index.full.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453
  1. /*! Element Plus v2.2.25 */
  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. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  8. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  9. var root = freeGlobal || freeSelf || Function("return this")();
  10. var Symbol$1 = root.Symbol;
  11. var objectProto$s = Object.prototype;
  12. var hasOwnProperty$p = objectProto$s.hasOwnProperty;
  13. var nativeObjectToString$3 = objectProto$s.toString;
  14. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
  15. function getRawTag(value) {
  16. var isOwn = hasOwnProperty$p.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  17. try {
  18. value[symToStringTag$1] = void 0;
  19. var unmasked = true;
  20. } catch (e) {
  21. }
  22. var result = nativeObjectToString$3.call(value);
  23. if (unmasked) {
  24. if (isOwn) {
  25. value[symToStringTag$1] = tag;
  26. } else {
  27. delete value[symToStringTag$1];
  28. }
  29. }
  30. return result;
  31. }
  32. var objectProto$r = Object.prototype;
  33. var nativeObjectToString$2 = objectProto$r.toString;
  34. function objectToString$1(value) {
  35. return nativeObjectToString$2.call(value);
  36. }
  37. var nullTag = "[object Null]";
  38. var undefinedTag = "[object Undefined]";
  39. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
  40. function baseGetTag(value) {
  41. if (value == null) {
  42. return value === void 0 ? undefinedTag : nullTag;
  43. }
  44. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString$1(value);
  45. }
  46. function isObjectLike(value) {
  47. return value != null && typeof value == "object";
  48. }
  49. var symbolTag$3 = "[object Symbol]";
  50. function isSymbol(value) {
  51. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  52. }
  53. var NAN$2 = 0 / 0;
  54. function baseToNumber(value) {
  55. if (typeof value == "number") {
  56. return value;
  57. }
  58. if (isSymbol(value)) {
  59. return NAN$2;
  60. }
  61. return +value;
  62. }
  63. function arrayMap(array, iteratee) {
  64. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  65. while (++index < length) {
  66. result[index] = iteratee(array[index], index, array);
  67. }
  68. return result;
  69. }
  70. var isArray$1 = Array.isArray;
  71. var INFINITY$5 = 1 / 0;
  72. var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0;
  73. var symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  74. function baseToString(value) {
  75. if (typeof value == "string") {
  76. return value;
  77. }
  78. if (isArray$1(value)) {
  79. return arrayMap(value, baseToString) + "";
  80. }
  81. if (isSymbol(value)) {
  82. return symbolToString ? symbolToString.call(value) : "";
  83. }
  84. var result = value + "";
  85. return result == "0" && 1 / value == -INFINITY$5 ? "-0" : result;
  86. }
  87. function createMathOperation(operator, defaultValue) {
  88. return function(value, other) {
  89. var result;
  90. if (value === void 0 && other === void 0) {
  91. return defaultValue;
  92. }
  93. if (value !== void 0) {
  94. result = value;
  95. }
  96. if (other !== void 0) {
  97. if (result === void 0) {
  98. return other;
  99. }
  100. if (typeof value == "string" || typeof other == "string") {
  101. value = baseToString(value);
  102. other = baseToString(other);
  103. } else {
  104. value = baseToNumber(value);
  105. other = baseToNumber(other);
  106. }
  107. result = operator(value, other);
  108. }
  109. return result;
  110. };
  111. }
  112. var add = createMathOperation(function(augend, addend) {
  113. return augend + addend;
  114. }, 0);
  115. var reWhitespace = /\s/;
  116. function trimmedEndIndex(string) {
  117. var index = string.length;
  118. while (index-- && reWhitespace.test(string.charAt(index))) {
  119. }
  120. return index;
  121. }
  122. var reTrimStart$2 = /^\s+/;
  123. function baseTrim(string) {
  124. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart$2, "") : string;
  125. }
  126. function isObject$2(value) {
  127. var type = typeof value;
  128. return value != null && (type == "object" || type == "function");
  129. }
  130. var NAN$1 = 0 / 0;
  131. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  132. var reIsBinary = /^0b[01]+$/i;
  133. var reIsOctal = /^0o[0-7]+$/i;
  134. var freeParseInt = parseInt;
  135. function toNumber(value) {
  136. if (typeof value == "number") {
  137. return value;
  138. }
  139. if (isSymbol(value)) {
  140. return NAN$1;
  141. }
  142. if (isObject$2(value)) {
  143. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  144. value = isObject$2(other) ? other + "" : other;
  145. }
  146. if (typeof value != "string") {
  147. return value === 0 ? value : +value;
  148. }
  149. value = baseTrim(value);
  150. var isBinary = reIsBinary.test(value);
  151. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN$1 : +value;
  152. }
  153. var INFINITY$4 = 1 / 0;
  154. var MAX_INTEGER = 17976931348623157e292;
  155. function toFinite(value) {
  156. if (!value) {
  157. return value === 0 ? value : 0;
  158. }
  159. value = toNumber(value);
  160. if (value === INFINITY$4 || value === -INFINITY$4) {
  161. var sign = value < 0 ? -1 : 1;
  162. return sign * MAX_INTEGER;
  163. }
  164. return value === value ? value : 0;
  165. }
  166. function toInteger(value) {
  167. var result = toFinite(value), remainder = result % 1;
  168. return result === result ? remainder ? result - remainder : result : 0;
  169. }
  170. var FUNC_ERROR_TEXT$b = "Expected a function";
  171. function after(n, func) {
  172. if (typeof func != "function") {
  173. throw new TypeError(FUNC_ERROR_TEXT$b);
  174. }
  175. n = toInteger(n);
  176. return function() {
  177. if (--n < 1) {
  178. return func.apply(this, arguments);
  179. }
  180. };
  181. }
  182. function identity$1(value) {
  183. return value;
  184. }
  185. var asyncTag = "[object AsyncFunction]";
  186. var funcTag$2 = "[object Function]";
  187. var genTag$1 = "[object GeneratorFunction]";
  188. var proxyTag = "[object Proxy]";
  189. function isFunction$1(value) {
  190. if (!isObject$2(value)) {
  191. return false;
  192. }
  193. var tag = baseGetTag(value);
  194. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  195. }
  196. var coreJsData = root["__core-js_shared__"];
  197. var maskSrcKey = function() {
  198. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  199. return uid ? "Symbol(src)_1." + uid : "";
  200. }();
  201. function isMasked(func) {
  202. return !!maskSrcKey && maskSrcKey in func;
  203. }
  204. var funcProto$2 = Function.prototype;
  205. var funcToString$2 = funcProto$2.toString;
  206. function toSource(func) {
  207. if (func != null) {
  208. try {
  209. return funcToString$2.call(func);
  210. } catch (e) {
  211. }
  212. try {
  213. return func + "";
  214. } catch (e) {
  215. }
  216. }
  217. return "";
  218. }
  219. var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
  220. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  221. var funcProto$1 = Function.prototype;
  222. var objectProto$q = Object.prototype;
  223. var funcToString$1 = funcProto$1.toString;
  224. var hasOwnProperty$o = objectProto$q.hasOwnProperty;
  225. var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$o).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  226. function baseIsNative(value) {
  227. if (!isObject$2(value) || isMasked(value)) {
  228. return false;
  229. }
  230. var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
  231. return pattern.test(toSource(value));
  232. }
  233. function getValue$1(object, key) {
  234. return object == null ? void 0 : object[key];
  235. }
  236. function getNative(object, key) {
  237. var value = getValue$1(object, key);
  238. return baseIsNative(value) ? value : void 0;
  239. }
  240. var WeakMap = getNative(root, "WeakMap");
  241. var metaMap = WeakMap && new WeakMap();
  242. var baseSetData = !metaMap ? identity$1 : function(func, data) {
  243. metaMap.set(func, data);
  244. return func;
  245. };
  246. var objectCreate = Object.create;
  247. var baseCreate = function() {
  248. function object() {
  249. }
  250. return function(proto) {
  251. if (!isObject$2(proto)) {
  252. return {};
  253. }
  254. if (objectCreate) {
  255. return objectCreate(proto);
  256. }
  257. object.prototype = proto;
  258. var result = new object();
  259. object.prototype = void 0;
  260. return result;
  261. };
  262. }();
  263. function createCtor(Ctor) {
  264. return function() {
  265. var args = arguments;
  266. switch (args.length) {
  267. case 0:
  268. return new Ctor();
  269. case 1:
  270. return new Ctor(args[0]);
  271. case 2:
  272. return new Ctor(args[0], args[1]);
  273. case 3:
  274. return new Ctor(args[0], args[1], args[2]);
  275. case 4:
  276. return new Ctor(args[0], args[1], args[2], args[3]);
  277. case 5:
  278. return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  279. case 6:
  280. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  281. case 7:
  282. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  283. }
  284. var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args);
  285. return isObject$2(result) ? result : thisBinding;
  286. };
  287. }
  288. var WRAP_BIND_FLAG$8 = 1;
  289. function createBind(func, bitmask, thisArg) {
  290. var isBind = bitmask & WRAP_BIND_FLAG$8, Ctor = createCtor(func);
  291. function wrapper() {
  292. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  293. return fn.apply(isBind ? thisArg : this, arguments);
  294. }
  295. return wrapper;
  296. }
  297. function apply(func, thisArg, args) {
  298. switch (args.length) {
  299. case 0:
  300. return func.call(thisArg);
  301. case 1:
  302. return func.call(thisArg, args[0]);
  303. case 2:
  304. return func.call(thisArg, args[0], args[1]);
  305. case 3:
  306. return func.call(thisArg, args[0], args[1], args[2]);
  307. }
  308. return func.apply(thisArg, args);
  309. }
  310. var nativeMax$g = Math.max;
  311. function composeArgs(args, partials, holders, isCurried) {
  312. 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;
  313. while (++leftIndex < leftLength) {
  314. result[leftIndex] = partials[leftIndex];
  315. }
  316. while (++argsIndex < holdersLength) {
  317. if (isUncurried || argsIndex < argsLength) {
  318. result[holders[argsIndex]] = args[argsIndex];
  319. }
  320. }
  321. while (rangeLength--) {
  322. result[leftIndex++] = args[argsIndex++];
  323. }
  324. return result;
  325. }
  326. var nativeMax$f = Math.max;
  327. function composeArgsRight(args, partials, holders, isCurried) {
  328. 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;
  329. while (++argsIndex < rangeLength) {
  330. result[argsIndex] = args[argsIndex];
  331. }
  332. var offset = argsIndex;
  333. while (++rightIndex < rightLength) {
  334. result[offset + rightIndex] = partials[rightIndex];
  335. }
  336. while (++holdersIndex < holdersLength) {
  337. if (isUncurried || argsIndex < argsLength) {
  338. result[offset + holders[holdersIndex]] = args[argsIndex++];
  339. }
  340. }
  341. return result;
  342. }
  343. function countHolders(array, placeholder) {
  344. var length = array.length, result = 0;
  345. while (length--) {
  346. if (array[length] === placeholder) {
  347. ++result;
  348. }
  349. }
  350. return result;
  351. }
  352. function baseLodash() {
  353. }
  354. var MAX_ARRAY_LENGTH$6 = 4294967295;
  355. function LazyWrapper(value) {
  356. this.__wrapped__ = value;
  357. this.__actions__ = [];
  358. this.__dir__ = 1;
  359. this.__filtered__ = false;
  360. this.__iteratees__ = [];
  361. this.__takeCount__ = MAX_ARRAY_LENGTH$6;
  362. this.__views__ = [];
  363. }
  364. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  365. LazyWrapper.prototype.constructor = LazyWrapper;
  366. function noop$1() {
  367. }
  368. var getData = !metaMap ? noop$1 : function(func) {
  369. return metaMap.get(func);
  370. };
  371. var realNames = {};
  372. var objectProto$p = Object.prototype;
  373. var hasOwnProperty$n = objectProto$p.hasOwnProperty;
  374. function getFuncName(func) {
  375. var result = func.name + "", array = realNames[result], length = hasOwnProperty$n.call(realNames, result) ? array.length : 0;
  376. while (length--) {
  377. var data = array[length], otherFunc = data.func;
  378. if (otherFunc == null || otherFunc == func) {
  379. return data.name;
  380. }
  381. }
  382. return result;
  383. }
  384. function LodashWrapper(value, chainAll) {
  385. this.__wrapped__ = value;
  386. this.__actions__ = [];
  387. this.__chain__ = !!chainAll;
  388. this.__index__ = 0;
  389. this.__values__ = void 0;
  390. }
  391. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  392. LodashWrapper.prototype.constructor = LodashWrapper;
  393. function copyArray(source, array) {
  394. var index = -1, length = source.length;
  395. array || (array = Array(length));
  396. while (++index < length) {
  397. array[index] = source[index];
  398. }
  399. return array;
  400. }
  401. function wrapperClone(wrapper) {
  402. if (wrapper instanceof LazyWrapper) {
  403. return wrapper.clone();
  404. }
  405. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  406. result.__actions__ = copyArray(wrapper.__actions__);
  407. result.__index__ = wrapper.__index__;
  408. result.__values__ = wrapper.__values__;
  409. return result;
  410. }
  411. var objectProto$o = Object.prototype;
  412. var hasOwnProperty$m = objectProto$o.hasOwnProperty;
  413. function lodash(value) {
  414. if (isObjectLike(value) && !isArray$1(value) && !(value instanceof LazyWrapper)) {
  415. if (value instanceof LodashWrapper) {
  416. return value;
  417. }
  418. if (hasOwnProperty$m.call(value, "__wrapped__")) {
  419. return wrapperClone(value);
  420. }
  421. }
  422. return new LodashWrapper(value);
  423. }
  424. lodash.prototype = baseLodash.prototype;
  425. lodash.prototype.constructor = lodash;
  426. function isLaziable(func) {
  427. var funcName = getFuncName(func), other = lodash[funcName];
  428. if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
  429. return false;
  430. }
  431. if (func === other) {
  432. return true;
  433. }
  434. var data = getData(other);
  435. return !!data && func === data[0];
  436. }
  437. var HOT_COUNT = 800;
  438. var HOT_SPAN = 16;
  439. var nativeNow = Date.now;
  440. function shortOut(func) {
  441. var count = 0, lastCalled = 0;
  442. return function() {
  443. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  444. lastCalled = stamp;
  445. if (remaining > 0) {
  446. if (++count >= HOT_COUNT) {
  447. return arguments[0];
  448. }
  449. } else {
  450. count = 0;
  451. }
  452. return func.apply(void 0, arguments);
  453. };
  454. }
  455. var setData = shortOut(baseSetData);
  456. var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
  457. var reSplitDetails = /,? & /;
  458. function getWrapDetails(source) {
  459. var match = source.match(reWrapDetails);
  460. return match ? match[1].split(reSplitDetails) : [];
  461. }
  462. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
  463. function insertWrapDetails(source, details) {
  464. var length = details.length;
  465. if (!length) {
  466. return source;
  467. }
  468. var lastIndex = length - 1;
  469. details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
  470. details = details.join(length > 2 ? ", " : " ");
  471. return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
  472. }
  473. function constant(value) {
  474. return function() {
  475. return value;
  476. };
  477. }
  478. var defineProperty = function() {
  479. try {
  480. var func = getNative(Object, "defineProperty");
  481. func({}, "", {});
  482. return func;
  483. } catch (e) {
  484. }
  485. }();
  486. var baseSetToString = !defineProperty ? identity$1 : function(func, string) {
  487. return defineProperty(func, "toString", {
  488. "configurable": true,
  489. "enumerable": false,
  490. "value": constant(string),
  491. "writable": true
  492. });
  493. };
  494. var setToString = shortOut(baseSetToString);
  495. function arrayEach(array, iteratee) {
  496. var index = -1, length = array == null ? 0 : array.length;
  497. while (++index < length) {
  498. if (iteratee(array[index], index, array) === false) {
  499. break;
  500. }
  501. }
  502. return array;
  503. }
  504. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  505. var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  506. while (fromRight ? index-- : ++index < length) {
  507. if (predicate(array[index], index, array)) {
  508. return index;
  509. }
  510. }
  511. return -1;
  512. }
  513. function baseIsNaN(value) {
  514. return value !== value;
  515. }
  516. function strictIndexOf(array, value, fromIndex) {
  517. var index = fromIndex - 1, length = array.length;
  518. while (++index < length) {
  519. if (array[index] === value) {
  520. return index;
  521. }
  522. }
  523. return -1;
  524. }
  525. function baseIndexOf(array, value, fromIndex) {
  526. return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
  527. }
  528. function arrayIncludes(array, value) {
  529. var length = array == null ? 0 : array.length;
  530. return !!length && baseIndexOf(array, value, 0) > -1;
  531. }
  532. var WRAP_BIND_FLAG$7 = 1;
  533. var WRAP_BIND_KEY_FLAG$6 = 2;
  534. var WRAP_CURRY_FLAG$6 = 8;
  535. var WRAP_CURRY_RIGHT_FLAG$3 = 16;
  536. var WRAP_PARTIAL_FLAG$6 = 32;
  537. var WRAP_PARTIAL_RIGHT_FLAG$3 = 64;
  538. var WRAP_ARY_FLAG$4 = 128;
  539. var WRAP_REARG_FLAG$3 = 256;
  540. var WRAP_FLIP_FLAG$2 = 512;
  541. var wrapFlags = [
  542. ["ary", WRAP_ARY_FLAG$4],
  543. ["bind", WRAP_BIND_FLAG$7],
  544. ["bindKey", WRAP_BIND_KEY_FLAG$6],
  545. ["curry", WRAP_CURRY_FLAG$6],
  546. ["curryRight", WRAP_CURRY_RIGHT_FLAG$3],
  547. ["flip", WRAP_FLIP_FLAG$2],
  548. ["partial", WRAP_PARTIAL_FLAG$6],
  549. ["partialRight", WRAP_PARTIAL_RIGHT_FLAG$3],
  550. ["rearg", WRAP_REARG_FLAG$3]
  551. ];
  552. function updateWrapDetails(details, bitmask) {
  553. arrayEach(wrapFlags, function(pair) {
  554. var value = "_." + pair[0];
  555. if (bitmask & pair[1] && !arrayIncludes(details, value)) {
  556. details.push(value);
  557. }
  558. });
  559. return details.sort();
  560. }
  561. function setWrapToString(wrapper, reference, bitmask) {
  562. var source = reference + "";
  563. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  564. }
  565. var WRAP_BIND_FLAG$6 = 1;
  566. var WRAP_BIND_KEY_FLAG$5 = 2;
  567. var WRAP_CURRY_BOUND_FLAG$1 = 4;
  568. var WRAP_CURRY_FLAG$5 = 8;
  569. var WRAP_PARTIAL_FLAG$5 = 32;
  570. var WRAP_PARTIAL_RIGHT_FLAG$2 = 64;
  571. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  572. 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;
  573. bitmask |= isCurry ? WRAP_PARTIAL_FLAG$5 : WRAP_PARTIAL_RIGHT_FLAG$2;
  574. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$5);
  575. if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) {
  576. bitmask &= ~(WRAP_BIND_FLAG$6 | WRAP_BIND_KEY_FLAG$5);
  577. }
  578. var newData = [
  579. func,
  580. bitmask,
  581. thisArg,
  582. newPartials,
  583. newHolders,
  584. newPartialsRight,
  585. newHoldersRight,
  586. argPos,
  587. ary,
  588. arity
  589. ];
  590. var result = wrapFunc.apply(void 0, newData);
  591. if (isLaziable(func)) {
  592. setData(result, newData);
  593. }
  594. result.placeholder = placeholder;
  595. return setWrapToString(result, func, bitmask);
  596. }
  597. function getHolder(func) {
  598. var object = func;
  599. return object.placeholder;
  600. }
  601. var MAX_SAFE_INTEGER$5 = 9007199254740991;
  602. var reIsUint = /^(?:0|[1-9]\d*)$/;
  603. function isIndex(value, length) {
  604. var type = typeof value;
  605. length = length == null ? MAX_SAFE_INTEGER$5 : length;
  606. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  607. }
  608. var nativeMin$e = Math.min;
  609. function reorder(array, indexes) {
  610. var arrLength = array.length, length = nativeMin$e(indexes.length, arrLength), oldArray = copyArray(array);
  611. while (length--) {
  612. var index = indexes[length];
  613. array[length] = isIndex(index, arrLength) ? oldArray[index] : void 0;
  614. }
  615. return array;
  616. }
  617. var PLACEHOLDER$1 = "__lodash_placeholder__";
  618. function replaceHolders(array, placeholder) {
  619. var index = -1, length = array.length, resIndex = 0, result = [];
  620. while (++index < length) {
  621. var value = array[index];
  622. if (value === placeholder || value === PLACEHOLDER$1) {
  623. array[index] = PLACEHOLDER$1;
  624. result[resIndex++] = index;
  625. }
  626. }
  627. return result;
  628. }
  629. var WRAP_BIND_FLAG$5 = 1;
  630. var WRAP_BIND_KEY_FLAG$4 = 2;
  631. var WRAP_CURRY_FLAG$4 = 8;
  632. var WRAP_CURRY_RIGHT_FLAG$2 = 16;
  633. var WRAP_ARY_FLAG$3 = 128;
  634. var WRAP_FLIP_FLAG$1 = 512;
  635. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  636. 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);
  637. function wrapper() {
  638. var length = arguments.length, args = Array(length), index = length;
  639. while (index--) {
  640. args[index] = arguments[index];
  641. }
  642. if (isCurried) {
  643. var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
  644. }
  645. if (partials) {
  646. args = composeArgs(args, partials, holders, isCurried);
  647. }
  648. if (partialsRight) {
  649. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  650. }
  651. length -= holdersCount;
  652. if (isCurried && length < arity) {
  653. var newHolders = replaceHolders(args, placeholder);
  654. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length);
  655. }
  656. var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
  657. length = args.length;
  658. if (argPos) {
  659. args = reorder(args, argPos);
  660. } else if (isFlip && length > 1) {
  661. args.reverse();
  662. }
  663. if (isAry && ary < length) {
  664. args.length = ary;
  665. }
  666. if (this && this !== root && this instanceof wrapper) {
  667. fn = Ctor || createCtor(fn);
  668. }
  669. return fn.apply(thisBinding, args);
  670. }
  671. return wrapper;
  672. }
  673. function createCurry(func, bitmask, arity) {
  674. var Ctor = createCtor(func);
  675. function wrapper() {
  676. var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper);
  677. while (index--) {
  678. args[index] = arguments[index];
  679. }
  680. var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
  681. length -= holders.length;
  682. if (length < arity) {
  683. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, void 0, args, holders, void 0, void 0, arity - length);
  684. }
  685. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  686. return apply(fn, this, args);
  687. }
  688. return wrapper;
  689. }
  690. var WRAP_BIND_FLAG$4 = 1;
  691. function createPartial(func, bitmask, thisArg, partials) {
  692. var isBind = bitmask & WRAP_BIND_FLAG$4, Ctor = createCtor(func);
  693. function wrapper() {
  694. var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  695. while (++leftIndex < leftLength) {
  696. args[leftIndex] = partials[leftIndex];
  697. }
  698. while (argsLength--) {
  699. args[leftIndex++] = arguments[++argsIndex];
  700. }
  701. return apply(fn, isBind ? thisArg : this, args);
  702. }
  703. return wrapper;
  704. }
  705. var PLACEHOLDER = "__lodash_placeholder__";
  706. var WRAP_BIND_FLAG$3 = 1;
  707. var WRAP_BIND_KEY_FLAG$3 = 2;
  708. var WRAP_CURRY_BOUND_FLAG = 4;
  709. var WRAP_CURRY_FLAG$3 = 8;
  710. var WRAP_ARY_FLAG$2 = 128;
  711. var WRAP_REARG_FLAG$2 = 256;
  712. var nativeMin$d = Math.min;
  713. function mergeData(data, source) {
  714. 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);
  715. 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;
  716. if (!(isCommon || isCombo)) {
  717. return data;
  718. }
  719. if (srcBitmask & WRAP_BIND_FLAG$3) {
  720. data[2] = source[2];
  721. newBitmask |= bitmask & WRAP_BIND_FLAG$3 ? 0 : WRAP_CURRY_BOUND_FLAG;
  722. }
  723. var value = source[3];
  724. if (value) {
  725. var partials = data[3];
  726. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  727. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  728. }
  729. value = source[5];
  730. if (value) {
  731. partials = data[5];
  732. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  733. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  734. }
  735. value = source[7];
  736. if (value) {
  737. data[7] = value;
  738. }
  739. if (srcBitmask & WRAP_ARY_FLAG$2) {
  740. data[8] = data[8] == null ? source[8] : nativeMin$d(data[8], source[8]);
  741. }
  742. if (data[9] == null) {
  743. data[9] = source[9];
  744. }
  745. data[0] = source[0];
  746. data[1] = newBitmask;
  747. return data;
  748. }
  749. var FUNC_ERROR_TEXT$a = "Expected a function";
  750. var WRAP_BIND_FLAG$2 = 1;
  751. var WRAP_BIND_KEY_FLAG$2 = 2;
  752. var WRAP_CURRY_FLAG$2 = 8;
  753. var WRAP_CURRY_RIGHT_FLAG$1 = 16;
  754. var WRAP_PARTIAL_FLAG$4 = 32;
  755. var WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
  756. var nativeMax$e = Math.max;
  757. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  758. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2;
  759. if (!isBindKey && typeof func != "function") {
  760. throw new TypeError(FUNC_ERROR_TEXT$a);
  761. }
  762. var length = partials ? partials.length : 0;
  763. if (!length) {
  764. bitmask &= ~(WRAP_PARTIAL_FLAG$4 | WRAP_PARTIAL_RIGHT_FLAG$1);
  765. partials = holders = void 0;
  766. }
  767. ary = ary === void 0 ? ary : nativeMax$e(toInteger(ary), 0);
  768. arity = arity === void 0 ? arity : toInteger(arity);
  769. length -= holders ? holders.length : 0;
  770. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$1) {
  771. var partialsRight = partials, holdersRight = holders;
  772. partials = holders = void 0;
  773. }
  774. var data = isBindKey ? void 0 : getData(func);
  775. var newData = [
  776. func,
  777. bitmask,
  778. thisArg,
  779. partials,
  780. holders,
  781. partialsRight,
  782. holdersRight,
  783. argPos,
  784. ary,
  785. arity
  786. ];
  787. if (data) {
  788. mergeData(newData, data);
  789. }
  790. func = newData[0];
  791. bitmask = newData[1];
  792. thisArg = newData[2];
  793. partials = newData[3];
  794. holders = newData[4];
  795. arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax$e(newData[9] - length, 0);
  796. if (!arity && bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1)) {
  797. bitmask &= ~(WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1);
  798. }
  799. if (!bitmask || bitmask == WRAP_BIND_FLAG$2) {
  800. var result = createBind(func, bitmask, thisArg);
  801. } else if (bitmask == WRAP_CURRY_FLAG$2 || bitmask == WRAP_CURRY_RIGHT_FLAG$1) {
  802. result = createCurry(func, bitmask, arity);
  803. } else if ((bitmask == WRAP_PARTIAL_FLAG$4 || bitmask == (WRAP_BIND_FLAG$2 | WRAP_PARTIAL_FLAG$4)) && !holders.length) {
  804. result = createPartial(func, bitmask, thisArg, partials);
  805. } else {
  806. result = createHybrid.apply(void 0, newData);
  807. }
  808. var setter = data ? baseSetData : setData;
  809. return setWrapToString(setter(result, newData), func, bitmask);
  810. }
  811. var WRAP_ARY_FLAG$1 = 128;
  812. function ary(func, n, guard) {
  813. n = guard ? void 0 : n;
  814. n = func && n == null ? func.length : n;
  815. return createWrap(func, WRAP_ARY_FLAG$1, void 0, void 0, void 0, void 0, n);
  816. }
  817. function baseAssignValue(object, key, value) {
  818. if (key == "__proto__" && defineProperty) {
  819. defineProperty(object, key, {
  820. "configurable": true,
  821. "enumerable": true,
  822. "value": value,
  823. "writable": true
  824. });
  825. } else {
  826. object[key] = value;
  827. }
  828. }
  829. function eq(value, other) {
  830. return value === other || value !== value && other !== other;
  831. }
  832. var objectProto$n = Object.prototype;
  833. var hasOwnProperty$l = objectProto$n.hasOwnProperty;
  834. function assignValue(object, key, value) {
  835. var objValue = object[key];
  836. if (!(hasOwnProperty$l.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
  837. baseAssignValue(object, key, value);
  838. }
  839. }
  840. function copyObject(source, props, object, customizer) {
  841. var isNew = !object;
  842. object || (object = {});
  843. var index = -1, length = props.length;
  844. while (++index < length) {
  845. var key = props[index];
  846. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  847. if (newValue === void 0) {
  848. newValue = source[key];
  849. }
  850. if (isNew) {
  851. baseAssignValue(object, key, newValue);
  852. } else {
  853. assignValue(object, key, newValue);
  854. }
  855. }
  856. return object;
  857. }
  858. var nativeMax$d = Math.max;
  859. function overRest(func, start, transform) {
  860. start = nativeMax$d(start === void 0 ? func.length - 1 : start, 0);
  861. return function() {
  862. var args = arguments, index = -1, length = nativeMax$d(args.length - start, 0), array = Array(length);
  863. while (++index < length) {
  864. array[index] = args[start + index];
  865. }
  866. index = -1;
  867. var otherArgs = Array(start + 1);
  868. while (++index < start) {
  869. otherArgs[index] = args[index];
  870. }
  871. otherArgs[start] = transform(array);
  872. return apply(func, this, otherArgs);
  873. };
  874. }
  875. function baseRest(func, start) {
  876. return setToString(overRest(func, start, identity$1), func + "");
  877. }
  878. var MAX_SAFE_INTEGER$4 = 9007199254740991;
  879. function isLength(value) {
  880. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4;
  881. }
  882. function isArrayLike(value) {
  883. return value != null && isLength(value.length) && !isFunction$1(value);
  884. }
  885. function isIterateeCall(value, index, object) {
  886. if (!isObject$2(object)) {
  887. return false;
  888. }
  889. var type = typeof index;
  890. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
  891. return eq(object[index], value);
  892. }
  893. return false;
  894. }
  895. function createAssigner(assigner) {
  896. return baseRest(function(object, sources) {
  897. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  898. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  899. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  900. customizer = length < 3 ? void 0 : customizer;
  901. length = 1;
  902. }
  903. object = Object(object);
  904. while (++index < length) {
  905. var source = sources[index];
  906. if (source) {
  907. assigner(object, source, index, customizer);
  908. }
  909. }
  910. return object;
  911. });
  912. }
  913. var objectProto$m = Object.prototype;
  914. function isPrototype(value) {
  915. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m;
  916. return value === proto;
  917. }
  918. function baseTimes(n, iteratee) {
  919. var index = -1, result = Array(n);
  920. while (++index < n) {
  921. result[index] = iteratee(index);
  922. }
  923. return result;
  924. }
  925. var argsTag$3 = "[object Arguments]";
  926. function baseIsArguments(value) {
  927. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  928. }
  929. var objectProto$l = Object.prototype;
  930. var hasOwnProperty$k = objectProto$l.hasOwnProperty;
  931. var propertyIsEnumerable$1 = objectProto$l.propertyIsEnumerable;
  932. var isArguments = baseIsArguments(function() {
  933. return arguments;
  934. }()) ? baseIsArguments : function(value) {
  935. return isObjectLike(value) && hasOwnProperty$k.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  936. };
  937. function stubFalse() {
  938. return false;
  939. }
  940. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  941. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  942. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  943. var Buffer$1 = moduleExports$2 ? root.Buffer : void 0;
  944. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  945. var isBuffer = nativeIsBuffer || stubFalse;
  946. var argsTag$2 = "[object Arguments]";
  947. var arrayTag$2 = "[object Array]";
  948. var boolTag$4 = "[object Boolean]";
  949. var dateTag$4 = "[object Date]";
  950. var errorTag$3 = "[object Error]";
  951. var funcTag$1 = "[object Function]";
  952. var mapTag$9 = "[object Map]";
  953. var numberTag$4 = "[object Number]";
  954. var objectTag$4 = "[object Object]";
  955. var regexpTag$4 = "[object RegExp]";
  956. var setTag$9 = "[object Set]";
  957. var stringTag$4 = "[object String]";
  958. var weakMapTag$3 = "[object WeakMap]";
  959. var arrayBufferTag$4 = "[object ArrayBuffer]";
  960. var dataViewTag$4 = "[object DataView]";
  961. var float32Tag$2 = "[object Float32Array]";
  962. var float64Tag$2 = "[object Float64Array]";
  963. var int8Tag$2 = "[object Int8Array]";
  964. var int16Tag$2 = "[object Int16Array]";
  965. var int32Tag$2 = "[object Int32Array]";
  966. var uint8Tag$2 = "[object Uint8Array]";
  967. var uint8ClampedTag$2 = "[object Uint8ClampedArray]";
  968. var uint16Tag$2 = "[object Uint16Array]";
  969. var uint32Tag$2 = "[object Uint32Array]";
  970. var typedArrayTags = {};
  971. 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;
  972. 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;
  973. function baseIsTypedArray(value) {
  974. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  975. }
  976. function baseUnary(func) {
  977. return function(value) {
  978. return func(value);
  979. };
  980. }
  981. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  982. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  983. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  984. var freeProcess = moduleExports$1 && freeGlobal.process;
  985. var nodeUtil = function() {
  986. try {
  987. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  988. if (types) {
  989. return types;
  990. }
  991. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  992. } catch (e) {
  993. }
  994. }();
  995. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  996. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  997. var objectProto$k = Object.prototype;
  998. var hasOwnProperty$j = objectProto$k.hasOwnProperty;
  999. function arrayLikeKeys(value, inherited) {
  1000. var isArr = isArray$1(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;
  1001. for (var key in value) {
  1002. if ((inherited || hasOwnProperty$j.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  1003. result.push(key);
  1004. }
  1005. }
  1006. return result;
  1007. }
  1008. function overArg(func, transform) {
  1009. return function(arg) {
  1010. return func(transform(arg));
  1011. };
  1012. }
  1013. var nativeKeys = overArg(Object.keys, Object);
  1014. var objectProto$j = Object.prototype;
  1015. var hasOwnProperty$i = objectProto$j.hasOwnProperty;
  1016. function baseKeys(object) {
  1017. if (!isPrototype(object)) {
  1018. return nativeKeys(object);
  1019. }
  1020. var result = [];
  1021. for (var key in Object(object)) {
  1022. if (hasOwnProperty$i.call(object, key) && key != "constructor") {
  1023. result.push(key);
  1024. }
  1025. }
  1026. return result;
  1027. }
  1028. function keys(object) {
  1029. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  1030. }
  1031. var objectProto$i = Object.prototype;
  1032. var hasOwnProperty$h = objectProto$i.hasOwnProperty;
  1033. var assign = createAssigner(function(object, source) {
  1034. if (isPrototype(source) || isArrayLike(source)) {
  1035. copyObject(source, keys(source), object);
  1036. return;
  1037. }
  1038. for (var key in source) {
  1039. if (hasOwnProperty$h.call(source, key)) {
  1040. assignValue(object, key, source[key]);
  1041. }
  1042. }
  1043. });
  1044. function nativeKeysIn(object) {
  1045. var result = [];
  1046. if (object != null) {
  1047. for (var key in Object(object)) {
  1048. result.push(key);
  1049. }
  1050. }
  1051. return result;
  1052. }
  1053. var objectProto$h = Object.prototype;
  1054. var hasOwnProperty$g = objectProto$h.hasOwnProperty;
  1055. function baseKeysIn(object) {
  1056. if (!isObject$2(object)) {
  1057. return nativeKeysIn(object);
  1058. }
  1059. var isProto = isPrototype(object), result = [];
  1060. for (var key in object) {
  1061. if (!(key == "constructor" && (isProto || !hasOwnProperty$g.call(object, key)))) {
  1062. result.push(key);
  1063. }
  1064. }
  1065. return result;
  1066. }
  1067. function keysIn(object) {
  1068. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  1069. }
  1070. var assignIn = createAssigner(function(object, source) {
  1071. copyObject(source, keysIn(source), object);
  1072. });
  1073. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  1074. copyObject(source, keysIn(source), object, customizer);
  1075. });
  1076. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  1077. copyObject(source, keys(source), object, customizer);
  1078. });
  1079. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
  1080. var reIsPlainProp = /^\w*$/;
  1081. function isKey(value, object) {
  1082. if (isArray$1(value)) {
  1083. return false;
  1084. }
  1085. var type = typeof value;
  1086. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
  1087. return true;
  1088. }
  1089. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  1090. }
  1091. var nativeCreate = getNative(Object, "create");
  1092. function hashClear() {
  1093. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1094. this.size = 0;
  1095. }
  1096. function hashDelete(key) {
  1097. var result = this.has(key) && delete this.__data__[key];
  1098. this.size -= result ? 1 : 0;
  1099. return result;
  1100. }
  1101. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  1102. var objectProto$g = Object.prototype;
  1103. var hasOwnProperty$f = objectProto$g.hasOwnProperty;
  1104. function hashGet(key) {
  1105. var data = this.__data__;
  1106. if (nativeCreate) {
  1107. var result = data[key];
  1108. return result === HASH_UNDEFINED$2 ? void 0 : result;
  1109. }
  1110. return hasOwnProperty$f.call(data, key) ? data[key] : void 0;
  1111. }
  1112. var objectProto$f = Object.prototype;
  1113. var hasOwnProperty$e = objectProto$f.hasOwnProperty;
  1114. function hashHas(key) {
  1115. var data = this.__data__;
  1116. return nativeCreate ? data[key] !== void 0 : hasOwnProperty$e.call(data, key);
  1117. }
  1118. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  1119. function hashSet(key, value) {
  1120. var data = this.__data__;
  1121. this.size += this.has(key) ? 0 : 1;
  1122. data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
  1123. return this;
  1124. }
  1125. function Hash(entries) {
  1126. var index = -1, length = entries == null ? 0 : entries.length;
  1127. this.clear();
  1128. while (++index < length) {
  1129. var entry = entries[index];
  1130. this.set(entry[0], entry[1]);
  1131. }
  1132. }
  1133. Hash.prototype.clear = hashClear;
  1134. Hash.prototype["delete"] = hashDelete;
  1135. Hash.prototype.get = hashGet;
  1136. Hash.prototype.has = hashHas;
  1137. Hash.prototype.set = hashSet;
  1138. function listCacheClear() {
  1139. this.__data__ = [];
  1140. this.size = 0;
  1141. }
  1142. function assocIndexOf(array, key) {
  1143. var length = array.length;
  1144. while (length--) {
  1145. if (eq(array[length][0], key)) {
  1146. return length;
  1147. }
  1148. }
  1149. return -1;
  1150. }
  1151. var arrayProto$5 = Array.prototype;
  1152. var splice$2 = arrayProto$5.splice;
  1153. function listCacheDelete(key) {
  1154. var data = this.__data__, index = assocIndexOf(data, key);
  1155. if (index < 0) {
  1156. return false;
  1157. }
  1158. var lastIndex = data.length - 1;
  1159. if (index == lastIndex) {
  1160. data.pop();
  1161. } else {
  1162. splice$2.call(data, index, 1);
  1163. }
  1164. --this.size;
  1165. return true;
  1166. }
  1167. function listCacheGet(key) {
  1168. var data = this.__data__, index = assocIndexOf(data, key);
  1169. return index < 0 ? void 0 : data[index][1];
  1170. }
  1171. function listCacheHas(key) {
  1172. return assocIndexOf(this.__data__, key) > -1;
  1173. }
  1174. function listCacheSet(key, value) {
  1175. var data = this.__data__, index = assocIndexOf(data, key);
  1176. if (index < 0) {
  1177. ++this.size;
  1178. data.push([key, value]);
  1179. } else {
  1180. data[index][1] = value;
  1181. }
  1182. return this;
  1183. }
  1184. function ListCache(entries) {
  1185. var index = -1, length = entries == null ? 0 : entries.length;
  1186. this.clear();
  1187. while (++index < length) {
  1188. var entry = entries[index];
  1189. this.set(entry[0], entry[1]);
  1190. }
  1191. }
  1192. ListCache.prototype.clear = listCacheClear;
  1193. ListCache.prototype["delete"] = listCacheDelete;
  1194. ListCache.prototype.get = listCacheGet;
  1195. ListCache.prototype.has = listCacheHas;
  1196. ListCache.prototype.set = listCacheSet;
  1197. var Map$1 = getNative(root, "Map");
  1198. function mapCacheClear() {
  1199. this.size = 0;
  1200. this.__data__ = {
  1201. "hash": new Hash(),
  1202. "map": new (Map$1 || ListCache)(),
  1203. "string": new Hash()
  1204. };
  1205. }
  1206. function isKeyable(value) {
  1207. var type = typeof value;
  1208. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  1209. }
  1210. function getMapData(map, key) {
  1211. var data = map.__data__;
  1212. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  1213. }
  1214. function mapCacheDelete(key) {
  1215. var result = getMapData(this, key)["delete"](key);
  1216. this.size -= result ? 1 : 0;
  1217. return result;
  1218. }
  1219. function mapCacheGet(key) {
  1220. return getMapData(this, key).get(key);
  1221. }
  1222. function mapCacheHas(key) {
  1223. return getMapData(this, key).has(key);
  1224. }
  1225. function mapCacheSet(key, value) {
  1226. var data = getMapData(this, key), size = data.size;
  1227. data.set(key, value);
  1228. this.size += data.size == size ? 0 : 1;
  1229. return this;
  1230. }
  1231. function MapCache(entries) {
  1232. var index = -1, length = entries == null ? 0 : entries.length;
  1233. this.clear();
  1234. while (++index < length) {
  1235. var entry = entries[index];
  1236. this.set(entry[0], entry[1]);
  1237. }
  1238. }
  1239. MapCache.prototype.clear = mapCacheClear;
  1240. MapCache.prototype["delete"] = mapCacheDelete;
  1241. MapCache.prototype.get = mapCacheGet;
  1242. MapCache.prototype.has = mapCacheHas;
  1243. MapCache.prototype.set = mapCacheSet;
  1244. var FUNC_ERROR_TEXT$9 = "Expected a function";
  1245. function memoize(func, resolver) {
  1246. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1247. throw new TypeError(FUNC_ERROR_TEXT$9);
  1248. }
  1249. var memoized = function() {
  1250. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  1251. if (cache.has(key)) {
  1252. return cache.get(key);
  1253. }
  1254. var result = func.apply(this, args);
  1255. memoized.cache = cache.set(key, result) || cache;
  1256. return result;
  1257. };
  1258. memoized.cache = new (memoize.Cache || MapCache)();
  1259. return memoized;
  1260. }
  1261. memoize.Cache = MapCache;
  1262. var MAX_MEMOIZE_SIZE = 500;
  1263. function memoizeCapped(func) {
  1264. var result = memoize(func, function(key) {
  1265. if (cache.size === MAX_MEMOIZE_SIZE) {
  1266. cache.clear();
  1267. }
  1268. return key;
  1269. });
  1270. var cache = result.cache;
  1271. return result;
  1272. }
  1273. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1274. var reEscapeChar = /\\(\\)?/g;
  1275. var stringToPath = memoizeCapped(function(string) {
  1276. var result = [];
  1277. if (string.charCodeAt(0) === 46) {
  1278. result.push("");
  1279. }
  1280. string.replace(rePropName, function(match, number, quote, subString) {
  1281. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  1282. });
  1283. return result;
  1284. });
  1285. function toString(value) {
  1286. return value == null ? "" : baseToString(value);
  1287. }
  1288. function castPath(value, object) {
  1289. if (isArray$1(value)) {
  1290. return value;
  1291. }
  1292. return isKey(value, object) ? [value] : stringToPath(toString(value));
  1293. }
  1294. var INFINITY$3 = 1 / 0;
  1295. function toKey(value) {
  1296. if (typeof value == "string" || isSymbol(value)) {
  1297. return value;
  1298. }
  1299. var result = value + "";
  1300. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  1301. }
  1302. function baseGet(object, path) {
  1303. path = castPath(path, object);
  1304. var index = 0, length = path.length;
  1305. while (object != null && index < length) {
  1306. object = object[toKey(path[index++])];
  1307. }
  1308. return index && index == length ? object : void 0;
  1309. }
  1310. function get(object, path, defaultValue) {
  1311. var result = object == null ? void 0 : baseGet(object, path);
  1312. return result === void 0 ? defaultValue : result;
  1313. }
  1314. function baseAt(object, paths) {
  1315. var index = -1, length = paths.length, result = Array(length), skip = object == null;
  1316. while (++index < length) {
  1317. result[index] = skip ? void 0 : get(object, paths[index]);
  1318. }
  1319. return result;
  1320. }
  1321. function arrayPush(array, values) {
  1322. var index = -1, length = values.length, offset = array.length;
  1323. while (++index < length) {
  1324. array[offset + index] = values[index];
  1325. }
  1326. return array;
  1327. }
  1328. var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
  1329. function isFlattenable(value) {
  1330. return isArray$1(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  1331. }
  1332. function baseFlatten(array, depth, predicate, isStrict, result) {
  1333. var index = -1, length = array.length;
  1334. predicate || (predicate = isFlattenable);
  1335. result || (result = []);
  1336. while (++index < length) {
  1337. var value = array[index];
  1338. if (depth > 0 && predicate(value)) {
  1339. if (depth > 1) {
  1340. baseFlatten(value, depth - 1, predicate, isStrict, result);
  1341. } else {
  1342. arrayPush(result, value);
  1343. }
  1344. } else if (!isStrict) {
  1345. result[result.length] = value;
  1346. }
  1347. }
  1348. return result;
  1349. }
  1350. function flatten(array) {
  1351. var length = array == null ? 0 : array.length;
  1352. return length ? baseFlatten(array, 1) : [];
  1353. }
  1354. function flatRest(func) {
  1355. return setToString(overRest(func, void 0, flatten), func + "");
  1356. }
  1357. var at$1 = flatRest(baseAt);
  1358. var getPrototype = overArg(Object.getPrototypeOf, Object);
  1359. var objectTag$3 = "[object Object]";
  1360. var funcProto = Function.prototype;
  1361. var objectProto$e = Object.prototype;
  1362. var funcToString = funcProto.toString;
  1363. var hasOwnProperty$d = objectProto$e.hasOwnProperty;
  1364. var objectCtorString = funcToString.call(Object);
  1365. function isPlainObject(value) {
  1366. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
  1367. return false;
  1368. }
  1369. var proto = getPrototype(value);
  1370. if (proto === null) {
  1371. return true;
  1372. }
  1373. var Ctor = hasOwnProperty$d.call(proto, "constructor") && proto.constructor;
  1374. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  1375. }
  1376. var domExcTag = "[object DOMException]";
  1377. var errorTag$2 = "[object Error]";
  1378. function isError(value) {
  1379. if (!isObjectLike(value)) {
  1380. return false;
  1381. }
  1382. var tag = baseGetTag(value);
  1383. return tag == errorTag$2 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
  1384. }
  1385. var attempt = baseRest(function(func, args) {
  1386. try {
  1387. return apply(func, void 0, args);
  1388. } catch (e) {
  1389. return isError(e) ? e : new Error(e);
  1390. }
  1391. });
  1392. var FUNC_ERROR_TEXT$8 = "Expected a function";
  1393. function before(n, func) {
  1394. var result;
  1395. if (typeof func != "function") {
  1396. throw new TypeError(FUNC_ERROR_TEXT$8);
  1397. }
  1398. n = toInteger(n);
  1399. return function() {
  1400. if (--n > 0) {
  1401. result = func.apply(this, arguments);
  1402. }
  1403. if (n <= 1) {
  1404. func = void 0;
  1405. }
  1406. return result;
  1407. };
  1408. }
  1409. var WRAP_BIND_FLAG$1 = 1;
  1410. var WRAP_PARTIAL_FLAG$3 = 32;
  1411. var bind = baseRest(function(func, thisArg, partials) {
  1412. var bitmask = WRAP_BIND_FLAG$1;
  1413. if (partials.length) {
  1414. var holders = replaceHolders(partials, getHolder(bind));
  1415. bitmask |= WRAP_PARTIAL_FLAG$3;
  1416. }
  1417. return createWrap(func, bitmask, thisArg, partials, holders);
  1418. });
  1419. bind.placeholder = {};
  1420. var bindAll = flatRest(function(object, methodNames) {
  1421. arrayEach(methodNames, function(key) {
  1422. key = toKey(key);
  1423. baseAssignValue(object, key, bind(object[key], object));
  1424. });
  1425. return object;
  1426. });
  1427. var WRAP_BIND_FLAG = 1;
  1428. var WRAP_BIND_KEY_FLAG$1 = 2;
  1429. var WRAP_PARTIAL_FLAG$2 = 32;
  1430. var bindKey = baseRest(function(object, key, partials) {
  1431. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG$1;
  1432. if (partials.length) {
  1433. var holders = replaceHolders(partials, getHolder(bindKey));
  1434. bitmask |= WRAP_PARTIAL_FLAG$2;
  1435. }
  1436. return createWrap(key, bitmask, object, partials, holders);
  1437. });
  1438. bindKey.placeholder = {};
  1439. function baseSlice(array, start, end) {
  1440. var index = -1, length = array.length;
  1441. if (start < 0) {
  1442. start = -start > length ? 0 : length + start;
  1443. }
  1444. end = end > length ? length : end;
  1445. if (end < 0) {
  1446. end += length;
  1447. }
  1448. length = start > end ? 0 : end - start >>> 0;
  1449. start >>>= 0;
  1450. var result = Array(length);
  1451. while (++index < length) {
  1452. result[index] = array[index + start];
  1453. }
  1454. return result;
  1455. }
  1456. function castSlice(array, start, end) {
  1457. var length = array.length;
  1458. end = end === void 0 ? length : end;
  1459. return !start && end >= length ? array : baseSlice(array, start, end);
  1460. }
  1461. var rsAstralRange$3 = "\\ud800-\\udfff";
  1462. var rsComboMarksRange$4 = "\\u0300-\\u036f";
  1463. var reComboHalfMarksRange$4 = "\\ufe20-\\ufe2f";
  1464. var rsComboSymbolsRange$4 = "\\u20d0-\\u20ff";
  1465. var rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4;
  1466. var rsVarRange$3 = "\\ufe0e\\ufe0f";
  1467. var rsZWJ$3 = "\\u200d";
  1468. var reHasUnicode = RegExp("[" + rsZWJ$3 + rsAstralRange$3 + rsComboRange$4 + rsVarRange$3 + "]");
  1469. function hasUnicode(string) {
  1470. return reHasUnicode.test(string);
  1471. }
  1472. function asciiToArray(string) {
  1473. return string.split("");
  1474. }
  1475. var rsAstralRange$2 = "\\ud800-\\udfff";
  1476. var rsComboMarksRange$3 = "\\u0300-\\u036f";
  1477. var reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f";
  1478. var rsComboSymbolsRange$3 = "\\u20d0-\\u20ff";
  1479. var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
  1480. var rsVarRange$2 = "\\ufe0e\\ufe0f";
  1481. var rsAstral$1 = "[" + rsAstralRange$2 + "]";
  1482. var rsCombo$3 = "[" + rsComboRange$3 + "]";
  1483. var rsFitz$2 = "\\ud83c[\\udffb-\\udfff]";
  1484. var rsModifier$2 = "(?:" + rsCombo$3 + "|" + rsFitz$2 + ")";
  1485. var rsNonAstral$2 = "[^" + rsAstralRange$2 + "]";
  1486. var rsRegional$2 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  1487. var rsSurrPair$2 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  1488. var rsZWJ$2 = "\\u200d";
  1489. var reOptMod$2 = rsModifier$2 + "?";
  1490. var rsOptVar$2 = "[" + rsVarRange$2 + "]?";
  1491. var rsOptJoin$2 = "(?:" + rsZWJ$2 + "(?:" + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join("|") + ")" + rsOptVar$2 + reOptMod$2 + ")*";
  1492. var rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2;
  1493. var rsSymbol$1 = "(?:" + [rsNonAstral$2 + rsCombo$3 + "?", rsCombo$3, rsRegional$2, rsSurrPair$2, rsAstral$1].join("|") + ")";
  1494. var reUnicode$1 = RegExp(rsFitz$2 + "(?=" + rsFitz$2 + ")|" + rsSymbol$1 + rsSeq$2, "g");
  1495. function unicodeToArray(string) {
  1496. return string.match(reUnicode$1) || [];
  1497. }
  1498. function stringToArray(string) {
  1499. return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
  1500. }
  1501. function createCaseFirst(methodName) {
  1502. return function(string) {
  1503. string = toString(string);
  1504. var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0;
  1505. var chr = strSymbols ? strSymbols[0] : string.charAt(0);
  1506. var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
  1507. return chr[methodName]() + trailing;
  1508. };
  1509. }
  1510. var upperFirst = createCaseFirst("toUpperCase");
  1511. function capitalize$2(string) {
  1512. return upperFirst(toString(string).toLowerCase());
  1513. }
  1514. function arrayReduce(array, iteratee, accumulator, initAccum) {
  1515. var index = -1, length = array == null ? 0 : array.length;
  1516. if (initAccum && length) {
  1517. accumulator = array[++index];
  1518. }
  1519. while (++index < length) {
  1520. accumulator = iteratee(accumulator, array[index], index, array);
  1521. }
  1522. return accumulator;
  1523. }
  1524. function basePropertyOf(object) {
  1525. return function(key) {
  1526. return object == null ? void 0 : object[key];
  1527. };
  1528. }
  1529. var deburredLetters = {
  1530. "\xC0": "A",
  1531. "\xC1": "A",
  1532. "\xC2": "A",
  1533. "\xC3": "A",
  1534. "\xC4": "A",
  1535. "\xC5": "A",
  1536. "\xE0": "a",
  1537. "\xE1": "a",
  1538. "\xE2": "a",
  1539. "\xE3": "a",
  1540. "\xE4": "a",
  1541. "\xE5": "a",
  1542. "\xC7": "C",
  1543. "\xE7": "c",
  1544. "\xD0": "D",
  1545. "\xF0": "d",
  1546. "\xC8": "E",
  1547. "\xC9": "E",
  1548. "\xCA": "E",
  1549. "\xCB": "E",
  1550. "\xE8": "e",
  1551. "\xE9": "e",
  1552. "\xEA": "e",
  1553. "\xEB": "e",
  1554. "\xCC": "I",
  1555. "\xCD": "I",
  1556. "\xCE": "I",
  1557. "\xCF": "I",
  1558. "\xEC": "i",
  1559. "\xED": "i",
  1560. "\xEE": "i",
  1561. "\xEF": "i",
  1562. "\xD1": "N",
  1563. "\xF1": "n",
  1564. "\xD2": "O",
  1565. "\xD3": "O",
  1566. "\xD4": "O",
  1567. "\xD5": "O",
  1568. "\xD6": "O",
  1569. "\xD8": "O",
  1570. "\xF2": "o",
  1571. "\xF3": "o",
  1572. "\xF4": "o",
  1573. "\xF5": "o",
  1574. "\xF6": "o",
  1575. "\xF8": "o",
  1576. "\xD9": "U",
  1577. "\xDA": "U",
  1578. "\xDB": "U",
  1579. "\xDC": "U",
  1580. "\xF9": "u",
  1581. "\xFA": "u",
  1582. "\xFB": "u",
  1583. "\xFC": "u",
  1584. "\xDD": "Y",
  1585. "\xFD": "y",
  1586. "\xFF": "y",
  1587. "\xC6": "Ae",
  1588. "\xE6": "ae",
  1589. "\xDE": "Th",
  1590. "\xFE": "th",
  1591. "\xDF": "ss",
  1592. "\u0100": "A",
  1593. "\u0102": "A",
  1594. "\u0104": "A",
  1595. "\u0101": "a",
  1596. "\u0103": "a",
  1597. "\u0105": "a",
  1598. "\u0106": "C",
  1599. "\u0108": "C",
  1600. "\u010A": "C",
  1601. "\u010C": "C",
  1602. "\u0107": "c",
  1603. "\u0109": "c",
  1604. "\u010B": "c",
  1605. "\u010D": "c",
  1606. "\u010E": "D",
  1607. "\u0110": "D",
  1608. "\u010F": "d",
  1609. "\u0111": "d",
  1610. "\u0112": "E",
  1611. "\u0114": "E",
  1612. "\u0116": "E",
  1613. "\u0118": "E",
  1614. "\u011A": "E",
  1615. "\u0113": "e",
  1616. "\u0115": "e",
  1617. "\u0117": "e",
  1618. "\u0119": "e",
  1619. "\u011B": "e",
  1620. "\u011C": "G",
  1621. "\u011E": "G",
  1622. "\u0120": "G",
  1623. "\u0122": "G",
  1624. "\u011D": "g",
  1625. "\u011F": "g",
  1626. "\u0121": "g",
  1627. "\u0123": "g",
  1628. "\u0124": "H",
  1629. "\u0126": "H",
  1630. "\u0125": "h",
  1631. "\u0127": "h",
  1632. "\u0128": "I",
  1633. "\u012A": "I",
  1634. "\u012C": "I",
  1635. "\u012E": "I",
  1636. "\u0130": "I",
  1637. "\u0129": "i",
  1638. "\u012B": "i",
  1639. "\u012D": "i",
  1640. "\u012F": "i",
  1641. "\u0131": "i",
  1642. "\u0134": "J",
  1643. "\u0135": "j",
  1644. "\u0136": "K",
  1645. "\u0137": "k",
  1646. "\u0138": "k",
  1647. "\u0139": "L",
  1648. "\u013B": "L",
  1649. "\u013D": "L",
  1650. "\u013F": "L",
  1651. "\u0141": "L",
  1652. "\u013A": "l",
  1653. "\u013C": "l",
  1654. "\u013E": "l",
  1655. "\u0140": "l",
  1656. "\u0142": "l",
  1657. "\u0143": "N",
  1658. "\u0145": "N",
  1659. "\u0147": "N",
  1660. "\u014A": "N",
  1661. "\u0144": "n",
  1662. "\u0146": "n",
  1663. "\u0148": "n",
  1664. "\u014B": "n",
  1665. "\u014C": "O",
  1666. "\u014E": "O",
  1667. "\u0150": "O",
  1668. "\u014D": "o",
  1669. "\u014F": "o",
  1670. "\u0151": "o",
  1671. "\u0154": "R",
  1672. "\u0156": "R",
  1673. "\u0158": "R",
  1674. "\u0155": "r",
  1675. "\u0157": "r",
  1676. "\u0159": "r",
  1677. "\u015A": "S",
  1678. "\u015C": "S",
  1679. "\u015E": "S",
  1680. "\u0160": "S",
  1681. "\u015B": "s",
  1682. "\u015D": "s",
  1683. "\u015F": "s",
  1684. "\u0161": "s",
  1685. "\u0162": "T",
  1686. "\u0164": "T",
  1687. "\u0166": "T",
  1688. "\u0163": "t",
  1689. "\u0165": "t",
  1690. "\u0167": "t",
  1691. "\u0168": "U",
  1692. "\u016A": "U",
  1693. "\u016C": "U",
  1694. "\u016E": "U",
  1695. "\u0170": "U",
  1696. "\u0172": "U",
  1697. "\u0169": "u",
  1698. "\u016B": "u",
  1699. "\u016D": "u",
  1700. "\u016F": "u",
  1701. "\u0171": "u",
  1702. "\u0173": "u",
  1703. "\u0174": "W",
  1704. "\u0175": "w",
  1705. "\u0176": "Y",
  1706. "\u0177": "y",
  1707. "\u0178": "Y",
  1708. "\u0179": "Z",
  1709. "\u017B": "Z",
  1710. "\u017D": "Z",
  1711. "\u017A": "z",
  1712. "\u017C": "z",
  1713. "\u017E": "z",
  1714. "\u0132": "IJ",
  1715. "\u0133": "ij",
  1716. "\u0152": "Oe",
  1717. "\u0153": "oe",
  1718. "\u0149": "'n",
  1719. "\u017F": "s"
  1720. };
  1721. var deburrLetter = basePropertyOf(deburredLetters);
  1722. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  1723. var rsComboMarksRange$2 = "\\u0300-\\u036f";
  1724. var reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f";
  1725. var rsComboSymbolsRange$2 = "\\u20d0-\\u20ff";
  1726. var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
  1727. var rsCombo$2 = "[" + rsComboRange$2 + "]";
  1728. var reComboMark = RegExp(rsCombo$2, "g");
  1729. function deburr(string) {
  1730. string = toString(string);
  1731. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
  1732. }
  1733. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  1734. function asciiWords(string) {
  1735. return string.match(reAsciiWord) || [];
  1736. }
  1737. 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 ]/;
  1738. function hasUnicodeWord(string) {
  1739. return reHasUnicodeWord.test(string);
  1740. }
  1741. var rsAstralRange$1 = "\\ud800-\\udfff";
  1742. var rsComboMarksRange$1 = "\\u0300-\\u036f";
  1743. var reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f";
  1744. var rsComboSymbolsRange$1 = "\\u20d0-\\u20ff";
  1745. var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
  1746. var rsDingbatRange = "\\u2700-\\u27bf";
  1747. var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
  1748. var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
  1749. var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
  1750. var rsPunctuationRange = "\\u2000-\\u206f";
  1751. 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";
  1752. var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
  1753. var rsVarRange$1 = "\\ufe0e\\ufe0f";
  1754. var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  1755. var rsApos$1 = "['\u2019]";
  1756. var rsBreak = "[" + rsBreakRange + "]";
  1757. var rsCombo$1 = "[" + rsComboRange$1 + "]";
  1758. var rsDigits = "\\d+";
  1759. var rsDingbat = "[" + rsDingbatRange + "]";
  1760. var rsLower = "[" + rsLowerRange + "]";
  1761. var rsMisc = "[^" + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
  1762. var rsFitz$1 = "\\ud83c[\\udffb-\\udfff]";
  1763. var rsModifier$1 = "(?:" + rsCombo$1 + "|" + rsFitz$1 + ")";
  1764. var rsNonAstral$1 = "[^" + rsAstralRange$1 + "]";
  1765. var rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  1766. var rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  1767. var rsUpper = "[" + rsUpperRange + "]";
  1768. var rsZWJ$1 = "\\u200d";
  1769. var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
  1770. var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
  1771. var rsOptContrLower = "(?:" + rsApos$1 + "(?:d|ll|m|re|s|t|ve))?";
  1772. var rsOptContrUpper = "(?:" + rsApos$1 + "(?:D|LL|M|RE|S|T|VE))?";
  1773. var reOptMod$1 = rsModifier$1 + "?";
  1774. var rsOptVar$1 = "[" + rsVarRange$1 + "]?";
  1775. var rsOptJoin$1 = "(?:" + rsZWJ$1 + "(?:" + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsOptVar$1 + reOptMod$1 + ")*";
  1776. var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
  1777. var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
  1778. var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1;
  1779. var rsEmoji = "(?:" + [rsDingbat, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsSeq$1;
  1780. var reUnicodeWord = RegExp([
  1781. rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
  1782. rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
  1783. rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
  1784. rsUpper + "+" + rsOptContrUpper,
  1785. rsOrdUpper,
  1786. rsOrdLower,
  1787. rsDigits,
  1788. rsEmoji
  1789. ].join("|"), "g");
  1790. function unicodeWords(string) {
  1791. return string.match(reUnicodeWord) || [];
  1792. }
  1793. function words(string, pattern, guard) {
  1794. string = toString(string);
  1795. pattern = guard ? void 0 : pattern;
  1796. if (pattern === void 0) {
  1797. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  1798. }
  1799. return string.match(pattern) || [];
  1800. }
  1801. var rsApos = "['\u2019]";
  1802. var reApos = RegExp(rsApos, "g");
  1803. function createCompounder(callback) {
  1804. return function(string) {
  1805. return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
  1806. };
  1807. }
  1808. var camelCase = createCompounder(function(result, word, index) {
  1809. word = word.toLowerCase();
  1810. return result + (index ? capitalize$2(word) : word);
  1811. });
  1812. function castArray$1() {
  1813. if (!arguments.length) {
  1814. return [];
  1815. }
  1816. var value = arguments[0];
  1817. return isArray$1(value) ? value : [value];
  1818. }
  1819. var nativeIsFinite$1 = root.isFinite;
  1820. var nativeMin$c = Math.min;
  1821. function createRound(methodName) {
  1822. var func = Math[methodName];
  1823. return function(number, precision) {
  1824. number = toNumber(number);
  1825. precision = precision == null ? 0 : nativeMin$c(toInteger(precision), 292);
  1826. if (precision && nativeIsFinite$1(number)) {
  1827. var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
  1828. pair = (toString(value) + "e").split("e");
  1829. return +(pair[0] + "e" + (+pair[1] - precision));
  1830. }
  1831. return func(number);
  1832. };
  1833. }
  1834. var ceil = createRound("ceil");
  1835. function chain(value) {
  1836. var result = lodash(value);
  1837. result.__chain__ = true;
  1838. return result;
  1839. }
  1840. var nativeCeil$3 = Math.ceil;
  1841. var nativeMax$c = Math.max;
  1842. function chunk(array, size, guard) {
  1843. if (guard ? isIterateeCall(array, size, guard) : size === void 0) {
  1844. size = 1;
  1845. } else {
  1846. size = nativeMax$c(toInteger(size), 0);
  1847. }
  1848. var length = array == null ? 0 : array.length;
  1849. if (!length || size < 1) {
  1850. return [];
  1851. }
  1852. var index = 0, resIndex = 0, result = Array(nativeCeil$3(length / size));
  1853. while (index < length) {
  1854. result[resIndex++] = baseSlice(array, index, index += size);
  1855. }
  1856. return result;
  1857. }
  1858. function baseClamp(number, lower, upper) {
  1859. if (number === number) {
  1860. if (upper !== void 0) {
  1861. number = number <= upper ? number : upper;
  1862. }
  1863. if (lower !== void 0) {
  1864. number = number >= lower ? number : lower;
  1865. }
  1866. }
  1867. return number;
  1868. }
  1869. function clamp(number, lower, upper) {
  1870. if (upper === void 0) {
  1871. upper = lower;
  1872. lower = void 0;
  1873. }
  1874. if (upper !== void 0) {
  1875. upper = toNumber(upper);
  1876. upper = upper === upper ? upper : 0;
  1877. }
  1878. if (lower !== void 0) {
  1879. lower = toNumber(lower);
  1880. lower = lower === lower ? lower : 0;
  1881. }
  1882. return baseClamp(toNumber(number), lower, upper);
  1883. }
  1884. function stackClear() {
  1885. this.__data__ = new ListCache();
  1886. this.size = 0;
  1887. }
  1888. function stackDelete(key) {
  1889. var data = this.__data__, result = data["delete"](key);
  1890. this.size = data.size;
  1891. return result;
  1892. }
  1893. function stackGet(key) {
  1894. return this.__data__.get(key);
  1895. }
  1896. function stackHas(key) {
  1897. return this.__data__.has(key);
  1898. }
  1899. var LARGE_ARRAY_SIZE$2 = 200;
  1900. function stackSet(key, value) {
  1901. var data = this.__data__;
  1902. if (data instanceof ListCache) {
  1903. var pairs = data.__data__;
  1904. if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) {
  1905. pairs.push([key, value]);
  1906. this.size = ++data.size;
  1907. return this;
  1908. }
  1909. data = this.__data__ = new MapCache(pairs);
  1910. }
  1911. data.set(key, value);
  1912. this.size = data.size;
  1913. return this;
  1914. }
  1915. function Stack(entries) {
  1916. var data = this.__data__ = new ListCache(entries);
  1917. this.size = data.size;
  1918. }
  1919. Stack.prototype.clear = stackClear;
  1920. Stack.prototype["delete"] = stackDelete;
  1921. Stack.prototype.get = stackGet;
  1922. Stack.prototype.has = stackHas;
  1923. Stack.prototype.set = stackSet;
  1924. function baseAssign(object, source) {
  1925. return object && copyObject(source, keys(source), object);
  1926. }
  1927. function baseAssignIn(object, source) {
  1928. return object && copyObject(source, keysIn(source), object);
  1929. }
  1930. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  1931. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  1932. var moduleExports = freeModule && freeModule.exports === freeExports;
  1933. var Buffer = moduleExports ? root.Buffer : void 0;
  1934. var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
  1935. function cloneBuffer(buffer, isDeep) {
  1936. if (isDeep) {
  1937. return buffer.slice();
  1938. }
  1939. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  1940. buffer.copy(result);
  1941. return result;
  1942. }
  1943. function arrayFilter(array, predicate) {
  1944. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  1945. while (++index < length) {
  1946. var value = array[index];
  1947. if (predicate(value, index, array)) {
  1948. result[resIndex++] = value;
  1949. }
  1950. }
  1951. return result;
  1952. }
  1953. function stubArray() {
  1954. return [];
  1955. }
  1956. var objectProto$d = Object.prototype;
  1957. var propertyIsEnumerable = objectProto$d.propertyIsEnumerable;
  1958. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  1959. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
  1960. if (object == null) {
  1961. return [];
  1962. }
  1963. object = Object(object);
  1964. return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
  1965. return propertyIsEnumerable.call(object, symbol);
  1966. });
  1967. };
  1968. function copySymbols(source, object) {
  1969. return copyObject(source, getSymbols(source), object);
  1970. }
  1971. var nativeGetSymbols = Object.getOwnPropertySymbols;
  1972. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  1973. var result = [];
  1974. while (object) {
  1975. arrayPush(result, getSymbols(object));
  1976. object = getPrototype(object);
  1977. }
  1978. return result;
  1979. };
  1980. function copySymbolsIn(source, object) {
  1981. return copyObject(source, getSymbolsIn(source), object);
  1982. }
  1983. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  1984. var result = keysFunc(object);
  1985. return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
  1986. }
  1987. function getAllKeys(object) {
  1988. return baseGetAllKeys(object, keys, getSymbols);
  1989. }
  1990. function getAllKeysIn(object) {
  1991. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  1992. }
  1993. var DataView = getNative(root, "DataView");
  1994. var Promise$1 = getNative(root, "Promise");
  1995. var Set$1 = getNative(root, "Set");
  1996. var mapTag$8 = "[object Map]";
  1997. var objectTag$2 = "[object Object]";
  1998. var promiseTag = "[object Promise]";
  1999. var setTag$8 = "[object Set]";
  2000. var weakMapTag$2 = "[object WeakMap]";
  2001. var dataViewTag$3 = "[object DataView]";
  2002. var dataViewCtorString = toSource(DataView);
  2003. var mapCtorString = toSource(Map$1);
  2004. var promiseCtorString = toSource(Promise$1);
  2005. var setCtorString = toSource(Set$1);
  2006. var weakMapCtorString = toSource(WeakMap);
  2007. var getTag = baseGetTag;
  2008. 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) {
  2009. getTag = function(value) {
  2010. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  2011. if (ctorString) {
  2012. switch (ctorString) {
  2013. case dataViewCtorString:
  2014. return dataViewTag$3;
  2015. case mapCtorString:
  2016. return mapTag$8;
  2017. case promiseCtorString:
  2018. return promiseTag;
  2019. case setCtorString:
  2020. return setTag$8;
  2021. case weakMapCtorString:
  2022. return weakMapTag$2;
  2023. }
  2024. }
  2025. return result;
  2026. };
  2027. }
  2028. var getTag$1 = getTag;
  2029. var objectProto$c = Object.prototype;
  2030. var hasOwnProperty$c = objectProto$c.hasOwnProperty;
  2031. function initCloneArray(array) {
  2032. var length = array.length, result = new array.constructor(length);
  2033. if (length && typeof array[0] == "string" && hasOwnProperty$c.call(array, "index")) {
  2034. result.index = array.index;
  2035. result.input = array.input;
  2036. }
  2037. return result;
  2038. }
  2039. var Uint8Array = root.Uint8Array;
  2040. function cloneArrayBuffer(arrayBuffer) {
  2041. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  2042. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  2043. return result;
  2044. }
  2045. function cloneDataView(dataView, isDeep) {
  2046. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  2047. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  2048. }
  2049. var reFlags$1 = /\w*$/;
  2050. function cloneRegExp(regexp) {
  2051. var result = new regexp.constructor(regexp.source, reFlags$1.exec(regexp));
  2052. result.lastIndex = regexp.lastIndex;
  2053. return result;
  2054. }
  2055. var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0;
  2056. var symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  2057. function cloneSymbol(symbol) {
  2058. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  2059. }
  2060. function cloneTypedArray(typedArray, isDeep) {
  2061. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  2062. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  2063. }
  2064. var boolTag$3 = "[object Boolean]";
  2065. var dateTag$3 = "[object Date]";
  2066. var mapTag$7 = "[object Map]";
  2067. var numberTag$3 = "[object Number]";
  2068. var regexpTag$3 = "[object RegExp]";
  2069. var setTag$7 = "[object Set]";
  2070. var stringTag$3 = "[object String]";
  2071. var symbolTag$2 = "[object Symbol]";
  2072. var arrayBufferTag$3 = "[object ArrayBuffer]";
  2073. var dataViewTag$2 = "[object DataView]";
  2074. var float32Tag$1 = "[object Float32Array]";
  2075. var float64Tag$1 = "[object Float64Array]";
  2076. var int8Tag$1 = "[object Int8Array]";
  2077. var int16Tag$1 = "[object Int16Array]";
  2078. var int32Tag$1 = "[object Int32Array]";
  2079. var uint8Tag$1 = "[object Uint8Array]";
  2080. var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
  2081. var uint16Tag$1 = "[object Uint16Array]";
  2082. var uint32Tag$1 = "[object Uint32Array]";
  2083. function initCloneByTag(object, tag, isDeep) {
  2084. var Ctor = object.constructor;
  2085. switch (tag) {
  2086. case arrayBufferTag$3:
  2087. return cloneArrayBuffer(object);
  2088. case boolTag$3:
  2089. case dateTag$3:
  2090. return new Ctor(+object);
  2091. case dataViewTag$2:
  2092. return cloneDataView(object, isDeep);
  2093. case float32Tag$1:
  2094. case float64Tag$1:
  2095. case int8Tag$1:
  2096. case int16Tag$1:
  2097. case int32Tag$1:
  2098. case uint8Tag$1:
  2099. case uint8ClampedTag$1:
  2100. case uint16Tag$1:
  2101. case uint32Tag$1:
  2102. return cloneTypedArray(object, isDeep);
  2103. case mapTag$7:
  2104. return new Ctor();
  2105. case numberTag$3:
  2106. case stringTag$3:
  2107. return new Ctor(object);
  2108. case regexpTag$3:
  2109. return cloneRegExp(object);
  2110. case setTag$7:
  2111. return new Ctor();
  2112. case symbolTag$2:
  2113. return cloneSymbol(object);
  2114. }
  2115. }
  2116. function initCloneObject(object) {
  2117. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
  2118. }
  2119. var mapTag$6 = "[object Map]";
  2120. function baseIsMap(value) {
  2121. return isObjectLike(value) && getTag$1(value) == mapTag$6;
  2122. }
  2123. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  2124. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  2125. var setTag$6 = "[object Set]";
  2126. function baseIsSet(value) {
  2127. return isObjectLike(value) && getTag$1(value) == setTag$6;
  2128. }
  2129. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  2130. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  2131. var CLONE_DEEP_FLAG$7 = 1;
  2132. var CLONE_FLAT_FLAG$1 = 2;
  2133. var CLONE_SYMBOLS_FLAG$5 = 4;
  2134. var argsTag$1 = "[object Arguments]";
  2135. var arrayTag$1 = "[object Array]";
  2136. var boolTag$2 = "[object Boolean]";
  2137. var dateTag$2 = "[object Date]";
  2138. var errorTag$1 = "[object Error]";
  2139. var funcTag = "[object Function]";
  2140. var genTag = "[object GeneratorFunction]";
  2141. var mapTag$5 = "[object Map]";
  2142. var numberTag$2 = "[object Number]";
  2143. var objectTag$1 = "[object Object]";
  2144. var regexpTag$2 = "[object RegExp]";
  2145. var setTag$5 = "[object Set]";
  2146. var stringTag$2 = "[object String]";
  2147. var symbolTag$1 = "[object Symbol]";
  2148. var weakMapTag$1 = "[object WeakMap]";
  2149. var arrayBufferTag$2 = "[object ArrayBuffer]";
  2150. var dataViewTag$1 = "[object DataView]";
  2151. var float32Tag = "[object Float32Array]";
  2152. var float64Tag = "[object Float64Array]";
  2153. var int8Tag = "[object Int8Array]";
  2154. var int16Tag = "[object Int16Array]";
  2155. var int32Tag = "[object Int32Array]";
  2156. var uint8Tag = "[object Uint8Array]";
  2157. var uint8ClampedTag = "[object Uint8ClampedArray]";
  2158. var uint16Tag = "[object Uint16Array]";
  2159. var uint32Tag = "[object Uint32Array]";
  2160. var cloneableTags = {};
  2161. 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;
  2162. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag$1] = false;
  2163. function baseClone(value, bitmask, customizer, key, object, stack) {
  2164. var result, isDeep = bitmask & CLONE_DEEP_FLAG$7, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$5;
  2165. if (customizer) {
  2166. result = object ? customizer(value, key, object, stack) : customizer(value);
  2167. }
  2168. if (result !== void 0) {
  2169. return result;
  2170. }
  2171. if (!isObject$2(value)) {
  2172. return value;
  2173. }
  2174. var isArr = isArray$1(value);
  2175. if (isArr) {
  2176. result = initCloneArray(value);
  2177. if (!isDeep) {
  2178. return copyArray(value, result);
  2179. }
  2180. } else {
  2181. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  2182. if (isBuffer(value)) {
  2183. return cloneBuffer(value, isDeep);
  2184. }
  2185. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
  2186. result = isFlat || isFunc ? {} : initCloneObject(value);
  2187. if (!isDeep) {
  2188. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  2189. }
  2190. } else {
  2191. if (!cloneableTags[tag]) {
  2192. return object ? value : {};
  2193. }
  2194. result = initCloneByTag(value, tag, isDeep);
  2195. }
  2196. }
  2197. stack || (stack = new Stack());
  2198. var stacked = stack.get(value);
  2199. if (stacked) {
  2200. return stacked;
  2201. }
  2202. stack.set(value, result);
  2203. if (isSet(value)) {
  2204. value.forEach(function(subValue) {
  2205. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  2206. });
  2207. } else if (isMap(value)) {
  2208. value.forEach(function(subValue, key2) {
  2209. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2210. });
  2211. }
  2212. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  2213. var props = isArr ? void 0 : keysFunc(value);
  2214. arrayEach(props || value, function(subValue, key2) {
  2215. if (props) {
  2216. key2 = subValue;
  2217. subValue = value[key2];
  2218. }
  2219. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2220. });
  2221. return result;
  2222. }
  2223. var CLONE_SYMBOLS_FLAG$4 = 4;
  2224. function clone(value) {
  2225. return baseClone(value, CLONE_SYMBOLS_FLAG$4);
  2226. }
  2227. var CLONE_DEEP_FLAG$6 = 1;
  2228. var CLONE_SYMBOLS_FLAG$3 = 4;
  2229. function cloneDeep(value) {
  2230. return baseClone(value, CLONE_DEEP_FLAG$6 | CLONE_SYMBOLS_FLAG$3);
  2231. }
  2232. var CLONE_DEEP_FLAG$5 = 1;
  2233. var CLONE_SYMBOLS_FLAG$2 = 4;
  2234. function cloneDeepWith(value, customizer) {
  2235. customizer = typeof customizer == "function" ? customizer : void 0;
  2236. return baseClone(value, CLONE_DEEP_FLAG$5 | CLONE_SYMBOLS_FLAG$2, customizer);
  2237. }
  2238. var CLONE_SYMBOLS_FLAG$1 = 4;
  2239. function cloneWith(value, customizer) {
  2240. customizer = typeof customizer == "function" ? customizer : void 0;
  2241. return baseClone(value, CLONE_SYMBOLS_FLAG$1, customizer);
  2242. }
  2243. function wrapperCommit() {
  2244. return new LodashWrapper(this.value(), this.__chain__);
  2245. }
  2246. function compact(array) {
  2247. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2248. while (++index < length) {
  2249. var value = array[index];
  2250. if (value) {
  2251. result[resIndex++] = value;
  2252. }
  2253. }
  2254. return result;
  2255. }
  2256. function concat() {
  2257. var length = arguments.length;
  2258. if (!length) {
  2259. return [];
  2260. }
  2261. var args = Array(length - 1), array = arguments[0], index = length;
  2262. while (index--) {
  2263. args[index - 1] = arguments[index];
  2264. }
  2265. return arrayPush(isArray$1(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  2266. }
  2267. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  2268. function setCacheAdd(value) {
  2269. this.__data__.set(value, HASH_UNDEFINED);
  2270. return this;
  2271. }
  2272. function setCacheHas(value) {
  2273. return this.__data__.has(value);
  2274. }
  2275. function SetCache(values) {
  2276. var index = -1, length = values == null ? 0 : values.length;
  2277. this.__data__ = new MapCache();
  2278. while (++index < length) {
  2279. this.add(values[index]);
  2280. }
  2281. }
  2282. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  2283. SetCache.prototype.has = setCacheHas;
  2284. function arraySome(array, predicate) {
  2285. var index = -1, length = array == null ? 0 : array.length;
  2286. while (++index < length) {
  2287. if (predicate(array[index], index, array)) {
  2288. return true;
  2289. }
  2290. }
  2291. return false;
  2292. }
  2293. function cacheHas(cache, key) {
  2294. return cache.has(key);
  2295. }
  2296. var COMPARE_PARTIAL_FLAG$5 = 1;
  2297. var COMPARE_UNORDERED_FLAG$3 = 2;
  2298. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  2299. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  2300. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  2301. return false;
  2302. }
  2303. var arrStacked = stack.get(array);
  2304. var othStacked = stack.get(other);
  2305. if (arrStacked && othStacked) {
  2306. return arrStacked == other && othStacked == array;
  2307. }
  2308. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  2309. stack.set(array, other);
  2310. stack.set(other, array);
  2311. while (++index < arrLength) {
  2312. var arrValue = array[index], othValue = other[index];
  2313. if (customizer) {
  2314. var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  2315. }
  2316. if (compared !== void 0) {
  2317. if (compared) {
  2318. continue;
  2319. }
  2320. result = false;
  2321. break;
  2322. }
  2323. if (seen) {
  2324. if (!arraySome(other, function(othValue2, othIndex) {
  2325. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  2326. return seen.push(othIndex);
  2327. }
  2328. })) {
  2329. result = false;
  2330. break;
  2331. }
  2332. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  2333. result = false;
  2334. break;
  2335. }
  2336. }
  2337. stack["delete"](array);
  2338. stack["delete"](other);
  2339. return result;
  2340. }
  2341. function mapToArray(map) {
  2342. var index = -1, result = Array(map.size);
  2343. map.forEach(function(value, key) {
  2344. result[++index] = [key, value];
  2345. });
  2346. return result;
  2347. }
  2348. function setToArray(set) {
  2349. var index = -1, result = Array(set.size);
  2350. set.forEach(function(value) {
  2351. result[++index] = value;
  2352. });
  2353. return result;
  2354. }
  2355. var COMPARE_PARTIAL_FLAG$4 = 1;
  2356. var COMPARE_UNORDERED_FLAG$2 = 2;
  2357. var boolTag$1 = "[object Boolean]";
  2358. var dateTag$1 = "[object Date]";
  2359. var errorTag = "[object Error]";
  2360. var mapTag$4 = "[object Map]";
  2361. var numberTag$1 = "[object Number]";
  2362. var regexpTag$1 = "[object RegExp]";
  2363. var setTag$4 = "[object Set]";
  2364. var stringTag$1 = "[object String]";
  2365. var symbolTag = "[object Symbol]";
  2366. var arrayBufferTag$1 = "[object ArrayBuffer]";
  2367. var dataViewTag = "[object DataView]";
  2368. var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
  2369. var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  2370. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  2371. switch (tag) {
  2372. case dataViewTag:
  2373. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  2374. return false;
  2375. }
  2376. object = object.buffer;
  2377. other = other.buffer;
  2378. case arrayBufferTag$1:
  2379. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  2380. return false;
  2381. }
  2382. return true;
  2383. case boolTag$1:
  2384. case dateTag$1:
  2385. case numberTag$1:
  2386. return eq(+object, +other);
  2387. case errorTag:
  2388. return object.name == other.name && object.message == other.message;
  2389. case regexpTag$1:
  2390. case stringTag$1:
  2391. return object == other + "";
  2392. case mapTag$4:
  2393. var convert = mapToArray;
  2394. case setTag$4:
  2395. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  2396. convert || (convert = setToArray);
  2397. if (object.size != other.size && !isPartial) {
  2398. return false;
  2399. }
  2400. var stacked = stack.get(object);
  2401. if (stacked) {
  2402. return stacked == other;
  2403. }
  2404. bitmask |= COMPARE_UNORDERED_FLAG$2;
  2405. stack.set(object, other);
  2406. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  2407. stack["delete"](object);
  2408. return result;
  2409. case symbolTag:
  2410. if (symbolValueOf) {
  2411. return symbolValueOf.call(object) == symbolValueOf.call(other);
  2412. }
  2413. }
  2414. return false;
  2415. }
  2416. var COMPARE_PARTIAL_FLAG$3 = 1;
  2417. var objectProto$b = Object.prototype;
  2418. var hasOwnProperty$b = objectProto$b.hasOwnProperty;
  2419. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  2420. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  2421. if (objLength != othLength && !isPartial) {
  2422. return false;
  2423. }
  2424. var index = objLength;
  2425. while (index--) {
  2426. var key = objProps[index];
  2427. if (!(isPartial ? key in other : hasOwnProperty$b.call(other, key))) {
  2428. return false;
  2429. }
  2430. }
  2431. var objStacked = stack.get(object);
  2432. var othStacked = stack.get(other);
  2433. if (objStacked && othStacked) {
  2434. return objStacked == other && othStacked == object;
  2435. }
  2436. var result = true;
  2437. stack.set(object, other);
  2438. stack.set(other, object);
  2439. var skipCtor = isPartial;
  2440. while (++index < objLength) {
  2441. key = objProps[index];
  2442. var objValue = object[key], othValue = other[key];
  2443. if (customizer) {
  2444. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  2445. }
  2446. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  2447. result = false;
  2448. break;
  2449. }
  2450. skipCtor || (skipCtor = key == "constructor");
  2451. }
  2452. if (result && !skipCtor) {
  2453. var objCtor = object.constructor, othCtor = other.constructor;
  2454. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  2455. result = false;
  2456. }
  2457. }
  2458. stack["delete"](object);
  2459. stack["delete"](other);
  2460. return result;
  2461. }
  2462. var COMPARE_PARTIAL_FLAG$2 = 1;
  2463. var argsTag = "[object Arguments]";
  2464. var arrayTag = "[object Array]";
  2465. var objectTag = "[object Object]";
  2466. var objectProto$a = Object.prototype;
  2467. var hasOwnProperty$a = objectProto$a.hasOwnProperty;
  2468. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  2469. var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  2470. objTag = objTag == argsTag ? objectTag : objTag;
  2471. othTag = othTag == argsTag ? objectTag : othTag;
  2472. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  2473. if (isSameTag && isBuffer(object)) {
  2474. if (!isBuffer(other)) {
  2475. return false;
  2476. }
  2477. objIsArr = true;
  2478. objIsObj = false;
  2479. }
  2480. if (isSameTag && !objIsObj) {
  2481. stack || (stack = new Stack());
  2482. return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  2483. }
  2484. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  2485. var objIsWrapped = objIsObj && hasOwnProperty$a.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$a.call(other, "__wrapped__");
  2486. if (objIsWrapped || othIsWrapped) {
  2487. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  2488. stack || (stack = new Stack());
  2489. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  2490. }
  2491. }
  2492. if (!isSameTag) {
  2493. return false;
  2494. }
  2495. stack || (stack = new Stack());
  2496. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  2497. }
  2498. function baseIsEqual(value, other, bitmask, customizer, stack) {
  2499. if (value === other) {
  2500. return true;
  2501. }
  2502. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  2503. return value !== value && other !== other;
  2504. }
  2505. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  2506. }
  2507. var COMPARE_PARTIAL_FLAG$1 = 1;
  2508. var COMPARE_UNORDERED_FLAG$1 = 2;
  2509. function baseIsMatch(object, source, matchData, customizer) {
  2510. var index = matchData.length, length = index, noCustomizer = !customizer;
  2511. if (object == null) {
  2512. return !length;
  2513. }
  2514. object = Object(object);
  2515. while (index--) {
  2516. var data = matchData[index];
  2517. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
  2518. return false;
  2519. }
  2520. }
  2521. while (++index < length) {
  2522. data = matchData[index];
  2523. var key = data[0], objValue = object[key], srcValue = data[1];
  2524. if (noCustomizer && data[2]) {
  2525. if (objValue === void 0 && !(key in object)) {
  2526. return false;
  2527. }
  2528. } else {
  2529. var stack = new Stack();
  2530. if (customizer) {
  2531. var result = customizer(objValue, srcValue, key, object, source, stack);
  2532. }
  2533. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
  2534. return false;
  2535. }
  2536. }
  2537. }
  2538. return true;
  2539. }
  2540. function isStrictComparable(value) {
  2541. return value === value && !isObject$2(value);
  2542. }
  2543. function getMatchData(object) {
  2544. var result = keys(object), length = result.length;
  2545. while (length--) {
  2546. var key = result[length], value = object[key];
  2547. result[length] = [key, value, isStrictComparable(value)];
  2548. }
  2549. return result;
  2550. }
  2551. function matchesStrictComparable(key, srcValue) {
  2552. return function(object) {
  2553. if (object == null) {
  2554. return false;
  2555. }
  2556. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  2557. };
  2558. }
  2559. function baseMatches(source) {
  2560. var matchData = getMatchData(source);
  2561. if (matchData.length == 1 && matchData[0][2]) {
  2562. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  2563. }
  2564. return function(object) {
  2565. return object === source || baseIsMatch(object, source, matchData);
  2566. };
  2567. }
  2568. function baseHasIn(object, key) {
  2569. return object != null && key in Object(object);
  2570. }
  2571. function hasPath(object, path, hasFunc) {
  2572. path = castPath(path, object);
  2573. var index = -1, length = path.length, result = false;
  2574. while (++index < length) {
  2575. var key = toKey(path[index]);
  2576. if (!(result = object != null && hasFunc(object, key))) {
  2577. break;
  2578. }
  2579. object = object[key];
  2580. }
  2581. if (result || ++index != length) {
  2582. return result;
  2583. }
  2584. length = object == null ? 0 : object.length;
  2585. return !!length && isLength(length) && isIndex(key, length) && (isArray$1(object) || isArguments(object));
  2586. }
  2587. function hasIn(object, path) {
  2588. return object != null && hasPath(object, path, baseHasIn);
  2589. }
  2590. var COMPARE_PARTIAL_FLAG = 1;
  2591. var COMPARE_UNORDERED_FLAG = 2;
  2592. function baseMatchesProperty(path, srcValue) {
  2593. if (isKey(path) && isStrictComparable(srcValue)) {
  2594. return matchesStrictComparable(toKey(path), srcValue);
  2595. }
  2596. return function(object) {
  2597. var objValue = get(object, path);
  2598. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  2599. };
  2600. }
  2601. function baseProperty(key) {
  2602. return function(object) {
  2603. return object == null ? void 0 : object[key];
  2604. };
  2605. }
  2606. function basePropertyDeep(path) {
  2607. return function(object) {
  2608. return baseGet(object, path);
  2609. };
  2610. }
  2611. function property(path) {
  2612. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  2613. }
  2614. function baseIteratee(value) {
  2615. if (typeof value == "function") {
  2616. return value;
  2617. }
  2618. if (value == null) {
  2619. return identity$1;
  2620. }
  2621. if (typeof value == "object") {
  2622. return isArray$1(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  2623. }
  2624. return property(value);
  2625. }
  2626. var FUNC_ERROR_TEXT$7 = "Expected a function";
  2627. function cond(pairs) {
  2628. var length = pairs == null ? 0 : pairs.length, toIteratee = baseIteratee;
  2629. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  2630. if (typeof pair[1] != "function") {
  2631. throw new TypeError(FUNC_ERROR_TEXT$7);
  2632. }
  2633. return [toIteratee(pair[0]), pair[1]];
  2634. });
  2635. return baseRest(function(args) {
  2636. var index = -1;
  2637. while (++index < length) {
  2638. var pair = pairs[index];
  2639. if (apply(pair[0], this, args)) {
  2640. return apply(pair[1], this, args);
  2641. }
  2642. }
  2643. });
  2644. }
  2645. function baseConformsTo(object, source, props) {
  2646. var length = props.length;
  2647. if (object == null) {
  2648. return !length;
  2649. }
  2650. object = Object(object);
  2651. while (length--) {
  2652. var key = props[length], predicate = source[key], value = object[key];
  2653. if (value === void 0 && !(key in object) || !predicate(value)) {
  2654. return false;
  2655. }
  2656. }
  2657. return true;
  2658. }
  2659. function baseConforms(source) {
  2660. var props = keys(source);
  2661. return function(object) {
  2662. return baseConformsTo(object, source, props);
  2663. };
  2664. }
  2665. var CLONE_DEEP_FLAG$4 = 1;
  2666. function conforms(source) {
  2667. return baseConforms(baseClone(source, CLONE_DEEP_FLAG$4));
  2668. }
  2669. function conformsTo(object, source) {
  2670. return source == null || baseConformsTo(object, source, keys(source));
  2671. }
  2672. function arrayAggregator(array, setter, iteratee, accumulator) {
  2673. var index = -1, length = array == null ? 0 : array.length;
  2674. while (++index < length) {
  2675. var value = array[index];
  2676. setter(accumulator, value, iteratee(value), array);
  2677. }
  2678. return accumulator;
  2679. }
  2680. function createBaseFor(fromRight) {
  2681. return function(object, iteratee, keysFunc) {
  2682. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  2683. while (length--) {
  2684. var key = props[fromRight ? length : ++index];
  2685. if (iteratee(iterable[key], key, iterable) === false) {
  2686. break;
  2687. }
  2688. }
  2689. return object;
  2690. };
  2691. }
  2692. var baseFor = createBaseFor();
  2693. function baseForOwn(object, iteratee) {
  2694. return object && baseFor(object, iteratee, keys);
  2695. }
  2696. function createBaseEach(eachFunc, fromRight) {
  2697. return function(collection, iteratee) {
  2698. if (collection == null) {
  2699. return collection;
  2700. }
  2701. if (!isArrayLike(collection)) {
  2702. return eachFunc(collection, iteratee);
  2703. }
  2704. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  2705. while (fromRight ? index-- : ++index < length) {
  2706. if (iteratee(iterable[index], index, iterable) === false) {
  2707. break;
  2708. }
  2709. }
  2710. return collection;
  2711. };
  2712. }
  2713. var baseEach = createBaseEach(baseForOwn);
  2714. function baseAggregator(collection, setter, iteratee, accumulator) {
  2715. baseEach(collection, function(value, key, collection2) {
  2716. setter(accumulator, value, iteratee(value), collection2);
  2717. });
  2718. return accumulator;
  2719. }
  2720. function createAggregator(setter, initializer) {
  2721. return function(collection, iteratee) {
  2722. var func = isArray$1(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
  2723. return func(collection, setter, baseIteratee(iteratee), accumulator);
  2724. };
  2725. }
  2726. var objectProto$9 = Object.prototype;
  2727. var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
  2728. var countBy = createAggregator(function(result, value, key) {
  2729. if (hasOwnProperty$9.call(result, key)) {
  2730. ++result[key];
  2731. } else {
  2732. baseAssignValue(result, key, 1);
  2733. }
  2734. });
  2735. function create(prototype, properties) {
  2736. var result = baseCreate(prototype);
  2737. return properties == null ? result : baseAssign(result, properties);
  2738. }
  2739. var WRAP_CURRY_FLAG$1 = 8;
  2740. function curry(func, arity, guard) {
  2741. arity = guard ? void 0 : arity;
  2742. var result = createWrap(func, WRAP_CURRY_FLAG$1, void 0, void 0, void 0, void 0, void 0, arity);
  2743. result.placeholder = curry.placeholder;
  2744. return result;
  2745. }
  2746. curry.placeholder = {};
  2747. var WRAP_CURRY_RIGHT_FLAG = 16;
  2748. function curryRight(func, arity, guard) {
  2749. arity = guard ? void 0 : arity;
  2750. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, void 0, void 0, void 0, void 0, void 0, arity);
  2751. result.placeholder = curryRight.placeholder;
  2752. return result;
  2753. }
  2754. curryRight.placeholder = {};
  2755. var now = function() {
  2756. return root.Date.now();
  2757. };
  2758. var FUNC_ERROR_TEXT$6 = "Expected a function";
  2759. var nativeMax$b = Math.max;
  2760. var nativeMin$b = Math.min;
  2761. function debounce(func, wait, options) {
  2762. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  2763. if (typeof func != "function") {
  2764. throw new TypeError(FUNC_ERROR_TEXT$6);
  2765. }
  2766. wait = toNumber(wait) || 0;
  2767. if (isObject$2(options)) {
  2768. leading = !!options.leading;
  2769. maxing = "maxWait" in options;
  2770. maxWait = maxing ? nativeMax$b(toNumber(options.maxWait) || 0, wait) : maxWait;
  2771. trailing = "trailing" in options ? !!options.trailing : trailing;
  2772. }
  2773. function invokeFunc(time) {
  2774. var args = lastArgs, thisArg = lastThis;
  2775. lastArgs = lastThis = void 0;
  2776. lastInvokeTime = time;
  2777. result = func.apply(thisArg, args);
  2778. return result;
  2779. }
  2780. function leadingEdge(time) {
  2781. lastInvokeTime = time;
  2782. timerId = setTimeout(timerExpired, wait);
  2783. return leading ? invokeFunc(time) : result;
  2784. }
  2785. function remainingWait(time) {
  2786. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  2787. return maxing ? nativeMin$b(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  2788. }
  2789. function shouldInvoke(time) {
  2790. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  2791. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  2792. }
  2793. function timerExpired() {
  2794. var time = now();
  2795. if (shouldInvoke(time)) {
  2796. return trailingEdge(time);
  2797. }
  2798. timerId = setTimeout(timerExpired, remainingWait(time));
  2799. }
  2800. function trailingEdge(time) {
  2801. timerId = void 0;
  2802. if (trailing && lastArgs) {
  2803. return invokeFunc(time);
  2804. }
  2805. lastArgs = lastThis = void 0;
  2806. return result;
  2807. }
  2808. function cancel() {
  2809. if (timerId !== void 0) {
  2810. clearTimeout(timerId);
  2811. }
  2812. lastInvokeTime = 0;
  2813. lastArgs = lastCallTime = lastThis = timerId = void 0;
  2814. }
  2815. function flush() {
  2816. return timerId === void 0 ? result : trailingEdge(now());
  2817. }
  2818. function debounced() {
  2819. var time = now(), isInvoking = shouldInvoke(time);
  2820. lastArgs = arguments;
  2821. lastThis = this;
  2822. lastCallTime = time;
  2823. if (isInvoking) {
  2824. if (timerId === void 0) {
  2825. return leadingEdge(lastCallTime);
  2826. }
  2827. if (maxing) {
  2828. clearTimeout(timerId);
  2829. timerId = setTimeout(timerExpired, wait);
  2830. return invokeFunc(lastCallTime);
  2831. }
  2832. }
  2833. if (timerId === void 0) {
  2834. timerId = setTimeout(timerExpired, wait);
  2835. }
  2836. return result;
  2837. }
  2838. debounced.cancel = cancel;
  2839. debounced.flush = flush;
  2840. return debounced;
  2841. }
  2842. function defaultTo(value, defaultValue) {
  2843. return value == null || value !== value ? defaultValue : value;
  2844. }
  2845. var objectProto$8 = Object.prototype;
  2846. var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
  2847. var defaults = baseRest(function(object, sources) {
  2848. object = Object(object);
  2849. var index = -1;
  2850. var length = sources.length;
  2851. var guard = length > 2 ? sources[2] : void 0;
  2852. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  2853. length = 1;
  2854. }
  2855. while (++index < length) {
  2856. var source = sources[index];
  2857. var props = keysIn(source);
  2858. var propsIndex = -1;
  2859. var propsLength = props.length;
  2860. while (++propsIndex < propsLength) {
  2861. var key = props[propsIndex];
  2862. var value = object[key];
  2863. if (value === void 0 || eq(value, objectProto$8[key]) && !hasOwnProperty$8.call(object, key)) {
  2864. object[key] = source[key];
  2865. }
  2866. }
  2867. }
  2868. return object;
  2869. });
  2870. function assignMergeValue(object, key, value) {
  2871. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
  2872. baseAssignValue(object, key, value);
  2873. }
  2874. }
  2875. function isArrayLikeObject(value) {
  2876. return isObjectLike(value) && isArrayLike(value);
  2877. }
  2878. function safeGet(object, key) {
  2879. if (key === "constructor" && typeof object[key] === "function") {
  2880. return;
  2881. }
  2882. if (key == "__proto__") {
  2883. return;
  2884. }
  2885. return object[key];
  2886. }
  2887. function toPlainObject(value) {
  2888. return copyObject(value, keysIn(value));
  2889. }
  2890. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  2891. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  2892. if (stacked) {
  2893. assignMergeValue(object, key, stacked);
  2894. return;
  2895. }
  2896. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  2897. var isCommon = newValue === void 0;
  2898. if (isCommon) {
  2899. var isArr = isArray$1(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  2900. newValue = srcValue;
  2901. if (isArr || isBuff || isTyped) {
  2902. if (isArray$1(objValue)) {
  2903. newValue = objValue;
  2904. } else if (isArrayLikeObject(objValue)) {
  2905. newValue = copyArray(objValue);
  2906. } else if (isBuff) {
  2907. isCommon = false;
  2908. newValue = cloneBuffer(srcValue, true);
  2909. } else if (isTyped) {
  2910. isCommon = false;
  2911. newValue = cloneTypedArray(srcValue, true);
  2912. } else {
  2913. newValue = [];
  2914. }
  2915. } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  2916. newValue = objValue;
  2917. if (isArguments(objValue)) {
  2918. newValue = toPlainObject(objValue);
  2919. } else if (!isObject$2(objValue) || isFunction$1(objValue)) {
  2920. newValue = initCloneObject(srcValue);
  2921. }
  2922. } else {
  2923. isCommon = false;
  2924. }
  2925. }
  2926. if (isCommon) {
  2927. stack.set(srcValue, newValue);
  2928. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  2929. stack["delete"](srcValue);
  2930. }
  2931. assignMergeValue(object, key, newValue);
  2932. }
  2933. function baseMerge(object, source, srcIndex, customizer, stack) {
  2934. if (object === source) {
  2935. return;
  2936. }
  2937. baseFor(source, function(srcValue, key) {
  2938. stack || (stack = new Stack());
  2939. if (isObject$2(srcValue)) {
  2940. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  2941. } else {
  2942. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  2943. if (newValue === void 0) {
  2944. newValue = srcValue;
  2945. }
  2946. assignMergeValue(object, key, newValue);
  2947. }
  2948. }, keysIn);
  2949. }
  2950. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  2951. if (isObject$2(objValue) && isObject$2(srcValue)) {
  2952. stack.set(srcValue, objValue);
  2953. baseMerge(objValue, srcValue, void 0, customDefaultsMerge, stack);
  2954. stack["delete"](srcValue);
  2955. }
  2956. return objValue;
  2957. }
  2958. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  2959. baseMerge(object, source, srcIndex, customizer);
  2960. });
  2961. var defaultsDeep = baseRest(function(args) {
  2962. args.push(void 0, customDefaultsMerge);
  2963. return apply(mergeWith, void 0, args);
  2964. });
  2965. var FUNC_ERROR_TEXT$5 = "Expected a function";
  2966. function baseDelay(func, wait, args) {
  2967. if (typeof func != "function") {
  2968. throw new TypeError(FUNC_ERROR_TEXT$5);
  2969. }
  2970. return setTimeout(function() {
  2971. func.apply(void 0, args);
  2972. }, wait);
  2973. }
  2974. var defer = baseRest(function(func, args) {
  2975. return baseDelay(func, 1, args);
  2976. });
  2977. var delay = baseRest(function(func, wait, args) {
  2978. return baseDelay(func, toNumber(wait) || 0, args);
  2979. });
  2980. function arrayIncludesWith(array, value, comparator) {
  2981. var index = -1, length = array == null ? 0 : array.length;
  2982. while (++index < length) {
  2983. if (comparator(value, array[index])) {
  2984. return true;
  2985. }
  2986. }
  2987. return false;
  2988. }
  2989. var LARGE_ARRAY_SIZE$1 = 200;
  2990. function baseDifference(array, values, iteratee, comparator) {
  2991. var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
  2992. if (!length) {
  2993. return result;
  2994. }
  2995. if (iteratee) {
  2996. values = arrayMap(values, baseUnary(iteratee));
  2997. }
  2998. if (comparator) {
  2999. includes = arrayIncludesWith;
  3000. isCommon = false;
  3001. } else if (values.length >= LARGE_ARRAY_SIZE$1) {
  3002. includes = cacheHas;
  3003. isCommon = false;
  3004. values = new SetCache(values);
  3005. }
  3006. outer:
  3007. while (++index < length) {
  3008. var value = array[index], computed = iteratee == null ? value : iteratee(value);
  3009. value = comparator || value !== 0 ? value : 0;
  3010. if (isCommon && computed === computed) {
  3011. var valuesIndex = valuesLength;
  3012. while (valuesIndex--) {
  3013. if (values[valuesIndex] === computed) {
  3014. continue outer;
  3015. }
  3016. }
  3017. result.push(value);
  3018. } else if (!includes(values, computed, comparator)) {
  3019. result.push(value);
  3020. }
  3021. }
  3022. return result;
  3023. }
  3024. var difference = baseRest(function(array, values) {
  3025. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
  3026. });
  3027. function last(array) {
  3028. var length = array == null ? 0 : array.length;
  3029. return length ? array[length - 1] : void 0;
  3030. }
  3031. var differenceBy = baseRest(function(array, values) {
  3032. var iteratee = last(values);
  3033. if (isArrayLikeObject(iteratee)) {
  3034. iteratee = void 0;
  3035. }
  3036. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee)) : [];
  3037. });
  3038. var differenceWith = baseRest(function(array, values) {
  3039. var comparator = last(values);
  3040. if (isArrayLikeObject(comparator)) {
  3041. comparator = void 0;
  3042. }
  3043. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), void 0, comparator) : [];
  3044. });
  3045. var divide = createMathOperation(function(dividend, divisor) {
  3046. return dividend / divisor;
  3047. }, 1);
  3048. function drop(array, n, guard) {
  3049. var length = array == null ? 0 : array.length;
  3050. if (!length) {
  3051. return [];
  3052. }
  3053. n = guard || n === void 0 ? 1 : toInteger(n);
  3054. return baseSlice(array, n < 0 ? 0 : n, length);
  3055. }
  3056. function dropRight(array, n, guard) {
  3057. var length = array == null ? 0 : array.length;
  3058. if (!length) {
  3059. return [];
  3060. }
  3061. n = guard || n === void 0 ? 1 : toInteger(n);
  3062. n = length - n;
  3063. return baseSlice(array, 0, n < 0 ? 0 : n);
  3064. }
  3065. function baseWhile(array, predicate, isDrop, fromRight) {
  3066. var length = array.length, index = fromRight ? length : -1;
  3067. while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
  3068. }
  3069. return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
  3070. }
  3071. function dropRightWhile(array, predicate) {
  3072. return array && array.length ? baseWhile(array, baseIteratee(predicate), true, true) : [];
  3073. }
  3074. function dropWhile(array, predicate) {
  3075. return array && array.length ? baseWhile(array, baseIteratee(predicate), true) : [];
  3076. }
  3077. function castFunction(value) {
  3078. return typeof value == "function" ? value : identity$1;
  3079. }
  3080. function forEach(collection, iteratee) {
  3081. var func = isArray$1(collection) ? arrayEach : baseEach;
  3082. return func(collection, castFunction(iteratee));
  3083. }
  3084. function arrayEachRight(array, iteratee) {
  3085. var length = array == null ? 0 : array.length;
  3086. while (length--) {
  3087. if (iteratee(array[length], length, array) === false) {
  3088. break;
  3089. }
  3090. }
  3091. return array;
  3092. }
  3093. var baseForRight = createBaseFor(true);
  3094. function baseForOwnRight(object, iteratee) {
  3095. return object && baseForRight(object, iteratee, keys);
  3096. }
  3097. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3098. function forEachRight(collection, iteratee) {
  3099. var func = isArray$1(collection) ? arrayEachRight : baseEachRight;
  3100. return func(collection, castFunction(iteratee));
  3101. }
  3102. function endsWith(string, target, position) {
  3103. string = toString(string);
  3104. target = baseToString(target);
  3105. var length = string.length;
  3106. position = position === void 0 ? length : baseClamp(toInteger(position), 0, length);
  3107. var end = position;
  3108. position -= target.length;
  3109. return position >= 0 && string.slice(position, end) == target;
  3110. }
  3111. function baseToPairs(object, props) {
  3112. return arrayMap(props, function(key) {
  3113. return [key, object[key]];
  3114. });
  3115. }
  3116. function setToPairs(set) {
  3117. var index = -1, result = Array(set.size);
  3118. set.forEach(function(value) {
  3119. result[++index] = [value, value];
  3120. });
  3121. return result;
  3122. }
  3123. var mapTag$3 = "[object Map]";
  3124. var setTag$3 = "[object Set]";
  3125. function createToPairs(keysFunc) {
  3126. return function(object) {
  3127. var tag = getTag$1(object);
  3128. if (tag == mapTag$3) {
  3129. return mapToArray(object);
  3130. }
  3131. if (tag == setTag$3) {
  3132. return setToPairs(object);
  3133. }
  3134. return baseToPairs(object, keysFunc(object));
  3135. };
  3136. }
  3137. var toPairs = createToPairs(keys);
  3138. var toPairsIn = createToPairs(keysIn);
  3139. var htmlEscapes = {
  3140. "&": "&amp;",
  3141. "<": "&lt;",
  3142. ">": "&gt;",
  3143. '"': "&quot;",
  3144. "'": "&#39;"
  3145. };
  3146. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  3147. var reUnescapedHtml = /[&<>"']/g;
  3148. var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  3149. function escape(string) {
  3150. string = toString(string);
  3151. return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
  3152. }
  3153. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3154. var reHasRegExpChar = RegExp(reRegExpChar.source);
  3155. function escapeRegExp(string) {
  3156. string = toString(string);
  3157. return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
  3158. }
  3159. function arrayEvery(array, predicate) {
  3160. var index = -1, length = array == null ? 0 : array.length;
  3161. while (++index < length) {
  3162. if (!predicate(array[index], index, array)) {
  3163. return false;
  3164. }
  3165. }
  3166. return true;
  3167. }
  3168. function baseEvery(collection, predicate) {
  3169. var result = true;
  3170. baseEach(collection, function(value, index, collection2) {
  3171. result = !!predicate(value, index, collection2);
  3172. return result;
  3173. });
  3174. return result;
  3175. }
  3176. function every(collection, predicate, guard) {
  3177. var func = isArray$1(collection) ? arrayEvery : baseEvery;
  3178. if (guard && isIterateeCall(collection, predicate, guard)) {
  3179. predicate = void 0;
  3180. }
  3181. return func(collection, baseIteratee(predicate));
  3182. }
  3183. var MAX_ARRAY_LENGTH$5 = 4294967295;
  3184. function toLength(value) {
  3185. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH$5) : 0;
  3186. }
  3187. function baseFill(array, value, start, end) {
  3188. var length = array.length;
  3189. start = toInteger(start);
  3190. if (start < 0) {
  3191. start = -start > length ? 0 : length + start;
  3192. }
  3193. end = end === void 0 || end > length ? length : toInteger(end);
  3194. if (end < 0) {
  3195. end += length;
  3196. }
  3197. end = start > end ? 0 : toLength(end);
  3198. while (start < end) {
  3199. array[start++] = value;
  3200. }
  3201. return array;
  3202. }
  3203. function fill(array, value, start, end) {
  3204. var length = array == null ? 0 : array.length;
  3205. if (!length) {
  3206. return [];
  3207. }
  3208. if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
  3209. start = 0;
  3210. end = length;
  3211. }
  3212. return baseFill(array, value, start, end);
  3213. }
  3214. function baseFilter(collection, predicate) {
  3215. var result = [];
  3216. baseEach(collection, function(value, index, collection2) {
  3217. if (predicate(value, index, collection2)) {
  3218. result.push(value);
  3219. }
  3220. });
  3221. return result;
  3222. }
  3223. function filter(collection, predicate) {
  3224. var func = isArray$1(collection) ? arrayFilter : baseFilter;
  3225. return func(collection, baseIteratee(predicate));
  3226. }
  3227. function createFind(findIndexFunc) {
  3228. return function(collection, predicate, fromIndex) {
  3229. var iterable = Object(collection);
  3230. if (!isArrayLike(collection)) {
  3231. var iteratee = baseIteratee(predicate);
  3232. collection = keys(collection);
  3233. predicate = function(key) {
  3234. return iteratee(iterable[key], key, iterable);
  3235. };
  3236. }
  3237. var index = findIndexFunc(collection, predicate, fromIndex);
  3238. return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0;
  3239. };
  3240. }
  3241. var nativeMax$a = Math.max;
  3242. function findIndex(array, predicate, fromIndex) {
  3243. var length = array == null ? 0 : array.length;
  3244. if (!length) {
  3245. return -1;
  3246. }
  3247. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  3248. if (index < 0) {
  3249. index = nativeMax$a(length + index, 0);
  3250. }
  3251. return baseFindIndex(array, baseIteratee(predicate), index);
  3252. }
  3253. var find = createFind(findIndex);
  3254. function baseFindKey(collection, predicate, eachFunc) {
  3255. var result;
  3256. eachFunc(collection, function(value, key, collection2) {
  3257. if (predicate(value, key, collection2)) {
  3258. result = key;
  3259. return false;
  3260. }
  3261. });
  3262. return result;
  3263. }
  3264. function findKey(object, predicate) {
  3265. return baseFindKey(object, baseIteratee(predicate), baseForOwn);
  3266. }
  3267. var nativeMax$9 = Math.max;
  3268. var nativeMin$a = Math.min;
  3269. function findLastIndex(array, predicate, fromIndex) {
  3270. var length = array == null ? 0 : array.length;
  3271. if (!length) {
  3272. return -1;
  3273. }
  3274. var index = length - 1;
  3275. if (fromIndex !== void 0) {
  3276. index = toInteger(fromIndex);
  3277. index = fromIndex < 0 ? nativeMax$9(length + index, 0) : nativeMin$a(index, length - 1);
  3278. }
  3279. return baseFindIndex(array, baseIteratee(predicate), index, true);
  3280. }
  3281. var findLast = createFind(findLastIndex);
  3282. function findLastKey(object, predicate) {
  3283. return baseFindKey(object, baseIteratee(predicate), baseForOwnRight);
  3284. }
  3285. function head(array) {
  3286. return array && array.length ? array[0] : void 0;
  3287. }
  3288. function baseMap(collection, iteratee) {
  3289. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  3290. baseEach(collection, function(value, key, collection2) {
  3291. result[++index] = iteratee(value, key, collection2);
  3292. });
  3293. return result;
  3294. }
  3295. function map(collection, iteratee) {
  3296. var func = isArray$1(collection) ? arrayMap : baseMap;
  3297. return func(collection, baseIteratee(iteratee));
  3298. }
  3299. function flatMap(collection, iteratee) {
  3300. return baseFlatten(map(collection, iteratee), 1);
  3301. }
  3302. var INFINITY$2 = 1 / 0;
  3303. function flatMapDeep(collection, iteratee) {
  3304. return baseFlatten(map(collection, iteratee), INFINITY$2);
  3305. }
  3306. function flatMapDepth(collection, iteratee, depth) {
  3307. depth = depth === void 0 ? 1 : toInteger(depth);
  3308. return baseFlatten(map(collection, iteratee), depth);
  3309. }
  3310. var INFINITY$1 = 1 / 0;
  3311. function flattenDeep(array) {
  3312. var length = array == null ? 0 : array.length;
  3313. return length ? baseFlatten(array, INFINITY$1) : [];
  3314. }
  3315. function flattenDepth(array, depth) {
  3316. var length = array == null ? 0 : array.length;
  3317. if (!length) {
  3318. return [];
  3319. }
  3320. depth = depth === void 0 ? 1 : toInteger(depth);
  3321. return baseFlatten(array, depth);
  3322. }
  3323. var WRAP_FLIP_FLAG = 512;
  3324. function flip(func) {
  3325. return createWrap(func, WRAP_FLIP_FLAG);
  3326. }
  3327. var floor$1 = createRound("floor");
  3328. var FUNC_ERROR_TEXT$4 = "Expected a function";
  3329. var WRAP_CURRY_FLAG = 8;
  3330. var WRAP_PARTIAL_FLAG$1 = 32;
  3331. var WRAP_ARY_FLAG = 128;
  3332. var WRAP_REARG_FLAG$1 = 256;
  3333. function createFlow(fromRight) {
  3334. return flatRest(function(funcs) {
  3335. var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
  3336. if (fromRight) {
  3337. funcs.reverse();
  3338. }
  3339. while (index--) {
  3340. var func = funcs[index];
  3341. if (typeof func != "function") {
  3342. throw new TypeError(FUNC_ERROR_TEXT$4);
  3343. }
  3344. if (prereq && !wrapper && getFuncName(func) == "wrapper") {
  3345. var wrapper = new LodashWrapper([], true);
  3346. }
  3347. }
  3348. index = wrapper ? index : length;
  3349. while (++index < length) {
  3350. func = funcs[index];
  3351. var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : void 0;
  3352. 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) {
  3353. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  3354. } else {
  3355. wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
  3356. }
  3357. }
  3358. return function() {
  3359. var args = arguments, value = args[0];
  3360. if (wrapper && args.length == 1 && isArray$1(value)) {
  3361. return wrapper.plant(value).value();
  3362. }
  3363. var index2 = 0, result = length ? funcs[index2].apply(this, args) : value;
  3364. while (++index2 < length) {
  3365. result = funcs[index2].call(this, result);
  3366. }
  3367. return result;
  3368. };
  3369. });
  3370. }
  3371. var flow = createFlow();
  3372. var flowRight = createFlow(true);
  3373. function forIn(object, iteratee) {
  3374. return object == null ? object : baseFor(object, castFunction(iteratee), keysIn);
  3375. }
  3376. function forInRight(object, iteratee) {
  3377. return object == null ? object : baseForRight(object, castFunction(iteratee), keysIn);
  3378. }
  3379. function forOwn(object, iteratee) {
  3380. return object && baseForOwn(object, castFunction(iteratee));
  3381. }
  3382. function forOwnRight(object, iteratee) {
  3383. return object && baseForOwnRight(object, castFunction(iteratee));
  3384. }
  3385. function fromPairs(pairs) {
  3386. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  3387. while (++index < length) {
  3388. var pair = pairs[index];
  3389. result[pair[0]] = pair[1];
  3390. }
  3391. return result;
  3392. }
  3393. function baseFunctions(object, props) {
  3394. return arrayFilter(props, function(key) {
  3395. return isFunction$1(object[key]);
  3396. });
  3397. }
  3398. function functions(object) {
  3399. return object == null ? [] : baseFunctions(object, keys(object));
  3400. }
  3401. function functionsIn(object) {
  3402. return object == null ? [] : baseFunctions(object, keysIn(object));
  3403. }
  3404. var objectProto$7 = Object.prototype;
  3405. var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
  3406. var groupBy = createAggregator(function(result, value, key) {
  3407. if (hasOwnProperty$7.call(result, key)) {
  3408. result[key].push(value);
  3409. } else {
  3410. baseAssignValue(result, key, [value]);
  3411. }
  3412. });
  3413. function baseGt(value, other) {
  3414. return value > other;
  3415. }
  3416. function createRelationalOperation(operator) {
  3417. return function(value, other) {
  3418. if (!(typeof value == "string" && typeof other == "string")) {
  3419. value = toNumber(value);
  3420. other = toNumber(other);
  3421. }
  3422. return operator(value, other);
  3423. };
  3424. }
  3425. var gt$1 = createRelationalOperation(baseGt);
  3426. var gte = createRelationalOperation(function(value, other) {
  3427. return value >= other;
  3428. });
  3429. var objectProto$6 = Object.prototype;
  3430. var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
  3431. function baseHas(object, key) {
  3432. return object != null && hasOwnProperty$6.call(object, key);
  3433. }
  3434. function has(object, path) {
  3435. return object != null && hasPath(object, path, baseHas);
  3436. }
  3437. var nativeMax$8 = Math.max;
  3438. var nativeMin$9 = Math.min;
  3439. function baseInRange(number, start, end) {
  3440. return number >= nativeMin$9(start, end) && number < nativeMax$8(start, end);
  3441. }
  3442. function inRange(number, start, end) {
  3443. start = toFinite(start);
  3444. if (end === void 0) {
  3445. end = start;
  3446. start = 0;
  3447. } else {
  3448. end = toFinite(end);
  3449. }
  3450. number = toNumber(number);
  3451. return baseInRange(number, start, end);
  3452. }
  3453. var stringTag = "[object String]";
  3454. function isString$2(value) {
  3455. return typeof value == "string" || !isArray$1(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
  3456. }
  3457. function baseValues(object, props) {
  3458. return arrayMap(props, function(key) {
  3459. return object[key];
  3460. });
  3461. }
  3462. function values(object) {
  3463. return object == null ? [] : baseValues(object, keys(object));
  3464. }
  3465. var nativeMax$7 = Math.max;
  3466. function includes(collection, value, fromIndex, guard) {
  3467. collection = isArrayLike(collection) ? collection : values(collection);
  3468. fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
  3469. var length = collection.length;
  3470. if (fromIndex < 0) {
  3471. fromIndex = nativeMax$7(length + fromIndex, 0);
  3472. }
  3473. return isString$2(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
  3474. }
  3475. var nativeMax$6 = Math.max;
  3476. function indexOf(array, value, fromIndex) {
  3477. var length = array == null ? 0 : array.length;
  3478. if (!length) {
  3479. return -1;
  3480. }
  3481. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  3482. if (index < 0) {
  3483. index = nativeMax$6(length + index, 0);
  3484. }
  3485. return baseIndexOf(array, value, index);
  3486. }
  3487. function initial(array) {
  3488. var length = array == null ? 0 : array.length;
  3489. return length ? baseSlice(array, 0, -1) : [];
  3490. }
  3491. var nativeMin$8 = Math.min;
  3492. function baseIntersection(arrays, iteratee, comparator) {
  3493. var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = [];
  3494. while (othIndex--) {
  3495. var array = arrays[othIndex];
  3496. if (othIndex && iteratee) {
  3497. array = arrayMap(array, baseUnary(iteratee));
  3498. }
  3499. maxLength = nativeMin$8(array.length, maxLength);
  3500. caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : void 0;
  3501. }
  3502. array = arrays[0];
  3503. var index = -1, seen = caches[0];
  3504. outer:
  3505. while (++index < length && result.length < maxLength) {
  3506. var value = array[index], computed = iteratee ? iteratee(value) : value;
  3507. value = comparator || value !== 0 ? value : 0;
  3508. if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
  3509. othIndex = othLength;
  3510. while (--othIndex) {
  3511. var cache = caches[othIndex];
  3512. if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) {
  3513. continue outer;
  3514. }
  3515. }
  3516. if (seen) {
  3517. seen.push(computed);
  3518. }
  3519. result.push(value);
  3520. }
  3521. }
  3522. return result;
  3523. }
  3524. function castArrayLikeObject(value) {
  3525. return isArrayLikeObject(value) ? value : [];
  3526. }
  3527. var intersection = baseRest(function(arrays) {
  3528. var mapped = arrayMap(arrays, castArrayLikeObject);
  3529. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
  3530. });
  3531. var intersectionBy = baseRest(function(arrays) {
  3532. var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  3533. if (iteratee === last(mapped)) {
  3534. iteratee = void 0;
  3535. } else {
  3536. mapped.pop();
  3537. }
  3538. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, baseIteratee(iteratee)) : [];
  3539. });
  3540. var intersectionWith = baseRest(function(arrays) {
  3541. var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  3542. comparator = typeof comparator == "function" ? comparator : void 0;
  3543. if (comparator) {
  3544. mapped.pop();
  3545. }
  3546. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, void 0, comparator) : [];
  3547. });
  3548. function baseInverter(object, setter, iteratee, accumulator) {
  3549. baseForOwn(object, function(value, key, object2) {
  3550. setter(accumulator, iteratee(value), key, object2);
  3551. });
  3552. return accumulator;
  3553. }
  3554. function createInverter(setter, toIteratee) {
  3555. return function(object, iteratee) {
  3556. return baseInverter(object, setter, toIteratee(iteratee), {});
  3557. };
  3558. }
  3559. var objectProto$5 = Object.prototype;
  3560. var nativeObjectToString$1 = objectProto$5.toString;
  3561. var invert = createInverter(function(result, value, key) {
  3562. if (value != null && typeof value.toString != "function") {
  3563. value = nativeObjectToString$1.call(value);
  3564. }
  3565. result[value] = key;
  3566. }, constant(identity$1));
  3567. var objectProto$4 = Object.prototype;
  3568. var hasOwnProperty$5 = objectProto$4.hasOwnProperty;
  3569. var nativeObjectToString = objectProto$4.toString;
  3570. var invertBy = createInverter(function(result, value, key) {
  3571. if (value != null && typeof value.toString != "function") {
  3572. value = nativeObjectToString.call(value);
  3573. }
  3574. if (hasOwnProperty$5.call(result, value)) {
  3575. result[value].push(key);
  3576. } else {
  3577. result[value] = [key];
  3578. }
  3579. }, baseIteratee);
  3580. function parent(object, path) {
  3581. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  3582. }
  3583. function baseInvoke(object, path, args) {
  3584. path = castPath(path, object);
  3585. object = parent(object, path);
  3586. var func = object == null ? object : object[toKey(last(path))];
  3587. return func == null ? void 0 : apply(func, object, args);
  3588. }
  3589. var invoke = baseRest(baseInvoke);
  3590. var invokeMap = baseRest(function(collection, path, args) {
  3591. var index = -1, isFunc = typeof path == "function", result = isArrayLike(collection) ? Array(collection.length) : [];
  3592. baseEach(collection, function(value) {
  3593. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  3594. });
  3595. return result;
  3596. });
  3597. var arrayBufferTag = "[object ArrayBuffer]";
  3598. function baseIsArrayBuffer(value) {
  3599. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  3600. }
  3601. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
  3602. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  3603. var boolTag = "[object Boolean]";
  3604. function isBoolean$1(value) {
  3605. return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
  3606. }
  3607. var dateTag = "[object Date]";
  3608. function baseIsDate(value) {
  3609. return isObjectLike(value) && baseGetTag(value) == dateTag;
  3610. }
  3611. var nodeIsDate = nodeUtil && nodeUtil.isDate;
  3612. var isDate$1 = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  3613. function isElement$2(value) {
  3614. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  3615. }
  3616. var mapTag$2 = "[object Map]";
  3617. var setTag$2 = "[object Set]";
  3618. var objectProto$3 = Object.prototype;
  3619. var hasOwnProperty$4 = objectProto$3.hasOwnProperty;
  3620. function isEmpty$1(value) {
  3621. if (value == null) {
  3622. return true;
  3623. }
  3624. if (isArrayLike(value) && (isArray$1(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  3625. return !value.length;
  3626. }
  3627. var tag = getTag$1(value);
  3628. if (tag == mapTag$2 || tag == setTag$2) {
  3629. return !value.size;
  3630. }
  3631. if (isPrototype(value)) {
  3632. return !baseKeys(value).length;
  3633. }
  3634. for (var key in value) {
  3635. if (hasOwnProperty$4.call(value, key)) {
  3636. return false;
  3637. }
  3638. }
  3639. return true;
  3640. }
  3641. function isEqual$1(value, other) {
  3642. return baseIsEqual(value, other);
  3643. }
  3644. function isEqualWith(value, other, customizer) {
  3645. customizer = typeof customizer == "function" ? customizer : void 0;
  3646. var result = customizer ? customizer(value, other) : void 0;
  3647. return result === void 0 ? baseIsEqual(value, other, void 0, customizer) : !!result;
  3648. }
  3649. var nativeIsFinite = root.isFinite;
  3650. function isFinite(value) {
  3651. return typeof value == "number" && nativeIsFinite(value);
  3652. }
  3653. function isInteger(value) {
  3654. return typeof value == "number" && value == toInteger(value);
  3655. }
  3656. function isMatch(object, source) {
  3657. return object === source || baseIsMatch(object, source, getMatchData(source));
  3658. }
  3659. function isMatchWith(object, source, customizer) {
  3660. customizer = typeof customizer == "function" ? customizer : void 0;
  3661. return baseIsMatch(object, source, getMatchData(source), customizer);
  3662. }
  3663. var numberTag = "[object Number]";
  3664. function isNumber$1(value) {
  3665. return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
  3666. }
  3667. function isNaN$1(value) {
  3668. return isNumber$1(value) && value != +value;
  3669. }
  3670. var isMaskable = coreJsData ? isFunction$1 : stubFalse;
  3671. var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.";
  3672. function isNative(value) {
  3673. if (isMaskable(value)) {
  3674. throw new Error(CORE_ERROR_TEXT);
  3675. }
  3676. return baseIsNative(value);
  3677. }
  3678. function isNil(value) {
  3679. return value == null;
  3680. }
  3681. function isNull(value) {
  3682. return value === null;
  3683. }
  3684. var regexpTag = "[object RegExp]";
  3685. function baseIsRegExp(value) {
  3686. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  3687. }
  3688. var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
  3689. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  3690. var MAX_SAFE_INTEGER$3 = 9007199254740991;
  3691. function isSafeInteger(value) {
  3692. return isInteger(value) && value >= -MAX_SAFE_INTEGER$3 && value <= MAX_SAFE_INTEGER$3;
  3693. }
  3694. function isUndefined$1(value) {
  3695. return value === void 0;
  3696. }
  3697. var weakMapTag = "[object WeakMap]";
  3698. function isWeakMap(value) {
  3699. return isObjectLike(value) && getTag$1(value) == weakMapTag;
  3700. }
  3701. var weakSetTag = "[object WeakSet]";
  3702. function isWeakSet(value) {
  3703. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  3704. }
  3705. var CLONE_DEEP_FLAG$3 = 1;
  3706. function iteratee(func) {
  3707. return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG$3));
  3708. }
  3709. var arrayProto$4 = Array.prototype;
  3710. var nativeJoin = arrayProto$4.join;
  3711. function join(array, separator) {
  3712. return array == null ? "" : nativeJoin.call(array, separator);
  3713. }
  3714. var kebabCase = createCompounder(function(result, word, index) {
  3715. return result + (index ? "-" : "") + word.toLowerCase();
  3716. });
  3717. var keyBy = createAggregator(function(result, value, key) {
  3718. baseAssignValue(result, key, value);
  3719. });
  3720. function strictLastIndexOf(array, value, fromIndex) {
  3721. var index = fromIndex + 1;
  3722. while (index--) {
  3723. if (array[index] === value) {
  3724. return index;
  3725. }
  3726. }
  3727. return index;
  3728. }
  3729. var nativeMax$5 = Math.max;
  3730. var nativeMin$7 = Math.min;
  3731. function lastIndexOf(array, value, fromIndex) {
  3732. var length = array == null ? 0 : array.length;
  3733. if (!length) {
  3734. return -1;
  3735. }
  3736. var index = length;
  3737. if (fromIndex !== void 0) {
  3738. index = toInteger(fromIndex);
  3739. index = index < 0 ? nativeMax$5(length + index, 0) : nativeMin$7(index, length - 1);
  3740. }
  3741. return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
  3742. }
  3743. var lowerCase = createCompounder(function(result, word, index) {
  3744. return result + (index ? " " : "") + word.toLowerCase();
  3745. });
  3746. var lowerFirst = createCaseFirst("toLowerCase");
  3747. function baseLt(value, other) {
  3748. return value < other;
  3749. }
  3750. var lt$1 = createRelationalOperation(baseLt);
  3751. var lte = createRelationalOperation(function(value, other) {
  3752. return value <= other;
  3753. });
  3754. function mapKeys(object, iteratee) {
  3755. var result = {};
  3756. iteratee = baseIteratee(iteratee);
  3757. baseForOwn(object, function(value, key, object2) {
  3758. baseAssignValue(result, iteratee(value, key, object2), value);
  3759. });
  3760. return result;
  3761. }
  3762. function mapValues(object, iteratee) {
  3763. var result = {};
  3764. iteratee = baseIteratee(iteratee);
  3765. baseForOwn(object, function(value, key, object2) {
  3766. baseAssignValue(result, key, iteratee(value, key, object2));
  3767. });
  3768. return result;
  3769. }
  3770. var CLONE_DEEP_FLAG$2 = 1;
  3771. function matches(source) {
  3772. return baseMatches(baseClone(source, CLONE_DEEP_FLAG$2));
  3773. }
  3774. var CLONE_DEEP_FLAG$1 = 1;
  3775. function matchesProperty(path, srcValue) {
  3776. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG$1));
  3777. }
  3778. function baseExtremum(array, iteratee, comparator) {
  3779. var index = -1, length = array.length;
  3780. while (++index < length) {
  3781. var value = array[index], current = iteratee(value);
  3782. if (current != null && (computed === void 0 ? current === current && !isSymbol(current) : comparator(current, computed))) {
  3783. var computed = current, result = value;
  3784. }
  3785. }
  3786. return result;
  3787. }
  3788. function max$3(array) {
  3789. return array && array.length ? baseExtremum(array, identity$1, baseGt) : void 0;
  3790. }
  3791. function maxBy(array, iteratee) {
  3792. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseGt) : void 0;
  3793. }
  3794. function baseSum(array, iteratee) {
  3795. var result, index = -1, length = array.length;
  3796. while (++index < length) {
  3797. var current = iteratee(array[index]);
  3798. if (current !== void 0) {
  3799. result = result === void 0 ? current : result + current;
  3800. }
  3801. }
  3802. return result;
  3803. }
  3804. var NAN = 0 / 0;
  3805. function baseMean(array, iteratee) {
  3806. var length = array == null ? 0 : array.length;
  3807. return length ? baseSum(array, iteratee) / length : NAN;
  3808. }
  3809. function mean(array) {
  3810. return baseMean(array, identity$1);
  3811. }
  3812. function meanBy(array, iteratee) {
  3813. return baseMean(array, baseIteratee(iteratee));
  3814. }
  3815. var merge = createAssigner(function(object, source, srcIndex) {
  3816. baseMerge(object, source, srcIndex);
  3817. });
  3818. var method = baseRest(function(path, args) {
  3819. return function(object) {
  3820. return baseInvoke(object, path, args);
  3821. };
  3822. });
  3823. var methodOf = baseRest(function(object, args) {
  3824. return function(path) {
  3825. return baseInvoke(object, path, args);
  3826. };
  3827. });
  3828. function min$3(array) {
  3829. return array && array.length ? baseExtremum(array, identity$1, baseLt) : void 0;
  3830. }
  3831. function minBy(array, iteratee) {
  3832. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseLt) : void 0;
  3833. }
  3834. function mixin$1(object, source, options) {
  3835. var props = keys(source), methodNames = baseFunctions(source, props);
  3836. var chain = !(isObject$2(options) && "chain" in options) || !!options.chain, isFunc = isFunction$1(object);
  3837. arrayEach(methodNames, function(methodName) {
  3838. var func = source[methodName];
  3839. object[methodName] = func;
  3840. if (isFunc) {
  3841. object.prototype[methodName] = function() {
  3842. var chainAll = this.__chain__;
  3843. if (chain || chainAll) {
  3844. var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__);
  3845. actions.push({ "func": func, "args": arguments, "thisArg": object });
  3846. result.__chain__ = chainAll;
  3847. return result;
  3848. }
  3849. return func.apply(object, arrayPush([this.value()], arguments));
  3850. };
  3851. }
  3852. });
  3853. return object;
  3854. }
  3855. var multiply = createMathOperation(function(multiplier, multiplicand) {
  3856. return multiplier * multiplicand;
  3857. }, 1);
  3858. var FUNC_ERROR_TEXT$3 = "Expected a function";
  3859. function negate(predicate) {
  3860. if (typeof predicate != "function") {
  3861. throw new TypeError(FUNC_ERROR_TEXT$3);
  3862. }
  3863. return function() {
  3864. var args = arguments;
  3865. switch (args.length) {
  3866. case 0:
  3867. return !predicate.call(this);
  3868. case 1:
  3869. return !predicate.call(this, args[0]);
  3870. case 2:
  3871. return !predicate.call(this, args[0], args[1]);
  3872. case 3:
  3873. return !predicate.call(this, args[0], args[1], args[2]);
  3874. }
  3875. return !predicate.apply(this, args);
  3876. };
  3877. }
  3878. function iteratorToArray(iterator) {
  3879. var data, result = [];
  3880. while (!(data = iterator.next()).done) {
  3881. result.push(data.value);
  3882. }
  3883. return result;
  3884. }
  3885. var mapTag$1 = "[object Map]";
  3886. var setTag$1 = "[object Set]";
  3887. var symIterator$1 = Symbol$1 ? Symbol$1.iterator : void 0;
  3888. function toArray(value) {
  3889. if (!value) {
  3890. return [];
  3891. }
  3892. if (isArrayLike(value)) {
  3893. return isString$2(value) ? stringToArray(value) : copyArray(value);
  3894. }
  3895. if (symIterator$1 && value[symIterator$1]) {
  3896. return iteratorToArray(value[symIterator$1]());
  3897. }
  3898. var tag = getTag$1(value), func = tag == mapTag$1 ? mapToArray : tag == setTag$1 ? setToArray : values;
  3899. return func(value);
  3900. }
  3901. function wrapperNext() {
  3902. if (this.__values__ === void 0) {
  3903. this.__values__ = toArray(this.value());
  3904. }
  3905. var done = this.__index__ >= this.__values__.length, value = done ? void 0 : this.__values__[this.__index__++];
  3906. return { "done": done, "value": value };
  3907. }
  3908. function baseNth(array, n) {
  3909. var length = array.length;
  3910. if (!length) {
  3911. return;
  3912. }
  3913. n += n < 0 ? length : 0;
  3914. return isIndex(n, length) ? array[n] : void 0;
  3915. }
  3916. function nth(array, n) {
  3917. return array && array.length ? baseNth(array, toInteger(n)) : void 0;
  3918. }
  3919. function nthArg(n) {
  3920. n = toInteger(n);
  3921. return baseRest(function(args) {
  3922. return baseNth(args, n);
  3923. });
  3924. }
  3925. function baseUnset(object, path) {
  3926. path = castPath(path, object);
  3927. object = parent(object, path);
  3928. return object == null || delete object[toKey(last(path))];
  3929. }
  3930. function customOmitClone(value) {
  3931. return isPlainObject(value) ? void 0 : value;
  3932. }
  3933. var CLONE_DEEP_FLAG = 1;
  3934. var CLONE_FLAT_FLAG = 2;
  3935. var CLONE_SYMBOLS_FLAG = 4;
  3936. var omit = flatRest(function(object, paths) {
  3937. var result = {};
  3938. if (object == null) {
  3939. return result;
  3940. }
  3941. var isDeep = false;
  3942. paths = arrayMap(paths, function(path) {
  3943. path = castPath(path, object);
  3944. isDeep || (isDeep = path.length > 1);
  3945. return path;
  3946. });
  3947. copyObject(object, getAllKeysIn(object), result);
  3948. if (isDeep) {
  3949. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  3950. }
  3951. var length = paths.length;
  3952. while (length--) {
  3953. baseUnset(result, paths[length]);
  3954. }
  3955. return result;
  3956. });
  3957. function baseSet(object, path, value, customizer) {
  3958. if (!isObject$2(object)) {
  3959. return object;
  3960. }
  3961. path = castPath(path, object);
  3962. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  3963. while (nested != null && ++index < length) {
  3964. var key = toKey(path[index]), newValue = value;
  3965. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  3966. return object;
  3967. }
  3968. if (index != lastIndex) {
  3969. var objValue = nested[key];
  3970. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  3971. if (newValue === void 0) {
  3972. newValue = isObject$2(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  3973. }
  3974. }
  3975. assignValue(nested, key, newValue);
  3976. nested = nested[key];
  3977. }
  3978. return object;
  3979. }
  3980. function basePickBy(object, paths, predicate) {
  3981. var index = -1, length = paths.length, result = {};
  3982. while (++index < length) {
  3983. var path = paths[index], value = baseGet(object, path);
  3984. if (predicate(value, path)) {
  3985. baseSet(result, castPath(path, object), value);
  3986. }
  3987. }
  3988. return result;
  3989. }
  3990. function pickBy(object, predicate) {
  3991. if (object == null) {
  3992. return {};
  3993. }
  3994. var props = arrayMap(getAllKeysIn(object), function(prop) {
  3995. return [prop];
  3996. });
  3997. predicate = baseIteratee(predicate);
  3998. return basePickBy(object, props, function(value, path) {
  3999. return predicate(value, path[0]);
  4000. });
  4001. }
  4002. function omitBy(object, predicate) {
  4003. return pickBy(object, negate(baseIteratee(predicate)));
  4004. }
  4005. function once(func) {
  4006. return before(2, func);
  4007. }
  4008. function baseSortBy(array, comparer) {
  4009. var length = array.length;
  4010. array.sort(comparer);
  4011. while (length--) {
  4012. array[length] = array[length].value;
  4013. }
  4014. return array;
  4015. }
  4016. function compareAscending(value, other) {
  4017. if (value !== other) {
  4018. var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
  4019. var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
  4020. if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
  4021. return 1;
  4022. }
  4023. if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
  4024. return -1;
  4025. }
  4026. }
  4027. return 0;
  4028. }
  4029. function compareMultiple(object, other, orders) {
  4030. var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
  4031. while (++index < length) {
  4032. var result = compareAscending(objCriteria[index], othCriteria[index]);
  4033. if (result) {
  4034. if (index >= ordersLength) {
  4035. return result;
  4036. }
  4037. var order = orders[index];
  4038. return result * (order == "desc" ? -1 : 1);
  4039. }
  4040. }
  4041. return object.index - other.index;
  4042. }
  4043. function baseOrderBy(collection, iteratees, orders) {
  4044. if (iteratees.length) {
  4045. iteratees = arrayMap(iteratees, function(iteratee) {
  4046. if (isArray$1(iteratee)) {
  4047. return function(value) {
  4048. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  4049. };
  4050. }
  4051. return iteratee;
  4052. });
  4053. } else {
  4054. iteratees = [identity$1];
  4055. }
  4056. var index = -1;
  4057. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4058. var result = baseMap(collection, function(value, key, collection2) {
  4059. var criteria = arrayMap(iteratees, function(iteratee) {
  4060. return iteratee(value);
  4061. });
  4062. return { "criteria": criteria, "index": ++index, "value": value };
  4063. });
  4064. return baseSortBy(result, function(object, other) {
  4065. return compareMultiple(object, other, orders);
  4066. });
  4067. }
  4068. function orderBy$1(collection, iteratees, orders, guard) {
  4069. if (collection == null) {
  4070. return [];
  4071. }
  4072. if (!isArray$1(iteratees)) {
  4073. iteratees = iteratees == null ? [] : [iteratees];
  4074. }
  4075. orders = guard ? void 0 : orders;
  4076. if (!isArray$1(orders)) {
  4077. orders = orders == null ? [] : [orders];
  4078. }
  4079. return baseOrderBy(collection, iteratees, orders);
  4080. }
  4081. function createOver(arrayFunc) {
  4082. return flatRest(function(iteratees) {
  4083. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4084. return baseRest(function(args) {
  4085. var thisArg = this;
  4086. return arrayFunc(iteratees, function(iteratee) {
  4087. return apply(iteratee, thisArg, args);
  4088. });
  4089. });
  4090. });
  4091. }
  4092. var over = createOver(arrayMap);
  4093. var castRest = baseRest;
  4094. var nativeMin$6 = Math.min;
  4095. var overArgs = castRest(function(func, transforms) {
  4096. transforms = transforms.length == 1 && isArray$1(transforms[0]) ? arrayMap(transforms[0], baseUnary(baseIteratee)) : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
  4097. var funcsLength = transforms.length;
  4098. return baseRest(function(args) {
  4099. var index = -1, length = nativeMin$6(args.length, funcsLength);
  4100. while (++index < length) {
  4101. args[index] = transforms[index].call(this, args[index]);
  4102. }
  4103. return apply(func, this, args);
  4104. });
  4105. });
  4106. var overEvery = createOver(arrayEvery);
  4107. var overSome = createOver(arraySome);
  4108. var MAX_SAFE_INTEGER$2 = 9007199254740991;
  4109. var nativeFloor$3 = Math.floor;
  4110. function baseRepeat(string, n) {
  4111. var result = "";
  4112. if (!string || n < 1 || n > MAX_SAFE_INTEGER$2) {
  4113. return result;
  4114. }
  4115. do {
  4116. if (n % 2) {
  4117. result += string;
  4118. }
  4119. n = nativeFloor$3(n / 2);
  4120. if (n) {
  4121. string += string;
  4122. }
  4123. } while (n);
  4124. return result;
  4125. }
  4126. var asciiSize = baseProperty("length");
  4127. var rsAstralRange = "\\ud800-\\udfff";
  4128. var rsComboMarksRange = "\\u0300-\\u036f";
  4129. var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
  4130. var rsComboSymbolsRange = "\\u20d0-\\u20ff";
  4131. var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
  4132. var rsVarRange = "\\ufe0e\\ufe0f";
  4133. var rsAstral = "[" + rsAstralRange + "]";
  4134. var rsCombo = "[" + rsComboRange + "]";
  4135. var rsFitz = "\\ud83c[\\udffb-\\udfff]";
  4136. var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
  4137. var rsNonAstral = "[^" + rsAstralRange + "]";
  4138. var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  4139. var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  4140. var rsZWJ = "\\u200d";
  4141. var reOptMod = rsModifier + "?";
  4142. var rsOptVar = "[" + rsVarRange + "]?";
  4143. var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
  4144. var rsSeq = rsOptVar + reOptMod + rsOptJoin;
  4145. var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
  4146. var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
  4147. function unicodeSize(string) {
  4148. var result = reUnicode.lastIndex = 0;
  4149. while (reUnicode.test(string)) {
  4150. ++result;
  4151. }
  4152. return result;
  4153. }
  4154. function stringSize(string) {
  4155. return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
  4156. }
  4157. var nativeCeil$2 = Math.ceil;
  4158. function createPadding(length, chars) {
  4159. chars = chars === void 0 ? " " : baseToString(chars);
  4160. var charsLength = chars.length;
  4161. if (charsLength < 2) {
  4162. return charsLength ? baseRepeat(chars, length) : chars;
  4163. }
  4164. var result = baseRepeat(chars, nativeCeil$2(length / stringSize(chars)));
  4165. return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length);
  4166. }
  4167. var nativeCeil$1 = Math.ceil;
  4168. var nativeFloor$2 = Math.floor;
  4169. function pad(string, length, chars) {
  4170. string = toString(string);
  4171. length = toInteger(length);
  4172. var strLength = length ? stringSize(string) : 0;
  4173. if (!length || strLength >= length) {
  4174. return string;
  4175. }
  4176. var mid = (length - strLength) / 2;
  4177. return createPadding(nativeFloor$2(mid), chars) + string + createPadding(nativeCeil$1(mid), chars);
  4178. }
  4179. function padEnd(string, length, chars) {
  4180. string = toString(string);
  4181. length = toInteger(length);
  4182. var strLength = length ? stringSize(string) : 0;
  4183. return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
  4184. }
  4185. function padStart(string, length, chars) {
  4186. string = toString(string);
  4187. length = toInteger(length);
  4188. var strLength = length ? stringSize(string) : 0;
  4189. return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
  4190. }
  4191. var reTrimStart$1 = /^\s+/;
  4192. var nativeParseInt = root.parseInt;
  4193. function parseInt$1(string, radix, guard) {
  4194. if (guard || radix == null) {
  4195. radix = 0;
  4196. } else if (radix) {
  4197. radix = +radix;
  4198. }
  4199. return nativeParseInt(toString(string).replace(reTrimStart$1, ""), radix || 0);
  4200. }
  4201. var WRAP_PARTIAL_FLAG = 32;
  4202. var partial = baseRest(function(func, partials) {
  4203. var holders = replaceHolders(partials, getHolder(partial));
  4204. return createWrap(func, WRAP_PARTIAL_FLAG, void 0, partials, holders);
  4205. });
  4206. partial.placeholder = {};
  4207. var WRAP_PARTIAL_RIGHT_FLAG = 64;
  4208. var partialRight = baseRest(function(func, partials) {
  4209. var holders = replaceHolders(partials, getHolder(partialRight));
  4210. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, void 0, partials, holders);
  4211. });
  4212. partialRight.placeholder = {};
  4213. var partition = createAggregator(function(result, value, key) {
  4214. result[key ? 0 : 1].push(value);
  4215. }, function() {
  4216. return [[], []];
  4217. });
  4218. function basePick(object, paths) {
  4219. return basePickBy(object, paths, function(value, path) {
  4220. return hasIn(object, path);
  4221. });
  4222. }
  4223. var pick = flatRest(function(object, paths) {
  4224. return object == null ? {} : basePick(object, paths);
  4225. });
  4226. function wrapperPlant(value) {
  4227. var result, parent = this;
  4228. while (parent instanceof baseLodash) {
  4229. var clone = wrapperClone(parent);
  4230. clone.__index__ = 0;
  4231. clone.__values__ = void 0;
  4232. if (result) {
  4233. previous.__wrapped__ = clone;
  4234. } else {
  4235. result = clone;
  4236. }
  4237. var previous = clone;
  4238. parent = parent.__wrapped__;
  4239. }
  4240. previous.__wrapped__ = value;
  4241. return result;
  4242. }
  4243. function propertyOf(object) {
  4244. return function(path) {
  4245. return object == null ? void 0 : baseGet(object, path);
  4246. };
  4247. }
  4248. function baseIndexOfWith(array, value, fromIndex, comparator) {
  4249. var index = fromIndex - 1, length = array.length;
  4250. while (++index < length) {
  4251. if (comparator(array[index], value)) {
  4252. return index;
  4253. }
  4254. }
  4255. return -1;
  4256. }
  4257. var arrayProto$3 = Array.prototype;
  4258. var splice$1 = arrayProto$3.splice;
  4259. function basePullAll(array, values, iteratee, comparator) {
  4260. var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array;
  4261. if (array === values) {
  4262. values = copyArray(values);
  4263. }
  4264. if (iteratee) {
  4265. seen = arrayMap(array, baseUnary(iteratee));
  4266. }
  4267. while (++index < length) {
  4268. var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value;
  4269. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  4270. if (seen !== array) {
  4271. splice$1.call(seen, fromIndex, 1);
  4272. }
  4273. splice$1.call(array, fromIndex, 1);
  4274. }
  4275. }
  4276. return array;
  4277. }
  4278. function pullAll(array, values) {
  4279. return array && array.length && values && values.length ? basePullAll(array, values) : array;
  4280. }
  4281. var pull = baseRest(pullAll);
  4282. function pullAllBy(array, values, iteratee) {
  4283. return array && array.length && values && values.length ? basePullAll(array, values, baseIteratee(iteratee)) : array;
  4284. }
  4285. function pullAllWith(array, values, comparator) {
  4286. return array && array.length && values && values.length ? basePullAll(array, values, void 0, comparator) : array;
  4287. }
  4288. var arrayProto$2 = Array.prototype;
  4289. var splice = arrayProto$2.splice;
  4290. function basePullAt(array, indexes) {
  4291. var length = array ? indexes.length : 0, lastIndex = length - 1;
  4292. while (length--) {
  4293. var index = indexes[length];
  4294. if (length == lastIndex || index !== previous) {
  4295. var previous = index;
  4296. if (isIndex(index)) {
  4297. splice.call(array, index, 1);
  4298. } else {
  4299. baseUnset(array, index);
  4300. }
  4301. }
  4302. }
  4303. return array;
  4304. }
  4305. var pullAt = flatRest(function(array, indexes) {
  4306. var length = array == null ? 0 : array.length, result = baseAt(array, indexes);
  4307. basePullAt(array, arrayMap(indexes, function(index) {
  4308. return isIndex(index, length) ? +index : index;
  4309. }).sort(compareAscending));
  4310. return result;
  4311. });
  4312. var nativeFloor$1 = Math.floor;
  4313. var nativeRandom$1 = Math.random;
  4314. function baseRandom(lower, upper) {
  4315. return lower + nativeFloor$1(nativeRandom$1() * (upper - lower + 1));
  4316. }
  4317. var freeParseFloat = parseFloat;
  4318. var nativeMin$5 = Math.min;
  4319. var nativeRandom = Math.random;
  4320. function random(lower, upper, floating) {
  4321. if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
  4322. upper = floating = void 0;
  4323. }
  4324. if (floating === void 0) {
  4325. if (typeof upper == "boolean") {
  4326. floating = upper;
  4327. upper = void 0;
  4328. } else if (typeof lower == "boolean") {
  4329. floating = lower;
  4330. lower = void 0;
  4331. }
  4332. }
  4333. if (lower === void 0 && upper === void 0) {
  4334. lower = 0;
  4335. upper = 1;
  4336. } else {
  4337. lower = toFinite(lower);
  4338. if (upper === void 0) {
  4339. upper = lower;
  4340. lower = 0;
  4341. } else {
  4342. upper = toFinite(upper);
  4343. }
  4344. }
  4345. if (lower > upper) {
  4346. var temp = lower;
  4347. lower = upper;
  4348. upper = temp;
  4349. }
  4350. if (floating || lower % 1 || upper % 1) {
  4351. var rand = nativeRandom();
  4352. return nativeMin$5(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
  4353. }
  4354. return baseRandom(lower, upper);
  4355. }
  4356. var nativeCeil = Math.ceil;
  4357. var nativeMax$4 = Math.max;
  4358. function baseRange(start, end, step, fromRight) {
  4359. var index = -1, length = nativeMax$4(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
  4360. while (length--) {
  4361. result[fromRight ? length : ++index] = start;
  4362. start += step;
  4363. }
  4364. return result;
  4365. }
  4366. function createRange(fromRight) {
  4367. return function(start, end, step) {
  4368. if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
  4369. end = step = void 0;
  4370. }
  4371. start = toFinite(start);
  4372. if (end === void 0) {
  4373. end = start;
  4374. start = 0;
  4375. } else {
  4376. end = toFinite(end);
  4377. }
  4378. step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
  4379. return baseRange(start, end, step, fromRight);
  4380. };
  4381. }
  4382. var range$1 = createRange();
  4383. var rangeRight = createRange(true);
  4384. var WRAP_REARG_FLAG = 256;
  4385. var rearg = flatRest(function(func, indexes) {
  4386. return createWrap(func, WRAP_REARG_FLAG, void 0, void 0, void 0, indexes);
  4387. });
  4388. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  4389. eachFunc(collection, function(value, index, collection2) {
  4390. accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
  4391. });
  4392. return accumulator;
  4393. }
  4394. function reduce(collection, iteratee, accumulator) {
  4395. var func = isArray$1(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
  4396. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach);
  4397. }
  4398. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  4399. var length = array == null ? 0 : array.length;
  4400. if (initAccum && length) {
  4401. accumulator = array[--length];
  4402. }
  4403. while (length--) {
  4404. accumulator = iteratee(accumulator, array[length], length, array);
  4405. }
  4406. return accumulator;
  4407. }
  4408. function reduceRight(collection, iteratee, accumulator) {
  4409. var func = isArray$1(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
  4410. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEachRight);
  4411. }
  4412. function reject(collection, predicate) {
  4413. var func = isArray$1(collection) ? arrayFilter : baseFilter;
  4414. return func(collection, negate(baseIteratee(predicate)));
  4415. }
  4416. function remove(array, predicate) {
  4417. var result = [];
  4418. if (!(array && array.length)) {
  4419. return result;
  4420. }
  4421. var index = -1, indexes = [], length = array.length;
  4422. predicate = baseIteratee(predicate);
  4423. while (++index < length) {
  4424. var value = array[index];
  4425. if (predicate(value, index, array)) {
  4426. result.push(value);
  4427. indexes.push(index);
  4428. }
  4429. }
  4430. basePullAt(array, indexes);
  4431. return result;
  4432. }
  4433. function repeat(string, n, guard) {
  4434. if (guard ? isIterateeCall(string, n, guard) : n === void 0) {
  4435. n = 1;
  4436. } else {
  4437. n = toInteger(n);
  4438. }
  4439. return baseRepeat(toString(string), n);
  4440. }
  4441. function replace() {
  4442. var args = arguments, string = toString(args[0]);
  4443. return args.length < 3 ? string : string.replace(args[1], args[2]);
  4444. }
  4445. var FUNC_ERROR_TEXT$2 = "Expected a function";
  4446. function rest(func, start) {
  4447. if (typeof func != "function") {
  4448. throw new TypeError(FUNC_ERROR_TEXT$2);
  4449. }
  4450. start = start === void 0 ? start : toInteger(start);
  4451. return baseRest(func, start);
  4452. }
  4453. function result(object, path, defaultValue) {
  4454. path = castPath(path, object);
  4455. var index = -1, length = path.length;
  4456. if (!length) {
  4457. length = 1;
  4458. object = void 0;
  4459. }
  4460. while (++index < length) {
  4461. var value = object == null ? void 0 : object[toKey(path[index])];
  4462. if (value === void 0) {
  4463. index = length;
  4464. value = defaultValue;
  4465. }
  4466. object = isFunction$1(value) ? value.call(object) : value;
  4467. }
  4468. return object;
  4469. }
  4470. var arrayProto$1 = Array.prototype;
  4471. var nativeReverse = arrayProto$1.reverse;
  4472. function reverse(array) {
  4473. return array == null ? array : nativeReverse.call(array);
  4474. }
  4475. var round$1 = createRound("round");
  4476. function arraySample(array) {
  4477. var length = array.length;
  4478. return length ? array[baseRandom(0, length - 1)] : void 0;
  4479. }
  4480. function baseSample(collection) {
  4481. return arraySample(values(collection));
  4482. }
  4483. function sample(collection) {
  4484. var func = isArray$1(collection) ? arraySample : baseSample;
  4485. return func(collection);
  4486. }
  4487. function shuffleSelf(array, size) {
  4488. var index = -1, length = array.length, lastIndex = length - 1;
  4489. size = size === void 0 ? length : size;
  4490. while (++index < size) {
  4491. var rand = baseRandom(index, lastIndex), value = array[rand];
  4492. array[rand] = array[index];
  4493. array[index] = value;
  4494. }
  4495. array.length = size;
  4496. return array;
  4497. }
  4498. function arraySampleSize(array, n) {
  4499. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  4500. }
  4501. function baseSampleSize(collection, n) {
  4502. var array = values(collection);
  4503. return shuffleSelf(array, baseClamp(n, 0, array.length));
  4504. }
  4505. function sampleSize(collection, n, guard) {
  4506. if (guard ? isIterateeCall(collection, n, guard) : n === void 0) {
  4507. n = 1;
  4508. } else {
  4509. n = toInteger(n);
  4510. }
  4511. var func = isArray$1(collection) ? arraySampleSize : baseSampleSize;
  4512. return func(collection, n);
  4513. }
  4514. function set(object, path, value) {
  4515. return object == null ? object : baseSet(object, path, value);
  4516. }
  4517. function setWith(object, path, value, customizer) {
  4518. customizer = typeof customizer == "function" ? customizer : void 0;
  4519. return object == null ? object : baseSet(object, path, value, customizer);
  4520. }
  4521. function arrayShuffle(array) {
  4522. return shuffleSelf(copyArray(array));
  4523. }
  4524. function baseShuffle(collection) {
  4525. return shuffleSelf(values(collection));
  4526. }
  4527. function shuffle(collection) {
  4528. var func = isArray$1(collection) ? arrayShuffle : baseShuffle;
  4529. return func(collection);
  4530. }
  4531. var mapTag = "[object Map]";
  4532. var setTag = "[object Set]";
  4533. function size(collection) {
  4534. if (collection == null) {
  4535. return 0;
  4536. }
  4537. if (isArrayLike(collection)) {
  4538. return isString$2(collection) ? stringSize(collection) : collection.length;
  4539. }
  4540. var tag = getTag$1(collection);
  4541. if (tag == mapTag || tag == setTag) {
  4542. return collection.size;
  4543. }
  4544. return baseKeys(collection).length;
  4545. }
  4546. function slice(array, start, end) {
  4547. var length = array == null ? 0 : array.length;
  4548. if (!length) {
  4549. return [];
  4550. }
  4551. if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
  4552. start = 0;
  4553. end = length;
  4554. } else {
  4555. start = start == null ? 0 : toInteger(start);
  4556. end = end === void 0 ? length : toInteger(end);
  4557. }
  4558. return baseSlice(array, start, end);
  4559. }
  4560. var snakeCase = createCompounder(function(result, word, index) {
  4561. return result + (index ? "_" : "") + word.toLowerCase();
  4562. });
  4563. function baseSome(collection, predicate) {
  4564. var result;
  4565. baseEach(collection, function(value, index, collection2) {
  4566. result = predicate(value, index, collection2);
  4567. return !result;
  4568. });
  4569. return !!result;
  4570. }
  4571. function some(collection, predicate, guard) {
  4572. var func = isArray$1(collection) ? arraySome : baseSome;
  4573. if (guard && isIterateeCall(collection, predicate, guard)) {
  4574. predicate = void 0;
  4575. }
  4576. return func(collection, baseIteratee(predicate));
  4577. }
  4578. var sortBy = baseRest(function(collection, iteratees) {
  4579. if (collection == null) {
  4580. return [];
  4581. }
  4582. var length = iteratees.length;
  4583. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  4584. iteratees = [];
  4585. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  4586. iteratees = [iteratees[0]];
  4587. }
  4588. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  4589. });
  4590. var MAX_ARRAY_LENGTH$4 = 4294967295;
  4591. var MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$4 - 1;
  4592. var nativeFloor = Math.floor;
  4593. var nativeMin$4 = Math.min;
  4594. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  4595. var low = 0, high = array == null ? 0 : array.length;
  4596. if (high === 0) {
  4597. return 0;
  4598. }
  4599. value = iteratee(value);
  4600. var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === void 0;
  4601. while (low < high) {
  4602. var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== void 0, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
  4603. if (valIsNaN) {
  4604. var setLow = retHighest || othIsReflexive;
  4605. } else if (valIsUndefined) {
  4606. setLow = othIsReflexive && (retHighest || othIsDefined);
  4607. } else if (valIsNull) {
  4608. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  4609. } else if (valIsSymbol) {
  4610. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  4611. } else if (othIsNull || othIsSymbol) {
  4612. setLow = false;
  4613. } else {
  4614. setLow = retHighest ? computed <= value : computed < value;
  4615. }
  4616. if (setLow) {
  4617. low = mid + 1;
  4618. } else {
  4619. high = mid;
  4620. }
  4621. }
  4622. return nativeMin$4(high, MAX_ARRAY_INDEX);
  4623. }
  4624. var MAX_ARRAY_LENGTH$3 = 4294967295;
  4625. var HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH$3 >>> 1;
  4626. function baseSortedIndex(array, value, retHighest) {
  4627. var low = 0, high = array == null ? low : array.length;
  4628. if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  4629. while (low < high) {
  4630. var mid = low + high >>> 1, computed = array[mid];
  4631. if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
  4632. low = mid + 1;
  4633. } else {
  4634. high = mid;
  4635. }
  4636. }
  4637. return high;
  4638. }
  4639. return baseSortedIndexBy(array, value, identity$1, retHighest);
  4640. }
  4641. function sortedIndex(array, value) {
  4642. return baseSortedIndex(array, value);
  4643. }
  4644. function sortedIndexBy(array, value, iteratee) {
  4645. return baseSortedIndexBy(array, value, baseIteratee(iteratee));
  4646. }
  4647. function sortedIndexOf(array, value) {
  4648. var length = array == null ? 0 : array.length;
  4649. if (length) {
  4650. var index = baseSortedIndex(array, value);
  4651. if (index < length && eq(array[index], value)) {
  4652. return index;
  4653. }
  4654. }
  4655. return -1;
  4656. }
  4657. function sortedLastIndex(array, value) {
  4658. return baseSortedIndex(array, value, true);
  4659. }
  4660. function sortedLastIndexBy(array, value, iteratee) {
  4661. return baseSortedIndexBy(array, value, baseIteratee(iteratee), true);
  4662. }
  4663. function sortedLastIndexOf(array, value) {
  4664. var length = array == null ? 0 : array.length;
  4665. if (length) {
  4666. var index = baseSortedIndex(array, value, true) - 1;
  4667. if (eq(array[index], value)) {
  4668. return index;
  4669. }
  4670. }
  4671. return -1;
  4672. }
  4673. function baseSortedUniq(array, iteratee) {
  4674. var index = -1, length = array.length, resIndex = 0, result = [];
  4675. while (++index < length) {
  4676. var value = array[index], computed = iteratee ? iteratee(value) : value;
  4677. if (!index || !eq(computed, seen)) {
  4678. var seen = computed;
  4679. result[resIndex++] = value === 0 ? 0 : value;
  4680. }
  4681. }
  4682. return result;
  4683. }
  4684. function sortedUniq(array) {
  4685. return array && array.length ? baseSortedUniq(array) : [];
  4686. }
  4687. function sortedUniqBy(array, iteratee) {
  4688. return array && array.length ? baseSortedUniq(array, baseIteratee(iteratee)) : [];
  4689. }
  4690. var MAX_ARRAY_LENGTH$2 = 4294967295;
  4691. function split(string, separator, limit) {
  4692. if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
  4693. separator = limit = void 0;
  4694. }
  4695. limit = limit === void 0 ? MAX_ARRAY_LENGTH$2 : limit >>> 0;
  4696. if (!limit) {
  4697. return [];
  4698. }
  4699. string = toString(string);
  4700. if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
  4701. separator = baseToString(separator);
  4702. if (!separator && hasUnicode(string)) {
  4703. return castSlice(stringToArray(string), 0, limit);
  4704. }
  4705. }
  4706. return string.split(separator, limit);
  4707. }
  4708. var FUNC_ERROR_TEXT$1 = "Expected a function";
  4709. var nativeMax$3 = Math.max;
  4710. function spread(func, start) {
  4711. if (typeof func != "function") {
  4712. throw new TypeError(FUNC_ERROR_TEXT$1);
  4713. }
  4714. start = start == null ? 0 : nativeMax$3(toInteger(start), 0);
  4715. return baseRest(function(args) {
  4716. var array = args[start], otherArgs = castSlice(args, 0, start);
  4717. if (array) {
  4718. arrayPush(otherArgs, array);
  4719. }
  4720. return apply(func, this, otherArgs);
  4721. });
  4722. }
  4723. var startCase = createCompounder(function(result, word, index) {
  4724. return result + (index ? " " : "") + upperFirst(word);
  4725. });
  4726. function startsWith(string, target, position) {
  4727. string = toString(string);
  4728. position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
  4729. target = baseToString(target);
  4730. return string.slice(position, position + target.length) == target;
  4731. }
  4732. function stubObject() {
  4733. return {};
  4734. }
  4735. function stubString() {
  4736. return "";
  4737. }
  4738. function stubTrue() {
  4739. return true;
  4740. }
  4741. var subtract = createMathOperation(function(minuend, subtrahend) {
  4742. return minuend - subtrahend;
  4743. }, 0);
  4744. function sum$1(array) {
  4745. return array && array.length ? baseSum(array, identity$1) : 0;
  4746. }
  4747. function sumBy(array, iteratee) {
  4748. return array && array.length ? baseSum(array, baseIteratee(iteratee)) : 0;
  4749. }
  4750. function tail(array) {
  4751. var length = array == null ? 0 : array.length;
  4752. return length ? baseSlice(array, 1, length) : [];
  4753. }
  4754. function take(array, n, guard) {
  4755. if (!(array && array.length)) {
  4756. return [];
  4757. }
  4758. n = guard || n === void 0 ? 1 : toInteger(n);
  4759. return baseSlice(array, 0, n < 0 ? 0 : n);
  4760. }
  4761. function takeRight(array, n, guard) {
  4762. var length = array == null ? 0 : array.length;
  4763. if (!length) {
  4764. return [];
  4765. }
  4766. n = guard || n === void 0 ? 1 : toInteger(n);
  4767. n = length - n;
  4768. return baseSlice(array, n < 0 ? 0 : n, length);
  4769. }
  4770. function takeRightWhile(array, predicate) {
  4771. return array && array.length ? baseWhile(array, baseIteratee(predicate), false, true) : [];
  4772. }
  4773. function takeWhile(array, predicate) {
  4774. return array && array.length ? baseWhile(array, baseIteratee(predicate)) : [];
  4775. }
  4776. function tap(value, interceptor) {
  4777. interceptor(value);
  4778. return value;
  4779. }
  4780. var objectProto$2 = Object.prototype;
  4781. var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
  4782. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  4783. if (objValue === void 0 || eq(objValue, objectProto$2[key]) && !hasOwnProperty$3.call(object, key)) {
  4784. return srcValue;
  4785. }
  4786. return objValue;
  4787. }
  4788. var stringEscapes = {
  4789. "\\": "\\",
  4790. "'": "'",
  4791. "\n": "n",
  4792. "\r": "r",
  4793. "\u2028": "u2028",
  4794. "\u2029": "u2029"
  4795. };
  4796. function escapeStringChar(chr) {
  4797. return "\\" + stringEscapes[chr];
  4798. }
  4799. var reInterpolate = /<%=([\s\S]+?)%>/g;
  4800. var reEscape = /<%-([\s\S]+?)%>/g;
  4801. var reEvaluate = /<%([\s\S]+?)%>/g;
  4802. var templateSettings = {
  4803. "escape": reEscape,
  4804. "evaluate": reEvaluate,
  4805. "interpolate": reInterpolate,
  4806. "variable": "",
  4807. "imports": {
  4808. "_": { "escape": escape }
  4809. }
  4810. };
  4811. var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
  4812. var reEmptyStringLeading = /\b__p \+= '';/g;
  4813. var reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
  4814. var reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  4815. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  4816. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  4817. var reNoMatch = /($^)/;
  4818. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  4819. var objectProto$1 = Object.prototype;
  4820. var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
  4821. function template(string, options, guard) {
  4822. var settings = templateSettings.imports._.templateSettings || templateSettings;
  4823. if (guard && isIterateeCall(string, options, guard)) {
  4824. options = void 0;
  4825. }
  4826. string = toString(string);
  4827. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  4828. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
  4829. var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
  4830. var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
  4831. var sourceURL = hasOwnProperty$2.call(options, "sourceURL") ? "//# sourceURL=" + (options.sourceURL + "").replace(/\s/g, " ") + "\n" : "";
  4832. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  4833. interpolateValue || (interpolateValue = esTemplateValue);
  4834. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  4835. if (escapeValue) {
  4836. isEscaping = true;
  4837. source += "' +\n__e(" + escapeValue + ") +\n'";
  4838. }
  4839. if (evaluateValue) {
  4840. isEvaluating = true;
  4841. source += "';\n" + evaluateValue + ";\n__p += '";
  4842. }
  4843. if (interpolateValue) {
  4844. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  4845. }
  4846. index = offset + match.length;
  4847. return match;
  4848. });
  4849. source += "';\n";
  4850. var variable = hasOwnProperty$2.call(options, "variable") && options.variable;
  4851. if (!variable) {
  4852. source = "with (obj) {\n" + source + "\n}\n";
  4853. } else if (reForbiddenIdentifierChars.test(variable)) {
  4854. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  4855. }
  4856. source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
  4857. 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}";
  4858. var result = attempt(function() {
  4859. return Function(importsKeys, sourceURL + "return " + source).apply(void 0, importsValues);
  4860. });
  4861. result.source = source;
  4862. if (isError(result)) {
  4863. throw result;
  4864. }
  4865. return result;
  4866. }
  4867. var FUNC_ERROR_TEXT = "Expected a function";
  4868. function throttle(func, wait, options) {
  4869. var leading = true, trailing = true;
  4870. if (typeof func != "function") {
  4871. throw new TypeError(FUNC_ERROR_TEXT);
  4872. }
  4873. if (isObject$2(options)) {
  4874. leading = "leading" in options ? !!options.leading : leading;
  4875. trailing = "trailing" in options ? !!options.trailing : trailing;
  4876. }
  4877. return debounce(func, wait, {
  4878. "leading": leading,
  4879. "maxWait": wait,
  4880. "trailing": trailing
  4881. });
  4882. }
  4883. function thru(value, interceptor) {
  4884. return interceptor(value);
  4885. }
  4886. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  4887. var MAX_ARRAY_LENGTH$1 = 4294967295;
  4888. var nativeMin$3 = Math.min;
  4889. function times(n, iteratee) {
  4890. n = toInteger(n);
  4891. if (n < 1 || n > MAX_SAFE_INTEGER$1) {
  4892. return [];
  4893. }
  4894. var index = MAX_ARRAY_LENGTH$1, length = nativeMin$3(n, MAX_ARRAY_LENGTH$1);
  4895. iteratee = castFunction(iteratee);
  4896. n -= MAX_ARRAY_LENGTH$1;
  4897. var result = baseTimes(length, iteratee);
  4898. while (++index < n) {
  4899. iteratee(index);
  4900. }
  4901. return result;
  4902. }
  4903. function wrapperToIterator() {
  4904. return this;
  4905. }
  4906. function baseWrapperValue(value, actions) {
  4907. var result = value;
  4908. if (result instanceof LazyWrapper) {
  4909. result = result.value();
  4910. }
  4911. return arrayReduce(actions, function(result2, action) {
  4912. return action.func.apply(action.thisArg, arrayPush([result2], action.args));
  4913. }, result);
  4914. }
  4915. function wrapperValue() {
  4916. return baseWrapperValue(this.__wrapped__, this.__actions__);
  4917. }
  4918. function toLower(value) {
  4919. return toString(value).toLowerCase();
  4920. }
  4921. function toPath(value) {
  4922. if (isArray$1(value)) {
  4923. return arrayMap(value, toKey);
  4924. }
  4925. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  4926. }
  4927. var MAX_SAFE_INTEGER = 9007199254740991;
  4928. function toSafeInteger(value) {
  4929. return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
  4930. }
  4931. function toUpper(value) {
  4932. return toString(value).toUpperCase();
  4933. }
  4934. function transform(object, iteratee, accumulator) {
  4935. var isArr = isArray$1(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  4936. iteratee = baseIteratee(iteratee);
  4937. if (accumulator == null) {
  4938. var Ctor = object && object.constructor;
  4939. if (isArrLike) {
  4940. accumulator = isArr ? new Ctor() : [];
  4941. } else if (isObject$2(object)) {
  4942. accumulator = isFunction$1(Ctor) ? baseCreate(getPrototype(object)) : {};
  4943. } else {
  4944. accumulator = {};
  4945. }
  4946. }
  4947. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
  4948. return iteratee(accumulator, value, index, object2);
  4949. });
  4950. return accumulator;
  4951. }
  4952. function charsEndIndex(strSymbols, chrSymbols) {
  4953. var index = strSymbols.length;
  4954. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  4955. }
  4956. return index;
  4957. }
  4958. function charsStartIndex(strSymbols, chrSymbols) {
  4959. var index = -1, length = strSymbols.length;
  4960. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  4961. }
  4962. return index;
  4963. }
  4964. function trim(string, chars, guard) {
  4965. string = toString(string);
  4966. if (string && (guard || chars === void 0)) {
  4967. return baseTrim(string);
  4968. }
  4969. if (!string || !(chars = baseToString(chars))) {
  4970. return string;
  4971. }
  4972. var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
  4973. return castSlice(strSymbols, start, end).join("");
  4974. }
  4975. function trimEnd(string, chars, guard) {
  4976. string = toString(string);
  4977. if (string && (guard || chars === void 0)) {
  4978. return string.slice(0, trimmedEndIndex(string) + 1);
  4979. }
  4980. if (!string || !(chars = baseToString(chars))) {
  4981. return string;
  4982. }
  4983. var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  4984. return castSlice(strSymbols, 0, end).join("");
  4985. }
  4986. var reTrimStart = /^\s+/;
  4987. function trimStart(string, chars, guard) {
  4988. string = toString(string);
  4989. if (string && (guard || chars === void 0)) {
  4990. return string.replace(reTrimStart, "");
  4991. }
  4992. if (!string || !(chars = baseToString(chars))) {
  4993. return string;
  4994. }
  4995. var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
  4996. return castSlice(strSymbols, start).join("");
  4997. }
  4998. var DEFAULT_TRUNC_LENGTH = 30;
  4999. var DEFAULT_TRUNC_OMISSION = "...";
  5000. var reFlags = /\w*$/;
  5001. function truncate(string, options) {
  5002. var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
  5003. if (isObject$2(options)) {
  5004. var separator = "separator" in options ? options.separator : separator;
  5005. length = "length" in options ? toInteger(options.length) : length;
  5006. omission = "omission" in options ? baseToString(options.omission) : omission;
  5007. }
  5008. string = toString(string);
  5009. var strLength = string.length;
  5010. if (hasUnicode(string)) {
  5011. var strSymbols = stringToArray(string);
  5012. strLength = strSymbols.length;
  5013. }
  5014. if (length >= strLength) {
  5015. return string;
  5016. }
  5017. var end = length - stringSize(omission);
  5018. if (end < 1) {
  5019. return omission;
  5020. }
  5021. var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
  5022. if (separator === void 0) {
  5023. return result + omission;
  5024. }
  5025. if (strSymbols) {
  5026. end += result.length - end;
  5027. }
  5028. if (isRegExp(separator)) {
  5029. if (string.slice(end).search(separator)) {
  5030. var match, substring = result;
  5031. if (!separator.global) {
  5032. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g");
  5033. }
  5034. separator.lastIndex = 0;
  5035. while (match = separator.exec(substring)) {
  5036. var newEnd = match.index;
  5037. }
  5038. result = result.slice(0, newEnd === void 0 ? end : newEnd);
  5039. }
  5040. } else if (string.indexOf(baseToString(separator), end) != end) {
  5041. var index = result.lastIndexOf(separator);
  5042. if (index > -1) {
  5043. result = result.slice(0, index);
  5044. }
  5045. }
  5046. return result + omission;
  5047. }
  5048. function unary(func) {
  5049. return ary(func, 1);
  5050. }
  5051. var htmlUnescapes = {
  5052. "&amp;": "&",
  5053. "&lt;": "<",
  5054. "&gt;": ">",
  5055. "&quot;": '"',
  5056. "&#39;": "'"
  5057. };
  5058. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  5059. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
  5060. var reHasEscapedHtml = RegExp(reEscapedHtml.source);
  5061. function unescape(string) {
  5062. string = toString(string);
  5063. return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
  5064. }
  5065. var INFINITY = 1 / 0;
  5066. var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY) ? noop$1 : function(values) {
  5067. return new Set$1(values);
  5068. };
  5069. var LARGE_ARRAY_SIZE = 200;
  5070. function baseUniq(array, iteratee, comparator) {
  5071. var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
  5072. if (comparator) {
  5073. isCommon = false;
  5074. includes = arrayIncludesWith;
  5075. } else if (length >= LARGE_ARRAY_SIZE) {
  5076. var set = iteratee ? null : createSet(array);
  5077. if (set) {
  5078. return setToArray(set);
  5079. }
  5080. isCommon = false;
  5081. includes = cacheHas;
  5082. seen = new SetCache();
  5083. } else {
  5084. seen = iteratee ? [] : result;
  5085. }
  5086. outer:
  5087. while (++index < length) {
  5088. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5089. value = comparator || value !== 0 ? value : 0;
  5090. if (isCommon && computed === computed) {
  5091. var seenIndex = seen.length;
  5092. while (seenIndex--) {
  5093. if (seen[seenIndex] === computed) {
  5094. continue outer;
  5095. }
  5096. }
  5097. if (iteratee) {
  5098. seen.push(computed);
  5099. }
  5100. result.push(value);
  5101. } else if (!includes(seen, computed, comparator)) {
  5102. if (seen !== result) {
  5103. seen.push(computed);
  5104. }
  5105. result.push(value);
  5106. }
  5107. }
  5108. return result;
  5109. }
  5110. var union = baseRest(function(arrays) {
  5111. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  5112. });
  5113. var unionBy = baseRest(function(arrays) {
  5114. var iteratee = last(arrays);
  5115. if (isArrayLikeObject(iteratee)) {
  5116. iteratee = void 0;
  5117. }
  5118. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee));
  5119. });
  5120. var unionWith = baseRest(function(arrays) {
  5121. var comparator = last(arrays);
  5122. comparator = typeof comparator == "function" ? comparator : void 0;
  5123. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), void 0, comparator);
  5124. });
  5125. function uniq(array) {
  5126. return array && array.length ? baseUniq(array) : [];
  5127. }
  5128. function uniqBy(array, iteratee) {
  5129. return array && array.length ? baseUniq(array, baseIteratee(iteratee)) : [];
  5130. }
  5131. function uniqWith(array, comparator) {
  5132. comparator = typeof comparator == "function" ? comparator : void 0;
  5133. return array && array.length ? baseUniq(array, void 0, comparator) : [];
  5134. }
  5135. var idCounter = 0;
  5136. function uniqueId(prefix) {
  5137. var id = ++idCounter;
  5138. return toString(prefix) + id;
  5139. }
  5140. function unset(object, path) {
  5141. return object == null ? true : baseUnset(object, path);
  5142. }
  5143. var nativeMax$2 = Math.max;
  5144. function unzip(array) {
  5145. if (!(array && array.length)) {
  5146. return [];
  5147. }
  5148. var length = 0;
  5149. array = arrayFilter(array, function(group) {
  5150. if (isArrayLikeObject(group)) {
  5151. length = nativeMax$2(group.length, length);
  5152. return true;
  5153. }
  5154. });
  5155. return baseTimes(length, function(index) {
  5156. return arrayMap(array, baseProperty(index));
  5157. });
  5158. }
  5159. function unzipWith(array, iteratee) {
  5160. if (!(array && array.length)) {
  5161. return [];
  5162. }
  5163. var result = unzip(array);
  5164. if (iteratee == null) {
  5165. return result;
  5166. }
  5167. return arrayMap(result, function(group) {
  5168. return apply(iteratee, void 0, group);
  5169. });
  5170. }
  5171. function baseUpdate(object, path, updater, customizer) {
  5172. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5173. }
  5174. function update(object, path, updater) {
  5175. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  5176. }
  5177. function updateWith(object, path, updater, customizer) {
  5178. customizer = typeof customizer == "function" ? customizer : void 0;
  5179. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  5180. }
  5181. var upperCase = createCompounder(function(result, word, index) {
  5182. return result + (index ? " " : "") + word.toUpperCase();
  5183. });
  5184. function valuesIn(object) {
  5185. return object == null ? [] : baseValues(object, keysIn(object));
  5186. }
  5187. var without = baseRest(function(array, values) {
  5188. return isArrayLikeObject(array) ? baseDifference(array, values) : [];
  5189. });
  5190. function wrap(value, wrapper) {
  5191. return partial(castFunction(wrapper), value);
  5192. }
  5193. var wrapperAt = flatRest(function(paths) {
  5194. var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
  5195. return baseAt(object, paths);
  5196. };
  5197. if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
  5198. return this.thru(interceptor);
  5199. }
  5200. value = value.slice(start, +start + (length ? 1 : 0));
  5201. value.__actions__.push({
  5202. "func": thru,
  5203. "args": [interceptor],
  5204. "thisArg": void 0
  5205. });
  5206. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  5207. if (length && !array.length) {
  5208. array.push(void 0);
  5209. }
  5210. return array;
  5211. });
  5212. });
  5213. function wrapperChain() {
  5214. return chain(this);
  5215. }
  5216. function wrapperReverse() {
  5217. var value = this.__wrapped__;
  5218. if (value instanceof LazyWrapper) {
  5219. var wrapped = value;
  5220. if (this.__actions__.length) {
  5221. wrapped = new LazyWrapper(this);
  5222. }
  5223. wrapped = wrapped.reverse();
  5224. wrapped.__actions__.push({
  5225. "func": thru,
  5226. "args": [reverse],
  5227. "thisArg": void 0
  5228. });
  5229. return new LodashWrapper(wrapped, this.__chain__);
  5230. }
  5231. return this.thru(reverse);
  5232. }
  5233. function baseXor(arrays, iteratee, comparator) {
  5234. var length = arrays.length;
  5235. if (length < 2) {
  5236. return length ? baseUniq(arrays[0]) : [];
  5237. }
  5238. var index = -1, result = Array(length);
  5239. while (++index < length) {
  5240. var array = arrays[index], othIndex = -1;
  5241. while (++othIndex < length) {
  5242. if (othIndex != index) {
  5243. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5244. }
  5245. }
  5246. }
  5247. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5248. }
  5249. var xor = baseRest(function(arrays) {
  5250. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  5251. });
  5252. var xorBy = baseRest(function(arrays) {
  5253. var iteratee = last(arrays);
  5254. if (isArrayLikeObject(iteratee)) {
  5255. iteratee = void 0;
  5256. }
  5257. return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee));
  5258. });
  5259. var xorWith = baseRest(function(arrays) {
  5260. var comparator = last(arrays);
  5261. comparator = typeof comparator == "function" ? comparator : void 0;
  5262. return baseXor(arrayFilter(arrays, isArrayLikeObject), void 0, comparator);
  5263. });
  5264. var zip = baseRest(unzip);
  5265. function baseZipObject(props, values, assignFunc) {
  5266. var index = -1, length = props.length, valsLength = values.length, result = {};
  5267. while (++index < length) {
  5268. var value = index < valsLength ? values[index] : void 0;
  5269. assignFunc(result, props[index], value);
  5270. }
  5271. return result;
  5272. }
  5273. function zipObject(props, values) {
  5274. return baseZipObject(props || [], values || [], assignValue);
  5275. }
  5276. function zipObjectDeep(props, values) {
  5277. return baseZipObject(props || [], values || [], baseSet);
  5278. }
  5279. var zipWith = baseRest(function(arrays) {
  5280. var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : void 0;
  5281. iteratee = typeof iteratee == "function" ? (arrays.pop(), iteratee) : void 0;
  5282. return unzipWith(arrays, iteratee);
  5283. });
  5284. var array = {
  5285. chunk,
  5286. compact,
  5287. concat,
  5288. difference,
  5289. differenceBy,
  5290. differenceWith,
  5291. drop,
  5292. dropRight,
  5293. dropRightWhile,
  5294. dropWhile,
  5295. fill,
  5296. findIndex,
  5297. findLastIndex,
  5298. first: head,
  5299. flatten,
  5300. flattenDeep,
  5301. flattenDepth,
  5302. fromPairs,
  5303. head,
  5304. indexOf,
  5305. initial,
  5306. intersection,
  5307. intersectionBy,
  5308. intersectionWith,
  5309. join,
  5310. last,
  5311. lastIndexOf,
  5312. nth,
  5313. pull,
  5314. pullAll,
  5315. pullAllBy,
  5316. pullAllWith,
  5317. pullAt,
  5318. remove,
  5319. reverse,
  5320. slice,
  5321. sortedIndex,
  5322. sortedIndexBy,
  5323. sortedIndexOf,
  5324. sortedLastIndex,
  5325. sortedLastIndexBy,
  5326. sortedLastIndexOf,
  5327. sortedUniq,
  5328. sortedUniqBy,
  5329. tail,
  5330. take,
  5331. takeRight,
  5332. takeRightWhile,
  5333. takeWhile,
  5334. union,
  5335. unionBy,
  5336. unionWith,
  5337. uniq,
  5338. uniqBy,
  5339. uniqWith,
  5340. unzip,
  5341. unzipWith,
  5342. without,
  5343. xor,
  5344. xorBy,
  5345. xorWith,
  5346. zip,
  5347. zipObject,
  5348. zipObjectDeep,
  5349. zipWith
  5350. };
  5351. var collection = {
  5352. countBy,
  5353. each: forEach,
  5354. eachRight: forEachRight,
  5355. every,
  5356. filter,
  5357. find,
  5358. findLast,
  5359. flatMap,
  5360. flatMapDeep,
  5361. flatMapDepth,
  5362. forEach,
  5363. forEachRight,
  5364. groupBy,
  5365. includes,
  5366. invokeMap,
  5367. keyBy,
  5368. map,
  5369. orderBy: orderBy$1,
  5370. partition,
  5371. reduce,
  5372. reduceRight,
  5373. reject,
  5374. sample,
  5375. sampleSize,
  5376. shuffle,
  5377. size,
  5378. some,
  5379. sortBy
  5380. };
  5381. var date$1 = {
  5382. now
  5383. };
  5384. var func = {
  5385. after,
  5386. ary,
  5387. before,
  5388. bind,
  5389. bindKey,
  5390. curry,
  5391. curryRight,
  5392. debounce,
  5393. defer,
  5394. delay,
  5395. flip,
  5396. memoize,
  5397. negate,
  5398. once,
  5399. overArgs,
  5400. partial,
  5401. partialRight,
  5402. rearg,
  5403. rest,
  5404. spread,
  5405. throttle,
  5406. unary,
  5407. wrap
  5408. };
  5409. var lang = {
  5410. castArray: castArray$1,
  5411. clone,
  5412. cloneDeep,
  5413. cloneDeepWith,
  5414. cloneWith,
  5415. conformsTo,
  5416. eq,
  5417. gt: gt$1,
  5418. gte,
  5419. isArguments,
  5420. isArray: isArray$1,
  5421. isArrayBuffer,
  5422. isArrayLike,
  5423. isArrayLikeObject,
  5424. isBoolean: isBoolean$1,
  5425. isBuffer,
  5426. isDate: isDate$1,
  5427. isElement: isElement$2,
  5428. isEmpty: isEmpty$1,
  5429. isEqual: isEqual$1,
  5430. isEqualWith,
  5431. isError,
  5432. isFinite,
  5433. isFunction: isFunction$1,
  5434. isInteger,
  5435. isLength,
  5436. isMap,
  5437. isMatch,
  5438. isMatchWith,
  5439. isNaN: isNaN$1,
  5440. isNative,
  5441. isNil,
  5442. isNull,
  5443. isNumber: isNumber$1,
  5444. isObject: isObject$2,
  5445. isObjectLike,
  5446. isPlainObject,
  5447. isRegExp,
  5448. isSafeInteger,
  5449. isSet,
  5450. isString: isString$2,
  5451. isSymbol,
  5452. isTypedArray,
  5453. isUndefined: isUndefined$1,
  5454. isWeakMap,
  5455. isWeakSet,
  5456. lt: lt$1,
  5457. lte,
  5458. toArray,
  5459. toFinite,
  5460. toInteger,
  5461. toLength,
  5462. toNumber,
  5463. toPlainObject,
  5464. toSafeInteger,
  5465. toString
  5466. };
  5467. var math = {
  5468. add,
  5469. ceil,
  5470. divide,
  5471. floor: floor$1,
  5472. max: max$3,
  5473. maxBy,
  5474. mean,
  5475. meanBy,
  5476. min: min$3,
  5477. minBy,
  5478. multiply,
  5479. round: round$1,
  5480. subtract,
  5481. sum: sum$1,
  5482. sumBy
  5483. };
  5484. var number = {
  5485. clamp,
  5486. inRange,
  5487. random
  5488. };
  5489. var object = {
  5490. assign,
  5491. assignIn,
  5492. assignInWith,
  5493. assignWith,
  5494. at: at$1,
  5495. create,
  5496. defaults,
  5497. defaultsDeep,
  5498. entries: toPairs,
  5499. entriesIn: toPairsIn,
  5500. extend: assignIn,
  5501. extendWith: assignInWith,
  5502. findKey,
  5503. findLastKey,
  5504. forIn,
  5505. forInRight,
  5506. forOwn,
  5507. forOwnRight,
  5508. functions,
  5509. functionsIn,
  5510. get,
  5511. has,
  5512. hasIn,
  5513. invert,
  5514. invertBy,
  5515. invoke,
  5516. keys,
  5517. keysIn,
  5518. mapKeys,
  5519. mapValues,
  5520. merge,
  5521. mergeWith,
  5522. omit,
  5523. omitBy,
  5524. pick,
  5525. pickBy,
  5526. result,
  5527. set,
  5528. setWith,
  5529. toPairs,
  5530. toPairsIn,
  5531. transform,
  5532. unset,
  5533. update,
  5534. updateWith,
  5535. values,
  5536. valuesIn
  5537. };
  5538. var seq = {
  5539. at: wrapperAt,
  5540. chain,
  5541. commit: wrapperCommit,
  5542. lodash,
  5543. next: wrapperNext,
  5544. plant: wrapperPlant,
  5545. reverse: wrapperReverse,
  5546. tap,
  5547. thru,
  5548. toIterator: wrapperToIterator,
  5549. toJSON: wrapperValue,
  5550. value: wrapperValue,
  5551. valueOf: wrapperValue,
  5552. wrapperChain
  5553. };
  5554. var string$1 = {
  5555. camelCase,
  5556. capitalize: capitalize$2,
  5557. deburr,
  5558. endsWith,
  5559. escape,
  5560. escapeRegExp,
  5561. kebabCase,
  5562. lowerCase,
  5563. lowerFirst,
  5564. pad,
  5565. padEnd,
  5566. padStart,
  5567. parseInt: parseInt$1,
  5568. repeat,
  5569. replace,
  5570. snakeCase,
  5571. split,
  5572. startCase,
  5573. startsWith,
  5574. template,
  5575. templateSettings,
  5576. toLower,
  5577. toUpper,
  5578. trim,
  5579. trimEnd,
  5580. trimStart,
  5581. truncate,
  5582. unescape,
  5583. upperCase,
  5584. upperFirst,
  5585. words
  5586. };
  5587. var util = {
  5588. attempt,
  5589. bindAll,
  5590. cond,
  5591. conforms,
  5592. constant,
  5593. defaultTo,
  5594. flow,
  5595. flowRight,
  5596. identity: identity$1,
  5597. iteratee,
  5598. matches,
  5599. matchesProperty,
  5600. method,
  5601. methodOf,
  5602. mixin: mixin$1,
  5603. noop: noop$1,
  5604. nthArg,
  5605. over,
  5606. overEvery,
  5607. overSome,
  5608. property,
  5609. propertyOf,
  5610. range: range$1,
  5611. rangeRight,
  5612. stubArray,
  5613. stubFalse,
  5614. stubObject,
  5615. stubString,
  5616. stubTrue,
  5617. times,
  5618. toPath,
  5619. uniqueId
  5620. };
  5621. function lazyClone() {
  5622. var result = new LazyWrapper(this.__wrapped__);
  5623. result.__actions__ = copyArray(this.__actions__);
  5624. result.__dir__ = this.__dir__;
  5625. result.__filtered__ = this.__filtered__;
  5626. result.__iteratees__ = copyArray(this.__iteratees__);
  5627. result.__takeCount__ = this.__takeCount__;
  5628. result.__views__ = copyArray(this.__views__);
  5629. return result;
  5630. }
  5631. function lazyReverse() {
  5632. if (this.__filtered__) {
  5633. var result = new LazyWrapper(this);
  5634. result.__dir__ = -1;
  5635. result.__filtered__ = true;
  5636. } else {
  5637. result = this.clone();
  5638. result.__dir__ *= -1;
  5639. }
  5640. return result;
  5641. }
  5642. var nativeMax$1 = Math.max;
  5643. var nativeMin$2 = Math.min;
  5644. function getView(start, end, transforms) {
  5645. var index = -1, length = transforms.length;
  5646. while (++index < length) {
  5647. var data = transforms[index], size = data.size;
  5648. switch (data.type) {
  5649. case "drop":
  5650. start += size;
  5651. break;
  5652. case "dropRight":
  5653. end -= size;
  5654. break;
  5655. case "take":
  5656. end = nativeMin$2(end, start + size);
  5657. break;
  5658. case "takeRight":
  5659. start = nativeMax$1(start, end - size);
  5660. break;
  5661. }
  5662. }
  5663. return { "start": start, "end": end };
  5664. }
  5665. var LAZY_FILTER_FLAG$1 = 1;
  5666. var LAZY_MAP_FLAG = 2;
  5667. var nativeMin$1 = Math.min;
  5668. function lazyValue() {
  5669. var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray$1(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__);
  5670. if (!isArr || !isRight && arrLength == length && takeCount == length) {
  5671. return baseWrapperValue(array, this.__actions__);
  5672. }
  5673. var result = [];
  5674. outer:
  5675. while (length-- && resIndex < takeCount) {
  5676. index += dir;
  5677. var iterIndex = -1, value = array[index];
  5678. while (++iterIndex < iterLength) {
  5679. var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value);
  5680. if (type == LAZY_MAP_FLAG) {
  5681. value = computed;
  5682. } else if (!computed) {
  5683. if (type == LAZY_FILTER_FLAG$1) {
  5684. continue outer;
  5685. } else {
  5686. break outer;
  5687. }
  5688. }
  5689. }
  5690. result[resIndex++] = value;
  5691. }
  5692. return result;
  5693. }
  5694. var VERSION = "4.17.21";
  5695. var WRAP_BIND_KEY_FLAG = 2;
  5696. var LAZY_FILTER_FLAG = 1;
  5697. var LAZY_WHILE_FLAG = 3;
  5698. var MAX_ARRAY_LENGTH = 4294967295;
  5699. var arrayProto = Array.prototype;
  5700. var objectProto = Object.prototype;
  5701. var hasOwnProperty$1 = objectProto.hasOwnProperty;
  5702. var symIterator = Symbol$1 ? Symbol$1.iterator : void 0;
  5703. var nativeMax = Math.max;
  5704. var nativeMin = Math.min;
  5705. var mixin = function(func2) {
  5706. return function(object2, source, options) {
  5707. if (options == null) {
  5708. var isObj = isObject$2(source), props = isObj && keys(source), methodNames = props && props.length && baseFunctions(source, props);
  5709. if (!(methodNames ? methodNames.length : isObj)) {
  5710. options = source;
  5711. source = object2;
  5712. object2 = this;
  5713. }
  5714. }
  5715. return func2(object2, source, options);
  5716. };
  5717. }(mixin$1);
  5718. lodash.after = func.after;
  5719. lodash.ary = func.ary;
  5720. lodash.assign = object.assign;
  5721. lodash.assignIn = object.assignIn;
  5722. lodash.assignInWith = object.assignInWith;
  5723. lodash.assignWith = object.assignWith;
  5724. lodash.at = object.at;
  5725. lodash.before = func.before;
  5726. lodash.bind = func.bind;
  5727. lodash.bindAll = util.bindAll;
  5728. lodash.bindKey = func.bindKey;
  5729. lodash.castArray = lang.castArray;
  5730. lodash.chain = seq.chain;
  5731. lodash.chunk = array.chunk;
  5732. lodash.compact = array.compact;
  5733. lodash.concat = array.concat;
  5734. lodash.cond = util.cond;
  5735. lodash.conforms = util.conforms;
  5736. lodash.constant = util.constant;
  5737. lodash.countBy = collection.countBy;
  5738. lodash.create = object.create;
  5739. lodash.curry = func.curry;
  5740. lodash.curryRight = func.curryRight;
  5741. lodash.debounce = func.debounce;
  5742. lodash.defaults = object.defaults;
  5743. lodash.defaultsDeep = object.defaultsDeep;
  5744. lodash.defer = func.defer;
  5745. lodash.delay = func.delay;
  5746. lodash.difference = array.difference;
  5747. lodash.differenceBy = array.differenceBy;
  5748. lodash.differenceWith = array.differenceWith;
  5749. lodash.drop = array.drop;
  5750. lodash.dropRight = array.dropRight;
  5751. lodash.dropRightWhile = array.dropRightWhile;
  5752. lodash.dropWhile = array.dropWhile;
  5753. lodash.fill = array.fill;
  5754. lodash.filter = collection.filter;
  5755. lodash.flatMap = collection.flatMap;
  5756. lodash.flatMapDeep = collection.flatMapDeep;
  5757. lodash.flatMapDepth = collection.flatMapDepth;
  5758. lodash.flatten = array.flatten;
  5759. lodash.flattenDeep = array.flattenDeep;
  5760. lodash.flattenDepth = array.flattenDepth;
  5761. lodash.flip = func.flip;
  5762. lodash.flow = util.flow;
  5763. lodash.flowRight = util.flowRight;
  5764. lodash.fromPairs = array.fromPairs;
  5765. lodash.functions = object.functions;
  5766. lodash.functionsIn = object.functionsIn;
  5767. lodash.groupBy = collection.groupBy;
  5768. lodash.initial = array.initial;
  5769. lodash.intersection = array.intersection;
  5770. lodash.intersectionBy = array.intersectionBy;
  5771. lodash.intersectionWith = array.intersectionWith;
  5772. lodash.invert = object.invert;
  5773. lodash.invertBy = object.invertBy;
  5774. lodash.invokeMap = collection.invokeMap;
  5775. lodash.iteratee = util.iteratee;
  5776. lodash.keyBy = collection.keyBy;
  5777. lodash.keys = keys;
  5778. lodash.keysIn = object.keysIn;
  5779. lodash.map = collection.map;
  5780. lodash.mapKeys = object.mapKeys;
  5781. lodash.mapValues = object.mapValues;
  5782. lodash.matches = util.matches;
  5783. lodash.matchesProperty = util.matchesProperty;
  5784. lodash.memoize = func.memoize;
  5785. lodash.merge = object.merge;
  5786. lodash.mergeWith = object.mergeWith;
  5787. lodash.method = util.method;
  5788. lodash.methodOf = util.methodOf;
  5789. lodash.mixin = mixin;
  5790. lodash.negate = negate;
  5791. lodash.nthArg = util.nthArg;
  5792. lodash.omit = object.omit;
  5793. lodash.omitBy = object.omitBy;
  5794. lodash.once = func.once;
  5795. lodash.orderBy = collection.orderBy;
  5796. lodash.over = util.over;
  5797. lodash.overArgs = func.overArgs;
  5798. lodash.overEvery = util.overEvery;
  5799. lodash.overSome = util.overSome;
  5800. lodash.partial = func.partial;
  5801. lodash.partialRight = func.partialRight;
  5802. lodash.partition = collection.partition;
  5803. lodash.pick = object.pick;
  5804. lodash.pickBy = object.pickBy;
  5805. lodash.property = util.property;
  5806. lodash.propertyOf = util.propertyOf;
  5807. lodash.pull = array.pull;
  5808. lodash.pullAll = array.pullAll;
  5809. lodash.pullAllBy = array.pullAllBy;
  5810. lodash.pullAllWith = array.pullAllWith;
  5811. lodash.pullAt = array.pullAt;
  5812. lodash.range = util.range;
  5813. lodash.rangeRight = util.rangeRight;
  5814. lodash.rearg = func.rearg;
  5815. lodash.reject = collection.reject;
  5816. lodash.remove = array.remove;
  5817. lodash.rest = func.rest;
  5818. lodash.reverse = array.reverse;
  5819. lodash.sampleSize = collection.sampleSize;
  5820. lodash.set = object.set;
  5821. lodash.setWith = object.setWith;
  5822. lodash.shuffle = collection.shuffle;
  5823. lodash.slice = array.slice;
  5824. lodash.sortBy = collection.sortBy;
  5825. lodash.sortedUniq = array.sortedUniq;
  5826. lodash.sortedUniqBy = array.sortedUniqBy;
  5827. lodash.split = string$1.split;
  5828. lodash.spread = func.spread;
  5829. lodash.tail = array.tail;
  5830. lodash.take = array.take;
  5831. lodash.takeRight = array.takeRight;
  5832. lodash.takeRightWhile = array.takeRightWhile;
  5833. lodash.takeWhile = array.takeWhile;
  5834. lodash.tap = seq.tap;
  5835. lodash.throttle = func.throttle;
  5836. lodash.thru = thru;
  5837. lodash.toArray = lang.toArray;
  5838. lodash.toPairs = object.toPairs;
  5839. lodash.toPairsIn = object.toPairsIn;
  5840. lodash.toPath = util.toPath;
  5841. lodash.toPlainObject = lang.toPlainObject;
  5842. lodash.transform = object.transform;
  5843. lodash.unary = func.unary;
  5844. lodash.union = array.union;
  5845. lodash.unionBy = array.unionBy;
  5846. lodash.unionWith = array.unionWith;
  5847. lodash.uniq = array.uniq;
  5848. lodash.uniqBy = array.uniqBy;
  5849. lodash.uniqWith = array.uniqWith;
  5850. lodash.unset = object.unset;
  5851. lodash.unzip = array.unzip;
  5852. lodash.unzipWith = array.unzipWith;
  5853. lodash.update = object.update;
  5854. lodash.updateWith = object.updateWith;
  5855. lodash.values = object.values;
  5856. lodash.valuesIn = object.valuesIn;
  5857. lodash.without = array.without;
  5858. lodash.words = string$1.words;
  5859. lodash.wrap = func.wrap;
  5860. lodash.xor = array.xor;
  5861. lodash.xorBy = array.xorBy;
  5862. lodash.xorWith = array.xorWith;
  5863. lodash.zip = array.zip;
  5864. lodash.zipObject = array.zipObject;
  5865. lodash.zipObjectDeep = array.zipObjectDeep;
  5866. lodash.zipWith = array.zipWith;
  5867. lodash.entries = object.toPairs;
  5868. lodash.entriesIn = object.toPairsIn;
  5869. lodash.extend = object.assignIn;
  5870. lodash.extendWith = object.assignInWith;
  5871. mixin(lodash, lodash);
  5872. lodash.add = math.add;
  5873. lodash.attempt = util.attempt;
  5874. lodash.camelCase = string$1.camelCase;
  5875. lodash.capitalize = string$1.capitalize;
  5876. lodash.ceil = math.ceil;
  5877. lodash.clamp = number.clamp;
  5878. lodash.clone = lang.clone;
  5879. lodash.cloneDeep = lang.cloneDeep;
  5880. lodash.cloneDeepWith = lang.cloneDeepWith;
  5881. lodash.cloneWith = lang.cloneWith;
  5882. lodash.conformsTo = lang.conformsTo;
  5883. lodash.deburr = string$1.deburr;
  5884. lodash.defaultTo = util.defaultTo;
  5885. lodash.divide = math.divide;
  5886. lodash.endsWith = string$1.endsWith;
  5887. lodash.eq = lang.eq;
  5888. lodash.escape = string$1.escape;
  5889. lodash.escapeRegExp = string$1.escapeRegExp;
  5890. lodash.every = collection.every;
  5891. lodash.find = collection.find;
  5892. lodash.findIndex = array.findIndex;
  5893. lodash.findKey = object.findKey;
  5894. lodash.findLast = collection.findLast;
  5895. lodash.findLastIndex = array.findLastIndex;
  5896. lodash.findLastKey = object.findLastKey;
  5897. lodash.floor = math.floor;
  5898. lodash.forEach = collection.forEach;
  5899. lodash.forEachRight = collection.forEachRight;
  5900. lodash.forIn = object.forIn;
  5901. lodash.forInRight = object.forInRight;
  5902. lodash.forOwn = object.forOwn;
  5903. lodash.forOwnRight = object.forOwnRight;
  5904. lodash.get = object.get;
  5905. lodash.gt = lang.gt;
  5906. lodash.gte = lang.gte;
  5907. lodash.has = object.has;
  5908. lodash.hasIn = object.hasIn;
  5909. lodash.head = array.head;
  5910. lodash.identity = identity$1;
  5911. lodash.includes = collection.includes;
  5912. lodash.indexOf = array.indexOf;
  5913. lodash.inRange = number.inRange;
  5914. lodash.invoke = object.invoke;
  5915. lodash.isArguments = lang.isArguments;
  5916. lodash.isArray = isArray$1;
  5917. lodash.isArrayBuffer = lang.isArrayBuffer;
  5918. lodash.isArrayLike = lang.isArrayLike;
  5919. lodash.isArrayLikeObject = lang.isArrayLikeObject;
  5920. lodash.isBoolean = lang.isBoolean;
  5921. lodash.isBuffer = lang.isBuffer;
  5922. lodash.isDate = lang.isDate;
  5923. lodash.isElement = lang.isElement;
  5924. lodash.isEmpty = lang.isEmpty;
  5925. lodash.isEqual = lang.isEqual;
  5926. lodash.isEqualWith = lang.isEqualWith;
  5927. lodash.isError = lang.isError;
  5928. lodash.isFinite = lang.isFinite;
  5929. lodash.isFunction = lang.isFunction;
  5930. lodash.isInteger = lang.isInteger;
  5931. lodash.isLength = lang.isLength;
  5932. lodash.isMap = lang.isMap;
  5933. lodash.isMatch = lang.isMatch;
  5934. lodash.isMatchWith = lang.isMatchWith;
  5935. lodash.isNaN = lang.isNaN;
  5936. lodash.isNative = lang.isNative;
  5937. lodash.isNil = lang.isNil;
  5938. lodash.isNull = lang.isNull;
  5939. lodash.isNumber = lang.isNumber;
  5940. lodash.isObject = isObject$2;
  5941. lodash.isObjectLike = lang.isObjectLike;
  5942. lodash.isPlainObject = lang.isPlainObject;
  5943. lodash.isRegExp = lang.isRegExp;
  5944. lodash.isSafeInteger = lang.isSafeInteger;
  5945. lodash.isSet = lang.isSet;
  5946. lodash.isString = lang.isString;
  5947. lodash.isSymbol = lang.isSymbol;
  5948. lodash.isTypedArray = lang.isTypedArray;
  5949. lodash.isUndefined = lang.isUndefined;
  5950. lodash.isWeakMap = lang.isWeakMap;
  5951. lodash.isWeakSet = lang.isWeakSet;
  5952. lodash.join = array.join;
  5953. lodash.kebabCase = string$1.kebabCase;
  5954. lodash.last = last;
  5955. lodash.lastIndexOf = array.lastIndexOf;
  5956. lodash.lowerCase = string$1.lowerCase;
  5957. lodash.lowerFirst = string$1.lowerFirst;
  5958. lodash.lt = lang.lt;
  5959. lodash.lte = lang.lte;
  5960. lodash.max = math.max;
  5961. lodash.maxBy = math.maxBy;
  5962. lodash.mean = math.mean;
  5963. lodash.meanBy = math.meanBy;
  5964. lodash.min = math.min;
  5965. lodash.minBy = math.minBy;
  5966. lodash.stubArray = util.stubArray;
  5967. lodash.stubFalse = util.stubFalse;
  5968. lodash.stubObject = util.stubObject;
  5969. lodash.stubString = util.stubString;
  5970. lodash.stubTrue = util.stubTrue;
  5971. lodash.multiply = math.multiply;
  5972. lodash.nth = array.nth;
  5973. lodash.noop = util.noop;
  5974. lodash.now = date$1.now;
  5975. lodash.pad = string$1.pad;
  5976. lodash.padEnd = string$1.padEnd;
  5977. lodash.padStart = string$1.padStart;
  5978. lodash.parseInt = string$1.parseInt;
  5979. lodash.random = number.random;
  5980. lodash.reduce = collection.reduce;
  5981. lodash.reduceRight = collection.reduceRight;
  5982. lodash.repeat = string$1.repeat;
  5983. lodash.replace = string$1.replace;
  5984. lodash.result = object.result;
  5985. lodash.round = math.round;
  5986. lodash.sample = collection.sample;
  5987. lodash.size = collection.size;
  5988. lodash.snakeCase = string$1.snakeCase;
  5989. lodash.some = collection.some;
  5990. lodash.sortedIndex = array.sortedIndex;
  5991. lodash.sortedIndexBy = array.sortedIndexBy;
  5992. lodash.sortedIndexOf = array.sortedIndexOf;
  5993. lodash.sortedLastIndex = array.sortedLastIndex;
  5994. lodash.sortedLastIndexBy = array.sortedLastIndexBy;
  5995. lodash.sortedLastIndexOf = array.sortedLastIndexOf;
  5996. lodash.startCase = string$1.startCase;
  5997. lodash.startsWith = string$1.startsWith;
  5998. lodash.subtract = math.subtract;
  5999. lodash.sum = math.sum;
  6000. lodash.sumBy = math.sumBy;
  6001. lodash.template = string$1.template;
  6002. lodash.times = util.times;
  6003. lodash.toFinite = lang.toFinite;
  6004. lodash.toInteger = toInteger;
  6005. lodash.toLength = lang.toLength;
  6006. lodash.toLower = string$1.toLower;
  6007. lodash.toNumber = lang.toNumber;
  6008. lodash.toSafeInteger = lang.toSafeInteger;
  6009. lodash.toString = lang.toString;
  6010. lodash.toUpper = string$1.toUpper;
  6011. lodash.trim = string$1.trim;
  6012. lodash.trimEnd = string$1.trimEnd;
  6013. lodash.trimStart = string$1.trimStart;
  6014. lodash.truncate = string$1.truncate;
  6015. lodash.unescape = string$1.unescape;
  6016. lodash.uniqueId = util.uniqueId;
  6017. lodash.upperCase = string$1.upperCase;
  6018. lodash.upperFirst = string$1.upperFirst;
  6019. lodash.each = collection.forEach;
  6020. lodash.eachRight = collection.forEachRight;
  6021. lodash.first = array.head;
  6022. mixin(lodash, function() {
  6023. var source = {};
  6024. baseForOwn(lodash, function(func2, methodName) {
  6025. if (!hasOwnProperty$1.call(lodash.prototype, methodName)) {
  6026. source[methodName] = func2;
  6027. }
  6028. });
  6029. return source;
  6030. }(), { "chain": false });
  6031. lodash.VERSION = VERSION;
  6032. (lodash.templateSettings = string$1.templateSettings).imports._ = lodash;
  6033. arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
  6034. lodash[methodName].placeholder = lodash;
  6035. });
  6036. arrayEach(["drop", "take"], function(methodName, index) {
  6037. LazyWrapper.prototype[methodName] = function(n) {
  6038. n = n === void 0 ? 1 : nativeMax(toInteger(n), 0);
  6039. var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
  6040. if (result.__filtered__) {
  6041. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  6042. } else {
  6043. result.__views__.push({
  6044. "size": nativeMin(n, MAX_ARRAY_LENGTH),
  6045. "type": methodName + (result.__dir__ < 0 ? "Right" : "")
  6046. });
  6047. }
  6048. return result;
  6049. };
  6050. LazyWrapper.prototype[methodName + "Right"] = function(n) {
  6051. return this.reverse()[methodName](n).reverse();
  6052. };
  6053. });
  6054. arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
  6055. var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  6056. LazyWrapper.prototype[methodName] = function(iteratee) {
  6057. var result = this.clone();
  6058. result.__iteratees__.push({
  6059. "iteratee": baseIteratee(iteratee),
  6060. "type": type
  6061. });
  6062. result.__filtered__ = result.__filtered__ || isFilter;
  6063. return result;
  6064. };
  6065. });
  6066. arrayEach(["head", "last"], function(methodName, index) {
  6067. var takeName = "take" + (index ? "Right" : "");
  6068. LazyWrapper.prototype[methodName] = function() {
  6069. return this[takeName](1).value()[0];
  6070. };
  6071. });
  6072. arrayEach(["initial", "tail"], function(methodName, index) {
  6073. var dropName = "drop" + (index ? "" : "Right");
  6074. LazyWrapper.prototype[methodName] = function() {
  6075. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  6076. };
  6077. });
  6078. LazyWrapper.prototype.compact = function() {
  6079. return this.filter(identity$1);
  6080. };
  6081. LazyWrapper.prototype.find = function(predicate) {
  6082. return this.filter(predicate).head();
  6083. };
  6084. LazyWrapper.prototype.findLast = function(predicate) {
  6085. return this.reverse().find(predicate);
  6086. };
  6087. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  6088. if (typeof path == "function") {
  6089. return new LazyWrapper(this);
  6090. }
  6091. return this.map(function(value) {
  6092. return baseInvoke(value, path, args);
  6093. });
  6094. });
  6095. LazyWrapper.prototype.reject = function(predicate) {
  6096. return this.filter(negate(baseIteratee(predicate)));
  6097. };
  6098. LazyWrapper.prototype.slice = function(start, end) {
  6099. start = toInteger(start);
  6100. var result = this;
  6101. if (result.__filtered__ && (start > 0 || end < 0)) {
  6102. return new LazyWrapper(result);
  6103. }
  6104. if (start < 0) {
  6105. result = result.takeRight(-start);
  6106. } else if (start) {
  6107. result = result.drop(start);
  6108. }
  6109. if (end !== void 0) {
  6110. end = toInteger(end);
  6111. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  6112. }
  6113. return result;
  6114. };
  6115. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  6116. return this.reverse().takeWhile(predicate).reverse();
  6117. };
  6118. LazyWrapper.prototype.toArray = function() {
  6119. return this.take(MAX_ARRAY_LENGTH);
  6120. };
  6121. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6122. 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);
  6123. if (!lodashFunc) {
  6124. return;
  6125. }
  6126. lodash.prototype[methodName] = function() {
  6127. var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray$1(value);
  6128. var interceptor = function(value2) {
  6129. var result2 = lodashFunc.apply(lodash, arrayPush([value2], args));
  6130. return isTaker && chainAll ? result2[0] : result2;
  6131. };
  6132. if (useLazy && checkIteratee && typeof iteratee == "function" && iteratee.length != 1) {
  6133. isLazy = useLazy = false;
  6134. }
  6135. var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
  6136. if (!retUnwrapped && useLazy) {
  6137. value = onlyLazy ? value : new LazyWrapper(this);
  6138. var result = func2.apply(value, args);
  6139. result.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": void 0 });
  6140. return new LodashWrapper(result, chainAll);
  6141. }
  6142. if (isUnwrapped && onlyLazy) {
  6143. return func2.apply(this, args);
  6144. }
  6145. result = this.thru(interceptor);
  6146. return isUnwrapped ? isTaker ? result.value()[0] : result.value() : result;
  6147. };
  6148. });
  6149. arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
  6150. var func2 = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  6151. lodash.prototype[methodName] = function() {
  6152. var args = arguments;
  6153. if (retUnwrapped && !this.__chain__) {
  6154. var value = this.value();
  6155. return func2.apply(isArray$1(value) ? value : [], args);
  6156. }
  6157. return this[chainName](function(value2) {
  6158. return func2.apply(isArray$1(value2) ? value2 : [], args);
  6159. });
  6160. };
  6161. });
  6162. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6163. var lodashFunc = lodash[methodName];
  6164. if (lodashFunc) {
  6165. var key = lodashFunc.name + "";
  6166. if (!hasOwnProperty$1.call(realNames, key)) {
  6167. realNames[key] = [];
  6168. }
  6169. realNames[key].push({ "name": methodName, "func": lodashFunc });
  6170. }
  6171. });
  6172. realNames[createHybrid(void 0, WRAP_BIND_KEY_FLAG).name] = [{
  6173. "name": "wrapper",
  6174. "func": void 0
  6175. }];
  6176. LazyWrapper.prototype.clone = lazyClone;
  6177. LazyWrapper.prototype.reverse = lazyReverse;
  6178. LazyWrapper.prototype.value = lazyValue;
  6179. lodash.prototype.at = seq.at;
  6180. lodash.prototype.chain = seq.wrapperChain;
  6181. lodash.prototype.commit = seq.commit;
  6182. lodash.prototype.next = seq.next;
  6183. lodash.prototype.plant = seq.plant;
  6184. lodash.prototype.reverse = seq.reverse;
  6185. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = seq.value;
  6186. lodash.prototype.first = lodash.prototype.head;
  6187. if (symIterator) {
  6188. lodash.prototype[symIterator] = seq.toIterator;
  6189. }
  6190. /**
  6191. * @license
  6192. * Lodash (Custom Build) <https://lodash.com/>
  6193. * Build: `lodash modularize exports="es" -o ./`
  6194. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  6195. * Released under MIT license <https://lodash.com/license>
  6196. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  6197. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  6198. */
  6199. 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])`;
  6200. const isVisible = (element) => {
  6201. const computed = getComputedStyle(element);
  6202. return computed.position === "fixed" ? false : element.offsetParent !== null;
  6203. };
  6204. const obtainAllFocusableElements$1 = (element) => {
  6205. return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item));
  6206. };
  6207. const isFocusable = (element) => {
  6208. if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
  6209. return true;
  6210. }
  6211. if (element.disabled) {
  6212. return false;
  6213. }
  6214. switch (element.nodeName) {
  6215. case "A": {
  6216. return !!element.href && element.rel !== "ignore";
  6217. }
  6218. case "INPUT": {
  6219. return !(element.type === "hidden" || element.type === "file");
  6220. }
  6221. case "BUTTON":
  6222. case "SELECT":
  6223. case "TEXTAREA": {
  6224. return true;
  6225. }
  6226. default: {
  6227. return false;
  6228. }
  6229. }
  6230. };
  6231. const triggerEvent = function(elm, name, ...opts) {
  6232. let eventName;
  6233. if (name.includes("mouse") || name.includes("click")) {
  6234. eventName = "MouseEvents";
  6235. } else if (name.includes("key")) {
  6236. eventName = "KeyboardEvent";
  6237. } else {
  6238. eventName = "HTMLEvents";
  6239. }
  6240. const evt = document.createEvent(eventName);
  6241. evt.initEvent(name, ...opts);
  6242. elm.dispatchEvent(evt);
  6243. return elm;
  6244. };
  6245. const isLeaf = (el) => !el.getAttribute("aria-owns");
  6246. const getSibling = (el, distance, elClass) => {
  6247. const { parentNode } = el;
  6248. if (!parentNode)
  6249. return null;
  6250. const siblings = parentNode.querySelectorAll(elClass);
  6251. const index = Array.prototype.indexOf.call(siblings, el);
  6252. return siblings[index + distance] || null;
  6253. };
  6254. const focusNode = (el) => {
  6255. if (!el)
  6256. return;
  6257. el.focus();
  6258. !isLeaf(el) && el.click();
  6259. };
  6260. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  6261. const handleEvent = (event) => {
  6262. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  6263. if (checkForDefaultPrevented === false || !shouldPrevent) {
  6264. return oursHandler == null ? void 0 : oursHandler(event);
  6265. }
  6266. };
  6267. return handleEvent;
  6268. };
  6269. const whenMouse = (handler) => {
  6270. return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
  6271. };
  6272. var __defProp$9 = Object.defineProperty;
  6273. var __defProps$6 = Object.defineProperties;
  6274. var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
  6275. var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
  6276. var __hasOwnProp$b = Object.prototype.hasOwnProperty;
  6277. var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
  6278. var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  6279. var __spreadValues$9 = (a, b) => {
  6280. for (var prop in b || (b = {}))
  6281. if (__hasOwnProp$b.call(b, prop))
  6282. __defNormalProp$9(a, prop, b[prop]);
  6283. if (__getOwnPropSymbols$b)
  6284. for (var prop of __getOwnPropSymbols$b(b)) {
  6285. if (__propIsEnum$b.call(b, prop))
  6286. __defNormalProp$9(a, prop, b[prop]);
  6287. }
  6288. return a;
  6289. };
  6290. var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
  6291. function computedEager(fn, options) {
  6292. var _a;
  6293. const result = vue.shallowRef();
  6294. vue.watchEffect(() => {
  6295. result.value = fn();
  6296. }, __spreadProps$6(__spreadValues$9({}, options), {
  6297. flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
  6298. }));
  6299. return vue.readonly(result);
  6300. }
  6301. var _a;
  6302. const isClient = typeof window !== "undefined";
  6303. const isDef = (val) => typeof val !== "undefined";
  6304. const isBoolean = (val) => typeof val === "boolean";
  6305. const isNumber = (val) => typeof val === "number";
  6306. const isString$1 = (val) => typeof val === "string";
  6307. const noop = () => {
  6308. };
  6309. isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  6310. function resolveUnref(r) {
  6311. return typeof r === "function" ? r() : vue.unref(r);
  6312. }
  6313. function createFilterWrapper(filter, fn) {
  6314. function wrapper(...args) {
  6315. filter(() => fn.apply(this, args), { fn, thisArg: this, args });
  6316. }
  6317. return wrapper;
  6318. }
  6319. function debounceFilter(ms, options = {}) {
  6320. let timer;
  6321. let maxTimer;
  6322. const filter = (invoke) => {
  6323. const duration = resolveUnref(ms);
  6324. const maxDuration = resolveUnref(options.maxWait);
  6325. if (timer)
  6326. clearTimeout(timer);
  6327. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  6328. if (maxTimer) {
  6329. clearTimeout(maxTimer);
  6330. maxTimer = null;
  6331. }
  6332. return invoke();
  6333. }
  6334. if (maxDuration && !maxTimer) {
  6335. maxTimer = setTimeout(() => {
  6336. if (timer)
  6337. clearTimeout(timer);
  6338. maxTimer = null;
  6339. invoke();
  6340. }, maxDuration);
  6341. }
  6342. timer = setTimeout(() => {
  6343. if (maxTimer)
  6344. clearTimeout(maxTimer);
  6345. maxTimer = null;
  6346. invoke();
  6347. }, duration);
  6348. };
  6349. return filter;
  6350. }
  6351. function throttleFilter(ms, trailing = true, leading = true) {
  6352. let lastExec = 0;
  6353. let timer;
  6354. let isLeading = true;
  6355. const clear = () => {
  6356. if (timer) {
  6357. clearTimeout(timer);
  6358. timer = void 0;
  6359. }
  6360. };
  6361. const filter = (invoke) => {
  6362. const duration = resolveUnref(ms);
  6363. const elapsed = Date.now() - lastExec;
  6364. clear();
  6365. if (duration <= 0) {
  6366. lastExec = Date.now();
  6367. return invoke();
  6368. }
  6369. if (elapsed > duration && (leading || !isLeading)) {
  6370. lastExec = Date.now();
  6371. invoke();
  6372. } else if (trailing) {
  6373. timer = setTimeout(() => {
  6374. lastExec = Date.now();
  6375. isLeading = true;
  6376. clear();
  6377. invoke();
  6378. }, duration);
  6379. }
  6380. if (!leading && !timer)
  6381. timer = setTimeout(() => isLeading = true, duration);
  6382. isLeading = false;
  6383. };
  6384. return filter;
  6385. }
  6386. function identity(arg) {
  6387. return arg;
  6388. }
  6389. function tryOnScopeDispose(fn) {
  6390. if (vue.getCurrentScope()) {
  6391. vue.onScopeDispose(fn);
  6392. return true;
  6393. }
  6394. return false;
  6395. }
  6396. function useDebounceFn(fn, ms = 200, options = {}) {
  6397. return createFilterWrapper(debounceFilter(ms, options), fn);
  6398. }
  6399. function refDebounced(value, ms = 200, options = {}) {
  6400. if (ms <= 0)
  6401. return value;
  6402. const debounced = vue.ref(value.value);
  6403. const updater = useDebounceFn(() => {
  6404. debounced.value = value.value;
  6405. }, ms, options);
  6406. vue.watch(value, () => updater());
  6407. return debounced;
  6408. }
  6409. function useThrottleFn(fn, ms = 200, trailing = false, leading = true) {
  6410. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
  6411. }
  6412. function tryOnMounted(fn, sync = true) {
  6413. if (vue.getCurrentInstance())
  6414. vue.onMounted(fn);
  6415. else if (sync)
  6416. fn();
  6417. else
  6418. vue.nextTick(fn);
  6419. }
  6420. function useTimeoutFn(cb, interval, options = {}) {
  6421. const {
  6422. immediate = true
  6423. } = options;
  6424. const isPending = vue.ref(false);
  6425. let timer = null;
  6426. function clear() {
  6427. if (timer) {
  6428. clearTimeout(timer);
  6429. timer = null;
  6430. }
  6431. }
  6432. function stop() {
  6433. isPending.value = false;
  6434. clear();
  6435. }
  6436. function start(...args) {
  6437. clear();
  6438. isPending.value = true;
  6439. timer = setTimeout(() => {
  6440. isPending.value = false;
  6441. timer = null;
  6442. cb(...args);
  6443. }, resolveUnref(interval));
  6444. }
  6445. if (immediate) {
  6446. isPending.value = true;
  6447. if (isClient)
  6448. start();
  6449. }
  6450. tryOnScopeDispose(stop);
  6451. return {
  6452. isPending,
  6453. start,
  6454. stop
  6455. };
  6456. }
  6457. function unrefElement(elRef) {
  6458. var _a;
  6459. const plain = resolveUnref(elRef);
  6460. return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
  6461. }
  6462. const defaultWindow = isClient ? window : void 0;
  6463. const defaultDocument = isClient ? window.document : void 0;
  6464. function useEventListener(...args) {
  6465. let target;
  6466. let event;
  6467. let listener;
  6468. let options;
  6469. if (isString$1(args[0])) {
  6470. [event, listener, options] = args;
  6471. target = defaultWindow;
  6472. } else {
  6473. [target, event, listener, options] = args;
  6474. }
  6475. if (!target)
  6476. return noop;
  6477. let cleanup = noop;
  6478. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  6479. cleanup();
  6480. if (!el)
  6481. return;
  6482. el.addEventListener(event, listener, options);
  6483. cleanup = () => {
  6484. el.removeEventListener(event, listener, options);
  6485. cleanup = noop;
  6486. };
  6487. }, { immediate: true, flush: "post" });
  6488. const stop = () => {
  6489. stopWatch();
  6490. cleanup();
  6491. };
  6492. tryOnScopeDispose(stop);
  6493. return stop;
  6494. }
  6495. function onClickOutside(target, handler, options = {}) {
  6496. const { window = defaultWindow, ignore, capture = true, detectIframe = false } = options;
  6497. if (!window)
  6498. return;
  6499. const shouldListen = vue.ref(true);
  6500. let fallback;
  6501. const listener = (event) => {
  6502. window.clearTimeout(fallback);
  6503. const el = unrefElement(target);
  6504. const composedPath = event.composedPath();
  6505. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  6506. return;
  6507. if (ignore && ignore.length > 0) {
  6508. if (ignore.some((target2) => {
  6509. const el2 = unrefElement(target2);
  6510. return el2 && (event.target === el2 || composedPath.includes(el2));
  6511. }))
  6512. return;
  6513. }
  6514. handler(event);
  6515. };
  6516. const cleanup = [
  6517. useEventListener(window, "click", listener, { passive: true, capture }),
  6518. useEventListener(window, "pointerdown", (e) => {
  6519. const el = unrefElement(target);
  6520. shouldListen.value = !!el && !e.composedPath().includes(el);
  6521. }, { passive: true }),
  6522. useEventListener(window, "pointerup", (e) => {
  6523. if (e.button === 0) {
  6524. const path = e.composedPath();
  6525. e.composedPath = () => path;
  6526. fallback = window.setTimeout(() => listener(e), 50);
  6527. }
  6528. }, { passive: true }),
  6529. detectIframe && useEventListener(window, "blur", (event) => {
  6530. var _a;
  6531. const el = unrefElement(target);
  6532. if (((_a = document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(document.activeElement)))
  6533. handler(event);
  6534. })
  6535. ].filter(Boolean);
  6536. const stop = () => cleanup.forEach((fn) => fn());
  6537. return stop;
  6538. }
  6539. function useSupported(callback, sync = false) {
  6540. const isSupported = vue.ref();
  6541. const update = () => isSupported.value = Boolean(callback());
  6542. update();
  6543. tryOnMounted(update, sync);
  6544. return isSupported;
  6545. }
  6546. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  6547. const globalKey = "__vueuse_ssr_handlers__";
  6548. _global[globalKey] = _global[globalKey] || {};
  6549. _global[globalKey];
  6550. function useCssVar(prop, target, { window = defaultWindow, initialValue = "" } = {}) {
  6551. const variable = vue.ref(initialValue);
  6552. const elRef = vue.computed(() => {
  6553. var _a;
  6554. return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
  6555. });
  6556. vue.watch([elRef, () => resolveUnref(prop)], ([el, prop2]) => {
  6557. var _a;
  6558. if (el && window) {
  6559. const value = (_a = window.getComputedStyle(el).getPropertyValue(prop2)) == null ? void 0 : _a.trim();
  6560. variable.value = value || initialValue;
  6561. }
  6562. }, { immediate: true });
  6563. vue.watch(variable, (val) => {
  6564. var _a;
  6565. if ((_a = elRef.value) == null ? void 0 : _a.style)
  6566. elRef.value.style.setProperty(resolveUnref(prop), val);
  6567. });
  6568. return variable;
  6569. }
  6570. function useDocumentVisibility({ document = defaultDocument } = {}) {
  6571. if (!document)
  6572. return vue.ref("visible");
  6573. const visibility = vue.ref(document.visibilityState);
  6574. useEventListener(document, "visibilitychange", () => {
  6575. visibility.value = document.visibilityState;
  6576. });
  6577. return visibility;
  6578. }
  6579. var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
  6580. var __hasOwnProp$f = Object.prototype.hasOwnProperty;
  6581. var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
  6582. var __objRest$2 = (source, exclude) => {
  6583. var target = {};
  6584. for (var prop in source)
  6585. if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
  6586. target[prop] = source[prop];
  6587. if (source != null && __getOwnPropSymbols$f)
  6588. for (var prop of __getOwnPropSymbols$f(source)) {
  6589. if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
  6590. target[prop] = source[prop];
  6591. }
  6592. return target;
  6593. };
  6594. function useResizeObserver(target, callback, options = {}) {
  6595. const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest$2(_a, ["window"]);
  6596. let observer;
  6597. const isSupported = useSupported(() => window && "ResizeObserver" in window);
  6598. const cleanup = () => {
  6599. if (observer) {
  6600. observer.disconnect();
  6601. observer = void 0;
  6602. }
  6603. };
  6604. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  6605. cleanup();
  6606. if (isSupported.value && window && el) {
  6607. observer = new ResizeObserver(callback);
  6608. observer.observe(el, observerOptions);
  6609. }
  6610. }, { immediate: true, flush: "post" });
  6611. const stop = () => {
  6612. cleanup();
  6613. stopWatch();
  6614. };
  6615. tryOnScopeDispose(stop);
  6616. return {
  6617. isSupported,
  6618. stop
  6619. };
  6620. }
  6621. function useElementBounding(target, options = {}) {
  6622. const {
  6623. reset = true,
  6624. windowResize = true,
  6625. windowScroll = true,
  6626. immediate = true
  6627. } = options;
  6628. const height = vue.ref(0);
  6629. const bottom = vue.ref(0);
  6630. const left = vue.ref(0);
  6631. const right = vue.ref(0);
  6632. const top = vue.ref(0);
  6633. const width = vue.ref(0);
  6634. const x = vue.ref(0);
  6635. const y = vue.ref(0);
  6636. function update() {
  6637. const el = unrefElement(target);
  6638. if (!el) {
  6639. if (reset) {
  6640. height.value = 0;
  6641. bottom.value = 0;
  6642. left.value = 0;
  6643. right.value = 0;
  6644. top.value = 0;
  6645. width.value = 0;
  6646. x.value = 0;
  6647. y.value = 0;
  6648. }
  6649. return;
  6650. }
  6651. const rect = el.getBoundingClientRect();
  6652. height.value = rect.height;
  6653. bottom.value = rect.bottom;
  6654. left.value = rect.left;
  6655. right.value = rect.right;
  6656. top.value = rect.top;
  6657. width.value = rect.width;
  6658. x.value = rect.x;
  6659. y.value = rect.y;
  6660. }
  6661. useResizeObserver(target, update);
  6662. vue.watch(() => unrefElement(target), (ele) => !ele && update());
  6663. if (windowScroll)
  6664. useEventListener("scroll", update, { passive: true });
  6665. if (windowResize)
  6666. useEventListener("resize", update, { passive: true });
  6667. tryOnMounted(() => {
  6668. if (immediate)
  6669. update();
  6670. });
  6671. return {
  6672. height,
  6673. bottom,
  6674. left,
  6675. right,
  6676. top,
  6677. width,
  6678. x,
  6679. y,
  6680. update
  6681. };
  6682. }
  6683. var SwipeDirection;
  6684. (function(SwipeDirection2) {
  6685. SwipeDirection2["UP"] = "UP";
  6686. SwipeDirection2["RIGHT"] = "RIGHT";
  6687. SwipeDirection2["DOWN"] = "DOWN";
  6688. SwipeDirection2["LEFT"] = "LEFT";
  6689. SwipeDirection2["NONE"] = "NONE";
  6690. })(SwipeDirection || (SwipeDirection = {}));
  6691. var __defProp = Object.defineProperty;
  6692. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  6693. var __hasOwnProp = Object.prototype.hasOwnProperty;
  6694. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  6695. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  6696. var __spreadValues = (a, b) => {
  6697. for (var prop in b || (b = {}))
  6698. if (__hasOwnProp.call(b, prop))
  6699. __defNormalProp(a, prop, b[prop]);
  6700. if (__getOwnPropSymbols)
  6701. for (var prop of __getOwnPropSymbols(b)) {
  6702. if (__propIsEnum.call(b, prop))
  6703. __defNormalProp(a, prop, b[prop]);
  6704. }
  6705. return a;
  6706. };
  6707. const _TransitionPresets = {
  6708. easeInSine: [0.12, 0, 0.39, 0],
  6709. easeOutSine: [0.61, 1, 0.88, 1],
  6710. easeInOutSine: [0.37, 0, 0.63, 1],
  6711. easeInQuad: [0.11, 0, 0.5, 0],
  6712. easeOutQuad: [0.5, 1, 0.89, 1],
  6713. easeInOutQuad: [0.45, 0, 0.55, 1],
  6714. easeInCubic: [0.32, 0, 0.67, 0],
  6715. easeOutCubic: [0.33, 1, 0.68, 1],
  6716. easeInOutCubic: [0.65, 0, 0.35, 1],
  6717. easeInQuart: [0.5, 0, 0.75, 0],
  6718. easeOutQuart: [0.25, 1, 0.5, 1],
  6719. easeInOutQuart: [0.76, 0, 0.24, 1],
  6720. easeInQuint: [0.64, 0, 0.78, 0],
  6721. easeOutQuint: [0.22, 1, 0.36, 1],
  6722. easeInOutQuint: [0.83, 0, 0.17, 1],
  6723. easeInExpo: [0.7, 0, 0.84, 0],
  6724. easeOutExpo: [0.16, 1, 0.3, 1],
  6725. easeInOutExpo: [0.87, 0, 0.13, 1],
  6726. easeInCirc: [0.55, 0, 1, 0.45],
  6727. easeOutCirc: [0, 0.55, 0.45, 1],
  6728. easeInOutCirc: [0.85, 0, 0.15, 1],
  6729. easeInBack: [0.36, 0, 0.66, -0.56],
  6730. easeOutBack: [0.34, 1.56, 0.64, 1],
  6731. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  6732. };
  6733. __spreadValues({
  6734. linear: identity
  6735. }, _TransitionPresets);
  6736. function useVModel(props, key, emit, options = {}) {
  6737. var _a, _b, _c;
  6738. const {
  6739. passive = false,
  6740. eventName,
  6741. deep = false,
  6742. defaultValue
  6743. } = options;
  6744. const vm = vue.getCurrentInstance();
  6745. 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));
  6746. let event = eventName;
  6747. if (!key) {
  6748. {
  6749. key = "modelValue";
  6750. }
  6751. }
  6752. event = eventName || event || `update:${key.toString()}`;
  6753. const getValue = () => isDef(props[key]) ? props[key] : defaultValue;
  6754. if (passive) {
  6755. const proxy = vue.ref(getValue());
  6756. vue.watch(() => props[key], (v) => proxy.value = v);
  6757. vue.watch(proxy, (v) => {
  6758. if (v !== props[key] || deep)
  6759. _emit(event, v);
  6760. }, {
  6761. deep
  6762. });
  6763. return proxy;
  6764. } else {
  6765. return vue.computed({
  6766. get() {
  6767. return getValue();
  6768. },
  6769. set(value) {
  6770. _emit(event, value);
  6771. }
  6772. });
  6773. }
  6774. }
  6775. function useWindowFocus({ window = defaultWindow } = {}) {
  6776. if (!window)
  6777. return vue.ref(false);
  6778. const focused = vue.ref(window.document.hasFocus());
  6779. useEventListener(window, "blur", () => {
  6780. focused.value = false;
  6781. });
  6782. useEventListener(window, "focus", () => {
  6783. focused.value = true;
  6784. });
  6785. return focused;
  6786. }
  6787. function useWindowSize(options = {}) {
  6788. const {
  6789. window = defaultWindow,
  6790. initialWidth = Infinity,
  6791. initialHeight = Infinity,
  6792. listenOrientation = true
  6793. } = options;
  6794. const width = vue.ref(initialWidth);
  6795. const height = vue.ref(initialHeight);
  6796. const update = () => {
  6797. if (window) {
  6798. width.value = window.innerWidth;
  6799. height.value = window.innerHeight;
  6800. }
  6801. };
  6802. update();
  6803. tryOnMounted(update);
  6804. useEventListener("resize", update, { passive: true });
  6805. if (listenOrientation)
  6806. useEventListener("orientationchange", update, { passive: true });
  6807. return { width, height };
  6808. }
  6809. const isInContainer = (el, container) => {
  6810. if (!isClient || !el || !container)
  6811. return false;
  6812. const elRect = el.getBoundingClientRect();
  6813. let containerRect;
  6814. if (container instanceof Element) {
  6815. containerRect = container.getBoundingClientRect();
  6816. } else {
  6817. containerRect = {
  6818. top: 0,
  6819. right: window.innerWidth,
  6820. bottom: window.innerHeight,
  6821. left: 0
  6822. };
  6823. }
  6824. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  6825. };
  6826. const getOffsetTop = (el) => {
  6827. let offset = 0;
  6828. let parent = el;
  6829. while (parent) {
  6830. offset += parent.offsetTop;
  6831. parent = parent.offsetParent;
  6832. }
  6833. return offset;
  6834. };
  6835. const getOffsetTopDistance = (el, containerEl) => {
  6836. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  6837. };
  6838. const getClientXY = (event) => {
  6839. let clientX;
  6840. let clientY;
  6841. if (event.type === "touchend") {
  6842. clientY = event.changedTouches[0].clientY;
  6843. clientX = event.changedTouches[0].clientX;
  6844. } else if (event.type.startsWith("touch")) {
  6845. clientY = event.touches[0].clientY;
  6846. clientX = event.touches[0].clientX;
  6847. } else {
  6848. clientY = event.clientY;
  6849. clientX = event.clientX;
  6850. }
  6851. return {
  6852. clientX,
  6853. clientY
  6854. };
  6855. };
  6856. const NOOP = () => {
  6857. };
  6858. const hasOwnProperty = Object.prototype.hasOwnProperty;
  6859. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  6860. const isArray = Array.isArray;
  6861. const isDate = (val) => toTypeString(val) === "[object Date]";
  6862. const isFunction = (val) => typeof val === "function";
  6863. const isString = (val) => typeof val === "string";
  6864. const isObject$1 = (val) => val !== null && typeof val === "object";
  6865. const isPromise = (val) => {
  6866. return isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
  6867. };
  6868. const objectToString = Object.prototype.toString;
  6869. const toTypeString = (value) => objectToString.call(value);
  6870. const toRawType = (value) => {
  6871. return toTypeString(value).slice(8, -1);
  6872. };
  6873. const cacheStringFunction = (fn) => {
  6874. const cache = /* @__PURE__ */ Object.create(null);
  6875. return (str) => {
  6876. const hit = cache[str];
  6877. return hit || (cache[str] = fn(str));
  6878. };
  6879. };
  6880. const camelizeRE = /-(\w)/g;
  6881. const camelize = cacheStringFunction((str) => {
  6882. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  6883. });
  6884. const hyphenateRE = /\B([A-Z])/g;
  6885. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  6886. const capitalize$1 = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  6887. const isUndefined = (val) => val === void 0;
  6888. const isEmpty = (val) => !val && val !== 0 || isArray(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  6889. const isElement$1 = (e) => {
  6890. if (typeof Element === "undefined")
  6891. return false;
  6892. return e instanceof Element;
  6893. };
  6894. const isPropAbsent = (prop) => {
  6895. return isNil(prop);
  6896. };
  6897. const isStringNumber = (val) => {
  6898. if (!isString(val)) {
  6899. return false;
  6900. }
  6901. return !Number.isNaN(Number(val));
  6902. };
  6903. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  6904. const capitalize = (str) => capitalize$1(str);
  6905. const keysOf = (arr) => Object.keys(arr);
  6906. const entriesOf = (arr) => Object.entries(arr);
  6907. const getProp = (obj, path, defaultValue) => {
  6908. return {
  6909. get value() {
  6910. return get(obj, path, defaultValue);
  6911. },
  6912. set value(val) {
  6913. set(obj, path, val);
  6914. }
  6915. };
  6916. };
  6917. class ElementPlusError extends Error {
  6918. constructor(m) {
  6919. super(m);
  6920. this.name = "ElementPlusError";
  6921. }
  6922. }
  6923. function throwError(scope, m) {
  6924. throw new ElementPlusError(`[${scope}] ${m}`);
  6925. }
  6926. function debugWarn(scope, message) {
  6927. }
  6928. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  6929. const hasClass = (el, cls) => {
  6930. if (!el || !cls)
  6931. return false;
  6932. if (cls.includes(" "))
  6933. throw new Error("className should not contain space.");
  6934. return el.classList.contains(cls);
  6935. };
  6936. const addClass = (el, cls) => {
  6937. if (!el || !cls.trim())
  6938. return;
  6939. el.classList.add(...classNameToArray(cls));
  6940. };
  6941. const removeClass = (el, cls) => {
  6942. if (!el || !cls.trim())
  6943. return;
  6944. el.classList.remove(...classNameToArray(cls));
  6945. };
  6946. const getStyle = (element, styleName) => {
  6947. var _a;
  6948. if (!isClient || !element || !styleName)
  6949. return "";
  6950. let key = camelize(styleName);
  6951. if (key === "float")
  6952. key = "cssFloat";
  6953. try {
  6954. const style = element.style[key];
  6955. if (style)
  6956. return style;
  6957. const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, "");
  6958. return computed ? computed[key] : "";
  6959. } catch (e) {
  6960. return element.style[key];
  6961. }
  6962. };
  6963. function addUnit(value, defaultUnit = "px") {
  6964. if (!value)
  6965. return "";
  6966. if (isNumber(value) || isStringNumber(value)) {
  6967. return `${value}${defaultUnit}`;
  6968. } else if (isString(value)) {
  6969. return value;
  6970. }
  6971. }
  6972. const isScroll = (el, isVertical) => {
  6973. if (!isClient)
  6974. return false;
  6975. const key = {
  6976. undefined: "overflow",
  6977. true: "overflow-y",
  6978. false: "overflow-x"
  6979. }[String(isVertical)];
  6980. const overflow = getStyle(el, key);
  6981. return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s));
  6982. };
  6983. const getScrollContainer = (el, isVertical) => {
  6984. if (!isClient)
  6985. return;
  6986. let parent = el;
  6987. while (parent) {
  6988. if ([window, document, document.documentElement].includes(parent))
  6989. return window;
  6990. if (isScroll(parent, isVertical))
  6991. return parent;
  6992. parent = parent.parentNode;
  6993. }
  6994. return parent;
  6995. };
  6996. let scrollBarWidth;
  6997. const getScrollBarWidth = (namespace) => {
  6998. var _a;
  6999. if (!isClient)
  7000. return 0;
  7001. if (scrollBarWidth !== void 0)
  7002. return scrollBarWidth;
  7003. const outer = document.createElement("div");
  7004. outer.className = `${namespace}-scrollbar__wrap`;
  7005. outer.style.visibility = "hidden";
  7006. outer.style.width = "100px";
  7007. outer.style.position = "absolute";
  7008. outer.style.top = "-9999px";
  7009. document.body.appendChild(outer);
  7010. const widthNoScroll = outer.offsetWidth;
  7011. outer.style.overflow = "scroll";
  7012. const inner = document.createElement("div");
  7013. inner.style.width = "100%";
  7014. outer.appendChild(inner);
  7015. const widthWithScroll = inner.offsetWidth;
  7016. (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
  7017. scrollBarWidth = widthNoScroll - widthWithScroll;
  7018. return scrollBarWidth;
  7019. };
  7020. function scrollIntoView(container, selected) {
  7021. if (!isClient)
  7022. return;
  7023. if (!selected) {
  7024. container.scrollTop = 0;
  7025. return;
  7026. }
  7027. const offsetParents = [];
  7028. let pointer = selected.offsetParent;
  7029. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  7030. offsetParents.push(pointer);
  7031. pointer = pointer.offsetParent;
  7032. }
  7033. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  7034. const bottom = top + selected.offsetHeight;
  7035. const viewRectTop = container.scrollTop;
  7036. const viewRectBottom = viewRectTop + container.clientHeight;
  7037. if (top < viewRectTop) {
  7038. container.scrollTop = top;
  7039. } else if (bottom > viewRectBottom) {
  7040. container.scrollTop = bottom - container.clientHeight;
  7041. }
  7042. }
  7043. let target = !isClient ? void 0 : document.body;
  7044. function createGlobalNode(id) {
  7045. const el = document.createElement("div");
  7046. if (id !== void 0) {
  7047. el.setAttribute("id", id);
  7048. }
  7049. target.appendChild(el);
  7050. return el;
  7051. }
  7052. function removeGlobalNode(el) {
  7053. el.remove();
  7054. }
  7055. var export_helper_default = (sfc, props) => {
  7056. let target = sfc.__vccOpts || sfc;
  7057. for (let [key, val] of props)
  7058. target[key] = val;
  7059. return target;
  7060. };
  7061. var _sfc_main6 = {
  7062. name: "ArrowDown"
  7063. };
  7064. var _hoisted_16$1 = {
  7065. viewBox: "0 0 1024 1024",
  7066. xmlns: "http://www.w3.org/2000/svg"
  7067. };
  7068. var _hoisted_26 = /* @__PURE__ */ vue.createElementVNode("path", {
  7069. fill: "currentColor",
  7070. 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"
  7071. }, null, -1);
  7072. var _hoisted_36 = [
  7073. _hoisted_26
  7074. ];
  7075. function _sfc_render6(_ctx, _cache, $props, $setup, $data, $options) {
  7076. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_16$1, _hoisted_36);
  7077. }
  7078. var arrow_down_default = /* @__PURE__ */ export_helper_default(_sfc_main6, [["render", _sfc_render6], ["__file", "arrow-down.vue"]]);
  7079. var _sfc_main8 = {
  7080. name: "ArrowLeft"
  7081. };
  7082. var _hoisted_18$1 = {
  7083. viewBox: "0 0 1024 1024",
  7084. xmlns: "http://www.w3.org/2000/svg"
  7085. };
  7086. var _hoisted_28 = /* @__PURE__ */ vue.createElementVNode("path", {
  7087. fill: "currentColor",
  7088. 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"
  7089. }, null, -1);
  7090. var _hoisted_38 = [
  7091. _hoisted_28
  7092. ];
  7093. function _sfc_render8(_ctx, _cache, $props, $setup, $data, $options) {
  7094. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_18$1, _hoisted_38);
  7095. }
  7096. var arrow_left_default = /* @__PURE__ */ export_helper_default(_sfc_main8, [["render", _sfc_render8], ["__file", "arrow-left.vue"]]);
  7097. var _sfc_main10 = {
  7098. name: "ArrowRight"
  7099. };
  7100. var _hoisted_110 = {
  7101. viewBox: "0 0 1024 1024",
  7102. xmlns: "http://www.w3.org/2000/svg"
  7103. };
  7104. var _hoisted_210 = /* @__PURE__ */ vue.createElementVNode("path", {
  7105. fill: "currentColor",
  7106. 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"
  7107. }, null, -1);
  7108. var _hoisted_310 = [
  7109. _hoisted_210
  7110. ];
  7111. function _sfc_render10(_ctx, _cache, $props, $setup, $data, $options) {
  7112. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_110, _hoisted_310);
  7113. }
  7114. var arrow_right_default = /* @__PURE__ */ export_helper_default(_sfc_main10, [["render", _sfc_render10], ["__file", "arrow-right.vue"]]);
  7115. var _sfc_main12 = {
  7116. name: "ArrowUp"
  7117. };
  7118. var _hoisted_112 = {
  7119. viewBox: "0 0 1024 1024",
  7120. xmlns: "http://www.w3.org/2000/svg"
  7121. };
  7122. var _hoisted_212 = /* @__PURE__ */ vue.createElementVNode("path", {
  7123. fill: "currentColor",
  7124. 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 0z"
  7125. }, null, -1);
  7126. var _hoisted_312 = [
  7127. _hoisted_212
  7128. ];
  7129. function _sfc_render12(_ctx, _cache, $props, $setup, $data, $options) {
  7130. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_112, _hoisted_312);
  7131. }
  7132. var arrow_up_default = /* @__PURE__ */ export_helper_default(_sfc_main12, [["render", _sfc_render12], ["__file", "arrow-up.vue"]]);
  7133. var _sfc_main14 = {
  7134. name: "Back"
  7135. };
  7136. var _hoisted_114 = {
  7137. viewBox: "0 0 1024 1024",
  7138. xmlns: "http://www.w3.org/2000/svg"
  7139. };
  7140. var _hoisted_214 = /* @__PURE__ */ vue.createElementVNode("path", {
  7141. fill: "currentColor",
  7142. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64z"
  7143. }, null, -1);
  7144. var _hoisted_314 = /* @__PURE__ */ vue.createElementVNode("path", {
  7145. fill: "currentColor",
  7146. 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.312L237.248 512z"
  7147. }, null, -1);
  7148. var _hoisted_44 = [
  7149. _hoisted_214,
  7150. _hoisted_314
  7151. ];
  7152. function _sfc_render14(_ctx, _cache, $props, $setup, $data, $options) {
  7153. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_114, _hoisted_44);
  7154. }
  7155. var back_default = /* @__PURE__ */ export_helper_default(_sfc_main14, [["render", _sfc_render14], ["__file", "back.vue"]]);
  7156. var _sfc_main29 = {
  7157. name: "Calendar"
  7158. };
  7159. var _hoisted_129 = {
  7160. viewBox: "0 0 1024 1024",
  7161. xmlns: "http://www.w3.org/2000/svg"
  7162. };
  7163. var _hoisted_229 = /* @__PURE__ */ vue.createElementVNode("path", {
  7164. fill: "currentColor",
  7165. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64H128zm192-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 0v32zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64z"
  7166. }, null, -1);
  7167. var _hoisted_328 = [
  7168. _hoisted_229
  7169. ];
  7170. function _sfc_render29(_ctx, _cache, $props, $setup, $data, $options) {
  7171. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_129, _hoisted_328);
  7172. }
  7173. var calendar_default = /* @__PURE__ */ export_helper_default(_sfc_main29, [["render", _sfc_render29], ["__file", "calendar.vue"]]);
  7174. var _sfc_main34 = {
  7175. name: "CaretRight"
  7176. };
  7177. var _hoisted_134 = {
  7178. viewBox: "0 0 1024 1024",
  7179. xmlns: "http://www.w3.org/2000/svg"
  7180. };
  7181. var _hoisted_234 = /* @__PURE__ */ vue.createElementVNode("path", {
  7182. fill: "currentColor",
  7183. d: "M384 192v640l384-320.064z"
  7184. }, null, -1);
  7185. var _hoisted_333 = [
  7186. _hoisted_234
  7187. ];
  7188. function _sfc_render34(_ctx, _cache, $props, $setup, $data, $options) {
  7189. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_134, _hoisted_333);
  7190. }
  7191. var caret_right_default = /* @__PURE__ */ export_helper_default(_sfc_main34, [["render", _sfc_render34], ["__file", "caret-right.vue"]]);
  7192. var _sfc_main35 = {
  7193. name: "CaretTop"
  7194. };
  7195. var _hoisted_135 = {
  7196. viewBox: "0 0 1024 1024",
  7197. xmlns: "http://www.w3.org/2000/svg"
  7198. };
  7199. var _hoisted_235 = /* @__PURE__ */ vue.createElementVNode("path", {
  7200. fill: "currentColor",
  7201. d: "M512 320 192 704h639.936z"
  7202. }, null, -1);
  7203. var _hoisted_334 = [
  7204. _hoisted_235
  7205. ];
  7206. function _sfc_render35(_ctx, _cache, $props, $setup, $data, $options) {
  7207. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_135, _hoisted_334);
  7208. }
  7209. var caret_top_default = /* @__PURE__ */ export_helper_default(_sfc_main35, [["render", _sfc_render35], ["__file", "caret-top.vue"]]);
  7210. var _sfc_main43 = {
  7211. name: "Check"
  7212. };
  7213. var _hoisted_143 = {
  7214. viewBox: "0 0 1024 1024",
  7215. xmlns: "http://www.w3.org/2000/svg"
  7216. };
  7217. var _hoisted_243 = /* @__PURE__ */ vue.createElementVNode("path", {
  7218. fill: "currentColor",
  7219. 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"
  7220. }, null, -1);
  7221. var _hoisted_342 = [
  7222. _hoisted_243
  7223. ];
  7224. function _sfc_render43(_ctx, _cache, $props, $setup, $data, $options) {
  7225. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_143, _hoisted_342);
  7226. }
  7227. var check_default = /* @__PURE__ */ export_helper_default(_sfc_main43, [["render", _sfc_render43], ["__file", "check.vue"]]);
  7228. var _sfc_main47 = {
  7229. name: "CircleCheckFilled"
  7230. };
  7231. var _hoisted_147 = {
  7232. viewBox: "0 0 1024 1024",
  7233. xmlns: "http://www.w3.org/2000/svg"
  7234. };
  7235. var _hoisted_247 = /* @__PURE__ */ vue.createElementVNode("path", {
  7236. fill: "currentColor",
  7237. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-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.336L456.192 600.384z"
  7238. }, null, -1);
  7239. var _hoisted_346 = [
  7240. _hoisted_247
  7241. ];
  7242. function _sfc_render47(_ctx, _cache, $props, $setup, $data, $options) {
  7243. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_147, _hoisted_346);
  7244. }
  7245. var circle_check_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main47, [["render", _sfc_render47], ["__file", "circle-check-filled.vue"]]);
  7246. var _sfc_main48 = {
  7247. name: "CircleCheck"
  7248. };
  7249. var _hoisted_148 = {
  7250. viewBox: "0 0 1024 1024",
  7251. xmlns: "http://www.w3.org/2000/svg"
  7252. };
  7253. var _hoisted_248 = /* @__PURE__ */ vue.createElementVNode("path", {
  7254. fill: "currentColor",
  7255. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  7256. }, null, -1);
  7257. var _hoisted_347 = /* @__PURE__ */ vue.createElementVNode("path", {
  7258. fill: "currentColor",
  7259. 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"
  7260. }, null, -1);
  7261. var _hoisted_414 = [
  7262. _hoisted_248,
  7263. _hoisted_347
  7264. ];
  7265. function _sfc_render48(_ctx, _cache, $props, $setup, $data, $options) {
  7266. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_148, _hoisted_414);
  7267. }
  7268. var circle_check_default = /* @__PURE__ */ export_helper_default(_sfc_main48, [["render", _sfc_render48], ["__file", "circle-check.vue"]]);
  7269. var _sfc_main49 = {
  7270. name: "CircleCloseFilled"
  7271. };
  7272. var _hoisted_149 = {
  7273. viewBox: "0 0 1024 1024",
  7274. xmlns: "http://www.w3.org/2000/svg"
  7275. };
  7276. var _hoisted_249 = /* @__PURE__ */ vue.createElementVNode("path", {
  7277. fill: "currentColor",
  7278. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 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.336L512 457.664z"
  7279. }, null, -1);
  7280. var _hoisted_348 = [
  7281. _hoisted_249
  7282. ];
  7283. function _sfc_render49(_ctx, _cache, $props, $setup, $data, $options) {
  7284. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_149, _hoisted_348);
  7285. }
  7286. var circle_close_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main49, [["render", _sfc_render49], ["__file", "circle-close-filled.vue"]]);
  7287. var _sfc_main50 = {
  7288. name: "CircleClose"
  7289. };
  7290. var _hoisted_150 = {
  7291. viewBox: "0 0 1024 1024",
  7292. xmlns: "http://www.w3.org/2000/svg"
  7293. };
  7294. var _hoisted_250 = /* @__PURE__ */ vue.createElementVNode("path", {
  7295. fill: "currentColor",
  7296. 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.248L466.752 512z"
  7297. }, null, -1);
  7298. var _hoisted_349 = /* @__PURE__ */ vue.createElementVNode("path", {
  7299. fill: "currentColor",
  7300. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  7301. }, null, -1);
  7302. var _hoisted_415 = [
  7303. _hoisted_250,
  7304. _hoisted_349
  7305. ];
  7306. function _sfc_render50(_ctx, _cache, $props, $setup, $data, $options) {
  7307. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_150, _hoisted_415);
  7308. }
  7309. var circle_close_default = /* @__PURE__ */ export_helper_default(_sfc_main50, [["render", _sfc_render50], ["__file", "circle-close.vue"]]);
  7310. var _sfc_main53 = {
  7311. name: "Clock"
  7312. };
  7313. var _hoisted_153 = {
  7314. viewBox: "0 0 1024 1024",
  7315. xmlns: "http://www.w3.org/2000/svg"
  7316. };
  7317. var _hoisted_253 = /* @__PURE__ */ vue.createElementVNode("path", {
  7318. fill: "currentColor",
  7319. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  7320. }, null, -1);
  7321. var _hoisted_352 = /* @__PURE__ */ vue.createElementVNode("path", {
  7322. fill: "currentColor",
  7323. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z"
  7324. }, null, -1);
  7325. var _hoisted_417 = /* @__PURE__ */ vue.createElementVNode("path", {
  7326. fill: "currentColor",
  7327. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32z"
  7328. }, null, -1);
  7329. var _hoisted_55 = [
  7330. _hoisted_253,
  7331. _hoisted_352,
  7332. _hoisted_417
  7333. ];
  7334. function _sfc_render53(_ctx, _cache, $props, $setup, $data, $options) {
  7335. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_153, _hoisted_55);
  7336. }
  7337. var clock_default = /* @__PURE__ */ export_helper_default(_sfc_main53, [["render", _sfc_render53], ["__file", "clock.vue"]]);
  7338. var _sfc_main55 = {
  7339. name: "Close"
  7340. };
  7341. var _hoisted_155 = {
  7342. viewBox: "0 0 1024 1024",
  7343. xmlns: "http://www.w3.org/2000/svg"
  7344. };
  7345. var _hoisted_255 = /* @__PURE__ */ vue.createElementVNode("path", {
  7346. fill: "currentColor",
  7347. 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"
  7348. }, null, -1);
  7349. var _hoisted_354 = [
  7350. _hoisted_255
  7351. ];
  7352. function _sfc_render55(_ctx, _cache, $props, $setup, $data, $options) {
  7353. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_155, _hoisted_354);
  7354. }
  7355. var close_default = /* @__PURE__ */ export_helper_default(_sfc_main55, [["render", _sfc_render55], ["__file", "close.vue"]]);
  7356. var _sfc_main71 = {
  7357. name: "DArrowLeft"
  7358. };
  7359. var _hoisted_171 = {
  7360. viewBox: "0 0 1024 1024",
  7361. xmlns: "http://www.w3.org/2000/svg"
  7362. };
  7363. var _hoisted_271 = /* @__PURE__ */ vue.createElementVNode("path", {
  7364. fill: "currentColor",
  7365. 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"
  7366. }, null, -1);
  7367. var _hoisted_370 = [
  7368. _hoisted_271
  7369. ];
  7370. function _sfc_render71(_ctx, _cache, $props, $setup, $data, $options) {
  7371. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_171, _hoisted_370);
  7372. }
  7373. var d_arrow_left_default = /* @__PURE__ */ export_helper_default(_sfc_main71, [["render", _sfc_render71], ["__file", "d-arrow-left.vue"]]);
  7374. var _sfc_main72 = {
  7375. name: "DArrowRight"
  7376. };
  7377. var _hoisted_172 = {
  7378. viewBox: "0 0 1024 1024",
  7379. xmlns: "http://www.w3.org/2000/svg"
  7380. };
  7381. var _hoisted_272 = /* @__PURE__ */ vue.createElementVNode("path", {
  7382. fill: "currentColor",
  7383. 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.688zm-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"
  7384. }, null, -1);
  7385. var _hoisted_371 = [
  7386. _hoisted_272
  7387. ];
  7388. function _sfc_render72(_ctx, _cache, $props, $setup, $data, $options) {
  7389. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_172, _hoisted_371);
  7390. }
  7391. var d_arrow_right_default = /* @__PURE__ */ export_helper_default(_sfc_main72, [["render", _sfc_render72], ["__file", "d-arrow-right.vue"]]);
  7392. var _sfc_main79 = {
  7393. name: "Delete"
  7394. };
  7395. var _hoisted_179 = {
  7396. viewBox: "0 0 1024 1024",
  7397. xmlns: "http://www.w3.org/2000/svg"
  7398. };
  7399. var _hoisted_279 = /* @__PURE__ */ vue.createElementVNode("path", {
  7400. fill: "currentColor",
  7401. 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-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
  7402. }, null, -1);
  7403. var _hoisted_378 = [
  7404. _hoisted_279
  7405. ];
  7406. function _sfc_render79(_ctx, _cache, $props, $setup, $data, $options) {
  7407. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_179, _hoisted_378);
  7408. }
  7409. var delete_default = /* @__PURE__ */ export_helper_default(_sfc_main79, [["render", _sfc_render79], ["__file", "delete.vue"]]);
  7410. var _sfc_main89 = {
  7411. name: "Document"
  7412. };
  7413. var _hoisted_189 = {
  7414. viewBox: "0 0 1024 1024",
  7415. xmlns: "http://www.w3.org/2000/svg"
  7416. };
  7417. var _hoisted_289 = /* @__PURE__ */ vue.createElementVNode("path", {
  7418. fill: "currentColor",
  7419. d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"
  7420. }, null, -1);
  7421. var _hoisted_388 = [
  7422. _hoisted_289
  7423. ];
  7424. function _sfc_render89(_ctx, _cache, $props, $setup, $data, $options) {
  7425. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_189, _hoisted_388);
  7426. }
  7427. var document_default = /* @__PURE__ */ export_helper_default(_sfc_main89, [["render", _sfc_render89], ["__file", "document.vue"]]);
  7428. var _sfc_main117 = {
  7429. name: "FullScreen"
  7430. };
  7431. var _hoisted_1117 = {
  7432. viewBox: "0 0 1024 1024",
  7433. xmlns: "http://www.w3.org/2000/svg"
  7434. };
  7435. var _hoisted_2117 = /* @__PURE__ */ vue.createElementVNode("path", {
  7436. fill: "currentColor",
  7437. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64v.064zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64l-192 .192zM864 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-64v-.064z"
  7438. }, null, -1);
  7439. var _hoisted_3116 = [
  7440. _hoisted_2117
  7441. ];
  7442. function _sfc_render117(_ctx, _cache, $props, $setup, $data, $options) {
  7443. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1117, _hoisted_3116);
  7444. }
  7445. var full_screen_default = /* @__PURE__ */ export_helper_default(_sfc_main117, [["render", _sfc_render117], ["__file", "full-screen.vue"]]);
  7446. var _sfc_main130 = {
  7447. name: "Hide"
  7448. };
  7449. var _hoisted_1130 = {
  7450. viewBox: "0 0 1024 1024",
  7451. xmlns: "http://www.w3.org/2000/svg"
  7452. };
  7453. var _hoisted_2130 = /* @__PURE__ */ vue.createElementVNode("path", {
  7454. 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.2L371.2 588.8ZM889.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",
  7455. fill: "currentColor"
  7456. }, null, -1);
  7457. var _hoisted_3129 = /* @__PURE__ */ vue.createElementVNode("path", {
  7458. 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",
  7459. fill: "currentColor"
  7460. }, null, -1);
  7461. var _hoisted_436 = [
  7462. _hoisted_2130,
  7463. _hoisted_3129
  7464. ];
  7465. function _sfc_render130(_ctx, _cache, $props, $setup, $data, $options) {
  7466. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1130, _hoisted_436);
  7467. }
  7468. var hide_default = /* @__PURE__ */ export_helper_default(_sfc_main130, [["render", _sfc_render130], ["__file", "hide.vue"]]);
  7469. var _sfc_main140 = {
  7470. name: "InfoFilled"
  7471. };
  7472. var _hoisted_1140 = {
  7473. viewBox: "0 0 1024 1024",
  7474. xmlns: "http://www.w3.org/2000/svg"
  7475. };
  7476. var _hoisted_2140 = /* @__PURE__ */ vue.createElementVNode("path", {
  7477. fill: "currentColor",
  7478. d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64zm67.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.344zM590.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"
  7479. }, null, -1);
  7480. var _hoisted_3139 = [
  7481. _hoisted_2140
  7482. ];
  7483. function _sfc_render140(_ctx, _cache, $props, $setup, $data, $options) {
  7484. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1140, _hoisted_3139);
  7485. }
  7486. var info_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main140, [["render", _sfc_render140], ["__file", "info-filled.vue"]]);
  7487. var _sfc_main147 = {
  7488. name: "Loading"
  7489. };
  7490. var _hoisted_1147 = {
  7491. viewBox: "0 0 1024 1024",
  7492. xmlns: "http://www.w3.org/2000/svg"
  7493. };
  7494. var _hoisted_2147 = /* @__PURE__ */ vue.createElementVNode("path", {
  7495. fill: "currentColor",
  7496. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.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 0zm-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"
  7497. }, null, -1);
  7498. var _hoisted_3146 = [
  7499. _hoisted_2147
  7500. ];
  7501. function _sfc_render147(_ctx, _cache, $props, $setup, $data, $options) {
  7502. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1147, _hoisted_3146);
  7503. }
  7504. var loading_default = /* @__PURE__ */ export_helper_default(_sfc_main147, [["render", _sfc_render147], ["__file", "loading.vue"]]);
  7505. var _sfc_main165 = {
  7506. name: "Minus"
  7507. };
  7508. var _hoisted_1165 = {
  7509. viewBox: "0 0 1024 1024",
  7510. xmlns: "http://www.w3.org/2000/svg"
  7511. };
  7512. var _hoisted_2165 = /* @__PURE__ */ vue.createElementVNode("path", {
  7513. fill: "currentColor",
  7514. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  7515. }, null, -1);
  7516. var _hoisted_3164 = [
  7517. _hoisted_2165
  7518. ];
  7519. function _sfc_render165(_ctx, _cache, $props, $setup, $data, $options) {
  7520. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1165, _hoisted_3164);
  7521. }
  7522. var minus_default = /* @__PURE__ */ export_helper_default(_sfc_main165, [["render", _sfc_render165], ["__file", "minus.vue"]]);
  7523. var _sfc_main170 = {
  7524. name: "MoreFilled"
  7525. };
  7526. var _hoisted_1170 = {
  7527. viewBox: "0 0 1024 1024",
  7528. xmlns: "http://www.w3.org/2000/svg"
  7529. };
  7530. var _hoisted_2170 = /* @__PURE__ */ vue.createElementVNode("path", {
  7531. fill: "currentColor",
  7532. d: "M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224z"
  7533. }, null, -1);
  7534. var _hoisted_3169 = [
  7535. _hoisted_2170
  7536. ];
  7537. function _sfc_render170(_ctx, _cache, $props, $setup, $data, $options) {
  7538. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1170, _hoisted_3169);
  7539. }
  7540. var more_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main170, [["render", _sfc_render170], ["__file", "more-filled.vue"]]);
  7541. var _sfc_main171 = {
  7542. name: "More"
  7543. };
  7544. var _hoisted_1171 = {
  7545. viewBox: "0 0 1024 1024",
  7546. xmlns: "http://www.w3.org/2000/svg"
  7547. };
  7548. var _hoisted_2171 = /* @__PURE__ */ vue.createElementVNode("path", {
  7549. fill: "currentColor",
  7550. 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-96zm336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96zm336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96z"
  7551. }, null, -1);
  7552. var _hoisted_3170 = [
  7553. _hoisted_2171
  7554. ];
  7555. function _sfc_render171(_ctx, _cache, $props, $setup, $data, $options) {
  7556. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1171, _hoisted_3170);
  7557. }
  7558. var more_default = /* @__PURE__ */ export_helper_default(_sfc_main171, [["render", _sfc_render171], ["__file", "more.vue"]]);
  7559. var _sfc_main191 = {
  7560. name: "PictureFilled"
  7561. };
  7562. var _hoisted_1191 = {
  7563. viewBox: "0 0 1024 1024",
  7564. xmlns: "http://www.w3.org/2000/svg"
  7565. };
  7566. var _hoisted_2191 = /* @__PURE__ */ vue.createElementVNode("path", {
  7567. fill: "currentColor",
  7568. 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 32H96zm315.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.112zM256 384a96 96 0 1 0 192.064-.064A96 96 0 0 0 256 384z"
  7569. }, null, -1);
  7570. var _hoisted_3190 = [
  7571. _hoisted_2191
  7572. ];
  7573. function _sfc_render191(_ctx, _cache, $props, $setup, $data, $options) {
  7574. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1191, _hoisted_3190);
  7575. }
  7576. var picture_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main191, [["render", _sfc_render191], ["__file", "picture-filled.vue"]]);
  7577. var _sfc_main197 = {
  7578. name: "Plus"
  7579. };
  7580. var _hoisted_1197 = {
  7581. viewBox: "0 0 1024 1024",
  7582. xmlns: "http://www.w3.org/2000/svg"
  7583. };
  7584. var _hoisted_2197 = /* @__PURE__ */ vue.createElementVNode("path", {
  7585. fill: "currentColor",
  7586. 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-64h352z"
  7587. }, null, -1);
  7588. var _hoisted_3196 = [
  7589. _hoisted_2197
  7590. ];
  7591. function _sfc_render197(_ctx, _cache, $props, $setup, $data, $options) {
  7592. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1197, _hoisted_3196);
  7593. }
  7594. var plus_default = /* @__PURE__ */ export_helper_default(_sfc_main197, [["render", _sfc_render197], ["__file", "plus.vue"]]);
  7595. var _sfc_main206 = {
  7596. name: "QuestionFilled"
  7597. };
  7598. var _hoisted_1206 = {
  7599. viewBox: "0 0 1024 1024",
  7600. xmlns: "http://www.w3.org/2000/svg"
  7601. };
  7602. var _hoisted_2206 = /* @__PURE__ */ vue.createElementVNode("path", {
  7603. fill: "currentColor",
  7604. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm23.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"
  7605. }, null, -1);
  7606. var _hoisted_3205 = [
  7607. _hoisted_2206
  7608. ];
  7609. function _sfc_render206(_ctx, _cache, $props, $setup, $data, $options) {
  7610. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1206, _hoisted_3205);
  7611. }
  7612. var question_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main206, [["render", _sfc_render206], ["__file", "question-filled.vue"]]);
  7613. var _sfc_main210 = {
  7614. name: "RefreshLeft"
  7615. };
  7616. var _hoisted_1210 = {
  7617. viewBox: "0 0 1024 1024",
  7618. xmlns: "http://www.w3.org/2000/svg"
  7619. };
  7620. var _hoisted_2210 = /* @__PURE__ */ vue.createElementVNode("path", {
  7621. fill: "currentColor",
  7622. 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"
  7623. }, null, -1);
  7624. var _hoisted_3209 = [
  7625. _hoisted_2210
  7626. ];
  7627. function _sfc_render210(_ctx, _cache, $props, $setup, $data, $options) {
  7628. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1210, _hoisted_3209);
  7629. }
  7630. var refresh_left_default = /* @__PURE__ */ export_helper_default(_sfc_main210, [["render", _sfc_render210], ["__file", "refresh-left.vue"]]);
  7631. var _sfc_main211 = {
  7632. name: "RefreshRight"
  7633. };
  7634. var _hoisted_1211 = {
  7635. viewBox: "0 0 1024 1024",
  7636. xmlns: "http://www.w3.org/2000/svg"
  7637. };
  7638. var _hoisted_2211 = /* @__PURE__ */ vue.createElementVNode("path", {
  7639. fill: "currentColor",
  7640. 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"
  7641. }, null, -1);
  7642. var _hoisted_3210 = [
  7643. _hoisted_2211
  7644. ];
  7645. function _sfc_render211(_ctx, _cache, $props, $setup, $data, $options) {
  7646. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1211, _hoisted_3210);
  7647. }
  7648. var refresh_right_default = /* @__PURE__ */ export_helper_default(_sfc_main211, [["render", _sfc_render211], ["__file", "refresh-right.vue"]]);
  7649. var _sfc_main217 = {
  7650. name: "ScaleToOriginal"
  7651. };
  7652. var _hoisted_1217 = {
  7653. viewBox: "0 0 1024 1024",
  7654. xmlns: "http://www.w3.org/2000/svg"
  7655. };
  7656. var _hoisted_2217 = /* @__PURE__ */ vue.createElementVNode("path", {
  7657. fill: "currentColor",
  7658. 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.118zM512 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.412zM512 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 512z"
  7659. }, null, -1);
  7660. var _hoisted_3216 = [
  7661. _hoisted_2217
  7662. ];
  7663. function _sfc_render217(_ctx, _cache, $props, $setup, $data, $options) {
  7664. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1217, _hoisted_3216);
  7665. }
  7666. var scale_to_original_default = /* @__PURE__ */ export_helper_default(_sfc_main217, [["render", _sfc_render217], ["__file", "scale-to-original.vue"]]);
  7667. var _sfc_main220 = {
  7668. name: "Search"
  7669. };
  7670. var _hoisted_1220 = {
  7671. viewBox: "0 0 1024 1024",
  7672. xmlns: "http://www.w3.org/2000/svg"
  7673. };
  7674. var _hoisted_2220 = /* @__PURE__ */ vue.createElementVNode("path", {
  7675. fill: "currentColor",
  7676. 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 704z"
  7677. }, null, -1);
  7678. var _hoisted_3219 = [
  7679. _hoisted_2220
  7680. ];
  7681. function _sfc_render220(_ctx, _cache, $props, $setup, $data, $options) {
  7682. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1220, _hoisted_3219);
  7683. }
  7684. var search_default = /* @__PURE__ */ export_helper_default(_sfc_main220, [["render", _sfc_render220], ["__file", "search.vue"]]);
  7685. var _sfc_main236 = {
  7686. name: "SortDown"
  7687. };
  7688. var _hoisted_1236 = {
  7689. viewBox: "0 0 1024 1024",
  7690. xmlns: "http://www.w3.org/2000/svg"
  7691. };
  7692. var _hoisted_2236 = /* @__PURE__ */ vue.createElementVNode("path", {
  7693. fill: "currentColor",
  7694. 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 0z"
  7695. }, null, -1);
  7696. var _hoisted_3235 = [
  7697. _hoisted_2236
  7698. ];
  7699. function _sfc_render236(_ctx, _cache, $props, $setup, $data, $options) {
  7700. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1236, _hoisted_3235);
  7701. }
  7702. var sort_down_default = /* @__PURE__ */ export_helper_default(_sfc_main236, [["render", _sfc_render236], ["__file", "sort-down.vue"]]);
  7703. var _sfc_main237 = {
  7704. name: "SortUp"
  7705. };
  7706. var _hoisted_1237 = {
  7707. viewBox: "0 0 1024 1024",
  7708. xmlns: "http://www.w3.org/2000/svg"
  7709. };
  7710. var _hoisted_2237 = /* @__PURE__ */ vue.createElementVNode("path", {
  7711. fill: "currentColor",
  7712. 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.248z"
  7713. }, null, -1);
  7714. var _hoisted_3236 = [
  7715. _hoisted_2237
  7716. ];
  7717. function _sfc_render237(_ctx, _cache, $props, $setup, $data, $options) {
  7718. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1237, _hoisted_3236);
  7719. }
  7720. var sort_up_default = /* @__PURE__ */ export_helper_default(_sfc_main237, [["render", _sfc_render237], ["__file", "sort-up.vue"]]);
  7721. var _sfc_main240 = {
  7722. name: "StarFilled"
  7723. };
  7724. var _hoisted_1240 = {
  7725. viewBox: "0 0 1024 1024",
  7726. xmlns: "http://www.w3.org/2000/svg"
  7727. };
  7728. var _hoisted_2240 = /* @__PURE__ */ vue.createElementVNode("path", {
  7729. fill: "currentColor",
  7730. 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"
  7731. }, null, -1);
  7732. var _hoisted_3239 = [
  7733. _hoisted_2240
  7734. ];
  7735. function _sfc_render240(_ctx, _cache, $props, $setup, $data, $options) {
  7736. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1240, _hoisted_3239);
  7737. }
  7738. var star_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main240, [["render", _sfc_render240], ["__file", "star-filled.vue"]]);
  7739. var _sfc_main241 = {
  7740. name: "Star"
  7741. };
  7742. var _hoisted_1241 = {
  7743. viewBox: "0 0 1024 1024",
  7744. xmlns: "http://www.w3.org/2000/svg"
  7745. };
  7746. var _hoisted_2241 = /* @__PURE__ */ vue.createElementVNode("path", {
  7747. fill: "currentColor",
  7748. 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.72L512 747.84zM313.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"
  7749. }, null, -1);
  7750. var _hoisted_3240 = [
  7751. _hoisted_2241
  7752. ];
  7753. function _sfc_render241(_ctx, _cache, $props, $setup, $data, $options) {
  7754. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1241, _hoisted_3240);
  7755. }
  7756. var star_default = /* @__PURE__ */ export_helper_default(_sfc_main241, [["render", _sfc_render241], ["__file", "star.vue"]]);
  7757. var _sfc_main243 = {
  7758. name: "SuccessFilled"
  7759. };
  7760. var _hoisted_1243 = {
  7761. viewBox: "0 0 1024 1024",
  7762. xmlns: "http://www.w3.org/2000/svg"
  7763. };
  7764. var _hoisted_2243 = /* @__PURE__ */ vue.createElementVNode("path", {
  7765. fill: "currentColor",
  7766. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-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.336L456.192 600.384z"
  7767. }, null, -1);
  7768. var _hoisted_3242 = [
  7769. _hoisted_2243
  7770. ];
  7771. function _sfc_render243(_ctx, _cache, $props, $setup, $data, $options) {
  7772. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1243, _hoisted_3242);
  7773. }
  7774. var success_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main243, [["render", _sfc_render243], ["__file", "success-filled.vue"]]);
  7775. var _sfc_main274 = {
  7776. name: "View"
  7777. };
  7778. var _hoisted_1274 = {
  7779. viewBox: "0 0 1024 1024",
  7780. xmlns: "http://www.w3.org/2000/svg"
  7781. };
  7782. var _hoisted_2274 = /* @__PURE__ */ vue.createElementVNode("path", {
  7783. fill: "currentColor",
  7784. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 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-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
  7785. }, null, -1);
  7786. var _hoisted_3273 = [
  7787. _hoisted_2274
  7788. ];
  7789. function _sfc_render274(_ctx, _cache, $props, $setup, $data, $options) {
  7790. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1274, _hoisted_3273);
  7791. }
  7792. var view_default = /* @__PURE__ */ export_helper_default(_sfc_main274, [["render", _sfc_render274], ["__file", "view.vue"]]);
  7793. var _sfc_main277 = {
  7794. name: "WarningFilled"
  7795. };
  7796. var _hoisted_1277 = {
  7797. viewBox: "0 0 1024 1024",
  7798. xmlns: "http://www.w3.org/2000/svg"
  7799. };
  7800. var _hoisted_2277 = /* @__PURE__ */ vue.createElementVNode("path", {
  7801. fill: "currentColor",
  7802. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 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 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"
  7803. }, null, -1);
  7804. var _hoisted_3276 = [
  7805. _hoisted_2277
  7806. ];
  7807. function _sfc_render277(_ctx, _cache, $props, $setup, $data, $options) {
  7808. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1277, _hoisted_3276);
  7809. }
  7810. var warning_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main277, [["render", _sfc_render277], ["__file", "warning-filled.vue"]]);
  7811. var _sfc_main282 = {
  7812. name: "ZoomIn"
  7813. };
  7814. var _hoisted_1282 = {
  7815. viewBox: "0 0 1024 1024",
  7816. xmlns: "http://www.w3.org/2000/svg"
  7817. };
  7818. var _hoisted_2282 = /* @__PURE__ */ vue.createElementVNode("path", {
  7819. fill: "currentColor",
  7820. 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 704zm-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-64h96z"
  7821. }, null, -1);
  7822. var _hoisted_3281 = [
  7823. _hoisted_2282
  7824. ];
  7825. function _sfc_render282(_ctx, _cache, $props, $setup, $data, $options) {
  7826. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1282, _hoisted_3281);
  7827. }
  7828. var zoom_in_default = /* @__PURE__ */ export_helper_default(_sfc_main282, [["render", _sfc_render282], ["__file", "zoom-in.vue"]]);
  7829. var _sfc_main283 = {
  7830. name: "ZoomOut"
  7831. };
  7832. var _hoisted_1283 = {
  7833. viewBox: "0 0 1024 1024",
  7834. xmlns: "http://www.w3.org/2000/svg"
  7835. };
  7836. var _hoisted_2283 = /* @__PURE__ */ vue.createElementVNode("path", {
  7837. fill: "currentColor",
  7838. 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 704zM352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z"
  7839. }, null, -1);
  7840. var _hoisted_3282 = [
  7841. _hoisted_2283
  7842. ];
  7843. function _sfc_render283(_ctx, _cache, $props, $setup, $data, $options) {
  7844. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1283, _hoisted_3282);
  7845. }
  7846. var zoom_out_default = /* @__PURE__ */ export_helper_default(_sfc_main283, [["render", _sfc_render283], ["__file", "zoom-out.vue"]]);
  7847. /*! Element Plus Icons Vue v2.0.6 */
  7848. const epPropKey = "__epPropKey";
  7849. const definePropType = (val) => val;
  7850. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  7851. const buildProp = (prop, key) => {
  7852. if (!isObject$1(prop) || isEpProp(prop))
  7853. return prop;
  7854. const { values, required, default: defaultValue, type, validator } = prop;
  7855. const _validator = values || validator ? (val) => {
  7856. let valid = false;
  7857. let allowedValues = [];
  7858. if (values) {
  7859. allowedValues = Array.from(values);
  7860. if (hasOwn(prop, "default")) {
  7861. allowedValues.push(defaultValue);
  7862. }
  7863. valid || (valid = allowedValues.includes(val));
  7864. }
  7865. if (validator)
  7866. valid || (valid = validator(val));
  7867. if (!valid && allowedValues.length > 0) {
  7868. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  7869. vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  7870. }
  7871. return valid;
  7872. } : void 0;
  7873. const epProp = {
  7874. type,
  7875. required: !!required,
  7876. validator: _validator,
  7877. [epPropKey]: true
  7878. };
  7879. if (hasOwn(prop, "default"))
  7880. epProp.default = defaultValue;
  7881. return epProp;
  7882. };
  7883. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  7884. key,
  7885. buildProp(option, key)
  7886. ]));
  7887. const iconPropType = definePropType([
  7888. String,
  7889. Object,
  7890. Function
  7891. ]);
  7892. const CloseComponents = {
  7893. Close: close_default
  7894. };
  7895. const TypeComponents = {
  7896. Close: close_default,
  7897. SuccessFilled: success_filled_default,
  7898. InfoFilled: info_filled_default,
  7899. WarningFilled: warning_filled_default,
  7900. CircleCloseFilled: circle_close_filled_default
  7901. };
  7902. const TypeComponentsMap = {
  7903. success: success_filled_default,
  7904. warning: warning_filled_default,
  7905. error: circle_close_filled_default,
  7906. info: info_filled_default
  7907. };
  7908. const ValidateComponentsMap = {
  7909. validating: loading_default,
  7910. success: circle_check_default,
  7911. error: circle_close_default
  7912. };
  7913. const withInstall = (main, extra) => {
  7914. main.install = (app) => {
  7915. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  7916. app.component(comp.name, comp);
  7917. }
  7918. };
  7919. if (extra) {
  7920. for (const [key, comp] of Object.entries(extra)) {
  7921. main[key] = comp;
  7922. }
  7923. }
  7924. return main;
  7925. };
  7926. const withInstallFunction = (fn, name) => {
  7927. fn.install = (app) => {
  7928. fn._context = app._context;
  7929. app.config.globalProperties[name] = fn;
  7930. };
  7931. return fn;
  7932. };
  7933. const withInstallDirective = (directive, name) => {
  7934. directive.install = (app) => {
  7935. app.directive(name, directive);
  7936. };
  7937. return directive;
  7938. };
  7939. const withNoopInstall = (component) => {
  7940. component.install = NOOP;
  7941. return component;
  7942. };
  7943. const composeRefs = (...refs) => {
  7944. return (el) => {
  7945. refs.forEach((ref) => {
  7946. if (isFunction(ref)) {
  7947. ref(el);
  7948. } else {
  7949. ref.value = el;
  7950. }
  7951. });
  7952. };
  7953. };
  7954. const EVENT_CODE = {
  7955. tab: "Tab",
  7956. enter: "Enter",
  7957. space: "Space",
  7958. left: "ArrowLeft",
  7959. up: "ArrowUp",
  7960. right: "ArrowRight",
  7961. down: "ArrowDown",
  7962. esc: "Escape",
  7963. delete: "Delete",
  7964. backspace: "Backspace",
  7965. numpadEnter: "NumpadEnter",
  7966. pageUp: "PageUp",
  7967. pageDown: "PageDown",
  7968. home: "Home",
  7969. end: "End"
  7970. };
  7971. const datePickTypes = [
  7972. "year",
  7973. "month",
  7974. "date",
  7975. "dates",
  7976. "week",
  7977. "datetime",
  7978. "datetimerange",
  7979. "daterange",
  7980. "monthrange"
  7981. ];
  7982. const WEEK_DAYS = [
  7983. "sun",
  7984. "mon",
  7985. "tue",
  7986. "wed",
  7987. "thu",
  7988. "fri",
  7989. "sat"
  7990. ];
  7991. const UPDATE_MODEL_EVENT = "update:modelValue";
  7992. const CHANGE_EVENT = "change";
  7993. const INPUT_EVENT = "input";
  7994. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  7995. const componentSizes = ["", "default", "small", "large"];
  7996. const componentSizeMap = {
  7997. large: 40,
  7998. default: 32,
  7999. small: 24
  8000. };
  8001. const getComponentSize = (size) => {
  8002. return componentSizeMap[size || "default"];
  8003. };
  8004. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  8005. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  8006. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  8007. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  8008. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  8009. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  8010. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  8011. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  8012. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  8013. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  8014. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  8015. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  8016. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  8017. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  8018. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  8019. return PatchFlags2;
  8020. })(PatchFlags || {});
  8021. function isFragment(node) {
  8022. return vue.isVNode(node) && node.type === vue.Fragment;
  8023. }
  8024. function isComment(node) {
  8025. return vue.isVNode(node) && node.type === vue.Comment;
  8026. }
  8027. function isValidElementNode(node) {
  8028. return vue.isVNode(node) && !isFragment(node) && !isComment(node);
  8029. }
  8030. const getNormalizedProps = (node) => {
  8031. if (!vue.isVNode(node)) {
  8032. return {};
  8033. }
  8034. const raw = node.props || {};
  8035. const type = (vue.isVNode(node.type) ? node.type.props : void 0) || {};
  8036. const props = {};
  8037. Object.keys(type).forEach((key) => {
  8038. if (hasOwn(type[key], "default")) {
  8039. props[key] = type[key].default;
  8040. }
  8041. });
  8042. Object.keys(raw).forEach((key) => {
  8043. props[camelize(key)] = raw[key];
  8044. });
  8045. return props;
  8046. };
  8047. const ensureOnlyChild = (children) => {
  8048. if (!isArray(children) || children.length > 1) {
  8049. throw new Error("expect to receive a single Vue element child");
  8050. }
  8051. return children[0];
  8052. };
  8053. const flattedChildren = (children) => {
  8054. const vNodes = isArray(children) ? children : [children];
  8055. const result = [];
  8056. vNodes.forEach((child) => {
  8057. var _a;
  8058. if (isArray(child)) {
  8059. result.push(...flattedChildren(child));
  8060. } else if (vue.isVNode(child) && isArray(child.children)) {
  8061. result.push(...flattedChildren(child.children));
  8062. } else {
  8063. result.push(child);
  8064. if (vue.isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
  8065. result.push(...flattedChildren(child.component.subTree));
  8066. }
  8067. }
  8068. });
  8069. return result;
  8070. };
  8071. const cubic = (value) => {
  8072. return value ** 3;
  8073. };
  8074. const easeInOutCubic = (value) => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
  8075. const unique = (arr) => [...new Set(arr)];
  8076. const castArray = (arr) => {
  8077. if (!arr && arr !== 0)
  8078. return [];
  8079. return Array.isArray(arr) ? arr : [arr];
  8080. };
  8081. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  8082. const isKorean = (text) => /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
  8083. const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
  8084. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  8085. const generateId = () => Math.floor(Math.random() * 1e4);
  8086. const mutable = (val) => val;
  8087. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8088. const LISTENER_PREFIX = /^on[A-Z]/;
  8089. const useAttrs = (params = {}) => {
  8090. const { excludeListeners = false, excludeKeys } = params;
  8091. const allExcludeKeys = vue.computed(() => {
  8092. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  8093. });
  8094. const instance = vue.getCurrentInstance();
  8095. if (!instance) {
  8096. return vue.computed(() => ({}));
  8097. }
  8098. return vue.computed(() => {
  8099. var _a;
  8100. return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  8101. });
  8102. };
  8103. const breadcrumbKey = Symbol("breadcrumbKey");
  8104. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  8105. const carouselContextKey = Symbol("carouselContextKey");
  8106. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  8107. const collapseContextKey = Symbol("collapseContextKey");
  8108. const configProviderContextKey = Symbol();
  8109. const dialogInjectionKey = Symbol("dialogInjectionKey");
  8110. const formContextKey = Symbol("formContextKey");
  8111. const formItemContextKey = Symbol("formItemContextKey");
  8112. const elPaginationKey = Symbol("elPaginationKey");
  8113. const radioGroupKey = Symbol("radioGroupKey");
  8114. const rowContextKey = Symbol("rowContextKey");
  8115. const scrollbarContextKey = Symbol("scrollbarContextKey");
  8116. const sliderContextKey = Symbol("sliderContextKey");
  8117. const tabsRootContextKey = Symbol("tabsRootContextKey");
  8118. const uploadContextKey = Symbol("uploadContextKey");
  8119. const POPPER_INJECTION_KEY = Symbol("popper");
  8120. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  8121. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  8122. const tooltipV2RootKey = Symbol("tooltipV2");
  8123. const tooltipV2ContentKey = Symbol("tooltipV2Content");
  8124. const TOOLTIP_V2_OPEN = "tooltip_v2.open";
  8125. const ROOT_PICKER_INJECTION_KEY = Symbol();
  8126. const useProp = (name) => {
  8127. const vm = vue.getCurrentInstance();
  8128. return vue.computed(() => {
  8129. var _a, _b;
  8130. return (_b = ((_a = vm.proxy) == null ? void 0 : _a.$props)[name]) != null ? _b : void 0;
  8131. });
  8132. };
  8133. const globalConfig = vue.ref();
  8134. function useGlobalConfig(key, defaultValue = void 0) {
  8135. const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig;
  8136. if (key) {
  8137. return vue.computed(() => {
  8138. var _a, _b;
  8139. return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
  8140. });
  8141. } else {
  8142. return config;
  8143. }
  8144. }
  8145. const provideGlobalConfig = (config, app, global = false) => {
  8146. var _a;
  8147. const inSetup = !!vue.getCurrentInstance();
  8148. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  8149. const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? vue.provide : void 0;
  8150. if (!provideFn) {
  8151. return;
  8152. }
  8153. const context = vue.computed(() => {
  8154. const cfg = vue.unref(config);
  8155. if (!(oldConfig == null ? void 0 : oldConfig.value))
  8156. return cfg;
  8157. return mergeConfig(oldConfig.value, cfg);
  8158. });
  8159. provideFn(configProviderContextKey, context);
  8160. if (global || !globalConfig.value) {
  8161. globalConfig.value = context.value;
  8162. }
  8163. return context;
  8164. };
  8165. const mergeConfig = (a, b) => {
  8166. var _a;
  8167. const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  8168. const obj = {};
  8169. for (const key of keys) {
  8170. obj[key] = (_a = b[key]) != null ? _a : a[key];
  8171. }
  8172. return obj;
  8173. };
  8174. const useSizeProp = buildProp({
  8175. type: String,
  8176. values: componentSizes,
  8177. required: false
  8178. });
  8179. const useSize = (fallback, ignore = {}) => {
  8180. const emptyRef = vue.ref(void 0);
  8181. const size = ignore.prop ? emptyRef : useProp("size");
  8182. const globalConfig = ignore.global ? emptyRef : useGlobalConfig("size");
  8183. const form = ignore.form ? { size: void 0 } : vue.inject(formContextKey, void 0);
  8184. const formItem = ignore.formItem ? { size: void 0 } : vue.inject(formItemContextKey, void 0);
  8185. return vue.computed(() => size.value || vue.unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
  8186. };
  8187. const useDisabled = (fallback) => {
  8188. const disabled = useProp("disabled");
  8189. const form = vue.inject(formContextKey, void 0);
  8190. return vue.computed(() => disabled.value || vue.unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  8191. };
  8192. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  8193. vue.watch(() => vue.unref(condition), (val) => {
  8194. }, {
  8195. immediate: true
  8196. });
  8197. };
  8198. const useDraggable = (targetRef, dragRef, draggable) => {
  8199. let transform = {
  8200. offsetX: 0,
  8201. offsetY: 0
  8202. };
  8203. const onMousedown = (e) => {
  8204. const downX = e.clientX;
  8205. const downY = e.clientY;
  8206. const { offsetX, offsetY } = transform;
  8207. const targetRect = targetRef.value.getBoundingClientRect();
  8208. const targetLeft = targetRect.left;
  8209. const targetTop = targetRect.top;
  8210. const targetWidth = targetRect.width;
  8211. const targetHeight = targetRect.height;
  8212. const clientWidth = document.documentElement.clientWidth;
  8213. const clientHeight = document.documentElement.clientHeight;
  8214. const minLeft = -targetLeft + offsetX;
  8215. const minTop = -targetTop + offsetY;
  8216. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  8217. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  8218. const onMousemove = (e2) => {
  8219. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  8220. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  8221. transform = {
  8222. offsetX: moveX,
  8223. offsetY: moveY
  8224. };
  8225. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  8226. };
  8227. const onMouseup = () => {
  8228. document.removeEventListener("mousemove", onMousemove);
  8229. document.removeEventListener("mouseup", onMouseup);
  8230. };
  8231. document.addEventListener("mousemove", onMousemove);
  8232. document.addEventListener("mouseup", onMouseup);
  8233. };
  8234. const onDraggable = () => {
  8235. if (dragRef.value && targetRef.value) {
  8236. dragRef.value.addEventListener("mousedown", onMousedown);
  8237. }
  8238. };
  8239. const offDraggable = () => {
  8240. if (dragRef.value && targetRef.value) {
  8241. dragRef.value.removeEventListener("mousedown", onMousedown);
  8242. }
  8243. };
  8244. vue.onMounted(() => {
  8245. vue.watchEffect(() => {
  8246. if (draggable.value) {
  8247. onDraggable();
  8248. } else {
  8249. offDraggable();
  8250. }
  8251. });
  8252. });
  8253. vue.onBeforeUnmount(() => {
  8254. offDraggable();
  8255. });
  8256. };
  8257. const useFocus = (el) => {
  8258. return {
  8259. focus: () => {
  8260. var _a, _b;
  8261. (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  8262. }
  8263. };
  8264. };
  8265. const defaultNamespace = "el";
  8266. const statePrefix = "is-";
  8267. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  8268. let cls = `${namespace}-${block}`;
  8269. if (blockSuffix) {
  8270. cls += `-${blockSuffix}`;
  8271. }
  8272. if (element) {
  8273. cls += `__${element}`;
  8274. }
  8275. if (modifier) {
  8276. cls += `--${modifier}`;
  8277. }
  8278. return cls;
  8279. };
  8280. const useNamespace = (block) => {
  8281. const namespace = useGlobalConfig("namespace", defaultNamespace);
  8282. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  8283. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  8284. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  8285. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  8286. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  8287. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  8288. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  8289. const is = (name, ...args) => {
  8290. const state = args.length >= 1 ? args[0] : true;
  8291. return name && state ? `${statePrefix}${name}` : "";
  8292. };
  8293. const cssVar = (object) => {
  8294. const styles = {};
  8295. for (const key in object) {
  8296. if (object[key]) {
  8297. styles[`--${namespace.value}-${key}`] = object[key];
  8298. }
  8299. }
  8300. return styles;
  8301. };
  8302. const cssVarBlock = (object) => {
  8303. const styles = {};
  8304. for (const key in object) {
  8305. if (object[key]) {
  8306. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  8307. }
  8308. }
  8309. return styles;
  8310. };
  8311. const cssVarName = (name) => `--${namespace.value}-${name}`;
  8312. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  8313. return {
  8314. namespace,
  8315. b,
  8316. e,
  8317. m,
  8318. be,
  8319. em,
  8320. bm,
  8321. bem,
  8322. is,
  8323. cssVar,
  8324. cssVarName,
  8325. cssVarBlock,
  8326. cssVarBlockName
  8327. };
  8328. };
  8329. const defaultIdInjection = {
  8330. prefix: Math.floor(Math.random() * 1e4),
  8331. current: 0
  8332. };
  8333. const ID_INJECTION_KEY = Symbol("elIdInjection");
  8334. const useIdInjection = () => {
  8335. return vue.getCurrentInstance() ? vue.inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  8336. };
  8337. const useId = (deterministicId) => {
  8338. const idInjection = useIdInjection();
  8339. const namespace = useGlobalConfig("namespace", defaultNamespace);
  8340. const idRef = vue.computed(() => vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  8341. return idRef;
  8342. };
  8343. const useFormItem = () => {
  8344. const form = vue.inject(formContextKey, void 0);
  8345. const formItem = vue.inject(formItemContextKey, void 0);
  8346. return {
  8347. form,
  8348. formItem
  8349. };
  8350. };
  8351. const useFormItemInputId = (props, {
  8352. formItemContext,
  8353. disableIdGeneration,
  8354. disableIdManagement
  8355. }) => {
  8356. if (!disableIdGeneration) {
  8357. disableIdGeneration = vue.ref(false);
  8358. }
  8359. if (!disableIdManagement) {
  8360. disableIdManagement = vue.ref(false);
  8361. }
  8362. const inputId = vue.ref();
  8363. let idUnwatch = void 0;
  8364. const isLabeledByFormItem = vue.computed(() => {
  8365. var _a;
  8366. return !!(!props.label && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
  8367. });
  8368. vue.onMounted(() => {
  8369. idUnwatch = vue.watch([vue.toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  8370. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  8371. if (newId !== inputId.value) {
  8372. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  8373. inputId.value && formItemContext.removeInputId(inputId.value);
  8374. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  8375. formItemContext.addInputId(newId);
  8376. }
  8377. }
  8378. inputId.value = newId;
  8379. }
  8380. }, { immediate: true });
  8381. });
  8382. vue.onUnmounted(() => {
  8383. idUnwatch && idUnwatch();
  8384. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  8385. inputId.value && formItemContext.removeInputId(inputId.value);
  8386. }
  8387. });
  8388. return {
  8389. isLabeledByFormItem,
  8390. inputId
  8391. };
  8392. };
  8393. var English = {
  8394. name: "en",
  8395. el: {
  8396. colorpicker: {
  8397. confirm: "OK",
  8398. clear: "Clear",
  8399. defaultLabel: "color picker",
  8400. description: "current color is {color}. press enter to select a new color."
  8401. },
  8402. datepicker: {
  8403. now: "Now",
  8404. today: "Today",
  8405. cancel: "Cancel",
  8406. clear: "Clear",
  8407. confirm: "OK",
  8408. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  8409. monthTablePrompt: "Use the arrow keys and enter to select the month",
  8410. yearTablePrompt: "Use the arrow keys and enter to select the year",
  8411. selectedDate: "Selected date",
  8412. selectDate: "Select date",
  8413. selectTime: "Select time",
  8414. startDate: "Start Date",
  8415. startTime: "Start Time",
  8416. endDate: "End Date",
  8417. endTime: "End Time",
  8418. prevYear: "Previous Year",
  8419. nextYear: "Next Year",
  8420. prevMonth: "Previous Month",
  8421. nextMonth: "Next Month",
  8422. year: "",
  8423. month1: "January",
  8424. month2: "February",
  8425. month3: "March",
  8426. month4: "April",
  8427. month5: "May",
  8428. month6: "June",
  8429. month7: "July",
  8430. month8: "August",
  8431. month9: "September",
  8432. month10: "October",
  8433. month11: "November",
  8434. month12: "December",
  8435. week: "week",
  8436. weeks: {
  8437. sun: "Sun",
  8438. mon: "Mon",
  8439. tue: "Tue",
  8440. wed: "Wed",
  8441. thu: "Thu",
  8442. fri: "Fri",
  8443. sat: "Sat"
  8444. },
  8445. weeksFull: {
  8446. sun: "Sunday",
  8447. mon: "Monday",
  8448. tue: "Tuesday",
  8449. wed: "Wednesday",
  8450. thu: "Thursday",
  8451. fri: "Friday",
  8452. sat: "Saturday"
  8453. },
  8454. months: {
  8455. jan: "Jan",
  8456. feb: "Feb",
  8457. mar: "Mar",
  8458. apr: "Apr",
  8459. may: "May",
  8460. jun: "Jun",
  8461. jul: "Jul",
  8462. aug: "Aug",
  8463. sep: "Sep",
  8464. oct: "Oct",
  8465. nov: "Nov",
  8466. dec: "Dec"
  8467. }
  8468. },
  8469. inputNumber: {
  8470. decrease: "decrease number",
  8471. increase: "increase number"
  8472. },
  8473. select: {
  8474. loading: "Loading",
  8475. noMatch: "No matching data",
  8476. noData: "No data",
  8477. placeholder: "Select"
  8478. },
  8479. dropdown: {
  8480. toggleDropdown: "Toggle Dropdown"
  8481. },
  8482. cascader: {
  8483. noMatch: "No matching data",
  8484. loading: "Loading",
  8485. placeholder: "Select",
  8486. noData: "No data"
  8487. },
  8488. pagination: {
  8489. goto: "Go to",
  8490. pagesize: "/page",
  8491. total: "Total {total}",
  8492. pageClassifier: "",
  8493. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  8494. },
  8495. dialog: {
  8496. close: "Close this dialog"
  8497. },
  8498. drawer: {
  8499. close: "Close this dialog"
  8500. },
  8501. messagebox: {
  8502. title: "Message",
  8503. confirm: "OK",
  8504. cancel: "Cancel",
  8505. error: "Illegal input",
  8506. close: "Close this dialog"
  8507. },
  8508. upload: {
  8509. deleteTip: "press delete to remove",
  8510. delete: "Delete",
  8511. preview: "Preview",
  8512. continue: "Continue"
  8513. },
  8514. slider: {
  8515. defaultLabel: "slider between {min} and {max}",
  8516. defaultRangeStartLabel: "pick start value",
  8517. defaultRangeEndLabel: "pick end value"
  8518. },
  8519. table: {
  8520. emptyText: "No Data",
  8521. confirmFilter: "Confirm",
  8522. resetFilter: "Reset",
  8523. clearFilter: "All",
  8524. sumText: "Sum"
  8525. },
  8526. tree: {
  8527. emptyText: "No Data"
  8528. },
  8529. transfer: {
  8530. noMatch: "No matching data",
  8531. noData: "No data",
  8532. titles: ["List 1", "List 2"],
  8533. filterPlaceholder: "Enter keyword",
  8534. noCheckedFormat: "{total} items",
  8535. hasCheckedFormat: "{checked}/{total} checked"
  8536. },
  8537. image: {
  8538. error: "FAILED"
  8539. },
  8540. pageHeader: {
  8541. title: "Back"
  8542. },
  8543. popconfirm: {
  8544. confirmButtonText: "Yes",
  8545. cancelButtonText: "No"
  8546. }
  8547. }
  8548. };
  8549. const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
  8550. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  8551. var _a;
  8552. return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
  8553. });
  8554. const buildLocaleContext = (locale) => {
  8555. const lang = vue.computed(() => vue.unref(locale).name);
  8556. const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
  8557. return {
  8558. lang,
  8559. locale: localeRef,
  8560. t: buildTranslator(locale)
  8561. };
  8562. };
  8563. const useLocale = () => {
  8564. const locale = useGlobalConfig("locale");
  8565. return buildLocaleContext(vue.computed(() => locale.value || English));
  8566. };
  8567. let activeEffectScope;
  8568. function recordEffectScope(effect2, scope = activeEffectScope) {
  8569. if (scope && scope.active) {
  8570. scope.effects.push(effect2);
  8571. }
  8572. }
  8573. const createDep = (effects) => {
  8574. const dep = new Set(effects);
  8575. dep.w = 0;
  8576. dep.n = 0;
  8577. return dep;
  8578. };
  8579. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  8580. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  8581. const initDepMarkers = ({ deps }) => {
  8582. if (deps.length) {
  8583. for (let i = 0; i < deps.length; i++) {
  8584. deps[i].w |= trackOpBit;
  8585. }
  8586. }
  8587. };
  8588. const finalizeDepMarkers = (effect2) => {
  8589. const { deps } = effect2;
  8590. if (deps.length) {
  8591. let ptr = 0;
  8592. for (let i = 0; i < deps.length; i++) {
  8593. const dep = deps[i];
  8594. if (wasTracked(dep) && !newTracked(dep)) {
  8595. dep.delete(effect2);
  8596. } else {
  8597. deps[ptr++] = dep;
  8598. }
  8599. dep.w &= ~trackOpBit;
  8600. dep.n &= ~trackOpBit;
  8601. }
  8602. deps.length = ptr;
  8603. }
  8604. };
  8605. let effectTrackDepth = 0;
  8606. let trackOpBit = 1;
  8607. const maxMarkerBits = 30;
  8608. let activeEffect;
  8609. class ReactiveEffect {
  8610. constructor(fn, scheduler2 = null, scope) {
  8611. this.fn = fn;
  8612. this.scheduler = scheduler2;
  8613. this.active = true;
  8614. this.deps = [];
  8615. this.parent = void 0;
  8616. recordEffectScope(this, scope);
  8617. }
  8618. run() {
  8619. if (!this.active) {
  8620. return this.fn();
  8621. }
  8622. let parent = activeEffect;
  8623. let lastShouldTrack = shouldTrack;
  8624. while (parent) {
  8625. if (parent === this) {
  8626. return;
  8627. }
  8628. parent = parent.parent;
  8629. }
  8630. try {
  8631. this.parent = activeEffect;
  8632. activeEffect = this;
  8633. shouldTrack = true;
  8634. trackOpBit = 1 << ++effectTrackDepth;
  8635. if (effectTrackDepth <= maxMarkerBits) {
  8636. initDepMarkers(this);
  8637. } else {
  8638. cleanupEffect(this);
  8639. }
  8640. return this.fn();
  8641. } finally {
  8642. if (effectTrackDepth <= maxMarkerBits) {
  8643. finalizeDepMarkers(this);
  8644. }
  8645. trackOpBit = 1 << --effectTrackDepth;
  8646. activeEffect = this.parent;
  8647. shouldTrack = lastShouldTrack;
  8648. this.parent = void 0;
  8649. if (this.deferStop) {
  8650. this.stop();
  8651. }
  8652. }
  8653. }
  8654. stop() {
  8655. if (activeEffect === this) {
  8656. this.deferStop = true;
  8657. } else if (this.active) {
  8658. cleanupEffect(this);
  8659. if (this.onStop) {
  8660. this.onStop();
  8661. }
  8662. this.active = false;
  8663. }
  8664. }
  8665. }
  8666. function cleanupEffect(effect2) {
  8667. const { deps } = effect2;
  8668. if (deps.length) {
  8669. for (let i = 0; i < deps.length; i++) {
  8670. deps[i].delete(effect2);
  8671. }
  8672. deps.length = 0;
  8673. }
  8674. }
  8675. let shouldTrack = true;
  8676. function trackEffects(dep, debuggerEventExtraInfo) {
  8677. let shouldTrack2 = false;
  8678. if (effectTrackDepth <= maxMarkerBits) {
  8679. if (!newTracked(dep)) {
  8680. dep.n |= trackOpBit;
  8681. shouldTrack2 = !wasTracked(dep);
  8682. }
  8683. } else {
  8684. shouldTrack2 = !dep.has(activeEffect);
  8685. }
  8686. if (shouldTrack2) {
  8687. dep.add(activeEffect);
  8688. activeEffect.deps.push(dep);
  8689. }
  8690. }
  8691. function triggerEffects(dep, debuggerEventExtraInfo) {
  8692. const effects = isArray(dep) ? dep : [...dep];
  8693. for (const effect2 of effects) {
  8694. if (effect2.computed) {
  8695. triggerEffect(effect2);
  8696. }
  8697. }
  8698. for (const effect2 of effects) {
  8699. if (!effect2.computed) {
  8700. triggerEffect(effect2);
  8701. }
  8702. }
  8703. }
  8704. function triggerEffect(effect2, debuggerEventExtraInfo) {
  8705. if (effect2 !== activeEffect || effect2.allowRecurse) {
  8706. if (effect2.scheduler) {
  8707. effect2.scheduler();
  8708. } else {
  8709. effect2.run();
  8710. }
  8711. }
  8712. }
  8713. function toRaw(observed) {
  8714. const raw = observed && observed["__v_raw"];
  8715. return raw ? toRaw(raw) : observed;
  8716. }
  8717. function trackRefValue(ref2) {
  8718. if (shouldTrack && activeEffect) {
  8719. ref2 = toRaw(ref2);
  8720. {
  8721. trackEffects(ref2.dep || (ref2.dep = createDep()));
  8722. }
  8723. }
  8724. }
  8725. function triggerRefValue(ref2, newVal) {
  8726. ref2 = toRaw(ref2);
  8727. if (ref2.dep) {
  8728. {
  8729. triggerEffects(ref2.dep);
  8730. }
  8731. }
  8732. }
  8733. class ComputedRefImpl {
  8734. constructor(getter, _setter, isReadonly2, isSSR) {
  8735. this._setter = _setter;
  8736. this.dep = void 0;
  8737. this.__v_isRef = true;
  8738. this._dirty = true;
  8739. this.effect = new ReactiveEffect(getter, () => {
  8740. if (!this._dirty) {
  8741. this._dirty = true;
  8742. triggerRefValue(this);
  8743. }
  8744. });
  8745. this.effect.computed = this;
  8746. this.effect.active = this._cacheable = !isSSR;
  8747. this["__v_isReadonly"] = isReadonly2;
  8748. }
  8749. get value() {
  8750. const self = toRaw(this);
  8751. trackRefValue(self);
  8752. if (self._dirty || !self._cacheable) {
  8753. self._dirty = false;
  8754. self._value = self.effect.run();
  8755. }
  8756. return self._value;
  8757. }
  8758. set value(newValue) {
  8759. this._setter(newValue);
  8760. }
  8761. }
  8762. function computed(getterOrOptions, debugOptions, isSSR = false) {
  8763. let getter;
  8764. let setter;
  8765. const onlyGetter = isFunction(getterOrOptions);
  8766. if (onlyGetter) {
  8767. getter = getterOrOptions;
  8768. setter = NOOP;
  8769. } else {
  8770. getter = getterOrOptions.get;
  8771. setter = getterOrOptions.set;
  8772. }
  8773. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  8774. return cRef;
  8775. }
  8776. const useLockscreen = (trigger) => {
  8777. if (!vue.isRef(trigger)) {
  8778. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  8779. }
  8780. const ns = useNamespace("popup");
  8781. const hiddenCls = computed(() => ns.bm("parent", "hidden"));
  8782. if (!isClient || hasClass(document.body, hiddenCls.value)) {
  8783. return;
  8784. }
  8785. let scrollBarWidth = 0;
  8786. let withoutHiddenClass = false;
  8787. let bodyWidth = "0";
  8788. const cleanup = () => {
  8789. setTimeout(() => {
  8790. removeClass(document.body, hiddenCls.value);
  8791. if (withoutHiddenClass) {
  8792. document.body.style.width = bodyWidth;
  8793. }
  8794. }, 200);
  8795. };
  8796. vue.watch(trigger, (val) => {
  8797. if (!val) {
  8798. cleanup();
  8799. return;
  8800. }
  8801. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  8802. if (withoutHiddenClass) {
  8803. bodyWidth = document.body.style.width;
  8804. }
  8805. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  8806. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  8807. const bodyOverflowY = getStyle(document.body, "overflowY");
  8808. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  8809. document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  8810. }
  8811. addClass(document.body, hiddenCls.value);
  8812. });
  8813. vue.onScopeDispose(() => cleanup());
  8814. };
  8815. const modalStack = [];
  8816. const closeModal = (e) => {
  8817. if (modalStack.length === 0)
  8818. return;
  8819. if (e.code === EVENT_CODE.esc) {
  8820. e.stopPropagation();
  8821. const topModal = modalStack[modalStack.length - 1];
  8822. topModal.handleClose();
  8823. }
  8824. };
  8825. const useModal = (instance, visibleRef) => {
  8826. vue.watch(visibleRef, (val) => {
  8827. if (val) {
  8828. modalStack.push(instance);
  8829. } else {
  8830. modalStack.splice(modalStack.indexOf(instance), 1);
  8831. }
  8832. });
  8833. };
  8834. if (isClient)
  8835. useEventListener(document, "keydown", closeModal);
  8836. const _prop = buildProp({
  8837. type: definePropType(Boolean),
  8838. default: null
  8839. });
  8840. const _event = buildProp({
  8841. type: definePropType(Function)
  8842. });
  8843. const createModelToggleComposable = (name) => {
  8844. const updateEventKey = `update:${name}`;
  8845. const updateEventKeyRaw = `onUpdate:${name}`;
  8846. const useModelToggleEmits2 = [updateEventKey];
  8847. const useModelToggleProps2 = {
  8848. [name]: _prop,
  8849. [updateEventKeyRaw]: _event
  8850. };
  8851. const useModelToggle2 = ({
  8852. indicator,
  8853. toggleReason,
  8854. shouldHideWhenRouteChanges,
  8855. shouldProceed,
  8856. onShow,
  8857. onHide
  8858. }) => {
  8859. const instance = vue.getCurrentInstance();
  8860. const { emit } = instance;
  8861. const props = instance.props;
  8862. const hasUpdateHandler = vue.computed(() => isFunction(props[updateEventKeyRaw]));
  8863. const isModelBindingAbsent = vue.computed(() => props[name] === null);
  8864. const doShow = (event) => {
  8865. if (indicator.value === true) {
  8866. return;
  8867. }
  8868. indicator.value = true;
  8869. if (toggleReason) {
  8870. toggleReason.value = event;
  8871. }
  8872. if (isFunction(onShow)) {
  8873. onShow(event);
  8874. }
  8875. };
  8876. const doHide = (event) => {
  8877. if (indicator.value === false) {
  8878. return;
  8879. }
  8880. indicator.value = false;
  8881. if (toggleReason) {
  8882. toggleReason.value = event;
  8883. }
  8884. if (isFunction(onHide)) {
  8885. onHide(event);
  8886. }
  8887. };
  8888. const show = (event) => {
  8889. if (props.disabled === true || isFunction(shouldProceed) && !shouldProceed())
  8890. return;
  8891. const shouldEmit = hasUpdateHandler.value && isClient;
  8892. if (shouldEmit) {
  8893. emit(updateEventKey, true);
  8894. }
  8895. if (isModelBindingAbsent.value || !shouldEmit) {
  8896. doShow(event);
  8897. }
  8898. };
  8899. const hide = (event) => {
  8900. if (props.disabled === true || !isClient)
  8901. return;
  8902. const shouldEmit = hasUpdateHandler.value && isClient;
  8903. if (shouldEmit) {
  8904. emit(updateEventKey, false);
  8905. }
  8906. if (isModelBindingAbsent.value || !shouldEmit) {
  8907. doHide(event);
  8908. }
  8909. };
  8910. const onChange = (val) => {
  8911. if (!isBoolean(val))
  8912. return;
  8913. if (props.disabled && val) {
  8914. if (hasUpdateHandler.value) {
  8915. emit(updateEventKey, false);
  8916. }
  8917. } else if (indicator.value !== val) {
  8918. if (val) {
  8919. doShow();
  8920. } else {
  8921. doHide();
  8922. }
  8923. }
  8924. };
  8925. const toggle = () => {
  8926. if (indicator.value) {
  8927. hide();
  8928. } else {
  8929. show();
  8930. }
  8931. };
  8932. vue.watch(() => props[name], onChange);
  8933. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  8934. vue.watch(() => ({
  8935. ...instance.proxy.$route
  8936. }), () => {
  8937. if (shouldHideWhenRouteChanges.value && indicator.value) {
  8938. hide();
  8939. }
  8940. });
  8941. }
  8942. vue.onMounted(() => {
  8943. onChange(props[name]);
  8944. });
  8945. return {
  8946. hide,
  8947. show,
  8948. toggle,
  8949. hasUpdateHandler
  8950. };
  8951. };
  8952. return {
  8953. useModelToggle: useModelToggle2,
  8954. useModelToggleProps: useModelToggleProps2,
  8955. useModelToggleEmits: useModelToggleEmits2
  8956. };
  8957. };
  8958. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  8959. const usePreventGlobal = (indicator, evt, cb) => {
  8960. const prevent = (e) => {
  8961. if (cb(e))
  8962. e.stopImmediatePropagation();
  8963. };
  8964. let stop = void 0;
  8965. vue.watch(() => indicator.value, (val) => {
  8966. if (val) {
  8967. stop = useEventListener(document, evt, prevent, true);
  8968. } else {
  8969. stop == null ? void 0 : stop();
  8970. }
  8971. }, { immediate: true });
  8972. };
  8973. const useRestoreActive = (toggle, initialFocus) => {
  8974. let previousActive;
  8975. vue.watch(() => toggle.value, (val) => {
  8976. var _a, _b;
  8977. if (val) {
  8978. previousActive = document.activeElement;
  8979. if (vue.isRef(initialFocus)) {
  8980. (_b = (_a = initialFocus.value).focus) == null ? void 0 : _b.call(_a);
  8981. }
  8982. } else {
  8983. {
  8984. previousActive.focus();
  8985. }
  8986. }
  8987. });
  8988. };
  8989. const useSameTarget = (handleClick) => {
  8990. if (!handleClick) {
  8991. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  8992. }
  8993. let mousedownTarget = false;
  8994. let mouseupTarget = false;
  8995. const onClick = (e) => {
  8996. if (mousedownTarget && mouseupTarget) {
  8997. handleClick(e);
  8998. }
  8999. mousedownTarget = mouseupTarget = false;
  9000. };
  9001. const onMousedown = (e) => {
  9002. mousedownTarget = e.target === e.currentTarget;
  9003. };
  9004. const onMouseup = (e) => {
  9005. mouseupTarget = e.target === e.currentTarget;
  9006. };
  9007. return { onClick, onMousedown, onMouseup };
  9008. };
  9009. const useTeleport = (contentRenderer, appendToBody) => {
  9010. const isTeleportVisible = vue.ref(false);
  9011. if (!isClient) {
  9012. return {
  9013. isTeleportVisible,
  9014. showTeleport: NOOP,
  9015. hideTeleport: NOOP,
  9016. renderTeleport: NOOP
  9017. };
  9018. }
  9019. let $el = null;
  9020. const showTeleport = () => {
  9021. isTeleportVisible.value = true;
  9022. if ($el !== null)
  9023. return;
  9024. $el = createGlobalNode();
  9025. };
  9026. const hideTeleport = () => {
  9027. isTeleportVisible.value = false;
  9028. if ($el !== null) {
  9029. removeGlobalNode($el);
  9030. $el = null;
  9031. }
  9032. };
  9033. const renderTeleport = () => {
  9034. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [vue.h(vue.Teleport, { to: $el }, contentRenderer())] : void 0;
  9035. };
  9036. vue.onUnmounted(hideTeleport);
  9037. return {
  9038. isTeleportVisible,
  9039. showTeleport,
  9040. hideTeleport,
  9041. renderTeleport
  9042. };
  9043. };
  9044. const useThrottleRender = (loading, throttle = 0) => {
  9045. if (throttle === 0)
  9046. return loading;
  9047. const throttled = vue.ref(false);
  9048. let timeoutHandle = 0;
  9049. const dispatchThrottling = () => {
  9050. if (timeoutHandle) {
  9051. clearTimeout(timeoutHandle);
  9052. }
  9053. timeoutHandle = window.setTimeout(() => {
  9054. throttled.value = loading.value;
  9055. }, throttle);
  9056. };
  9057. vue.onMounted(dispatchThrottling);
  9058. vue.watch(() => loading.value, (val) => {
  9059. if (val) {
  9060. dispatchThrottling();
  9061. } else {
  9062. throttled.value = val;
  9063. }
  9064. });
  9065. return throttled;
  9066. };
  9067. function useTimeout() {
  9068. let timeoutHandle;
  9069. const registerTimeout = (fn, delay) => {
  9070. cancelTimeout();
  9071. timeoutHandle = window.setTimeout(fn, delay);
  9072. };
  9073. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  9074. tryOnScopeDispose(() => cancelTimeout());
  9075. return {
  9076. registerTimeout,
  9077. cancelTimeout
  9078. };
  9079. }
  9080. const AFTER_APPEAR = "after-appear";
  9081. const AFTER_ENTER = "after-enter";
  9082. const AFTER_LEAVE = "after-leave";
  9083. const APPEAR = "appear";
  9084. const APPEAR_CANCELLED = "appear-cancelled";
  9085. const BEFORE_ENTER = "before-enter";
  9086. const BEFORE_LEAVE = "before-leave";
  9087. const ENTER = "enter";
  9088. const ENTER_CANCELLED = "enter-cancelled";
  9089. const LEAVE = "leave";
  9090. const LEAVE_CANCELLED = "leave-cancelled";
  9091. const useTransitionFallthroughEmits = [
  9092. AFTER_APPEAR,
  9093. AFTER_ENTER,
  9094. AFTER_LEAVE,
  9095. APPEAR,
  9096. APPEAR_CANCELLED,
  9097. BEFORE_ENTER,
  9098. BEFORE_LEAVE,
  9099. ENTER,
  9100. ENTER_CANCELLED,
  9101. LEAVE,
  9102. LEAVE_CANCELLED
  9103. ];
  9104. const useTransitionFallthrough = () => {
  9105. const { emit } = vue.getCurrentInstance();
  9106. return {
  9107. onAfterAppear: () => {
  9108. emit(AFTER_APPEAR);
  9109. },
  9110. onAfterEnter: () => {
  9111. emit(AFTER_ENTER);
  9112. },
  9113. onAfterLeave: () => {
  9114. emit(AFTER_LEAVE);
  9115. },
  9116. onAppearCancelled: () => {
  9117. emit(APPEAR_CANCELLED);
  9118. },
  9119. onBeforeEnter: () => {
  9120. emit(BEFORE_ENTER);
  9121. },
  9122. onBeforeLeave: () => {
  9123. emit(BEFORE_LEAVE);
  9124. },
  9125. onEnter: () => {
  9126. emit(ENTER);
  9127. },
  9128. onEnterCancelled: () => {
  9129. emit(ENTER_CANCELLED);
  9130. },
  9131. onLeave: () => {
  9132. emit(LEAVE);
  9133. },
  9134. onLeaveCancelled: () => {
  9135. emit(LEAVE_CANCELLED);
  9136. }
  9137. };
  9138. };
  9139. let registeredEscapeHandlers = [];
  9140. const cachedHandler = (e) => {
  9141. const event = e;
  9142. if (event.key === EVENT_CODE.esc) {
  9143. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  9144. }
  9145. };
  9146. const useEscapeKeydown = (handler) => {
  9147. vue.onMounted(() => {
  9148. if (registeredEscapeHandlers.length === 0) {
  9149. document.addEventListener("keydown", cachedHandler);
  9150. }
  9151. if (isClient)
  9152. registeredEscapeHandlers.push(handler);
  9153. });
  9154. vue.onBeforeUnmount(() => {
  9155. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  9156. if (registeredEscapeHandlers.length === 0) {
  9157. if (isClient)
  9158. document.removeEventListener("keydown", cachedHandler);
  9159. }
  9160. });
  9161. };
  9162. let cachedContainer;
  9163. const usePopperContainerId = () => {
  9164. const namespace = useGlobalConfig("namespace", defaultNamespace);
  9165. const idInjection = useIdInjection();
  9166. const id = vue.computed(() => {
  9167. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  9168. });
  9169. const selector = vue.computed(() => `#${id.value}`);
  9170. return {
  9171. id,
  9172. selector
  9173. };
  9174. };
  9175. const createContainer = (id) => {
  9176. const container = document.createElement("div");
  9177. container.id = id;
  9178. document.body.appendChild(container);
  9179. return container;
  9180. };
  9181. const usePopperContainer = () => {
  9182. vue.onBeforeMount(() => {
  9183. if (!isClient)
  9184. return;
  9185. const { id, selector } = usePopperContainerId();
  9186. if (!cachedContainer && !document.body.querySelector(selector.value)) {
  9187. cachedContainer = createContainer(id.value);
  9188. }
  9189. });
  9190. };
  9191. const useDelayedRender = ({
  9192. indicator,
  9193. intermediateIndicator,
  9194. shouldSetIntermediate = () => true,
  9195. beforeShow,
  9196. afterShow,
  9197. afterHide,
  9198. beforeHide
  9199. }) => {
  9200. vue.watch(() => vue.unref(indicator), (val) => {
  9201. if (val) {
  9202. beforeShow == null ? void 0 : beforeShow();
  9203. vue.nextTick(() => {
  9204. if (!vue.unref(indicator))
  9205. return;
  9206. if (shouldSetIntermediate("show")) {
  9207. intermediateIndicator.value = true;
  9208. }
  9209. });
  9210. } else {
  9211. beforeHide == null ? void 0 : beforeHide();
  9212. vue.nextTick(() => {
  9213. if (vue.unref(indicator))
  9214. return;
  9215. if (shouldSetIntermediate("hide")) {
  9216. intermediateIndicator.value = false;
  9217. }
  9218. });
  9219. }
  9220. });
  9221. vue.watch(() => intermediateIndicator.value, (val) => {
  9222. if (val) {
  9223. afterShow == null ? void 0 : afterShow();
  9224. } else {
  9225. afterHide == null ? void 0 : afterHide();
  9226. }
  9227. });
  9228. };
  9229. const useDelayedToggleProps = buildProps({
  9230. showAfter: {
  9231. type: Number,
  9232. default: 0
  9233. },
  9234. hideAfter: {
  9235. type: Number,
  9236. default: 200
  9237. }
  9238. });
  9239. const useDelayedToggle = ({
  9240. showAfter,
  9241. hideAfter,
  9242. open,
  9243. close
  9244. }) => {
  9245. const { registerTimeout } = useTimeout();
  9246. const onOpen = (event) => {
  9247. registerTimeout(() => {
  9248. open(event);
  9249. }, vue.unref(showAfter));
  9250. };
  9251. const onClose = (event) => {
  9252. registerTimeout(() => {
  9253. close(event);
  9254. }, vue.unref(hideAfter));
  9255. };
  9256. return {
  9257. onOpen,
  9258. onClose
  9259. };
  9260. };
  9261. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  9262. const useForwardRef = (forwardRef) => {
  9263. const setForwardRef = (el) => {
  9264. forwardRef.value = el;
  9265. };
  9266. vue.provide(FORWARD_REF_INJECTION_KEY, {
  9267. setForwardRef
  9268. });
  9269. };
  9270. const useForwardRefDirective = (setForwardRef) => {
  9271. return {
  9272. mounted(el) {
  9273. setForwardRef(el);
  9274. },
  9275. updated(el) {
  9276. setForwardRef(el);
  9277. },
  9278. unmounted() {
  9279. setForwardRef(null);
  9280. }
  9281. };
  9282. };
  9283. const zIndex = vue.ref(0);
  9284. const useZIndex = () => {
  9285. const initialZIndex = useGlobalConfig("zIndex", 2e3);
  9286. const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
  9287. const nextZIndex = () => {
  9288. zIndex.value++;
  9289. return currentZIndex.value;
  9290. };
  9291. return {
  9292. initialZIndex,
  9293. currentZIndex,
  9294. nextZIndex
  9295. };
  9296. };
  9297. function getSide(placement) {
  9298. return placement.split('-')[0];
  9299. }
  9300. function getAlignment(placement) {
  9301. return placement.split('-')[1];
  9302. }
  9303. function getMainAxisFromPlacement(placement) {
  9304. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  9305. }
  9306. function getLengthFromAxis(axis) {
  9307. return axis === 'y' ? 'height' : 'width';
  9308. }
  9309. function computeCoordsFromPlacement(_ref, placement, rtl) {
  9310. let {
  9311. reference,
  9312. floating
  9313. } = _ref;
  9314. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  9315. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  9316. const mainAxis = getMainAxisFromPlacement(placement);
  9317. const length = getLengthFromAxis(mainAxis);
  9318. const commonAlign = reference[length] / 2 - floating[length] / 2;
  9319. const side = getSide(placement);
  9320. const isVertical = mainAxis === 'x';
  9321. let coords;
  9322. switch (side) {
  9323. case 'top':
  9324. coords = {
  9325. x: commonX,
  9326. y: reference.y - floating.height
  9327. };
  9328. break;
  9329. case 'bottom':
  9330. coords = {
  9331. x: commonX,
  9332. y: reference.y + reference.height
  9333. };
  9334. break;
  9335. case 'right':
  9336. coords = {
  9337. x: reference.x + reference.width,
  9338. y: commonY
  9339. };
  9340. break;
  9341. case 'left':
  9342. coords = {
  9343. x: reference.x - floating.width,
  9344. y: commonY
  9345. };
  9346. break;
  9347. default:
  9348. coords = {
  9349. x: reference.x,
  9350. y: reference.y
  9351. };
  9352. }
  9353. switch (getAlignment(placement)) {
  9354. case 'start':
  9355. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  9356. break;
  9357. case 'end':
  9358. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  9359. break;
  9360. }
  9361. return coords;
  9362. }
  9363. /**
  9364. * Computes the `x` and `y` coordinates that will place the floating element
  9365. * next to a reference element when it is given a certain positioning strategy.
  9366. *
  9367. * This export does not have any `platform` interface logic. You will need to
  9368. * write one for the platform you are using Floating UI with.
  9369. */
  9370. const computePosition$1 = async (reference, floating, config) => {
  9371. const {
  9372. placement = 'bottom',
  9373. strategy = 'absolute',
  9374. middleware = [],
  9375. platform
  9376. } = config;
  9377. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  9378. if (process.env.NODE_ENV !== "production") {
  9379. if (platform == null) {
  9380. console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));
  9381. }
  9382. if (middleware.filter(_ref => {
  9383. let {
  9384. name
  9385. } = _ref;
  9386. return name === 'autoPlacement' || name === 'flip';
  9387. }).length > 1) {
  9388. throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement`', 'middleware detected. This will lead to an infinite loop. Ensure only', 'one of either has been passed to the `middleware` array.'].join(' '));
  9389. }
  9390. }
  9391. let rects = await platform.getElementRects({
  9392. reference,
  9393. floating,
  9394. strategy
  9395. });
  9396. let {
  9397. x,
  9398. y
  9399. } = computeCoordsFromPlacement(rects, placement, rtl);
  9400. let statefulPlacement = placement;
  9401. let middlewareData = {};
  9402. let resetCount = 0;
  9403. for (let i = 0; i < middleware.length; i++) {
  9404. const {
  9405. name,
  9406. fn
  9407. } = middleware[i];
  9408. const {
  9409. x: nextX,
  9410. y: nextY,
  9411. data,
  9412. reset
  9413. } = await fn({
  9414. x,
  9415. y,
  9416. initialPlacement: placement,
  9417. placement: statefulPlacement,
  9418. strategy,
  9419. middlewareData,
  9420. rects,
  9421. platform,
  9422. elements: {
  9423. reference,
  9424. floating
  9425. }
  9426. });
  9427. x = nextX != null ? nextX : x;
  9428. y = nextY != null ? nextY : y;
  9429. middlewareData = { ...middlewareData,
  9430. [name]: { ...middlewareData[name],
  9431. ...data
  9432. }
  9433. };
  9434. if (process.env.NODE_ENV !== "production") {
  9435. if (resetCount > 50) {
  9436. console.warn(['Floating UI: The middleware lifecycle appears to be running in an', 'infinite loop. This is usually caused by a `reset` continually', 'being returned without a break condition.'].join(' '));
  9437. }
  9438. }
  9439. if (reset && resetCount <= 50) {
  9440. resetCount++;
  9441. if (typeof reset === 'object') {
  9442. if (reset.placement) {
  9443. statefulPlacement = reset.placement;
  9444. }
  9445. if (reset.rects) {
  9446. rects = reset.rects === true ? await platform.getElementRects({
  9447. reference,
  9448. floating,
  9449. strategy
  9450. }) : reset.rects;
  9451. }
  9452. ({
  9453. x,
  9454. y
  9455. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  9456. }
  9457. i = -1;
  9458. continue;
  9459. }
  9460. }
  9461. return {
  9462. x,
  9463. y,
  9464. placement: statefulPlacement,
  9465. strategy,
  9466. middlewareData
  9467. };
  9468. };
  9469. function expandPaddingObject(padding) {
  9470. return {
  9471. top: 0,
  9472. right: 0,
  9473. bottom: 0,
  9474. left: 0,
  9475. ...padding
  9476. };
  9477. }
  9478. function getSideObjectFromPadding(padding) {
  9479. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  9480. top: padding,
  9481. right: padding,
  9482. bottom: padding,
  9483. left: padding
  9484. };
  9485. }
  9486. function rectToClientRect(rect) {
  9487. return { ...rect,
  9488. top: rect.y,
  9489. left: rect.x,
  9490. right: rect.x + rect.width,
  9491. bottom: rect.y + rect.height
  9492. };
  9493. }
  9494. const min$2 = Math.min;
  9495. const max$2 = Math.max;
  9496. function within(min$1, value, max$1) {
  9497. return max$2(min$1, min$2(value, max$1));
  9498. }
  9499. /**
  9500. * Positions an inner element of the floating element such that it is centered
  9501. * to the reference element.
  9502. * @see https://floating-ui.com/docs/arrow
  9503. */
  9504. const arrow = options => ({
  9505. name: 'arrow',
  9506. options,
  9507. async fn(middlewareArguments) {
  9508. // Since `element` is required, we don't Partial<> the type
  9509. const {
  9510. element,
  9511. padding = 0
  9512. } = options != null ? options : {};
  9513. const {
  9514. x,
  9515. y,
  9516. placement,
  9517. rects,
  9518. platform
  9519. } = middlewareArguments;
  9520. if (element == null) {
  9521. if (process.env.NODE_ENV !== "production") {
  9522. console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
  9523. }
  9524. return {};
  9525. }
  9526. const paddingObject = getSideObjectFromPadding(padding);
  9527. const coords = {
  9528. x,
  9529. y
  9530. };
  9531. const axis = getMainAxisFromPlacement(placement);
  9532. const alignment = getAlignment(placement);
  9533. const length = getLengthFromAxis(axis);
  9534. const arrowDimensions = await platform.getDimensions(element);
  9535. const minProp = axis === 'y' ? 'top' : 'left';
  9536. const maxProp = axis === 'y' ? 'bottom' : 'right';
  9537. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  9538. const startDiff = coords[axis] - rects.reference[axis];
  9539. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  9540. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  9541. if (clientSize === 0) {
  9542. clientSize = rects.floating[length];
  9543. }
  9544. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  9545. // point is outside the floating element's bounds
  9546. const min = paddingObject[minProp];
  9547. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  9548. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  9549. const offset = within(min, center, max); // Make sure that arrow points at the reference
  9550. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  9551. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  9552. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  9553. return {
  9554. [axis]: coords[axis] - alignmentOffset,
  9555. data: {
  9556. [axis]: offset,
  9557. centerOffset: center - offset
  9558. }
  9559. };
  9560. }
  9561. });
  9562. async function convertValueToCoords(middlewareArguments, value) {
  9563. const {
  9564. placement,
  9565. platform,
  9566. elements
  9567. } = middlewareArguments;
  9568. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  9569. const side = getSide(placement);
  9570. const alignment = getAlignment(placement);
  9571. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  9572. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  9573. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  9574. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  9575. let {
  9576. mainAxis,
  9577. crossAxis,
  9578. alignmentAxis
  9579. } = typeof rawValue === 'number' ? {
  9580. mainAxis: rawValue,
  9581. crossAxis: 0,
  9582. alignmentAxis: null
  9583. } : {
  9584. mainAxis: 0,
  9585. crossAxis: 0,
  9586. alignmentAxis: null,
  9587. ...rawValue
  9588. };
  9589. if (alignment && typeof alignmentAxis === 'number') {
  9590. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  9591. }
  9592. return isVertical ? {
  9593. x: crossAxis * crossAxisMulti,
  9594. y: mainAxis * mainAxisMulti
  9595. } : {
  9596. x: mainAxis * mainAxisMulti,
  9597. y: crossAxis * crossAxisMulti
  9598. };
  9599. }
  9600. /**
  9601. * Displaces the floating element from its reference element.
  9602. * @see https://floating-ui.com/docs/offset
  9603. */
  9604. const offset = function (value) {
  9605. if (value === void 0) {
  9606. value = 0;
  9607. }
  9608. return {
  9609. name: 'offset',
  9610. options: value,
  9611. async fn(middlewareArguments) {
  9612. const {
  9613. x,
  9614. y
  9615. } = middlewareArguments;
  9616. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  9617. return {
  9618. x: x + diffCoords.x,
  9619. y: y + diffCoords.y,
  9620. data: diffCoords
  9621. };
  9622. }
  9623. };
  9624. };
  9625. function isWindow(value) {
  9626. return value && value.document && value.location && value.alert && value.setInterval;
  9627. }
  9628. function getWindow(node) {
  9629. if (node == null) {
  9630. return window;
  9631. }
  9632. if (!isWindow(node)) {
  9633. const ownerDocument = node.ownerDocument;
  9634. return ownerDocument ? ownerDocument.defaultView || window : window;
  9635. }
  9636. return node;
  9637. }
  9638. function getComputedStyle$1(element) {
  9639. return getWindow(element).getComputedStyle(element);
  9640. }
  9641. function getNodeName(node) {
  9642. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  9643. }
  9644. function getUAString() {
  9645. const uaData = navigator.userAgentData;
  9646. if (uaData != null && uaData.brands) {
  9647. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  9648. }
  9649. return navigator.userAgent;
  9650. }
  9651. function isHTMLElement(value) {
  9652. return value instanceof getWindow(value).HTMLElement;
  9653. }
  9654. function isElement(value) {
  9655. return value instanceof getWindow(value).Element;
  9656. }
  9657. function isNode(value) {
  9658. return value instanceof getWindow(value).Node;
  9659. }
  9660. function isShadowRoot(node) {
  9661. // Browsers without `ShadowRoot` support
  9662. if (typeof ShadowRoot === 'undefined') {
  9663. return false;
  9664. }
  9665. const OwnElement = getWindow(node).ShadowRoot;
  9666. return node instanceof OwnElement || node instanceof ShadowRoot;
  9667. }
  9668. function isOverflowElement(element) {
  9669. // Firefox wants us to check `-x` and `-y` variations as well
  9670. const {
  9671. overflow,
  9672. overflowX,
  9673. overflowY
  9674. } = getComputedStyle$1(element);
  9675. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  9676. }
  9677. function isTableElement(element) {
  9678. return ['table', 'td', 'th'].includes(getNodeName(element));
  9679. }
  9680. function isContainingBlock(element) {
  9681. // TODO: Try and use feature detection here instead
  9682. const isFirefox = /firefox/i.test(getUAString());
  9683. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  9684. // create a containing block.
  9685. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  9686. return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
  9687. css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
  9688. }
  9689. function isLayoutViewport() {
  9690. // Not Safari
  9691. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  9692. // • Always-visible scrollbar or not
  9693. // • Width of <html>, etc.
  9694. // const vV = win.visualViewport;
  9695. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  9696. }
  9697. const min$1 = Math.min;
  9698. const max$1 = Math.max;
  9699. const round = Math.round;
  9700. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  9701. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  9702. if (includeScale === void 0) {
  9703. includeScale = false;
  9704. }
  9705. if (isFixedStrategy === void 0) {
  9706. isFixedStrategy = false;
  9707. }
  9708. const clientRect = element.getBoundingClientRect();
  9709. let scaleX = 1;
  9710. let scaleY = 1;
  9711. if (includeScale && isHTMLElement(element)) {
  9712. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  9713. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  9714. }
  9715. const win = isElement(element) ? getWindow(element) : window;
  9716. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  9717. 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;
  9718. 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;
  9719. const width = clientRect.width / scaleX;
  9720. const height = clientRect.height / scaleY;
  9721. return {
  9722. width,
  9723. height,
  9724. top: y,
  9725. right: x + width,
  9726. bottom: y + height,
  9727. left: x,
  9728. x,
  9729. y
  9730. };
  9731. }
  9732. function getDocumentElement(node) {
  9733. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  9734. }
  9735. function getNodeScroll(element) {
  9736. if (isElement(element)) {
  9737. return {
  9738. scrollLeft: element.scrollLeft,
  9739. scrollTop: element.scrollTop
  9740. };
  9741. }
  9742. return {
  9743. scrollLeft: element.pageXOffset,
  9744. scrollTop: element.pageYOffset
  9745. };
  9746. }
  9747. function getWindowScrollBarX(element) {
  9748. // If <html> has a CSS width greater than the viewport, then this will be
  9749. // incorrect for RTL.
  9750. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  9751. }
  9752. function isScaled(element) {
  9753. const rect = getBoundingClientRect(element);
  9754. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  9755. }
  9756. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  9757. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9758. const documentElement = getDocumentElement(offsetParent);
  9759. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  9760. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  9761. let scroll = {
  9762. scrollLeft: 0,
  9763. scrollTop: 0
  9764. };
  9765. const offsets = {
  9766. x: 0,
  9767. y: 0
  9768. };
  9769. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9770. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9771. scroll = getNodeScroll(offsetParent);
  9772. }
  9773. if (isHTMLElement(offsetParent)) {
  9774. const offsetRect = getBoundingClientRect(offsetParent, true);
  9775. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9776. offsets.y = offsetRect.y + offsetParent.clientTop;
  9777. } else if (documentElement) {
  9778. offsets.x = getWindowScrollBarX(documentElement);
  9779. }
  9780. }
  9781. return {
  9782. x: rect.left + scroll.scrollLeft - offsets.x,
  9783. y: rect.top + scroll.scrollTop - offsets.y,
  9784. width: rect.width,
  9785. height: rect.height
  9786. };
  9787. }
  9788. function getParentNode(node) {
  9789. if (getNodeName(node) === 'html') {
  9790. return node;
  9791. }
  9792. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  9793. // @ts-ignore
  9794. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  9795. node.parentNode || ( // DOM Element detected
  9796. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  9797. getDocumentElement(node) // fallback
  9798. );
  9799. }
  9800. function getTrueOffsetParent(element) {
  9801. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  9802. return null;
  9803. }
  9804. return composedOffsetParent(element);
  9805. }
  9806. /**
  9807. * Polyfills the old offsetParent behavior from before the spec was changed:
  9808. * https://github.com/w3c/csswg-drafts/issues/159
  9809. */
  9810. function composedOffsetParent(element) {
  9811. let {
  9812. offsetParent
  9813. } = element;
  9814. let ancestor = element;
  9815. let foundInsideSlot = false;
  9816. while (ancestor && ancestor !== offsetParent) {
  9817. const {
  9818. assignedSlot
  9819. } = ancestor;
  9820. if (assignedSlot) {
  9821. let newOffsetParent = assignedSlot.offsetParent;
  9822. if (getComputedStyle$1(assignedSlot).display === 'contents') {
  9823. const hadStyleAttribute = assignedSlot.hasAttribute('style');
  9824. const oldDisplay = assignedSlot.style.display;
  9825. assignedSlot.style.display = getComputedStyle$1(ancestor).display;
  9826. newOffsetParent = assignedSlot.offsetParent;
  9827. assignedSlot.style.display = oldDisplay;
  9828. if (!hadStyleAttribute) {
  9829. assignedSlot.removeAttribute('style');
  9830. }
  9831. }
  9832. ancestor = assignedSlot;
  9833. if (offsetParent !== newOffsetParent) {
  9834. offsetParent = newOffsetParent;
  9835. foundInsideSlot = true;
  9836. }
  9837. } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
  9838. break;
  9839. }
  9840. ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
  9841. }
  9842. return offsetParent;
  9843. }
  9844. function getContainingBlock(element) {
  9845. let currentNode = getParentNode(element);
  9846. if (isShadowRoot(currentNode)) {
  9847. currentNode = currentNode.host;
  9848. }
  9849. while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
  9850. if (isContainingBlock(currentNode)) {
  9851. return currentNode;
  9852. } else {
  9853. const parent = currentNode.parentNode;
  9854. currentNode = isShadowRoot(parent) ? parent.host : parent;
  9855. }
  9856. }
  9857. return null;
  9858. } // Gets the closest ancestor positioned element. Handles some edge cases,
  9859. // such as table ancestors and cross browser bugs.
  9860. function getOffsetParent(element) {
  9861. const window = getWindow(element);
  9862. let offsetParent = getTrueOffsetParent(element);
  9863. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  9864. offsetParent = getTrueOffsetParent(offsetParent);
  9865. }
  9866. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  9867. return window;
  9868. }
  9869. return offsetParent || getContainingBlock(element) || window;
  9870. }
  9871. function getDimensions(element) {
  9872. if (isHTMLElement(element)) {
  9873. return {
  9874. width: element.offsetWidth,
  9875. height: element.offsetHeight
  9876. };
  9877. }
  9878. const rect = getBoundingClientRect(element);
  9879. return {
  9880. width: rect.width,
  9881. height: rect.height
  9882. };
  9883. }
  9884. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  9885. let {
  9886. rect,
  9887. offsetParent,
  9888. strategy
  9889. } = _ref;
  9890. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9891. const documentElement = getDocumentElement(offsetParent);
  9892. if (offsetParent === documentElement) {
  9893. return rect;
  9894. }
  9895. let scroll = {
  9896. scrollLeft: 0,
  9897. scrollTop: 0
  9898. };
  9899. const offsets = {
  9900. x: 0,
  9901. y: 0
  9902. };
  9903. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9904. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9905. scroll = getNodeScroll(offsetParent);
  9906. }
  9907. if (isHTMLElement(offsetParent)) {
  9908. const offsetRect = getBoundingClientRect(offsetParent, true);
  9909. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9910. offsets.y = offsetRect.y + offsetParent.clientTop;
  9911. } // This doesn't appear to be need to be negated.
  9912. // else if (documentElement) {
  9913. // offsets.x = getWindowScrollBarX(documentElement);
  9914. // }
  9915. }
  9916. return { ...rect,
  9917. x: rect.x - scroll.scrollLeft + offsets.x,
  9918. y: rect.y - scroll.scrollTop + offsets.y
  9919. };
  9920. }
  9921. function getViewportRect(element, strategy) {
  9922. const win = getWindow(element);
  9923. const html = getDocumentElement(element);
  9924. const visualViewport = win.visualViewport;
  9925. let width = html.clientWidth;
  9926. let height = html.clientHeight;
  9927. let x = 0;
  9928. let y = 0;
  9929. if (visualViewport) {
  9930. width = visualViewport.width;
  9931. height = visualViewport.height;
  9932. const layoutViewport = isLayoutViewport();
  9933. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  9934. x = visualViewport.offsetLeft;
  9935. y = visualViewport.offsetTop;
  9936. }
  9937. }
  9938. return {
  9939. width,
  9940. height,
  9941. x,
  9942. y
  9943. };
  9944. }
  9945. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  9946. function getDocumentRect(element) {
  9947. var _element$ownerDocumen;
  9948. const html = getDocumentElement(element);
  9949. const scroll = getNodeScroll(element);
  9950. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  9951. const width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  9952. const height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  9953. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  9954. const y = -scroll.scrollTop;
  9955. if (getComputedStyle$1(body || html).direction === 'rtl') {
  9956. x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
  9957. }
  9958. return {
  9959. width,
  9960. height,
  9961. x,
  9962. y
  9963. };
  9964. }
  9965. function getNearestOverflowAncestor(node) {
  9966. const parentNode = getParentNode(node);
  9967. if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
  9968. // @ts-ignore assume body is always available
  9969. return node.ownerDocument.body;
  9970. }
  9971. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  9972. return parentNode;
  9973. }
  9974. return getNearestOverflowAncestor(parentNode);
  9975. }
  9976. function getOverflowAncestors(node, list) {
  9977. var _node$ownerDocument;
  9978. if (list === void 0) {
  9979. list = [];
  9980. }
  9981. const scrollableAncestor = getNearestOverflowAncestor(node);
  9982. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  9983. const win = getWindow(scrollableAncestor);
  9984. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  9985. const updatedList = list.concat(target);
  9986. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  9987. updatedList.concat(getOverflowAncestors(target));
  9988. }
  9989. function contains(parent, child) {
  9990. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  9991. if (parent.contains(child)) {
  9992. return true;
  9993. } // then fallback to custom implementation with Shadow DOM support
  9994. else if (rootNode && isShadowRoot(rootNode)) {
  9995. let next = child;
  9996. do {
  9997. // use `===` replace node.isSameNode()
  9998. if (next && parent === next) {
  9999. return true;
  10000. } // @ts-ignore: need a better way to handle this...
  10001. next = next.parentNode || next.host;
  10002. } while (next);
  10003. }
  10004. return false;
  10005. }
  10006. function getInnerBoundingClientRect(element, strategy) {
  10007. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  10008. const top = clientRect.top + element.clientTop;
  10009. const left = clientRect.left + element.clientLeft;
  10010. return {
  10011. top,
  10012. left,
  10013. x: left,
  10014. y: top,
  10015. right: left + element.clientWidth,
  10016. bottom: top + element.clientHeight,
  10017. width: element.clientWidth,
  10018. height: element.clientHeight
  10019. };
  10020. }
  10021. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  10022. if (clippingParent === 'viewport') {
  10023. return rectToClientRect(getViewportRect(element, strategy));
  10024. }
  10025. if (isElement(clippingParent)) {
  10026. return getInnerBoundingClientRect(clippingParent, strategy);
  10027. }
  10028. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  10029. } // A "clipping ancestor" is an overflowable container with the characteristic of
  10030. // clipping (or hiding) overflowing elements with a position different from
  10031. // `initial`
  10032. function getClippingAncestors(element) {
  10033. const clippingAncestors = getOverflowAncestors(element);
  10034. const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
  10035. const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  10036. if (!isElement(clipperElement)) {
  10037. return [];
  10038. } // @ts-ignore isElement check ensures we return Array<Element>
  10039. return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  10040. } // Gets the maximum area that the element is visible in due to any number of
  10041. // clipping ancestors
  10042. function getClippingRect(_ref) {
  10043. let {
  10044. element,
  10045. boundary,
  10046. rootBoundary,
  10047. strategy
  10048. } = _ref;
  10049. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  10050. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  10051. const firstClippingAncestor = clippingAncestors[0];
  10052. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  10053. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  10054. accRect.top = max$1(rect.top, accRect.top);
  10055. accRect.right = min$1(rect.right, accRect.right);
  10056. accRect.bottom = min$1(rect.bottom, accRect.bottom);
  10057. accRect.left = max$1(rect.left, accRect.left);
  10058. return accRect;
  10059. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  10060. return {
  10061. width: clippingRect.right - clippingRect.left,
  10062. height: clippingRect.bottom - clippingRect.top,
  10063. x: clippingRect.left,
  10064. y: clippingRect.top
  10065. };
  10066. }
  10067. const platform = {
  10068. getClippingRect,
  10069. convertOffsetParentRelativeRectToViewportRelativeRect,
  10070. isElement,
  10071. getDimensions,
  10072. getOffsetParent,
  10073. getDocumentElement,
  10074. getElementRects: _ref => {
  10075. let {
  10076. reference,
  10077. floating,
  10078. strategy
  10079. } = _ref;
  10080. return {
  10081. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  10082. floating: { ...getDimensions(floating),
  10083. x: 0,
  10084. y: 0
  10085. }
  10086. };
  10087. },
  10088. getClientRects: element => Array.from(element.getClientRects()),
  10089. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  10090. };
  10091. /**
  10092. * Computes the `x` and `y` coordinates that will place the floating element
  10093. * next to a reference element when it is given a certain CSS positioning
  10094. * strategy.
  10095. */
  10096. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  10097. platform,
  10098. ...options
  10099. });
  10100. const useFloatingProps = buildProps({});
  10101. const unrefReference = (elRef) => {
  10102. if (!isClient)
  10103. return;
  10104. if (!elRef)
  10105. return elRef;
  10106. const unrefEl = unrefElement(elRef);
  10107. if (unrefEl)
  10108. return unrefEl;
  10109. return vue.isRef(elRef) ? unrefEl : elRef;
  10110. };
  10111. const getPositionDataWithUnit = (record, key) => {
  10112. const value = record == null ? void 0 : record[key];
  10113. return isNil(value) ? "" : `${value}px`;
  10114. };
  10115. const useFloating = ({
  10116. middleware,
  10117. placement,
  10118. strategy
  10119. }) => {
  10120. const referenceRef = vue.ref();
  10121. const contentRef = vue.ref();
  10122. const x = vue.ref();
  10123. const y = vue.ref();
  10124. const middlewareData = vue.ref({});
  10125. const states = {
  10126. x,
  10127. y,
  10128. placement,
  10129. strategy,
  10130. middlewareData
  10131. };
  10132. const update = async () => {
  10133. if (!isClient)
  10134. return;
  10135. const referenceEl = unrefReference(referenceRef);
  10136. const contentEl = unrefElement(contentRef);
  10137. if (!referenceEl || !contentEl)
  10138. return;
  10139. const data = await computePosition(referenceEl, contentEl, {
  10140. placement: vue.unref(placement),
  10141. strategy: vue.unref(strategy),
  10142. middleware: vue.unref(middleware)
  10143. });
  10144. keysOf(states).forEach((key) => {
  10145. states[key].value = data[key];
  10146. });
  10147. };
  10148. vue.onMounted(() => {
  10149. vue.watchEffect(() => {
  10150. update();
  10151. });
  10152. });
  10153. return {
  10154. ...states,
  10155. update,
  10156. referenceRef,
  10157. contentRef
  10158. };
  10159. };
  10160. const arrowMiddleware = ({
  10161. arrowRef,
  10162. padding
  10163. }) => {
  10164. return {
  10165. name: "arrow",
  10166. options: {
  10167. element: arrowRef,
  10168. padding
  10169. },
  10170. fn(args) {
  10171. const arrowEl = vue.unref(arrowRef);
  10172. if (!arrowEl)
  10173. return {};
  10174. return arrow({
  10175. element: arrowEl,
  10176. padding
  10177. }).fn(args);
  10178. }
  10179. };
  10180. };
  10181. function useCursor(input) {
  10182. const selectionRef = vue.ref();
  10183. function recordCursor() {
  10184. if (input.value == void 0)
  10185. return;
  10186. const { selectionStart, selectionEnd, value } = input.value;
  10187. if (selectionStart == null || selectionEnd == null)
  10188. return;
  10189. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  10190. const afterTxt = value.slice(Math.max(0, selectionEnd));
  10191. selectionRef.value = {
  10192. selectionStart,
  10193. selectionEnd,
  10194. value,
  10195. beforeTxt,
  10196. afterTxt
  10197. };
  10198. }
  10199. function setCursor() {
  10200. if (input.value == void 0 || selectionRef.value == void 0)
  10201. return;
  10202. const { value } = input.value;
  10203. const { beforeTxt, afterTxt, selectionStart } = selectionRef.value;
  10204. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  10205. return;
  10206. let startPos = value.length;
  10207. if (value.endsWith(afterTxt)) {
  10208. startPos = value.length - afterTxt.length;
  10209. } else if (value.startsWith(beforeTxt)) {
  10210. startPos = beforeTxt.length;
  10211. } else {
  10212. const beforeLastChar = beforeTxt[selectionStart - 1];
  10213. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  10214. if (newIndex !== -1) {
  10215. startPos = newIndex + 1;
  10216. }
  10217. }
  10218. input.value.setSelectionRange(startPos, startPos);
  10219. }
  10220. return [recordCursor, setCursor];
  10221. }
  10222. const getOrderedChildren = (vm, childComponentName, children) => {
  10223. const nodes = flattedChildren(vm.subTree).filter((n) => {
  10224. var _a;
  10225. return vue.isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
  10226. });
  10227. const uids = nodes.map((n) => n.component.uid);
  10228. return uids.map((uid) => children[uid]).filter((p) => !!p);
  10229. };
  10230. const useOrderedChildren = (vm, childComponentName) => {
  10231. const children = {};
  10232. const orderedChildren = vue.shallowRef([]);
  10233. const addChild = (child) => {
  10234. children[child.uid] = child;
  10235. orderedChildren.value = getOrderedChildren(vm, childComponentName, children);
  10236. };
  10237. const removeChild = (uid) => {
  10238. delete children[uid];
  10239. orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid);
  10240. };
  10241. return {
  10242. children: orderedChildren,
  10243. addChild,
  10244. removeChild
  10245. };
  10246. };
  10247. const version$1 = "2.2.25";
  10248. const makeInstaller = (components = []) => {
  10249. const install = (app, options) => {
  10250. if (app[INSTALLED_KEY])
  10251. return;
  10252. app[INSTALLED_KEY] = true;
  10253. components.forEach((c) => app.use(c));
  10254. if (options)
  10255. provideGlobalConfig(options, app, true);
  10256. };
  10257. return {
  10258. version: version$1,
  10259. install
  10260. };
  10261. };
  10262. const affixProps = buildProps({
  10263. zIndex: {
  10264. type: definePropType([Number, String]),
  10265. default: 100
  10266. },
  10267. target: {
  10268. type: String,
  10269. default: ""
  10270. },
  10271. offset: {
  10272. type: Number,
  10273. default: 0
  10274. },
  10275. position: {
  10276. type: String,
  10277. values: ["top", "bottom"],
  10278. default: "top"
  10279. }
  10280. });
  10281. const affixEmits = {
  10282. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  10283. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  10284. };
  10285. var _export_sfc = (sfc, props) => {
  10286. const target = sfc.__vccOpts || sfc;
  10287. for (const [key, val] of props) {
  10288. target[key] = val;
  10289. }
  10290. return target;
  10291. };
  10292. const COMPONENT_NAME$m = "ElAffix";
  10293. const __default__$1w = vue.defineComponent({
  10294. name: COMPONENT_NAME$m
  10295. });
  10296. const _sfc_main$2f = /* @__PURE__ */ vue.defineComponent({
  10297. ...__default__$1w,
  10298. props: affixProps,
  10299. emits: affixEmits,
  10300. setup(__props, { expose, emit }) {
  10301. const props = __props;
  10302. const ns = useNamespace("affix");
  10303. const target = vue.shallowRef();
  10304. const root = vue.shallowRef();
  10305. const scrollContainer = vue.shallowRef();
  10306. const { height: windowHeight } = useWindowSize();
  10307. const {
  10308. height: rootHeight,
  10309. width: rootWidth,
  10310. top: rootTop,
  10311. bottom: rootBottom,
  10312. update: updateRoot
  10313. } = useElementBounding(root, { windowScroll: false });
  10314. const targetRect = useElementBounding(target);
  10315. const fixed = vue.ref(false);
  10316. const scrollTop = vue.ref(0);
  10317. const transform = vue.ref(0);
  10318. const rootStyle = vue.computed(() => {
  10319. return {
  10320. height: fixed.value ? `${rootHeight.value}px` : "",
  10321. width: fixed.value ? `${rootWidth.value}px` : ""
  10322. };
  10323. });
  10324. const affixStyle = vue.computed(() => {
  10325. if (!fixed.value)
  10326. return {};
  10327. const offset = props.offset ? addUnit(props.offset) : 0;
  10328. return {
  10329. height: `${rootHeight.value}px`,
  10330. width: `${rootWidth.value}px`,
  10331. top: props.position === "top" ? offset : "",
  10332. bottom: props.position === "bottom" ? offset : "",
  10333. transform: transform.value ? `translateY(${transform.value}px)` : "",
  10334. zIndex: props.zIndex
  10335. };
  10336. });
  10337. const update = () => {
  10338. if (!scrollContainer.value)
  10339. return;
  10340. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  10341. if (props.position === "top") {
  10342. if (props.target) {
  10343. const difference = targetRect.bottom.value - props.offset - rootHeight.value;
  10344. fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0;
  10345. transform.value = difference < 0 ? difference : 0;
  10346. } else {
  10347. fixed.value = props.offset > rootTop.value;
  10348. }
  10349. } else if (props.target) {
  10350. const difference = windowHeight.value - targetRect.top.value - props.offset - rootHeight.value;
  10351. fixed.value = windowHeight.value - props.offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  10352. transform.value = difference < 0 ? -difference : 0;
  10353. } else {
  10354. fixed.value = windowHeight.value - props.offset < rootBottom.value;
  10355. }
  10356. };
  10357. const handleScroll = () => {
  10358. updateRoot();
  10359. emit("scroll", {
  10360. scrollTop: scrollTop.value,
  10361. fixed: fixed.value
  10362. });
  10363. };
  10364. vue.watch(fixed, (val) => emit("change", val));
  10365. vue.onMounted(() => {
  10366. var _a;
  10367. if (props.target) {
  10368. target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  10369. if (!target.value)
  10370. throwError(COMPONENT_NAME$m, `Target is not existed: ${props.target}`);
  10371. } else {
  10372. target.value = document.documentElement;
  10373. }
  10374. scrollContainer.value = getScrollContainer(root.value, true);
  10375. updateRoot();
  10376. });
  10377. useEventListener(scrollContainer, "scroll", handleScroll);
  10378. vue.watchEffect(update);
  10379. expose({
  10380. update,
  10381. updateRoot
  10382. });
  10383. return (_ctx, _cache) => {
  10384. return vue.openBlock(), vue.createElementBlock("div", {
  10385. ref_key: "root",
  10386. ref: root,
  10387. class: vue.normalizeClass(vue.unref(ns).b()),
  10388. style: vue.normalizeStyle(vue.unref(rootStyle))
  10389. }, [
  10390. vue.createElementVNode("div", {
  10391. class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }),
  10392. style: vue.normalizeStyle(vue.unref(affixStyle))
  10393. }, [
  10394. vue.renderSlot(_ctx.$slots, "default")
  10395. ], 6)
  10396. ], 6);
  10397. };
  10398. }
  10399. });
  10400. var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "affix.vue"]]);
  10401. const ElAffix = withInstall(Affix);
  10402. const iconProps = buildProps({
  10403. size: {
  10404. type: definePropType([Number, String])
  10405. },
  10406. color: {
  10407. type: String
  10408. }
  10409. });
  10410. const __default__$1v = vue.defineComponent({
  10411. name: "ElIcon",
  10412. inheritAttrs: false
  10413. });
  10414. const _sfc_main$2e = /* @__PURE__ */ vue.defineComponent({
  10415. ...__default__$1v,
  10416. props: iconProps,
  10417. setup(__props) {
  10418. const props = __props;
  10419. const ns = useNamespace("icon");
  10420. const style = vue.computed(() => {
  10421. const { size, color } = props;
  10422. if (!size && !color)
  10423. return {};
  10424. return {
  10425. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  10426. "--color": color
  10427. };
  10428. });
  10429. return (_ctx, _cache) => {
  10430. return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({
  10431. class: vue.unref(ns).b(),
  10432. style: vue.unref(style)
  10433. }, _ctx.$attrs), [
  10434. vue.renderSlot(_ctx.$slots, "default")
  10435. ], 16);
  10436. };
  10437. }
  10438. });
  10439. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__file", "icon.vue"]]);
  10440. const ElIcon = withInstall(Icon);
  10441. const alertEffects = ["light", "dark"];
  10442. const alertProps = buildProps({
  10443. title: {
  10444. type: String,
  10445. default: ""
  10446. },
  10447. description: {
  10448. type: String,
  10449. default: ""
  10450. },
  10451. type: {
  10452. type: String,
  10453. values: keysOf(TypeComponentsMap),
  10454. default: "info"
  10455. },
  10456. closable: {
  10457. type: Boolean,
  10458. default: true
  10459. },
  10460. closeText: {
  10461. type: String,
  10462. default: ""
  10463. },
  10464. showIcon: Boolean,
  10465. center: Boolean,
  10466. effect: {
  10467. type: String,
  10468. values: alertEffects,
  10469. default: "light"
  10470. }
  10471. });
  10472. const alertEmits = {
  10473. close: (evt) => evt instanceof MouseEvent
  10474. };
  10475. const __default__$1u = vue.defineComponent({
  10476. name: "ElAlert"
  10477. });
  10478. const _sfc_main$2d = /* @__PURE__ */ vue.defineComponent({
  10479. ...__default__$1u,
  10480. props: alertProps,
  10481. emits: alertEmits,
  10482. setup(__props, { emit }) {
  10483. const props = __props;
  10484. const { Close } = TypeComponents;
  10485. const slots = vue.useSlots();
  10486. const ns = useNamespace("alert");
  10487. const visible = vue.ref(true);
  10488. const iconComponent = vue.computed(() => TypeComponentsMap[props.type]);
  10489. const iconClass = vue.computed(() => [
  10490. ns.e("icon"),
  10491. { [ns.is("big")]: !!props.description || !!slots.default }
  10492. ]);
  10493. const isBoldTitle = vue.computed(() => {
  10494. return { [ns.is("bold")]: props.description || slots.default };
  10495. });
  10496. const close = (evt) => {
  10497. visible.value = false;
  10498. emit("close", evt);
  10499. };
  10500. return (_ctx, _cache) => {
  10501. return vue.openBlock(), vue.createBlock(vue.Transition, {
  10502. name: vue.unref(ns).b("fade"),
  10503. persisted: ""
  10504. }, {
  10505. default: vue.withCtx(() => [
  10506. vue.withDirectives(vue.createElementVNode("div", {
  10507. 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)]),
  10508. role: "alert"
  10509. }, [
  10510. _ctx.showIcon && vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10511. key: 0,
  10512. class: vue.normalizeClass(vue.unref(iconClass))
  10513. }, {
  10514. default: vue.withCtx(() => [
  10515. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  10516. ]),
  10517. _: 1
  10518. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  10519. vue.createElementVNode("div", {
  10520. class: vue.normalizeClass(vue.unref(ns).e("content"))
  10521. }, [
  10522. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  10523. key: 0,
  10524. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(isBoldTitle)])
  10525. }, [
  10526. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  10527. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  10528. ])
  10529. ], 2)) : vue.createCommentVNode("v-if", true),
  10530. _ctx.$slots.default || _ctx.description ? (vue.openBlock(), vue.createElementBlock("p", {
  10531. key: 1,
  10532. class: vue.normalizeClass(vue.unref(ns).e("description"))
  10533. }, [
  10534. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  10535. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  10536. ])
  10537. ], 2)) : vue.createCommentVNode("v-if", true),
  10538. _ctx.closable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  10539. _ctx.closeText ? (vue.openBlock(), vue.createElementBlock("div", {
  10540. key: 0,
  10541. class: vue.normalizeClass([vue.unref(ns).e("close-btn"), vue.unref(ns).is("customed")]),
  10542. onClick: close
  10543. }, vue.toDisplayString(_ctx.closeText), 3)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10544. key: 1,
  10545. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  10546. onClick: close
  10547. }, {
  10548. default: vue.withCtx(() => [
  10549. vue.createVNode(vue.unref(Close))
  10550. ]),
  10551. _: 1
  10552. }, 8, ["class"]))
  10553. ], 64)) : vue.createCommentVNode("v-if", true)
  10554. ], 2)
  10555. ], 2), [
  10556. [vue.vShow, visible.value]
  10557. ])
  10558. ]),
  10559. _: 3
  10560. }, 8, ["name"]);
  10561. };
  10562. }
  10563. });
  10564. var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "alert.vue"]]);
  10565. const ElAlert = withInstall(Alert);
  10566. let hiddenTextarea = void 0;
  10567. const HIDDEN_STYLE = `
  10568. height:0 !important;
  10569. visibility:hidden !important;
  10570. overflow:hidden !important;
  10571. position:absolute !important;
  10572. z-index:-1000 !important;
  10573. top:0 !important;
  10574. right:0 !important;
  10575. `;
  10576. const CONTEXT_STYLE = [
  10577. "letter-spacing",
  10578. "line-height",
  10579. "padding-top",
  10580. "padding-bottom",
  10581. "font-family",
  10582. "font-weight",
  10583. "font-size",
  10584. "text-rendering",
  10585. "text-transform",
  10586. "width",
  10587. "text-indent",
  10588. "padding-left",
  10589. "padding-right",
  10590. "border-width",
  10591. "box-sizing"
  10592. ];
  10593. function calculateNodeStyling(targetElement) {
  10594. const style = window.getComputedStyle(targetElement);
  10595. const boxSizing = style.getPropertyValue("box-sizing");
  10596. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  10597. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  10598. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  10599. return { contextStyle, paddingSize, borderSize, boxSizing };
  10600. }
  10601. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  10602. var _a;
  10603. if (!hiddenTextarea) {
  10604. hiddenTextarea = document.createElement("textarea");
  10605. document.body.appendChild(hiddenTextarea);
  10606. }
  10607. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  10608. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  10609. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  10610. let height = hiddenTextarea.scrollHeight;
  10611. const result = {};
  10612. if (boxSizing === "border-box") {
  10613. height = height + borderSize;
  10614. } else if (boxSizing === "content-box") {
  10615. height = height - paddingSize;
  10616. }
  10617. hiddenTextarea.value = "";
  10618. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  10619. if (isNumber(minRows)) {
  10620. let minHeight = singleRowHeight * minRows;
  10621. if (boxSizing === "border-box") {
  10622. minHeight = minHeight + paddingSize + borderSize;
  10623. }
  10624. height = Math.max(minHeight, height);
  10625. result.minHeight = `${minHeight}px`;
  10626. }
  10627. if (isNumber(maxRows)) {
  10628. let maxHeight = singleRowHeight * maxRows;
  10629. if (boxSizing === "border-box") {
  10630. maxHeight = maxHeight + paddingSize + borderSize;
  10631. }
  10632. height = Math.min(maxHeight, height);
  10633. }
  10634. result.height = `${height}px`;
  10635. (_a = hiddenTextarea.parentNode) == null ? void 0 : _a.removeChild(hiddenTextarea);
  10636. hiddenTextarea = void 0;
  10637. return result;
  10638. }
  10639. const inputProps = buildProps({
  10640. id: {
  10641. type: String,
  10642. default: void 0
  10643. },
  10644. size: useSizeProp,
  10645. disabled: Boolean,
  10646. modelValue: {
  10647. type: definePropType([
  10648. String,
  10649. Number,
  10650. Object
  10651. ]),
  10652. default: ""
  10653. },
  10654. type: {
  10655. type: String,
  10656. default: "text"
  10657. },
  10658. resize: {
  10659. type: String,
  10660. values: ["none", "both", "horizontal", "vertical"]
  10661. },
  10662. autosize: {
  10663. type: definePropType([Boolean, Object]),
  10664. default: false
  10665. },
  10666. autocomplete: {
  10667. type: String,
  10668. default: "off"
  10669. },
  10670. formatter: {
  10671. type: Function
  10672. },
  10673. parser: {
  10674. type: Function
  10675. },
  10676. placeholder: {
  10677. type: String
  10678. },
  10679. form: {
  10680. type: String
  10681. },
  10682. readonly: {
  10683. type: Boolean,
  10684. default: false
  10685. },
  10686. clearable: {
  10687. type: Boolean,
  10688. default: false
  10689. },
  10690. showPassword: {
  10691. type: Boolean,
  10692. default: false
  10693. },
  10694. showWordLimit: {
  10695. type: Boolean,
  10696. default: false
  10697. },
  10698. suffixIcon: {
  10699. type: iconPropType
  10700. },
  10701. prefixIcon: {
  10702. type: iconPropType
  10703. },
  10704. containerRole: {
  10705. type: String,
  10706. default: void 0
  10707. },
  10708. label: {
  10709. type: String,
  10710. default: void 0
  10711. },
  10712. tabindex: {
  10713. type: [String, Number],
  10714. default: 0
  10715. },
  10716. validateEvent: {
  10717. type: Boolean,
  10718. default: true
  10719. },
  10720. inputStyle: {
  10721. type: definePropType([Object, Array, String]),
  10722. default: () => mutable({})
  10723. }
  10724. });
  10725. const inputEmits = {
  10726. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  10727. input: (value) => isString(value),
  10728. change: (value) => isString(value),
  10729. focus: (evt) => evt instanceof FocusEvent,
  10730. blur: (evt) => evt instanceof FocusEvent,
  10731. clear: () => true,
  10732. mouseleave: (evt) => evt instanceof MouseEvent,
  10733. mouseenter: (evt) => evt instanceof MouseEvent,
  10734. keydown: (evt) => evt instanceof Event,
  10735. compositionstart: (evt) => evt instanceof CompositionEvent,
  10736. compositionupdate: (evt) => evt instanceof CompositionEvent,
  10737. compositionend: (evt) => evt instanceof CompositionEvent
  10738. };
  10739. const _hoisted_1$13 = ["role"];
  10740. const _hoisted_2$G = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"];
  10741. const _hoisted_3$k = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"];
  10742. const __default__$1t = vue.defineComponent({
  10743. name: "ElInput",
  10744. inheritAttrs: false
  10745. });
  10746. const _sfc_main$2c = /* @__PURE__ */ vue.defineComponent({
  10747. ...__default__$1t,
  10748. props: inputProps,
  10749. emits: inputEmits,
  10750. setup(__props, { expose, emit }) {
  10751. const props = __props;
  10752. const rawAttrs = vue.useAttrs();
  10753. const slots = vue.useSlots();
  10754. const containerAttrs = vue.computed(() => {
  10755. const comboBoxAttrs = {};
  10756. if (props.containerRole === "combobox") {
  10757. comboBoxAttrs["aria-haspopup"] = rawAttrs["aria-haspopup"];
  10758. comboBoxAttrs["aria-owns"] = rawAttrs["aria-owns"];
  10759. comboBoxAttrs["aria-expanded"] = rawAttrs["aria-expanded"];
  10760. }
  10761. return comboBoxAttrs;
  10762. });
  10763. const containerKls = vue.computed(() => [
  10764. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  10765. nsInput.m(inputSize.value),
  10766. nsInput.is("disabled", inputDisabled.value),
  10767. nsInput.is("exceed", inputExceed.value),
  10768. {
  10769. [nsInput.b("group")]: slots.prepend || slots.append,
  10770. [nsInput.bm("group", "append")]: slots.append,
  10771. [nsInput.bm("group", "prepend")]: slots.prepend,
  10772. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  10773. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  10774. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value
  10775. },
  10776. rawAttrs.class
  10777. ]);
  10778. const wrapperKls = vue.computed(() => [
  10779. nsInput.e("wrapper"),
  10780. nsInput.is("focus", focused.value)
  10781. ]);
  10782. const attrs = useAttrs({
  10783. excludeKeys: vue.computed(() => {
  10784. return Object.keys(containerAttrs.value);
  10785. })
  10786. });
  10787. const { form, formItem } = useFormItem();
  10788. const { inputId } = useFormItemInputId(props, {
  10789. formItemContext: formItem
  10790. });
  10791. const inputSize = useSize();
  10792. const inputDisabled = useDisabled();
  10793. const nsInput = useNamespace("input");
  10794. const nsTextarea = useNamespace("textarea");
  10795. const input = vue.shallowRef();
  10796. const textarea = vue.shallowRef();
  10797. const focused = vue.ref(false);
  10798. const hovering = vue.ref(false);
  10799. const isComposing = vue.ref(false);
  10800. const passwordVisible = vue.ref(false);
  10801. const countStyle = vue.ref();
  10802. const textareaCalcStyle = vue.shallowRef(props.inputStyle);
  10803. const _ref = vue.computed(() => input.value || textarea.value);
  10804. const needStatusIcon = vue.computed(() => {
  10805. var _a;
  10806. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  10807. });
  10808. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  10809. const validateIcon = vue.computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  10810. const passwordIcon = vue.computed(() => passwordVisible.value ? view_default : hide_default);
  10811. const containerStyle = vue.computed(() => [
  10812. rawAttrs.style,
  10813. props.inputStyle
  10814. ]);
  10815. const textareaStyle = vue.computed(() => [
  10816. props.inputStyle,
  10817. textareaCalcStyle.value,
  10818. { resize: props.resize }
  10819. ]);
  10820. const nativeInputValue = vue.computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  10821. const showClear = vue.computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  10822. const showPwdVisible = vue.computed(() => props.showPassword && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (!!nativeInputValue.value || focused.value));
  10823. const isWordLimitVisible = vue.computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  10824. const textLength = vue.computed(() => Array.from(nativeInputValue.value).length);
  10825. const inputExceed = vue.computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  10826. const suffixVisible = vue.computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  10827. const [recordCursor, setCursor] = useCursor(input);
  10828. useResizeObserver(textarea, (entries) => {
  10829. if (!isWordLimitVisible.value || props.resize !== "both")
  10830. return;
  10831. const entry = entries[0];
  10832. const { width } = entry.contentRect;
  10833. countStyle.value = {
  10834. right: `calc(100% - ${width + 15 + 6}px)`
  10835. };
  10836. });
  10837. const resizeTextarea = () => {
  10838. const { type, autosize } = props;
  10839. if (!isClient || type !== "textarea")
  10840. return;
  10841. if (autosize) {
  10842. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  10843. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  10844. textareaCalcStyle.value = {
  10845. ...calcTextareaHeight(textarea.value, minRows, maxRows)
  10846. };
  10847. } else {
  10848. textareaCalcStyle.value = {
  10849. minHeight: calcTextareaHeight(textarea.value).minHeight
  10850. };
  10851. }
  10852. };
  10853. const setNativeInputValue = () => {
  10854. const input2 = _ref.value;
  10855. if (!input2 || input2.value === nativeInputValue.value)
  10856. return;
  10857. input2.value = nativeInputValue.value;
  10858. };
  10859. const handleInput = async (event) => {
  10860. recordCursor();
  10861. let { value } = event.target;
  10862. if (props.formatter) {
  10863. value = props.parser ? props.parser(value) : value;
  10864. value = props.formatter(value);
  10865. }
  10866. if (isComposing.value)
  10867. return;
  10868. if (value === nativeInputValue.value) {
  10869. setNativeInputValue();
  10870. return;
  10871. }
  10872. emit(UPDATE_MODEL_EVENT, value);
  10873. emit("input", value);
  10874. await vue.nextTick();
  10875. setNativeInputValue();
  10876. setCursor();
  10877. };
  10878. const handleChange = (event) => {
  10879. emit("change", event.target.value);
  10880. };
  10881. const handleCompositionStart = (event) => {
  10882. emit("compositionstart", event);
  10883. isComposing.value = true;
  10884. };
  10885. const handleCompositionUpdate = (event) => {
  10886. var _a;
  10887. emit("compositionupdate", event);
  10888. const text = (_a = event.target) == null ? void 0 : _a.value;
  10889. const lastCharacter = text[text.length - 1] || "";
  10890. isComposing.value = !isKorean(lastCharacter);
  10891. };
  10892. const handleCompositionEnd = (event) => {
  10893. emit("compositionend", event);
  10894. if (isComposing.value) {
  10895. isComposing.value = false;
  10896. handleInput(event);
  10897. }
  10898. };
  10899. const handlePasswordVisible = () => {
  10900. passwordVisible.value = !passwordVisible.value;
  10901. focus();
  10902. };
  10903. const focus = async () => {
  10904. var _a;
  10905. await vue.nextTick();
  10906. (_a = _ref.value) == null ? void 0 : _a.focus();
  10907. };
  10908. const blur = () => {
  10909. var _a;
  10910. return (_a = _ref.value) == null ? void 0 : _a.blur();
  10911. };
  10912. const handleFocus = (event) => {
  10913. focused.value = true;
  10914. emit("focus", event);
  10915. };
  10916. const handleBlur = (event) => {
  10917. var _a;
  10918. focused.value = false;
  10919. emit("blur", event);
  10920. if (props.validateEvent) {
  10921. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  10922. }
  10923. };
  10924. const handleMouseLeave = (evt) => {
  10925. hovering.value = false;
  10926. emit("mouseleave", evt);
  10927. };
  10928. const handleMouseEnter = (evt) => {
  10929. hovering.value = true;
  10930. emit("mouseenter", evt);
  10931. };
  10932. const handleKeydown = (evt) => {
  10933. emit("keydown", evt);
  10934. };
  10935. const select = () => {
  10936. var _a;
  10937. (_a = _ref.value) == null ? void 0 : _a.select();
  10938. };
  10939. const clear = () => {
  10940. emit(UPDATE_MODEL_EVENT, "");
  10941. emit("change", "");
  10942. emit("clear");
  10943. emit("input", "");
  10944. };
  10945. vue.watch(() => props.modelValue, () => {
  10946. var _a;
  10947. vue.nextTick(() => resizeTextarea());
  10948. if (props.validateEvent) {
  10949. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  10950. }
  10951. });
  10952. vue.watch(nativeInputValue, () => setNativeInputValue());
  10953. vue.watch(() => props.type, async () => {
  10954. await vue.nextTick();
  10955. setNativeInputValue();
  10956. resizeTextarea();
  10957. });
  10958. vue.onMounted(() => {
  10959. if (!props.formatter && props.parser) ;
  10960. setNativeInputValue();
  10961. vue.nextTick(resizeTextarea);
  10962. });
  10963. expose({
  10964. input,
  10965. textarea,
  10966. ref: _ref,
  10967. textareaStyle,
  10968. autosize: vue.toRef(props, "autosize"),
  10969. focus,
  10970. blur,
  10971. select,
  10972. clear,
  10973. resizeTextarea
  10974. });
  10975. return (_ctx, _cache) => {
  10976. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", vue.mergeProps(vue.unref(containerAttrs), {
  10977. class: vue.unref(containerKls),
  10978. style: vue.unref(containerStyle),
  10979. role: _ctx.containerRole,
  10980. onMouseenter: handleMouseEnter,
  10981. onMouseleave: handleMouseLeave
  10982. }), [
  10983. vue.createCommentVNode(" input "),
  10984. _ctx.type !== "textarea" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  10985. vue.createCommentVNode(" prepend slot "),
  10986. _ctx.$slots.prepend ? (vue.openBlock(), vue.createElementBlock("div", {
  10987. key: 0,
  10988. class: vue.normalizeClass(vue.unref(nsInput).be("group", "prepend"))
  10989. }, [
  10990. vue.renderSlot(_ctx.$slots, "prepend")
  10991. ], 2)) : vue.createCommentVNode("v-if", true),
  10992. vue.createElementVNode("div", {
  10993. class: vue.normalizeClass(vue.unref(wrapperKls))
  10994. }, [
  10995. vue.createCommentVNode(" prefix slot "),
  10996. _ctx.$slots.prefix || _ctx.prefixIcon ? (vue.openBlock(), vue.createElementBlock("span", {
  10997. key: 0,
  10998. class: vue.normalizeClass(vue.unref(nsInput).e("prefix"))
  10999. }, [
  11000. vue.createElementVNode("span", {
  11001. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-inner")),
  11002. onClick: focus
  11003. }, [
  11004. vue.renderSlot(_ctx.$slots, "prefix"),
  11005. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  11006. key: 0,
  11007. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  11008. }, {
  11009. default: vue.withCtx(() => [
  11010. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  11011. ]),
  11012. _: 1
  11013. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  11014. ], 2)
  11015. ], 2)) : vue.createCommentVNode("v-if", true),
  11016. vue.createElementVNode("input", vue.mergeProps({
  11017. id: vue.unref(inputId),
  11018. ref_key: "input",
  11019. ref: input,
  11020. class: vue.unref(nsInput).e("inner")
  11021. }, vue.unref(attrs), {
  11022. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  11023. disabled: vue.unref(inputDisabled),
  11024. formatter: _ctx.formatter,
  11025. parser: _ctx.parser,
  11026. readonly: _ctx.readonly,
  11027. autocomplete: _ctx.autocomplete,
  11028. tabindex: _ctx.tabindex,
  11029. "aria-label": _ctx.label,
  11030. placeholder: _ctx.placeholder,
  11031. style: _ctx.inputStyle,
  11032. form: props.form,
  11033. onCompositionstart: handleCompositionStart,
  11034. onCompositionupdate: handleCompositionUpdate,
  11035. onCompositionend: handleCompositionEnd,
  11036. onInput: handleInput,
  11037. onFocus: handleFocus,
  11038. onBlur: handleBlur,
  11039. onChange: handleChange,
  11040. onKeydown: handleKeydown
  11041. }), null, 16, _hoisted_2$G),
  11042. vue.createCommentVNode(" suffix slot "),
  11043. vue.unref(suffixVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  11044. key: 1,
  11045. class: vue.normalizeClass(vue.unref(nsInput).e("suffix"))
  11046. }, [
  11047. vue.createElementVNode("span", {
  11048. class: vue.normalizeClass(vue.unref(nsInput).e("suffix-inner")),
  11049. onClick: focus
  11050. }, [
  11051. !vue.unref(showClear) || !vue.unref(showPwdVisible) || !vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  11052. vue.renderSlot(_ctx.$slots, "suffix"),
  11053. _ctx.suffixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  11054. key: 0,
  11055. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  11056. }, {
  11057. default: vue.withCtx(() => [
  11058. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.suffixIcon)))
  11059. ]),
  11060. _: 1
  11061. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  11062. ], 64)) : vue.createCommentVNode("v-if", true),
  11063. vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  11064. key: 1,
  11065. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("clear")]),
  11066. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  11067. onClick: clear
  11068. }, {
  11069. default: vue.withCtx(() => [
  11070. vue.createVNode(vue.unref(circle_close_default))
  11071. ]),
  11072. _: 1
  11073. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  11074. vue.unref(showPwdVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  11075. key: 2,
  11076. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("password")]),
  11077. onClick: handlePasswordVisible
  11078. }, {
  11079. default: vue.withCtx(() => [
  11080. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(passwordIcon))))
  11081. ]),
  11082. _: 1
  11083. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  11084. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  11085. key: 3,
  11086. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  11087. }, [
  11088. vue.createElementVNode("span", {
  11089. class: vue.normalizeClass(vue.unref(nsInput).e("count-inner"))
  11090. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(vue.unref(attrs).maxlength), 3)
  11091. ], 2)) : vue.createCommentVNode("v-if", true),
  11092. vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  11093. key: 4,
  11094. class: vue.normalizeClass([
  11095. vue.unref(nsInput).e("icon"),
  11096. vue.unref(nsInput).e("validateIcon"),
  11097. vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating")
  11098. ])
  11099. }, {
  11100. default: vue.withCtx(() => [
  11101. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon))))
  11102. ]),
  11103. _: 1
  11104. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  11105. ], 2)
  11106. ], 2)) : vue.createCommentVNode("v-if", true)
  11107. ], 2),
  11108. vue.createCommentVNode(" append slot "),
  11109. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  11110. key: 1,
  11111. class: vue.normalizeClass(vue.unref(nsInput).be("group", "append"))
  11112. }, [
  11113. vue.renderSlot(_ctx.$slots, "append")
  11114. ], 2)) : vue.createCommentVNode("v-if", true)
  11115. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  11116. vue.createCommentVNode(" textarea "),
  11117. vue.createElementVNode("textarea", vue.mergeProps({
  11118. id: vue.unref(inputId),
  11119. ref_key: "textarea",
  11120. ref: textarea,
  11121. class: vue.unref(nsTextarea).e("inner")
  11122. }, vue.unref(attrs), {
  11123. tabindex: _ctx.tabindex,
  11124. disabled: vue.unref(inputDisabled),
  11125. readonly: _ctx.readonly,
  11126. autocomplete: _ctx.autocomplete,
  11127. style: vue.unref(textareaStyle),
  11128. "aria-label": _ctx.label,
  11129. placeholder: _ctx.placeholder,
  11130. form: props.form,
  11131. onCompositionstart: handleCompositionStart,
  11132. onCompositionupdate: handleCompositionUpdate,
  11133. onCompositionend: handleCompositionEnd,
  11134. onInput: handleInput,
  11135. onFocus: handleFocus,
  11136. onBlur: handleBlur,
  11137. onChange: handleChange,
  11138. onKeydown: handleKeydown
  11139. }), null, 16, _hoisted_3$k),
  11140. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  11141. key: 0,
  11142. style: vue.normalizeStyle(countStyle.value),
  11143. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  11144. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(vue.unref(attrs).maxlength), 7)) : vue.createCommentVNode("v-if", true)
  11145. ], 64))
  11146. ], 16, _hoisted_1$13)), [
  11147. [vue.vShow, _ctx.type !== "hidden"]
  11148. ]);
  11149. };
  11150. }
  11151. });
  11152. var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "input.vue"]]);
  11153. const ElInput = withInstall(Input);
  11154. const GAP = 4;
  11155. const BAR_MAP = {
  11156. vertical: {
  11157. offset: "offsetHeight",
  11158. scroll: "scrollTop",
  11159. scrollSize: "scrollHeight",
  11160. size: "height",
  11161. key: "vertical",
  11162. axis: "Y",
  11163. client: "clientY",
  11164. direction: "top"
  11165. },
  11166. horizontal: {
  11167. offset: "offsetWidth",
  11168. scroll: "scrollLeft",
  11169. scrollSize: "scrollWidth",
  11170. size: "width",
  11171. key: "horizontal",
  11172. axis: "X",
  11173. client: "clientX",
  11174. direction: "left"
  11175. }
  11176. };
  11177. const renderThumbStyle$1 = ({
  11178. move,
  11179. size,
  11180. bar
  11181. }) => ({
  11182. [bar.size]: size,
  11183. transform: `translate${bar.axis}(${move}%)`
  11184. });
  11185. const thumbProps = buildProps({
  11186. vertical: Boolean,
  11187. size: String,
  11188. move: Number,
  11189. ratio: {
  11190. type: Number,
  11191. required: true
  11192. },
  11193. always: Boolean
  11194. });
  11195. const COMPONENT_NAME$l = "Thumb";
  11196. const _sfc_main$2b = /* @__PURE__ */ vue.defineComponent({
  11197. __name: "thumb",
  11198. props: thumbProps,
  11199. setup(__props) {
  11200. const props = __props;
  11201. const scrollbar = vue.inject(scrollbarContextKey);
  11202. const ns = useNamespace("scrollbar");
  11203. if (!scrollbar)
  11204. throwError(COMPONENT_NAME$l, "can not inject scrollbar context");
  11205. const instance = vue.ref();
  11206. const thumb = vue.ref();
  11207. const thumbState = vue.ref({});
  11208. const visible = vue.ref(false);
  11209. let cursorDown = false;
  11210. let cursorLeave = false;
  11211. let originalOnSelectStart = isClient ? document.onselectstart : null;
  11212. const bar = vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  11213. const thumbStyle = vue.computed(() => renderThumbStyle$1({
  11214. size: props.size,
  11215. move: props.move,
  11216. bar: bar.value
  11217. }));
  11218. const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  11219. const clickThumbHandler = (e) => {
  11220. var _a;
  11221. e.stopPropagation();
  11222. if (e.ctrlKey || [1, 2].includes(e.button))
  11223. return;
  11224. (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
  11225. startDrag(e);
  11226. const el = e.currentTarget;
  11227. if (!el)
  11228. return;
  11229. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  11230. };
  11231. const clickTrackHandler = (e) => {
  11232. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  11233. return;
  11234. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  11235. const thumbHalf = thumb.value[bar.value.offset] / 2;
  11236. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  11237. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  11238. };
  11239. const startDrag = (e) => {
  11240. e.stopImmediatePropagation();
  11241. cursorDown = true;
  11242. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  11243. document.addEventListener("mouseup", mouseUpDocumentHandler);
  11244. originalOnSelectStart = document.onselectstart;
  11245. document.onselectstart = () => false;
  11246. };
  11247. const mouseMoveDocumentHandler = (e) => {
  11248. if (!instance.value || !thumb.value)
  11249. return;
  11250. if (cursorDown === false)
  11251. return;
  11252. const prevPage = thumbState.value[bar.value.axis];
  11253. if (!prevPage)
  11254. return;
  11255. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  11256. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  11257. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  11258. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  11259. };
  11260. const mouseUpDocumentHandler = () => {
  11261. cursorDown = false;
  11262. thumbState.value[bar.value.axis] = 0;
  11263. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  11264. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  11265. restoreOnselectstart();
  11266. if (cursorLeave)
  11267. visible.value = false;
  11268. };
  11269. const mouseMoveScrollbarHandler = () => {
  11270. cursorLeave = false;
  11271. visible.value = !!props.size;
  11272. };
  11273. const mouseLeaveScrollbarHandler = () => {
  11274. cursorLeave = true;
  11275. visible.value = cursorDown;
  11276. };
  11277. vue.onBeforeUnmount(() => {
  11278. restoreOnselectstart();
  11279. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  11280. });
  11281. const restoreOnselectstart = () => {
  11282. if (document.onselectstart !== originalOnSelectStart)
  11283. document.onselectstart = originalOnSelectStart;
  11284. };
  11285. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  11286. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  11287. return (_ctx, _cache) => {
  11288. return vue.openBlock(), vue.createBlock(vue.Transition, {
  11289. name: vue.unref(ns).b("fade"),
  11290. persisted: ""
  11291. }, {
  11292. default: vue.withCtx(() => [
  11293. vue.withDirectives(vue.createElementVNode("div", {
  11294. ref_key: "instance",
  11295. ref: instance,
  11296. class: vue.normalizeClass([vue.unref(ns).e("bar"), vue.unref(ns).is(vue.unref(bar).key)]),
  11297. onMousedown: clickTrackHandler
  11298. }, [
  11299. vue.createElementVNode("div", {
  11300. ref_key: "thumb",
  11301. ref: thumb,
  11302. class: vue.normalizeClass(vue.unref(ns).e("thumb")),
  11303. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  11304. onMousedown: clickThumbHandler
  11305. }, null, 38)
  11306. ], 34), [
  11307. [vue.vShow, _ctx.always || visible.value]
  11308. ])
  11309. ]),
  11310. _: 1
  11311. }, 8, ["name"]);
  11312. };
  11313. }
  11314. });
  11315. var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "thumb.vue"]]);
  11316. const barProps = buildProps({
  11317. always: {
  11318. type: Boolean,
  11319. default: true
  11320. },
  11321. width: String,
  11322. height: String,
  11323. ratioX: {
  11324. type: Number,
  11325. default: 1
  11326. },
  11327. ratioY: {
  11328. type: Number,
  11329. default: 1
  11330. }
  11331. });
  11332. const _sfc_main$2a = /* @__PURE__ */ vue.defineComponent({
  11333. __name: "bar",
  11334. props: barProps,
  11335. setup(__props, { expose }) {
  11336. const props = __props;
  11337. const moveX = vue.ref(0);
  11338. const moveY = vue.ref(0);
  11339. const handleScroll = (wrap) => {
  11340. if (wrap) {
  11341. const offsetHeight = wrap.offsetHeight - GAP;
  11342. const offsetWidth = wrap.offsetWidth - GAP;
  11343. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  11344. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  11345. }
  11346. };
  11347. expose({
  11348. handleScroll
  11349. });
  11350. return (_ctx, _cache) => {
  11351. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  11352. vue.createVNode(Thumb, {
  11353. move: moveX.value,
  11354. ratio: _ctx.ratioX,
  11355. size: _ctx.width,
  11356. always: _ctx.always
  11357. }, null, 8, ["move", "ratio", "size", "always"]),
  11358. vue.createVNode(Thumb, {
  11359. move: moveY.value,
  11360. ratio: _ctx.ratioY,
  11361. size: _ctx.height,
  11362. vertical: "",
  11363. always: _ctx.always
  11364. }, null, 8, ["move", "ratio", "size", "always"])
  11365. ], 64);
  11366. };
  11367. }
  11368. });
  11369. var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "bar.vue"]]);
  11370. const scrollbarProps = buildProps({
  11371. height: {
  11372. type: [String, Number],
  11373. default: ""
  11374. },
  11375. maxHeight: {
  11376. type: [String, Number],
  11377. default: ""
  11378. },
  11379. native: {
  11380. type: Boolean,
  11381. default: false
  11382. },
  11383. wrapStyle: {
  11384. type: definePropType([String, Object, Array]),
  11385. default: ""
  11386. },
  11387. wrapClass: {
  11388. type: [String, Array],
  11389. default: ""
  11390. },
  11391. viewClass: {
  11392. type: [String, Array],
  11393. default: ""
  11394. },
  11395. viewStyle: {
  11396. type: [String, Array, Object],
  11397. default: ""
  11398. },
  11399. noresize: Boolean,
  11400. tag: {
  11401. type: String,
  11402. default: "div"
  11403. },
  11404. always: Boolean,
  11405. minSize: {
  11406. type: Number,
  11407. default: 20
  11408. }
  11409. });
  11410. const scrollbarEmits = {
  11411. scroll: ({
  11412. scrollTop,
  11413. scrollLeft
  11414. }) => [scrollTop, scrollLeft].every(isNumber)
  11415. };
  11416. const COMPONENT_NAME$k = "ElScrollbar";
  11417. const __default__$1s = vue.defineComponent({
  11418. name: COMPONENT_NAME$k
  11419. });
  11420. const _sfc_main$29 = /* @__PURE__ */ vue.defineComponent({
  11421. ...__default__$1s,
  11422. props: scrollbarProps,
  11423. emits: scrollbarEmits,
  11424. setup(__props, { expose, emit }) {
  11425. const props = __props;
  11426. const ns = useNamespace("scrollbar");
  11427. let stopResizeObserver = void 0;
  11428. let stopResizeListener = void 0;
  11429. const scrollbarRef = vue.ref();
  11430. const wrapRef = vue.ref();
  11431. const resizeRef = vue.ref();
  11432. const sizeWidth = vue.ref("0");
  11433. const sizeHeight = vue.ref("0");
  11434. const barRef = vue.ref();
  11435. const ratioY = vue.ref(1);
  11436. const ratioX = vue.ref(1);
  11437. const style = vue.computed(() => {
  11438. const style2 = {};
  11439. if (props.height)
  11440. style2.height = addUnit(props.height);
  11441. if (props.maxHeight)
  11442. style2.maxHeight = addUnit(props.maxHeight);
  11443. return [props.wrapStyle, style2];
  11444. });
  11445. const wrapKls = vue.computed(() => {
  11446. return [
  11447. props.wrapClass,
  11448. ns.e("wrap"),
  11449. { [ns.em("wrap", "hidden-default")]: !props.native }
  11450. ];
  11451. });
  11452. const resizeKls = vue.computed(() => {
  11453. return [ns.e("view"), props.viewClass];
  11454. });
  11455. const handleScroll = () => {
  11456. var _a;
  11457. if (wrapRef.value) {
  11458. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  11459. emit("scroll", {
  11460. scrollTop: wrapRef.value.scrollTop,
  11461. scrollLeft: wrapRef.value.scrollLeft
  11462. });
  11463. }
  11464. };
  11465. function scrollTo(arg1, arg2) {
  11466. if (isObject$1(arg1)) {
  11467. wrapRef.value.scrollTo(arg1);
  11468. } else if (isNumber(arg1) && isNumber(arg2)) {
  11469. wrapRef.value.scrollTo(arg1, arg2);
  11470. }
  11471. }
  11472. const setScrollTop = (value) => {
  11473. if (!isNumber(value)) {
  11474. return;
  11475. }
  11476. wrapRef.value.scrollTop = value;
  11477. };
  11478. const setScrollLeft = (value) => {
  11479. if (!isNumber(value)) {
  11480. return;
  11481. }
  11482. wrapRef.value.scrollLeft = value;
  11483. };
  11484. const update = () => {
  11485. if (!wrapRef.value)
  11486. return;
  11487. const offsetHeight = wrapRef.value.offsetHeight - GAP;
  11488. const offsetWidth = wrapRef.value.offsetWidth - GAP;
  11489. const originalHeight = offsetHeight ** 2 / wrapRef.value.scrollHeight;
  11490. const originalWidth = offsetWidth ** 2 / wrapRef.value.scrollWidth;
  11491. const height = Math.max(originalHeight, props.minSize);
  11492. const width = Math.max(originalWidth, props.minSize);
  11493. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  11494. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  11495. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  11496. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  11497. };
  11498. vue.watch(() => props.noresize, (noresize) => {
  11499. if (noresize) {
  11500. stopResizeObserver == null ? void 0 : stopResizeObserver();
  11501. stopResizeListener == null ? void 0 : stopResizeListener();
  11502. } else {
  11503. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  11504. stopResizeListener = useEventListener("resize", update);
  11505. }
  11506. }, { immediate: true });
  11507. vue.watch(() => [props.maxHeight, props.height], () => {
  11508. if (!props.native)
  11509. vue.nextTick(() => {
  11510. var _a;
  11511. update();
  11512. if (wrapRef.value) {
  11513. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  11514. }
  11515. });
  11516. });
  11517. vue.provide(scrollbarContextKey, vue.reactive({
  11518. scrollbarElement: scrollbarRef,
  11519. wrapElement: wrapRef
  11520. }));
  11521. vue.onMounted(() => {
  11522. if (!props.native)
  11523. vue.nextTick(() => {
  11524. update();
  11525. });
  11526. });
  11527. vue.onUpdated(() => update());
  11528. expose({
  11529. wrapRef,
  11530. update,
  11531. scrollTo,
  11532. setScrollTop,
  11533. setScrollLeft,
  11534. handleScroll
  11535. });
  11536. return (_ctx, _cache) => {
  11537. return vue.openBlock(), vue.createElementBlock("div", {
  11538. ref_key: "scrollbarRef",
  11539. ref: scrollbarRef,
  11540. class: vue.normalizeClass(vue.unref(ns).b())
  11541. }, [
  11542. vue.createElementVNode("div", {
  11543. ref_key: "wrapRef",
  11544. ref: wrapRef,
  11545. class: vue.normalizeClass(vue.unref(wrapKls)),
  11546. style: vue.normalizeStyle(vue.unref(style)),
  11547. onScroll: handleScroll
  11548. }, [
  11549. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  11550. ref_key: "resizeRef",
  11551. ref: resizeRef,
  11552. class: vue.normalizeClass(vue.unref(resizeKls)),
  11553. style: vue.normalizeStyle(_ctx.viewStyle)
  11554. }, {
  11555. default: vue.withCtx(() => [
  11556. vue.renderSlot(_ctx.$slots, "default")
  11557. ]),
  11558. _: 3
  11559. }, 8, ["class", "style"]))
  11560. ], 38),
  11561. !_ctx.native ? (vue.openBlock(), vue.createBlock(Bar, {
  11562. key: 0,
  11563. ref_key: "barRef",
  11564. ref: barRef,
  11565. height: sizeHeight.value,
  11566. width: sizeWidth.value,
  11567. always: _ctx.always,
  11568. "ratio-x": ratioX.value,
  11569. "ratio-y": ratioY.value
  11570. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : vue.createCommentVNode("v-if", true)
  11571. ], 2);
  11572. };
  11573. }
  11574. });
  11575. var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "scrollbar.vue"]]);
  11576. const ElScrollbar = withInstall(Scrollbar$1);
  11577. const Effect = {
  11578. LIGHT: "light",
  11579. DARK: "dark"
  11580. };
  11581. const roleTypes = [
  11582. "dialog",
  11583. "grid",
  11584. "group",
  11585. "listbox",
  11586. "menu",
  11587. "navigation",
  11588. "tooltip",
  11589. "tree"
  11590. ];
  11591. const popperProps = buildProps({
  11592. role: {
  11593. type: String,
  11594. values: roleTypes,
  11595. default: "tooltip"
  11596. }
  11597. });
  11598. const usePopperProps = popperProps;
  11599. const __default__$1r = vue.defineComponent({
  11600. name: "ElPopperRoot",
  11601. inheritAttrs: false
  11602. });
  11603. const _sfc_main$28 = /* @__PURE__ */ vue.defineComponent({
  11604. ...__default__$1r,
  11605. props: popperProps,
  11606. setup(__props, { expose }) {
  11607. const props = __props;
  11608. const triggerRef = vue.ref();
  11609. const popperInstanceRef = vue.ref();
  11610. const contentRef = vue.ref();
  11611. const referenceRef = vue.ref();
  11612. const role = vue.computed(() => props.role);
  11613. const popperProvides = {
  11614. triggerRef,
  11615. popperInstanceRef,
  11616. contentRef,
  11617. referenceRef,
  11618. role
  11619. };
  11620. expose(popperProvides);
  11621. vue.provide(POPPER_INJECTION_KEY, popperProvides);
  11622. return (_ctx, _cache) => {
  11623. return vue.renderSlot(_ctx.$slots, "default");
  11624. };
  11625. }
  11626. });
  11627. var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "popper.vue"]]);
  11628. const popperArrowProps = buildProps({
  11629. arrowOffset: {
  11630. type: Number,
  11631. default: 5
  11632. }
  11633. });
  11634. const usePopperArrowProps = popperArrowProps;
  11635. const __default__$1q = vue.defineComponent({
  11636. name: "ElPopperArrow",
  11637. inheritAttrs: false
  11638. });
  11639. const _sfc_main$27 = /* @__PURE__ */ vue.defineComponent({
  11640. ...__default__$1q,
  11641. props: popperArrowProps,
  11642. setup(__props, { expose }) {
  11643. const props = __props;
  11644. const ns = useNamespace("popper");
  11645. const { arrowOffset, arrowRef } = vue.inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  11646. vue.watch(() => props.arrowOffset, (val) => {
  11647. arrowOffset.value = val;
  11648. });
  11649. vue.onBeforeUnmount(() => {
  11650. arrowRef.value = void 0;
  11651. });
  11652. expose({
  11653. arrowRef
  11654. });
  11655. return (_ctx, _cache) => {
  11656. return vue.openBlock(), vue.createElementBlock("span", {
  11657. ref_key: "arrowRef",
  11658. ref: arrowRef,
  11659. class: vue.normalizeClass(vue.unref(ns).e("arrow")),
  11660. "data-popper-arrow": ""
  11661. }, null, 2);
  11662. };
  11663. }
  11664. });
  11665. var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "arrow.vue"]]);
  11666. const NAME = "ElOnlyChild";
  11667. const OnlyChild = vue.defineComponent({
  11668. name: NAME,
  11669. setup(_, {
  11670. slots,
  11671. attrs
  11672. }) {
  11673. var _a;
  11674. const forwardRefInjection = vue.inject(FORWARD_REF_INJECTION_KEY);
  11675. const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
  11676. return () => {
  11677. var _a2;
  11678. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
  11679. if (!defaultSlot)
  11680. return null;
  11681. if (defaultSlot.length > 1) {
  11682. return null;
  11683. }
  11684. const firstLegitNode = findFirstLegitChild(defaultSlot);
  11685. if (!firstLegitNode) {
  11686. return null;
  11687. }
  11688. return vue.withDirectives(vue.cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  11689. };
  11690. }
  11691. });
  11692. function findFirstLegitChild(node) {
  11693. if (!node)
  11694. return null;
  11695. const children = node;
  11696. for (const child of children) {
  11697. if (isObject$1(child)) {
  11698. switch (child.type) {
  11699. case vue.Comment:
  11700. continue;
  11701. case vue.Text:
  11702. case "svg":
  11703. return wrapTextContent(child);
  11704. case vue.Fragment:
  11705. return findFirstLegitChild(child.children);
  11706. default:
  11707. return child;
  11708. }
  11709. }
  11710. return wrapTextContent(child);
  11711. }
  11712. return null;
  11713. }
  11714. function wrapTextContent(s) {
  11715. const ns = useNamespace("only-child");
  11716. return vue.createVNode("span", {
  11717. "class": ns.e("content")
  11718. }, [s]);
  11719. }
  11720. const popperTriggerProps = buildProps({
  11721. virtualRef: {
  11722. type: definePropType(Object)
  11723. },
  11724. virtualTriggering: Boolean,
  11725. onMouseenter: {
  11726. type: definePropType(Function)
  11727. },
  11728. onMouseleave: {
  11729. type: definePropType(Function)
  11730. },
  11731. onClick: {
  11732. type: definePropType(Function)
  11733. },
  11734. onKeydown: {
  11735. type: definePropType(Function)
  11736. },
  11737. onFocus: {
  11738. type: definePropType(Function)
  11739. },
  11740. onBlur: {
  11741. type: definePropType(Function)
  11742. },
  11743. onContextmenu: {
  11744. type: definePropType(Function)
  11745. },
  11746. id: String,
  11747. open: Boolean
  11748. });
  11749. const usePopperTriggerProps = popperTriggerProps;
  11750. const __default__$1p = vue.defineComponent({
  11751. name: "ElPopperTrigger",
  11752. inheritAttrs: false
  11753. });
  11754. const _sfc_main$26 = /* @__PURE__ */ vue.defineComponent({
  11755. ...__default__$1p,
  11756. props: popperTriggerProps,
  11757. setup(__props, { expose }) {
  11758. const props = __props;
  11759. const { role, triggerRef } = vue.inject(POPPER_INJECTION_KEY, void 0);
  11760. useForwardRef(triggerRef);
  11761. const ariaControls = vue.computed(() => {
  11762. return ariaHaspopup.value ? props.id : void 0;
  11763. });
  11764. const ariaDescribedby = vue.computed(() => {
  11765. if (role && role.value === "tooltip") {
  11766. return props.open && props.id ? props.id : void 0;
  11767. }
  11768. return void 0;
  11769. });
  11770. const ariaHaspopup = vue.computed(() => {
  11771. if (role && role.value !== "tooltip") {
  11772. return role.value;
  11773. }
  11774. return void 0;
  11775. });
  11776. const ariaExpanded = vue.computed(() => {
  11777. return ariaHaspopup.value ? `${props.open}` : void 0;
  11778. });
  11779. let virtualTriggerAriaStopWatch = void 0;
  11780. vue.onMounted(() => {
  11781. vue.watch(() => props.virtualRef, (virtualEl) => {
  11782. if (virtualEl) {
  11783. triggerRef.value = unrefElement(virtualEl);
  11784. }
  11785. }, {
  11786. immediate: true
  11787. });
  11788. vue.watch(triggerRef, (el, prevEl) => {
  11789. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  11790. virtualTriggerAriaStopWatch = void 0;
  11791. if (isElement$1(el)) {
  11792. [
  11793. "onMouseenter",
  11794. "onMouseleave",
  11795. "onClick",
  11796. "onKeydown",
  11797. "onFocus",
  11798. "onBlur",
  11799. "onContextmenu"
  11800. ].forEach((eventName) => {
  11801. var _a;
  11802. const handler = props[eventName];
  11803. if (handler) {
  11804. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  11805. (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  11806. }
  11807. });
  11808. virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  11809. [
  11810. "aria-controls",
  11811. "aria-describedby",
  11812. "aria-haspopup",
  11813. "aria-expanded"
  11814. ].forEach((key, idx) => {
  11815. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  11816. });
  11817. }, { immediate: true });
  11818. }
  11819. if (isElement$1(prevEl)) {
  11820. [
  11821. "aria-controls",
  11822. "aria-describedby",
  11823. "aria-haspopup",
  11824. "aria-expanded"
  11825. ].forEach((key) => prevEl.removeAttribute(key));
  11826. }
  11827. }, {
  11828. immediate: true
  11829. });
  11830. });
  11831. vue.onBeforeUnmount(() => {
  11832. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  11833. virtualTriggerAriaStopWatch = void 0;
  11834. });
  11835. expose({
  11836. triggerRef
  11837. });
  11838. return (_ctx, _cache) => {
  11839. return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
  11840. "aria-controls": vue.unref(ariaControls),
  11841. "aria-describedby": vue.unref(ariaDescribedby),
  11842. "aria-expanded": vue.unref(ariaExpanded),
  11843. "aria-haspopup": vue.unref(ariaHaspopup)
  11844. }), {
  11845. default: vue.withCtx(() => [
  11846. vue.renderSlot(_ctx.$slots, "default")
  11847. ]),
  11848. _: 3
  11849. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true);
  11850. };
  11851. }
  11852. });
  11853. var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["__file", "trigger.vue"]]);
  11854. 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});
  11855. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  11856. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  11857. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  11858. const FOCUS_AFTER_TRAPPED_OPTS = {
  11859. cancelable: true,
  11860. bubbles: false
  11861. };
  11862. const FOCUSOUT_PREVENTED_OPTS = {
  11863. cancelable: true,
  11864. bubbles: false
  11865. };
  11866. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  11867. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  11868. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  11869. const focusReason = vue.ref();
  11870. const lastUserFocusTimestamp = vue.ref(0);
  11871. const lastAutomatedFocusTimestamp = vue.ref(0);
  11872. let focusReasonUserCount = 0;
  11873. const obtainAllFocusableElements = (element) => {
  11874. const nodes = [];
  11875. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  11876. acceptNode: (node) => {
  11877. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  11878. if (node.disabled || node.hidden || isHiddenInput)
  11879. return NodeFilter.FILTER_SKIP;
  11880. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  11881. }
  11882. });
  11883. while (walker.nextNode())
  11884. nodes.push(walker.currentNode);
  11885. return nodes;
  11886. };
  11887. const getVisibleElement = (elements, container) => {
  11888. for (const element of elements) {
  11889. if (!isHidden(element, container))
  11890. return element;
  11891. }
  11892. };
  11893. const isHidden = (element, container) => {
  11894. if (getComputedStyle(element).visibility === "hidden")
  11895. return true;
  11896. while (element) {
  11897. if (container && element === container)
  11898. return false;
  11899. if (getComputedStyle(element).display === "none")
  11900. return true;
  11901. element = element.parentElement;
  11902. }
  11903. return false;
  11904. };
  11905. const getEdges = (container) => {
  11906. const focusable = obtainAllFocusableElements(container);
  11907. const first = getVisibleElement(focusable, container);
  11908. const last = getVisibleElement(focusable.reverse(), container);
  11909. return [first, last];
  11910. };
  11911. const isSelectable = (element) => {
  11912. return element instanceof HTMLInputElement && "select" in element;
  11913. };
  11914. const tryFocus = (element, shouldSelect) => {
  11915. if (element && element.focus) {
  11916. const prevFocusedElement = document.activeElement;
  11917. element.focus({ preventScroll: true });
  11918. lastAutomatedFocusTimestamp.value = window.performance.now();
  11919. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  11920. if (element.tagName === "INPUT") {
  11921. element.setSelectionRange(element.value.length, element.value.length);
  11922. return;
  11923. }
  11924. element.select();
  11925. }
  11926. }
  11927. };
  11928. function removeFromStack(list, item) {
  11929. const copy = [...list];
  11930. const idx = list.indexOf(item);
  11931. if (idx !== -1) {
  11932. copy.splice(idx, 1);
  11933. }
  11934. return copy;
  11935. }
  11936. const createFocusableStack = () => {
  11937. let stack = [];
  11938. const push = (layer) => {
  11939. const currentLayer = stack[0];
  11940. if (currentLayer && layer !== currentLayer) {
  11941. currentLayer.pause();
  11942. }
  11943. stack = removeFromStack(stack, layer);
  11944. stack.unshift(layer);
  11945. };
  11946. const remove = (layer) => {
  11947. var _a, _b;
  11948. stack = removeFromStack(stack, layer);
  11949. (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
  11950. };
  11951. return {
  11952. push,
  11953. remove
  11954. };
  11955. };
  11956. const focusFirstDescendant = (elements, shouldSelect = false) => {
  11957. const prevFocusedElement = document.activeElement;
  11958. for (const element of elements) {
  11959. tryFocus(element, shouldSelect);
  11960. if (document.activeElement !== prevFocusedElement)
  11961. return;
  11962. }
  11963. };
  11964. const focusableStack = createFocusableStack();
  11965. const isFocusCausedByUserEvent = () => {
  11966. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  11967. };
  11968. const notifyFocusReasonPointer = () => {
  11969. focusReason.value = "pointer";
  11970. lastUserFocusTimestamp.value = window.performance.now();
  11971. };
  11972. const notifyFocusReasonKeydown = () => {
  11973. focusReason.value = "keyboard";
  11974. lastUserFocusTimestamp.value = window.performance.now();
  11975. };
  11976. const useFocusReason = () => {
  11977. vue.onMounted(() => {
  11978. if (focusReasonUserCount === 0) {
  11979. document.addEventListener("mousedown", notifyFocusReasonPointer);
  11980. document.addEventListener("touchstart", notifyFocusReasonPointer);
  11981. document.addEventListener("keydown", notifyFocusReasonKeydown);
  11982. }
  11983. focusReasonUserCount++;
  11984. });
  11985. vue.onBeforeUnmount(() => {
  11986. focusReasonUserCount--;
  11987. if (focusReasonUserCount <= 0) {
  11988. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  11989. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  11990. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  11991. }
  11992. });
  11993. return {
  11994. focusReason,
  11995. lastUserFocusTimestamp,
  11996. lastAutomatedFocusTimestamp
  11997. };
  11998. };
  11999. const createFocusOutPreventedEvent = (detail) => {
  12000. return new CustomEvent(FOCUSOUT_PREVENTED, {
  12001. ...FOCUSOUT_PREVENTED_OPTS,
  12002. detail
  12003. });
  12004. };
  12005. const _sfc_main$25 = vue.defineComponent({
  12006. name: "ElFocusTrap",
  12007. inheritAttrs: false,
  12008. props: {
  12009. loop: Boolean,
  12010. trapped: Boolean,
  12011. focusTrapEl: Object,
  12012. focusStartEl: {
  12013. type: [Object, String],
  12014. default: "first"
  12015. }
  12016. },
  12017. emits: [
  12018. ON_TRAP_FOCUS_EVT,
  12019. ON_RELEASE_FOCUS_EVT,
  12020. "focusin",
  12021. "focusout",
  12022. "focusout-prevented",
  12023. "release-requested"
  12024. ],
  12025. setup(props, { emit }) {
  12026. const forwardRef = vue.ref();
  12027. let lastFocusBeforeTrapped;
  12028. let lastFocusAfterTrapped;
  12029. const { focusReason } = useFocusReason();
  12030. useEscapeKeydown((event) => {
  12031. if (props.trapped && !focusLayer.paused) {
  12032. emit("release-requested", event);
  12033. }
  12034. });
  12035. const focusLayer = {
  12036. paused: false,
  12037. pause() {
  12038. this.paused = true;
  12039. },
  12040. resume() {
  12041. this.paused = false;
  12042. }
  12043. };
  12044. const onKeydown = (e) => {
  12045. if (!props.loop && !props.trapped)
  12046. return;
  12047. if (focusLayer.paused)
  12048. return;
  12049. const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  12050. const { loop } = props;
  12051. const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  12052. const currentFocusingEl = document.activeElement;
  12053. if (isTabbing && currentFocusingEl) {
  12054. const container = currentTarget;
  12055. const [first, last] = getEdges(container);
  12056. const isTabbable = first && last;
  12057. if (!isTabbable) {
  12058. if (currentFocusingEl === container) {
  12059. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  12060. focusReason: focusReason.value
  12061. });
  12062. emit("focusout-prevented", focusoutPreventedEvent);
  12063. if (!focusoutPreventedEvent.defaultPrevented) {
  12064. e.preventDefault();
  12065. }
  12066. }
  12067. } else {
  12068. if (!shiftKey && currentFocusingEl === last) {
  12069. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  12070. focusReason: focusReason.value
  12071. });
  12072. emit("focusout-prevented", focusoutPreventedEvent);
  12073. if (!focusoutPreventedEvent.defaultPrevented) {
  12074. e.preventDefault();
  12075. if (loop)
  12076. tryFocus(first, true);
  12077. }
  12078. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  12079. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  12080. focusReason: focusReason.value
  12081. });
  12082. emit("focusout-prevented", focusoutPreventedEvent);
  12083. if (!focusoutPreventedEvent.defaultPrevented) {
  12084. e.preventDefault();
  12085. if (loop)
  12086. tryFocus(last, true);
  12087. }
  12088. }
  12089. }
  12090. }
  12091. };
  12092. vue.provide(FOCUS_TRAP_INJECTION_KEY, {
  12093. focusTrapRef: forwardRef,
  12094. onKeydown
  12095. });
  12096. vue.watch(() => props.focusTrapEl, (focusTrapEl) => {
  12097. if (focusTrapEl) {
  12098. forwardRef.value = focusTrapEl;
  12099. }
  12100. }, { immediate: true });
  12101. vue.watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  12102. if (forwardRef2) {
  12103. forwardRef2.addEventListener("keydown", onKeydown);
  12104. forwardRef2.addEventListener("focusin", onFocusIn);
  12105. forwardRef2.addEventListener("focusout", onFocusOut);
  12106. }
  12107. if (oldForwardRef) {
  12108. oldForwardRef.removeEventListener("keydown", onKeydown);
  12109. oldForwardRef.removeEventListener("focusin", onFocusIn);
  12110. oldForwardRef.removeEventListener("focusout", onFocusOut);
  12111. }
  12112. });
  12113. const trapOnFocus = (e) => {
  12114. emit(ON_TRAP_FOCUS_EVT, e);
  12115. };
  12116. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  12117. const onFocusIn = (e) => {
  12118. const trapContainer = vue.unref(forwardRef);
  12119. if (!trapContainer)
  12120. return;
  12121. const target = e.target;
  12122. const relatedTarget = e.relatedTarget;
  12123. const isFocusedInTrap = target && trapContainer.contains(target);
  12124. if (!props.trapped) {
  12125. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  12126. if (!isPrevFocusedInTrap) {
  12127. lastFocusBeforeTrapped = relatedTarget;
  12128. }
  12129. }
  12130. if (isFocusedInTrap)
  12131. emit("focusin", e);
  12132. if (focusLayer.paused)
  12133. return;
  12134. if (props.trapped) {
  12135. if (isFocusedInTrap) {
  12136. lastFocusAfterTrapped = target;
  12137. } else {
  12138. tryFocus(lastFocusAfterTrapped, true);
  12139. }
  12140. }
  12141. };
  12142. const onFocusOut = (e) => {
  12143. const trapContainer = vue.unref(forwardRef);
  12144. if (focusLayer.paused || !trapContainer)
  12145. return;
  12146. if (props.trapped) {
  12147. const relatedTarget = e.relatedTarget;
  12148. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  12149. setTimeout(() => {
  12150. if (!focusLayer.paused && props.trapped) {
  12151. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  12152. focusReason: focusReason.value
  12153. });
  12154. emit("focusout-prevented", focusoutPreventedEvent);
  12155. if (!focusoutPreventedEvent.defaultPrevented) {
  12156. tryFocus(lastFocusAfterTrapped, true);
  12157. }
  12158. }
  12159. }, 0);
  12160. }
  12161. } else {
  12162. const target = e.target;
  12163. const isFocusedInTrap = target && trapContainer.contains(target);
  12164. if (!isFocusedInTrap)
  12165. emit("focusout", e);
  12166. }
  12167. };
  12168. async function startTrap() {
  12169. await vue.nextTick();
  12170. const trapContainer = vue.unref(forwardRef);
  12171. if (trapContainer) {
  12172. focusableStack.push(focusLayer);
  12173. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  12174. lastFocusBeforeTrapped = prevFocusedElement;
  12175. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  12176. if (!isPrevFocusContained) {
  12177. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  12178. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  12179. trapContainer.dispatchEvent(focusEvent);
  12180. if (!focusEvent.defaultPrevented) {
  12181. vue.nextTick(() => {
  12182. let focusStartEl = props.focusStartEl;
  12183. if (!isString(focusStartEl)) {
  12184. tryFocus(focusStartEl);
  12185. if (document.activeElement !== focusStartEl) {
  12186. focusStartEl = "first";
  12187. }
  12188. }
  12189. if (focusStartEl === "first") {
  12190. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  12191. }
  12192. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  12193. tryFocus(trapContainer);
  12194. }
  12195. });
  12196. }
  12197. }
  12198. }
  12199. }
  12200. function stopTrap() {
  12201. const trapContainer = vue.unref(forwardRef);
  12202. if (trapContainer) {
  12203. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  12204. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  12205. ...FOCUS_AFTER_TRAPPED_OPTS,
  12206. detail: {
  12207. focusReason: focusReason.value
  12208. }
  12209. });
  12210. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  12211. trapContainer.dispatchEvent(releasedEvent);
  12212. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent())) {
  12213. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body, true);
  12214. }
  12215. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, trapOnFocus);
  12216. focusableStack.remove(focusLayer);
  12217. }
  12218. }
  12219. vue.onMounted(() => {
  12220. if (props.trapped) {
  12221. startTrap();
  12222. }
  12223. vue.watch(() => props.trapped, (trapped) => {
  12224. if (trapped) {
  12225. startTrap();
  12226. } else {
  12227. stopTrap();
  12228. }
  12229. });
  12230. });
  12231. vue.onBeforeUnmount(() => {
  12232. if (props.trapped) {
  12233. stopTrap();
  12234. }
  12235. });
  12236. return {
  12237. onKeydown
  12238. };
  12239. }
  12240. });
  12241. function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
  12242. return vue.renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  12243. }
  12244. var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["render", _sfc_render$y], ["__file", "focus-trap.vue"]]);
  12245. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  12246. const popperCoreConfigProps = buildProps({
  12247. boundariesPadding: {
  12248. type: Number,
  12249. default: 0
  12250. },
  12251. fallbackPlacements: {
  12252. type: definePropType(Array),
  12253. default: void 0
  12254. },
  12255. gpuAcceleration: {
  12256. type: Boolean,
  12257. default: true
  12258. },
  12259. offset: {
  12260. type: Number,
  12261. default: 12
  12262. },
  12263. placement: {
  12264. type: String,
  12265. values: Ee,
  12266. default: "bottom"
  12267. },
  12268. popperOptions: {
  12269. type: definePropType(Object),
  12270. default: () => ({})
  12271. },
  12272. strategy: {
  12273. type: String,
  12274. values: POSITIONING_STRATEGIES,
  12275. default: "absolute"
  12276. }
  12277. });
  12278. const popperContentProps = buildProps({
  12279. ...popperCoreConfigProps,
  12280. id: String,
  12281. style: {
  12282. type: definePropType([String, Array, Object])
  12283. },
  12284. className: {
  12285. type: definePropType([String, Array, Object])
  12286. },
  12287. effect: {
  12288. type: String,
  12289. default: "dark"
  12290. },
  12291. visible: Boolean,
  12292. enterable: {
  12293. type: Boolean,
  12294. default: true
  12295. },
  12296. pure: Boolean,
  12297. focusOnShow: {
  12298. type: Boolean,
  12299. default: false
  12300. },
  12301. trapping: {
  12302. type: Boolean,
  12303. default: false
  12304. },
  12305. popperClass: {
  12306. type: definePropType([String, Array, Object])
  12307. },
  12308. popperStyle: {
  12309. type: definePropType([String, Array, Object])
  12310. },
  12311. referenceEl: {
  12312. type: definePropType(Object)
  12313. },
  12314. triggerTargetEl: {
  12315. type: definePropType(Object)
  12316. },
  12317. stopPopperMouseEvent: {
  12318. type: Boolean,
  12319. default: true
  12320. },
  12321. ariaLabel: {
  12322. type: String,
  12323. default: void 0
  12324. },
  12325. virtualTriggering: Boolean,
  12326. zIndex: Number
  12327. });
  12328. const popperContentEmits = {
  12329. mouseenter: (evt) => evt instanceof MouseEvent,
  12330. mouseleave: (evt) => evt instanceof MouseEvent,
  12331. focus: () => true,
  12332. blur: () => true,
  12333. close: () => true
  12334. };
  12335. const usePopperCoreConfigProps = popperCoreConfigProps;
  12336. const usePopperContentProps = popperContentProps;
  12337. const usePopperContentEmits = popperContentEmits;
  12338. const buildPopperOptions = (props, arrowProps) => {
  12339. const { placement, strategy, popperOptions } = props;
  12340. const options = {
  12341. placement,
  12342. strategy,
  12343. ...popperOptions,
  12344. modifiers: genModifiers(props)
  12345. };
  12346. attachArrow(options, arrowProps);
  12347. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  12348. return options;
  12349. };
  12350. const unwrapMeasurableEl = ($el) => {
  12351. if (!isClient)
  12352. return;
  12353. return unrefElement($el);
  12354. };
  12355. function genModifiers(options) {
  12356. const { offset, gpuAcceleration, fallbackPlacements } = options;
  12357. return [
  12358. {
  12359. name: "offset",
  12360. options: {
  12361. offset: [0, offset != null ? offset : 12]
  12362. }
  12363. },
  12364. {
  12365. name: "preventOverflow",
  12366. options: {
  12367. padding: {
  12368. top: 2,
  12369. bottom: 2,
  12370. left: 5,
  12371. right: 5
  12372. }
  12373. }
  12374. },
  12375. {
  12376. name: "flip",
  12377. options: {
  12378. padding: 5,
  12379. fallbackPlacements
  12380. }
  12381. },
  12382. {
  12383. name: "computeStyles",
  12384. options: {
  12385. gpuAcceleration
  12386. }
  12387. }
  12388. ];
  12389. }
  12390. function attachArrow(options, { arrowEl, arrowOffset }) {
  12391. options.modifiers.push({
  12392. name: "arrow",
  12393. options: {
  12394. element: arrowEl,
  12395. padding: arrowOffset != null ? arrowOffset : 5
  12396. }
  12397. });
  12398. }
  12399. function deriveExtraModifiers(options, modifiers) {
  12400. if (modifiers) {
  12401. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  12402. }
  12403. }
  12404. const __default__$1o = vue.defineComponent({
  12405. name: "ElPopperContent"
  12406. });
  12407. const _sfc_main$24 = /* @__PURE__ */ vue.defineComponent({
  12408. ...__default__$1o,
  12409. props: popperContentProps,
  12410. emits: popperContentEmits,
  12411. setup(__props, { expose, emit }) {
  12412. const props = __props;
  12413. const { popperInstanceRef, contentRef, triggerRef, role } = vue.inject(POPPER_INJECTION_KEY, void 0);
  12414. const formItemContext = vue.inject(formItemContextKey, void 0);
  12415. const { nextZIndex } = useZIndex();
  12416. const ns = useNamespace("popper");
  12417. const popperContentRef = vue.ref();
  12418. const focusStartRef = vue.ref("first");
  12419. const arrowRef = vue.ref();
  12420. const arrowOffset = vue.ref();
  12421. vue.provide(POPPER_CONTENT_INJECTION_KEY, {
  12422. arrowRef,
  12423. arrowOffset
  12424. });
  12425. if (formItemContext && (formItemContext.addInputId || formItemContext.removeInputId)) {
  12426. vue.provide(formItemContextKey, {
  12427. ...formItemContext,
  12428. addInputId: NOOP,
  12429. removeInputId: NOOP
  12430. });
  12431. }
  12432. const contentZIndex = vue.ref(props.zIndex || nextZIndex());
  12433. const trapped = vue.ref(false);
  12434. let triggerTargetAriaStopWatch = void 0;
  12435. const computedReference = vue.computed(() => unwrapMeasurableEl(props.referenceEl) || vue.unref(triggerRef));
  12436. const contentStyle = vue.computed(() => [{ zIndex: vue.unref(contentZIndex) }, props.popperStyle]);
  12437. const contentClass = vue.computed(() => [
  12438. ns.b(),
  12439. ns.is("pure", props.pure),
  12440. ns.is(props.effect),
  12441. props.popperClass
  12442. ]);
  12443. const ariaModal = vue.computed(() => {
  12444. return role && role.value === "dialog" ? "false" : void 0;
  12445. });
  12446. const createPopperInstance = ({
  12447. referenceEl,
  12448. popperContentEl,
  12449. arrowEl
  12450. }) => {
  12451. const options = buildPopperOptions(props, {
  12452. arrowEl,
  12453. arrowOffset: vue.unref(arrowOffset)
  12454. });
  12455. return yn(referenceEl, popperContentEl, options);
  12456. };
  12457. const updatePopper = (shouldUpdateZIndex = true) => {
  12458. var _a;
  12459. (_a = vue.unref(popperInstanceRef)) == null ? void 0 : _a.update();
  12460. shouldUpdateZIndex && (contentZIndex.value = props.zIndex || nextZIndex());
  12461. };
  12462. const togglePopperAlive = () => {
  12463. var _a, _b;
  12464. const monitorable = { name: "eventListeners", enabled: props.visible };
  12465. (_b = (_a = vue.unref(popperInstanceRef)) == null ? void 0 : _a.setOptions) == null ? void 0 : _b.call(_a, (options) => ({
  12466. ...options,
  12467. modifiers: [...options.modifiers || [], monitorable]
  12468. }));
  12469. updatePopper(false);
  12470. if (props.visible && props.focusOnShow) {
  12471. trapped.value = true;
  12472. } else if (props.visible === false) {
  12473. trapped.value = false;
  12474. }
  12475. };
  12476. const onFocusAfterTrapped = () => {
  12477. emit("focus");
  12478. };
  12479. const onFocusAfterReleased = (event) => {
  12480. var _a;
  12481. if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
  12482. focusStartRef.value = "first";
  12483. emit("blur");
  12484. }
  12485. };
  12486. const onFocusInTrap = (event) => {
  12487. if (props.visible && !trapped.value) {
  12488. if (event.target) {
  12489. focusStartRef.value = event.target;
  12490. }
  12491. trapped.value = true;
  12492. }
  12493. };
  12494. const onFocusoutPrevented = (event) => {
  12495. if (!props.trapping) {
  12496. if (event.detail.focusReason === "pointer") {
  12497. event.preventDefault();
  12498. }
  12499. trapped.value = false;
  12500. }
  12501. };
  12502. const onReleaseRequested = () => {
  12503. trapped.value = false;
  12504. emit("close");
  12505. };
  12506. vue.onMounted(() => {
  12507. let updateHandle;
  12508. vue.watch(computedReference, (referenceEl) => {
  12509. var _a;
  12510. updateHandle == null ? void 0 : updateHandle();
  12511. const popperInstance = vue.unref(popperInstanceRef);
  12512. (_a = popperInstance == null ? void 0 : popperInstance.destroy) == null ? void 0 : _a.call(popperInstance);
  12513. if (referenceEl) {
  12514. const popperContentEl = vue.unref(popperContentRef);
  12515. contentRef.value = popperContentEl;
  12516. popperInstanceRef.value = createPopperInstance({
  12517. referenceEl,
  12518. popperContentEl,
  12519. arrowEl: vue.unref(arrowRef)
  12520. });
  12521. updateHandle = vue.watch(() => referenceEl.getBoundingClientRect(), () => updatePopper(), {
  12522. immediate: true
  12523. });
  12524. } else {
  12525. popperInstanceRef.value = void 0;
  12526. }
  12527. }, {
  12528. immediate: true
  12529. });
  12530. vue.watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  12531. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  12532. triggerTargetAriaStopWatch = void 0;
  12533. const el = vue.unref(triggerTargetEl || popperContentRef.value);
  12534. const prevEl = vue.unref(prevTriggerTargetEl || popperContentRef.value);
  12535. if (isElement$1(el)) {
  12536. triggerTargetAriaStopWatch = vue.watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  12537. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  12538. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  12539. });
  12540. }, { immediate: true });
  12541. }
  12542. if (prevEl !== el && isElement$1(prevEl)) {
  12543. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  12544. prevEl.removeAttribute(key);
  12545. });
  12546. }
  12547. }, { immediate: true });
  12548. vue.watch(() => props.visible, togglePopperAlive, { immediate: true });
  12549. vue.watch(() => buildPopperOptions(props, {
  12550. arrowEl: vue.unref(arrowRef),
  12551. arrowOffset: vue.unref(arrowOffset)
  12552. }), (option) => {
  12553. var _a;
  12554. return (_a = popperInstanceRef.value) == null ? void 0 : _a.setOptions(option);
  12555. });
  12556. });
  12557. vue.onBeforeUnmount(() => {
  12558. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  12559. triggerTargetAriaStopWatch = void 0;
  12560. });
  12561. expose({
  12562. popperContentRef,
  12563. popperInstanceRef,
  12564. updatePopper,
  12565. contentStyle
  12566. });
  12567. return (_ctx, _cache) => {
  12568. return vue.openBlock(), vue.createElementBlock("div", {
  12569. ref_key: "popperContentRef",
  12570. ref: popperContentRef,
  12571. style: vue.normalizeStyle(vue.unref(contentStyle)),
  12572. class: vue.normalizeClass(vue.unref(contentClass)),
  12573. tabindex: "-1",
  12574. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  12575. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  12576. }, [
  12577. vue.createVNode(vue.unref(ElFocusTrap), {
  12578. trapped: trapped.value,
  12579. "trap-on-focus-in": true,
  12580. "focus-trap-el": popperContentRef.value,
  12581. "focus-start-el": focusStartRef.value,
  12582. onFocusAfterTrapped,
  12583. onFocusAfterReleased,
  12584. onFocusin: onFocusInTrap,
  12585. onFocusoutPrevented,
  12586. onReleaseRequested
  12587. }, {
  12588. default: vue.withCtx(() => [
  12589. vue.renderSlot(_ctx.$slots, "default")
  12590. ]),
  12591. _: 3
  12592. }, 8, ["trapped", "focus-trap-el", "focus-start-el"])
  12593. ], 38);
  12594. };
  12595. }
  12596. });
  12597. var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "content.vue"]]);
  12598. const ElPopper = withInstall(Popper);
  12599. const ns = useNamespace("tooltip");
  12600. const useTooltipContentProps = buildProps({
  12601. ...useDelayedToggleProps,
  12602. ...popperContentProps,
  12603. appendTo: {
  12604. type: definePropType([String, Object])
  12605. },
  12606. content: {
  12607. type: String,
  12608. default: ""
  12609. },
  12610. rawContent: {
  12611. type: Boolean,
  12612. default: false
  12613. },
  12614. persistent: Boolean,
  12615. ariaLabel: String,
  12616. visible: {
  12617. type: definePropType(Boolean),
  12618. default: null
  12619. },
  12620. transition: {
  12621. type: String,
  12622. default: `${ns.namespace.value}-fade-in-linear`
  12623. },
  12624. teleported: {
  12625. type: Boolean,
  12626. default: true
  12627. },
  12628. disabled: {
  12629. type: Boolean
  12630. }
  12631. });
  12632. const useTooltipTriggerProps = buildProps({
  12633. ...popperTriggerProps,
  12634. disabled: Boolean,
  12635. trigger: {
  12636. type: definePropType([String, Array]),
  12637. default: "hover"
  12638. },
  12639. triggerKeys: {
  12640. type: definePropType(Array),
  12641. default: () => [EVENT_CODE.enter, EVENT_CODE.space]
  12642. }
  12643. });
  12644. const {
  12645. useModelToggleProps: useTooltipModelToggleProps,
  12646. useModelToggleEmits: useTooltipModelToggleEmits,
  12647. useModelToggle: useTooltipModelToggle
  12648. } = createModelToggleComposable("visible");
  12649. const useTooltipProps = buildProps({
  12650. ...popperProps,
  12651. ...useTooltipModelToggleProps,
  12652. ...useTooltipContentProps,
  12653. ...useTooltipTriggerProps,
  12654. ...popperArrowProps,
  12655. showArrow: {
  12656. type: Boolean,
  12657. default: true
  12658. }
  12659. });
  12660. const tooltipEmits = [
  12661. ...useTooltipModelToggleEmits,
  12662. "before-show",
  12663. "before-hide",
  12664. "show",
  12665. "hide",
  12666. "open",
  12667. "close"
  12668. ];
  12669. const isTriggerType = (trigger, type) => {
  12670. if (isArray(trigger)) {
  12671. return trigger.includes(type);
  12672. }
  12673. return trigger === type;
  12674. };
  12675. const whenTrigger = (trigger, type, handler) => {
  12676. return (e) => {
  12677. isTriggerType(vue.unref(trigger), type) && handler(e);
  12678. };
  12679. };
  12680. const __default__$1n = vue.defineComponent({
  12681. name: "ElTooltipTrigger"
  12682. });
  12683. const _sfc_main$23 = /* @__PURE__ */ vue.defineComponent({
  12684. ...__default__$1n,
  12685. props: useTooltipTriggerProps,
  12686. setup(__props, { expose }) {
  12687. const props = __props;
  12688. const ns = useNamespace("tooltip");
  12689. const { controlled, id, open, onOpen, onClose, onToggle } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  12690. const triggerRef = vue.ref(null);
  12691. const stopWhenControlledOrDisabled = () => {
  12692. if (vue.unref(controlled) || props.disabled) {
  12693. return true;
  12694. }
  12695. };
  12696. const trigger = vue.toRef(props, "trigger");
  12697. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  12698. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  12699. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  12700. if (e.button === 0) {
  12701. onToggle(e);
  12702. }
  12703. }));
  12704. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  12705. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  12706. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  12707. e.preventDefault();
  12708. onToggle(e);
  12709. }));
  12710. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  12711. const { code } = e;
  12712. if (props.triggerKeys.includes(code)) {
  12713. e.preventDefault();
  12714. onToggle(e);
  12715. }
  12716. });
  12717. expose({
  12718. triggerRef
  12719. });
  12720. return (_ctx, _cache) => {
  12721. return vue.openBlock(), vue.createBlock(vue.unref(ElPopperTrigger), {
  12722. id: vue.unref(id),
  12723. "virtual-ref": _ctx.virtualRef,
  12724. open: vue.unref(open),
  12725. "virtual-triggering": _ctx.virtualTriggering,
  12726. class: vue.normalizeClass(vue.unref(ns).e("trigger")),
  12727. onBlur: vue.unref(onBlur),
  12728. onClick: vue.unref(onClick),
  12729. onContextmenu: vue.unref(onContextMenu),
  12730. onFocus: vue.unref(onFocus),
  12731. onMouseenter: vue.unref(onMouseenter),
  12732. onMouseleave: vue.unref(onMouseleave),
  12733. onKeydown: vue.unref(onKeydown)
  12734. }, {
  12735. default: vue.withCtx(() => [
  12736. vue.renderSlot(_ctx.$slots, "default")
  12737. ]),
  12738. _: 3
  12739. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  12740. };
  12741. }
  12742. });
  12743. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "trigger.vue"]]);
  12744. const __default__$1m = vue.defineComponent({
  12745. name: "ElTooltipContent",
  12746. inheritAttrs: false
  12747. });
  12748. const _sfc_main$22 = /* @__PURE__ */ vue.defineComponent({
  12749. ...__default__$1m,
  12750. props: useTooltipContentProps,
  12751. setup(__props, { expose }) {
  12752. const props = __props;
  12753. const { selector } = usePopperContainerId();
  12754. const contentRef = vue.ref(null);
  12755. const destroyed = vue.ref(false);
  12756. const {
  12757. controlled,
  12758. id,
  12759. open,
  12760. trigger,
  12761. onClose,
  12762. onOpen,
  12763. onShow,
  12764. onHide,
  12765. onBeforeShow,
  12766. onBeforeHide
  12767. } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  12768. const persistentRef = vue.computed(() => {
  12769. return props.persistent;
  12770. });
  12771. vue.onBeforeUnmount(() => {
  12772. destroyed.value = true;
  12773. });
  12774. const shouldRender = vue.computed(() => {
  12775. return vue.unref(persistentRef) ? true : vue.unref(open);
  12776. });
  12777. const shouldShow = vue.computed(() => {
  12778. return props.disabled ? false : vue.unref(open);
  12779. });
  12780. const appendTo = vue.computed(() => {
  12781. return props.appendTo || selector.value;
  12782. });
  12783. const contentStyle = vue.computed(() => {
  12784. var _a;
  12785. return (_a = props.style) != null ? _a : {};
  12786. });
  12787. const ariaHidden = vue.computed(() => !vue.unref(open));
  12788. const onTransitionLeave = () => {
  12789. onHide();
  12790. };
  12791. const stopWhenControlled = () => {
  12792. if (vue.unref(controlled))
  12793. return true;
  12794. };
  12795. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  12796. if (props.enterable && vue.unref(trigger) === "hover") {
  12797. onOpen();
  12798. }
  12799. });
  12800. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  12801. if (vue.unref(trigger) === "hover") {
  12802. onClose();
  12803. }
  12804. });
  12805. const onBeforeEnter = () => {
  12806. var _a, _b;
  12807. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  12808. onBeforeShow == null ? void 0 : onBeforeShow();
  12809. };
  12810. const onBeforeLeave = () => {
  12811. onBeforeHide == null ? void 0 : onBeforeHide();
  12812. };
  12813. const onAfterShow = () => {
  12814. onShow();
  12815. stopHandle = onClickOutside(vue.computed(() => {
  12816. var _a;
  12817. return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  12818. }), () => {
  12819. if (vue.unref(controlled))
  12820. return;
  12821. const $trigger = vue.unref(trigger);
  12822. if ($trigger !== "hover") {
  12823. onClose();
  12824. }
  12825. });
  12826. };
  12827. const onBlur = () => {
  12828. if (!props.virtualTriggering) {
  12829. onClose();
  12830. }
  12831. };
  12832. let stopHandle;
  12833. vue.watch(() => vue.unref(open), (val) => {
  12834. if (!val) {
  12835. stopHandle == null ? void 0 : stopHandle();
  12836. }
  12837. }, {
  12838. flush: "post"
  12839. });
  12840. vue.watch(() => props.content, () => {
  12841. var _a, _b;
  12842. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  12843. });
  12844. expose({
  12845. contentRef
  12846. });
  12847. return (_ctx, _cache) => {
  12848. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  12849. disabled: !_ctx.teleported,
  12850. to: vue.unref(appendTo)
  12851. }, [
  12852. vue.createVNode(vue.Transition, {
  12853. name: _ctx.transition,
  12854. onAfterLeave: onTransitionLeave,
  12855. onBeforeEnter,
  12856. onAfterEnter: onAfterShow,
  12857. onBeforeLeave
  12858. }, {
  12859. default: vue.withCtx(() => [
  12860. vue.unref(shouldRender) ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElPopperContent), vue.mergeProps({
  12861. key: 0,
  12862. id: vue.unref(id),
  12863. ref_key: "contentRef",
  12864. ref: contentRef
  12865. }, _ctx.$attrs, {
  12866. "aria-label": _ctx.ariaLabel,
  12867. "aria-hidden": vue.unref(ariaHidden),
  12868. "boundaries-padding": _ctx.boundariesPadding,
  12869. "fallback-placements": _ctx.fallbackPlacements,
  12870. "gpu-acceleration": _ctx.gpuAcceleration,
  12871. offset: _ctx.offset,
  12872. placement: _ctx.placement,
  12873. "popper-options": _ctx.popperOptions,
  12874. strategy: _ctx.strategy,
  12875. effect: _ctx.effect,
  12876. enterable: _ctx.enterable,
  12877. pure: _ctx.pure,
  12878. "popper-class": _ctx.popperClass,
  12879. "popper-style": [_ctx.popperStyle, vue.unref(contentStyle)],
  12880. "reference-el": _ctx.referenceEl,
  12881. "trigger-target-el": _ctx.triggerTargetEl,
  12882. visible: vue.unref(shouldShow),
  12883. "z-index": _ctx.zIndex,
  12884. onMouseenter: vue.unref(onContentEnter),
  12885. onMouseleave: vue.unref(onContentLeave),
  12886. onBlur,
  12887. onClose: vue.unref(onClose)
  12888. }), {
  12889. default: vue.withCtx(() => [
  12890. !destroyed.value ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  12891. ]),
  12892. _: 3
  12893. }, 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"])), [
  12894. [vue.vShow, vue.unref(shouldShow)]
  12895. ]) : vue.createCommentVNode("v-if", true)
  12896. ]),
  12897. _: 3
  12898. }, 8, ["name"])
  12899. ], 8, ["disabled", "to"]);
  12900. };
  12901. }
  12902. });
  12903. var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "content.vue"]]);
  12904. const _hoisted_1$12 = ["innerHTML"];
  12905. const _hoisted_2$F = { key: 1 };
  12906. const __default__$1l = vue.defineComponent({
  12907. name: "ElTooltip"
  12908. });
  12909. const _sfc_main$21 = /* @__PURE__ */ vue.defineComponent({
  12910. ...__default__$1l,
  12911. props: useTooltipProps,
  12912. emits: tooltipEmits,
  12913. setup(__props, { expose, emit }) {
  12914. const props = __props;
  12915. usePopperContainer();
  12916. const id = useId();
  12917. const popperRef = vue.ref();
  12918. const contentRef = vue.ref();
  12919. const updatePopper = () => {
  12920. var _a;
  12921. const popperComponent = vue.unref(popperRef);
  12922. if (popperComponent) {
  12923. (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
  12924. }
  12925. };
  12926. const open = vue.ref(false);
  12927. const toggleReason = vue.ref();
  12928. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  12929. indicator: open,
  12930. toggleReason
  12931. });
  12932. const { onOpen, onClose } = useDelayedToggle({
  12933. showAfter: vue.toRef(props, "showAfter"),
  12934. hideAfter: vue.toRef(props, "hideAfter"),
  12935. open: show,
  12936. close: hide
  12937. });
  12938. const controlled = vue.computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  12939. vue.provide(TOOLTIP_INJECTION_KEY, {
  12940. controlled,
  12941. id,
  12942. open: vue.readonly(open),
  12943. trigger: vue.toRef(props, "trigger"),
  12944. onOpen: (event) => {
  12945. onOpen(event);
  12946. },
  12947. onClose: (event) => {
  12948. onClose(event);
  12949. },
  12950. onToggle: (event) => {
  12951. if (vue.unref(open)) {
  12952. onClose(event);
  12953. } else {
  12954. onOpen(event);
  12955. }
  12956. },
  12957. onShow: () => {
  12958. emit("show", toggleReason.value);
  12959. },
  12960. onHide: () => {
  12961. emit("hide", toggleReason.value);
  12962. },
  12963. onBeforeShow: () => {
  12964. emit("before-show", toggleReason.value);
  12965. },
  12966. onBeforeHide: () => {
  12967. emit("before-hide", toggleReason.value);
  12968. },
  12969. updatePopper
  12970. });
  12971. vue.watch(() => props.disabled, (disabled) => {
  12972. if (disabled && open.value) {
  12973. open.value = false;
  12974. }
  12975. });
  12976. const isFocusInsideContent = () => {
  12977. var _a, _b;
  12978. const popperContent = (_b = (_a = contentRef.value) == null ? void 0 : _a.contentRef) == null ? void 0 : _b.popperContentRef;
  12979. return popperContent && popperContent.contains(document.activeElement);
  12980. };
  12981. vue.onDeactivated(() => open.value && hide());
  12982. expose({
  12983. popperRef,
  12984. contentRef,
  12985. isFocusInsideContent,
  12986. updatePopper,
  12987. onOpen,
  12988. onClose,
  12989. hide
  12990. });
  12991. return (_ctx, _cache) => {
  12992. return vue.openBlock(), vue.createBlock(vue.unref(ElPopper), {
  12993. ref_key: "popperRef",
  12994. ref: popperRef,
  12995. role: _ctx.role
  12996. }, {
  12997. default: vue.withCtx(() => [
  12998. vue.createVNode(ElTooltipTrigger, {
  12999. disabled: _ctx.disabled,
  13000. trigger: _ctx.trigger,
  13001. "trigger-keys": _ctx.triggerKeys,
  13002. "virtual-ref": _ctx.virtualRef,
  13003. "virtual-triggering": _ctx.virtualTriggering
  13004. }, {
  13005. default: vue.withCtx(() => [
  13006. _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  13007. ]),
  13008. _: 3
  13009. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  13010. vue.createVNode(ElTooltipContent, {
  13011. ref_key: "contentRef",
  13012. ref: contentRef,
  13013. "aria-label": _ctx.ariaLabel,
  13014. "boundaries-padding": _ctx.boundariesPadding,
  13015. content: _ctx.content,
  13016. disabled: _ctx.disabled,
  13017. effect: _ctx.effect,
  13018. enterable: _ctx.enterable,
  13019. "fallback-placements": _ctx.fallbackPlacements,
  13020. "hide-after": _ctx.hideAfter,
  13021. "gpu-acceleration": _ctx.gpuAcceleration,
  13022. offset: _ctx.offset,
  13023. persistent: _ctx.persistent,
  13024. "popper-class": _ctx.popperClass,
  13025. "popper-style": _ctx.popperStyle,
  13026. placement: _ctx.placement,
  13027. "popper-options": _ctx.popperOptions,
  13028. pure: _ctx.pure,
  13029. "raw-content": _ctx.rawContent,
  13030. "reference-el": _ctx.referenceEl,
  13031. "trigger-target-el": _ctx.triggerTargetEl,
  13032. "show-after": _ctx.showAfter,
  13033. strategy: _ctx.strategy,
  13034. teleported: _ctx.teleported,
  13035. transition: _ctx.transition,
  13036. "virtual-triggering": _ctx.virtualTriggering,
  13037. "z-index": _ctx.zIndex,
  13038. "append-to": _ctx.appendTo
  13039. }, {
  13040. default: vue.withCtx(() => [
  13041. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  13042. _ctx.rawContent ? (vue.openBlock(), vue.createElementBlock("span", {
  13043. key: 0,
  13044. innerHTML: _ctx.content
  13045. }, null, 8, _hoisted_1$12)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$F, vue.toDisplayString(_ctx.content), 1))
  13046. ]),
  13047. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(vue.unref(ElPopperArrow), {
  13048. key: 0,
  13049. "arrow-offset": _ctx.arrowOffset
  13050. }, null, 8, ["arrow-offset"])) : vue.createCommentVNode("v-if", true)
  13051. ]),
  13052. _: 3
  13053. }, 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"])
  13054. ]),
  13055. _: 3
  13056. }, 8, ["role"]);
  13057. };
  13058. }
  13059. });
  13060. var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "tooltip.vue"]]);
  13061. const ElTooltip = withInstall(Tooltip);
  13062. const autocompleteProps = buildProps({
  13063. valueKey: {
  13064. type: String,
  13065. default: "value"
  13066. },
  13067. modelValue: {
  13068. type: [String, Number],
  13069. default: ""
  13070. },
  13071. debounce: {
  13072. type: Number,
  13073. default: 300
  13074. },
  13075. placement: {
  13076. type: definePropType(String),
  13077. values: [
  13078. "top",
  13079. "top-start",
  13080. "top-end",
  13081. "bottom",
  13082. "bottom-start",
  13083. "bottom-end"
  13084. ],
  13085. default: "bottom-start"
  13086. },
  13087. fetchSuggestions: {
  13088. type: definePropType([Function, Array]),
  13089. default: NOOP
  13090. },
  13091. popperClass: {
  13092. type: String,
  13093. default: ""
  13094. },
  13095. triggerOnFocus: {
  13096. type: Boolean,
  13097. default: true
  13098. },
  13099. selectWhenUnmatched: {
  13100. type: Boolean,
  13101. default: false
  13102. },
  13103. hideLoading: {
  13104. type: Boolean,
  13105. default: false
  13106. },
  13107. label: {
  13108. type: String
  13109. },
  13110. teleported: useTooltipContentProps.teleported,
  13111. highlightFirstItem: {
  13112. type: Boolean,
  13113. default: false
  13114. },
  13115. fitInputWidth: {
  13116. type: Boolean,
  13117. default: false
  13118. }
  13119. });
  13120. const autocompleteEmits = {
  13121. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  13122. [INPUT_EVENT]: (value) => isString(value),
  13123. [CHANGE_EVENT]: (value) => isString(value),
  13124. focus: (evt) => evt instanceof FocusEvent,
  13125. blur: (evt) => evt instanceof FocusEvent,
  13126. clear: () => true,
  13127. select: (item) => isObject$1(item)
  13128. };
  13129. const _hoisted_1$11 = ["aria-expanded", "aria-owns"];
  13130. const _hoisted_2$E = { key: 0 };
  13131. const _hoisted_3$j = ["id", "aria-selected", "onClick"];
  13132. const COMPONENT_NAME$j = "ElAutocomplete";
  13133. const __default__$1k = vue.defineComponent({
  13134. name: COMPONENT_NAME$j,
  13135. inheritAttrs: false
  13136. });
  13137. const _sfc_main$20 = /* @__PURE__ */ vue.defineComponent({
  13138. ...__default__$1k,
  13139. props: autocompleteProps,
  13140. emits: autocompleteEmits,
  13141. setup(__props, { expose, emit }) {
  13142. const props = __props;
  13143. const attrs = useAttrs();
  13144. const rawAttrs = vue.useAttrs();
  13145. const disabled = useDisabled();
  13146. const ns = useNamespace("autocomplete");
  13147. const inputRef = vue.ref();
  13148. const regionRef = vue.ref();
  13149. const popperRef = vue.ref();
  13150. const listboxRef = vue.ref();
  13151. let readonly = false;
  13152. let ignoreFocusEvent = false;
  13153. const suggestions = vue.ref([]);
  13154. const highlightedIndex = vue.ref(-1);
  13155. const dropdownWidth = vue.ref("");
  13156. const activated = vue.ref(false);
  13157. const suggestionDisabled = vue.ref(false);
  13158. const loading = vue.ref(false);
  13159. const listboxId = vue.computed(() => ns.b(String(generateId())));
  13160. const styles = vue.computed(() => rawAttrs.style);
  13161. const suggestionVisible = vue.computed(() => {
  13162. const isValidData = suggestions.value.length > 0;
  13163. return (isValidData || loading.value) && activated.value;
  13164. });
  13165. const suggestionLoading = vue.computed(() => !props.hideLoading && loading.value);
  13166. const refInput = vue.computed(() => {
  13167. if (inputRef.value) {
  13168. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  13169. }
  13170. return [];
  13171. });
  13172. const onSuggestionShow = async () => {
  13173. await vue.nextTick();
  13174. if (suggestionVisible.value) {
  13175. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  13176. }
  13177. };
  13178. const onShow = () => {
  13179. ignoreFocusEvent = true;
  13180. };
  13181. const onHide = () => {
  13182. ignoreFocusEvent = false;
  13183. highlightedIndex.value = -1;
  13184. };
  13185. const getData = async (queryString) => {
  13186. if (suggestionDisabled.value)
  13187. return;
  13188. const cb = (suggestionList) => {
  13189. loading.value = false;
  13190. if (suggestionDisabled.value)
  13191. return;
  13192. if (isArray(suggestionList)) {
  13193. suggestions.value = suggestionList;
  13194. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  13195. } else {
  13196. throwError(COMPONENT_NAME$j, "autocomplete suggestions must be an array");
  13197. }
  13198. };
  13199. loading.value = true;
  13200. if (isArray(props.fetchSuggestions)) {
  13201. cb(props.fetchSuggestions);
  13202. } else {
  13203. const result = await props.fetchSuggestions(queryString, cb);
  13204. if (isArray(result))
  13205. cb(result);
  13206. }
  13207. };
  13208. const debouncedGetData = debounce(getData, props.debounce);
  13209. const handleInput = (value) => {
  13210. const valuePresented = !!value;
  13211. emit(INPUT_EVENT, value);
  13212. emit(UPDATE_MODEL_EVENT, value);
  13213. suggestionDisabled.value = false;
  13214. activated.value || (activated.value = valuePresented);
  13215. if (!props.triggerOnFocus && !value) {
  13216. suggestionDisabled.value = true;
  13217. suggestions.value = [];
  13218. return;
  13219. }
  13220. debouncedGetData(value);
  13221. };
  13222. const handleMouseDown = (event) => {
  13223. var _a;
  13224. if (disabled.value)
  13225. return;
  13226. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  13227. activated.value = true;
  13228. }
  13229. };
  13230. const handleChange = (value) => {
  13231. emit(CHANGE_EVENT, value);
  13232. };
  13233. const handleFocus = (evt) => {
  13234. if (ignoreFocusEvent)
  13235. return;
  13236. activated.value = true;
  13237. emit("focus", evt);
  13238. if (props.triggerOnFocus && !readonly) {
  13239. debouncedGetData(String(props.modelValue));
  13240. }
  13241. };
  13242. const handleBlur = (evt) => {
  13243. if (ignoreFocusEvent)
  13244. return;
  13245. emit("blur", evt);
  13246. };
  13247. const handleClear = () => {
  13248. activated.value = false;
  13249. emit(UPDATE_MODEL_EVENT, "");
  13250. emit("clear");
  13251. };
  13252. const handleKeyEnter = async () => {
  13253. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  13254. handleSelect(suggestions.value[highlightedIndex.value]);
  13255. } else if (props.selectWhenUnmatched) {
  13256. emit("select", { value: props.modelValue });
  13257. suggestions.value = [];
  13258. highlightedIndex.value = -1;
  13259. }
  13260. };
  13261. const handleKeyEscape = (evt) => {
  13262. if (suggestionVisible.value) {
  13263. evt.preventDefault();
  13264. evt.stopPropagation();
  13265. close();
  13266. }
  13267. };
  13268. const close = () => {
  13269. activated.value = false;
  13270. };
  13271. const focus = () => {
  13272. var _a;
  13273. (_a = inputRef.value) == null ? void 0 : _a.focus();
  13274. };
  13275. const blur = () => {
  13276. var _a;
  13277. (_a = inputRef.value) == null ? void 0 : _a.blur();
  13278. };
  13279. const handleSelect = async (item) => {
  13280. emit(INPUT_EVENT, item[props.valueKey]);
  13281. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  13282. emit("select", item);
  13283. suggestions.value = [];
  13284. highlightedIndex.value = -1;
  13285. };
  13286. const highlight = (index) => {
  13287. if (!suggestionVisible.value || loading.value)
  13288. return;
  13289. if (index < 0) {
  13290. highlightedIndex.value = -1;
  13291. return;
  13292. }
  13293. if (index >= suggestions.value.length) {
  13294. index = suggestions.value.length - 1;
  13295. }
  13296. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  13297. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  13298. const highlightItem = suggestionList[index];
  13299. const scrollTop = suggestion.scrollTop;
  13300. const { offsetTop, scrollHeight } = highlightItem;
  13301. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  13302. suggestion.scrollTop += scrollHeight;
  13303. }
  13304. if (offsetTop < scrollTop) {
  13305. suggestion.scrollTop -= scrollHeight;
  13306. }
  13307. highlightedIndex.value = index;
  13308. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  13309. };
  13310. onClickOutside(listboxRef, () => {
  13311. suggestionVisible.value && close();
  13312. });
  13313. vue.onMounted(() => {
  13314. inputRef.value.ref.setAttribute("role", "textbox");
  13315. inputRef.value.ref.setAttribute("aria-autocomplete", "list");
  13316. inputRef.value.ref.setAttribute("aria-controls", "id");
  13317. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  13318. readonly = inputRef.value.ref.hasAttribute("readonly");
  13319. });
  13320. expose({
  13321. highlightedIndex,
  13322. activated,
  13323. loading,
  13324. inputRef,
  13325. popperRef,
  13326. suggestions,
  13327. handleSelect,
  13328. handleKeyEnter,
  13329. focus,
  13330. blur,
  13331. close,
  13332. highlight
  13333. });
  13334. return (_ctx, _cache) => {
  13335. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  13336. ref_key: "popperRef",
  13337. ref: popperRef,
  13338. visible: vue.unref(suggestionVisible),
  13339. placement: _ctx.placement,
  13340. "fallback-placements": ["bottom-start", "top-start"],
  13341. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  13342. teleported: _ctx.teleported,
  13343. "gpu-acceleration": false,
  13344. pure: "",
  13345. "manual-mode": "",
  13346. effect: "light",
  13347. trigger: "click",
  13348. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  13349. persistent: "",
  13350. onBeforeShow: onSuggestionShow,
  13351. onShow,
  13352. onHide
  13353. }, {
  13354. content: vue.withCtx(() => [
  13355. vue.createElementVNode("div", {
  13356. ref_key: "regionRef",
  13357. ref: regionRef,
  13358. class: vue.normalizeClass([vue.unref(ns).b("suggestion"), vue.unref(ns).is("loading", vue.unref(suggestionLoading))]),
  13359. style: vue.normalizeStyle({
  13360. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  13361. outline: "none"
  13362. }),
  13363. role: "region"
  13364. }, [
  13365. vue.createVNode(vue.unref(ElScrollbar), {
  13366. id: vue.unref(listboxId),
  13367. tag: "ul",
  13368. "wrap-class": vue.unref(ns).be("suggestion", "wrap"),
  13369. "view-class": vue.unref(ns).be("suggestion", "list"),
  13370. role: "listbox"
  13371. }, {
  13372. default: vue.withCtx(() => [
  13373. vue.unref(suggestionLoading) ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_2$E, [
  13374. vue.createVNode(vue.unref(ElIcon), {
  13375. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  13376. }, {
  13377. default: vue.withCtx(() => [
  13378. vue.createVNode(vue.unref(loading_default))
  13379. ]),
  13380. _: 1
  13381. }, 8, ["class"])
  13382. ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(suggestions.value, (item, index) => {
  13383. return vue.openBlock(), vue.createElementBlock("li", {
  13384. id: `${vue.unref(listboxId)}-item-${index}`,
  13385. key: index,
  13386. class: vue.normalizeClass({ highlighted: highlightedIndex.value === index }),
  13387. role: "option",
  13388. "aria-selected": highlightedIndex.value === index,
  13389. onClick: ($event) => handleSelect(item)
  13390. }, [
  13391. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  13392. vue.createTextVNode(vue.toDisplayString(item[_ctx.valueKey]), 1)
  13393. ])
  13394. ], 10, _hoisted_3$j);
  13395. }), 128))
  13396. ]),
  13397. _: 3
  13398. }, 8, ["id", "wrap-class", "view-class"])
  13399. ], 6)
  13400. ]),
  13401. default: vue.withCtx(() => [
  13402. vue.createElementVNode("div", {
  13403. ref_key: "listboxRef",
  13404. ref: listboxRef,
  13405. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  13406. style: vue.normalizeStyle(vue.unref(styles)),
  13407. role: "combobox",
  13408. "aria-haspopup": "listbox",
  13409. "aria-expanded": vue.unref(suggestionVisible),
  13410. "aria-owns": vue.unref(listboxId)
  13411. }, [
  13412. vue.createVNode(vue.unref(ElInput), vue.mergeProps({
  13413. ref_key: "inputRef",
  13414. ref: inputRef
  13415. }, vue.unref(attrs), {
  13416. "model-value": _ctx.modelValue,
  13417. onInput: handleInput,
  13418. onChange: handleChange,
  13419. onFocus: handleFocus,
  13420. onBlur: handleBlur,
  13421. onClear: handleClear,
  13422. onKeydown: [
  13423. _cache[0] || (_cache[0] = vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"])),
  13424. _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"])),
  13425. vue.withKeys(handleKeyEnter, ["enter"]),
  13426. vue.withKeys(close, ["tab"]),
  13427. vue.withKeys(handleKeyEscape, ["esc"])
  13428. ],
  13429. onMousedown: handleMouseDown
  13430. }), vue.createSlots({ _: 2 }, [
  13431. _ctx.$slots.prepend ? {
  13432. name: "prepend",
  13433. fn: vue.withCtx(() => [
  13434. vue.renderSlot(_ctx.$slots, "prepend")
  13435. ])
  13436. } : void 0,
  13437. _ctx.$slots.append ? {
  13438. name: "append",
  13439. fn: vue.withCtx(() => [
  13440. vue.renderSlot(_ctx.$slots, "append")
  13441. ])
  13442. } : void 0,
  13443. _ctx.$slots.prefix ? {
  13444. name: "prefix",
  13445. fn: vue.withCtx(() => [
  13446. vue.renderSlot(_ctx.$slots, "prefix")
  13447. ])
  13448. } : void 0,
  13449. _ctx.$slots.suffix ? {
  13450. name: "suffix",
  13451. fn: vue.withCtx(() => [
  13452. vue.renderSlot(_ctx.$slots, "suffix")
  13453. ])
  13454. } : void 0
  13455. ]), 1040, ["model-value", "onKeydown"])
  13456. ], 14, _hoisted_1$11)
  13457. ]),
  13458. _: 3
  13459. }, 8, ["visible", "placement", "popper-class", "teleported", "transition"]);
  13460. };
  13461. }
  13462. });
  13463. var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "autocomplete.vue"]]);
  13464. const ElAutocomplete = withInstall(Autocomplete);
  13465. const avatarProps = buildProps({
  13466. size: {
  13467. type: [Number, String],
  13468. values: componentSizes,
  13469. default: "",
  13470. validator: (val) => isNumber(val)
  13471. },
  13472. shape: {
  13473. type: String,
  13474. values: ["circle", "square"],
  13475. default: "circle"
  13476. },
  13477. icon: {
  13478. type: iconPropType
  13479. },
  13480. src: {
  13481. type: String,
  13482. default: ""
  13483. },
  13484. alt: String,
  13485. srcSet: String,
  13486. fit: {
  13487. type: definePropType(String),
  13488. default: "cover"
  13489. }
  13490. });
  13491. const avatarEmits = {
  13492. error: (evt) => evt instanceof Event
  13493. };
  13494. const _hoisted_1$10 = ["src", "alt", "srcset"];
  13495. const __default__$1j = vue.defineComponent({
  13496. name: "ElAvatar"
  13497. });
  13498. const _sfc_main$1$ = /* @__PURE__ */ vue.defineComponent({
  13499. ...__default__$1j,
  13500. props: avatarProps,
  13501. emits: avatarEmits,
  13502. setup(__props, { emit }) {
  13503. const props = __props;
  13504. const ns = useNamespace("avatar");
  13505. const hasLoadError = vue.ref(false);
  13506. const avatarClass = vue.computed(() => {
  13507. const { size, icon, shape } = props;
  13508. const classList = [ns.b()];
  13509. if (isString(size))
  13510. classList.push(ns.m(size));
  13511. if (icon)
  13512. classList.push(ns.m("icon"));
  13513. if (shape)
  13514. classList.push(ns.m(shape));
  13515. return classList;
  13516. });
  13517. const sizeStyle = vue.computed(() => {
  13518. const { size } = props;
  13519. return isNumber(size) ? ns.cssVarBlock({
  13520. size: addUnit(size) || ""
  13521. }) : void 0;
  13522. });
  13523. const fitStyle = vue.computed(() => ({
  13524. objectFit: props.fit
  13525. }));
  13526. vue.watch(() => props.src, () => hasLoadError.value = false);
  13527. function handleError(e) {
  13528. hasLoadError.value = true;
  13529. emit("error", e);
  13530. }
  13531. return (_ctx, _cache) => {
  13532. return vue.openBlock(), vue.createElementBlock("span", {
  13533. class: vue.normalizeClass(vue.unref(avatarClass)),
  13534. style: vue.normalizeStyle(vue.unref(sizeStyle))
  13535. }, [
  13536. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", {
  13537. key: 0,
  13538. src: _ctx.src,
  13539. alt: _ctx.alt,
  13540. srcset: _ctx.srcSet,
  13541. style: vue.normalizeStyle(vue.unref(fitStyle)),
  13542. onError: handleError
  13543. }, null, 44, _hoisted_1$10)) : _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  13544. default: vue.withCtx(() => [
  13545. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  13546. ]),
  13547. _: 1
  13548. })) : vue.renderSlot(_ctx.$slots, "default", { key: 2 })
  13549. ], 6);
  13550. };
  13551. }
  13552. });
  13553. var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "avatar.vue"]]);
  13554. const ElAvatar = withInstall(Avatar);
  13555. const backtopProps = {
  13556. visibilityHeight: {
  13557. type: Number,
  13558. default: 200
  13559. },
  13560. target: {
  13561. type: String,
  13562. default: ""
  13563. },
  13564. right: {
  13565. type: Number,
  13566. default: 40
  13567. },
  13568. bottom: {
  13569. type: Number,
  13570. default: 40
  13571. }
  13572. };
  13573. const backtopEmits = {
  13574. click: (evt) => evt instanceof MouseEvent
  13575. };
  13576. const useBackTop = (props, emit, componentName) => {
  13577. const el = vue.shallowRef();
  13578. const container = vue.shallowRef();
  13579. const visible = vue.ref(false);
  13580. const scrollToTop = () => {
  13581. if (!el.value)
  13582. return;
  13583. const beginTime = Date.now();
  13584. const beginValue = el.value.scrollTop;
  13585. const frameFunc = () => {
  13586. if (!el.value)
  13587. return;
  13588. const progress = (Date.now() - beginTime) / 500;
  13589. if (progress < 1) {
  13590. el.value.scrollTop = beginValue * (1 - easeInOutCubic(progress));
  13591. requestAnimationFrame(frameFunc);
  13592. } else {
  13593. el.value.scrollTop = 0;
  13594. }
  13595. };
  13596. requestAnimationFrame(frameFunc);
  13597. };
  13598. const handleScroll = () => {
  13599. if (el.value)
  13600. visible.value = el.value.scrollTop >= props.visibilityHeight;
  13601. };
  13602. const handleClick = (event) => {
  13603. scrollToTop();
  13604. emit("click", event);
  13605. };
  13606. const handleScrollThrottled = useThrottleFn(handleScroll, 300, true);
  13607. useEventListener(container, "scroll", handleScrollThrottled);
  13608. vue.onMounted(() => {
  13609. var _a;
  13610. container.value = document;
  13611. el.value = document.documentElement;
  13612. if (props.target) {
  13613. el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  13614. if (!el.value) {
  13615. throwError(componentName, `target does not exist: ${props.target}`);
  13616. }
  13617. container.value = el.value;
  13618. }
  13619. });
  13620. return {
  13621. visible,
  13622. handleClick
  13623. };
  13624. };
  13625. const COMPONENT_NAME$i = "ElBacktop";
  13626. const __default__$1i = vue.defineComponent({
  13627. name: COMPONENT_NAME$i
  13628. });
  13629. const _sfc_main$1_ = /* @__PURE__ */ vue.defineComponent({
  13630. ...__default__$1i,
  13631. props: backtopProps,
  13632. emits: backtopEmits,
  13633. setup(__props, { emit }) {
  13634. const props = __props;
  13635. const ns = useNamespace("backtop");
  13636. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$i);
  13637. const backTopStyle = vue.computed(() => ({
  13638. right: `${props.right}px`,
  13639. bottom: `${props.bottom}px`
  13640. }));
  13641. return (_ctx, _cache) => {
  13642. return vue.openBlock(), vue.createBlock(vue.Transition, {
  13643. name: `${vue.unref(ns).namespace.value}-fade-in`
  13644. }, {
  13645. default: vue.withCtx(() => [
  13646. vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("div", {
  13647. key: 0,
  13648. style: vue.normalizeStyle(vue.unref(backTopStyle)),
  13649. class: vue.normalizeClass(vue.unref(ns).b()),
  13650. onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => vue.unref(handleClick) && vue.unref(handleClick)(...args), ["stop"]))
  13651. }, [
  13652. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  13653. vue.createVNode(vue.unref(ElIcon), {
  13654. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  13655. }, {
  13656. default: vue.withCtx(() => [
  13657. vue.createVNode(vue.unref(caret_top_default))
  13658. ]),
  13659. _: 1
  13660. }, 8, ["class"])
  13661. ])
  13662. ], 6)) : vue.createCommentVNode("v-if", true)
  13663. ]),
  13664. _: 3
  13665. }, 8, ["name"]);
  13666. };
  13667. }
  13668. });
  13669. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "backtop.vue"]]);
  13670. const ElBacktop = withInstall(Backtop);
  13671. const badgeProps = buildProps({
  13672. value: {
  13673. type: [String, Number],
  13674. default: ""
  13675. },
  13676. max: {
  13677. type: Number,
  13678. default: 99
  13679. },
  13680. isDot: Boolean,
  13681. hidden: Boolean,
  13682. type: {
  13683. type: String,
  13684. values: ["primary", "success", "warning", "info", "danger"],
  13685. default: "danger"
  13686. }
  13687. });
  13688. const _hoisted_1$$ = ["textContent"];
  13689. const __default__$1h = vue.defineComponent({
  13690. name: "ElBadge"
  13691. });
  13692. const _sfc_main$1Z = /* @__PURE__ */ vue.defineComponent({
  13693. ...__default__$1h,
  13694. props: badgeProps,
  13695. setup(__props, { expose }) {
  13696. const props = __props;
  13697. const ns = useNamespace("badge");
  13698. const content = vue.computed(() => {
  13699. if (props.isDot)
  13700. return "";
  13701. if (isNumber(props.value) && isNumber(props.max)) {
  13702. return props.max < props.value ? `${props.max}+` : `${props.value}`;
  13703. }
  13704. return `${props.value}`;
  13705. });
  13706. expose({
  13707. content
  13708. });
  13709. return (_ctx, _cache) => {
  13710. return vue.openBlock(), vue.createElementBlock("div", {
  13711. class: vue.normalizeClass(vue.unref(ns).b())
  13712. }, [
  13713. vue.renderSlot(_ctx.$slots, "default"),
  13714. vue.createVNode(vue.Transition, {
  13715. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  13716. persisted: ""
  13717. }, {
  13718. default: vue.withCtx(() => [
  13719. vue.withDirectives(vue.createElementVNode("sup", {
  13720. class: vue.normalizeClass([
  13721. vue.unref(ns).e("content"),
  13722. vue.unref(ns).em("content", _ctx.type),
  13723. vue.unref(ns).is("fixed", !!_ctx.$slots.default),
  13724. vue.unref(ns).is("dot", _ctx.isDot)
  13725. ]),
  13726. textContent: vue.toDisplayString(vue.unref(content))
  13727. }, null, 10, _hoisted_1$$), [
  13728. [vue.vShow, !_ctx.hidden && (vue.unref(content) || _ctx.isDot)]
  13729. ])
  13730. ]),
  13731. _: 1
  13732. }, 8, ["name"])
  13733. ], 2);
  13734. };
  13735. }
  13736. });
  13737. var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "badge.vue"]]);
  13738. const ElBadge = withInstall(Badge);
  13739. const breadcrumbProps = buildProps({
  13740. separator: {
  13741. type: String,
  13742. default: "/"
  13743. },
  13744. separatorIcon: {
  13745. type: iconPropType
  13746. }
  13747. });
  13748. const __default__$1g = vue.defineComponent({
  13749. name: "ElBreadcrumb"
  13750. });
  13751. const _sfc_main$1Y = /* @__PURE__ */ vue.defineComponent({
  13752. ...__default__$1g,
  13753. props: breadcrumbProps,
  13754. setup(__props) {
  13755. const props = __props;
  13756. const ns = useNamespace("breadcrumb");
  13757. const breadcrumb = vue.ref();
  13758. vue.provide(breadcrumbKey, props);
  13759. vue.onMounted(() => {
  13760. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  13761. if (items.length) {
  13762. items[items.length - 1].setAttribute("aria-current", "page");
  13763. }
  13764. });
  13765. return (_ctx, _cache) => {
  13766. return vue.openBlock(), vue.createElementBlock("div", {
  13767. ref_key: "breadcrumb",
  13768. ref: breadcrumb,
  13769. class: vue.normalizeClass(vue.unref(ns).b()),
  13770. "aria-label": "Breadcrumb",
  13771. role: "navigation"
  13772. }, [
  13773. vue.renderSlot(_ctx.$slots, "default")
  13774. ], 2);
  13775. };
  13776. }
  13777. });
  13778. var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "breadcrumb.vue"]]);
  13779. const breadcrumbItemProps = buildProps({
  13780. to: {
  13781. type: definePropType([String, Object]),
  13782. default: ""
  13783. },
  13784. replace: {
  13785. type: Boolean,
  13786. default: false
  13787. }
  13788. });
  13789. const __default__$1f = vue.defineComponent({
  13790. name: "ElBreadcrumbItem"
  13791. });
  13792. const _sfc_main$1X = /* @__PURE__ */ vue.defineComponent({
  13793. ...__default__$1f,
  13794. props: breadcrumbItemProps,
  13795. setup(__props) {
  13796. const props = __props;
  13797. const instance = vue.getCurrentInstance();
  13798. const breadcrumbContext = vue.inject(breadcrumbKey, void 0);
  13799. const ns = useNamespace("breadcrumb");
  13800. const { separator, separatorIcon } = vue.toRefs(breadcrumbContext);
  13801. const router = instance.appContext.config.globalProperties.$router;
  13802. const link = vue.ref();
  13803. const onClick = () => {
  13804. if (!props.to || !router)
  13805. return;
  13806. props.replace ? router.replace(props.to) : router.push(props.to);
  13807. };
  13808. return (_ctx, _cache) => {
  13809. return vue.openBlock(), vue.createElementBlock("span", {
  13810. class: vue.normalizeClass(vue.unref(ns).e("item"))
  13811. }, [
  13812. vue.createElementVNode("span", {
  13813. ref_key: "link",
  13814. ref: link,
  13815. class: vue.normalizeClass([vue.unref(ns).e("inner"), vue.unref(ns).is("link", !!_ctx.to)]),
  13816. role: "link",
  13817. onClick
  13818. }, [
  13819. vue.renderSlot(_ctx.$slots, "default")
  13820. ], 2),
  13821. vue.unref(separatorIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13822. key: 0,
  13823. class: vue.normalizeClass(vue.unref(ns).e("separator"))
  13824. }, {
  13825. default: vue.withCtx(() => [
  13826. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(separatorIcon))))
  13827. ]),
  13828. _: 1
  13829. }, 8, ["class"])) : (vue.openBlock(), vue.createElementBlock("span", {
  13830. key: 1,
  13831. class: vue.normalizeClass(vue.unref(ns).e("separator")),
  13832. role: "presentation"
  13833. }, vue.toDisplayString(vue.unref(separator)), 3))
  13834. ], 2);
  13835. };
  13836. }
  13837. });
  13838. var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "breadcrumb-item.vue"]]);
  13839. const ElBreadcrumb = withInstall(Breadcrumb, {
  13840. BreadcrumbItem
  13841. });
  13842. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  13843. const useButton = (props, emit) => {
  13844. useDeprecated({
  13845. from: "type.text",
  13846. replacement: "link",
  13847. version: "3.0.0",
  13848. scope: "props",
  13849. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  13850. }, vue.computed(() => props.type === "text"));
  13851. const buttonGroupContext = vue.inject(buttonGroupContextKey, void 0);
  13852. const globalConfig = useGlobalConfig("button");
  13853. const { form } = useFormItem();
  13854. const _size = useSize(vue.computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  13855. const _disabled = useDisabled();
  13856. const _ref = vue.ref();
  13857. const slots = vue.useSlots();
  13858. const _type = vue.computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  13859. const autoInsertSpace = vue.computed(() => {
  13860. var _a, _b, _c;
  13861. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
  13862. });
  13863. const shouldAddSpace = vue.computed(() => {
  13864. var _a;
  13865. const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
  13866. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  13867. const slot = defaultSlot[0];
  13868. if ((slot == null ? void 0 : slot.type) === vue.Text) {
  13869. const text = slot.children;
  13870. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  13871. }
  13872. }
  13873. return false;
  13874. });
  13875. const handleClick = (evt) => {
  13876. if (props.nativeType === "reset") {
  13877. form == null ? void 0 : form.resetFields();
  13878. }
  13879. emit("click", evt);
  13880. };
  13881. return {
  13882. _disabled,
  13883. _size,
  13884. _type,
  13885. _ref,
  13886. shouldAddSpace,
  13887. handleClick
  13888. };
  13889. };
  13890. const buttonTypes = [
  13891. "default",
  13892. "primary",
  13893. "success",
  13894. "warning",
  13895. "info",
  13896. "danger",
  13897. "text",
  13898. ""
  13899. ];
  13900. const buttonNativeTypes = ["button", "submit", "reset"];
  13901. const buttonProps = buildProps({
  13902. size: useSizeProp,
  13903. disabled: Boolean,
  13904. type: {
  13905. type: String,
  13906. values: buttonTypes,
  13907. default: ""
  13908. },
  13909. icon: {
  13910. type: iconPropType
  13911. },
  13912. nativeType: {
  13913. type: String,
  13914. values: buttonNativeTypes,
  13915. default: "button"
  13916. },
  13917. loading: Boolean,
  13918. loadingIcon: {
  13919. type: iconPropType,
  13920. default: () => loading_default
  13921. },
  13922. plain: Boolean,
  13923. text: Boolean,
  13924. link: Boolean,
  13925. bg: Boolean,
  13926. autofocus: Boolean,
  13927. round: Boolean,
  13928. circle: Boolean,
  13929. color: String,
  13930. dark: Boolean,
  13931. autoInsertSpace: {
  13932. type: Boolean,
  13933. default: void 0
  13934. }
  13935. });
  13936. const buttonEmits = {
  13937. click: (evt) => evt instanceof MouseEvent
  13938. };
  13939. function bound01$1(n, max) {
  13940. if (isOnePointZero$1(n)) {
  13941. n = "100%";
  13942. }
  13943. var isPercent = isPercentage$1(n);
  13944. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  13945. if (isPercent) {
  13946. n = parseInt(String(n * max), 10) / 100;
  13947. }
  13948. if (Math.abs(n - max) < 1e-6) {
  13949. return 1;
  13950. }
  13951. if (max === 360) {
  13952. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  13953. } else {
  13954. n = n % max / parseFloat(String(max));
  13955. }
  13956. return n;
  13957. }
  13958. function clamp01(val) {
  13959. return Math.min(1, Math.max(0, val));
  13960. }
  13961. function isOnePointZero$1(n) {
  13962. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  13963. }
  13964. function isPercentage$1(n) {
  13965. return typeof n === "string" && n.indexOf("%") !== -1;
  13966. }
  13967. function boundAlpha(a) {
  13968. a = parseFloat(a);
  13969. if (isNaN(a) || a < 0 || a > 1) {
  13970. a = 1;
  13971. }
  13972. return a;
  13973. }
  13974. function convertToPercentage(n) {
  13975. if (n <= 1) {
  13976. return "".concat(Number(n) * 100, "%");
  13977. }
  13978. return n;
  13979. }
  13980. function pad2(c) {
  13981. return c.length === 1 ? "0" + c : String(c);
  13982. }
  13983. function rgbToRgb(r, g, b) {
  13984. return {
  13985. r: bound01$1(r, 255) * 255,
  13986. g: bound01$1(g, 255) * 255,
  13987. b: bound01$1(b, 255) * 255
  13988. };
  13989. }
  13990. function rgbToHsl(r, g, b) {
  13991. r = bound01$1(r, 255);
  13992. g = bound01$1(g, 255);
  13993. b = bound01$1(b, 255);
  13994. var max = Math.max(r, g, b);
  13995. var min = Math.min(r, g, b);
  13996. var h = 0;
  13997. var s = 0;
  13998. var l = (max + min) / 2;
  13999. if (max === min) {
  14000. s = 0;
  14001. h = 0;
  14002. } else {
  14003. var d = max - min;
  14004. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  14005. switch (max) {
  14006. case r:
  14007. h = (g - b) / d + (g < b ? 6 : 0);
  14008. break;
  14009. case g:
  14010. h = (b - r) / d + 2;
  14011. break;
  14012. case b:
  14013. h = (r - g) / d + 4;
  14014. break;
  14015. }
  14016. h /= 6;
  14017. }
  14018. return { h, s, l };
  14019. }
  14020. function hue2rgb(p, q, t) {
  14021. if (t < 0) {
  14022. t += 1;
  14023. }
  14024. if (t > 1) {
  14025. t -= 1;
  14026. }
  14027. if (t < 1 / 6) {
  14028. return p + (q - p) * (6 * t);
  14029. }
  14030. if (t < 1 / 2) {
  14031. return q;
  14032. }
  14033. if (t < 2 / 3) {
  14034. return p + (q - p) * (2 / 3 - t) * 6;
  14035. }
  14036. return p;
  14037. }
  14038. function hslToRgb(h, s, l) {
  14039. var r;
  14040. var g;
  14041. var b;
  14042. h = bound01$1(h, 360);
  14043. s = bound01$1(s, 100);
  14044. l = bound01$1(l, 100);
  14045. if (s === 0) {
  14046. g = l;
  14047. b = l;
  14048. r = l;
  14049. } else {
  14050. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  14051. var p = 2 * l - q;
  14052. r = hue2rgb(p, q, h + 1 / 3);
  14053. g = hue2rgb(p, q, h);
  14054. b = hue2rgb(p, q, h - 1 / 3);
  14055. }
  14056. return { r: r * 255, g: g * 255, b: b * 255 };
  14057. }
  14058. function rgbToHsv(r, g, b) {
  14059. r = bound01$1(r, 255);
  14060. g = bound01$1(g, 255);
  14061. b = bound01$1(b, 255);
  14062. var max = Math.max(r, g, b);
  14063. var min = Math.min(r, g, b);
  14064. var h = 0;
  14065. var v = max;
  14066. var d = max - min;
  14067. var s = max === 0 ? 0 : d / max;
  14068. if (max === min) {
  14069. h = 0;
  14070. } else {
  14071. switch (max) {
  14072. case r:
  14073. h = (g - b) / d + (g < b ? 6 : 0);
  14074. break;
  14075. case g:
  14076. h = (b - r) / d + 2;
  14077. break;
  14078. case b:
  14079. h = (r - g) / d + 4;
  14080. break;
  14081. }
  14082. h /= 6;
  14083. }
  14084. return { h, s, v };
  14085. }
  14086. function hsvToRgb(h, s, v) {
  14087. h = bound01$1(h, 360) * 6;
  14088. s = bound01$1(s, 100);
  14089. v = bound01$1(v, 100);
  14090. var i = Math.floor(h);
  14091. var f = h - i;
  14092. var p = v * (1 - s);
  14093. var q = v * (1 - f * s);
  14094. var t = v * (1 - (1 - f) * s);
  14095. var mod = i % 6;
  14096. var r = [v, q, p, p, t, v][mod];
  14097. var g = [t, v, v, q, p, p][mod];
  14098. var b = [p, p, t, v, v, q][mod];
  14099. return { r: r * 255, g: g * 255, b: b * 255 };
  14100. }
  14101. function rgbToHex(r, g, b, allow3Char) {
  14102. var hex = [
  14103. pad2(Math.round(r).toString(16)),
  14104. pad2(Math.round(g).toString(16)),
  14105. pad2(Math.round(b).toString(16))
  14106. ];
  14107. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  14108. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  14109. }
  14110. return hex.join("");
  14111. }
  14112. function rgbaToHex(r, g, b, a, allow4Char) {
  14113. var hex = [
  14114. pad2(Math.round(r).toString(16)),
  14115. pad2(Math.round(g).toString(16)),
  14116. pad2(Math.round(b).toString(16)),
  14117. pad2(convertDecimalToHex(a))
  14118. ];
  14119. 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))) {
  14120. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  14121. }
  14122. return hex.join("");
  14123. }
  14124. function convertDecimalToHex(d) {
  14125. return Math.round(parseFloat(d) * 255).toString(16);
  14126. }
  14127. function convertHexToDecimal(h) {
  14128. return parseIntFromHex(h) / 255;
  14129. }
  14130. function parseIntFromHex(val) {
  14131. return parseInt(val, 16);
  14132. }
  14133. function numberInputToObject(color) {
  14134. return {
  14135. r: color >> 16,
  14136. g: (color & 65280) >> 8,
  14137. b: color & 255
  14138. };
  14139. }
  14140. var names = {
  14141. aliceblue: "#f0f8ff",
  14142. antiquewhite: "#faebd7",
  14143. aqua: "#00ffff",
  14144. aquamarine: "#7fffd4",
  14145. azure: "#f0ffff",
  14146. beige: "#f5f5dc",
  14147. bisque: "#ffe4c4",
  14148. black: "#000000",
  14149. blanchedalmond: "#ffebcd",
  14150. blue: "#0000ff",
  14151. blueviolet: "#8a2be2",
  14152. brown: "#a52a2a",
  14153. burlywood: "#deb887",
  14154. cadetblue: "#5f9ea0",
  14155. chartreuse: "#7fff00",
  14156. chocolate: "#d2691e",
  14157. coral: "#ff7f50",
  14158. cornflowerblue: "#6495ed",
  14159. cornsilk: "#fff8dc",
  14160. crimson: "#dc143c",
  14161. cyan: "#00ffff",
  14162. darkblue: "#00008b",
  14163. darkcyan: "#008b8b",
  14164. darkgoldenrod: "#b8860b",
  14165. darkgray: "#a9a9a9",
  14166. darkgreen: "#006400",
  14167. darkgrey: "#a9a9a9",
  14168. darkkhaki: "#bdb76b",
  14169. darkmagenta: "#8b008b",
  14170. darkolivegreen: "#556b2f",
  14171. darkorange: "#ff8c00",
  14172. darkorchid: "#9932cc",
  14173. darkred: "#8b0000",
  14174. darksalmon: "#e9967a",
  14175. darkseagreen: "#8fbc8f",
  14176. darkslateblue: "#483d8b",
  14177. darkslategray: "#2f4f4f",
  14178. darkslategrey: "#2f4f4f",
  14179. darkturquoise: "#00ced1",
  14180. darkviolet: "#9400d3",
  14181. deeppink: "#ff1493",
  14182. deepskyblue: "#00bfff",
  14183. dimgray: "#696969",
  14184. dimgrey: "#696969",
  14185. dodgerblue: "#1e90ff",
  14186. firebrick: "#b22222",
  14187. floralwhite: "#fffaf0",
  14188. forestgreen: "#228b22",
  14189. fuchsia: "#ff00ff",
  14190. gainsboro: "#dcdcdc",
  14191. ghostwhite: "#f8f8ff",
  14192. goldenrod: "#daa520",
  14193. gold: "#ffd700",
  14194. gray: "#808080",
  14195. green: "#008000",
  14196. greenyellow: "#adff2f",
  14197. grey: "#808080",
  14198. honeydew: "#f0fff0",
  14199. hotpink: "#ff69b4",
  14200. indianred: "#cd5c5c",
  14201. indigo: "#4b0082",
  14202. ivory: "#fffff0",
  14203. khaki: "#f0e68c",
  14204. lavenderblush: "#fff0f5",
  14205. lavender: "#e6e6fa",
  14206. lawngreen: "#7cfc00",
  14207. lemonchiffon: "#fffacd",
  14208. lightblue: "#add8e6",
  14209. lightcoral: "#f08080",
  14210. lightcyan: "#e0ffff",
  14211. lightgoldenrodyellow: "#fafad2",
  14212. lightgray: "#d3d3d3",
  14213. lightgreen: "#90ee90",
  14214. lightgrey: "#d3d3d3",
  14215. lightpink: "#ffb6c1",
  14216. lightsalmon: "#ffa07a",
  14217. lightseagreen: "#20b2aa",
  14218. lightskyblue: "#87cefa",
  14219. lightslategray: "#778899",
  14220. lightslategrey: "#778899",
  14221. lightsteelblue: "#b0c4de",
  14222. lightyellow: "#ffffe0",
  14223. lime: "#00ff00",
  14224. limegreen: "#32cd32",
  14225. linen: "#faf0e6",
  14226. magenta: "#ff00ff",
  14227. maroon: "#800000",
  14228. mediumaquamarine: "#66cdaa",
  14229. mediumblue: "#0000cd",
  14230. mediumorchid: "#ba55d3",
  14231. mediumpurple: "#9370db",
  14232. mediumseagreen: "#3cb371",
  14233. mediumslateblue: "#7b68ee",
  14234. mediumspringgreen: "#00fa9a",
  14235. mediumturquoise: "#48d1cc",
  14236. mediumvioletred: "#c71585",
  14237. midnightblue: "#191970",
  14238. mintcream: "#f5fffa",
  14239. mistyrose: "#ffe4e1",
  14240. moccasin: "#ffe4b5",
  14241. navajowhite: "#ffdead",
  14242. navy: "#000080",
  14243. oldlace: "#fdf5e6",
  14244. olive: "#808000",
  14245. olivedrab: "#6b8e23",
  14246. orange: "#ffa500",
  14247. orangered: "#ff4500",
  14248. orchid: "#da70d6",
  14249. palegoldenrod: "#eee8aa",
  14250. palegreen: "#98fb98",
  14251. paleturquoise: "#afeeee",
  14252. palevioletred: "#db7093",
  14253. papayawhip: "#ffefd5",
  14254. peachpuff: "#ffdab9",
  14255. peru: "#cd853f",
  14256. pink: "#ffc0cb",
  14257. plum: "#dda0dd",
  14258. powderblue: "#b0e0e6",
  14259. purple: "#800080",
  14260. rebeccapurple: "#663399",
  14261. red: "#ff0000",
  14262. rosybrown: "#bc8f8f",
  14263. royalblue: "#4169e1",
  14264. saddlebrown: "#8b4513",
  14265. salmon: "#fa8072",
  14266. sandybrown: "#f4a460",
  14267. seagreen: "#2e8b57",
  14268. seashell: "#fff5ee",
  14269. sienna: "#a0522d",
  14270. silver: "#c0c0c0",
  14271. skyblue: "#87ceeb",
  14272. slateblue: "#6a5acd",
  14273. slategray: "#708090",
  14274. slategrey: "#708090",
  14275. snow: "#fffafa",
  14276. springgreen: "#00ff7f",
  14277. steelblue: "#4682b4",
  14278. tan: "#d2b48c",
  14279. teal: "#008080",
  14280. thistle: "#d8bfd8",
  14281. tomato: "#ff6347",
  14282. turquoise: "#40e0d0",
  14283. violet: "#ee82ee",
  14284. wheat: "#f5deb3",
  14285. white: "#ffffff",
  14286. whitesmoke: "#f5f5f5",
  14287. yellow: "#ffff00",
  14288. yellowgreen: "#9acd32"
  14289. };
  14290. function inputToRGB(color) {
  14291. var rgb = { r: 0, g: 0, b: 0 };
  14292. var a = 1;
  14293. var s = null;
  14294. var v = null;
  14295. var l = null;
  14296. var ok = false;
  14297. var format = false;
  14298. if (typeof color === "string") {
  14299. color = stringInputToObject(color);
  14300. }
  14301. if (typeof color === "object") {
  14302. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  14303. rgb = rgbToRgb(color.r, color.g, color.b);
  14304. ok = true;
  14305. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  14306. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  14307. s = convertToPercentage(color.s);
  14308. v = convertToPercentage(color.v);
  14309. rgb = hsvToRgb(color.h, s, v);
  14310. ok = true;
  14311. format = "hsv";
  14312. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  14313. s = convertToPercentage(color.s);
  14314. l = convertToPercentage(color.l);
  14315. rgb = hslToRgb(color.h, s, l);
  14316. ok = true;
  14317. format = "hsl";
  14318. }
  14319. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  14320. a = color.a;
  14321. }
  14322. }
  14323. a = boundAlpha(a);
  14324. return {
  14325. ok,
  14326. format: color.format || format,
  14327. r: Math.min(255, Math.max(rgb.r, 0)),
  14328. g: Math.min(255, Math.max(rgb.g, 0)),
  14329. b: Math.min(255, Math.max(rgb.b, 0)),
  14330. a
  14331. };
  14332. }
  14333. var CSS_INTEGER = "[-\\+]?\\d+%?";
  14334. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  14335. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  14336. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  14337. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  14338. var matchers = {
  14339. CSS_UNIT: new RegExp(CSS_UNIT),
  14340. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  14341. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  14342. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  14343. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  14344. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  14345. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  14346. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  14347. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  14348. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  14349. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  14350. };
  14351. function stringInputToObject(color) {
  14352. color = color.trim().toLowerCase();
  14353. if (color.length === 0) {
  14354. return false;
  14355. }
  14356. var named = false;
  14357. if (names[color]) {
  14358. color = names[color];
  14359. named = true;
  14360. } else if (color === "transparent") {
  14361. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  14362. }
  14363. var match = matchers.rgb.exec(color);
  14364. if (match) {
  14365. return { r: match[1], g: match[2], b: match[3] };
  14366. }
  14367. match = matchers.rgba.exec(color);
  14368. if (match) {
  14369. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  14370. }
  14371. match = matchers.hsl.exec(color);
  14372. if (match) {
  14373. return { h: match[1], s: match[2], l: match[3] };
  14374. }
  14375. match = matchers.hsla.exec(color);
  14376. if (match) {
  14377. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  14378. }
  14379. match = matchers.hsv.exec(color);
  14380. if (match) {
  14381. return { h: match[1], s: match[2], v: match[3] };
  14382. }
  14383. match = matchers.hsva.exec(color);
  14384. if (match) {
  14385. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  14386. }
  14387. match = matchers.hex8.exec(color);
  14388. if (match) {
  14389. return {
  14390. r: parseIntFromHex(match[1]),
  14391. g: parseIntFromHex(match[2]),
  14392. b: parseIntFromHex(match[3]),
  14393. a: convertHexToDecimal(match[4]),
  14394. format: named ? "name" : "hex8"
  14395. };
  14396. }
  14397. match = matchers.hex6.exec(color);
  14398. if (match) {
  14399. return {
  14400. r: parseIntFromHex(match[1]),
  14401. g: parseIntFromHex(match[2]),
  14402. b: parseIntFromHex(match[3]),
  14403. format: named ? "name" : "hex"
  14404. };
  14405. }
  14406. match = matchers.hex4.exec(color);
  14407. if (match) {
  14408. return {
  14409. r: parseIntFromHex(match[1] + match[1]),
  14410. g: parseIntFromHex(match[2] + match[2]),
  14411. b: parseIntFromHex(match[3] + match[3]),
  14412. a: convertHexToDecimal(match[4] + match[4]),
  14413. format: named ? "name" : "hex8"
  14414. };
  14415. }
  14416. match = matchers.hex3.exec(color);
  14417. if (match) {
  14418. return {
  14419. r: parseIntFromHex(match[1] + match[1]),
  14420. g: parseIntFromHex(match[2] + match[2]),
  14421. b: parseIntFromHex(match[3] + match[3]),
  14422. format: named ? "name" : "hex"
  14423. };
  14424. }
  14425. return false;
  14426. }
  14427. function isValidCSSUnit(color) {
  14428. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  14429. }
  14430. var TinyColor = function() {
  14431. function TinyColor2(color, opts) {
  14432. if (color === void 0) {
  14433. color = "";
  14434. }
  14435. if (opts === void 0) {
  14436. opts = {};
  14437. }
  14438. var _a;
  14439. if (color instanceof TinyColor2) {
  14440. return color;
  14441. }
  14442. if (typeof color === "number") {
  14443. color = numberInputToObject(color);
  14444. }
  14445. this.originalInput = color;
  14446. var rgb = inputToRGB(color);
  14447. this.originalInput = color;
  14448. this.r = rgb.r;
  14449. this.g = rgb.g;
  14450. this.b = rgb.b;
  14451. this.a = rgb.a;
  14452. this.roundA = Math.round(100 * this.a) / 100;
  14453. this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
  14454. this.gradientType = opts.gradientType;
  14455. if (this.r < 1) {
  14456. this.r = Math.round(this.r);
  14457. }
  14458. if (this.g < 1) {
  14459. this.g = Math.round(this.g);
  14460. }
  14461. if (this.b < 1) {
  14462. this.b = Math.round(this.b);
  14463. }
  14464. this.isValid = rgb.ok;
  14465. }
  14466. TinyColor2.prototype.isDark = function() {
  14467. return this.getBrightness() < 128;
  14468. };
  14469. TinyColor2.prototype.isLight = function() {
  14470. return !this.isDark();
  14471. };
  14472. TinyColor2.prototype.getBrightness = function() {
  14473. var rgb = this.toRgb();
  14474. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  14475. };
  14476. TinyColor2.prototype.getLuminance = function() {
  14477. var rgb = this.toRgb();
  14478. var R;
  14479. var G;
  14480. var B;
  14481. var RsRGB = rgb.r / 255;
  14482. var GsRGB = rgb.g / 255;
  14483. var BsRGB = rgb.b / 255;
  14484. if (RsRGB <= 0.03928) {
  14485. R = RsRGB / 12.92;
  14486. } else {
  14487. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  14488. }
  14489. if (GsRGB <= 0.03928) {
  14490. G = GsRGB / 12.92;
  14491. } else {
  14492. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  14493. }
  14494. if (BsRGB <= 0.03928) {
  14495. B = BsRGB / 12.92;
  14496. } else {
  14497. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  14498. }
  14499. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  14500. };
  14501. TinyColor2.prototype.getAlpha = function() {
  14502. return this.a;
  14503. };
  14504. TinyColor2.prototype.setAlpha = function(alpha) {
  14505. this.a = boundAlpha(alpha);
  14506. this.roundA = Math.round(100 * this.a) / 100;
  14507. return this;
  14508. };
  14509. TinyColor2.prototype.toHsv = function() {
  14510. var hsv = rgbToHsv(this.r, this.g, this.b);
  14511. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  14512. };
  14513. TinyColor2.prototype.toHsvString = function() {
  14514. var hsv = rgbToHsv(this.r, this.g, this.b);
  14515. var h = Math.round(hsv.h * 360);
  14516. var s = Math.round(hsv.s * 100);
  14517. var v = Math.round(hsv.v * 100);
  14518. return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  14519. };
  14520. TinyColor2.prototype.toHsl = function() {
  14521. var hsl = rgbToHsl(this.r, this.g, this.b);
  14522. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  14523. };
  14524. TinyColor2.prototype.toHslString = function() {
  14525. var hsl = rgbToHsl(this.r, this.g, this.b);
  14526. var h = Math.round(hsl.h * 360);
  14527. var s = Math.round(hsl.s * 100);
  14528. var l = Math.round(hsl.l * 100);
  14529. return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  14530. };
  14531. TinyColor2.prototype.toHex = function(allow3Char) {
  14532. if (allow3Char === void 0) {
  14533. allow3Char = false;
  14534. }
  14535. return rgbToHex(this.r, this.g, this.b, allow3Char);
  14536. };
  14537. TinyColor2.prototype.toHexString = function(allow3Char) {
  14538. if (allow3Char === void 0) {
  14539. allow3Char = false;
  14540. }
  14541. return "#" + this.toHex(allow3Char);
  14542. };
  14543. TinyColor2.prototype.toHex8 = function(allow4Char) {
  14544. if (allow4Char === void 0) {
  14545. allow4Char = false;
  14546. }
  14547. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  14548. };
  14549. TinyColor2.prototype.toHex8String = function(allow4Char) {
  14550. if (allow4Char === void 0) {
  14551. allow4Char = false;
  14552. }
  14553. return "#" + this.toHex8(allow4Char);
  14554. };
  14555. TinyColor2.prototype.toRgb = function() {
  14556. return {
  14557. r: Math.round(this.r),
  14558. g: Math.round(this.g),
  14559. b: Math.round(this.b),
  14560. a: this.a
  14561. };
  14562. };
  14563. TinyColor2.prototype.toRgbString = function() {
  14564. var r = Math.round(this.r);
  14565. var g = Math.round(this.g);
  14566. var b = Math.round(this.b);
  14567. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  14568. };
  14569. TinyColor2.prototype.toPercentageRgb = function() {
  14570. var fmt = function(x) {
  14571. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  14572. };
  14573. return {
  14574. r: fmt(this.r),
  14575. g: fmt(this.g),
  14576. b: fmt(this.b),
  14577. a: this.a
  14578. };
  14579. };
  14580. TinyColor2.prototype.toPercentageRgbString = function() {
  14581. var rnd = function(x) {
  14582. return Math.round(bound01$1(x, 255) * 100);
  14583. };
  14584. 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, ")");
  14585. };
  14586. TinyColor2.prototype.toName = function() {
  14587. if (this.a === 0) {
  14588. return "transparent";
  14589. }
  14590. if (this.a < 1) {
  14591. return false;
  14592. }
  14593. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  14594. for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
  14595. var _b = _a[_i], key = _b[0], value = _b[1];
  14596. if (hex === value) {
  14597. return key;
  14598. }
  14599. }
  14600. return false;
  14601. };
  14602. TinyColor2.prototype.toString = function(format) {
  14603. var formatSet = Boolean(format);
  14604. format = format !== null && format !== void 0 ? format : this.format;
  14605. var formattedString = false;
  14606. var hasAlpha = this.a < 1 && this.a >= 0;
  14607. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  14608. if (needsAlphaFormat) {
  14609. if (format === "name" && this.a === 0) {
  14610. return this.toName();
  14611. }
  14612. return this.toRgbString();
  14613. }
  14614. if (format === "rgb") {
  14615. formattedString = this.toRgbString();
  14616. }
  14617. if (format === "prgb") {
  14618. formattedString = this.toPercentageRgbString();
  14619. }
  14620. if (format === "hex" || format === "hex6") {
  14621. formattedString = this.toHexString();
  14622. }
  14623. if (format === "hex3") {
  14624. formattedString = this.toHexString(true);
  14625. }
  14626. if (format === "hex4") {
  14627. formattedString = this.toHex8String(true);
  14628. }
  14629. if (format === "hex8") {
  14630. formattedString = this.toHex8String();
  14631. }
  14632. if (format === "name") {
  14633. formattedString = this.toName();
  14634. }
  14635. if (format === "hsl") {
  14636. formattedString = this.toHslString();
  14637. }
  14638. if (format === "hsv") {
  14639. formattedString = this.toHsvString();
  14640. }
  14641. return formattedString || this.toHexString();
  14642. };
  14643. TinyColor2.prototype.toNumber = function() {
  14644. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  14645. };
  14646. TinyColor2.prototype.clone = function() {
  14647. return new TinyColor2(this.toString());
  14648. };
  14649. TinyColor2.prototype.lighten = function(amount) {
  14650. if (amount === void 0) {
  14651. amount = 10;
  14652. }
  14653. var hsl = this.toHsl();
  14654. hsl.l += amount / 100;
  14655. hsl.l = clamp01(hsl.l);
  14656. return new TinyColor2(hsl);
  14657. };
  14658. TinyColor2.prototype.brighten = function(amount) {
  14659. if (amount === void 0) {
  14660. amount = 10;
  14661. }
  14662. var rgb = this.toRgb();
  14663. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  14664. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  14665. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  14666. return new TinyColor2(rgb);
  14667. };
  14668. TinyColor2.prototype.darken = function(amount) {
  14669. if (amount === void 0) {
  14670. amount = 10;
  14671. }
  14672. var hsl = this.toHsl();
  14673. hsl.l -= amount / 100;
  14674. hsl.l = clamp01(hsl.l);
  14675. return new TinyColor2(hsl);
  14676. };
  14677. TinyColor2.prototype.tint = function(amount) {
  14678. if (amount === void 0) {
  14679. amount = 10;
  14680. }
  14681. return this.mix("white", amount);
  14682. };
  14683. TinyColor2.prototype.shade = function(amount) {
  14684. if (amount === void 0) {
  14685. amount = 10;
  14686. }
  14687. return this.mix("black", amount);
  14688. };
  14689. TinyColor2.prototype.desaturate = function(amount) {
  14690. if (amount === void 0) {
  14691. amount = 10;
  14692. }
  14693. var hsl = this.toHsl();
  14694. hsl.s -= amount / 100;
  14695. hsl.s = clamp01(hsl.s);
  14696. return new TinyColor2(hsl);
  14697. };
  14698. TinyColor2.prototype.saturate = function(amount) {
  14699. if (amount === void 0) {
  14700. amount = 10;
  14701. }
  14702. var hsl = this.toHsl();
  14703. hsl.s += amount / 100;
  14704. hsl.s = clamp01(hsl.s);
  14705. return new TinyColor2(hsl);
  14706. };
  14707. TinyColor2.prototype.greyscale = function() {
  14708. return this.desaturate(100);
  14709. };
  14710. TinyColor2.prototype.spin = function(amount) {
  14711. var hsl = this.toHsl();
  14712. var hue = (hsl.h + amount) % 360;
  14713. hsl.h = hue < 0 ? 360 + hue : hue;
  14714. return new TinyColor2(hsl);
  14715. };
  14716. TinyColor2.prototype.mix = function(color, amount) {
  14717. if (amount === void 0) {
  14718. amount = 50;
  14719. }
  14720. var rgb1 = this.toRgb();
  14721. var rgb2 = new TinyColor2(color).toRgb();
  14722. var p = amount / 100;
  14723. var rgba = {
  14724. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  14725. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  14726. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  14727. a: (rgb2.a - rgb1.a) * p + rgb1.a
  14728. };
  14729. return new TinyColor2(rgba);
  14730. };
  14731. TinyColor2.prototype.analogous = function(results, slices) {
  14732. if (results === void 0) {
  14733. results = 6;
  14734. }
  14735. if (slices === void 0) {
  14736. slices = 30;
  14737. }
  14738. var hsl = this.toHsl();
  14739. var part = 360 / slices;
  14740. var ret = [this];
  14741. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  14742. hsl.h = (hsl.h + part) % 360;
  14743. ret.push(new TinyColor2(hsl));
  14744. }
  14745. return ret;
  14746. };
  14747. TinyColor2.prototype.complement = function() {
  14748. var hsl = this.toHsl();
  14749. hsl.h = (hsl.h + 180) % 360;
  14750. return new TinyColor2(hsl);
  14751. };
  14752. TinyColor2.prototype.monochromatic = function(results) {
  14753. if (results === void 0) {
  14754. results = 6;
  14755. }
  14756. var hsv = this.toHsv();
  14757. var h = hsv.h;
  14758. var s = hsv.s;
  14759. var v = hsv.v;
  14760. var res = [];
  14761. var modification = 1 / results;
  14762. while (results--) {
  14763. res.push(new TinyColor2({ h, s, v }));
  14764. v = (v + modification) % 1;
  14765. }
  14766. return res;
  14767. };
  14768. TinyColor2.prototype.splitcomplement = function() {
  14769. var hsl = this.toHsl();
  14770. var h = hsl.h;
  14771. return [
  14772. this,
  14773. new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
  14774. new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
  14775. ];
  14776. };
  14777. TinyColor2.prototype.onBackground = function(background) {
  14778. var fg = this.toRgb();
  14779. var bg = new TinyColor2(background).toRgb();
  14780. return new TinyColor2({
  14781. r: bg.r + (fg.r - bg.r) * fg.a,
  14782. g: bg.g + (fg.g - bg.g) * fg.a,
  14783. b: bg.b + (fg.b - bg.b) * fg.a
  14784. });
  14785. };
  14786. TinyColor2.prototype.triad = function() {
  14787. return this.polyad(3);
  14788. };
  14789. TinyColor2.prototype.tetrad = function() {
  14790. return this.polyad(4);
  14791. };
  14792. TinyColor2.prototype.polyad = function(n) {
  14793. var hsl = this.toHsl();
  14794. var h = hsl.h;
  14795. var result = [this];
  14796. var increment = 360 / n;
  14797. for (var i = 1; i < n; i++) {
  14798. result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
  14799. }
  14800. return result;
  14801. };
  14802. TinyColor2.prototype.equals = function(color) {
  14803. return this.toRgbString() === new TinyColor2(color).toRgbString();
  14804. };
  14805. return TinyColor2;
  14806. }();
  14807. function darken(color, amount = 20) {
  14808. return color.mix("#141414", amount).toString();
  14809. }
  14810. function useButtonCustomStyle(props) {
  14811. const _disabled = useDisabled();
  14812. const ns = useNamespace("button");
  14813. return vue.computed(() => {
  14814. let styles = {};
  14815. const buttonColor = props.color;
  14816. if (buttonColor) {
  14817. const color = new TinyColor(buttonColor);
  14818. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  14819. if (props.plain) {
  14820. styles = ns.cssVarBlock({
  14821. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  14822. "text-color": buttonColor,
  14823. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  14824. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  14825. "hover-bg-color": buttonColor,
  14826. "hover-border-color": buttonColor,
  14827. "active-bg-color": activeBgColor,
  14828. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  14829. "active-border-color": activeBgColor
  14830. });
  14831. if (_disabled.value) {
  14832. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  14833. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  14834. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  14835. }
  14836. } else {
  14837. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  14838. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  14839. styles = ns.cssVarBlock({
  14840. "bg-color": buttonColor,
  14841. "text-color": textColor,
  14842. "border-color": buttonColor,
  14843. "hover-bg-color": hoverBgColor,
  14844. "hover-text-color": textColor,
  14845. "hover-border-color": hoverBgColor,
  14846. "active-bg-color": activeBgColor,
  14847. "active-border-color": activeBgColor
  14848. });
  14849. if (_disabled.value) {
  14850. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  14851. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  14852. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  14853. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  14854. }
  14855. }
  14856. }
  14857. return styles;
  14858. });
  14859. }
  14860. const _hoisted_1$_ = ["aria-disabled", "disabled", "autofocus", "type"];
  14861. const __default__$1e = vue.defineComponent({
  14862. name: "ElButton"
  14863. });
  14864. const _sfc_main$1W = /* @__PURE__ */ vue.defineComponent({
  14865. ...__default__$1e,
  14866. props: buttonProps,
  14867. emits: buttonEmits,
  14868. setup(__props, { expose, emit }) {
  14869. const props = __props;
  14870. const buttonStyle = useButtonCustomStyle(props);
  14871. const ns = useNamespace("button");
  14872. const { _ref, _size, _type, _disabled, shouldAddSpace, handleClick } = useButton(props, emit);
  14873. expose({
  14874. ref: _ref,
  14875. size: _size,
  14876. type: _type,
  14877. disabled: _disabled,
  14878. shouldAddSpace
  14879. });
  14880. return (_ctx, _cache) => {
  14881. return vue.openBlock(), vue.createElementBlock("button", {
  14882. ref_key: "_ref",
  14883. ref: _ref,
  14884. class: vue.normalizeClass([
  14885. vue.unref(ns).b(),
  14886. vue.unref(ns).m(vue.unref(_type)),
  14887. vue.unref(ns).m(vue.unref(_size)),
  14888. vue.unref(ns).is("disabled", vue.unref(_disabled)),
  14889. vue.unref(ns).is("loading", _ctx.loading),
  14890. vue.unref(ns).is("plain", _ctx.plain),
  14891. vue.unref(ns).is("round", _ctx.round),
  14892. vue.unref(ns).is("circle", _ctx.circle),
  14893. vue.unref(ns).is("text", _ctx.text),
  14894. vue.unref(ns).is("link", _ctx.link),
  14895. vue.unref(ns).is("has-bg", _ctx.bg)
  14896. ]),
  14897. "aria-disabled": vue.unref(_disabled) || _ctx.loading,
  14898. disabled: vue.unref(_disabled) || _ctx.loading,
  14899. autofocus: _ctx.autofocus,
  14900. type: _ctx.nativeType,
  14901. style: vue.normalizeStyle(vue.unref(buttonStyle)),
  14902. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleClick) && vue.unref(handleClick)(...args))
  14903. }, [
  14904. _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  14905. _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  14906. key: 1,
  14907. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  14908. }, {
  14909. default: vue.withCtx(() => [
  14910. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loadingIcon)))
  14911. ]),
  14912. _: 1
  14913. }, 8, ["class"]))
  14914. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  14915. default: vue.withCtx(() => [
  14916. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 })
  14917. ]),
  14918. _: 3
  14919. })) : vue.createCommentVNode("v-if", true),
  14920. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  14921. key: 2,
  14922. class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) })
  14923. }, [
  14924. vue.renderSlot(_ctx.$slots, "default")
  14925. ], 2)) : vue.createCommentVNode("v-if", true)
  14926. ], 14, _hoisted_1$_);
  14927. };
  14928. }
  14929. });
  14930. var Button = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "button.vue"]]);
  14931. const buttonGroupProps = {
  14932. size: buttonProps.size,
  14933. type: buttonProps.type
  14934. };
  14935. const __default__$1d = vue.defineComponent({
  14936. name: "ElButtonGroup"
  14937. });
  14938. const _sfc_main$1V = /* @__PURE__ */ vue.defineComponent({
  14939. ...__default__$1d,
  14940. props: buttonGroupProps,
  14941. setup(__props) {
  14942. const props = __props;
  14943. vue.provide(buttonGroupContextKey, vue.reactive({
  14944. size: vue.toRef(props, "size"),
  14945. type: vue.toRef(props, "type")
  14946. }));
  14947. const ns = useNamespace("button");
  14948. return (_ctx, _cache) => {
  14949. return vue.openBlock(), vue.createElementBlock("div", {
  14950. class: vue.normalizeClass(`${vue.unref(ns).b("group")}`)
  14951. }, [
  14952. vue.renderSlot(_ctx.$slots, "default")
  14953. ], 2);
  14954. };
  14955. }
  14956. });
  14957. var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "button-group.vue"]]);
  14958. const ElButton = withInstall(Button, {
  14959. ButtonGroup
  14960. });
  14961. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  14962. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  14963. var dayjs_min = {exports: {}};
  14964. (function(module, exports) {
  14965. !function(t, e) {
  14966. module.exports = e() ;
  14967. }(commonjsGlobal, function() {
  14968. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", $ = "Invalid Date", l = /^(\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("_") }, m = function(t2, e2, n2) {
  14969. var r2 = String(t2);
  14970. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  14971. }, g = { s: m, z: function(t2) {
  14972. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  14973. return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
  14974. }, m: function t2(e2, n2) {
  14975. if (e2.date() < n2.date())
  14976. return -t2(n2, e2);
  14977. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f);
  14978. return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
  14979. }, a: function(t2) {
  14980. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  14981. }, p: function(t2) {
  14982. return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  14983. }, u: function(t2) {
  14984. return t2 === void 0;
  14985. } }, v = "en", D = {};
  14986. D[v] = M;
  14987. var p = function(t2) {
  14988. return t2 instanceof _;
  14989. }, S = function t2(e2, n2, r2) {
  14990. var i2;
  14991. if (!e2)
  14992. return v;
  14993. if (typeof e2 == "string") {
  14994. var s2 = e2.toLowerCase();
  14995. D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
  14996. var u2 = e2.split("-");
  14997. if (!i2 && u2.length > 1)
  14998. return t2(u2[0]);
  14999. } else {
  15000. var a2 = e2.name;
  15001. D[a2] = e2, i2 = a2;
  15002. }
  15003. return !r2 && i2 && (v = i2), i2 || !r2 && v;
  15004. }, w = function(t2, e2) {
  15005. if (p(t2))
  15006. return t2.clone();
  15007. var n2 = typeof e2 == "object" ? e2 : {};
  15008. return n2.date = t2, n2.args = arguments, new _(n2);
  15009. }, O = g;
  15010. O.l = S, O.i = p, O.w = function(t2, e2) {
  15011. return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  15012. };
  15013. var _ = function() {
  15014. function M2(t2) {
  15015. this.$L = S(t2.locale, null, true), this.parse(t2);
  15016. }
  15017. var m2 = M2.prototype;
  15018. return m2.parse = function(t2) {
  15019. this.$d = function(t3) {
  15020. var e2 = t3.date, n2 = t3.utc;
  15021. if (e2 === null)
  15022. return new Date(NaN);
  15023. if (O.u(e2))
  15024. return new Date();
  15025. if (e2 instanceof Date)
  15026. return new Date(e2);
  15027. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  15028. var r2 = e2.match(l);
  15029. if (r2) {
  15030. var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
  15031. 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);
  15032. }
  15033. }
  15034. return new Date(e2);
  15035. }(t2), this.$x = t2.x || {}, this.init();
  15036. }, m2.init = function() {
  15037. var t2 = this.$d;
  15038. 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();
  15039. }, m2.$utils = function() {
  15040. return O;
  15041. }, m2.isValid = function() {
  15042. return !(this.$d.toString() === $);
  15043. }, m2.isSame = function(t2, e2) {
  15044. var n2 = w(t2);
  15045. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  15046. }, m2.isAfter = function(t2, e2) {
  15047. return w(t2) < this.startOf(e2);
  15048. }, m2.isBefore = function(t2, e2) {
  15049. return this.endOf(e2) < w(t2);
  15050. }, m2.$g = function(t2, e2, n2) {
  15051. return O.u(t2) ? this[e2] : this.set(n2, t2);
  15052. }, m2.unix = function() {
  15053. return Math.floor(this.valueOf() / 1e3);
  15054. }, m2.valueOf = function() {
  15055. return this.$d.getTime();
  15056. }, m2.startOf = function(t2, e2) {
  15057. var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), $2 = function(t3, e3) {
  15058. var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  15059. return r2 ? i2 : i2.endOf(a);
  15060. }, l2 = function(t3, e3) {
  15061. return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  15062. }, y2 = this.$W, M3 = this.$M, m3 = this.$D, g2 = "set" + (this.$u ? "UTC" : "");
  15063. switch (h2) {
  15064. case c:
  15065. return r2 ? $2(1, 0) : $2(31, 11);
  15066. case f:
  15067. return r2 ? $2(1, M3) : $2(0, M3 + 1);
  15068. case o:
  15069. var v2 = this.$locale().weekStart || 0, D2 = (y2 < v2 ? y2 + 7 : y2) - v2;
  15070. return $2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
  15071. case a:
  15072. case d:
  15073. return l2(g2 + "Hours", 0);
  15074. case u:
  15075. return l2(g2 + "Minutes", 1);
  15076. case s:
  15077. return l2(g2 + "Seconds", 2);
  15078. case i:
  15079. return l2(g2 + "Milliseconds", 3);
  15080. default:
  15081. return this.clone();
  15082. }
  15083. }, m2.endOf = function(t2) {
  15084. return this.startOf(t2, false);
  15085. }, m2.$set = function(t2, e2) {
  15086. var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), $2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], l2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
  15087. if (o2 === f || o2 === c) {
  15088. var y2 = this.clone().set(d, 1);
  15089. y2.$d[$2](l2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
  15090. } else
  15091. $2 && this.$d[$2](l2);
  15092. return this.init(), this;
  15093. }, m2.set = function(t2, e2) {
  15094. return this.clone().$set(t2, e2);
  15095. }, m2.get = function(t2) {
  15096. return this[O.p(t2)]();
  15097. }, m2.add = function(r2, h2) {
  15098. var d2, $2 = this;
  15099. r2 = Number(r2);
  15100. var l2 = O.p(h2), y2 = function(t2) {
  15101. var e2 = w($2);
  15102. return O.w(e2.date(e2.date() + Math.round(t2 * r2)), $2);
  15103. };
  15104. if (l2 === f)
  15105. return this.set(f, this.$M + r2);
  15106. if (l2 === c)
  15107. return this.set(c, this.$y + r2);
  15108. if (l2 === a)
  15109. return y2(1);
  15110. if (l2 === o)
  15111. return y2(7);
  15112. var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[l2] || 1, m3 = this.$d.getTime() + r2 * M3;
  15113. return O.w(m3, this);
  15114. }, m2.subtract = function(t2, e2) {
  15115. return this.add(-1 * t2, e2);
  15116. }, m2.format = function(t2) {
  15117. var e2 = this, n2 = this.$locale();
  15118. if (!this.isValid())
  15119. return n2.invalidDate || $;
  15120. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i3, s3) {
  15121. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
  15122. }, c2 = function(t3) {
  15123. return O.s(s2 % 12 || 12, t3, "0");
  15124. }, d2 = n2.meridiem || function(t3, e3, n3) {
  15125. var r3 = t3 < 12 ? "AM" : "PM";
  15126. return n3 ? r3.toLowerCase() : r3;
  15127. }, l2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i2 };
  15128. return r2.replace(y, function(t3, e3) {
  15129. return e3 || l2[t3] || i2.replace(":", "");
  15130. });
  15131. }, m2.utcOffset = function() {
  15132. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  15133. }, m2.diff = function(r2, d2, $2) {
  15134. var l2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, g2 = this - M3, v2 = O.m(this, M3);
  15135. return v2 = (l2 = {}, l2[c] = v2 / 12, l2[f] = v2, l2[h] = v2 / 3, l2[o] = (g2 - m3) / 6048e5, l2[a] = (g2 - m3) / 864e5, l2[u] = g2 / n, l2[s] = g2 / e, l2[i] = g2 / t, l2)[y2] || g2, $2 ? v2 : O.a(v2);
  15136. }, m2.daysInMonth = function() {
  15137. return this.endOf(f).$D;
  15138. }, m2.$locale = function() {
  15139. return D[this.$L];
  15140. }, m2.locale = function(t2, e2) {
  15141. if (!t2)
  15142. return this.$L;
  15143. var n2 = this.clone(), r2 = S(t2, e2, true);
  15144. return r2 && (n2.$L = r2), n2;
  15145. }, m2.clone = function() {
  15146. return O.w(this.$d, this);
  15147. }, m2.toDate = function() {
  15148. return new Date(this.valueOf());
  15149. }, m2.toJSON = function() {
  15150. return this.isValid() ? this.toISOString() : null;
  15151. }, m2.toISOString = function() {
  15152. return this.$d.toISOString();
  15153. }, m2.toString = function() {
  15154. return this.$d.toUTCString();
  15155. }, M2;
  15156. }(), T = _.prototype;
  15157. return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
  15158. T[t2[1]] = function(e2) {
  15159. return this.$g(e2, t2[0], t2[1]);
  15160. };
  15161. }), w.extend = function(t2, e2) {
  15162. return t2.$i || (t2(e2, _, w), t2.$i = true), w;
  15163. }, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
  15164. return w(1e3 * t2);
  15165. }, w.en = D[v], w.Ls = D, w.p = {}, w;
  15166. });
  15167. })(dayjs_min);
  15168. var dayjs = dayjs_min.exports;
  15169. var customParseFormat$1 = {exports: {}};
  15170. (function(module, exports) {
  15171. !function(e, t) {
  15172. module.exports = t() ;
  15173. }(commonjsGlobal, function() {
  15174. var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d\d/, r = /\d\d?/, i = /\d*[^-_:/,()\s\d]+/, o = {}, s = function(e2) {
  15175. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  15176. };
  15177. var a = function(e2) {
  15178. return function(t2) {
  15179. this[e2] = +t2;
  15180. };
  15181. }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  15182. (this.zone || (this.zone = {})).offset = function(e3) {
  15183. if (!e3)
  15184. return 0;
  15185. if (e3 === "Z")
  15186. return 0;
  15187. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  15188. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  15189. }(e2);
  15190. }], h = function(e2) {
  15191. var t2 = o[e2];
  15192. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  15193. }, u = function(e2, t2) {
  15194. var n2, r2 = o.meridiem;
  15195. if (r2) {
  15196. for (var i2 = 1; i2 <= 24; i2 += 1)
  15197. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  15198. n2 = i2 > 12;
  15199. break;
  15200. }
  15201. } else
  15202. n2 = e2 === (t2 ? "pm" : "PM");
  15203. return n2;
  15204. }, d = { A: [i, function(e2) {
  15205. this.afternoon = u(e2, false);
  15206. }], a: [i, function(e2) {
  15207. this.afternoon = u(e2, true);
  15208. }], S: [/\d/, function(e2) {
  15209. this.milliseconds = 100 * +e2;
  15210. }], SS: [n, function(e2) {
  15211. this.milliseconds = 10 * +e2;
  15212. }], SSS: [/\d{3}/, function(e2) {
  15213. this.milliseconds = +e2;
  15214. }], s: [r, a("seconds")], ss: [r, a("seconds")], m: [r, a("minutes")], mm: [r, a("minutes")], H: [r, a("hours")], h: [r, a("hours")], HH: [r, a("hours")], hh: [r, a("hours")], D: [r, a("day")], DD: [n, a("day")], Do: [i, function(e2) {
  15215. var t2 = o.ordinal, n2 = e2.match(/\d+/);
  15216. if (this.day = n2[0], t2)
  15217. for (var r2 = 1; r2 <= 31; r2 += 1)
  15218. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  15219. }], M: [r, a("month")], MM: [n, a("month")], MMM: [i, function(e2) {
  15220. var t2 = h("months"), n2 = (h("monthsShort") || t2.map(function(e3) {
  15221. return e3.slice(0, 3);
  15222. })).indexOf(e2) + 1;
  15223. if (n2 < 1)
  15224. throw new Error();
  15225. this.month = n2 % 12 || n2;
  15226. }], MMMM: [i, function(e2) {
  15227. var t2 = h("months").indexOf(e2) + 1;
  15228. if (t2 < 1)
  15229. throw new Error();
  15230. this.month = t2 % 12 || t2;
  15231. }], Y: [/[+-]?\d+/, a("year")], YY: [n, function(e2) {
  15232. this.year = s(e2);
  15233. }], YYYY: [/\d{4}/, a("year")], Z: f, ZZ: f };
  15234. function c(n2) {
  15235. var r2, i2;
  15236. r2 = n2, i2 = o && o.formats;
  15237. for (var s2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  15238. var o2 = r3 && r3.toUpperCase();
  15239. return n3 || i2[r3] || e[r3] || i2[o2].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  15240. return t3 || n4.slice(1);
  15241. });
  15242. })).match(t), a2 = s2.length, f2 = 0; f2 < a2; f2 += 1) {
  15243. var h2 = s2[f2], u2 = d[h2], c2 = u2 && u2[0], l = u2 && u2[1];
  15244. s2[f2] = l ? { regex: c2, parser: l } : h2.replace(/^\[|\]$/g, "");
  15245. }
  15246. return function(e2) {
  15247. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
  15248. var i3 = s2[n3];
  15249. if (typeof i3 == "string")
  15250. r3 += i3.length;
  15251. else {
  15252. var o2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = o2.exec(h3)[0];
  15253. f3.call(t2, u3), e2 = e2.replace(u3, "");
  15254. }
  15255. }
  15256. return function(e3) {
  15257. var t3 = e3.afternoon;
  15258. if (t3 !== void 0) {
  15259. var n4 = e3.hours;
  15260. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  15261. }
  15262. }(t2), t2;
  15263. };
  15264. }
  15265. return function(e2, t2, n2) {
  15266. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s = e2.parseTwoDigitYear);
  15267. var r2 = t2.prototype, i2 = r2.parse;
  15268. r2.parse = function(e3) {
  15269. var t3 = e3.date, r3 = e3.utc, s2 = e3.args;
  15270. this.$u = r3;
  15271. var a2 = s2[1];
  15272. if (typeof a2 == "string") {
  15273. var f2 = s2[2] === true, h2 = s2[3] === true, u2 = f2 || h2, d2 = s2[2];
  15274. h2 && (d2 = s2[2]), o = this.$locale(), !f2 && d2 && (o = n2.Ls[d2]), this.$d = function(e4, t4, n3) {
  15275. try {
  15276. if (["x", "X"].indexOf(t4) > -1)
  15277. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  15278. var r4 = c(t4)(e4), i3 = r4.year, o2 = r4.month, s3 = r4.day, a3 = r4.hours, f3 = r4.minutes, h3 = r4.seconds, u3 = r4.milliseconds, d3 = r4.zone, l2 = new Date(), m2 = s3 || (i3 || o2 ? 1 : l2.getDate()), M2 = i3 || l2.getFullYear(), Y = 0;
  15279. i3 && !o2 || (Y = o2 > 0 ? o2 - 1 : l2.getMonth());
  15280. var p = a3 || 0, v = f3 || 0, D = h3 || 0, g = u3 || 0;
  15281. return d3 ? new Date(Date.UTC(M2, Y, m2, p, v, D, g + 60 * d3.offset * 1e3)) : n3 ? new Date(Date.UTC(M2, Y, m2, p, v, D, g)) : new Date(M2, Y, m2, p, v, D, g);
  15282. } catch (e5) {
  15283. return new Date("");
  15284. }
  15285. }(t3, a2, r3), this.init(), d2 && d2 !== true && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = new Date("")), o = {};
  15286. } else if (a2 instanceof Array)
  15287. for (var l = a2.length, m = 1; m <= l; m += 1) {
  15288. s2[1] = a2[m - 1];
  15289. var M = n2.apply(this, s2);
  15290. if (M.isValid()) {
  15291. this.$d = M.$d, this.$L = M.$L, this.init();
  15292. break;
  15293. }
  15294. m === l && (this.$d = new Date(""));
  15295. }
  15296. else
  15297. i2.call(this, e3);
  15298. };
  15299. };
  15300. });
  15301. })(customParseFormat$1);
  15302. var customParseFormat = customParseFormat$1.exports;
  15303. const timeUnits = ["hours", "minutes", "seconds"];
  15304. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  15305. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  15306. const DEFAULT_FORMATS_DATEPICKER = {
  15307. date: DEFAULT_FORMATS_DATE,
  15308. dates: DEFAULT_FORMATS_DATE,
  15309. week: "gggg[w]ww",
  15310. year: "YYYY",
  15311. month: "YYYY-MM",
  15312. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  15313. monthrange: "YYYY-MM",
  15314. daterange: DEFAULT_FORMATS_DATE,
  15315. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  15316. };
  15317. const buildTimeList = (value, bound) => {
  15318. return [
  15319. value > 0 ? value - 1 : void 0,
  15320. value,
  15321. value < bound ? value + 1 : void 0
  15322. ];
  15323. };
  15324. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  15325. const extractDateFormat = (format) => {
  15326. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  15327. };
  15328. const extractTimeFormat = (format) => {
  15329. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  15330. };
  15331. const dateEquals = function(a, b) {
  15332. const aIsDate = isDate(a);
  15333. const bIsDate = isDate(b);
  15334. if (aIsDate && bIsDate) {
  15335. return a.getTime() === b.getTime();
  15336. }
  15337. if (!aIsDate && !bIsDate) {
  15338. return a === b;
  15339. }
  15340. return false;
  15341. };
  15342. const valueEquals = function(a, b) {
  15343. const aIsArray = isArray(a);
  15344. const bIsArray = isArray(b);
  15345. if (aIsArray && bIsArray) {
  15346. if (a.length !== b.length) {
  15347. return false;
  15348. }
  15349. return a.every((item, index) => dateEquals(item, b[index]));
  15350. }
  15351. if (!aIsArray && !bIsArray) {
  15352. return dateEquals(a, b);
  15353. }
  15354. return false;
  15355. };
  15356. const parseDate = function(date, format, lang) {
  15357. const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
  15358. return day.isValid() ? day : void 0;
  15359. };
  15360. const formatter = function(date, format, lang) {
  15361. if (isEmpty(format))
  15362. return date;
  15363. if (format === "x")
  15364. return +date;
  15365. return dayjs(date).locale(lang).format(format);
  15366. };
  15367. const makeList = (total, method) => {
  15368. var _a;
  15369. const arr = [];
  15370. const disabledArr = method == null ? void 0 : method();
  15371. for (let i = 0; i < total; i++) {
  15372. arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
  15373. }
  15374. return arr;
  15375. };
  15376. const disabledTimeListsProps = buildProps({
  15377. disabledHours: {
  15378. type: definePropType(Function)
  15379. },
  15380. disabledMinutes: {
  15381. type: definePropType(Function)
  15382. },
  15383. disabledSeconds: {
  15384. type: definePropType(Function)
  15385. }
  15386. });
  15387. const timePanelSharedProps = buildProps({
  15388. visible: Boolean,
  15389. actualVisible: {
  15390. type: Boolean,
  15391. default: void 0
  15392. },
  15393. format: {
  15394. type: String,
  15395. default: ""
  15396. }
  15397. });
  15398. const timePickerDefaultProps = buildProps({
  15399. id: {
  15400. type: definePropType([Array, String])
  15401. },
  15402. name: {
  15403. type: definePropType([Array, String]),
  15404. default: ""
  15405. },
  15406. popperClass: {
  15407. type: String,
  15408. default: ""
  15409. },
  15410. format: String,
  15411. valueFormat: String,
  15412. type: {
  15413. type: String,
  15414. default: ""
  15415. },
  15416. clearable: {
  15417. type: Boolean,
  15418. default: true
  15419. },
  15420. clearIcon: {
  15421. type: definePropType([String, Object]),
  15422. default: circle_close_default
  15423. },
  15424. editable: {
  15425. type: Boolean,
  15426. default: true
  15427. },
  15428. prefixIcon: {
  15429. type: definePropType([String, Object]),
  15430. default: ""
  15431. },
  15432. size: useSizeProp,
  15433. readonly: {
  15434. type: Boolean,
  15435. default: false
  15436. },
  15437. disabled: {
  15438. type: Boolean,
  15439. default: false
  15440. },
  15441. placeholder: {
  15442. type: String,
  15443. default: ""
  15444. },
  15445. popperOptions: {
  15446. type: definePropType(Object),
  15447. default: () => ({})
  15448. },
  15449. modelValue: {
  15450. type: definePropType([Date, Array, String, Number]),
  15451. default: ""
  15452. },
  15453. rangeSeparator: {
  15454. type: String,
  15455. default: "-"
  15456. },
  15457. startPlaceholder: String,
  15458. endPlaceholder: String,
  15459. defaultValue: {
  15460. type: definePropType([Date, Array])
  15461. },
  15462. defaultTime: {
  15463. type: definePropType([Date, Array])
  15464. },
  15465. isRange: {
  15466. type: Boolean,
  15467. default: false
  15468. },
  15469. ...disabledTimeListsProps,
  15470. disabledDate: {
  15471. type: Function
  15472. },
  15473. cellClassName: {
  15474. type: Function
  15475. },
  15476. shortcuts: {
  15477. type: Array,
  15478. default: () => []
  15479. },
  15480. arrowControl: {
  15481. type: Boolean,
  15482. default: false
  15483. },
  15484. label: {
  15485. type: String,
  15486. default: void 0
  15487. },
  15488. tabindex: {
  15489. type: definePropType([String, Number]),
  15490. default: 0
  15491. },
  15492. validateEvent: {
  15493. type: Boolean,
  15494. default: true
  15495. },
  15496. unlinkPanels: Boolean
  15497. });
  15498. const _hoisted_1$Z = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  15499. const _hoisted_2$D = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  15500. const __default__$1c = vue.defineComponent({
  15501. name: "Picker"
  15502. });
  15503. const _sfc_main$1U = /* @__PURE__ */ vue.defineComponent({
  15504. ...__default__$1c,
  15505. props: timePickerDefaultProps,
  15506. emits: [
  15507. "update:modelValue",
  15508. "change",
  15509. "focus",
  15510. "blur",
  15511. "calendar-change",
  15512. "panel-change",
  15513. "visible-change",
  15514. "keydown"
  15515. ],
  15516. setup(__props, { expose, emit }) {
  15517. const props = __props;
  15518. const { lang } = useLocale();
  15519. const nsDate = useNamespace("date");
  15520. const nsInput = useNamespace("input");
  15521. const nsRange = useNamespace("range");
  15522. const { form, formItem } = useFormItem();
  15523. const elPopperOptions = vue.inject("ElPopperOptions", {});
  15524. const refPopper = vue.ref();
  15525. const inputRef = vue.ref();
  15526. const pickerVisible = vue.ref(false);
  15527. const pickerActualVisible = vue.ref(false);
  15528. const valueOnOpen = vue.ref(null);
  15529. let hasJustTabExitedInput = false;
  15530. let ignoreFocusEvent = false;
  15531. vue.watch(pickerVisible, (val) => {
  15532. if (!val) {
  15533. userInput.value = null;
  15534. vue.nextTick(() => {
  15535. emitChange(props.modelValue);
  15536. });
  15537. } else {
  15538. vue.nextTick(() => {
  15539. if (val) {
  15540. valueOnOpen.value = props.modelValue;
  15541. }
  15542. });
  15543. }
  15544. });
  15545. const emitChange = (val, isClear) => {
  15546. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  15547. emit("change", val);
  15548. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  15549. }
  15550. };
  15551. const emitInput = (input) => {
  15552. if (!valueEquals(props.modelValue, input)) {
  15553. let formatted;
  15554. if (isArray(input)) {
  15555. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  15556. } else if (input) {
  15557. formatted = formatter(input, props.valueFormat, lang.value);
  15558. }
  15559. emit("update:modelValue", input ? formatted : input, lang.value);
  15560. }
  15561. };
  15562. const emitKeydown = (e) => {
  15563. emit("keydown", e);
  15564. };
  15565. const refInput = vue.computed(() => {
  15566. if (inputRef.value) {
  15567. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  15568. return Array.from(_r.querySelectorAll("input"));
  15569. }
  15570. return [];
  15571. });
  15572. const setSelectionRange = (start, end, pos) => {
  15573. const _inputs = refInput.value;
  15574. if (!_inputs.length)
  15575. return;
  15576. if (!pos || pos === "min") {
  15577. _inputs[0].setSelectionRange(start, end);
  15578. _inputs[0].focus();
  15579. } else if (pos === "max") {
  15580. _inputs[1].setSelectionRange(start, end);
  15581. _inputs[1].focus();
  15582. }
  15583. };
  15584. const focusOnInputBox = () => {
  15585. focus(true, true);
  15586. vue.nextTick(() => {
  15587. ignoreFocusEvent = false;
  15588. });
  15589. };
  15590. const onPick = (date = "", visible = false) => {
  15591. if (!visible) {
  15592. ignoreFocusEvent = true;
  15593. }
  15594. pickerVisible.value = visible;
  15595. let result;
  15596. if (isArray(date)) {
  15597. result = date.map((_) => _.toDate());
  15598. } else {
  15599. result = date ? date.toDate() : date;
  15600. }
  15601. userInput.value = null;
  15602. emitInput(result);
  15603. };
  15604. const onBeforeShow = () => {
  15605. pickerActualVisible.value = true;
  15606. };
  15607. const onShow = () => {
  15608. emit("visible-change", true);
  15609. };
  15610. const onKeydownPopperContent = (event) => {
  15611. if ((event == null ? void 0 : event.key) === EVENT_CODE.esc) {
  15612. focus(true, true);
  15613. }
  15614. };
  15615. const onHide = () => {
  15616. pickerActualVisible.value = false;
  15617. pickerVisible.value = false;
  15618. ignoreFocusEvent = false;
  15619. emit("visible-change", false);
  15620. };
  15621. const handleOpen = () => {
  15622. pickerVisible.value = true;
  15623. };
  15624. const handleClose = () => {
  15625. pickerVisible.value = false;
  15626. };
  15627. const focus = (focusStartInput = true, isIgnoreFocusEvent = false) => {
  15628. ignoreFocusEvent = isIgnoreFocusEvent;
  15629. const [leftInput, rightInput] = vue.unref(refInput);
  15630. let input = leftInput;
  15631. if (!focusStartInput && isRangeInput.value) {
  15632. input = rightInput;
  15633. }
  15634. if (input) {
  15635. input.focus();
  15636. }
  15637. };
  15638. const handleFocusInput = (e) => {
  15639. if (props.readonly || pickerDisabled.value || pickerVisible.value || ignoreFocusEvent) {
  15640. return;
  15641. }
  15642. pickerVisible.value = true;
  15643. emit("focus", e);
  15644. };
  15645. let currentHandleBlurDeferCallback = void 0;
  15646. const handleBlurInput = (e) => {
  15647. const handleBlurDefer = async () => {
  15648. setTimeout(() => {
  15649. var _a;
  15650. if (currentHandleBlurDeferCallback === handleBlurDefer) {
  15651. if (!(((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent()) && !hasJustTabExitedInput) && refInput.value.filter((input) => {
  15652. return input.contains(document.activeElement);
  15653. }).length === 0) {
  15654. handleChange();
  15655. pickerVisible.value = false;
  15656. emit("blur", e);
  15657. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn()));
  15658. }
  15659. hasJustTabExitedInput = false;
  15660. }
  15661. }, 0);
  15662. };
  15663. currentHandleBlurDeferCallback = handleBlurDefer;
  15664. handleBlurDefer();
  15665. };
  15666. const pickerDisabled = vue.computed(() => {
  15667. return props.disabled || (form == null ? void 0 : form.disabled);
  15668. });
  15669. const parsedValue = vue.computed(() => {
  15670. let dayOrDays;
  15671. if (valueIsEmpty.value) {
  15672. if (pickerOptions.value.getDefaultValue) {
  15673. dayOrDays = pickerOptions.value.getDefaultValue();
  15674. }
  15675. } else {
  15676. if (isArray(props.modelValue)) {
  15677. dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  15678. } else {
  15679. dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
  15680. }
  15681. }
  15682. if (pickerOptions.value.getRangeAvailableTime) {
  15683. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  15684. if (!isEqual$1(availableResult, dayOrDays)) {
  15685. dayOrDays = availableResult;
  15686. emitInput(isArray(dayOrDays) ? dayOrDays.map((_) => _.toDate()) : dayOrDays.toDate());
  15687. }
  15688. }
  15689. if (isArray(dayOrDays) && dayOrDays.some((day) => !day)) {
  15690. dayOrDays = [];
  15691. }
  15692. return dayOrDays;
  15693. });
  15694. const displayValue = vue.computed(() => {
  15695. if (!pickerOptions.value.panelReady)
  15696. return "";
  15697. const formattedValue = formatDayjsToString(parsedValue.value);
  15698. if (isArray(userInput.value)) {
  15699. return [
  15700. userInput.value[0] || formattedValue && formattedValue[0] || "",
  15701. userInput.value[1] || formattedValue && formattedValue[1] || ""
  15702. ];
  15703. } else if (userInput.value !== null) {
  15704. return userInput.value;
  15705. }
  15706. if (!isTimePicker.value && valueIsEmpty.value)
  15707. return "";
  15708. if (!pickerVisible.value && valueIsEmpty.value)
  15709. return "";
  15710. if (formattedValue) {
  15711. return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
  15712. }
  15713. return "";
  15714. });
  15715. const isTimeLikePicker = vue.computed(() => props.type.includes("time"));
  15716. const isTimePicker = vue.computed(() => props.type.startsWith("time"));
  15717. const isDatesPicker = vue.computed(() => props.type === "dates");
  15718. const triggerIcon = vue.computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  15719. const showClose = vue.ref(false);
  15720. const onClearIconClick = (event) => {
  15721. if (props.readonly || pickerDisabled.value)
  15722. return;
  15723. if (showClose.value) {
  15724. event.stopPropagation();
  15725. focusOnInputBox();
  15726. emitInput(null);
  15727. emitChange(null, true);
  15728. showClose.value = false;
  15729. pickerVisible.value = false;
  15730. pickerOptions.value.handleClear && pickerOptions.value.handleClear();
  15731. }
  15732. };
  15733. const valueIsEmpty = vue.computed(() => {
  15734. const { modelValue } = props;
  15735. return !modelValue || isArray(modelValue) && !modelValue.filter(Boolean).length;
  15736. });
  15737. const onMouseDownInput = async (event) => {
  15738. var _a;
  15739. if (props.readonly || pickerDisabled.value)
  15740. return;
  15741. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  15742. pickerVisible.value = true;
  15743. }
  15744. };
  15745. const onMouseEnter = () => {
  15746. if (props.readonly || pickerDisabled.value)
  15747. return;
  15748. if (!valueIsEmpty.value && props.clearable) {
  15749. showClose.value = true;
  15750. }
  15751. };
  15752. const onMouseLeave = () => {
  15753. showClose.value = false;
  15754. };
  15755. const onTouchStartInput = (event) => {
  15756. var _a;
  15757. if (props.readonly || pickerDisabled.value)
  15758. return;
  15759. if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  15760. pickerVisible.value = true;
  15761. }
  15762. };
  15763. const isRangeInput = vue.computed(() => {
  15764. return props.type.includes("range");
  15765. });
  15766. const pickerSize = useSize();
  15767. const popperEl = vue.computed(() => {
  15768. var _a, _b;
  15769. return (_b = (_a = vue.unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  15770. });
  15771. const actualInputRef = vue.computed(() => {
  15772. var _a;
  15773. if (vue.unref(isRangeInput)) {
  15774. return vue.unref(inputRef);
  15775. }
  15776. return (_a = vue.unref(inputRef)) == null ? void 0 : _a.$el;
  15777. });
  15778. onClickOutside(actualInputRef, (e) => {
  15779. const unrefedPopperEl = vue.unref(popperEl);
  15780. const inputEl = vue.unref(actualInputRef);
  15781. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  15782. return;
  15783. pickerVisible.value = false;
  15784. });
  15785. const userInput = vue.ref(null);
  15786. const handleChange = () => {
  15787. if (userInput.value) {
  15788. const value = parseUserInputToDayjs(displayValue.value);
  15789. if (value) {
  15790. if (isValidValue(value)) {
  15791. emitInput(isArray(value) ? value.map((_) => _.toDate()) : value.toDate());
  15792. userInput.value = null;
  15793. }
  15794. }
  15795. }
  15796. if (userInput.value === "") {
  15797. emitInput(null);
  15798. emitChange(null);
  15799. userInput.value = null;
  15800. }
  15801. };
  15802. const parseUserInputToDayjs = (value) => {
  15803. if (!value)
  15804. return null;
  15805. return pickerOptions.value.parseUserInput(value);
  15806. };
  15807. const formatDayjsToString = (value) => {
  15808. if (!value)
  15809. return null;
  15810. return pickerOptions.value.formatToString(value);
  15811. };
  15812. const isValidValue = (value) => {
  15813. return pickerOptions.value.isValidValue(value);
  15814. };
  15815. const handleKeydownInput = async (event) => {
  15816. if (props.readonly || pickerDisabled.value)
  15817. return;
  15818. const { code } = event;
  15819. emitKeydown(event);
  15820. if (code === EVENT_CODE.esc) {
  15821. if (pickerVisible.value === true) {
  15822. pickerVisible.value = false;
  15823. event.preventDefault();
  15824. event.stopPropagation();
  15825. }
  15826. return;
  15827. }
  15828. if (code === EVENT_CODE.down) {
  15829. if (pickerOptions.value.handleFocusPicker) {
  15830. event.preventDefault();
  15831. event.stopPropagation();
  15832. }
  15833. if (pickerVisible.value === false) {
  15834. pickerVisible.value = true;
  15835. await vue.nextTick();
  15836. }
  15837. if (pickerOptions.value.handleFocusPicker) {
  15838. pickerOptions.value.handleFocusPicker();
  15839. return;
  15840. }
  15841. }
  15842. if (code === EVENT_CODE.tab) {
  15843. hasJustTabExitedInput = true;
  15844. return;
  15845. }
  15846. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  15847. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  15848. handleChange();
  15849. pickerVisible.value = false;
  15850. }
  15851. event.stopPropagation();
  15852. return;
  15853. }
  15854. if (userInput.value) {
  15855. event.stopPropagation();
  15856. return;
  15857. }
  15858. if (pickerOptions.value.handleKeydownInput) {
  15859. pickerOptions.value.handleKeydownInput(event);
  15860. }
  15861. };
  15862. const onUserInput = (e) => {
  15863. userInput.value = e;
  15864. if (!pickerVisible.value) {
  15865. pickerVisible.value = true;
  15866. }
  15867. };
  15868. const handleStartInput = (event) => {
  15869. const target = event.target;
  15870. if (userInput.value) {
  15871. userInput.value = [target.value, userInput.value[1]];
  15872. } else {
  15873. userInput.value = [target.value, null];
  15874. }
  15875. };
  15876. const handleEndInput = (event) => {
  15877. const target = event.target;
  15878. if (userInput.value) {
  15879. userInput.value = [userInput.value[0], target.value];
  15880. } else {
  15881. userInput.value = [null, target.value];
  15882. }
  15883. };
  15884. const handleStartChange = () => {
  15885. var _a;
  15886. const values = userInput.value;
  15887. const value = parseUserInputToDayjs(values && values[0]);
  15888. const parsedVal = vue.unref(parsedValue);
  15889. if (value && value.isValid()) {
  15890. userInput.value = [
  15891. formatDayjsToString(value),
  15892. ((_a = displayValue.value) == null ? void 0 : _a[1]) || null
  15893. ];
  15894. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  15895. if (isValidValue(newValue)) {
  15896. emitInput(newValue);
  15897. userInput.value = null;
  15898. }
  15899. }
  15900. };
  15901. const handleEndChange = () => {
  15902. var _a;
  15903. const values = vue.unref(userInput);
  15904. const value = parseUserInputToDayjs(values && values[1]);
  15905. const parsedVal = vue.unref(parsedValue);
  15906. if (value && value.isValid()) {
  15907. userInput.value = [
  15908. ((_a = vue.unref(displayValue)) == null ? void 0 : _a[0]) || null,
  15909. formatDayjsToString(value)
  15910. ];
  15911. const newValue = [parsedVal && parsedVal[0], value];
  15912. if (isValidValue(newValue)) {
  15913. emitInput(newValue);
  15914. userInput.value = null;
  15915. }
  15916. }
  15917. };
  15918. const pickerOptions = vue.ref({});
  15919. const onSetPickerOption = (e) => {
  15920. pickerOptions.value[e[0]] = e[1];
  15921. pickerOptions.value.panelReady = true;
  15922. };
  15923. const onCalendarChange = (e) => {
  15924. emit("calendar-change", e);
  15925. };
  15926. const onPanelChange = (value, mode, view) => {
  15927. emit("panel-change", value, mode, view);
  15928. };
  15929. vue.provide("EP_PICKER_BASE", {
  15930. props
  15931. });
  15932. expose({
  15933. focus,
  15934. handleFocusInput,
  15935. handleBlurInput,
  15936. handleOpen,
  15937. handleClose,
  15938. onPick
  15939. });
  15940. return (_ctx, _cache) => {
  15941. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  15942. ref_key: "refPopper",
  15943. ref: refPopper,
  15944. visible: pickerVisible.value,
  15945. effect: "light",
  15946. pure: "",
  15947. trigger: "click"
  15948. }, _ctx.$attrs, {
  15949. role: "dialog",
  15950. teleported: "",
  15951. transition: `${vue.unref(nsDate).namespace.value}-zoom-in-top`,
  15952. "popper-class": [`${vue.unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  15953. "popper-options": vue.unref(elPopperOptions),
  15954. "fallback-placements": ["bottom", "top", "right", "left"],
  15955. "gpu-acceleration": false,
  15956. "stop-popper-mouse-event": false,
  15957. "hide-after": 0,
  15958. persistent: "",
  15959. onBeforeShow,
  15960. onShow,
  15961. onHide
  15962. }), {
  15963. default: vue.withCtx(() => [
  15964. !vue.unref(isRangeInput) ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  15965. key: 0,
  15966. id: _ctx.id,
  15967. ref_key: "inputRef",
  15968. ref: inputRef,
  15969. "container-role": "combobox",
  15970. "model-value": vue.unref(displayValue),
  15971. name: _ctx.name,
  15972. size: vue.unref(pickerSize),
  15973. disabled: vue.unref(pickerDisabled),
  15974. placeholder: _ctx.placeholder,
  15975. class: vue.normalizeClass([vue.unref(nsDate).b("editor"), vue.unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]),
  15976. style: vue.normalizeStyle(_ctx.$attrs.style),
  15977. readonly: !_ctx.editable || _ctx.readonly || vue.unref(isDatesPicker) || _ctx.type === "week",
  15978. label: _ctx.label,
  15979. tabindex: _ctx.tabindex,
  15980. "validate-event": false,
  15981. onInput: onUserInput,
  15982. onFocus: handleFocusInput,
  15983. onBlur: handleBlurInput,
  15984. onKeydown: handleKeydownInput,
  15985. onChange: handleChange,
  15986. onMousedown: onMouseDownInput,
  15987. onMouseenter: onMouseEnter,
  15988. onMouseleave: onMouseLeave,
  15989. onTouchstart: onTouchStartInput,
  15990. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  15991. }, ["stop"]))
  15992. }, {
  15993. prefix: vue.withCtx(() => [
  15994. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  15995. key: 0,
  15996. class: vue.normalizeClass(vue.unref(nsInput).e("icon")),
  15997. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  15998. onTouchstart: onTouchStartInput
  15999. }, {
  16000. default: vue.withCtx(() => [
  16001. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  16002. ]),
  16003. _: 1
  16004. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  16005. ]),
  16006. suffix: vue.withCtx(() => [
  16007. showClose.value && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16008. key: 0,
  16009. class: vue.normalizeClass(`${vue.unref(nsInput).e("icon")} clear-icon`),
  16010. onClick: vue.withModifiers(onClearIconClick, ["stop"])
  16011. }, {
  16012. default: vue.withCtx(() => [
  16013. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  16014. ]),
  16015. _: 1
  16016. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  16017. ]),
  16018. _: 1
  16019. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "label", "tabindex", "onKeydown"])) : (vue.openBlock(), vue.createElementBlock("div", {
  16020. key: 1,
  16021. ref_key: "inputRef",
  16022. ref: inputRef,
  16023. class: vue.normalizeClass([
  16024. vue.unref(nsDate).b("editor"),
  16025. vue.unref(nsDate).bm("editor", _ctx.type),
  16026. vue.unref(nsInput).e("wrapper"),
  16027. vue.unref(nsDate).is("disabled", vue.unref(pickerDisabled)),
  16028. vue.unref(nsDate).is("active", pickerVisible.value),
  16029. vue.unref(nsRange).b("editor"),
  16030. vue.unref(pickerSize) ? vue.unref(nsRange).bm("editor", vue.unref(pickerSize)) : "",
  16031. _ctx.$attrs.class
  16032. ]),
  16033. style: vue.normalizeStyle(_ctx.$attrs.style),
  16034. onClick: handleFocusInput,
  16035. onMouseenter: onMouseEnter,
  16036. onMouseleave: onMouseLeave,
  16037. onTouchstart: onTouchStartInput,
  16038. onKeydown: handleKeydownInput
  16039. }, [
  16040. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16041. key: 0,
  16042. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsRange).e("icon")]),
  16043. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  16044. onTouchstart: onTouchStartInput
  16045. }, {
  16046. default: vue.withCtx(() => [
  16047. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  16048. ]),
  16049. _: 1
  16050. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  16051. vue.createElementVNode("input", {
  16052. id: _ctx.id && _ctx.id[0],
  16053. autocomplete: "off",
  16054. name: _ctx.name && _ctx.name[0],
  16055. placeholder: _ctx.startPlaceholder,
  16056. value: vue.unref(displayValue) && vue.unref(displayValue)[0],
  16057. disabled: vue.unref(pickerDisabled),
  16058. readonly: !_ctx.editable || _ctx.readonly,
  16059. class: vue.normalizeClass(vue.unref(nsRange).b("input")),
  16060. onMousedown: onMouseDownInput,
  16061. onInput: handleStartInput,
  16062. onChange: handleStartChange,
  16063. onFocus: handleFocusInput,
  16064. onBlur: handleBlurInput
  16065. }, null, 42, _hoisted_1$Z),
  16066. vue.renderSlot(_ctx.$slots, "range-separator", {}, () => [
  16067. vue.createElementVNode("span", {
  16068. class: vue.normalizeClass(vue.unref(nsRange).b("separator"))
  16069. }, vue.toDisplayString(_ctx.rangeSeparator), 3)
  16070. ]),
  16071. vue.createElementVNode("input", {
  16072. id: _ctx.id && _ctx.id[1],
  16073. autocomplete: "off",
  16074. name: _ctx.name && _ctx.name[1],
  16075. placeholder: _ctx.endPlaceholder,
  16076. value: vue.unref(displayValue) && vue.unref(displayValue)[1],
  16077. disabled: vue.unref(pickerDisabled),
  16078. readonly: !_ctx.editable || _ctx.readonly,
  16079. class: vue.normalizeClass(vue.unref(nsRange).b("input")),
  16080. onMousedown: onMouseDownInput,
  16081. onFocus: handleFocusInput,
  16082. onBlur: handleBlurInput,
  16083. onInput: handleEndInput,
  16084. onChange: handleEndChange
  16085. }, null, 42, _hoisted_2$D),
  16086. _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16087. key: 1,
  16088. class: vue.normalizeClass([
  16089. vue.unref(nsInput).e("icon"),
  16090. vue.unref(nsRange).e("close-icon"),
  16091. {
  16092. [vue.unref(nsRange).e("close-icon--hidden")]: !showClose.value
  16093. }
  16094. ]),
  16095. onClick: onClearIconClick
  16096. }, {
  16097. default: vue.withCtx(() => [
  16098. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  16099. ]),
  16100. _: 1
  16101. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  16102. ], 38))
  16103. ]),
  16104. content: vue.withCtx(() => [
  16105. vue.renderSlot(_ctx.$slots, "default", {
  16106. visible: pickerVisible.value,
  16107. actualVisible: pickerActualVisible.value,
  16108. parsedValue: vue.unref(parsedValue),
  16109. format: _ctx.format,
  16110. unlinkPanels: _ctx.unlinkPanels,
  16111. type: _ctx.type,
  16112. defaultValue: _ctx.defaultValue,
  16113. onPick,
  16114. onSelectRange: setSelectionRange,
  16115. onSetPickerOption,
  16116. onCalendarChange,
  16117. onPanelChange,
  16118. onKeydown: onKeydownPopperContent,
  16119. onMousedown: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  16120. }, ["stop"]))
  16121. })
  16122. ]),
  16123. _: 3
  16124. }, 16, ["visible", "transition", "popper-class", "popper-options"]);
  16125. };
  16126. }
  16127. });
  16128. var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "picker.vue"]]);
  16129. const panelTimePickerProps = buildProps({
  16130. ...timePanelSharedProps,
  16131. datetimeRole: String,
  16132. parsedValue: {
  16133. type: definePropType(Object)
  16134. }
  16135. });
  16136. const useTimePanel = ({
  16137. getAvailableHours,
  16138. getAvailableMinutes,
  16139. getAvailableSeconds
  16140. }) => {
  16141. const getAvailableTime = (date, role, first, compareDate) => {
  16142. const availableTimeGetters = {
  16143. hour: getAvailableHours,
  16144. minute: getAvailableMinutes,
  16145. second: getAvailableSeconds
  16146. };
  16147. let result = date;
  16148. ["hour", "minute", "second"].forEach((type) => {
  16149. if (availableTimeGetters[type]) {
  16150. let availableTimeSlots;
  16151. const method = availableTimeGetters[type];
  16152. switch (type) {
  16153. case "minute": {
  16154. availableTimeSlots = method(result.hour(), role, compareDate);
  16155. break;
  16156. }
  16157. case "second": {
  16158. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  16159. break;
  16160. }
  16161. default: {
  16162. availableTimeSlots = method(role, compareDate);
  16163. break;
  16164. }
  16165. }
  16166. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
  16167. const pos = first ? 0 : availableTimeSlots.length - 1;
  16168. result = result[type](availableTimeSlots[pos]);
  16169. }
  16170. }
  16171. });
  16172. return result;
  16173. };
  16174. const timePickerOptions = {};
  16175. const onSetOption = ([key, val]) => {
  16176. timePickerOptions[key] = val;
  16177. };
  16178. return {
  16179. timePickerOptions,
  16180. getAvailableTime,
  16181. onSetOption
  16182. };
  16183. };
  16184. const makeAvailableArr = (disabledList) => {
  16185. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  16186. const getNumber = (predicate) => predicate !== true;
  16187. return disabledList.map(trueOrNumber).filter(getNumber);
  16188. };
  16189. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  16190. const getHoursList = (role, compare) => {
  16191. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  16192. };
  16193. const getMinutesList = (hour, role, compare) => {
  16194. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  16195. };
  16196. const getSecondsList = (hour, minute, role, compare) => {
  16197. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  16198. };
  16199. return {
  16200. getHoursList,
  16201. getMinutesList,
  16202. getSecondsList
  16203. };
  16204. };
  16205. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  16206. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  16207. const getAvailableHours = (role, compare) => {
  16208. return makeAvailableArr(getHoursList(role, compare));
  16209. };
  16210. const getAvailableMinutes = (hour, role, compare) => {
  16211. return makeAvailableArr(getMinutesList(hour, role, compare));
  16212. };
  16213. const getAvailableSeconds = (hour, minute, role, compare) => {
  16214. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  16215. };
  16216. return {
  16217. getAvailableHours,
  16218. getAvailableMinutes,
  16219. getAvailableSeconds
  16220. };
  16221. };
  16222. const useOldValue = (props) => {
  16223. const oldValue = vue.ref(props.parsedValue);
  16224. vue.watch(() => props.visible, (val) => {
  16225. if (!val) {
  16226. oldValue.value = props.parsedValue;
  16227. }
  16228. });
  16229. return oldValue;
  16230. };
  16231. const nodeList = /* @__PURE__ */ new Map();
  16232. let startClick;
  16233. if (isClient) {
  16234. document.addEventListener("mousedown", (e) => startClick = e);
  16235. document.addEventListener("mouseup", (e) => {
  16236. for (const handlers of nodeList.values()) {
  16237. for (const { documentHandler } of handlers) {
  16238. documentHandler(e, startClick);
  16239. }
  16240. }
  16241. });
  16242. }
  16243. function createDocumentHandler(el, binding) {
  16244. let excludes = [];
  16245. if (Array.isArray(binding.arg)) {
  16246. excludes = binding.arg;
  16247. } else if (isElement$1(binding.arg)) {
  16248. excludes.push(binding.arg);
  16249. }
  16250. return function(mouseup, mousedown) {
  16251. const popperRef = binding.instance.popperRef;
  16252. const mouseUpTarget = mouseup.target;
  16253. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  16254. const isBound = !binding || !binding.instance;
  16255. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  16256. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  16257. const isSelf = el === mouseUpTarget;
  16258. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  16259. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  16260. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  16261. return;
  16262. }
  16263. binding.value(mouseup, mousedown);
  16264. };
  16265. }
  16266. const ClickOutside = {
  16267. beforeMount(el, binding) {
  16268. if (!nodeList.has(el)) {
  16269. nodeList.set(el, []);
  16270. }
  16271. nodeList.get(el).push({
  16272. documentHandler: createDocumentHandler(el, binding),
  16273. bindingFn: binding.value
  16274. });
  16275. },
  16276. updated(el, binding) {
  16277. if (!nodeList.has(el)) {
  16278. nodeList.set(el, []);
  16279. }
  16280. const handlers = nodeList.get(el);
  16281. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  16282. const newHandler = {
  16283. documentHandler: createDocumentHandler(el, binding),
  16284. bindingFn: binding.value
  16285. };
  16286. if (oldHandlerIndex >= 0) {
  16287. handlers.splice(oldHandlerIndex, 1, newHandler);
  16288. } else {
  16289. handlers.push(newHandler);
  16290. }
  16291. },
  16292. unmounted(el) {
  16293. nodeList.delete(el);
  16294. }
  16295. };
  16296. const REPEAT_INTERVAL = 100;
  16297. const REPEAT_DELAY = 600;
  16298. const vRepeatClick = {
  16299. beforeMount(el, binding) {
  16300. const value = binding.value;
  16301. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction(value) ? {} : value;
  16302. let intervalId;
  16303. let delayId;
  16304. const handler = () => isFunction(value) ? value() : value.handler();
  16305. const clear = () => {
  16306. if (delayId) {
  16307. clearTimeout(delayId);
  16308. delayId = void 0;
  16309. }
  16310. if (intervalId) {
  16311. clearInterval(intervalId);
  16312. intervalId = void 0;
  16313. }
  16314. };
  16315. el.addEventListener("mousedown", (evt) => {
  16316. if (evt.button !== 0)
  16317. return;
  16318. clear();
  16319. handler();
  16320. document.addEventListener("mouseup", () => clear(), {
  16321. once: true
  16322. });
  16323. delayId = setTimeout(() => {
  16324. intervalId = setInterval(() => {
  16325. handler();
  16326. }, interval);
  16327. }, delay);
  16328. });
  16329. }
  16330. };
  16331. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  16332. const FOCUS_STACK = [];
  16333. const FOCUS_HANDLER = (e) => {
  16334. if (FOCUS_STACK.length === 0)
  16335. return;
  16336. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  16337. if (focusableElement.length > 0 && e.code === EVENT_CODE.tab) {
  16338. if (focusableElement.length === 1) {
  16339. e.preventDefault();
  16340. if (document.activeElement !== focusableElement[0]) {
  16341. focusableElement[0].focus();
  16342. }
  16343. return;
  16344. }
  16345. const goingBackward = e.shiftKey;
  16346. const isFirst = e.target === focusableElement[0];
  16347. const isLast = e.target === focusableElement[focusableElement.length - 1];
  16348. if (isFirst && goingBackward) {
  16349. e.preventDefault();
  16350. focusableElement[focusableElement.length - 1].focus();
  16351. }
  16352. if (isLast && !goingBackward) {
  16353. e.preventDefault();
  16354. focusableElement[0].focus();
  16355. }
  16356. }
  16357. };
  16358. const TrapFocus = {
  16359. beforeMount(el) {
  16360. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  16361. FOCUS_STACK.push(el);
  16362. if (FOCUS_STACK.length <= 1) {
  16363. document.addEventListener("keydown", FOCUS_HANDLER);
  16364. }
  16365. },
  16366. updated(el) {
  16367. vue.nextTick(() => {
  16368. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  16369. });
  16370. },
  16371. unmounted() {
  16372. FOCUS_STACK.shift();
  16373. if (FOCUS_STACK.length === 0) {
  16374. document.removeEventListener("keydown", FOCUS_HANDLER);
  16375. }
  16376. }
  16377. };
  16378. 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;/**
  16379. * Checks if an event is supported in the current execution environment.
  16380. *
  16381. * NOTE: This will not work correctly for non-generic events such as `change`,
  16382. * `reset`, `load`, `error`, and `select`.
  16383. *
  16384. * Borrows from Modernizr.
  16385. *
  16386. * @param {string} eventNameSuffix Event name, e.g. "click".
  16387. * @param {?boolean} capture Check if the capture phase is supported.
  16388. * @return {boolean} True if the event is supported.
  16389. * @internal
  16390. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  16391. */
  16392. const mousewheel = function(element, callback) {
  16393. if (element && element.addEventListener) {
  16394. const fn = function(event) {
  16395. const normalized = Y(event);
  16396. callback && Reflect.apply(callback, this, [event, normalized]);
  16397. };
  16398. element.addEventListener("wheel", fn, { passive: true });
  16399. }
  16400. };
  16401. const Mousewheel = {
  16402. beforeMount(el, binding) {
  16403. mousewheel(el, binding.value);
  16404. }
  16405. };
  16406. const basicTimeSpinnerProps = buildProps({
  16407. role: {
  16408. type: String,
  16409. required: true
  16410. },
  16411. spinnerDate: {
  16412. type: definePropType(Object),
  16413. required: true
  16414. },
  16415. showSeconds: {
  16416. type: Boolean,
  16417. default: true
  16418. },
  16419. arrowControl: Boolean,
  16420. amPmMode: {
  16421. type: definePropType(String),
  16422. default: ""
  16423. },
  16424. ...disabledTimeListsProps
  16425. });
  16426. const _hoisted_1$Y = ["onClick"];
  16427. const _hoisted_2$C = ["onMouseenter"];
  16428. const _sfc_main$1T = /* @__PURE__ */ vue.defineComponent({
  16429. __name: "basic-time-spinner",
  16430. props: basicTimeSpinnerProps,
  16431. emits: ["change", "select-range", "set-option"],
  16432. setup(__props, { emit }) {
  16433. const props = __props;
  16434. const ns = useNamespace("time");
  16435. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  16436. let isScrolling = false;
  16437. const currentScrollbar = vue.ref();
  16438. const listHoursRef = vue.ref();
  16439. const listMinutesRef = vue.ref();
  16440. const listSecondsRef = vue.ref();
  16441. const listRefsMap = {
  16442. hours: listHoursRef,
  16443. minutes: listMinutesRef,
  16444. seconds: listSecondsRef
  16445. };
  16446. const spinnerItems = vue.computed(() => {
  16447. return props.showSeconds ? timeUnits : timeUnits.slice(0, 2);
  16448. });
  16449. const timePartials = vue.computed(() => {
  16450. const { spinnerDate } = props;
  16451. const hours = spinnerDate.hour();
  16452. const minutes = spinnerDate.minute();
  16453. const seconds = spinnerDate.second();
  16454. return { hours, minutes, seconds };
  16455. });
  16456. const timeList = vue.computed(() => {
  16457. const { hours, minutes } = vue.unref(timePartials);
  16458. return {
  16459. hours: getHoursList(props.role),
  16460. minutes: getMinutesList(hours, props.role),
  16461. seconds: getSecondsList(hours, minutes, props.role)
  16462. };
  16463. });
  16464. const arrowControlTimeList = vue.computed(() => {
  16465. const { hours, minutes, seconds } = vue.unref(timePartials);
  16466. return {
  16467. hours: buildTimeList(hours, 23),
  16468. minutes: buildTimeList(minutes, 59),
  16469. seconds: buildTimeList(seconds, 59)
  16470. };
  16471. });
  16472. const debouncedResetScroll = debounce((type) => {
  16473. isScrolling = false;
  16474. adjustCurrentSpinner(type);
  16475. }, 200);
  16476. const getAmPmFlag = (hour) => {
  16477. const shouldShowAmPm = !!props.amPmMode;
  16478. if (!shouldShowAmPm)
  16479. return "";
  16480. const isCapital = props.amPmMode === "A";
  16481. let content = hour < 12 ? " am" : " pm";
  16482. if (isCapital)
  16483. content = content.toUpperCase();
  16484. return content;
  16485. };
  16486. const emitSelectRange = (type) => {
  16487. let range;
  16488. switch (type) {
  16489. case "hours":
  16490. range = [0, 2];
  16491. break;
  16492. case "minutes":
  16493. range = [3, 5];
  16494. break;
  16495. case "seconds":
  16496. range = [6, 8];
  16497. break;
  16498. }
  16499. const [left, right] = range;
  16500. emit("select-range", left, right);
  16501. currentScrollbar.value = type;
  16502. };
  16503. const adjustCurrentSpinner = (type) => {
  16504. adjustSpinner(type, vue.unref(timePartials)[type]);
  16505. };
  16506. const adjustSpinners = () => {
  16507. adjustCurrentSpinner("hours");
  16508. adjustCurrentSpinner("minutes");
  16509. adjustCurrentSpinner("seconds");
  16510. };
  16511. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  16512. const adjustSpinner = (type, value) => {
  16513. if (props.arrowControl)
  16514. return;
  16515. const scrollbar = vue.unref(listRefsMap[type]);
  16516. if (scrollbar && scrollbar.$el) {
  16517. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  16518. }
  16519. };
  16520. const typeItemHeight = (type) => {
  16521. const scrollbar = vue.unref(listRefsMap[type]);
  16522. return (scrollbar == null ? void 0 : scrollbar.$el.querySelector("li").offsetHeight) || 0;
  16523. };
  16524. const onIncrement = () => {
  16525. scrollDown(1);
  16526. };
  16527. const onDecrement = () => {
  16528. scrollDown(-1);
  16529. };
  16530. const scrollDown = (step) => {
  16531. if (!currentScrollbar.value) {
  16532. emitSelectRange("hours");
  16533. }
  16534. const label = currentScrollbar.value;
  16535. const now = vue.unref(timePartials)[label];
  16536. const total = currentScrollbar.value === "hours" ? 24 : 60;
  16537. const next = findNextUnDisabled(label, now, step, total);
  16538. modifyDateField(label, next);
  16539. adjustSpinner(label, next);
  16540. vue.nextTick(() => emitSelectRange(label));
  16541. };
  16542. const findNextUnDisabled = (type, now, step, total) => {
  16543. let next = (now + step + total) % total;
  16544. const list = vue.unref(timeList)[type];
  16545. while (list[next] && next !== now) {
  16546. next = (next + step + total) % total;
  16547. }
  16548. return next;
  16549. };
  16550. const modifyDateField = (type, value) => {
  16551. const list = vue.unref(timeList)[type];
  16552. const isDisabled = list[value];
  16553. if (isDisabled)
  16554. return;
  16555. const { hours, minutes, seconds } = vue.unref(timePartials);
  16556. let changeTo;
  16557. switch (type) {
  16558. case "hours":
  16559. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  16560. break;
  16561. case "minutes":
  16562. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  16563. break;
  16564. case "seconds":
  16565. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  16566. break;
  16567. }
  16568. emit("change", changeTo);
  16569. };
  16570. const handleClick = (type, { value, disabled }) => {
  16571. if (!disabled) {
  16572. modifyDateField(type, value);
  16573. emitSelectRange(type);
  16574. adjustSpinner(type, value);
  16575. }
  16576. };
  16577. const handleScroll = (type) => {
  16578. isScrolling = true;
  16579. debouncedResetScroll(type);
  16580. const value = Math.min(Math.round((getScrollbarElement(vue.unref(listRefsMap[type]).$el).scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59);
  16581. modifyDateField(type, value);
  16582. };
  16583. const scrollBarHeight = (type) => {
  16584. return vue.unref(listRefsMap[type]).$el.offsetHeight;
  16585. };
  16586. const bindScrollEvent = () => {
  16587. const bindFunction = (type) => {
  16588. const scrollbar = vue.unref(listRefsMap[type]);
  16589. if (scrollbar && scrollbar.$el) {
  16590. getScrollbarElement(scrollbar.$el).onscroll = () => {
  16591. handleScroll(type);
  16592. };
  16593. }
  16594. };
  16595. bindFunction("hours");
  16596. bindFunction("minutes");
  16597. bindFunction("seconds");
  16598. };
  16599. vue.onMounted(() => {
  16600. vue.nextTick(() => {
  16601. !props.arrowControl && bindScrollEvent();
  16602. adjustSpinners();
  16603. if (props.role === "start")
  16604. emitSelectRange("hours");
  16605. });
  16606. });
  16607. const setRef = (scrollbar, type) => {
  16608. listRefsMap[type].value = scrollbar;
  16609. };
  16610. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  16611. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  16612. vue.watch(() => props.spinnerDate, () => {
  16613. if (isScrolling)
  16614. return;
  16615. adjustSpinners();
  16616. });
  16617. return (_ctx, _cache) => {
  16618. return vue.openBlock(), vue.createElementBlock("div", {
  16619. class: vue.normalizeClass([vue.unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  16620. }, [
  16621. !_ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  16622. return vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  16623. key: item,
  16624. ref_for: true,
  16625. ref: (scrollbar) => setRef(scrollbar, item),
  16626. class: vue.normalizeClass(vue.unref(ns).be("spinner", "wrapper")),
  16627. "wrap-style": "max-height: inherit;",
  16628. "view-class": vue.unref(ns).be("spinner", "list"),
  16629. noresize: "",
  16630. tag: "ul",
  16631. onMouseenter: ($event) => emitSelectRange(item),
  16632. onMousemove: ($event) => adjustCurrentSpinner(item)
  16633. }, {
  16634. default: vue.withCtx(() => [
  16635. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(timeList)[item], (disabled, key) => {
  16636. return vue.openBlock(), vue.createElementBlock("li", {
  16637. key,
  16638. class: vue.normalizeClass([
  16639. vue.unref(ns).be("spinner", "item"),
  16640. vue.unref(ns).is("active", key === vue.unref(timePartials)[item]),
  16641. vue.unref(ns).is("disabled", disabled)
  16642. ]),
  16643. onClick: ($event) => handleClick(item, { value: key, disabled })
  16644. }, [
  16645. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  16646. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + vue.toDisplayString(getAmPmFlag(key)), 1)
  16647. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  16648. vue.createTextVNode(vue.toDisplayString(("0" + key).slice(-2)), 1)
  16649. ], 64))
  16650. ], 10, _hoisted_1$Y);
  16651. }), 128))
  16652. ]),
  16653. _: 2
  16654. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  16655. }), 128)) : vue.createCommentVNode("v-if", true),
  16656. _ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  16657. return vue.openBlock(), vue.createElementBlock("div", {
  16658. key: item,
  16659. class: vue.normalizeClass([vue.unref(ns).be("spinner", "wrapper"), vue.unref(ns).is("arrow")]),
  16660. onMouseenter: ($event) => emitSelectRange(item)
  16661. }, [
  16662. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16663. class: vue.normalizeClass(["arrow-up", vue.unref(ns).be("spinner", "arrow")])
  16664. }, {
  16665. default: vue.withCtx(() => [
  16666. vue.createVNode(vue.unref(arrow_up_default))
  16667. ]),
  16668. _: 1
  16669. }, 8, ["class"])), [
  16670. [vue.unref(vRepeatClick), onDecrement]
  16671. ]),
  16672. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16673. class: vue.normalizeClass(["arrow-down", vue.unref(ns).be("spinner", "arrow")])
  16674. }, {
  16675. default: vue.withCtx(() => [
  16676. vue.createVNode(vue.unref(arrow_down_default))
  16677. ]),
  16678. _: 1
  16679. }, 8, ["class"])), [
  16680. [vue.unref(vRepeatClick), onIncrement]
  16681. ]),
  16682. vue.createElementVNode("ul", {
  16683. class: vue.normalizeClass(vue.unref(ns).be("spinner", "list"))
  16684. }, [
  16685. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(arrowControlTimeList)[item], (time, key) => {
  16686. return vue.openBlock(), vue.createElementBlock("li", {
  16687. key,
  16688. class: vue.normalizeClass([
  16689. vue.unref(ns).be("spinner", "item"),
  16690. vue.unref(ns).is("active", time === vue.unref(timePartials)[item]),
  16691. vue.unref(ns).is("disabled", vue.unref(timeList)[item][time])
  16692. ])
  16693. }, [
  16694. typeof time === "number" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  16695. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  16696. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + vue.toDisplayString(getAmPmFlag(time)), 1)
  16697. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  16698. vue.createTextVNode(vue.toDisplayString(("0" + time).slice(-2)), 1)
  16699. ], 64))
  16700. ], 64)) : vue.createCommentVNode("v-if", true)
  16701. ], 2);
  16702. }), 128))
  16703. ], 2)
  16704. ], 42, _hoisted_2$C);
  16705. }), 128)) : vue.createCommentVNode("v-if", true)
  16706. ], 2);
  16707. };
  16708. }
  16709. });
  16710. var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["__file", "basic-time-spinner.vue"]]);
  16711. const _sfc_main$1S = /* @__PURE__ */ vue.defineComponent({
  16712. __name: "panel-time-pick",
  16713. props: panelTimePickerProps,
  16714. emits: ["pick", "select-range", "set-picker-option"],
  16715. setup(__props, { emit }) {
  16716. const props = __props;
  16717. const pickerBase = vue.inject("EP_PICKER_BASE");
  16718. const {
  16719. arrowControl,
  16720. disabledHours,
  16721. disabledMinutes,
  16722. disabledSeconds,
  16723. defaultValue
  16724. } = pickerBase.props;
  16725. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  16726. const ns = useNamespace("time");
  16727. const { t, lang } = useLocale();
  16728. const selectionRange = vue.ref([0, 2]);
  16729. const oldValue = useOldValue(props);
  16730. const transitionName = vue.computed(() => {
  16731. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  16732. });
  16733. const showSeconds = vue.computed(() => {
  16734. return props.format.includes("ss");
  16735. });
  16736. const amPmMode = vue.computed(() => {
  16737. if (props.format.includes("A"))
  16738. return "A";
  16739. if (props.format.includes("a"))
  16740. return "a";
  16741. return "";
  16742. });
  16743. const isValidValue = (_date) => {
  16744. const parsedDate = dayjs(_date).locale(lang.value);
  16745. const result = getRangeAvailableTime(parsedDate);
  16746. return parsedDate.isSame(result);
  16747. };
  16748. const handleCancel = () => {
  16749. emit("pick", oldValue.value, false);
  16750. };
  16751. const handleConfirm = (visible = false, first = false) => {
  16752. if (first)
  16753. return;
  16754. emit("pick", props.parsedValue, visible);
  16755. };
  16756. const handleChange = (_date) => {
  16757. if (!props.visible) {
  16758. return;
  16759. }
  16760. const result = getRangeAvailableTime(_date).millisecond(0);
  16761. emit("pick", result, true);
  16762. };
  16763. const setSelectionRange = (start, end) => {
  16764. emit("select-range", start, end);
  16765. selectionRange.value = [start, end];
  16766. };
  16767. const changeSelectionRange = (step) => {
  16768. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  16769. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  16770. const index = list.indexOf(selectionRange.value[0]);
  16771. const next = (index + step + list.length) % list.length;
  16772. timePickerOptions["start_emitSelectRange"](mapping[next]);
  16773. };
  16774. const handleKeydown = (event) => {
  16775. const code = event.code;
  16776. const { left, right, up, down } = EVENT_CODE;
  16777. if ([left, right].includes(code)) {
  16778. const step = code === left ? -1 : 1;
  16779. changeSelectionRange(step);
  16780. event.preventDefault();
  16781. return;
  16782. }
  16783. if ([up, down].includes(code)) {
  16784. const step = code === up ? -1 : 1;
  16785. timePickerOptions["start_scrollDown"](step);
  16786. event.preventDefault();
  16787. return;
  16788. }
  16789. };
  16790. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  16791. getAvailableHours,
  16792. getAvailableMinutes,
  16793. getAvailableSeconds
  16794. });
  16795. const getRangeAvailableTime = (date) => {
  16796. return getAvailableTime(date, props.datetimeRole || "", true);
  16797. };
  16798. const parseUserInput = (value) => {
  16799. if (!value)
  16800. return null;
  16801. return dayjs(value, props.format).locale(lang.value);
  16802. };
  16803. const formatToString = (value) => {
  16804. if (!value)
  16805. return null;
  16806. return value.format(props.format);
  16807. };
  16808. const getDefaultValue = () => {
  16809. return dayjs(defaultValue).locale(lang.value);
  16810. };
  16811. emit("set-picker-option", ["isValidValue", isValidValue]);
  16812. emit("set-picker-option", ["formatToString", formatToString]);
  16813. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  16814. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  16815. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  16816. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  16817. return (_ctx, _cache) => {
  16818. return vue.openBlock(), vue.createBlock(vue.Transition, { name: vue.unref(transitionName) }, {
  16819. default: vue.withCtx(() => [
  16820. _ctx.actualVisible || _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
  16821. key: 0,
  16822. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  16823. }, [
  16824. vue.createElementVNode("div", {
  16825. class: vue.normalizeClass([vue.unref(ns).be("panel", "content"), { "has-seconds": vue.unref(showSeconds) }])
  16826. }, [
  16827. vue.createVNode(TimeSpinner, {
  16828. ref: "spinner",
  16829. role: _ctx.datetimeRole || "start",
  16830. "arrow-control": vue.unref(arrowControl),
  16831. "show-seconds": vue.unref(showSeconds),
  16832. "am-pm-mode": vue.unref(amPmMode),
  16833. "spinner-date": _ctx.parsedValue,
  16834. "disabled-hours": vue.unref(disabledHours),
  16835. "disabled-minutes": vue.unref(disabledMinutes),
  16836. "disabled-seconds": vue.unref(disabledSeconds),
  16837. onChange: handleChange,
  16838. onSetOption: vue.unref(onSetOption),
  16839. onSelectRange: setSelectionRange
  16840. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  16841. ], 2),
  16842. vue.createElementVNode("div", {
  16843. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  16844. }, [
  16845. vue.createElementVNode("button", {
  16846. type: "button",
  16847. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "cancel"]),
  16848. onClick: handleCancel
  16849. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  16850. vue.createElementVNode("button", {
  16851. type: "button",
  16852. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "confirm"]),
  16853. onClick: _cache[0] || (_cache[0] = ($event) => handleConfirm())
  16854. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 3)
  16855. ], 2)
  16856. ], 2)) : vue.createCommentVNode("v-if", true)
  16857. ]),
  16858. _: 1
  16859. }, 8, ["name"]);
  16860. };
  16861. }
  16862. });
  16863. var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["__file", "panel-time-pick.vue"]]);
  16864. const panelTimeRangeProps = buildProps({
  16865. ...timePanelSharedProps,
  16866. parsedValue: {
  16867. type: definePropType(Array)
  16868. }
  16869. });
  16870. const _hoisted_1$X = ["disabled"];
  16871. const _sfc_main$1R = /* @__PURE__ */ vue.defineComponent({
  16872. __name: "panel-time-range",
  16873. props: panelTimeRangeProps,
  16874. emits: ["pick", "select-range", "set-picker-option"],
  16875. setup(__props, { emit }) {
  16876. const props = __props;
  16877. const makeSelectRange = (start, end) => {
  16878. const result = [];
  16879. for (let i = start; i <= end; i++) {
  16880. result.push(i);
  16881. }
  16882. return result;
  16883. };
  16884. const { t, lang } = useLocale();
  16885. const nsTime = useNamespace("time");
  16886. const nsPicker = useNamespace("picker");
  16887. const pickerBase = vue.inject("EP_PICKER_BASE");
  16888. const {
  16889. arrowControl,
  16890. disabledHours,
  16891. disabledMinutes,
  16892. disabledSeconds,
  16893. defaultValue
  16894. } = pickerBase.props;
  16895. const startTime = vue.computed(() => props.parsedValue[0]);
  16896. const endTime = vue.computed(() => props.parsedValue[1]);
  16897. const oldValue = useOldValue(props);
  16898. const handleCancel = () => {
  16899. emit("pick", oldValue.value, false);
  16900. };
  16901. const showSeconds = vue.computed(() => {
  16902. return props.format.includes("ss");
  16903. });
  16904. const amPmMode = vue.computed(() => {
  16905. if (props.format.includes("A"))
  16906. return "A";
  16907. if (props.format.includes("a"))
  16908. return "a";
  16909. return "";
  16910. });
  16911. const handleConfirm = (visible = false) => {
  16912. emit("pick", [startTime.value, endTime.value], visible);
  16913. };
  16914. const handleMinChange = (date) => {
  16915. handleChange(date.millisecond(0), endTime.value);
  16916. };
  16917. const handleMaxChange = (date) => {
  16918. handleChange(startTime.value, date.millisecond(0));
  16919. };
  16920. const isValidValue = (_date) => {
  16921. const parsedDate = _date.map((_) => dayjs(_).locale(lang.value));
  16922. const result = getRangeAvailableTime(parsedDate);
  16923. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  16924. };
  16925. const handleChange = (start, end) => {
  16926. emit("pick", [start, end], true);
  16927. };
  16928. const btnConfirmDisabled = vue.computed(() => {
  16929. return startTime.value > endTime.value;
  16930. });
  16931. const selectionRange = vue.ref([0, 2]);
  16932. const setMinSelectionRange = (start, end) => {
  16933. emit("select-range", start, end, "min");
  16934. selectionRange.value = [start, end];
  16935. };
  16936. const offset = vue.computed(() => showSeconds.value ? 11 : 8);
  16937. const setMaxSelectionRange = (start, end) => {
  16938. emit("select-range", start, end, "max");
  16939. const _offset = vue.unref(offset);
  16940. selectionRange.value = [start + _offset, end + _offset];
  16941. };
  16942. const changeSelectionRange = (step) => {
  16943. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  16944. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  16945. const index = list.indexOf(selectionRange.value[0]);
  16946. const next = (index + step + list.length) % list.length;
  16947. const half = list.length / 2;
  16948. if (next < half) {
  16949. timePickerOptions["start_emitSelectRange"](mapping[next]);
  16950. } else {
  16951. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  16952. }
  16953. };
  16954. const handleKeydown = (event) => {
  16955. const code = event.code;
  16956. const { left, right, up, down } = EVENT_CODE;
  16957. if ([left, right].includes(code)) {
  16958. const step = code === left ? -1 : 1;
  16959. changeSelectionRange(step);
  16960. event.preventDefault();
  16961. return;
  16962. }
  16963. if ([up, down].includes(code)) {
  16964. const step = code === up ? -1 : 1;
  16965. const role = selectionRange.value[0] < offset.value ? "start" : "end";
  16966. timePickerOptions[`${role}_scrollDown`](step);
  16967. event.preventDefault();
  16968. return;
  16969. }
  16970. };
  16971. const disabledHours_ = (role, compare) => {
  16972. const defaultDisable = disabledHours ? disabledHours(role) : [];
  16973. const isStart = role === "start";
  16974. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  16975. const compareHour = compareDate.hour();
  16976. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  16977. return union(defaultDisable, nextDisable);
  16978. };
  16979. const disabledMinutes_ = (hour, role, compare) => {
  16980. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  16981. const isStart = role === "start";
  16982. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  16983. const compareHour = compareDate.hour();
  16984. if (hour !== compareHour) {
  16985. return defaultDisable;
  16986. }
  16987. const compareMinute = compareDate.minute();
  16988. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  16989. return union(defaultDisable, nextDisable);
  16990. };
  16991. const disabledSeconds_ = (hour, minute, role, compare) => {
  16992. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  16993. const isStart = role === "start";
  16994. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  16995. const compareHour = compareDate.hour();
  16996. const compareMinute = compareDate.minute();
  16997. if (hour !== compareHour || minute !== compareMinute) {
  16998. return defaultDisable;
  16999. }
  17000. const compareSecond = compareDate.second();
  17001. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  17002. return union(defaultDisable, nextDisable);
  17003. };
  17004. const getRangeAvailableTime = ([start, end]) => {
  17005. return [
  17006. getAvailableTime(start, "start", true, end),
  17007. getAvailableTime(end, "end", false, start)
  17008. ];
  17009. };
  17010. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  17011. const {
  17012. timePickerOptions,
  17013. getAvailableTime,
  17014. onSetOption
  17015. } = useTimePanel({
  17016. getAvailableHours,
  17017. getAvailableMinutes,
  17018. getAvailableSeconds
  17019. });
  17020. const parseUserInput = (days) => {
  17021. if (!days)
  17022. return null;
  17023. if (isArray(days)) {
  17024. return days.map((d) => dayjs(d, props.format).locale(lang.value));
  17025. }
  17026. return dayjs(days, props.format).locale(lang.value);
  17027. };
  17028. const formatToString = (days) => {
  17029. if (!days)
  17030. return null;
  17031. if (isArray(days)) {
  17032. return days.map((d) => d.format(props.format));
  17033. }
  17034. return days.format(props.format);
  17035. };
  17036. const getDefaultValue = () => {
  17037. if (isArray(defaultValue)) {
  17038. return defaultValue.map((d) => dayjs(d).locale(lang.value));
  17039. }
  17040. const defaultDay = dayjs(defaultValue).locale(lang.value);
  17041. return [defaultDay, defaultDay.add(60, "m")];
  17042. };
  17043. emit("set-picker-option", ["formatToString", formatToString]);
  17044. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  17045. emit("set-picker-option", ["isValidValue", isValidValue]);
  17046. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  17047. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  17048. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  17049. return (_ctx, _cache) => {
  17050. return _ctx.actualVisible ? (vue.openBlock(), vue.createElementBlock("div", {
  17051. key: 0,
  17052. class: vue.normalizeClass([vue.unref(nsTime).b("range-picker"), vue.unref(nsPicker).b("panel")])
  17053. }, [
  17054. vue.createElementVNode("div", {
  17055. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "content"))
  17056. }, [
  17057. vue.createElementVNode("div", {
  17058. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  17059. }, [
  17060. vue.createElementVNode("div", {
  17061. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  17062. }, vue.toDisplayString(vue.unref(t)("el.datepicker.startTime")), 3),
  17063. vue.createElementVNode("div", {
  17064. class: vue.normalizeClass([
  17065. vue.unref(nsTime).be("range-picker", "body"),
  17066. vue.unref(nsTime).be("panel", "content"),
  17067. vue.unref(nsTime).is("arrow", vue.unref(arrowControl)),
  17068. { "has-seconds": vue.unref(showSeconds) }
  17069. ])
  17070. }, [
  17071. vue.createVNode(TimeSpinner, {
  17072. ref: "minSpinner",
  17073. role: "start",
  17074. "show-seconds": vue.unref(showSeconds),
  17075. "am-pm-mode": vue.unref(amPmMode),
  17076. "arrow-control": vue.unref(arrowControl),
  17077. "spinner-date": vue.unref(startTime),
  17078. "disabled-hours": disabledHours_,
  17079. "disabled-minutes": disabledMinutes_,
  17080. "disabled-seconds": disabledSeconds_,
  17081. onChange: handleMinChange,
  17082. onSetOption: vue.unref(onSetOption),
  17083. onSelectRange: setMinSelectionRange
  17084. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  17085. ], 2)
  17086. ], 2),
  17087. vue.createElementVNode("div", {
  17088. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  17089. }, [
  17090. vue.createElementVNode("div", {
  17091. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  17092. }, vue.toDisplayString(vue.unref(t)("el.datepicker.endTime")), 3),
  17093. vue.createElementVNode("div", {
  17094. class: vue.normalizeClass([
  17095. vue.unref(nsTime).be("range-picker", "body"),
  17096. vue.unref(nsTime).be("panel", "content"),
  17097. vue.unref(nsTime).is("arrow", vue.unref(arrowControl)),
  17098. { "has-seconds": vue.unref(showSeconds) }
  17099. ])
  17100. }, [
  17101. vue.createVNode(TimeSpinner, {
  17102. ref: "maxSpinner",
  17103. role: "end",
  17104. "show-seconds": vue.unref(showSeconds),
  17105. "am-pm-mode": vue.unref(amPmMode),
  17106. "arrow-control": vue.unref(arrowControl),
  17107. "spinner-date": vue.unref(endTime),
  17108. "disabled-hours": disabledHours_,
  17109. "disabled-minutes": disabledMinutes_,
  17110. "disabled-seconds": disabledSeconds_,
  17111. onChange: handleMaxChange,
  17112. onSetOption: vue.unref(onSetOption),
  17113. onSelectRange: setMaxSelectionRange
  17114. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  17115. ], 2)
  17116. ], 2)
  17117. ], 2),
  17118. vue.createElementVNode("div", {
  17119. class: vue.normalizeClass(vue.unref(nsTime).be("panel", "footer"))
  17120. }, [
  17121. vue.createElementVNode("button", {
  17122. type: "button",
  17123. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "cancel"]),
  17124. onClick: _cache[0] || (_cache[0] = ($event) => handleCancel())
  17125. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  17126. vue.createElementVNode("button", {
  17127. type: "button",
  17128. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "confirm"]),
  17129. disabled: vue.unref(btnConfirmDisabled),
  17130. onClick: _cache[1] || (_cache[1] = ($event) => handleConfirm())
  17131. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, _hoisted_1$X)
  17132. ], 2)
  17133. ], 2)) : vue.createCommentVNode("v-if", true);
  17134. };
  17135. }
  17136. });
  17137. var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["__file", "panel-time-range.vue"]]);
  17138. dayjs.extend(customParseFormat);
  17139. var TimePicker = vue.defineComponent({
  17140. name: "ElTimePicker",
  17141. install: null,
  17142. props: {
  17143. ...timePickerDefaultProps,
  17144. isRange: {
  17145. type: Boolean,
  17146. default: false
  17147. }
  17148. },
  17149. emits: ["update:modelValue"],
  17150. setup(props, ctx) {
  17151. const commonPicker = vue.ref();
  17152. const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  17153. const modelUpdater = (value) => ctx.emit("update:modelValue", value);
  17154. vue.provide("ElPopperOptions", props.popperOptions);
  17155. ctx.expose({
  17156. focus: (e) => {
  17157. var _a;
  17158. (_a = commonPicker.value) == null ? void 0 : _a.handleFocusInput(e);
  17159. },
  17160. blur: (e) => {
  17161. var _a;
  17162. (_a = commonPicker.value) == null ? void 0 : _a.handleBlurInput(e);
  17163. },
  17164. handleOpen: () => {
  17165. var _a;
  17166. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  17167. },
  17168. handleClose: () => {
  17169. var _a;
  17170. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  17171. }
  17172. });
  17173. return () => {
  17174. var _a;
  17175. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
  17176. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  17177. "ref": commonPicker,
  17178. "type": type,
  17179. "format": format,
  17180. "onUpdate:modelValue": modelUpdater
  17181. }), {
  17182. default: (props2) => vue.createVNode(Panel, props2, null)
  17183. });
  17184. };
  17185. }
  17186. });
  17187. const _TimePicker = TimePicker;
  17188. _TimePicker.install = (app) => {
  17189. app.component(_TimePicker.name, _TimePicker);
  17190. };
  17191. const ElTimePicker = _TimePicker;
  17192. const getPrevMonthLastDays = (date, count) => {
  17193. const lastDay = date.subtract(1, "month").endOf("month").date();
  17194. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  17195. };
  17196. const getMonthDays = (date) => {
  17197. const days = date.daysInMonth();
  17198. return rangeArr(days).map((_, index) => index + 1);
  17199. };
  17200. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  17201. const start = index * 7;
  17202. return days.slice(start, start + 7);
  17203. });
  17204. const dateTableProps = buildProps({
  17205. selectedDay: {
  17206. type: definePropType(Object)
  17207. },
  17208. range: {
  17209. type: definePropType(Array)
  17210. },
  17211. date: {
  17212. type: definePropType(Object),
  17213. required: true
  17214. },
  17215. hideHeader: {
  17216. type: Boolean
  17217. }
  17218. });
  17219. const dateTableEmits = {
  17220. pick: (value) => isObject$1(value)
  17221. };
  17222. var localeData$1 = {exports: {}};
  17223. (function(module, exports) {
  17224. !function(n, e) {
  17225. module.exports = e() ;
  17226. }(commonjsGlobal, function() {
  17227. return function(n, e, t) {
  17228. var r = e.prototype, o = function(n2) {
  17229. return n2 && (n2.indexOf ? n2 : n2.s);
  17230. }, u = function(n2, e2, t2, r2, u2) {
  17231. var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
  17232. return n3.slice(0, r2);
  17233. });
  17234. if (!u2)
  17235. return f;
  17236. var d = i2.weekStart;
  17237. return f.map(function(n3, e3) {
  17238. return f[(e3 + (d || 0)) % 7];
  17239. });
  17240. }, i = function() {
  17241. return t.Ls[t.locale()];
  17242. }, a = function(n2, e2) {
  17243. return n2.formats[e2] || function(n3) {
  17244. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  17245. return e3 || t2.slice(1);
  17246. });
  17247. }(n2.formats[e2.toUpperCase()]);
  17248. }, s = function() {
  17249. var n2 = this;
  17250. return { months: function(e2) {
  17251. return e2 ? e2.format("MMMM") : u(n2, "months");
  17252. }, monthsShort: function(e2) {
  17253. return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
  17254. }, firstDayOfWeek: function() {
  17255. return n2.$locale().weekStart || 0;
  17256. }, weekdays: function(e2) {
  17257. return e2 ? e2.format("dddd") : u(n2, "weekdays");
  17258. }, weekdaysMin: function(e2) {
  17259. return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
  17260. }, weekdaysShort: function(e2) {
  17261. return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
  17262. }, longDateFormat: function(e2) {
  17263. return a(n2.$locale(), e2);
  17264. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  17265. };
  17266. r.localeData = function() {
  17267. return s.bind(this)();
  17268. }, t.localeData = function() {
  17269. var n2 = i();
  17270. return { firstDayOfWeek: function() {
  17271. return n2.weekStart || 0;
  17272. }, weekdays: function() {
  17273. return t.weekdays();
  17274. }, weekdaysShort: function() {
  17275. return t.weekdaysShort();
  17276. }, weekdaysMin: function() {
  17277. return t.weekdaysMin();
  17278. }, months: function() {
  17279. return t.months();
  17280. }, monthsShort: function() {
  17281. return t.monthsShort();
  17282. }, longDateFormat: function(e2) {
  17283. return a(n2, e2);
  17284. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  17285. }, t.months = function() {
  17286. return u(i(), "months");
  17287. }, t.monthsShort = function() {
  17288. return u(i(), "monthsShort", "months", 3);
  17289. }, t.weekdays = function(n2) {
  17290. return u(i(), "weekdays", null, null, n2);
  17291. }, t.weekdaysShort = function(n2) {
  17292. return u(i(), "weekdaysShort", "weekdays", 3, n2);
  17293. }, t.weekdaysMin = function(n2) {
  17294. return u(i(), "weekdaysMin", "weekdays", 2, n2);
  17295. };
  17296. };
  17297. });
  17298. })(localeData$1);
  17299. var localeData = localeData$1.exports;
  17300. const useDateTable = (props, emit) => {
  17301. dayjs.extend(localeData);
  17302. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  17303. const { t, lang } = useLocale();
  17304. const now = dayjs().locale(lang.value);
  17305. const isInRange = vue.computed(() => !!props.range && !!props.range.length);
  17306. const rows = vue.computed(() => {
  17307. let days = [];
  17308. if (isInRange.value) {
  17309. const [start, end] = props.range;
  17310. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  17311. text: start.date() + index,
  17312. type: "current"
  17313. }));
  17314. let remaining = currentMonthRange.length % 7;
  17315. remaining = remaining === 0 ? 0 : 7 - remaining;
  17316. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  17317. text: index + 1,
  17318. type: "next"
  17319. }));
  17320. days = currentMonthRange.concat(nextMonthRange);
  17321. } else {
  17322. const firstDay = props.date.startOf("month").day();
  17323. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  17324. text: day,
  17325. type: "prev"
  17326. }));
  17327. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  17328. text: day,
  17329. type: "current"
  17330. }));
  17331. days = [...prevMonthDays, ...currentMonthDays];
  17332. const remaining = 7 - (days.length % 7 || 7);
  17333. const nextMonthDays = rangeArr(remaining).map((_, index) => ({
  17334. text: index + 1,
  17335. type: "next"
  17336. }));
  17337. days = days.concat(nextMonthDays);
  17338. }
  17339. return toNestedArr(days);
  17340. });
  17341. const weekDays = vue.computed(() => {
  17342. const start = firstDayOfWeek;
  17343. if (start === 0) {
  17344. return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  17345. } else {
  17346. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  17347. }
  17348. });
  17349. const getFormattedDate = (day, type) => {
  17350. switch (type) {
  17351. case "prev":
  17352. return props.date.startOf("month").subtract(1, "month").date(day);
  17353. case "next":
  17354. return props.date.startOf("month").add(1, "month").date(day);
  17355. case "current":
  17356. return props.date.date(day);
  17357. }
  17358. };
  17359. const handlePickDay = ({ text, type }) => {
  17360. const date = getFormattedDate(text, type);
  17361. emit("pick", date);
  17362. };
  17363. const getSlotData = ({ text, type }) => {
  17364. const day = getFormattedDate(text, type);
  17365. return {
  17366. isSelected: day.isSame(props.selectedDay),
  17367. type: `${type}-month`,
  17368. day: day.format("YYYY-MM-DD"),
  17369. date: day.toDate()
  17370. };
  17371. };
  17372. return {
  17373. now,
  17374. isInRange,
  17375. rows,
  17376. weekDays,
  17377. getFormattedDate,
  17378. handlePickDay,
  17379. getSlotData
  17380. };
  17381. };
  17382. const _hoisted_1$W = { key: 0 };
  17383. const _hoisted_2$B = ["onClick"];
  17384. const __default__$1b = vue.defineComponent({
  17385. name: "DateTable"
  17386. });
  17387. const _sfc_main$1Q = /* @__PURE__ */ vue.defineComponent({
  17388. ...__default__$1b,
  17389. props: dateTableProps,
  17390. emits: dateTableEmits,
  17391. setup(__props, { expose, emit }) {
  17392. const props = __props;
  17393. const {
  17394. isInRange,
  17395. now,
  17396. rows,
  17397. weekDays,
  17398. getFormattedDate,
  17399. handlePickDay,
  17400. getSlotData
  17401. } = useDateTable(props, emit);
  17402. const nsTable = useNamespace("calendar-table");
  17403. const nsDay = useNamespace("calendar-day");
  17404. const getCellClass = ({ text, type }) => {
  17405. const classes = [type];
  17406. if (type === "current") {
  17407. const date = getFormattedDate(text, type);
  17408. if (date.isSame(props.selectedDay, "day")) {
  17409. classes.push(nsDay.is("selected"));
  17410. }
  17411. if (date.isSame(now, "day")) {
  17412. classes.push(nsDay.is("today"));
  17413. }
  17414. }
  17415. return classes;
  17416. };
  17417. expose({
  17418. getFormattedDate
  17419. });
  17420. return (_ctx, _cache) => {
  17421. return vue.openBlock(), vue.createElementBlock("table", {
  17422. class: vue.normalizeClass([vue.unref(nsTable).b(), vue.unref(nsTable).is("range", vue.unref(isInRange))]),
  17423. cellspacing: "0",
  17424. cellpadding: "0"
  17425. }, [
  17426. !_ctx.hideHeader ? (vue.openBlock(), vue.createElementBlock("thead", _hoisted_1$W, [
  17427. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(weekDays), (day) => {
  17428. return vue.openBlock(), vue.createElementBlock("th", { key: day }, vue.toDisplayString(day), 1);
  17429. }), 128))
  17430. ])) : vue.createCommentVNode("v-if", true),
  17431. vue.createElementVNode("tbody", null, [
  17432. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, index) => {
  17433. return vue.openBlock(), vue.createElementBlock("tr", {
  17434. key: index,
  17435. class: vue.normalizeClass({
  17436. [vue.unref(nsTable).e("row")]: true,
  17437. [vue.unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
  17438. })
  17439. }, [
  17440. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key) => {
  17441. return vue.openBlock(), vue.createElementBlock("td", {
  17442. key,
  17443. class: vue.normalizeClass(getCellClass(cell)),
  17444. onClick: ($event) => vue.unref(handlePickDay)(cell)
  17445. }, [
  17446. vue.createElementVNode("div", {
  17447. class: vue.normalizeClass(vue.unref(nsDay).b())
  17448. }, [
  17449. vue.renderSlot(_ctx.$slots, "date-cell", {
  17450. data: vue.unref(getSlotData)(cell)
  17451. }, () => [
  17452. vue.createElementVNode("span", null, vue.toDisplayString(cell.text), 1)
  17453. ])
  17454. ], 2)
  17455. ], 10, _hoisted_2$B);
  17456. }), 128))
  17457. ], 2);
  17458. }), 128))
  17459. ])
  17460. ], 2);
  17461. };
  17462. }
  17463. });
  17464. var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["__file", "date-table.vue"]]);
  17465. const adjacentMonth = (start, end) => {
  17466. const firstMonthLastDay = start.endOf("month");
  17467. const lastMonthFirstDay = end.startOf("month");
  17468. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  17469. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  17470. return [
  17471. [start, firstMonthLastDay],
  17472. [lastMonthStartDay.startOf("week"), end]
  17473. ];
  17474. };
  17475. const threeConsecutiveMonth = (start, end) => {
  17476. const firstMonthLastDay = start.endOf("month");
  17477. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  17478. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  17479. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  17480. const lastMonthFirstDay = end.startOf("month");
  17481. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  17482. return [
  17483. [start, firstMonthLastDay],
  17484. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  17485. [lastMonthStartDay.startOf("week"), end]
  17486. ];
  17487. };
  17488. const useCalendar = (props, emit, componentName) => {
  17489. const slots = vue.useSlots();
  17490. const { lang } = useLocale();
  17491. const selectedDay = vue.ref();
  17492. const now = dayjs().locale(lang.value);
  17493. const realSelectedDay = vue.computed({
  17494. get() {
  17495. if (!props.modelValue)
  17496. return selectedDay.value;
  17497. return date.value;
  17498. },
  17499. set(val) {
  17500. if (!val)
  17501. return;
  17502. selectedDay.value = val;
  17503. const result = val.toDate();
  17504. emit(INPUT_EVENT, result);
  17505. emit(UPDATE_MODEL_EVENT, result);
  17506. }
  17507. });
  17508. const validatedRange = vue.computed(() => {
  17509. if (!props.range)
  17510. return [];
  17511. const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
  17512. const [startDayjs, endDayjs] = rangeArrDayjs;
  17513. if (startDayjs.isAfter(endDayjs)) {
  17514. return [];
  17515. }
  17516. if (startDayjs.isSame(endDayjs, "month")) {
  17517. return calculateValidatedDateRange(startDayjs, endDayjs);
  17518. } else {
  17519. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  17520. return [];
  17521. }
  17522. return calculateValidatedDateRange(startDayjs, endDayjs);
  17523. }
  17524. });
  17525. const date = vue.computed(() => {
  17526. if (!props.modelValue) {
  17527. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  17528. } else {
  17529. return dayjs(props.modelValue).locale(lang.value);
  17530. }
  17531. });
  17532. const prevMonthDayjs = vue.computed(() => date.value.subtract(1, "month").date(1));
  17533. const nextMonthDayjs = vue.computed(() => date.value.add(1, "month").date(1));
  17534. const prevYearDayjs = vue.computed(() => date.value.subtract(1, "year").date(1));
  17535. const nextYearDayjs = vue.computed(() => date.value.add(1, "year").date(1));
  17536. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  17537. const firstDay = startDayjs.startOf("week");
  17538. const lastDay = endDayjs.endOf("week");
  17539. const firstMonth = firstDay.get("month");
  17540. const lastMonth = lastDay.get("month");
  17541. if (firstMonth === lastMonth) {
  17542. return [[firstDay, lastDay]];
  17543. } else if ((firstMonth + 1) % 12 === lastMonth) {
  17544. return adjacentMonth(firstDay, lastDay);
  17545. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  17546. return threeConsecutiveMonth(firstDay, lastDay);
  17547. } else {
  17548. return [];
  17549. }
  17550. };
  17551. const pickDay = (day) => {
  17552. realSelectedDay.value = day;
  17553. };
  17554. const selectDate = (type) => {
  17555. const dateMap = {
  17556. "prev-month": prevMonthDayjs.value,
  17557. "next-month": nextMonthDayjs.value,
  17558. "prev-year": prevYearDayjs.value,
  17559. "next-year": nextYearDayjs.value,
  17560. today: now
  17561. };
  17562. const day = dateMap[type];
  17563. if (!day.isSame(date.value, "day")) {
  17564. pickDay(day);
  17565. }
  17566. };
  17567. useDeprecated({
  17568. from: '"dateCell"',
  17569. replacement: '"date-cell"',
  17570. scope: "ElCalendar",
  17571. version: "2.3.0",
  17572. ref: "https://element-plus.org/en-US/component/calendar.html#slots",
  17573. type: "Slot"
  17574. }, vue.computed(() => !!slots.dateCell));
  17575. return {
  17576. calculateValidatedDateRange,
  17577. date,
  17578. realSelectedDay,
  17579. pickDay,
  17580. selectDate,
  17581. validatedRange
  17582. };
  17583. };
  17584. const isValidRange$1 = (range) => isArray(range) && range.length === 2 && range.every((item) => isDate(item));
  17585. const calendarProps = buildProps({
  17586. modelValue: {
  17587. type: Date
  17588. },
  17589. range: {
  17590. type: definePropType(Array),
  17591. validator: isValidRange$1
  17592. }
  17593. });
  17594. const calendarEmits = {
  17595. [UPDATE_MODEL_EVENT]: (value) => isDate(value),
  17596. [INPUT_EVENT]: (value) => isDate(value)
  17597. };
  17598. const COMPONENT_NAME$h = "ElCalendar";
  17599. const __default__$1a = vue.defineComponent({
  17600. name: COMPONENT_NAME$h
  17601. });
  17602. const _sfc_main$1P = /* @__PURE__ */ vue.defineComponent({
  17603. ...__default__$1a,
  17604. props: calendarProps,
  17605. emits: calendarEmits,
  17606. setup(__props, { expose, emit }) {
  17607. const props = __props;
  17608. const ns = useNamespace("calendar");
  17609. const {
  17610. calculateValidatedDateRange,
  17611. date,
  17612. pickDay,
  17613. realSelectedDay,
  17614. selectDate,
  17615. validatedRange
  17616. } = useCalendar(props, emit);
  17617. const { t } = useLocale();
  17618. const i18nDate = vue.computed(() => {
  17619. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  17620. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  17621. });
  17622. expose({
  17623. selectedDay: realSelectedDay,
  17624. pickDay,
  17625. selectDate,
  17626. calculateValidatedDateRange
  17627. });
  17628. return (_ctx, _cache) => {
  17629. return vue.openBlock(), vue.createElementBlock("div", {
  17630. class: vue.normalizeClass(vue.unref(ns).b())
  17631. }, [
  17632. vue.createElementVNode("div", {
  17633. class: vue.normalizeClass(vue.unref(ns).e("header"))
  17634. }, [
  17635. vue.renderSlot(_ctx.$slots, "header", { date: vue.unref(i18nDate) }, () => [
  17636. vue.createElementVNode("div", {
  17637. class: vue.normalizeClass(vue.unref(ns).e("title"))
  17638. }, vue.toDisplayString(vue.unref(i18nDate)), 3),
  17639. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  17640. key: 0,
  17641. class: vue.normalizeClass(vue.unref(ns).e("button-group"))
  17642. }, [
  17643. vue.createVNode(vue.unref(ElButtonGroup$1), null, {
  17644. default: vue.withCtx(() => [
  17645. vue.createVNode(vue.unref(ElButton), {
  17646. size: "small",
  17647. onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(selectDate)("prev-month"))
  17648. }, {
  17649. default: vue.withCtx(() => [
  17650. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.prevMonth")), 1)
  17651. ]),
  17652. _: 1
  17653. }),
  17654. vue.createVNode(vue.unref(ElButton), {
  17655. size: "small",
  17656. onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(selectDate)("today"))
  17657. }, {
  17658. default: vue.withCtx(() => [
  17659. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.today")), 1)
  17660. ]),
  17661. _: 1
  17662. }),
  17663. vue.createVNode(vue.unref(ElButton), {
  17664. size: "small",
  17665. onClick: _cache[2] || (_cache[2] = ($event) => vue.unref(selectDate)("next-month"))
  17666. }, {
  17667. default: vue.withCtx(() => [
  17668. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.nextMonth")), 1)
  17669. ]),
  17670. _: 1
  17671. })
  17672. ]),
  17673. _: 1
  17674. })
  17675. ], 2)) : vue.createCommentVNode("v-if", true)
  17676. ])
  17677. ], 2),
  17678. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  17679. key: 0,
  17680. class: vue.normalizeClass(vue.unref(ns).e("body"))
  17681. }, [
  17682. vue.createVNode(DateTable$1, {
  17683. date: vue.unref(date),
  17684. "selected-day": vue.unref(realSelectedDay),
  17685. onPick: vue.unref(pickDay)
  17686. }, vue.createSlots({ _: 2 }, [
  17687. _ctx.$slots["date-cell"] || _ctx.$slots.dateCell ? {
  17688. name: "date-cell",
  17689. fn: vue.withCtx((data) => [
  17690. _ctx.$slots["date-cell"] ? vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.mergeProps({ key: 0 }, data))) : vue.renderSlot(_ctx.$slots, "dateCell", vue.normalizeProps(vue.mergeProps({ key: 1 }, data)))
  17691. ])
  17692. } : void 0
  17693. ]), 1032, ["date", "selected-day", "onPick"])
  17694. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  17695. key: 1,
  17696. class: vue.normalizeClass(vue.unref(ns).e("body"))
  17697. }, [
  17698. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(validatedRange), (range_, index) => {
  17699. return vue.openBlock(), vue.createBlock(DateTable$1, {
  17700. key: index,
  17701. date: range_[0],
  17702. "selected-day": vue.unref(realSelectedDay),
  17703. range: range_,
  17704. "hide-header": index !== 0,
  17705. onPick: vue.unref(pickDay)
  17706. }, vue.createSlots({ _: 2 }, [
  17707. _ctx.$slots["date-cell"] || _ctx.$slots.dateCell ? {
  17708. name: "date-cell",
  17709. fn: vue.withCtx((data) => [
  17710. _ctx.$slots["date-cell"] ? vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.mergeProps({ key: 0 }, data))) : vue.renderSlot(_ctx.$slots, "dateCell", vue.normalizeProps(vue.mergeProps({ key: 1 }, data)))
  17711. ])
  17712. } : void 0
  17713. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  17714. }), 128))
  17715. ], 2))
  17716. ], 2);
  17717. };
  17718. }
  17719. });
  17720. var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["__file", "calendar.vue"]]);
  17721. const ElCalendar = withInstall(Calendar);
  17722. const cardProps = buildProps({
  17723. header: {
  17724. type: String,
  17725. default: ""
  17726. },
  17727. bodyStyle: {
  17728. type: definePropType([String, Object, Array]),
  17729. default: ""
  17730. },
  17731. shadow: {
  17732. type: String,
  17733. values: ["always", "hover", "never"],
  17734. default: "always"
  17735. }
  17736. });
  17737. const __default__$19 = vue.defineComponent({
  17738. name: "ElCard"
  17739. });
  17740. const _sfc_main$1O = /* @__PURE__ */ vue.defineComponent({
  17741. ...__default__$19,
  17742. props: cardProps,
  17743. setup(__props) {
  17744. const ns = useNamespace("card");
  17745. return (_ctx, _cache) => {
  17746. return vue.openBlock(), vue.createElementBlock("div", {
  17747. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is(`${_ctx.shadow}-shadow`)])
  17748. }, [
  17749. _ctx.$slots.header || _ctx.header ? (vue.openBlock(), vue.createElementBlock("div", {
  17750. key: 0,
  17751. class: vue.normalizeClass(vue.unref(ns).e("header"))
  17752. }, [
  17753. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  17754. vue.createTextVNode(vue.toDisplayString(_ctx.header), 1)
  17755. ])
  17756. ], 2)) : vue.createCommentVNode("v-if", true),
  17757. vue.createElementVNode("div", {
  17758. class: vue.normalizeClass(vue.unref(ns).e("body")),
  17759. style: vue.normalizeStyle(_ctx.bodyStyle)
  17760. }, [
  17761. vue.renderSlot(_ctx.$slots, "default")
  17762. ], 6)
  17763. ], 2);
  17764. };
  17765. }
  17766. });
  17767. var Card = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["__file", "card.vue"]]);
  17768. const ElCard = withInstall(Card);
  17769. const carouselProps = buildProps({
  17770. initialIndex: {
  17771. type: Number,
  17772. default: 0
  17773. },
  17774. height: {
  17775. type: String,
  17776. default: ""
  17777. },
  17778. trigger: {
  17779. type: String,
  17780. values: ["hover", "click"],
  17781. default: "hover"
  17782. },
  17783. autoplay: {
  17784. type: Boolean,
  17785. default: true
  17786. },
  17787. interval: {
  17788. type: Number,
  17789. default: 3e3
  17790. },
  17791. indicatorPosition: {
  17792. type: String,
  17793. values: ["", "none", "outside"],
  17794. default: ""
  17795. },
  17796. indicator: {
  17797. type: Boolean,
  17798. default: true
  17799. },
  17800. arrow: {
  17801. type: String,
  17802. values: ["always", "hover", "never"],
  17803. default: "hover"
  17804. },
  17805. type: {
  17806. type: String,
  17807. values: ["", "card"],
  17808. default: ""
  17809. },
  17810. loop: {
  17811. type: Boolean,
  17812. default: true
  17813. },
  17814. direction: {
  17815. type: String,
  17816. values: ["horizontal", "vertical"],
  17817. default: "horizontal"
  17818. },
  17819. pauseOnHover: {
  17820. type: Boolean,
  17821. default: true
  17822. }
  17823. });
  17824. const carouselEmits = {
  17825. change: (current, prev) => [current, prev].every(isNumber)
  17826. };
  17827. const THROTTLE_TIME = 300;
  17828. const useCarousel = (props, emit, componentName) => {
  17829. const {
  17830. children: items,
  17831. addChild: addItem,
  17832. removeChild: removeItem
  17833. } = useOrderedChildren(vue.getCurrentInstance(), "ElCarouselItem");
  17834. const activeIndex = vue.ref(-1);
  17835. const timer = vue.ref(null);
  17836. const hover = vue.ref(false);
  17837. const root = vue.ref();
  17838. const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
  17839. const hasLabel = vue.computed(() => {
  17840. return items.value.some((item) => item.props.label.toString().length > 0);
  17841. });
  17842. const isCardType = vue.computed(() => props.type === "card");
  17843. const isVertical = vue.computed(() => props.direction === "vertical");
  17844. const throttledArrowClick = throttle((index) => {
  17845. setActiveItem(index);
  17846. }, THROTTLE_TIME, { trailing: true });
  17847. const throttledIndicatorHover = throttle((index) => {
  17848. handleIndicatorHover(index);
  17849. }, THROTTLE_TIME);
  17850. function pauseTimer() {
  17851. if (timer.value) {
  17852. clearInterval(timer.value);
  17853. timer.value = null;
  17854. }
  17855. }
  17856. function startTimer() {
  17857. if (props.interval <= 0 || !props.autoplay || timer.value)
  17858. return;
  17859. timer.value = setInterval(() => playSlides(), props.interval);
  17860. }
  17861. const playSlides = () => {
  17862. if (activeIndex.value < items.value.length - 1) {
  17863. activeIndex.value = activeIndex.value + 1;
  17864. } else if (props.loop) {
  17865. activeIndex.value = 0;
  17866. }
  17867. };
  17868. function setActiveItem(index) {
  17869. if (isString(index)) {
  17870. const filteredItems = items.value.filter((item) => item.props.name === index);
  17871. if (filteredItems.length > 0) {
  17872. index = items.value.indexOf(filteredItems[0]);
  17873. }
  17874. }
  17875. index = Number(index);
  17876. if (Number.isNaN(index) || index !== Math.floor(index)) {
  17877. return;
  17878. }
  17879. const itemCount = items.value.length;
  17880. const oldIndex = activeIndex.value;
  17881. if (index < 0) {
  17882. activeIndex.value = props.loop ? itemCount - 1 : 0;
  17883. } else if (index >= itemCount) {
  17884. activeIndex.value = props.loop ? 0 : itemCount - 1;
  17885. } else {
  17886. activeIndex.value = index;
  17887. }
  17888. if (oldIndex === activeIndex.value) {
  17889. resetItemPosition(oldIndex);
  17890. }
  17891. resetTimer();
  17892. }
  17893. function resetItemPosition(oldIndex) {
  17894. items.value.forEach((item, index) => {
  17895. item.translateItem(index, activeIndex.value, oldIndex);
  17896. });
  17897. }
  17898. function itemInStage(item, index) {
  17899. var _a, _b, _c, _d;
  17900. const _items = vue.unref(items);
  17901. const itemCount = _items.length;
  17902. if (itemCount === 0 || !item.states.inStage)
  17903. return false;
  17904. const nextItemIndex = index + 1;
  17905. const prevItemIndex = index - 1;
  17906. const lastItemIndex = itemCount - 1;
  17907. const isLastItemActive = _items[lastItemIndex].states.active;
  17908. const isFirstItemActive = _items[0].states.active;
  17909. const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
  17910. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  17911. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
  17912. return "left";
  17913. } else if (index === 0 && isLastItemActive || isPrevItemActive) {
  17914. return "right";
  17915. }
  17916. return false;
  17917. }
  17918. function handleMouseEnter() {
  17919. hover.value = true;
  17920. if (props.pauseOnHover) {
  17921. pauseTimer();
  17922. }
  17923. }
  17924. function handleMouseLeave() {
  17925. hover.value = false;
  17926. startTimer();
  17927. }
  17928. function handleButtonEnter(arrow) {
  17929. if (vue.unref(isVertical))
  17930. return;
  17931. items.value.forEach((item, index) => {
  17932. if (arrow === itemInStage(item, index)) {
  17933. item.states.hover = true;
  17934. }
  17935. });
  17936. }
  17937. function handleButtonLeave() {
  17938. if (vue.unref(isVertical))
  17939. return;
  17940. items.value.forEach((item) => {
  17941. item.states.hover = false;
  17942. });
  17943. }
  17944. function handleIndicatorClick(index) {
  17945. activeIndex.value = index;
  17946. }
  17947. function handleIndicatorHover(index) {
  17948. if (props.trigger === "hover" && index !== activeIndex.value) {
  17949. activeIndex.value = index;
  17950. }
  17951. }
  17952. function prev() {
  17953. setActiveItem(activeIndex.value - 1);
  17954. }
  17955. function next() {
  17956. setActiveItem(activeIndex.value + 1);
  17957. }
  17958. function resetTimer() {
  17959. pauseTimer();
  17960. startTimer();
  17961. }
  17962. vue.watch(() => activeIndex.value, (current, prev2) => {
  17963. resetItemPosition(prev2);
  17964. if (prev2 > -1) {
  17965. emit("change", current, prev2);
  17966. }
  17967. });
  17968. vue.watch(() => props.autoplay, (autoplay) => {
  17969. autoplay ? startTimer() : pauseTimer();
  17970. });
  17971. vue.watch(() => props.loop, () => {
  17972. setActiveItem(activeIndex.value);
  17973. });
  17974. vue.watch(() => props.interval, () => {
  17975. resetTimer();
  17976. });
  17977. vue.watch(() => items.value, () => {
  17978. if (items.value.length > 0)
  17979. setActiveItem(props.initialIndex);
  17980. });
  17981. const resizeObserver = vue.shallowRef();
  17982. vue.onMounted(() => {
  17983. resizeObserver.value = useResizeObserver(root.value, () => {
  17984. resetItemPosition();
  17985. });
  17986. startTimer();
  17987. });
  17988. vue.onBeforeUnmount(() => {
  17989. pauseTimer();
  17990. if (root.value && resizeObserver.value)
  17991. resizeObserver.value.stop();
  17992. });
  17993. vue.provide(carouselContextKey, {
  17994. root,
  17995. isCardType,
  17996. isVertical,
  17997. items,
  17998. loop: props.loop,
  17999. addItem,
  18000. removeItem,
  18001. setActiveItem
  18002. });
  18003. return {
  18004. root,
  18005. activeIndex,
  18006. arrowDisplay,
  18007. hasLabel,
  18008. hover,
  18009. isCardType,
  18010. items,
  18011. handleButtonEnter,
  18012. handleButtonLeave,
  18013. handleIndicatorClick,
  18014. handleMouseEnter,
  18015. handleMouseLeave,
  18016. setActiveItem,
  18017. prev,
  18018. next,
  18019. throttledArrowClick,
  18020. throttledIndicatorHover
  18021. };
  18022. };
  18023. const _hoisted_1$V = ["onMouseenter", "onClick"];
  18024. const _hoisted_2$A = { key: 0 };
  18025. const COMPONENT_NAME$g = "ElCarousel";
  18026. const __default__$18 = vue.defineComponent({
  18027. name: COMPONENT_NAME$g
  18028. });
  18029. const _sfc_main$1N = /* @__PURE__ */ vue.defineComponent({
  18030. ...__default__$18,
  18031. props: carouselProps,
  18032. emits: carouselEmits,
  18033. setup(__props, { expose, emit }) {
  18034. const props = __props;
  18035. const {
  18036. root,
  18037. activeIndex,
  18038. arrowDisplay,
  18039. hasLabel,
  18040. hover,
  18041. isCardType,
  18042. items,
  18043. handleButtonEnter,
  18044. handleButtonLeave,
  18045. handleIndicatorClick,
  18046. handleMouseEnter,
  18047. handleMouseLeave,
  18048. setActiveItem,
  18049. prev,
  18050. next,
  18051. throttledArrowClick,
  18052. throttledIndicatorHover
  18053. } = useCarousel(props, emit);
  18054. const ns = useNamespace("carousel");
  18055. const carouselClasses = vue.computed(() => {
  18056. const classes = [ns.b(), ns.m(props.direction)];
  18057. if (vue.unref(isCardType)) {
  18058. classes.push(ns.m("card"));
  18059. }
  18060. return classes;
  18061. });
  18062. const indicatorsClasses = vue.computed(() => {
  18063. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  18064. if (vue.unref(hasLabel)) {
  18065. classes.push(ns.em("indicators", "labels"));
  18066. }
  18067. if (props.indicatorPosition === "outside" || vue.unref(isCardType)) {
  18068. classes.push(ns.em("indicators", "outside"));
  18069. }
  18070. return classes;
  18071. });
  18072. expose({
  18073. setActiveItem,
  18074. prev,
  18075. next
  18076. });
  18077. return (_ctx, _cache) => {
  18078. return vue.openBlock(), vue.createElementBlock("div", {
  18079. ref_key: "root",
  18080. ref: root,
  18081. class: vue.normalizeClass(vue.unref(carouselClasses)),
  18082. onMouseenter: _cache[6] || (_cache[6] = vue.withModifiers((...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args), ["stop"])),
  18083. onMouseleave: _cache[7] || (_cache[7] = vue.withModifiers((...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args), ["stop"]))
  18084. }, [
  18085. vue.createElementVNode("div", {
  18086. class: vue.normalizeClass(vue.unref(ns).e("container")),
  18087. style: vue.normalizeStyle({ height: _ctx.height })
  18088. }, [
  18089. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  18090. key: 0,
  18091. name: "carousel-arrow-left",
  18092. persisted: ""
  18093. }, {
  18094. default: vue.withCtx(() => [
  18095. vue.withDirectives(vue.createElementVNode("button", {
  18096. type: "button",
  18097. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "left")]),
  18098. onMouseenter: _cache[0] || (_cache[0] = ($event) => vue.unref(handleButtonEnter)("left")),
  18099. onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
  18100. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) - 1), ["stop"]))
  18101. }, [
  18102. vue.createVNode(vue.unref(ElIcon), null, {
  18103. default: vue.withCtx(() => [
  18104. vue.createVNode(vue.unref(arrow_left_default))
  18105. ]),
  18106. _: 1
  18107. })
  18108. ], 34), [
  18109. [
  18110. vue.vShow,
  18111. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) > 0)
  18112. ]
  18113. ])
  18114. ]),
  18115. _: 1
  18116. })) : vue.createCommentVNode("v-if", true),
  18117. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  18118. key: 1,
  18119. name: "carousel-arrow-right",
  18120. persisted: ""
  18121. }, {
  18122. default: vue.withCtx(() => [
  18123. vue.withDirectives(vue.createElementVNode("button", {
  18124. type: "button",
  18125. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "right")]),
  18126. onMouseenter: _cache[3] || (_cache[3] = ($event) => vue.unref(handleButtonEnter)("right")),
  18127. onMouseleave: _cache[4] || (_cache[4] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
  18128. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) + 1), ["stop"]))
  18129. }, [
  18130. vue.createVNode(vue.unref(ElIcon), null, {
  18131. default: vue.withCtx(() => [
  18132. vue.createVNode(vue.unref(arrow_right_default))
  18133. ]),
  18134. _: 1
  18135. })
  18136. ], 34), [
  18137. [
  18138. vue.vShow,
  18139. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) < vue.unref(items).length - 1)
  18140. ]
  18141. ])
  18142. ]),
  18143. _: 1
  18144. })) : vue.createCommentVNode("v-if", true),
  18145. vue.renderSlot(_ctx.$slots, "default")
  18146. ], 6),
  18147. _ctx.indicatorPosition !== "none" ? (vue.openBlock(), vue.createElementBlock("ul", {
  18148. key: 0,
  18149. class: vue.normalizeClass(vue.unref(indicatorsClasses))
  18150. }, [
  18151. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item, index) => {
  18152. return vue.openBlock(), vue.createElementBlock("li", {
  18153. key: index,
  18154. class: vue.normalizeClass([
  18155. vue.unref(ns).e("indicator"),
  18156. vue.unref(ns).em("indicator", _ctx.direction),
  18157. vue.unref(ns).is("active", index === vue.unref(activeIndex))
  18158. ]),
  18159. onMouseenter: ($event) => vue.unref(throttledIndicatorHover)(index),
  18160. onClick: vue.withModifiers(($event) => vue.unref(handleIndicatorClick)(index), ["stop"])
  18161. }, [
  18162. vue.createElementVNode("button", {
  18163. class: vue.normalizeClass(vue.unref(ns).e("button"))
  18164. }, [
  18165. vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$A, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
  18166. ], 2)
  18167. ], 42, _hoisted_1$V);
  18168. }), 128))
  18169. ], 2)) : vue.createCommentVNode("v-if", true)
  18170. ], 34);
  18171. };
  18172. }
  18173. });
  18174. var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["__file", "carousel.vue"]]);
  18175. const carouselItemProps = buildProps({
  18176. name: { type: String, default: "" },
  18177. label: {
  18178. type: [String, Number],
  18179. default: ""
  18180. }
  18181. });
  18182. const useCarouselItem = (props, componentName) => {
  18183. const carouselContext = vue.inject(carouselContextKey);
  18184. const instance = vue.getCurrentInstance();
  18185. const CARD_SCALE = 0.83;
  18186. const hover = vue.ref(false);
  18187. const translate = vue.ref(0);
  18188. const scale = vue.ref(1);
  18189. const active = vue.ref(false);
  18190. const ready = vue.ref(false);
  18191. const inStage = vue.ref(false);
  18192. const animating = vue.ref(false);
  18193. const { isCardType, isVertical } = carouselContext;
  18194. function processIndex(index, activeIndex, length) {
  18195. const lastItemIndex = length - 1;
  18196. const prevItemIndex = activeIndex - 1;
  18197. const nextItemIndex = activeIndex + 1;
  18198. const halfItemIndex = length / 2;
  18199. if (activeIndex === 0 && index === lastItemIndex) {
  18200. return -1;
  18201. } else if (activeIndex === lastItemIndex && index === 0) {
  18202. return length;
  18203. } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
  18204. return length + 1;
  18205. } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
  18206. return -2;
  18207. }
  18208. return index;
  18209. }
  18210. function calcCardTranslate(index, activeIndex) {
  18211. var _a;
  18212. const parentWidth = ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetWidth) || 0;
  18213. if (inStage.value) {
  18214. return parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1) / 4;
  18215. } else if (index < activeIndex) {
  18216. return -(1 + CARD_SCALE) * parentWidth / 4;
  18217. } else {
  18218. return (3 + CARD_SCALE) * parentWidth / 4;
  18219. }
  18220. }
  18221. function calcTranslate(index, activeIndex, isVertical2) {
  18222. const rootEl = carouselContext.root.value;
  18223. if (!rootEl)
  18224. return 0;
  18225. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  18226. return distance * (index - activeIndex);
  18227. }
  18228. const translateItem = (index, activeIndex, oldIndex) => {
  18229. var _a;
  18230. const _isCardType = vue.unref(isCardType);
  18231. const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
  18232. const isActive = index === activeIndex;
  18233. if (!_isCardType && !isUndefined(oldIndex)) {
  18234. animating.value = isActive || index === oldIndex;
  18235. }
  18236. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  18237. index = processIndex(index, activeIndex, carouselItemLength);
  18238. }
  18239. const _isVertical = vue.unref(isVertical);
  18240. active.value = isActive;
  18241. if (_isCardType) {
  18242. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  18243. translate.value = calcCardTranslate(index, activeIndex);
  18244. scale.value = vue.unref(active) ? 1 : CARD_SCALE;
  18245. } else {
  18246. translate.value = calcTranslate(index, activeIndex, _isVertical);
  18247. }
  18248. ready.value = true;
  18249. };
  18250. function handleItemClick() {
  18251. if (carouselContext && vue.unref(isCardType)) {
  18252. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  18253. carouselContext.setActiveItem(index);
  18254. }
  18255. }
  18256. vue.onMounted(() => {
  18257. carouselContext.addItem({
  18258. props,
  18259. states: vue.reactive({
  18260. hover,
  18261. translate,
  18262. scale,
  18263. active,
  18264. ready,
  18265. inStage,
  18266. animating
  18267. }),
  18268. uid: instance.uid,
  18269. translateItem
  18270. });
  18271. });
  18272. vue.onUnmounted(() => {
  18273. carouselContext.removeItem(instance.uid);
  18274. });
  18275. return {
  18276. active,
  18277. animating,
  18278. hover,
  18279. inStage,
  18280. isVertical,
  18281. translate,
  18282. isCardType,
  18283. scale,
  18284. ready,
  18285. handleItemClick
  18286. };
  18287. };
  18288. const __default__$17 = vue.defineComponent({
  18289. name: "ElCarouselItem"
  18290. });
  18291. const _sfc_main$1M = /* @__PURE__ */ vue.defineComponent({
  18292. ...__default__$17,
  18293. props: carouselItemProps,
  18294. setup(__props) {
  18295. const props = __props;
  18296. const ns = useNamespace("carousel");
  18297. const {
  18298. active,
  18299. animating,
  18300. hover,
  18301. inStage,
  18302. isVertical,
  18303. translate,
  18304. isCardType,
  18305. scale,
  18306. ready,
  18307. handleItemClick
  18308. } = useCarouselItem(props);
  18309. const itemStyle = vue.computed(() => {
  18310. const translateType = `translate${vue.unref(isVertical) ? "Y" : "X"}`;
  18311. const _translate = `${translateType}(${vue.unref(translate)}px)`;
  18312. const _scale = `scale(${vue.unref(scale)})`;
  18313. const transform = [_translate, _scale].join(" ");
  18314. return {
  18315. transform
  18316. };
  18317. });
  18318. return (_ctx, _cache) => {
  18319. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  18320. class: vue.normalizeClass([
  18321. vue.unref(ns).e("item"),
  18322. vue.unref(ns).is("active", vue.unref(active)),
  18323. vue.unref(ns).is("in-stage", vue.unref(inStage)),
  18324. vue.unref(ns).is("hover", vue.unref(hover)),
  18325. vue.unref(ns).is("animating", vue.unref(animating)),
  18326. { [vue.unref(ns).em("item", "card")]: vue.unref(isCardType) }
  18327. ]),
  18328. style: vue.normalizeStyle(vue.unref(itemStyle)),
  18329. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleItemClick) && vue.unref(handleItemClick)(...args))
  18330. }, [
  18331. vue.unref(isCardType) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  18332. key: 0,
  18333. class: vue.normalizeClass(vue.unref(ns).e("mask"))
  18334. }, null, 2)), [
  18335. [vue.vShow, !vue.unref(active)]
  18336. ]) : vue.createCommentVNode("v-if", true),
  18337. vue.renderSlot(_ctx.$slots, "default")
  18338. ], 6)), [
  18339. [vue.vShow, vue.unref(ready)]
  18340. ]);
  18341. };
  18342. }
  18343. });
  18344. var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["__file", "carousel-item.vue"]]);
  18345. const ElCarousel = withInstall(Carousel, {
  18346. CarouselItem
  18347. });
  18348. const ElCarouselItem = withNoopInstall(CarouselItem);
  18349. const checkboxProps = {
  18350. modelValue: {
  18351. type: [Number, String, Boolean],
  18352. default: void 0
  18353. },
  18354. label: {
  18355. type: [String, Boolean, Number, Object]
  18356. },
  18357. indeterminate: Boolean,
  18358. disabled: Boolean,
  18359. checked: Boolean,
  18360. name: {
  18361. type: String,
  18362. default: void 0
  18363. },
  18364. trueLabel: {
  18365. type: [String, Number],
  18366. default: void 0
  18367. },
  18368. falseLabel: {
  18369. type: [String, Number],
  18370. default: void 0
  18371. },
  18372. id: {
  18373. type: String,
  18374. default: void 0
  18375. },
  18376. controls: {
  18377. type: String,
  18378. default: void 0
  18379. },
  18380. border: Boolean,
  18381. size: useSizeProp,
  18382. tabindex: [String, Number],
  18383. validateEvent: {
  18384. type: Boolean,
  18385. default: true
  18386. }
  18387. };
  18388. const checkboxEmits = {
  18389. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  18390. change: (val) => isString(val) || isNumber(val) || isBoolean(val)
  18391. };
  18392. const useCheckboxDisabled = ({
  18393. model,
  18394. isChecked
  18395. }) => {
  18396. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  18397. const isLimitDisabled = vue.computed(() => {
  18398. var _a, _b;
  18399. const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
  18400. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  18401. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  18402. });
  18403. const isDisabled = useDisabled(vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  18404. return {
  18405. isDisabled,
  18406. isLimitDisabled
  18407. };
  18408. };
  18409. const useCheckboxEvent = (props, {
  18410. model,
  18411. isLimitExceeded,
  18412. hasOwnLabel,
  18413. isDisabled,
  18414. isLabeledByFormItem
  18415. }) => {
  18416. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  18417. const { formItem } = useFormItem();
  18418. const { emit } = vue.getCurrentInstance();
  18419. function getLabeledValue(value) {
  18420. var _a, _b;
  18421. return value === props.trueLabel || value === true ? (_a = props.trueLabel) != null ? _a : true : (_b = props.falseLabel) != null ? _b : false;
  18422. }
  18423. function emitChangeEvent(checked, e) {
  18424. emit("change", getLabeledValue(checked), e);
  18425. }
  18426. function handleChange(e) {
  18427. if (isLimitExceeded.value)
  18428. return;
  18429. const target = e.target;
  18430. emit("change", getLabeledValue(target.checked), e);
  18431. }
  18432. async function onClickRoot(e) {
  18433. if (isLimitExceeded.value)
  18434. return;
  18435. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  18436. const eventTargets = e.composedPath();
  18437. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  18438. if (!hasLabel) {
  18439. model.value = getLabeledValue([false, props.falseLabel].includes(model.value));
  18440. await vue.nextTick();
  18441. emitChangeEvent(model.value, e);
  18442. }
  18443. }
  18444. }
  18445. const validateEvent = vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  18446. vue.watch(() => props.modelValue, () => {
  18447. if (validateEvent.value) {
  18448. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  18449. }
  18450. });
  18451. return {
  18452. handleChange,
  18453. onClickRoot
  18454. };
  18455. };
  18456. const useCheckboxModel = (props) => {
  18457. const selfModel = vue.ref(false);
  18458. const { emit } = vue.getCurrentInstance();
  18459. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  18460. const isGroup = vue.computed(() => isUndefined(checkboxGroup) === false);
  18461. const isLimitExceeded = vue.ref(false);
  18462. const model = vue.computed({
  18463. get() {
  18464. var _a, _b;
  18465. return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  18466. },
  18467. set(val) {
  18468. var _a, _b;
  18469. if (isGroup.value && isArray(val)) {
  18470. 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);
  18471. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  18472. } else {
  18473. emit(UPDATE_MODEL_EVENT, val);
  18474. selfModel.value = val;
  18475. }
  18476. }
  18477. });
  18478. return {
  18479. model,
  18480. isGroup,
  18481. isLimitExceeded
  18482. };
  18483. };
  18484. const useCheckboxStatus = (props, slots, { model }) => {
  18485. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  18486. const isFocused = vue.ref(false);
  18487. const isChecked = vue.computed(() => {
  18488. const value = model.value;
  18489. if (isBoolean(value)) {
  18490. return value;
  18491. } else if (isArray(value)) {
  18492. if (isObject$1(props.label)) {
  18493. return value.map(vue.toRaw).some((o) => isEqual$1(o, props.label));
  18494. } else {
  18495. return value.map(vue.toRaw).includes(props.label);
  18496. }
  18497. } else if (value !== null && value !== void 0) {
  18498. return value === props.trueLabel;
  18499. } else {
  18500. return !!value;
  18501. }
  18502. });
  18503. const checkboxButtonSize = useSize(vue.computed(() => {
  18504. var _a;
  18505. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  18506. }), {
  18507. prop: true
  18508. });
  18509. const checkboxSize = useSize(vue.computed(() => {
  18510. var _a;
  18511. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  18512. }));
  18513. const hasOwnLabel = vue.computed(() => {
  18514. return !!(slots.default || props.label);
  18515. });
  18516. return {
  18517. checkboxButtonSize,
  18518. isChecked,
  18519. isFocused,
  18520. checkboxSize,
  18521. hasOwnLabel
  18522. };
  18523. };
  18524. const setStoreValue = (props, { model }) => {
  18525. function addToStore() {
  18526. if (isArray(model.value) && !model.value.includes(props.label)) {
  18527. model.value.push(props.label);
  18528. } else {
  18529. model.value = props.trueLabel || true;
  18530. }
  18531. }
  18532. props.checked && addToStore();
  18533. };
  18534. const useCheckbox = (props, slots) => {
  18535. const { formItem: elFormItem } = useFormItem();
  18536. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  18537. const {
  18538. isFocused,
  18539. isChecked,
  18540. checkboxButtonSize,
  18541. checkboxSize,
  18542. hasOwnLabel
  18543. } = useCheckboxStatus(props, slots, { model });
  18544. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  18545. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  18546. formItemContext: elFormItem,
  18547. disableIdGeneration: hasOwnLabel,
  18548. disableIdManagement: isGroup
  18549. });
  18550. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  18551. model,
  18552. isLimitExceeded,
  18553. hasOwnLabel,
  18554. isDisabled,
  18555. isLabeledByFormItem
  18556. });
  18557. setStoreValue(props, { model });
  18558. return {
  18559. inputId,
  18560. isLabeledByFormItem,
  18561. isChecked,
  18562. isDisabled,
  18563. isFocused,
  18564. checkboxButtonSize,
  18565. checkboxSize,
  18566. hasOwnLabel,
  18567. model,
  18568. handleChange,
  18569. onClickRoot
  18570. };
  18571. };
  18572. const _hoisted_1$U = ["tabindex", "role", "aria-checked"];
  18573. const _hoisted_2$z = ["id", "aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"];
  18574. const _hoisted_3$i = ["id", "aria-hidden", "disabled", "value", "name", "tabindex"];
  18575. const __default__$16 = vue.defineComponent({
  18576. name: "ElCheckbox"
  18577. });
  18578. const _sfc_main$1L = /* @__PURE__ */ vue.defineComponent({
  18579. ...__default__$16,
  18580. props: checkboxProps,
  18581. emits: checkboxEmits,
  18582. setup(__props) {
  18583. const props = __props;
  18584. const slots = vue.useSlots();
  18585. const {
  18586. inputId,
  18587. isLabeledByFormItem,
  18588. isChecked,
  18589. isDisabled,
  18590. isFocused,
  18591. checkboxSize,
  18592. hasOwnLabel,
  18593. model,
  18594. handleChange,
  18595. onClickRoot
  18596. } = useCheckbox(props, slots);
  18597. const ns = useNamespace("checkbox");
  18598. return (_ctx, _cache) => {
  18599. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!vue.unref(hasOwnLabel) && vue.unref(isLabeledByFormItem) ? "span" : "label"), {
  18600. class: vue.normalizeClass([
  18601. vue.unref(ns).b(),
  18602. vue.unref(ns).m(vue.unref(checkboxSize)),
  18603. vue.unref(ns).is("disabled", vue.unref(isDisabled)),
  18604. vue.unref(ns).is("bordered", _ctx.border),
  18605. vue.unref(ns).is("checked", vue.unref(isChecked))
  18606. ]),
  18607. "aria-controls": _ctx.indeterminate ? _ctx.controls : null,
  18608. onClick: vue.unref(onClickRoot)
  18609. }, {
  18610. default: vue.withCtx(() => [
  18611. vue.createElementVNode("span", {
  18612. class: vue.normalizeClass([
  18613. vue.unref(ns).e("input"),
  18614. vue.unref(ns).is("disabled", vue.unref(isDisabled)),
  18615. vue.unref(ns).is("checked", vue.unref(isChecked)),
  18616. vue.unref(ns).is("indeterminate", _ctx.indeterminate),
  18617. vue.unref(ns).is("focus", vue.unref(isFocused))
  18618. ]),
  18619. tabindex: _ctx.indeterminate ? 0 : void 0,
  18620. role: _ctx.indeterminate ? "checkbox" : void 0,
  18621. "aria-checked": _ctx.indeterminate ? "mixed" : void 0
  18622. }, [
  18623. _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  18624. key: 0,
  18625. id: vue.unref(inputId),
  18626. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
  18627. class: vue.normalizeClass(vue.unref(ns).e("original")),
  18628. type: "checkbox",
  18629. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  18630. name: _ctx.name,
  18631. tabindex: _ctx.tabindex,
  18632. disabled: vue.unref(isDisabled),
  18633. "true-value": _ctx.trueLabel,
  18634. "false-value": _ctx.falseLabel,
  18635. onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  18636. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  18637. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false)
  18638. }, null, 42, _hoisted_2$z)), [
  18639. [vue.vModelCheckbox, vue.unref(model)]
  18640. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  18641. key: 1,
  18642. id: vue.unref(inputId),
  18643. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(model) ? model.value = $event : null),
  18644. class: vue.normalizeClass(vue.unref(ns).e("original")),
  18645. type: "checkbox",
  18646. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  18647. disabled: vue.unref(isDisabled),
  18648. value: _ctx.label,
  18649. name: _ctx.name,
  18650. tabindex: _ctx.tabindex,
  18651. onChange: _cache[5] || (_cache[5] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  18652. onFocus: _cache[6] || (_cache[6] = ($event) => isFocused.value = true),
  18653. onBlur: _cache[7] || (_cache[7] = ($event) => isFocused.value = false)
  18654. }, null, 42, _hoisted_3$i)), [
  18655. [vue.vModelCheckbox, vue.unref(model)]
  18656. ]),
  18657. vue.createElementVNode("span", {
  18658. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  18659. }, null, 2)
  18660. ], 10, _hoisted_1$U),
  18661. vue.unref(hasOwnLabel) ? (vue.openBlock(), vue.createElementBlock("span", {
  18662. key: 0,
  18663. class: vue.normalizeClass(vue.unref(ns).e("label"))
  18664. }, [
  18665. vue.renderSlot(_ctx.$slots, "default"),
  18666. !_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  18667. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  18668. ], 64)) : vue.createCommentVNode("v-if", true)
  18669. ], 2)) : vue.createCommentVNode("v-if", true)
  18670. ]),
  18671. _: 3
  18672. }, 8, ["class", "aria-controls", "onClick"]);
  18673. };
  18674. }
  18675. });
  18676. var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "checkbox.vue"]]);
  18677. const _hoisted_1$T = ["name", "tabindex", "disabled", "true-value", "false-value"];
  18678. const _hoisted_2$y = ["name", "tabindex", "disabled", "value"];
  18679. const __default__$15 = vue.defineComponent({
  18680. name: "ElCheckboxButton"
  18681. });
  18682. const _sfc_main$1K = /* @__PURE__ */ vue.defineComponent({
  18683. ...__default__$15,
  18684. props: checkboxProps,
  18685. emits: checkboxEmits,
  18686. setup(__props) {
  18687. const props = __props;
  18688. const slots = vue.useSlots();
  18689. const {
  18690. isFocused,
  18691. isChecked,
  18692. isDisabled,
  18693. checkboxButtonSize,
  18694. model,
  18695. handleChange
  18696. } = useCheckbox(props, slots);
  18697. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  18698. const ns = useNamespace("checkbox");
  18699. const activeStyle = vue.computed(() => {
  18700. var _a, _b, _c, _d;
  18701. const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
  18702. return {
  18703. backgroundColor: fillValue,
  18704. borderColor: fillValue,
  18705. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  18706. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  18707. };
  18708. });
  18709. return (_ctx, _cache) => {
  18710. return vue.openBlock(), vue.createElementBlock("label", {
  18711. class: vue.normalizeClass([
  18712. vue.unref(ns).b("button"),
  18713. vue.unref(ns).bm("button", vue.unref(checkboxButtonSize)),
  18714. vue.unref(ns).is("disabled", vue.unref(isDisabled)),
  18715. vue.unref(ns).is("checked", vue.unref(isChecked)),
  18716. vue.unref(ns).is("focus", vue.unref(isFocused))
  18717. ])
  18718. }, [
  18719. _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  18720. key: 0,
  18721. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
  18722. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  18723. type: "checkbox",
  18724. name: _ctx.name,
  18725. tabindex: _ctx.tabindex,
  18726. disabled: vue.unref(isDisabled),
  18727. "true-value": _ctx.trueLabel,
  18728. "false-value": _ctx.falseLabel,
  18729. onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  18730. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  18731. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false)
  18732. }, null, 42, _hoisted_1$T)), [
  18733. [vue.vModelCheckbox, vue.unref(model)]
  18734. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  18735. key: 1,
  18736. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(model) ? model.value = $event : null),
  18737. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  18738. type: "checkbox",
  18739. name: _ctx.name,
  18740. tabindex: _ctx.tabindex,
  18741. disabled: vue.unref(isDisabled),
  18742. value: _ctx.label,
  18743. onChange: _cache[5] || (_cache[5] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  18744. onFocus: _cache[6] || (_cache[6] = ($event) => isFocused.value = true),
  18745. onBlur: _cache[7] || (_cache[7] = ($event) => isFocused.value = false)
  18746. }, null, 42, _hoisted_2$y)), [
  18747. [vue.vModelCheckbox, vue.unref(model)]
  18748. ]),
  18749. _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", {
  18750. key: 2,
  18751. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  18752. style: vue.normalizeStyle(vue.unref(isChecked) ? vue.unref(activeStyle) : void 0)
  18753. }, [
  18754. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  18755. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  18756. ])
  18757. ], 6)) : vue.createCommentVNode("v-if", true)
  18758. ], 2);
  18759. };
  18760. }
  18761. });
  18762. var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "checkbox-button.vue"]]);
  18763. const checkboxGroupProps = buildProps({
  18764. modelValue: {
  18765. type: definePropType(Array),
  18766. default: () => []
  18767. },
  18768. disabled: Boolean,
  18769. min: Number,
  18770. max: Number,
  18771. size: useSizeProp,
  18772. label: String,
  18773. fill: String,
  18774. textColor: String,
  18775. tag: {
  18776. type: String,
  18777. default: "div"
  18778. },
  18779. validateEvent: {
  18780. type: Boolean,
  18781. default: true
  18782. }
  18783. });
  18784. const checkboxGroupEmits = {
  18785. [UPDATE_MODEL_EVENT]: (val) => isArray(val),
  18786. change: (val) => isArray(val)
  18787. };
  18788. const __default__$14 = vue.defineComponent({
  18789. name: "ElCheckboxGroup"
  18790. });
  18791. const _sfc_main$1J = /* @__PURE__ */ vue.defineComponent({
  18792. ...__default__$14,
  18793. props: checkboxGroupProps,
  18794. emits: checkboxGroupEmits,
  18795. setup(__props, { emit }) {
  18796. const props = __props;
  18797. const ns = useNamespace("checkbox");
  18798. const { formItem } = useFormItem();
  18799. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  18800. formItemContext: formItem
  18801. });
  18802. const changeEvent = async (value) => {
  18803. emit(UPDATE_MODEL_EVENT, value);
  18804. await vue.nextTick();
  18805. emit("change", value);
  18806. };
  18807. const modelValue = vue.computed({
  18808. get() {
  18809. return props.modelValue;
  18810. },
  18811. set(val) {
  18812. changeEvent(val);
  18813. }
  18814. });
  18815. vue.provide(checkboxGroupContextKey, {
  18816. ...pick(vue.toRefs(props), [
  18817. "size",
  18818. "min",
  18819. "max",
  18820. "disabled",
  18821. "validateEvent",
  18822. "fill",
  18823. "textColor"
  18824. ]),
  18825. modelValue,
  18826. changeEvent
  18827. });
  18828. vue.watch(() => props.modelValue, () => {
  18829. if (props.validateEvent) {
  18830. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  18831. }
  18832. });
  18833. return (_ctx, _cache) => {
  18834. var _a;
  18835. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  18836. id: vue.unref(groupId),
  18837. class: vue.normalizeClass(vue.unref(ns).b("group")),
  18838. role: "group",
  18839. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "checkbox-group" : void 0,
  18840. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItem)) == null ? void 0 : _a.labelId : void 0
  18841. }, {
  18842. default: vue.withCtx(() => [
  18843. vue.renderSlot(_ctx.$slots, "default")
  18844. ]),
  18845. _: 3
  18846. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  18847. };
  18848. }
  18849. });
  18850. var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "checkbox-group.vue"]]);
  18851. const ElCheckbox = withInstall(Checkbox, {
  18852. CheckboxButton,
  18853. CheckboxGroup
  18854. });
  18855. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  18856. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  18857. const radioPropsBase = buildProps({
  18858. size: useSizeProp,
  18859. disabled: Boolean,
  18860. label: {
  18861. type: [String, Number, Boolean],
  18862. default: ""
  18863. }
  18864. });
  18865. const radioProps = buildProps({
  18866. ...radioPropsBase,
  18867. modelValue: {
  18868. type: [String, Number, Boolean],
  18869. default: ""
  18870. },
  18871. name: {
  18872. type: String,
  18873. default: ""
  18874. },
  18875. border: Boolean
  18876. });
  18877. const radioEmits = {
  18878. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  18879. [CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
  18880. };
  18881. const useRadio = (props, emit) => {
  18882. const radioRef = vue.ref();
  18883. const radioGroup = vue.inject(radioGroupKey, void 0);
  18884. const isGroup = vue.computed(() => !!radioGroup);
  18885. const modelValue = vue.computed({
  18886. get() {
  18887. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  18888. },
  18889. set(val) {
  18890. if (isGroup.value) {
  18891. radioGroup.changeEvent(val);
  18892. } else {
  18893. emit && emit(UPDATE_MODEL_EVENT, val);
  18894. }
  18895. radioRef.value.checked = props.modelValue === props.label;
  18896. }
  18897. });
  18898. const size = useSize(vue.computed(() => radioGroup == null ? void 0 : radioGroup.size));
  18899. const disabled = useDisabled(vue.computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  18900. const focus = vue.ref(false);
  18901. const tabIndex = vue.computed(() => {
  18902. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  18903. });
  18904. return {
  18905. radioRef,
  18906. isGroup,
  18907. radioGroup,
  18908. focus,
  18909. size,
  18910. disabled,
  18911. tabIndex,
  18912. modelValue
  18913. };
  18914. };
  18915. const _hoisted_1$S = ["value", "name", "disabled"];
  18916. const __default__$13 = vue.defineComponent({
  18917. name: "ElRadio"
  18918. });
  18919. const _sfc_main$1I = /* @__PURE__ */ vue.defineComponent({
  18920. ...__default__$13,
  18921. props: radioProps,
  18922. emits: radioEmits,
  18923. setup(__props, { emit }) {
  18924. const props = __props;
  18925. const ns = useNamespace("radio");
  18926. const { radioRef, radioGroup, focus, size, disabled, modelValue } = useRadio(props, emit);
  18927. function handleChange() {
  18928. vue.nextTick(() => emit("change", modelValue.value));
  18929. }
  18930. return (_ctx, _cache) => {
  18931. var _a;
  18932. return vue.openBlock(), vue.createElementBlock("label", {
  18933. class: vue.normalizeClass([
  18934. vue.unref(ns).b(),
  18935. vue.unref(ns).is("disabled", vue.unref(disabled)),
  18936. vue.unref(ns).is("focus", vue.unref(focus)),
  18937. vue.unref(ns).is("bordered", _ctx.border),
  18938. vue.unref(ns).is("checked", vue.unref(modelValue) === _ctx.label),
  18939. vue.unref(ns).m(vue.unref(size))
  18940. ])
  18941. }, [
  18942. vue.createElementVNode("span", {
  18943. class: vue.normalizeClass([
  18944. vue.unref(ns).e("input"),
  18945. vue.unref(ns).is("disabled", vue.unref(disabled)),
  18946. vue.unref(ns).is("checked", vue.unref(modelValue) === _ctx.label)
  18947. ])
  18948. }, [
  18949. vue.withDirectives(vue.createElementVNode("input", {
  18950. ref_key: "radioRef",
  18951. ref: radioRef,
  18952. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null),
  18953. class: vue.normalizeClass(vue.unref(ns).e("original")),
  18954. value: _ctx.label,
  18955. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  18956. disabled: vue.unref(disabled),
  18957. type: "radio",
  18958. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  18959. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  18960. onChange: handleChange
  18961. }, null, 42, _hoisted_1$S), [
  18962. [vue.vModelRadio, vue.unref(modelValue)]
  18963. ]),
  18964. vue.createElementVNode("span", {
  18965. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  18966. }, null, 2)
  18967. ], 2),
  18968. vue.createElementVNode("span", {
  18969. class: vue.normalizeClass(vue.unref(ns).e("label")),
  18970. onKeydown: _cache[3] || (_cache[3] = vue.withModifiers(() => {
  18971. }, ["stop"]))
  18972. }, [
  18973. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  18974. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  18975. ])
  18976. ], 34)
  18977. ], 2);
  18978. };
  18979. }
  18980. });
  18981. var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "radio.vue"]]);
  18982. const radioButtonProps = buildProps({
  18983. ...radioPropsBase,
  18984. name: {
  18985. type: String,
  18986. default: ""
  18987. }
  18988. });
  18989. const _hoisted_1$R = ["value", "name", "disabled"];
  18990. const __default__$12 = vue.defineComponent({
  18991. name: "ElRadioButton"
  18992. });
  18993. const _sfc_main$1H = /* @__PURE__ */ vue.defineComponent({
  18994. ...__default__$12,
  18995. props: radioButtonProps,
  18996. setup(__props) {
  18997. const props = __props;
  18998. const ns = useNamespace("radio");
  18999. const { radioRef, focus, size, disabled, modelValue, radioGroup } = useRadio(props);
  19000. const activeStyle = vue.computed(() => {
  19001. return {
  19002. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  19003. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  19004. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  19005. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  19006. };
  19007. });
  19008. return (_ctx, _cache) => {
  19009. var _a;
  19010. return vue.openBlock(), vue.createElementBlock("label", {
  19011. class: vue.normalizeClass([
  19012. vue.unref(ns).b("button"),
  19013. vue.unref(ns).is("active", vue.unref(modelValue) === _ctx.label),
  19014. vue.unref(ns).is("disabled", vue.unref(disabled)),
  19015. vue.unref(ns).is("focus", vue.unref(focus)),
  19016. vue.unref(ns).bm("button", vue.unref(size))
  19017. ])
  19018. }, [
  19019. vue.withDirectives(vue.createElementVNode("input", {
  19020. ref_key: "radioRef",
  19021. ref: radioRef,
  19022. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null),
  19023. class: vue.normalizeClass(vue.unref(ns).be("button", "original-radio")),
  19024. value: _ctx.label,
  19025. type: "radio",
  19026. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  19027. disabled: vue.unref(disabled),
  19028. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  19029. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false)
  19030. }, null, 42, _hoisted_1$R), [
  19031. [vue.vModelRadio, vue.unref(modelValue)]
  19032. ]),
  19033. vue.createElementVNode("span", {
  19034. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  19035. style: vue.normalizeStyle(vue.unref(modelValue) === _ctx.label ? vue.unref(activeStyle) : {}),
  19036. onKeydown: _cache[3] || (_cache[3] = vue.withModifiers(() => {
  19037. }, ["stop"]))
  19038. }, [
  19039. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  19040. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  19041. ])
  19042. ], 38)
  19043. ], 2);
  19044. };
  19045. }
  19046. });
  19047. var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["__file", "radio-button.vue"]]);
  19048. const radioGroupProps = buildProps({
  19049. id: {
  19050. type: String,
  19051. default: void 0
  19052. },
  19053. size: useSizeProp,
  19054. disabled: Boolean,
  19055. modelValue: {
  19056. type: [String, Number, Boolean],
  19057. default: ""
  19058. },
  19059. fill: {
  19060. type: String,
  19061. default: ""
  19062. },
  19063. label: {
  19064. type: String,
  19065. default: void 0
  19066. },
  19067. textColor: {
  19068. type: String,
  19069. default: ""
  19070. },
  19071. name: {
  19072. type: String,
  19073. default: void 0
  19074. },
  19075. validateEvent: {
  19076. type: Boolean,
  19077. default: true
  19078. }
  19079. });
  19080. const radioGroupEmits = radioEmits;
  19081. const _hoisted_1$Q = ["id", "aria-label", "aria-labelledby"];
  19082. const __default__$11 = vue.defineComponent({
  19083. name: "ElRadioGroup"
  19084. });
  19085. const _sfc_main$1G = /* @__PURE__ */ vue.defineComponent({
  19086. ...__default__$11,
  19087. props: radioGroupProps,
  19088. emits: radioGroupEmits,
  19089. setup(__props, { emit }) {
  19090. const props = __props;
  19091. const ns = useNamespace("radio");
  19092. const radioId = useId();
  19093. const radioGroupRef = vue.ref();
  19094. const { formItem } = useFormItem();
  19095. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  19096. formItemContext: formItem
  19097. });
  19098. const changeEvent = (value) => {
  19099. emit(UPDATE_MODEL_EVENT, value);
  19100. vue.nextTick(() => emit("change", value));
  19101. };
  19102. vue.onMounted(() => {
  19103. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  19104. const firstLabel = radios[0];
  19105. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  19106. firstLabel.tabIndex = 0;
  19107. }
  19108. });
  19109. const name = vue.computed(() => {
  19110. return props.name || radioId.value;
  19111. });
  19112. vue.provide(radioGroupKey, vue.reactive({
  19113. ...vue.toRefs(props),
  19114. changeEvent,
  19115. name
  19116. }));
  19117. vue.watch(() => props.modelValue, () => {
  19118. if (props.validateEvent) {
  19119. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  19120. }
  19121. });
  19122. return (_ctx, _cache) => {
  19123. return vue.openBlock(), vue.createElementBlock("div", {
  19124. id: vue.unref(groupId),
  19125. ref_key: "radioGroupRef",
  19126. ref: radioGroupRef,
  19127. class: vue.normalizeClass(vue.unref(ns).b("group")),
  19128. role: "radiogroup",
  19129. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "radio-group" : void 0,
  19130. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  19131. }, [
  19132. vue.renderSlot(_ctx.$slots, "default")
  19133. ], 10, _hoisted_1$Q);
  19134. };
  19135. }
  19136. });
  19137. var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["__file", "radio-group.vue"]]);
  19138. const ElRadio = withInstall(Radio, {
  19139. RadioButton,
  19140. RadioGroup
  19141. });
  19142. const ElRadioGroup = withNoopInstall(RadioGroup);
  19143. const ElRadioButton = withNoopInstall(RadioButton);
  19144. var NodeContent$1 = vue.defineComponent({
  19145. name: "NodeContent",
  19146. setup() {
  19147. const ns = useNamespace("cascader-node");
  19148. return {
  19149. ns
  19150. };
  19151. },
  19152. render() {
  19153. const { ns } = this;
  19154. const { node, panel } = this.$parent;
  19155. const { data, label } = node;
  19156. const { renderLabelFn } = panel;
  19157. return vue.h("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data }) : label);
  19158. }
  19159. });
  19160. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  19161. const _sfc_main$1F = vue.defineComponent({
  19162. name: "ElCascaderNode",
  19163. components: {
  19164. ElCheckbox,
  19165. ElRadio,
  19166. NodeContent: NodeContent$1,
  19167. ElIcon,
  19168. Check: check_default,
  19169. Loading: loading_default,
  19170. ArrowRight: arrow_right_default
  19171. },
  19172. props: {
  19173. node: {
  19174. type: Object,
  19175. required: true
  19176. },
  19177. menuId: String
  19178. },
  19179. emits: ["expand"],
  19180. setup(props, { emit }) {
  19181. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  19182. const ns = useNamespace("cascader-node");
  19183. const isHoverMenu = vue.computed(() => panel.isHoverMenu);
  19184. const multiple = vue.computed(() => panel.config.multiple);
  19185. const checkStrictly = vue.computed(() => panel.config.checkStrictly);
  19186. const checkedNodeId = vue.computed(() => {
  19187. var _a;
  19188. return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid;
  19189. });
  19190. const isDisabled = vue.computed(() => props.node.isDisabled);
  19191. const isLeaf = vue.computed(() => props.node.isLeaf);
  19192. const expandable = vue.computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  19193. const inExpandingPath = vue.computed(() => isInPath(panel.expandingNode));
  19194. const inCheckedPath = vue.computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  19195. const isInPath = (node) => {
  19196. var _a;
  19197. const { level, uid } = props.node;
  19198. return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid;
  19199. };
  19200. const doExpand = () => {
  19201. if (inExpandingPath.value)
  19202. return;
  19203. panel.expandNode(props.node);
  19204. };
  19205. const doCheck = (checked) => {
  19206. const { node } = props;
  19207. if (checked === node.checked)
  19208. return;
  19209. panel.handleCheckChange(node, checked);
  19210. };
  19211. const doLoad = () => {
  19212. panel.lazyLoad(props.node, () => {
  19213. if (!isLeaf.value)
  19214. doExpand();
  19215. });
  19216. };
  19217. const handleHoverExpand = (e) => {
  19218. if (!isHoverMenu.value)
  19219. return;
  19220. handleExpand();
  19221. !isLeaf.value && emit("expand", e);
  19222. };
  19223. const handleExpand = () => {
  19224. const { node } = props;
  19225. if (!expandable.value || node.loading)
  19226. return;
  19227. node.loaded ? doExpand() : doLoad();
  19228. };
  19229. const handleClick = () => {
  19230. if (isHoverMenu.value && !isLeaf.value)
  19231. return;
  19232. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  19233. handleCheck(true);
  19234. } else {
  19235. handleExpand();
  19236. }
  19237. };
  19238. const handleSelectCheck = (checked) => {
  19239. if (checkStrictly.value) {
  19240. doCheck(checked);
  19241. if (props.node.loaded) {
  19242. doExpand();
  19243. }
  19244. } else {
  19245. handleCheck(checked);
  19246. }
  19247. };
  19248. const handleCheck = (checked) => {
  19249. if (!props.node.loaded) {
  19250. doLoad();
  19251. } else {
  19252. doCheck(checked);
  19253. !checkStrictly.value && doExpand();
  19254. }
  19255. };
  19256. return {
  19257. panel,
  19258. isHoverMenu,
  19259. multiple,
  19260. checkStrictly,
  19261. checkedNodeId,
  19262. isDisabled,
  19263. isLeaf,
  19264. expandable,
  19265. inExpandingPath,
  19266. inCheckedPath,
  19267. ns,
  19268. handleHoverExpand,
  19269. handleExpand,
  19270. handleClick,
  19271. handleCheck,
  19272. handleSelectCheck
  19273. };
  19274. }
  19275. });
  19276. const _hoisted_1$P = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
  19277. const _hoisted_2$x = /* @__PURE__ */ vue.createElementVNode("span", null, null, -1);
  19278. function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
  19279. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  19280. const _component_el_radio = vue.resolveComponent("el-radio");
  19281. const _component_check = vue.resolveComponent("check");
  19282. const _component_el_icon = vue.resolveComponent("el-icon");
  19283. const _component_node_content = vue.resolveComponent("node-content");
  19284. const _component_loading = vue.resolveComponent("loading");
  19285. const _component_arrow_right = vue.resolveComponent("arrow-right");
  19286. return vue.openBlock(), vue.createElementBlock("li", {
  19287. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  19288. role: "menuitem",
  19289. "aria-haspopup": !_ctx.isLeaf,
  19290. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  19291. "aria-expanded": _ctx.inExpandingPath,
  19292. tabindex: _ctx.expandable ? -1 : void 0,
  19293. class: vue.normalizeClass([
  19294. _ctx.ns.b(),
  19295. _ctx.ns.is("selectable", _ctx.checkStrictly),
  19296. _ctx.ns.is("active", _ctx.node.checked),
  19297. _ctx.ns.is("disabled", !_ctx.expandable),
  19298. _ctx.inExpandingPath && "in-active-path",
  19299. _ctx.inCheckedPath && "in-checked-path"
  19300. ]),
  19301. onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  19302. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  19303. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  19304. }, [
  19305. vue.createCommentVNode(" prefix "),
  19306. _ctx.multiple ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  19307. key: 0,
  19308. "model-value": _ctx.node.checked,
  19309. indeterminate: _ctx.node.indeterminate,
  19310. disabled: _ctx.isDisabled,
  19311. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  19312. }, ["stop"])),
  19313. "onUpdate:modelValue": _ctx.handleSelectCheck
  19314. }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (vue.openBlock(), vue.createBlock(_component_el_radio, {
  19315. key: 1,
  19316. "model-value": _ctx.checkedNodeId,
  19317. label: _ctx.node.uid,
  19318. disabled: _ctx.isDisabled,
  19319. "onUpdate:modelValue": _ctx.handleSelectCheck,
  19320. onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  19321. }, ["stop"]))
  19322. }, {
  19323. default: vue.withCtx(() => [
  19324. 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 "),
  19325. _hoisted_2$x
  19326. ]),
  19327. _: 1
  19328. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  19329. key: 2,
  19330. class: vue.normalizeClass(_ctx.ns.e("prefix"))
  19331. }, {
  19332. default: vue.withCtx(() => [
  19333. vue.createVNode(_component_check)
  19334. ]),
  19335. _: 1
  19336. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  19337. vue.createCommentVNode(" content "),
  19338. vue.createVNode(_component_node_content),
  19339. vue.createCommentVNode(" postfix "),
  19340. !_ctx.isLeaf ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  19341. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  19342. key: 0,
  19343. class: vue.normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  19344. }, {
  19345. default: vue.withCtx(() => [
  19346. vue.createVNode(_component_loading)
  19347. ]),
  19348. _: 1
  19349. }, 8, ["class"])) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
  19350. key: 1,
  19351. class: vue.normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  19352. }, {
  19353. default: vue.withCtx(() => [
  19354. vue.createVNode(_component_arrow_right)
  19355. ]),
  19356. _: 1
  19357. }, 8, ["class"]))
  19358. ], 64)) : vue.createCommentVNode("v-if", true)
  19359. ], 42, _hoisted_1$P);
  19360. }
  19361. var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_render$x], ["__file", "node.vue"]]);
  19362. const _sfc_main$1E = vue.defineComponent({
  19363. name: "ElCascaderMenu",
  19364. components: {
  19365. Loading: loading_default,
  19366. ElIcon,
  19367. ElScrollbar,
  19368. ElCascaderNode
  19369. },
  19370. props: {
  19371. nodes: {
  19372. type: Array,
  19373. required: true
  19374. },
  19375. index: {
  19376. type: Number,
  19377. required: true
  19378. }
  19379. },
  19380. setup(props) {
  19381. const instance = vue.getCurrentInstance();
  19382. const ns = useNamespace("cascader-menu");
  19383. const { t } = useLocale();
  19384. const id = generateId();
  19385. let activeNode = null;
  19386. let hoverTimer = null;
  19387. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  19388. const hoverZone = vue.ref(null);
  19389. const isEmpty = vue.computed(() => !props.nodes.length);
  19390. const isLoading = vue.computed(() => !panel.initialLoaded);
  19391. const menuId = vue.computed(() => `cascader-menu-${id}-${props.index}`);
  19392. const handleExpand = (e) => {
  19393. activeNode = e.target;
  19394. };
  19395. const handleMouseMove = (e) => {
  19396. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  19397. return;
  19398. if (activeNode.contains(e.target)) {
  19399. clearHoverTimer();
  19400. const el = instance.vnode.el;
  19401. const { left } = el.getBoundingClientRect();
  19402. const { offsetWidth, offsetHeight } = el;
  19403. const startX = e.clientX - left;
  19404. const top = activeNode.offsetTop;
  19405. const bottom = top + activeNode.offsetHeight;
  19406. hoverZone.value.innerHTML = `
  19407. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  19408. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  19409. `;
  19410. } else if (!hoverTimer) {
  19411. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  19412. }
  19413. };
  19414. const clearHoverTimer = () => {
  19415. if (!hoverTimer)
  19416. return;
  19417. clearTimeout(hoverTimer);
  19418. hoverTimer = null;
  19419. };
  19420. const clearHoverZone = () => {
  19421. if (!hoverZone.value)
  19422. return;
  19423. hoverZone.value.innerHTML = "";
  19424. clearHoverTimer();
  19425. };
  19426. return {
  19427. ns,
  19428. panel,
  19429. hoverZone,
  19430. isEmpty,
  19431. isLoading,
  19432. menuId,
  19433. t,
  19434. handleExpand,
  19435. handleMouseMove,
  19436. clearHoverZone
  19437. };
  19438. }
  19439. });
  19440. function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
  19441. const _component_el_cascader_node = vue.resolveComponent("el-cascader-node");
  19442. const _component_loading = vue.resolveComponent("loading");
  19443. const _component_el_icon = vue.resolveComponent("el-icon");
  19444. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  19445. return vue.openBlock(), vue.createBlock(_component_el_scrollbar, {
  19446. key: _ctx.menuId,
  19447. tag: "ul",
  19448. role: "menu",
  19449. class: vue.normalizeClass(_ctx.ns.b()),
  19450. "wrap-class": _ctx.ns.e("wrap"),
  19451. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  19452. onMousemove: _ctx.handleMouseMove,
  19453. onMouseleave: _ctx.clearHoverZone
  19454. }, {
  19455. default: vue.withCtx(() => {
  19456. var _a;
  19457. return [
  19458. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.nodes, (node) => {
  19459. return vue.openBlock(), vue.createBlock(_component_el_cascader_node, {
  19460. key: node.uid,
  19461. node,
  19462. "menu-id": _ctx.menuId,
  19463. onExpand: _ctx.handleExpand
  19464. }, null, 8, ["node", "menu-id", "onExpand"]);
  19465. }), 128)),
  19466. _ctx.isLoading ? (vue.openBlock(), vue.createElementBlock("div", {
  19467. key: 0,
  19468. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  19469. }, [
  19470. vue.createVNode(_component_el_icon, {
  19471. size: "14",
  19472. class: vue.normalizeClass(_ctx.ns.is("loading"))
  19473. }, {
  19474. default: vue.withCtx(() => [
  19475. vue.createVNode(_component_loading)
  19476. ]),
  19477. _: 1
  19478. }, 8, ["class"]),
  19479. vue.createTextVNode(" " + vue.toDisplayString(_ctx.t("el.cascader.loading")), 1)
  19480. ], 2)) : _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  19481. key: 1,
  19482. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  19483. }, vue.toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a = _ctx.panel) == null ? void 0 : _a.isHoverMenu) ? (vue.openBlock(), vue.createElementBlock("svg", {
  19484. key: 2,
  19485. ref: "hoverZone",
  19486. class: vue.normalizeClass(_ctx.ns.e("hover-zone"))
  19487. }, null, 2)) : vue.createCommentVNode("v-if", true)
  19488. ];
  19489. }),
  19490. _: 1
  19491. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  19492. }
  19493. var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["render", _sfc_render$w], ["__file", "menu.vue"]]);
  19494. let uid = 0;
  19495. const calculatePathNodes = (node) => {
  19496. const nodes = [node];
  19497. let { parent } = node;
  19498. while (parent) {
  19499. nodes.unshift(parent);
  19500. parent = parent.parent;
  19501. }
  19502. return nodes;
  19503. };
  19504. class Node$2 {
  19505. constructor(data, config, parent, root = false) {
  19506. this.data = data;
  19507. this.config = config;
  19508. this.parent = parent;
  19509. this.root = root;
  19510. this.uid = uid++;
  19511. this.checked = false;
  19512. this.indeterminate = false;
  19513. this.loading = false;
  19514. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  19515. const childrenData = data[childrenKey];
  19516. const pathNodes = calculatePathNodes(this);
  19517. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  19518. this.value = data[valueKey];
  19519. this.label = data[labelKey];
  19520. this.pathNodes = pathNodes;
  19521. this.pathValues = pathNodes.map((node) => node.value);
  19522. this.pathLabels = pathNodes.map((node) => node.label);
  19523. this.childrenData = childrenData;
  19524. this.children = (childrenData || []).map((child) => new Node$2(child, config, this));
  19525. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  19526. }
  19527. get isDisabled() {
  19528. const { data, parent, config } = this;
  19529. const { disabled, checkStrictly } = config;
  19530. const isDisabled = isFunction(disabled) ? disabled(data, this) : !!data[disabled];
  19531. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  19532. }
  19533. get isLeaf() {
  19534. const { data, config, childrenData, loaded } = this;
  19535. const { lazy, leaf } = config;
  19536. const isLeaf = isFunction(leaf) ? leaf(data, this) : data[leaf];
  19537. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf;
  19538. }
  19539. get valueByOption() {
  19540. return this.config.emitPath ? this.pathValues : this.value;
  19541. }
  19542. appendChild(childData) {
  19543. const { childrenData, children } = this;
  19544. const node = new Node$2(childData, this.config, this);
  19545. if (Array.isArray(childrenData)) {
  19546. childrenData.push(childData);
  19547. } else {
  19548. this.childrenData = [childData];
  19549. }
  19550. children.push(node);
  19551. return node;
  19552. }
  19553. calcText(allLevels, separator) {
  19554. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  19555. this.text = text;
  19556. return text;
  19557. }
  19558. broadcast(event, ...args) {
  19559. const handlerName = `onParent${capitalize(event)}`;
  19560. this.children.forEach((child) => {
  19561. if (child) {
  19562. child.broadcast(event, ...args);
  19563. child[handlerName] && child[handlerName](...args);
  19564. }
  19565. });
  19566. }
  19567. emit(event, ...args) {
  19568. const { parent } = this;
  19569. const handlerName = `onChild${capitalize(event)}`;
  19570. if (parent) {
  19571. parent[handlerName] && parent[handlerName](...args);
  19572. parent.emit(event, ...args);
  19573. }
  19574. }
  19575. onParentCheck(checked) {
  19576. if (!this.isDisabled) {
  19577. this.setCheckState(checked);
  19578. }
  19579. }
  19580. onChildCheck() {
  19581. const { children } = this;
  19582. const validChildren = children.filter((child) => !child.isDisabled);
  19583. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  19584. this.setCheckState(checked);
  19585. }
  19586. setCheckState(checked) {
  19587. const totalNum = this.children.length;
  19588. const checkedNum = this.children.reduce((c, p) => {
  19589. const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  19590. return c + num;
  19591. }, 0);
  19592. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  19593. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  19594. }
  19595. doCheck(checked) {
  19596. if (this.checked === checked)
  19597. return;
  19598. const { checkStrictly, multiple } = this.config;
  19599. if (checkStrictly || !multiple) {
  19600. this.checked = checked;
  19601. } else {
  19602. this.broadcast("check", checked);
  19603. this.setCheckState(checked);
  19604. this.emit("check");
  19605. }
  19606. }
  19607. }
  19608. var Node$3 = Node$2;
  19609. const flatNodes = (nodes, leafOnly) => {
  19610. return nodes.reduce((res, node) => {
  19611. if (node.isLeaf) {
  19612. res.push(node);
  19613. } else {
  19614. !leafOnly && res.push(node);
  19615. res = res.concat(flatNodes(node.children, leafOnly));
  19616. }
  19617. return res;
  19618. }, []);
  19619. };
  19620. class Store {
  19621. constructor(data, config) {
  19622. this.config = config;
  19623. const nodes = (data || []).map((nodeData) => new Node$3(nodeData, this.config));
  19624. this.nodes = nodes;
  19625. this.allNodes = flatNodes(nodes, false);
  19626. this.leafNodes = flatNodes(nodes, true);
  19627. }
  19628. getNodes() {
  19629. return this.nodes;
  19630. }
  19631. getFlattedNodes(leafOnly) {
  19632. return leafOnly ? this.leafNodes : this.allNodes;
  19633. }
  19634. appendNode(nodeData, parentNode) {
  19635. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$3(nodeData, this.config);
  19636. if (!parentNode)
  19637. this.nodes.push(node);
  19638. this.allNodes.push(node);
  19639. node.isLeaf && this.leafNodes.push(node);
  19640. }
  19641. appendNodes(nodeDataList, parentNode) {
  19642. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  19643. }
  19644. getNodeByValue(value, leafOnly = false) {
  19645. if (!value && value !== 0)
  19646. return null;
  19647. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  19648. return node || null;
  19649. }
  19650. getSameNode(node) {
  19651. if (!node)
  19652. return null;
  19653. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  19654. return node_ || null;
  19655. }
  19656. }
  19657. const CommonProps = {
  19658. modelValue: [Number, String, Array],
  19659. options: {
  19660. type: Array,
  19661. default: () => []
  19662. },
  19663. props: {
  19664. type: Object,
  19665. default: () => ({})
  19666. }
  19667. };
  19668. const DefaultProps = {
  19669. expandTrigger: "click",
  19670. multiple: false,
  19671. checkStrictly: false,
  19672. emitPath: true,
  19673. lazy: false,
  19674. lazyLoad: NOOP,
  19675. value: "value",
  19676. label: "label",
  19677. children: "children",
  19678. leaf: "leaf",
  19679. disabled: "disabled",
  19680. hoverThreshold: 500
  19681. };
  19682. const useCascaderConfig = (props) => {
  19683. return vue.computed(() => ({
  19684. ...DefaultProps,
  19685. ...props.props
  19686. }));
  19687. };
  19688. const getMenuIndex = (el) => {
  19689. if (!el)
  19690. return 0;
  19691. const pieces = el.id.split("-");
  19692. return Number(pieces[pieces.length - 2]);
  19693. };
  19694. const checkNode = (el) => {
  19695. if (!el)
  19696. return;
  19697. const input = el.querySelector("input");
  19698. if (input) {
  19699. input.click();
  19700. } else if (isLeaf(el)) {
  19701. el.click();
  19702. }
  19703. };
  19704. const sortByOriginalOrder = (oldNodes, newNodes) => {
  19705. const newNodesCopy = newNodes.slice(0);
  19706. const newIds = newNodesCopy.map((node) => node.uid);
  19707. const res = oldNodes.reduce((acc, item) => {
  19708. const index = newIds.indexOf(item.uid);
  19709. if (index > -1) {
  19710. acc.push(item);
  19711. newNodesCopy.splice(index, 1);
  19712. newIds.splice(index, 1);
  19713. }
  19714. return acc;
  19715. }, []);
  19716. res.push(...newNodesCopy);
  19717. return res;
  19718. };
  19719. const _sfc_main$1D = vue.defineComponent({
  19720. name: "ElCascaderPanel",
  19721. components: {
  19722. ElCascaderMenu
  19723. },
  19724. props: {
  19725. ...CommonProps,
  19726. border: {
  19727. type: Boolean,
  19728. default: true
  19729. },
  19730. renderLabel: Function
  19731. },
  19732. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  19733. setup(props, { emit, slots }) {
  19734. let manualChecked = false;
  19735. const ns = useNamespace("cascader");
  19736. const config = useCascaderConfig(props);
  19737. let store = null;
  19738. const initialLoaded = vue.ref(true);
  19739. const menuList = vue.ref([]);
  19740. const checkedValue = vue.ref(null);
  19741. const menus = vue.ref([]);
  19742. const expandingNode = vue.ref(null);
  19743. const checkedNodes = vue.ref([]);
  19744. const isHoverMenu = vue.computed(() => config.value.expandTrigger === "hover");
  19745. const renderLabelFn = vue.computed(() => props.renderLabel || slots.default);
  19746. const initStore = () => {
  19747. const { options } = props;
  19748. const cfg = config.value;
  19749. manualChecked = false;
  19750. store = new Store(options, cfg);
  19751. menus.value = [store.getNodes()];
  19752. if (cfg.lazy && isEmpty(props.options)) {
  19753. initialLoaded.value = false;
  19754. lazyLoad(void 0, (list) => {
  19755. if (list) {
  19756. store = new Store(list, cfg);
  19757. menus.value = [store.getNodes()];
  19758. }
  19759. initialLoaded.value = true;
  19760. syncCheckedValue(false, true);
  19761. });
  19762. } else {
  19763. syncCheckedValue(false, true);
  19764. }
  19765. };
  19766. const lazyLoad = (node, cb) => {
  19767. const cfg = config.value;
  19768. node = node || new Node$3({}, cfg, void 0, true);
  19769. node.loading = true;
  19770. const resolve = (dataList) => {
  19771. const _node = node;
  19772. const parent = _node.root ? null : _node;
  19773. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  19774. _node.loading = false;
  19775. _node.loaded = true;
  19776. _node.childrenData = _node.childrenData || [];
  19777. cb && cb(dataList);
  19778. };
  19779. cfg.lazyLoad(node, resolve);
  19780. };
  19781. const expandNode = (node, silent) => {
  19782. var _a;
  19783. const { level } = node;
  19784. const newMenus = menus.value.slice(0, level);
  19785. let newExpandingNode;
  19786. if (node.isLeaf) {
  19787. newExpandingNode = node.pathNodes[level - 2];
  19788. } else {
  19789. newExpandingNode = node;
  19790. newMenus.push(node.children);
  19791. }
  19792. if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  19793. expandingNode.value = node;
  19794. menus.value = newMenus;
  19795. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  19796. }
  19797. };
  19798. const handleCheckChange = (node, checked, emitClose = true) => {
  19799. const { checkStrictly, multiple } = config.value;
  19800. const oldNode = checkedNodes.value[0];
  19801. manualChecked = true;
  19802. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  19803. node.doCheck(checked);
  19804. calculateCheckedValue();
  19805. emitClose && !multiple && !checkStrictly && emit("close");
  19806. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  19807. };
  19808. const expandParentNode = (node) => {
  19809. if (!node)
  19810. return;
  19811. node = node.parent;
  19812. expandParentNode(node);
  19813. node && expandNode(node);
  19814. };
  19815. const getFlattedNodes = (leafOnly) => {
  19816. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  19817. };
  19818. const getCheckedNodes = (leafOnly) => {
  19819. var _a;
  19820. return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter((node) => node.checked !== false);
  19821. };
  19822. const clearCheckedNodes = () => {
  19823. checkedNodes.value.forEach((node) => node.doCheck(false));
  19824. calculateCheckedValue();
  19825. };
  19826. const calculateCheckedValue = () => {
  19827. var _a;
  19828. const { checkStrictly, multiple } = config.value;
  19829. const oldNodes = checkedNodes.value;
  19830. const newNodes = getCheckedNodes(!checkStrictly);
  19831. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  19832. const values = nodes.map((node) => node.valueByOption);
  19833. checkedNodes.value = nodes;
  19834. checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null;
  19835. };
  19836. const syncCheckedValue = (loaded = false, forced = false) => {
  19837. const { modelValue } = props;
  19838. const { lazy, multiple, checkStrictly } = config.value;
  19839. const leafOnly = !checkStrictly;
  19840. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  19841. return;
  19842. if (lazy && !loaded) {
  19843. const values = unique(flattenDeep(castArray(modelValue)));
  19844. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  19845. if (nodes.length) {
  19846. nodes.forEach((node) => {
  19847. lazyLoad(node, () => syncCheckedValue(false, forced));
  19848. });
  19849. } else {
  19850. syncCheckedValue(true, forced);
  19851. }
  19852. } else {
  19853. const values = multiple ? castArray(modelValue) : [modelValue];
  19854. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  19855. syncMenuState(nodes, forced);
  19856. checkedValue.value = cloneDeep(modelValue);
  19857. }
  19858. };
  19859. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  19860. const { checkStrictly } = config.value;
  19861. const oldNodes = checkedNodes.value;
  19862. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  19863. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  19864. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  19865. if (newExpandingNode) {
  19866. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  19867. } else {
  19868. expandingNode.value = null;
  19869. }
  19870. oldNodes.forEach((node) => node.doCheck(false));
  19871. newNodes.forEach((node) => node.doCheck(true));
  19872. checkedNodes.value = newNodes;
  19873. vue.nextTick(scrollToExpandingNode);
  19874. };
  19875. const scrollToExpandingNode = () => {
  19876. if (!isClient)
  19877. return;
  19878. menuList.value.forEach((menu) => {
  19879. const menuElement = menu == null ? void 0 : menu.$el;
  19880. if (menuElement) {
  19881. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  19882. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  19883. scrollIntoView(container, activeNode);
  19884. }
  19885. });
  19886. };
  19887. const handleKeyDown = (e) => {
  19888. const target = e.target;
  19889. const { code } = e;
  19890. switch (code) {
  19891. case EVENT_CODE.up:
  19892. case EVENT_CODE.down: {
  19893. e.preventDefault();
  19894. const distance = code === EVENT_CODE.up ? -1 : 1;
  19895. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  19896. break;
  19897. }
  19898. case EVENT_CODE.left: {
  19899. e.preventDefault();
  19900. const preMenu = menuList.value[getMenuIndex(target) - 1];
  19901. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  19902. focusNode(expandedNode);
  19903. break;
  19904. }
  19905. case EVENT_CODE.right: {
  19906. e.preventDefault();
  19907. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  19908. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  19909. focusNode(firstNode);
  19910. break;
  19911. }
  19912. case EVENT_CODE.enter:
  19913. checkNode(target);
  19914. break;
  19915. }
  19916. };
  19917. vue.provide(CASCADER_PANEL_INJECTION_KEY, vue.reactive({
  19918. config,
  19919. expandingNode,
  19920. checkedNodes,
  19921. isHoverMenu,
  19922. initialLoaded,
  19923. renderLabelFn,
  19924. lazyLoad,
  19925. expandNode,
  19926. handleCheckChange
  19927. }));
  19928. vue.watch([config, () => props.options], initStore, {
  19929. deep: true,
  19930. immediate: true
  19931. });
  19932. vue.watch(() => props.modelValue, () => {
  19933. manualChecked = false;
  19934. syncCheckedValue();
  19935. }, {
  19936. deep: true
  19937. });
  19938. vue.watch(() => checkedValue.value, (val) => {
  19939. if (!isEqual$1(val, props.modelValue)) {
  19940. emit(UPDATE_MODEL_EVENT, val);
  19941. emit(CHANGE_EVENT, val);
  19942. }
  19943. });
  19944. vue.onBeforeUpdate(() => menuList.value = []);
  19945. vue.onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  19946. return {
  19947. ns,
  19948. menuList,
  19949. menus,
  19950. checkedNodes,
  19951. handleKeyDown,
  19952. handleCheckChange,
  19953. getFlattedNodes,
  19954. getCheckedNodes,
  19955. clearCheckedNodes,
  19956. calculateCheckedValue,
  19957. scrollToExpandingNode
  19958. };
  19959. }
  19960. });
  19961. function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
  19962. const _component_el_cascader_menu = vue.resolveComponent("el-cascader-menu");
  19963. return vue.openBlock(), vue.createElementBlock("div", {
  19964. class: vue.normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  19965. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
  19966. }, [
  19967. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menus, (menu, index) => {
  19968. return vue.openBlock(), vue.createBlock(_component_el_cascader_menu, {
  19969. key: index,
  19970. ref_for: true,
  19971. ref: (item) => _ctx.menuList[index] = item,
  19972. index,
  19973. nodes: [...menu]
  19974. }, null, 8, ["index", "nodes"]);
  19975. }), 128))
  19976. ], 34);
  19977. }
  19978. var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["render", _sfc_render$v], ["__file", "index.vue"]]);
  19979. CascaderPanel.install = (app) => {
  19980. app.component(CascaderPanel.name, CascaderPanel);
  19981. };
  19982. const _CascaderPanel = CascaderPanel;
  19983. const ElCascaderPanel = _CascaderPanel;
  19984. const tagProps = buildProps({
  19985. closable: Boolean,
  19986. type: {
  19987. type: String,
  19988. values: ["success", "info", "warning", "danger", ""],
  19989. default: ""
  19990. },
  19991. hit: Boolean,
  19992. disableTransitions: Boolean,
  19993. color: {
  19994. type: String,
  19995. default: ""
  19996. },
  19997. size: {
  19998. type: String,
  19999. values: componentSizes,
  20000. default: ""
  20001. },
  20002. effect: {
  20003. type: String,
  20004. values: ["dark", "light", "plain"],
  20005. default: "light"
  20006. },
  20007. round: Boolean
  20008. });
  20009. const tagEmits = {
  20010. close: (evt) => evt instanceof MouseEvent,
  20011. click: (evt) => evt instanceof MouseEvent
  20012. };
  20013. const __default__$10 = vue.defineComponent({
  20014. name: "ElTag"
  20015. });
  20016. const _sfc_main$1C = /* @__PURE__ */ vue.defineComponent({
  20017. ...__default__$10,
  20018. props: tagProps,
  20019. emits: tagEmits,
  20020. setup(__props, { emit }) {
  20021. const props = __props;
  20022. const tagSize = useSize();
  20023. const ns = useNamespace("tag");
  20024. const classes = vue.computed(() => {
  20025. const { type, hit, effect, closable, round } = props;
  20026. return [
  20027. ns.b(),
  20028. ns.is("closable", closable),
  20029. ns.m(type),
  20030. ns.m(tagSize.value),
  20031. ns.m(effect),
  20032. ns.is("hit", hit),
  20033. ns.is("round", round)
  20034. ];
  20035. });
  20036. const handleClose = (event) => {
  20037. emit("close", event);
  20038. };
  20039. const handleClick = (event) => {
  20040. emit("click", event);
  20041. };
  20042. return (_ctx, _cache) => {
  20043. return _ctx.disableTransitions ? (vue.openBlock(), vue.createElementBlock("span", {
  20044. key: 0,
  20045. class: vue.normalizeClass(vue.unref(classes)),
  20046. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  20047. onClick: handleClick
  20048. }, [
  20049. vue.createElementVNode("span", {
  20050. class: vue.normalizeClass(vue.unref(ns).e("content"))
  20051. }, [
  20052. vue.renderSlot(_ctx.$slots, "default")
  20053. ], 2),
  20054. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  20055. key: 0,
  20056. class: vue.normalizeClass(vue.unref(ns).e("close")),
  20057. onClick: vue.withModifiers(handleClose, ["stop"])
  20058. }, {
  20059. default: vue.withCtx(() => [
  20060. vue.createVNode(vue.unref(close_default))
  20061. ]),
  20062. _: 1
  20063. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  20064. ], 6)) : (vue.openBlock(), vue.createBlock(vue.Transition, {
  20065. key: 1,
  20066. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  20067. appear: ""
  20068. }, {
  20069. default: vue.withCtx(() => [
  20070. vue.createElementVNode("span", {
  20071. class: vue.normalizeClass(vue.unref(classes)),
  20072. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  20073. onClick: handleClick
  20074. }, [
  20075. vue.createElementVNode("span", {
  20076. class: vue.normalizeClass(vue.unref(ns).e("content"))
  20077. }, [
  20078. vue.renderSlot(_ctx.$slots, "default")
  20079. ], 2),
  20080. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  20081. key: 0,
  20082. class: vue.normalizeClass(vue.unref(ns).e("close")),
  20083. onClick: vue.withModifiers(handleClose, ["stop"])
  20084. }, {
  20085. default: vue.withCtx(() => [
  20086. vue.createVNode(vue.unref(close_default))
  20087. ]),
  20088. _: 1
  20089. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  20090. ], 6)
  20091. ]),
  20092. _: 3
  20093. }, 8, ["name"]));
  20094. };
  20095. }
  20096. });
  20097. var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__file", "tag.vue"]]);
  20098. const ElTag = withInstall(Tag);
  20099. const popperOptions = {
  20100. modifiers: [
  20101. {
  20102. name: "arrowPosition",
  20103. enabled: true,
  20104. phase: "main",
  20105. fn: ({ state }) => {
  20106. const { modifiersData, placement } = state;
  20107. if (["right", "left", "bottom", "top"].includes(placement))
  20108. return;
  20109. modifiersData.arrow.x = 35;
  20110. },
  20111. requires: ["arrow"]
  20112. }
  20113. ]
  20114. };
  20115. const COMPONENT_NAME$f = "ElCascader";
  20116. const _sfc_main$1B = vue.defineComponent({
  20117. name: COMPONENT_NAME$f,
  20118. components: {
  20119. ElCascaderPanel: _CascaderPanel,
  20120. ElInput,
  20121. ElTooltip,
  20122. ElScrollbar,
  20123. ElTag,
  20124. ElIcon,
  20125. CircleClose: circle_close_default,
  20126. Check: check_default,
  20127. ArrowDown: arrow_down_default
  20128. },
  20129. directives: {
  20130. Clickoutside: ClickOutside
  20131. },
  20132. props: {
  20133. ...CommonProps,
  20134. size: {
  20135. type: String,
  20136. validator: isValidComponentSize
  20137. },
  20138. placeholder: {
  20139. type: String
  20140. },
  20141. disabled: Boolean,
  20142. clearable: Boolean,
  20143. filterable: Boolean,
  20144. filterMethod: {
  20145. type: Function,
  20146. default: (node, keyword) => node.text.includes(keyword)
  20147. },
  20148. separator: {
  20149. type: String,
  20150. default: " / "
  20151. },
  20152. showAllLevels: {
  20153. type: Boolean,
  20154. default: true
  20155. },
  20156. collapseTags: Boolean,
  20157. collapseTagsTooltip: {
  20158. type: Boolean,
  20159. default: false
  20160. },
  20161. debounce: {
  20162. type: Number,
  20163. default: 300
  20164. },
  20165. beforeFilter: {
  20166. type: Function,
  20167. default: () => true
  20168. },
  20169. popperClass: {
  20170. type: String,
  20171. default: ""
  20172. },
  20173. teleported: useTooltipContentProps.teleported,
  20174. tagType: { ...tagProps.type, default: "info" },
  20175. validateEvent: {
  20176. type: Boolean,
  20177. default: true
  20178. }
  20179. },
  20180. emits: [
  20181. UPDATE_MODEL_EVENT,
  20182. CHANGE_EVENT,
  20183. "focus",
  20184. "blur",
  20185. "visible-change",
  20186. "expand-change",
  20187. "remove-tag"
  20188. ],
  20189. setup(props, { emit }) {
  20190. let inputInitialHeight = 0;
  20191. let pressDeleteCount = 0;
  20192. const nsCascader = useNamespace("cascader");
  20193. const nsInput = useNamespace("input");
  20194. const { t } = useLocale();
  20195. const { form, formItem } = useFormItem();
  20196. const tooltipRef = vue.ref(null);
  20197. const input = vue.ref(null);
  20198. const tagWrapper = vue.ref(null);
  20199. const panel = vue.ref(null);
  20200. const suggestionPanel = vue.ref(null);
  20201. const popperVisible = vue.ref(false);
  20202. const inputHover = vue.ref(false);
  20203. const filtering = vue.ref(false);
  20204. const inputValue = vue.ref("");
  20205. const searchInputValue = vue.ref("");
  20206. const presentTags = vue.ref([]);
  20207. const allPresentTags = vue.ref([]);
  20208. const suggestions = vue.ref([]);
  20209. const isOnComposition = vue.ref(false);
  20210. const isDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  20211. const inputPlaceholder = vue.computed(() => props.placeholder || t("el.cascader.placeholder"));
  20212. const currentPlaceholder = vue.computed(() => searchInputValue.value || presentTags.value.length > 0 ? "" : inputPlaceholder.value);
  20213. const realSize = useSize();
  20214. const tagSize = vue.computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  20215. const multiple = vue.computed(() => !!props.props.multiple);
  20216. const readonly = vue.computed(() => !props.filterable || multiple.value);
  20217. const searchKeyword = vue.computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  20218. const checkedNodes = vue.computed(() => {
  20219. var _a;
  20220. return ((_a = panel.value) == null ? void 0 : _a.checkedNodes) || [];
  20221. });
  20222. const clearBtnVisible = vue.computed(() => {
  20223. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  20224. return false;
  20225. return !!checkedNodes.value.length;
  20226. });
  20227. const presentText = vue.computed(() => {
  20228. const { showAllLevels, separator } = props;
  20229. const nodes = checkedNodes.value;
  20230. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  20231. });
  20232. const checkedValue = vue.computed({
  20233. get() {
  20234. return cloneDeep(props.modelValue);
  20235. },
  20236. set(val) {
  20237. emit(UPDATE_MODEL_EVENT, val);
  20238. emit(CHANGE_EVENT, val);
  20239. if (props.validateEvent) {
  20240. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  20241. }
  20242. }
  20243. });
  20244. const popperPaneRef = vue.computed(() => {
  20245. var _a, _b;
  20246. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  20247. });
  20248. const togglePopperVisible = (visible) => {
  20249. var _a, _b, _c;
  20250. if (isDisabled.value)
  20251. return;
  20252. visible = visible != null ? visible : !popperVisible.value;
  20253. if (visible !== popperVisible.value) {
  20254. popperVisible.value = visible;
  20255. (_b = (_a = input.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  20256. if (visible) {
  20257. updatePopperPosition();
  20258. vue.nextTick((_c = panel.value) == null ? void 0 : _c.scrollToExpandingNode);
  20259. } else if (props.filterable) {
  20260. syncPresentTextValue();
  20261. }
  20262. emit("visible-change", visible);
  20263. }
  20264. };
  20265. const updatePopperPosition = () => {
  20266. vue.nextTick(() => {
  20267. var _a;
  20268. (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  20269. });
  20270. };
  20271. const hideSuggestionPanel = () => {
  20272. filtering.value = false;
  20273. };
  20274. const genTag = (node) => {
  20275. const { showAllLevels, separator } = props;
  20276. return {
  20277. node,
  20278. key: node.uid,
  20279. text: node.calcText(showAllLevels, separator),
  20280. hitState: false,
  20281. closable: !isDisabled.value && !node.isDisabled,
  20282. isCollapseTag: false
  20283. };
  20284. };
  20285. const deleteTag = (tag) => {
  20286. var _a;
  20287. const node = tag.node;
  20288. node.doCheck(false);
  20289. (_a = panel.value) == null ? void 0 : _a.calculateCheckedValue();
  20290. emit("remove-tag", node.valueByOption);
  20291. };
  20292. const calculatePresentTags = () => {
  20293. if (!multiple.value)
  20294. return;
  20295. const nodes = checkedNodes.value;
  20296. const tags = [];
  20297. const allTags = [];
  20298. nodes.forEach((node) => allTags.push(genTag(node)));
  20299. allPresentTags.value = allTags;
  20300. if (nodes.length) {
  20301. const [first, ...rest] = nodes;
  20302. const restCount = rest.length;
  20303. tags.push(genTag(first));
  20304. if (restCount) {
  20305. if (props.collapseTags) {
  20306. tags.push({
  20307. key: -1,
  20308. text: `+ ${restCount}`,
  20309. closable: false,
  20310. isCollapseTag: true
  20311. });
  20312. } else {
  20313. rest.forEach((node) => tags.push(genTag(node)));
  20314. }
  20315. }
  20316. }
  20317. presentTags.value = tags;
  20318. };
  20319. const calculateSuggestions = () => {
  20320. var _a, _b;
  20321. const { filterMethod, showAllLevels, separator } = props;
  20322. const res = (_b = (_a = panel.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  20323. if (node.isDisabled)
  20324. return false;
  20325. node.calcText(showAllLevels, separator);
  20326. return filterMethod(node, searchKeyword.value);
  20327. });
  20328. if (multiple.value) {
  20329. presentTags.value.forEach((tag) => {
  20330. tag.hitState = false;
  20331. });
  20332. allPresentTags.value.forEach((tag) => {
  20333. tag.hitState = false;
  20334. });
  20335. }
  20336. filtering.value = true;
  20337. suggestions.value = res;
  20338. updatePopperPosition();
  20339. };
  20340. const focusFirstNode = () => {
  20341. var _a;
  20342. let firstNode;
  20343. if (filtering.value && suggestionPanel.value) {
  20344. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  20345. } else {
  20346. firstNode = (_a = panel.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  20347. }
  20348. if (firstNode) {
  20349. firstNode.focus();
  20350. !filtering.value && firstNode.click();
  20351. }
  20352. };
  20353. const updateStyle = () => {
  20354. var _a, _b;
  20355. const inputInner = (_a = input.value) == null ? void 0 : _a.input;
  20356. const tagWrapperEl = tagWrapper.value;
  20357. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  20358. if (!isClient || !inputInner)
  20359. return;
  20360. if (suggestionPanelEl) {
  20361. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  20362. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  20363. }
  20364. if (tagWrapperEl) {
  20365. const { offsetHeight } = tagWrapperEl;
  20366. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  20367. inputInner.style.height = height;
  20368. updatePopperPosition();
  20369. }
  20370. };
  20371. const getCheckedNodes = (leafOnly) => {
  20372. var _a;
  20373. return (_a = panel.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
  20374. };
  20375. const handleExpandChange = (value) => {
  20376. updatePopperPosition();
  20377. emit("expand-change", value);
  20378. };
  20379. const handleComposition = (event) => {
  20380. var _a;
  20381. const text = (_a = event.target) == null ? void 0 : _a.value;
  20382. if (event.type === "compositionend") {
  20383. isOnComposition.value = false;
  20384. vue.nextTick(() => handleInput(text));
  20385. } else {
  20386. const lastCharacter = text[text.length - 1] || "";
  20387. isOnComposition.value = !isKorean(lastCharacter);
  20388. }
  20389. };
  20390. const handleKeyDown = (e) => {
  20391. if (isOnComposition.value)
  20392. return;
  20393. switch (e.code) {
  20394. case EVENT_CODE.enter:
  20395. togglePopperVisible();
  20396. break;
  20397. case EVENT_CODE.down:
  20398. togglePopperVisible(true);
  20399. vue.nextTick(focusFirstNode);
  20400. e.preventDefault();
  20401. break;
  20402. case EVENT_CODE.esc:
  20403. if (popperVisible.value === true) {
  20404. e.preventDefault();
  20405. e.stopPropagation();
  20406. togglePopperVisible(false);
  20407. }
  20408. break;
  20409. case EVENT_CODE.tab:
  20410. togglePopperVisible(false);
  20411. break;
  20412. }
  20413. };
  20414. const handleClear = () => {
  20415. var _a;
  20416. (_a = panel.value) == null ? void 0 : _a.clearCheckedNodes();
  20417. if (!popperVisible.value && props.filterable) {
  20418. syncPresentTextValue();
  20419. }
  20420. togglePopperVisible(false);
  20421. };
  20422. const syncPresentTextValue = () => {
  20423. const { value } = presentText;
  20424. inputValue.value = value;
  20425. searchInputValue.value = value;
  20426. };
  20427. const handleSuggestionClick = (node) => {
  20428. var _a, _b;
  20429. const { checked } = node;
  20430. if (multiple.value) {
  20431. (_a = panel.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
  20432. } else {
  20433. !checked && ((_b = panel.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  20434. togglePopperVisible(false);
  20435. }
  20436. };
  20437. const handleSuggestionKeyDown = (e) => {
  20438. const target = e.target;
  20439. const { code } = e;
  20440. switch (code) {
  20441. case EVENT_CODE.up:
  20442. case EVENT_CODE.down: {
  20443. const distance = code === EVENT_CODE.up ? -1 : 1;
  20444. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  20445. break;
  20446. }
  20447. case EVENT_CODE.enter:
  20448. target.click();
  20449. break;
  20450. }
  20451. };
  20452. const handleDelete = () => {
  20453. const tags = presentTags.value;
  20454. const lastTag = tags[tags.length - 1];
  20455. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  20456. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1)
  20457. return;
  20458. if (lastTag.hitState) {
  20459. deleteTag(lastTag);
  20460. } else {
  20461. lastTag.hitState = true;
  20462. }
  20463. };
  20464. const handleFilter = debounce(() => {
  20465. const { value } = searchKeyword;
  20466. if (!value)
  20467. return;
  20468. const passed = props.beforeFilter(value);
  20469. if (isPromise(passed)) {
  20470. passed.then(calculateSuggestions).catch(() => {
  20471. });
  20472. } else if (passed !== false) {
  20473. calculateSuggestions();
  20474. } else {
  20475. hideSuggestionPanel();
  20476. }
  20477. }, props.debounce);
  20478. const handleInput = (val, e) => {
  20479. !popperVisible.value && togglePopperVisible(true);
  20480. if (e == null ? void 0 : e.isComposing)
  20481. return;
  20482. val ? handleFilter() : hideSuggestionPanel();
  20483. };
  20484. vue.watch(filtering, updatePopperPosition);
  20485. vue.watch([checkedNodes, isDisabled], calculatePresentTags);
  20486. vue.watch(presentTags, () => {
  20487. vue.nextTick(() => updateStyle());
  20488. });
  20489. vue.watch(presentText, syncPresentTextValue, { immediate: true });
  20490. vue.onMounted(() => {
  20491. const inputInner = input.value.input;
  20492. const inputInnerHeight = Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  20493. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  20494. useResizeObserver(inputInner, updateStyle);
  20495. });
  20496. return {
  20497. popperOptions,
  20498. tooltipRef,
  20499. popperPaneRef,
  20500. input,
  20501. tagWrapper,
  20502. panel,
  20503. suggestionPanel,
  20504. popperVisible,
  20505. inputHover,
  20506. inputPlaceholder,
  20507. currentPlaceholder,
  20508. filtering,
  20509. presentText,
  20510. checkedValue,
  20511. inputValue,
  20512. searchInputValue,
  20513. presentTags,
  20514. allPresentTags,
  20515. suggestions,
  20516. isDisabled,
  20517. isOnComposition,
  20518. realSize,
  20519. tagSize,
  20520. multiple,
  20521. readonly,
  20522. clearBtnVisible,
  20523. nsCascader,
  20524. nsInput,
  20525. t,
  20526. togglePopperVisible,
  20527. hideSuggestionPanel,
  20528. deleteTag,
  20529. focusFirstNode,
  20530. getCheckedNodes,
  20531. handleExpandChange,
  20532. handleKeyDown,
  20533. handleComposition,
  20534. handleClear,
  20535. handleSuggestionClick,
  20536. handleSuggestionKeyDown,
  20537. handleDelete,
  20538. handleInput
  20539. };
  20540. }
  20541. });
  20542. const _hoisted_1$O = { key: 0 };
  20543. const _hoisted_2$w = ["placeholder"];
  20544. const _hoisted_3$h = ["onClick"];
  20545. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  20546. const _component_circle_close = vue.resolveComponent("circle-close");
  20547. const _component_el_icon = vue.resolveComponent("el-icon");
  20548. const _component_arrow_down = vue.resolveComponent("arrow-down");
  20549. const _component_el_input = vue.resolveComponent("el-input");
  20550. const _component_el_tag = vue.resolveComponent("el-tag");
  20551. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  20552. const _component_el_cascader_panel = vue.resolveComponent("el-cascader-panel");
  20553. const _component_check = vue.resolveComponent("check");
  20554. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  20555. const _directive_clickoutside = vue.resolveDirective("clickoutside");
  20556. return vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  20557. ref: "tooltipRef",
  20558. visible: _ctx.popperVisible,
  20559. teleported: _ctx.teleported,
  20560. "popper-class": [_ctx.nsCascader.e("dropdown"), _ctx.popperClass],
  20561. "popper-options": _ctx.popperOptions,
  20562. "fallback-placements": [
  20563. "bottom-start",
  20564. "bottom",
  20565. "top-start",
  20566. "top",
  20567. "right",
  20568. "left"
  20569. ],
  20570. "stop-popper-mouse-event": false,
  20571. "gpu-acceleration": false,
  20572. placement: "bottom-start",
  20573. transition: `${_ctx.nsCascader.namespace.value}-zoom-in-top`,
  20574. effect: "light",
  20575. pure: "",
  20576. persistent: "",
  20577. onHide: _ctx.hideSuggestionPanel
  20578. }, {
  20579. default: vue.withCtx(() => [
  20580. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  20581. class: vue.normalizeClass([
  20582. _ctx.nsCascader.b(),
  20583. _ctx.nsCascader.m(_ctx.realSize),
  20584. _ctx.nsCascader.is("disabled", _ctx.isDisabled),
  20585. _ctx.$attrs.class
  20586. ]),
  20587. style: vue.normalizeStyle(_ctx.$attrs.style),
  20588. onClick: _cache[11] || (_cache[11] = () => _ctx.togglePopperVisible(_ctx.readonly ? void 0 : true)),
  20589. onKeydown: _cache[12] || (_cache[12] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)),
  20590. onMouseenter: _cache[13] || (_cache[13] = ($event) => _ctx.inputHover = true),
  20591. onMouseleave: _cache[14] || (_cache[14] = ($event) => _ctx.inputHover = false)
  20592. }, [
  20593. vue.createVNode(_component_el_input, {
  20594. ref: "input",
  20595. modelValue: _ctx.inputValue,
  20596. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.inputValue = $event),
  20597. placeholder: _ctx.currentPlaceholder,
  20598. readonly: _ctx.readonly,
  20599. disabled: _ctx.isDisabled,
  20600. "validate-event": false,
  20601. size: _ctx.realSize,
  20602. class: vue.normalizeClass(_ctx.nsCascader.is("focus", _ctx.popperVisible)),
  20603. onCompositionstart: _ctx.handleComposition,
  20604. onCompositionupdate: _ctx.handleComposition,
  20605. onCompositionend: _ctx.handleComposition,
  20606. onFocus: _cache[2] || (_cache[2] = (e) => _ctx.$emit("focus", e)),
  20607. onBlur: _cache[3] || (_cache[3] = (e) => _ctx.$emit("blur", e)),
  20608. onInput: _ctx.handleInput
  20609. }, {
  20610. suffix: vue.withCtx(() => [
  20611. _ctx.clearBtnVisible ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  20612. key: "clear",
  20613. class: vue.normalizeClass([_ctx.nsInput.e("icon"), "icon-circle-close"]),
  20614. onClick: vue.withModifiers(_ctx.handleClear, ["stop"])
  20615. }, {
  20616. default: vue.withCtx(() => [
  20617. vue.createVNode(_component_circle_close)
  20618. ]),
  20619. _: 1
  20620. }, 8, ["class", "onClick"])) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
  20621. key: "arrow-down",
  20622. class: vue.normalizeClass([
  20623. _ctx.nsInput.e("icon"),
  20624. "icon-arrow-down",
  20625. _ctx.nsCascader.is("reverse", _ctx.popperVisible)
  20626. ]),
  20627. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => _ctx.togglePopperVisible(), ["stop"]))
  20628. }, {
  20629. default: vue.withCtx(() => [
  20630. vue.createVNode(_component_arrow_down)
  20631. ]),
  20632. _: 1
  20633. }, 8, ["class"]))
  20634. ]),
  20635. _: 1
  20636. }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput"]),
  20637. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", {
  20638. key: 0,
  20639. ref: "tagWrapper",
  20640. class: vue.normalizeClass(_ctx.nsCascader.e("tags"))
  20641. }, [
  20642. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.presentTags, (tag) => {
  20643. return vue.openBlock(), vue.createBlock(_component_el_tag, {
  20644. key: tag.key,
  20645. type: _ctx.tagType,
  20646. size: _ctx.tagSize,
  20647. hit: tag.hitState,
  20648. closable: tag.closable,
  20649. "disable-transitions": "",
  20650. onClose: ($event) => _ctx.deleteTag(tag)
  20651. }, {
  20652. default: vue.withCtx(() => [
  20653. tag.isCollapseTag === false ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$O, vue.toDisplayString(tag.text), 1)) : (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  20654. key: 1,
  20655. disabled: _ctx.popperVisible || !_ctx.collapseTagsTooltip,
  20656. "fallback-placements": ["bottom", "top", "right", "left"],
  20657. placement: "bottom",
  20658. effect: "light"
  20659. }, {
  20660. default: vue.withCtx(() => [
  20661. vue.createElementVNode("span", null, vue.toDisplayString(tag.text), 1)
  20662. ]),
  20663. content: vue.withCtx(() => [
  20664. vue.createElementVNode("div", {
  20665. class: vue.normalizeClass(_ctx.nsCascader.e("collapse-tags"))
  20666. }, [
  20667. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.allPresentTags.slice(1), (tag2, idx) => {
  20668. return vue.openBlock(), vue.createElementBlock("div", {
  20669. key: idx,
  20670. class: vue.normalizeClass(_ctx.nsCascader.e("collapse-tag"))
  20671. }, [
  20672. (vue.openBlock(), vue.createBlock(_component_el_tag, {
  20673. key: tag2.key,
  20674. class: "in-tooltip",
  20675. type: _ctx.tagType,
  20676. size: _ctx.tagSize,
  20677. hit: tag2.hitState,
  20678. closable: tag2.closable,
  20679. "disable-transitions": "",
  20680. onClose: ($event) => _ctx.deleteTag(tag2)
  20681. }, {
  20682. default: vue.withCtx(() => [
  20683. vue.createElementVNode("span", null, vue.toDisplayString(tag2.text), 1)
  20684. ]),
  20685. _: 2
  20686. }, 1032, ["type", "size", "hit", "closable", "onClose"]))
  20687. ], 2);
  20688. }), 128))
  20689. ], 2)
  20690. ]),
  20691. _: 2
  20692. }, 1032, ["disabled"]))
  20693. ]),
  20694. _: 2
  20695. }, 1032, ["type", "size", "hit", "closable", "onClose"]);
  20696. }), 128)),
  20697. _ctx.filterable && !_ctx.isDisabled ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  20698. key: 0,
  20699. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.searchInputValue = $event),
  20700. type: "text",
  20701. class: vue.normalizeClass(_ctx.nsCascader.e("search-input")),
  20702. placeholder: _ctx.presentText ? "" : _ctx.inputPlaceholder,
  20703. onInput: _cache[5] || (_cache[5] = (e) => _ctx.handleInput(_ctx.searchInputValue, e)),
  20704. onClick: _cache[6] || (_cache[6] = vue.withModifiers(($event) => _ctx.togglePopperVisible(true), ["stop"])),
  20705. onKeydown: _cache[7] || (_cache[7] = vue.withKeys((...args) => _ctx.handleDelete && _ctx.handleDelete(...args), ["delete"])),
  20706. onCompositionstart: _cache[8] || (_cache[8] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20707. onCompositionupdate: _cache[9] || (_cache[9] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20708. onCompositionend: _cache[10] || (_cache[10] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args))
  20709. }, null, 42, _hoisted_2$w)), [
  20710. [vue.vModelText, _ctx.searchInputValue]
  20711. ]) : vue.createCommentVNode("v-if", true)
  20712. ], 2)) : vue.createCommentVNode("v-if", true)
  20713. ], 38)), [
  20714. [_directive_clickoutside, () => _ctx.togglePopperVisible(false), _ctx.popperPaneRef]
  20715. ])
  20716. ]),
  20717. content: vue.withCtx(() => [
  20718. vue.withDirectives(vue.createVNode(_component_el_cascader_panel, {
  20719. ref: "panel",
  20720. modelValue: _ctx.checkedValue,
  20721. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.checkedValue = $event),
  20722. options: _ctx.options,
  20723. props: _ctx.props,
  20724. border: false,
  20725. "render-label": _ctx.$slots.default,
  20726. onExpandChange: _ctx.handleExpandChange,
  20727. onClose: _cache[16] || (_cache[16] = ($event) => _ctx.$nextTick(() => _ctx.togglePopperVisible(false)))
  20728. }, null, 8, ["modelValue", "options", "props", "render-label", "onExpandChange"]), [
  20729. [vue.vShow, !_ctx.filtering]
  20730. ]),
  20731. _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_scrollbar, {
  20732. key: 0,
  20733. ref: "suggestionPanel",
  20734. tag: "ul",
  20735. class: vue.normalizeClass(_ctx.nsCascader.e("suggestion-panel")),
  20736. "view-class": _ctx.nsCascader.e("suggestion-list"),
  20737. onKeydown: _ctx.handleSuggestionKeyDown
  20738. }, {
  20739. default: vue.withCtx(() => [
  20740. _ctx.suggestions.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.suggestions, (item) => {
  20741. return vue.openBlock(), vue.createElementBlock("li", {
  20742. key: item.uid,
  20743. class: vue.normalizeClass([
  20744. _ctx.nsCascader.e("suggestion-item"),
  20745. _ctx.nsCascader.is("checked", item.checked)
  20746. ]),
  20747. tabindex: -1,
  20748. onClick: ($event) => _ctx.handleSuggestionClick(item)
  20749. }, [
  20750. vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1),
  20751. item.checked ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
  20752. default: vue.withCtx(() => [
  20753. vue.createVNode(_component_check)
  20754. ]),
  20755. _: 1
  20756. })) : vue.createCommentVNode("v-if", true)
  20757. ], 10, _hoisted_3$h);
  20758. }), 128)) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  20759. vue.createElementVNode("li", {
  20760. class: vue.normalizeClass(_ctx.nsCascader.e("empty-text"))
  20761. }, vue.toDisplayString(_ctx.t("el.cascader.noMatch")), 3)
  20762. ])
  20763. ]),
  20764. _: 3
  20765. }, 8, ["class", "view-class", "onKeydown"])), [
  20766. [vue.vShow, _ctx.filtering]
  20767. ]) : vue.createCommentVNode("v-if", true)
  20768. ]),
  20769. _: 3
  20770. }, 8, ["visible", "teleported", "popper-class", "popper-options", "transition", "onHide"]);
  20771. }
  20772. var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["render", _sfc_render$u], ["__file", "index.vue"]]);
  20773. Cascader.install = (app) => {
  20774. app.component(Cascader.name, Cascader);
  20775. };
  20776. const _Cascader = Cascader;
  20777. const ElCascader = _Cascader;
  20778. const checkTagProps = buildProps({
  20779. checked: {
  20780. type: Boolean,
  20781. default: false
  20782. }
  20783. });
  20784. const checkTagEmits = {
  20785. "update:checked": (value) => isBoolean(value),
  20786. [CHANGE_EVENT]: (value) => isBoolean(value)
  20787. };
  20788. const __default__$$ = vue.defineComponent({
  20789. name: "ElCheckTag"
  20790. });
  20791. const _sfc_main$1A = /* @__PURE__ */ vue.defineComponent({
  20792. ...__default__$$,
  20793. props: checkTagProps,
  20794. emits: checkTagEmits,
  20795. setup(__props, { emit }) {
  20796. const props = __props;
  20797. const ns = useNamespace("check-tag");
  20798. const handleChange = () => {
  20799. const checked = !props.checked;
  20800. emit(CHANGE_EVENT, checked);
  20801. emit("update:checked", checked);
  20802. };
  20803. return (_ctx, _cache) => {
  20804. return vue.openBlock(), vue.createElementBlock("span", {
  20805. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("checked", _ctx.checked)]),
  20806. onClick: handleChange
  20807. }, [
  20808. vue.renderSlot(_ctx.$slots, "default")
  20809. ], 2);
  20810. };
  20811. }
  20812. });
  20813. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__file", "check-tag.vue"]]);
  20814. const ElCheckTag = withInstall(CheckTag);
  20815. const colProps = buildProps({
  20816. tag: {
  20817. type: String,
  20818. default: "div"
  20819. },
  20820. span: {
  20821. type: Number,
  20822. default: 24
  20823. },
  20824. offset: {
  20825. type: Number,
  20826. default: 0
  20827. },
  20828. pull: {
  20829. type: Number,
  20830. default: 0
  20831. },
  20832. push: {
  20833. type: Number,
  20834. default: 0
  20835. },
  20836. xs: {
  20837. type: definePropType([Number, Object]),
  20838. default: () => mutable({})
  20839. },
  20840. sm: {
  20841. type: definePropType([Number, Object]),
  20842. default: () => mutable({})
  20843. },
  20844. md: {
  20845. type: definePropType([Number, Object]),
  20846. default: () => mutable({})
  20847. },
  20848. lg: {
  20849. type: definePropType([Number, Object]),
  20850. default: () => mutable({})
  20851. },
  20852. xl: {
  20853. type: definePropType([Number, Object]),
  20854. default: () => mutable({})
  20855. }
  20856. });
  20857. const __default__$_ = vue.defineComponent({
  20858. name: "ElCol"
  20859. });
  20860. const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({
  20861. ...__default__$_,
  20862. props: colProps,
  20863. setup(__props) {
  20864. const props = __props;
  20865. const { gutter } = vue.inject(rowContextKey, { gutter: vue.computed(() => 0) });
  20866. const ns = useNamespace("col");
  20867. const style = vue.computed(() => {
  20868. const styles = {};
  20869. if (gutter.value) {
  20870. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  20871. }
  20872. return styles;
  20873. });
  20874. const colKls = vue.computed(() => {
  20875. const classes = [];
  20876. const pos = ["span", "offset", "pull", "push"];
  20877. pos.forEach((prop) => {
  20878. const size = props[prop];
  20879. if (isNumber(size)) {
  20880. if (prop === "span")
  20881. classes.push(ns.b(`${props[prop]}`));
  20882. else if (size > 0)
  20883. classes.push(ns.b(`${prop}-${props[prop]}`));
  20884. }
  20885. });
  20886. const sizes = ["xs", "sm", "md", "lg", "xl"];
  20887. sizes.forEach((size) => {
  20888. if (isNumber(props[size])) {
  20889. classes.push(ns.b(`${size}-${props[size]}`));
  20890. } else if (isObject$1(props[size])) {
  20891. Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  20892. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  20893. });
  20894. }
  20895. });
  20896. if (gutter.value) {
  20897. classes.push(ns.is("guttered"));
  20898. }
  20899. return [ns.b(), classes];
  20900. });
  20901. return (_ctx, _cache) => {
  20902. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  20903. class: vue.normalizeClass(vue.unref(colKls)),
  20904. style: vue.normalizeStyle(vue.unref(style))
  20905. }, {
  20906. default: vue.withCtx(() => [
  20907. vue.renderSlot(_ctx.$slots, "default")
  20908. ]),
  20909. _: 3
  20910. }, 8, ["class", "style"]);
  20911. };
  20912. }
  20913. });
  20914. var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "col.vue"]]);
  20915. const ElCol = withInstall(Col);
  20916. const emitChangeFn = (value) => typeof isNumber(value);
  20917. const collapseProps = buildProps({
  20918. accordion: Boolean,
  20919. modelValue: {
  20920. type: definePropType([Array, String, Number]),
  20921. default: () => mutable([])
  20922. }
  20923. });
  20924. const collapseEmits = {
  20925. [UPDATE_MODEL_EVENT]: emitChangeFn,
  20926. [CHANGE_EVENT]: emitChangeFn
  20927. };
  20928. const useCollapse = (props, emit) => {
  20929. const activeNames = vue.ref(castArray$1(props.modelValue));
  20930. const setActiveNames = (_activeNames) => {
  20931. activeNames.value = _activeNames;
  20932. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  20933. emit(UPDATE_MODEL_EVENT, value);
  20934. emit(CHANGE_EVENT, value);
  20935. };
  20936. const handleItemClick = (name) => {
  20937. if (props.accordion) {
  20938. setActiveNames([activeNames.value[0] === name ? "" : name]);
  20939. } else {
  20940. const _activeNames = [...activeNames.value];
  20941. const index = _activeNames.indexOf(name);
  20942. if (index > -1) {
  20943. _activeNames.splice(index, 1);
  20944. } else {
  20945. _activeNames.push(name);
  20946. }
  20947. setActiveNames(_activeNames);
  20948. }
  20949. };
  20950. vue.watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  20951. vue.provide(collapseContextKey, {
  20952. activeNames,
  20953. handleItemClick
  20954. });
  20955. return {
  20956. activeNames,
  20957. setActiveNames
  20958. };
  20959. };
  20960. const useCollapseDOM = () => {
  20961. const ns = useNamespace("collapse");
  20962. const rootKls = vue.computed(() => ns.b());
  20963. return {
  20964. rootKls
  20965. };
  20966. };
  20967. const __default__$Z = vue.defineComponent({
  20968. name: "ElCollapse"
  20969. });
  20970. const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({
  20971. ...__default__$Z,
  20972. props: collapseProps,
  20973. emits: collapseEmits,
  20974. setup(__props, { expose, emit }) {
  20975. const props = __props;
  20976. const { activeNames, setActiveNames } = useCollapse(props, emit);
  20977. const { rootKls } = useCollapseDOM();
  20978. expose({
  20979. activeNames,
  20980. setActiveNames
  20981. });
  20982. return (_ctx, _cache) => {
  20983. return vue.openBlock(), vue.createElementBlock("div", {
  20984. class: vue.normalizeClass(vue.unref(rootKls)),
  20985. role: "tablist",
  20986. "aria-multiselectable": "true"
  20987. }, [
  20988. vue.renderSlot(_ctx.$slots, "default")
  20989. ], 2);
  20990. };
  20991. }
  20992. });
  20993. var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "collapse.vue"]]);
  20994. const __default__$Y = vue.defineComponent({
  20995. name: "ElCollapseTransition"
  20996. });
  20997. const _sfc_main$1x = /* @__PURE__ */ vue.defineComponent({
  20998. ...__default__$Y,
  20999. setup(__props) {
  21000. const ns = useNamespace("collapse-transition");
  21001. const on = {
  21002. beforeEnter(el) {
  21003. if (!el.dataset)
  21004. el.dataset = {};
  21005. el.dataset.oldPaddingTop = el.style.paddingTop;
  21006. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  21007. el.style.maxHeight = 0;
  21008. el.style.paddingTop = 0;
  21009. el.style.paddingBottom = 0;
  21010. },
  21011. enter(el) {
  21012. el.dataset.oldOverflow = el.style.overflow;
  21013. if (el.scrollHeight !== 0) {
  21014. el.style.maxHeight = `${el.scrollHeight}px`;
  21015. el.style.paddingTop = el.dataset.oldPaddingTop;
  21016. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  21017. } else {
  21018. el.style.maxHeight = 0;
  21019. el.style.paddingTop = el.dataset.oldPaddingTop;
  21020. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  21021. }
  21022. el.style.overflow = "hidden";
  21023. },
  21024. afterEnter(el) {
  21025. el.style.maxHeight = "";
  21026. el.style.overflow = el.dataset.oldOverflow;
  21027. },
  21028. beforeLeave(el) {
  21029. if (!el.dataset)
  21030. el.dataset = {};
  21031. el.dataset.oldPaddingTop = el.style.paddingTop;
  21032. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  21033. el.dataset.oldOverflow = el.style.overflow;
  21034. el.style.maxHeight = `${el.scrollHeight}px`;
  21035. el.style.overflow = "hidden";
  21036. },
  21037. leave(el) {
  21038. if (el.scrollHeight !== 0) {
  21039. el.style.maxHeight = 0;
  21040. el.style.paddingTop = 0;
  21041. el.style.paddingBottom = 0;
  21042. }
  21043. },
  21044. afterLeave(el) {
  21045. el.style.maxHeight = "";
  21046. el.style.overflow = el.dataset.oldOverflow;
  21047. el.style.paddingTop = el.dataset.oldPaddingTop;
  21048. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  21049. }
  21050. };
  21051. return (_ctx, _cache) => {
  21052. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({
  21053. name: vue.unref(ns).b()
  21054. }, vue.toHandlers(on)), {
  21055. default: vue.withCtx(() => [
  21056. vue.renderSlot(_ctx.$slots, "default")
  21057. ]),
  21058. _: 3
  21059. }, 16, ["name"]);
  21060. };
  21061. }
  21062. });
  21063. var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "collapse-transition.vue"]]);
  21064. CollapseTransition.install = (app) => {
  21065. app.component(CollapseTransition.name, CollapseTransition);
  21066. };
  21067. const _CollapseTransition = CollapseTransition;
  21068. const ElCollapseTransition = _CollapseTransition;
  21069. const collapseItemProps = buildProps({
  21070. title: {
  21071. type: String,
  21072. default: ""
  21073. },
  21074. name: {
  21075. type: definePropType([String, Number]),
  21076. default: () => generateId()
  21077. },
  21078. disabled: Boolean
  21079. });
  21080. const useCollapseItem = (props) => {
  21081. const collapse = vue.inject(collapseContextKey);
  21082. const focusing = vue.ref(false);
  21083. const isClick = vue.ref(false);
  21084. const id = vue.ref(generateId());
  21085. const isActive = vue.computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(props.name));
  21086. const handleFocus = () => {
  21087. setTimeout(() => {
  21088. if (!isClick.value) {
  21089. focusing.value = true;
  21090. } else {
  21091. isClick.value = false;
  21092. }
  21093. }, 50);
  21094. };
  21095. const handleHeaderClick = () => {
  21096. if (props.disabled)
  21097. return;
  21098. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  21099. focusing.value = false;
  21100. isClick.value = true;
  21101. };
  21102. const handleEnterClick = () => {
  21103. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  21104. };
  21105. return {
  21106. focusing,
  21107. id,
  21108. isActive,
  21109. handleFocus,
  21110. handleHeaderClick,
  21111. handleEnterClick
  21112. };
  21113. };
  21114. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  21115. const ns = useNamespace("collapse");
  21116. const rootKls = vue.computed(() => [
  21117. ns.b("item"),
  21118. ns.is("active", vue.unref(isActive)),
  21119. ns.is("disabled", props.disabled)
  21120. ]);
  21121. const headKls = vue.computed(() => [
  21122. ns.be("item", "header"),
  21123. ns.is("active", vue.unref(isActive)),
  21124. { focusing: vue.unref(focusing) && !props.disabled }
  21125. ]);
  21126. const arrowKls = vue.computed(() => [
  21127. ns.be("item", "arrow"),
  21128. ns.is("active", vue.unref(isActive))
  21129. ]);
  21130. const itemWrapperKls = vue.computed(() => ns.be("item", "wrap"));
  21131. const itemContentKls = vue.computed(() => ns.be("item", "content"));
  21132. const scopedContentId = vue.computed(() => ns.b(`content-${vue.unref(id)}`));
  21133. const scopedHeadId = vue.computed(() => ns.b(`head-${vue.unref(id)}`));
  21134. return {
  21135. arrowKls,
  21136. headKls,
  21137. rootKls,
  21138. itemWrapperKls,
  21139. itemContentKls,
  21140. scopedContentId,
  21141. scopedHeadId
  21142. };
  21143. };
  21144. const _hoisted_1$N = ["aria-expanded", "aria-controls", "aria-describedby"];
  21145. const _hoisted_2$v = ["id", "tabindex"];
  21146. const _hoisted_3$g = ["id", "aria-hidden", "aria-labelledby"];
  21147. const __default__$X = vue.defineComponent({
  21148. name: "ElCollapseItem"
  21149. });
  21150. const _sfc_main$1w = /* @__PURE__ */ vue.defineComponent({
  21151. ...__default__$X,
  21152. props: collapseItemProps,
  21153. setup(__props, { expose }) {
  21154. const props = __props;
  21155. const {
  21156. focusing,
  21157. id,
  21158. isActive,
  21159. handleFocus,
  21160. handleHeaderClick,
  21161. handleEnterClick
  21162. } = useCollapseItem(props);
  21163. const {
  21164. arrowKls,
  21165. headKls,
  21166. rootKls,
  21167. itemWrapperKls,
  21168. itemContentKls,
  21169. scopedContentId,
  21170. scopedHeadId
  21171. } = useCollapseItemDOM(props, { focusing, isActive, id });
  21172. expose({
  21173. isActive
  21174. });
  21175. return (_ctx, _cache) => {
  21176. return vue.openBlock(), vue.createElementBlock("div", {
  21177. class: vue.normalizeClass(vue.unref(rootKls))
  21178. }, [
  21179. vue.createElementVNode("div", {
  21180. role: "tab",
  21181. "aria-expanded": vue.unref(isActive),
  21182. "aria-controls": vue.unref(scopedContentId),
  21183. "aria-describedby": vue.unref(scopedContentId)
  21184. }, [
  21185. vue.createElementVNode("div", {
  21186. id: vue.unref(scopedHeadId),
  21187. class: vue.normalizeClass(vue.unref(headKls)),
  21188. role: "button",
  21189. tabindex: _ctx.disabled ? -1 : 0,
  21190. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleHeaderClick) && vue.unref(handleHeaderClick)(...args)),
  21191. onKeypress: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers((...args) => vue.unref(handleEnterClick) && vue.unref(handleEnterClick)(...args), ["stop", "prevent"]), ["space", "enter"])),
  21192. onFocus: _cache[2] || (_cache[2] = (...args) => vue.unref(handleFocus) && vue.unref(handleFocus)(...args)),
  21193. onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
  21194. }, [
  21195. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  21196. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  21197. ]),
  21198. vue.createVNode(vue.unref(ElIcon), {
  21199. class: vue.normalizeClass(vue.unref(arrowKls))
  21200. }, {
  21201. default: vue.withCtx(() => [
  21202. vue.createVNode(vue.unref(arrow_right_default))
  21203. ]),
  21204. _: 1
  21205. }, 8, ["class"])
  21206. ], 42, _hoisted_2$v)
  21207. ], 8, _hoisted_1$N),
  21208. vue.createVNode(vue.unref(_CollapseTransition), null, {
  21209. default: vue.withCtx(() => [
  21210. vue.withDirectives(vue.createElementVNode("div", {
  21211. id: vue.unref(scopedContentId),
  21212. class: vue.normalizeClass(vue.unref(itemWrapperKls)),
  21213. role: "tabpanel",
  21214. "aria-hidden": !vue.unref(isActive),
  21215. "aria-labelledby": vue.unref(scopedHeadId)
  21216. }, [
  21217. vue.createElementVNode("div", {
  21218. class: vue.normalizeClass(vue.unref(itemContentKls))
  21219. }, [
  21220. vue.renderSlot(_ctx.$slots, "default")
  21221. ], 2)
  21222. ], 10, _hoisted_3$g), [
  21223. [vue.vShow, vue.unref(isActive)]
  21224. ])
  21225. ]),
  21226. _: 3
  21227. })
  21228. ], 2);
  21229. };
  21230. }
  21231. });
  21232. var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "collapse-item.vue"]]);
  21233. const ElCollapse = withInstall(Collapse, {
  21234. CollapseItem
  21235. });
  21236. const ElCollapseItem = withNoopInstall(CollapseItem);
  21237. let isDragging = false;
  21238. function draggable(element, options) {
  21239. if (!isClient)
  21240. return;
  21241. const moveFn = function(event) {
  21242. var _a;
  21243. (_a = options.drag) == null ? void 0 : _a.call(options, event);
  21244. };
  21245. const upFn = function(event) {
  21246. var _a;
  21247. document.removeEventListener("mousemove", moveFn);
  21248. document.removeEventListener("mouseup", upFn);
  21249. document.removeEventListener("touchmove", moveFn);
  21250. document.removeEventListener("touchend", upFn);
  21251. document.onselectstart = null;
  21252. document.ondragstart = null;
  21253. isDragging = false;
  21254. (_a = options.end) == null ? void 0 : _a.call(options, event);
  21255. };
  21256. const downFn = function(event) {
  21257. var _a;
  21258. if (isDragging)
  21259. return;
  21260. event.preventDefault();
  21261. document.onselectstart = () => false;
  21262. document.ondragstart = () => false;
  21263. document.addEventListener("mousemove", moveFn);
  21264. document.addEventListener("mouseup", upFn);
  21265. document.addEventListener("touchmove", moveFn);
  21266. document.addEventListener("touchend", upFn);
  21267. isDragging = true;
  21268. (_a = options.start) == null ? void 0 : _a.call(options, event);
  21269. };
  21270. element.addEventListener("mousedown", downFn);
  21271. element.addEventListener("touchstart", downFn);
  21272. }
  21273. const _sfc_main$1v = vue.defineComponent({
  21274. name: "ElColorAlphaSlider",
  21275. props: {
  21276. color: {
  21277. type: Object,
  21278. required: true
  21279. },
  21280. vertical: {
  21281. type: Boolean,
  21282. default: false
  21283. }
  21284. },
  21285. setup(props) {
  21286. const ns = useNamespace("color-alpha-slider");
  21287. const instance = vue.getCurrentInstance();
  21288. const thumb = vue.shallowRef();
  21289. const bar = vue.shallowRef();
  21290. const thumbLeft = vue.ref(0);
  21291. const thumbTop = vue.ref(0);
  21292. const background = vue.ref();
  21293. vue.watch(() => props.color.get("alpha"), () => {
  21294. update();
  21295. });
  21296. vue.watch(() => props.color.value, () => {
  21297. update();
  21298. });
  21299. function getThumbLeft() {
  21300. if (!thumb.value)
  21301. return 0;
  21302. if (props.vertical)
  21303. return 0;
  21304. const el = instance.vnode.el;
  21305. const alpha = props.color.get("alpha");
  21306. if (!el)
  21307. return 0;
  21308. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  21309. }
  21310. function getThumbTop() {
  21311. if (!thumb.value)
  21312. return 0;
  21313. const el = instance.vnode.el;
  21314. if (!props.vertical)
  21315. return 0;
  21316. const alpha = props.color.get("alpha");
  21317. if (!el)
  21318. return 0;
  21319. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  21320. }
  21321. function getBackground() {
  21322. if (props.color && props.color.value) {
  21323. const { r, g, b } = props.color.toRgb();
  21324. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  21325. }
  21326. return "";
  21327. }
  21328. function handleClick(event) {
  21329. const target = event.target;
  21330. if (target !== thumb.value) {
  21331. handleDrag(event);
  21332. }
  21333. }
  21334. function handleDrag(event) {
  21335. if (!bar.value || !thumb.value)
  21336. return;
  21337. const el = instance.vnode.el;
  21338. const rect = el.getBoundingClientRect();
  21339. const { clientX, clientY } = getClientXY(event);
  21340. if (!props.vertical) {
  21341. let left = clientX - rect.left;
  21342. left = Math.max(thumb.value.offsetWidth / 2, left);
  21343. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  21344. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  21345. } else {
  21346. let top = clientY - rect.top;
  21347. top = Math.max(thumb.value.offsetHeight / 2, top);
  21348. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  21349. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  21350. }
  21351. }
  21352. function update() {
  21353. thumbLeft.value = getThumbLeft();
  21354. thumbTop.value = getThumbTop();
  21355. background.value = getBackground();
  21356. }
  21357. vue.onMounted(() => {
  21358. if (!bar.value || !thumb.value)
  21359. return;
  21360. const dragConfig = {
  21361. drag: (event) => {
  21362. handleDrag(event);
  21363. },
  21364. end: (event) => {
  21365. handleDrag(event);
  21366. }
  21367. };
  21368. draggable(bar.value, dragConfig);
  21369. draggable(thumb.value, dragConfig);
  21370. update();
  21371. });
  21372. return {
  21373. thumb,
  21374. bar,
  21375. thumbLeft,
  21376. thumbTop,
  21377. background,
  21378. handleClick,
  21379. update,
  21380. ns
  21381. };
  21382. }
  21383. });
  21384. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  21385. return vue.openBlock(), vue.createElementBlock("div", {
  21386. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  21387. }, [
  21388. vue.createElementVNode("div", {
  21389. ref: "bar",
  21390. class: vue.normalizeClass(_ctx.ns.e("bar")),
  21391. style: vue.normalizeStyle({
  21392. background: _ctx.background
  21393. }),
  21394. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  21395. }, null, 6),
  21396. vue.createElementVNode("div", {
  21397. ref: "thumb",
  21398. class: vue.normalizeClass(_ctx.ns.e("thumb")),
  21399. style: vue.normalizeStyle({
  21400. left: _ctx.thumbLeft + "px",
  21401. top: _ctx.thumbTop + "px"
  21402. })
  21403. }, null, 6)
  21404. ], 2);
  21405. }
  21406. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["render", _sfc_render$t], ["__file", "alpha-slider.vue"]]);
  21407. const _sfc_main$1u = vue.defineComponent({
  21408. name: "ElColorHueSlider",
  21409. props: {
  21410. color: {
  21411. type: Object,
  21412. required: true
  21413. },
  21414. vertical: Boolean
  21415. },
  21416. setup(props) {
  21417. const ns = useNamespace("color-hue-slider");
  21418. const instance = vue.getCurrentInstance();
  21419. const thumb = vue.ref();
  21420. const bar = vue.ref();
  21421. const thumbLeft = vue.ref(0);
  21422. const thumbTop = vue.ref(0);
  21423. const hueValue = vue.computed(() => {
  21424. return props.color.get("hue");
  21425. });
  21426. vue.watch(() => hueValue.value, () => {
  21427. update();
  21428. });
  21429. function handleClick(event) {
  21430. const target = event.target;
  21431. if (target !== thumb.value) {
  21432. handleDrag(event);
  21433. }
  21434. }
  21435. function handleDrag(event) {
  21436. if (!bar.value || !thumb.value)
  21437. return;
  21438. const el = instance.vnode.el;
  21439. const rect = el.getBoundingClientRect();
  21440. const { clientX, clientY } = getClientXY(event);
  21441. let hue;
  21442. if (!props.vertical) {
  21443. let left = clientX - rect.left;
  21444. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  21445. left = Math.max(thumb.value.offsetWidth / 2, left);
  21446. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  21447. } else {
  21448. let top = clientY - rect.top;
  21449. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  21450. top = Math.max(thumb.value.offsetHeight / 2, top);
  21451. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  21452. }
  21453. props.color.set("hue", hue);
  21454. }
  21455. function getThumbLeft() {
  21456. if (!thumb.value)
  21457. return 0;
  21458. const el = instance.vnode.el;
  21459. if (props.vertical)
  21460. return 0;
  21461. const hue = props.color.get("hue");
  21462. if (!el)
  21463. return 0;
  21464. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  21465. }
  21466. function getThumbTop() {
  21467. if (!thumb.value)
  21468. return 0;
  21469. const el = instance.vnode.el;
  21470. if (!props.vertical)
  21471. return 0;
  21472. const hue = props.color.get("hue");
  21473. if (!el)
  21474. return 0;
  21475. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  21476. }
  21477. function update() {
  21478. thumbLeft.value = getThumbLeft();
  21479. thumbTop.value = getThumbTop();
  21480. }
  21481. vue.onMounted(() => {
  21482. if (!bar.value || !thumb.value)
  21483. return;
  21484. const dragConfig = {
  21485. drag: (event) => {
  21486. handleDrag(event);
  21487. },
  21488. end: (event) => {
  21489. handleDrag(event);
  21490. }
  21491. };
  21492. draggable(bar.value, dragConfig);
  21493. draggable(thumb.value, dragConfig);
  21494. update();
  21495. });
  21496. return {
  21497. bar,
  21498. thumb,
  21499. thumbLeft,
  21500. thumbTop,
  21501. hueValue,
  21502. handleClick,
  21503. update,
  21504. ns
  21505. };
  21506. }
  21507. });
  21508. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  21509. return vue.openBlock(), vue.createElementBlock("div", {
  21510. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  21511. }, [
  21512. vue.createElementVNode("div", {
  21513. ref: "bar",
  21514. class: vue.normalizeClass(_ctx.ns.e("bar")),
  21515. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  21516. }, null, 2),
  21517. vue.createElementVNode("div", {
  21518. ref: "thumb",
  21519. class: vue.normalizeClass(_ctx.ns.e("thumb")),
  21520. style: vue.normalizeStyle({
  21521. left: _ctx.thumbLeft + "px",
  21522. top: _ctx.thumbTop + "px"
  21523. })
  21524. }, null, 6)
  21525. ], 2);
  21526. }
  21527. var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["render", _sfc_render$s], ["__file", "hue-slider.vue"]]);
  21528. const colorPickerProps = buildProps({
  21529. modelValue: String,
  21530. id: String,
  21531. showAlpha: Boolean,
  21532. colorFormat: String,
  21533. disabled: Boolean,
  21534. size: useSizeProp,
  21535. popperClass: {
  21536. type: String,
  21537. default: ""
  21538. },
  21539. label: {
  21540. type: String,
  21541. default: void 0
  21542. },
  21543. tabindex: {
  21544. type: [String, Number],
  21545. default: 0
  21546. },
  21547. predefine: {
  21548. type: definePropType(Array)
  21549. },
  21550. validateEvent: {
  21551. type: Boolean,
  21552. default: true
  21553. }
  21554. });
  21555. const colorPickerEmits = {
  21556. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val),
  21557. [CHANGE_EVENT]: (val) => isString(val) || isNil(val),
  21558. activeChange: (val) => isString(val) || isNil(val)
  21559. };
  21560. const colorPickerContextKey = Symbol("colorPickerContextKey");
  21561. const hsv2hsl = function(hue, sat, val) {
  21562. return [
  21563. hue,
  21564. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  21565. hue / 2
  21566. ];
  21567. };
  21568. const isOnePointZero = function(n) {
  21569. return typeof n === "string" && n.includes(".") && Number.parseFloat(n) === 1;
  21570. };
  21571. const isPercentage = function(n) {
  21572. return typeof n === "string" && n.includes("%");
  21573. };
  21574. const bound01 = function(value, max) {
  21575. if (isOnePointZero(value))
  21576. value = "100%";
  21577. const processPercent = isPercentage(value);
  21578. value = Math.min(max, Math.max(0, Number.parseFloat(`${value}`)));
  21579. if (processPercent) {
  21580. value = Number.parseInt(`${value * max}`, 10) / 100;
  21581. }
  21582. if (Math.abs(value - max) < 1e-6) {
  21583. return 1;
  21584. }
  21585. return value % max / Number.parseFloat(max);
  21586. };
  21587. const INT_HEX_MAP = {
  21588. 10: "A",
  21589. 11: "B",
  21590. 12: "C",
  21591. 13: "D",
  21592. 14: "E",
  21593. 15: "F"
  21594. };
  21595. const hexOne = (value) => {
  21596. value = Math.min(Math.round(value), 255);
  21597. const high = Math.floor(value / 16);
  21598. const low = value % 16;
  21599. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  21600. };
  21601. const toHex = function({ r, g, b }) {
  21602. if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b))
  21603. return "";
  21604. return `#${hexOne(r)}${hexOne(g)}${hexOne(b)}`;
  21605. };
  21606. const HEX_INT_MAP = {
  21607. A: 10,
  21608. B: 11,
  21609. C: 12,
  21610. D: 13,
  21611. E: 14,
  21612. F: 15
  21613. };
  21614. const parseHexChannel = function(hex) {
  21615. if (hex.length === 2) {
  21616. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  21617. }
  21618. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  21619. };
  21620. const hsl2hsv = function(hue, sat, light) {
  21621. sat = sat / 100;
  21622. light = light / 100;
  21623. let smin = sat;
  21624. const lmin = Math.max(light, 0.01);
  21625. light *= 2;
  21626. sat *= light <= 1 ? light : 2 - light;
  21627. smin *= lmin <= 1 ? lmin : 2 - lmin;
  21628. const v = (light + sat) / 2;
  21629. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  21630. return {
  21631. h: hue,
  21632. s: sv * 100,
  21633. v: v * 100
  21634. };
  21635. };
  21636. const rgb2hsv = (r, g, b) => {
  21637. r = bound01(r, 255);
  21638. g = bound01(g, 255);
  21639. b = bound01(b, 255);
  21640. const max = Math.max(r, g, b);
  21641. const min = Math.min(r, g, b);
  21642. let h;
  21643. const v = max;
  21644. const d = max - min;
  21645. const s = max === 0 ? 0 : d / max;
  21646. if (max === min) {
  21647. h = 0;
  21648. } else {
  21649. switch (max) {
  21650. case r: {
  21651. h = (g - b) / d + (g < b ? 6 : 0);
  21652. break;
  21653. }
  21654. case g: {
  21655. h = (b - r) / d + 2;
  21656. break;
  21657. }
  21658. case b: {
  21659. h = (r - g) / d + 4;
  21660. break;
  21661. }
  21662. }
  21663. h /= 6;
  21664. }
  21665. return { h: h * 360, s: s * 100, v: v * 100 };
  21666. };
  21667. const hsv2rgb = function(h, s, v) {
  21668. h = bound01(h, 360) * 6;
  21669. s = bound01(s, 100);
  21670. v = bound01(v, 100);
  21671. const i = Math.floor(h);
  21672. const f = h - i;
  21673. const p = v * (1 - s);
  21674. const q = v * (1 - f * s);
  21675. const t = v * (1 - (1 - f) * s);
  21676. const mod = i % 6;
  21677. const r = [v, q, p, p, t, v][mod];
  21678. const g = [t, v, v, q, p, p][mod];
  21679. const b = [p, p, t, v, v, q][mod];
  21680. return {
  21681. r: Math.round(r * 255),
  21682. g: Math.round(g * 255),
  21683. b: Math.round(b * 255)
  21684. };
  21685. };
  21686. class Color {
  21687. constructor(options = {}) {
  21688. this._hue = 0;
  21689. this._saturation = 100;
  21690. this._value = 100;
  21691. this._alpha = 100;
  21692. this.enableAlpha = false;
  21693. this.format = "hex";
  21694. this.value = "";
  21695. for (const option in options) {
  21696. if (hasOwn(options, option)) {
  21697. this[option] = options[option];
  21698. }
  21699. }
  21700. if (options.value) {
  21701. this.fromString(options.value);
  21702. } else {
  21703. this.doOnChange();
  21704. }
  21705. }
  21706. set(prop, value) {
  21707. if (arguments.length === 1 && typeof prop === "object") {
  21708. for (const p in prop) {
  21709. if (hasOwn(prop, p)) {
  21710. this.set(p, prop[p]);
  21711. }
  21712. }
  21713. return;
  21714. }
  21715. this[`_${prop}`] = value;
  21716. this.doOnChange();
  21717. }
  21718. get(prop) {
  21719. if (prop === "alpha") {
  21720. return Math.floor(this[`_${prop}`]);
  21721. }
  21722. return this[`_${prop}`];
  21723. }
  21724. toRgb() {
  21725. return hsv2rgb(this._hue, this._saturation, this._value);
  21726. }
  21727. fromString(value) {
  21728. if (!value) {
  21729. this._hue = 0;
  21730. this._saturation = 100;
  21731. this._value = 100;
  21732. this.doOnChange();
  21733. return;
  21734. }
  21735. const fromHSV = (h, s, v) => {
  21736. this._hue = Math.max(0, Math.min(360, h));
  21737. this._saturation = Math.max(0, Math.min(100, s));
  21738. this._value = Math.max(0, Math.min(100, v));
  21739. this.doOnChange();
  21740. };
  21741. if (value.includes("hsl")) {
  21742. 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));
  21743. if (parts.length === 4) {
  21744. this._alpha = Number.parseFloat(parts[3]) * 100;
  21745. } else if (parts.length === 3) {
  21746. this._alpha = 100;
  21747. }
  21748. if (parts.length >= 3) {
  21749. const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  21750. fromHSV(h, s, v);
  21751. }
  21752. } else if (value.includes("hsv")) {
  21753. 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));
  21754. if (parts.length === 4) {
  21755. this._alpha = Number.parseFloat(parts[3]) * 100;
  21756. } else if (parts.length === 3) {
  21757. this._alpha = 100;
  21758. }
  21759. if (parts.length >= 3) {
  21760. fromHSV(parts[0], parts[1], parts[2]);
  21761. }
  21762. } else if (value.includes("rgb")) {
  21763. 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));
  21764. if (parts.length === 4) {
  21765. this._alpha = Number.parseFloat(parts[3]) * 100;
  21766. } else if (parts.length === 3) {
  21767. this._alpha = 100;
  21768. }
  21769. if (parts.length >= 3) {
  21770. const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  21771. fromHSV(h, s, v);
  21772. }
  21773. } else if (value.includes("#")) {
  21774. const hex = value.replace("#", "").trim();
  21775. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  21776. return;
  21777. let r, g, b;
  21778. if (hex.length === 3) {
  21779. r = parseHexChannel(hex[0] + hex[0]);
  21780. g = parseHexChannel(hex[1] + hex[1]);
  21781. b = parseHexChannel(hex[2] + hex[2]);
  21782. } else if (hex.length === 6 || hex.length === 8) {
  21783. r = parseHexChannel(hex.slice(0, 2));
  21784. g = parseHexChannel(hex.slice(2, 4));
  21785. b = parseHexChannel(hex.slice(4, 6));
  21786. }
  21787. if (hex.length === 8) {
  21788. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  21789. } else if (hex.length === 3 || hex.length === 6) {
  21790. this._alpha = 100;
  21791. }
  21792. const { h, s, v } = rgb2hsv(r, g, b);
  21793. fromHSV(h, s, v);
  21794. }
  21795. }
  21796. compare(color) {
  21797. 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;
  21798. }
  21799. doOnChange() {
  21800. const { _hue, _saturation, _value, _alpha, format } = this;
  21801. if (this.enableAlpha) {
  21802. switch (format) {
  21803. case "hsl": {
  21804. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  21805. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  21806. break;
  21807. }
  21808. case "hsv": {
  21809. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  21810. break;
  21811. }
  21812. case "hex": {
  21813. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  21814. break;
  21815. }
  21816. default: {
  21817. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  21818. this.value = `rgba(${r}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  21819. }
  21820. }
  21821. } else {
  21822. switch (format) {
  21823. case "hsl": {
  21824. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  21825. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  21826. break;
  21827. }
  21828. case "hsv": {
  21829. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  21830. break;
  21831. }
  21832. case "rgb": {
  21833. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  21834. this.value = `rgb(${r}, ${g}, ${b})`;
  21835. break;
  21836. }
  21837. default: {
  21838. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  21839. }
  21840. }
  21841. }
  21842. }
  21843. }
  21844. const _sfc_main$1t = vue.defineComponent({
  21845. props: {
  21846. colors: {
  21847. type: Array,
  21848. required: true
  21849. },
  21850. color: {
  21851. type: Object,
  21852. required: true
  21853. }
  21854. },
  21855. setup(props) {
  21856. const ns = useNamespace("color-predefine");
  21857. const { currentColor } = vue.inject(colorPickerContextKey);
  21858. const rgbaColors = vue.ref(parseColors(props.colors, props.color));
  21859. vue.watch(() => currentColor.value, (val) => {
  21860. const color = new Color();
  21861. color.fromString(val);
  21862. rgbaColors.value.forEach((item) => {
  21863. item.selected = color.compare(item);
  21864. });
  21865. });
  21866. vue.watchEffect(() => {
  21867. rgbaColors.value = parseColors(props.colors, props.color);
  21868. });
  21869. function handleSelect(index) {
  21870. props.color.fromString(props.colors[index]);
  21871. }
  21872. function parseColors(colors, color) {
  21873. return colors.map((value) => {
  21874. const c = new Color();
  21875. c.enableAlpha = true;
  21876. c.format = "rgba";
  21877. c.fromString(value);
  21878. c.selected = c.value === color.value;
  21879. return c;
  21880. });
  21881. }
  21882. return {
  21883. rgbaColors,
  21884. handleSelect,
  21885. ns
  21886. };
  21887. }
  21888. });
  21889. const _hoisted_1$M = ["onClick"];
  21890. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  21891. return vue.openBlock(), vue.createElementBlock("div", {
  21892. class: vue.normalizeClass(_ctx.ns.b())
  21893. }, [
  21894. vue.createElementVNode("div", {
  21895. class: vue.normalizeClass(_ctx.ns.e("colors"))
  21896. }, [
  21897. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rgbaColors, (item, index) => {
  21898. return vue.openBlock(), vue.createElementBlock("div", {
  21899. key: _ctx.colors[index],
  21900. class: vue.normalizeClass([
  21901. _ctx.ns.e("color-selector"),
  21902. _ctx.ns.is("alpha", item._alpha < 100),
  21903. { selected: item.selected }
  21904. ]),
  21905. onClick: ($event) => _ctx.handleSelect(index)
  21906. }, [
  21907. vue.createElementVNode("div", {
  21908. style: vue.normalizeStyle({ backgroundColor: item.value })
  21909. }, null, 4)
  21910. ], 10, _hoisted_1$M);
  21911. }), 128))
  21912. ], 2)
  21913. ], 2);
  21914. }
  21915. var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["render", _sfc_render$r], ["__file", "predefine.vue"]]);
  21916. const _sfc_main$1s = vue.defineComponent({
  21917. name: "ElSlPanel",
  21918. props: {
  21919. color: {
  21920. type: Object,
  21921. required: true
  21922. }
  21923. },
  21924. setup(props) {
  21925. const ns = useNamespace("color-svpanel");
  21926. const instance = vue.getCurrentInstance();
  21927. const cursorTop = vue.ref(0);
  21928. const cursorLeft = vue.ref(0);
  21929. const background = vue.ref("hsl(0, 100%, 50%)");
  21930. const colorValue = vue.computed(() => {
  21931. const hue = props.color.get("hue");
  21932. const value = props.color.get("value");
  21933. return { hue, value };
  21934. });
  21935. function update() {
  21936. const saturation = props.color.get("saturation");
  21937. const value = props.color.get("value");
  21938. const el = instance.vnode.el;
  21939. const { clientWidth: width, clientHeight: height } = el;
  21940. cursorLeft.value = saturation * width / 100;
  21941. cursorTop.value = (100 - value) * height / 100;
  21942. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  21943. }
  21944. function handleDrag(event) {
  21945. const el = instance.vnode.el;
  21946. const rect = el.getBoundingClientRect();
  21947. const { clientX, clientY } = getClientXY(event);
  21948. let left = clientX - rect.left;
  21949. let top = clientY - rect.top;
  21950. left = Math.max(0, left);
  21951. left = Math.min(left, rect.width);
  21952. top = Math.max(0, top);
  21953. top = Math.min(top, rect.height);
  21954. cursorLeft.value = left;
  21955. cursorTop.value = top;
  21956. props.color.set({
  21957. saturation: left / rect.width * 100,
  21958. value: 100 - top / rect.height * 100
  21959. });
  21960. }
  21961. vue.watch(() => colorValue.value, () => {
  21962. update();
  21963. });
  21964. vue.onMounted(() => {
  21965. draggable(instance.vnode.el, {
  21966. drag: (event) => {
  21967. handleDrag(event);
  21968. },
  21969. end: (event) => {
  21970. handleDrag(event);
  21971. }
  21972. });
  21973. update();
  21974. });
  21975. return {
  21976. cursorTop,
  21977. cursorLeft,
  21978. background,
  21979. colorValue,
  21980. handleDrag,
  21981. update,
  21982. ns
  21983. };
  21984. }
  21985. });
  21986. const _hoisted_1$L = /* @__PURE__ */ vue.createElementVNode("div", null, null, -1);
  21987. const _hoisted_2$u = [
  21988. _hoisted_1$L
  21989. ];
  21990. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  21991. return vue.openBlock(), vue.createElementBlock("div", {
  21992. class: vue.normalizeClass(_ctx.ns.b()),
  21993. style: vue.normalizeStyle({
  21994. backgroundColor: _ctx.background
  21995. })
  21996. }, [
  21997. vue.createElementVNode("div", {
  21998. class: vue.normalizeClass(_ctx.ns.e("white"))
  21999. }, null, 2),
  22000. vue.createElementVNode("div", {
  22001. class: vue.normalizeClass(_ctx.ns.e("black"))
  22002. }, null, 2),
  22003. vue.createElementVNode("div", {
  22004. class: vue.normalizeClass(_ctx.ns.e("cursor")),
  22005. style: vue.normalizeStyle({
  22006. top: _ctx.cursorTop + "px",
  22007. left: _ctx.cursorLeft + "px"
  22008. })
  22009. }, _hoisted_2$u, 6)
  22010. ], 6);
  22011. }
  22012. var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["render", _sfc_render$q], ["__file", "sv-panel.vue"]]);
  22013. const _hoisted_1$K = ["id", "aria-label", "aria-labelledby", "aria-description", "tabindex", "onKeydown"];
  22014. const __default__$W = vue.defineComponent({
  22015. name: "ElColorPicker"
  22016. });
  22017. const _sfc_main$1r = /* @__PURE__ */ vue.defineComponent({
  22018. ...__default__$W,
  22019. props: colorPickerProps,
  22020. emits: colorPickerEmits,
  22021. setup(__props, { expose, emit }) {
  22022. const props = __props;
  22023. const { t } = useLocale();
  22024. const ns = useNamespace("color");
  22025. const { formItem } = useFormItem();
  22026. const colorSize = useSize();
  22027. const colorDisabled = useDisabled();
  22028. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  22029. formItemContext: formItem
  22030. });
  22031. const hue = vue.ref();
  22032. const sv = vue.ref();
  22033. const alpha = vue.ref();
  22034. const popper = vue.ref();
  22035. let shouldActiveChange = true;
  22036. const color = vue.reactive(new Color({
  22037. enableAlpha: props.showAlpha,
  22038. format: props.colorFormat || "",
  22039. value: props.modelValue
  22040. }));
  22041. const showPicker = vue.ref(false);
  22042. const showPanelColor = vue.ref(false);
  22043. const customInput = vue.ref("");
  22044. const displayedColor = vue.computed(() => {
  22045. if (!props.modelValue && !showPanelColor.value) {
  22046. return "transparent";
  22047. }
  22048. return displayedRgb(color, props.showAlpha);
  22049. });
  22050. const currentColor = vue.computed(() => {
  22051. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  22052. });
  22053. const buttonAriaLabel = vue.computed(() => {
  22054. return !isLabeledByFormItem.value ? props.label || t("el.colorpicker.defaultLabel") : void 0;
  22055. });
  22056. const buttonAriaLabelledby = vue.computed(() => {
  22057. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  22058. });
  22059. function displayedRgb(color2, showAlpha) {
  22060. if (!(color2 instanceof Color)) {
  22061. throw new TypeError("color should be instance of _color Class");
  22062. }
  22063. const { r, g, b } = color2.toRgb();
  22064. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`;
  22065. }
  22066. function setShowPicker(value) {
  22067. showPicker.value = value;
  22068. }
  22069. const debounceSetShowPicker = debounce(setShowPicker, 100);
  22070. function hide() {
  22071. debounceSetShowPicker(false);
  22072. resetColor();
  22073. }
  22074. function resetColor() {
  22075. vue.nextTick(() => {
  22076. if (props.modelValue) {
  22077. color.fromString(props.modelValue);
  22078. } else {
  22079. color.value = "";
  22080. vue.nextTick(() => {
  22081. showPanelColor.value = false;
  22082. });
  22083. }
  22084. });
  22085. }
  22086. function handleTrigger() {
  22087. if (colorDisabled.value)
  22088. return;
  22089. debounceSetShowPicker(!showPicker.value);
  22090. }
  22091. function handleConfirm() {
  22092. color.fromString(customInput.value);
  22093. }
  22094. function confirmValue() {
  22095. const value = color.value;
  22096. emit(UPDATE_MODEL_EVENT, value);
  22097. emit("change", value);
  22098. if (props.validateEvent) {
  22099. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  22100. }
  22101. debounceSetShowPicker(false);
  22102. vue.nextTick(() => {
  22103. const newColor = new Color({
  22104. enableAlpha: props.showAlpha,
  22105. format: props.colorFormat || "",
  22106. value: props.modelValue
  22107. });
  22108. if (!color.compare(newColor)) {
  22109. resetColor();
  22110. }
  22111. });
  22112. }
  22113. function clear() {
  22114. debounceSetShowPicker(false);
  22115. emit(UPDATE_MODEL_EVENT, null);
  22116. emit("change", null);
  22117. if (props.modelValue !== null && props.validateEvent) {
  22118. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  22119. }
  22120. resetColor();
  22121. }
  22122. vue.onMounted(() => {
  22123. if (props.modelValue) {
  22124. customInput.value = currentColor.value;
  22125. }
  22126. });
  22127. vue.watch(() => props.modelValue, (newVal) => {
  22128. if (!newVal) {
  22129. showPanelColor.value = false;
  22130. } else if (newVal && newVal !== color.value) {
  22131. shouldActiveChange = false;
  22132. color.fromString(newVal);
  22133. }
  22134. });
  22135. vue.watch(() => currentColor.value, (val) => {
  22136. customInput.value = val;
  22137. shouldActiveChange && emit("activeChange", val);
  22138. shouldActiveChange = true;
  22139. });
  22140. vue.watch(() => color.value, () => {
  22141. if (!props.modelValue && !showPanelColor.value) {
  22142. showPanelColor.value = true;
  22143. }
  22144. });
  22145. vue.watch(() => showPicker.value, () => {
  22146. vue.nextTick(() => {
  22147. var _a, _b, _c;
  22148. (_a = hue.value) == null ? void 0 : _a.update();
  22149. (_b = sv.value) == null ? void 0 : _b.update();
  22150. (_c = alpha.value) == null ? void 0 : _c.update();
  22151. });
  22152. });
  22153. vue.provide(colorPickerContextKey, {
  22154. currentColor
  22155. });
  22156. expose({
  22157. color
  22158. });
  22159. return (_ctx, _cache) => {
  22160. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  22161. ref_key: "popper",
  22162. ref: popper,
  22163. visible: showPicker.value,
  22164. "show-arrow": false,
  22165. "fallback-placements": ["bottom", "top", "right", "left"],
  22166. offset: 0,
  22167. "gpu-acceleration": false,
  22168. "popper-class": [vue.unref(ns).be("picker", "panel"), vue.unref(ns).b("dropdown"), _ctx.popperClass],
  22169. "stop-popper-mouse-event": false,
  22170. effect: "light",
  22171. trigger: "click",
  22172. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  22173. persistent: ""
  22174. }, {
  22175. content: vue.withCtx(() => [
  22176. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", null, [
  22177. vue.createElementVNode("div", {
  22178. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "main-wrapper"))
  22179. }, [
  22180. vue.createVNode(HueSlider, {
  22181. ref_key: "hue",
  22182. ref: hue,
  22183. class: "hue-slider",
  22184. color: vue.unref(color),
  22185. vertical: ""
  22186. }, null, 8, ["color"]),
  22187. vue.createVNode(SvPanel, {
  22188. ref: "svPanel",
  22189. color: vue.unref(color)
  22190. }, null, 8, ["color"])
  22191. ], 2),
  22192. _ctx.showAlpha ? (vue.openBlock(), vue.createBlock(AlphaSlider, {
  22193. key: 0,
  22194. ref_key: "alpha",
  22195. ref: alpha,
  22196. color: vue.unref(color)
  22197. }, null, 8, ["color"])) : vue.createCommentVNode("v-if", true),
  22198. _ctx.predefine ? (vue.openBlock(), vue.createBlock(Predefine, {
  22199. key: 1,
  22200. ref: "predefine",
  22201. color: vue.unref(color),
  22202. colors: _ctx.predefine
  22203. }, null, 8, ["color", "colors"])) : vue.createCommentVNode("v-if", true),
  22204. vue.createElementVNode("div", {
  22205. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btns"))
  22206. }, [
  22207. vue.createElementVNode("span", {
  22208. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "value"))
  22209. }, [
  22210. vue.createVNode(vue.unref(ElInput), {
  22211. modelValue: customInput.value,
  22212. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
  22213. "validate-event": false,
  22214. size: "small",
  22215. onKeyup: vue.withKeys(handleConfirm, ["enter"]),
  22216. onBlur: handleConfirm
  22217. }, null, 8, ["modelValue", "onKeyup"])
  22218. ], 2),
  22219. vue.createVNode(vue.unref(ElButton), {
  22220. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "link-btn")),
  22221. text: "",
  22222. size: "small",
  22223. onClick: clear
  22224. }, {
  22225. default: vue.withCtx(() => [
  22226. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.clear")), 1)
  22227. ]),
  22228. _: 1
  22229. }, 8, ["class"]),
  22230. vue.createVNode(vue.unref(ElButton), {
  22231. plain: "",
  22232. size: "small",
  22233. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btn")),
  22234. onClick: confirmValue
  22235. }, {
  22236. default: vue.withCtx(() => [
  22237. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.confirm")), 1)
  22238. ]),
  22239. _: 1
  22240. }, 8, ["class"])
  22241. ], 2)
  22242. ])), [
  22243. [vue.unref(ClickOutside), hide]
  22244. ])
  22245. ]),
  22246. default: vue.withCtx(() => [
  22247. vue.createElementVNode("div", {
  22248. id: vue.unref(buttonId),
  22249. class: vue.normalizeClass([
  22250. vue.unref(ns).b("picker"),
  22251. vue.unref(ns).is("disabled", vue.unref(colorDisabled)),
  22252. vue.unref(ns).bm("picker", vue.unref(colorSize))
  22253. ]),
  22254. role: "button",
  22255. "aria-label": vue.unref(buttonAriaLabel),
  22256. "aria-labelledby": vue.unref(buttonAriaLabelledby),
  22257. "aria-description": vue.unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  22258. tabindex: _ctx.tabindex,
  22259. onKeydown: vue.withKeys(handleTrigger, ["enter"])
  22260. }, [
  22261. vue.unref(colorDisabled) ? (vue.openBlock(), vue.createElementBlock("div", {
  22262. key: 0,
  22263. class: vue.normalizeClass(vue.unref(ns).be("picker", "mask"))
  22264. }, null, 2)) : vue.createCommentVNode("v-if", true),
  22265. vue.createElementVNode("div", {
  22266. class: vue.normalizeClass(vue.unref(ns).be("picker", "trigger")),
  22267. onClick: handleTrigger
  22268. }, [
  22269. vue.createElementVNode("span", {
  22270. class: vue.normalizeClass([vue.unref(ns).be("picker", "color"), vue.unref(ns).is("alpha", _ctx.showAlpha)])
  22271. }, [
  22272. vue.createElementVNode("span", {
  22273. class: vue.normalizeClass(vue.unref(ns).be("picker", "color-inner")),
  22274. style: vue.normalizeStyle({
  22275. backgroundColor: vue.unref(displayedColor)
  22276. })
  22277. }, [
  22278. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  22279. class: vue.normalizeClass([vue.unref(ns).be("picker", "icon"), vue.unref(ns).is("icon-arrow-down")])
  22280. }, {
  22281. default: vue.withCtx(() => [
  22282. vue.createVNode(vue.unref(arrow_down_default))
  22283. ]),
  22284. _: 1
  22285. }, 8, ["class"]), [
  22286. [vue.vShow, _ctx.modelValue || showPanelColor.value]
  22287. ]),
  22288. !_ctx.modelValue && !showPanelColor.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22289. key: 0,
  22290. class: vue.normalizeClass([vue.unref(ns).be("picker", "empty"), vue.unref(ns).is("icon-close")])
  22291. }, {
  22292. default: vue.withCtx(() => [
  22293. vue.createVNode(vue.unref(close_default))
  22294. ]),
  22295. _: 1
  22296. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  22297. ], 6)
  22298. ], 2)
  22299. ], 2)
  22300. ], 42, _hoisted_1$K)
  22301. ]),
  22302. _: 1
  22303. }, 8, ["visible", "popper-class", "transition"]);
  22304. };
  22305. }
  22306. });
  22307. var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "color-picker.vue"]]);
  22308. const ElColorPicker = withInstall(ColorPicker);
  22309. const messageConfig = {};
  22310. const configProviderProps = buildProps({
  22311. a11y: {
  22312. type: Boolean,
  22313. default: true
  22314. },
  22315. locale: {
  22316. type: definePropType(Object)
  22317. },
  22318. size: useSizeProp,
  22319. button: {
  22320. type: definePropType(Object)
  22321. },
  22322. experimentalFeatures: {
  22323. type: definePropType(Object)
  22324. },
  22325. keyboardNavigation: {
  22326. type: Boolean,
  22327. default: true
  22328. },
  22329. message: {
  22330. type: definePropType(Object)
  22331. },
  22332. zIndex: Number,
  22333. namespace: {
  22334. type: String,
  22335. default: "el"
  22336. }
  22337. });
  22338. const ConfigProvider = vue.defineComponent({
  22339. name: "ElConfigProvider",
  22340. props: configProviderProps,
  22341. setup(props, { slots }) {
  22342. vue.watch(() => props.message, (val) => {
  22343. Object.assign(messageConfig, val != null ? val : {});
  22344. }, { immediate: true, deep: true });
  22345. const config = provideGlobalConfig(props);
  22346. return () => vue.renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  22347. }
  22348. });
  22349. const ElConfigProvider = withInstall(ConfigProvider);
  22350. const __default__$V = vue.defineComponent({
  22351. name: "ElContainer"
  22352. });
  22353. const _sfc_main$1q = /* @__PURE__ */ vue.defineComponent({
  22354. ...__default__$V,
  22355. props: {
  22356. direction: {
  22357. type: String
  22358. }
  22359. },
  22360. setup(__props) {
  22361. const props = __props;
  22362. const slots = vue.useSlots();
  22363. const ns = useNamespace("container");
  22364. const isVertical = vue.computed(() => {
  22365. if (props.direction === "vertical") {
  22366. return true;
  22367. } else if (props.direction === "horizontal") {
  22368. return false;
  22369. }
  22370. if (slots && slots.default) {
  22371. const vNodes = slots.default();
  22372. return vNodes.some((vNode) => {
  22373. const tag = vNode.type.name;
  22374. return tag === "ElHeader" || tag === "ElFooter";
  22375. });
  22376. } else {
  22377. return false;
  22378. }
  22379. });
  22380. return (_ctx, _cache) => {
  22381. return vue.openBlock(), vue.createElementBlock("section", {
  22382. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("vertical", vue.unref(isVertical))])
  22383. }, [
  22384. vue.renderSlot(_ctx.$slots, "default")
  22385. ], 2);
  22386. };
  22387. }
  22388. });
  22389. var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "container.vue"]]);
  22390. const __default__$U = vue.defineComponent({
  22391. name: "ElAside"
  22392. });
  22393. const _sfc_main$1p = /* @__PURE__ */ vue.defineComponent({
  22394. ...__default__$U,
  22395. props: {
  22396. width: {
  22397. type: String,
  22398. default: null
  22399. }
  22400. },
  22401. setup(__props) {
  22402. const props = __props;
  22403. const ns = useNamespace("aside");
  22404. const style = vue.computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  22405. return (_ctx, _cache) => {
  22406. return vue.openBlock(), vue.createElementBlock("aside", {
  22407. class: vue.normalizeClass(vue.unref(ns).b()),
  22408. style: vue.normalizeStyle(vue.unref(style))
  22409. }, [
  22410. vue.renderSlot(_ctx.$slots, "default")
  22411. ], 6);
  22412. };
  22413. }
  22414. });
  22415. var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "aside.vue"]]);
  22416. const __default__$T = vue.defineComponent({
  22417. name: "ElFooter"
  22418. });
  22419. const _sfc_main$1o = /* @__PURE__ */ vue.defineComponent({
  22420. ...__default__$T,
  22421. props: {
  22422. height: {
  22423. type: String,
  22424. default: null
  22425. }
  22426. },
  22427. setup(__props) {
  22428. const props = __props;
  22429. const ns = useNamespace("footer");
  22430. const style = vue.computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  22431. return (_ctx, _cache) => {
  22432. return vue.openBlock(), vue.createElementBlock("footer", {
  22433. class: vue.normalizeClass(vue.unref(ns).b()),
  22434. style: vue.normalizeStyle(vue.unref(style))
  22435. }, [
  22436. vue.renderSlot(_ctx.$slots, "default")
  22437. ], 6);
  22438. };
  22439. }
  22440. });
  22441. var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "footer.vue"]]);
  22442. const __default__$S = vue.defineComponent({
  22443. name: "ElHeader"
  22444. });
  22445. const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({
  22446. ...__default__$S,
  22447. props: {
  22448. height: {
  22449. type: String,
  22450. default: null
  22451. }
  22452. },
  22453. setup(__props) {
  22454. const props = __props;
  22455. const ns = useNamespace("header");
  22456. const style = vue.computed(() => {
  22457. return props.height ? ns.cssVarBlock({
  22458. height: props.height
  22459. }) : {};
  22460. });
  22461. return (_ctx, _cache) => {
  22462. return vue.openBlock(), vue.createElementBlock("header", {
  22463. class: vue.normalizeClass(vue.unref(ns).b()),
  22464. style: vue.normalizeStyle(vue.unref(style))
  22465. }, [
  22466. vue.renderSlot(_ctx.$slots, "default")
  22467. ], 6);
  22468. };
  22469. }
  22470. });
  22471. var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "header.vue"]]);
  22472. const __default__$R = vue.defineComponent({
  22473. name: "ElMain"
  22474. });
  22475. const _sfc_main$1m = /* @__PURE__ */ vue.defineComponent({
  22476. ...__default__$R,
  22477. setup(__props) {
  22478. const ns = useNamespace("main");
  22479. return (_ctx, _cache) => {
  22480. return vue.openBlock(), vue.createElementBlock("main", {
  22481. class: vue.normalizeClass(vue.unref(ns).b())
  22482. }, [
  22483. vue.renderSlot(_ctx.$slots, "default")
  22484. ], 2);
  22485. };
  22486. }
  22487. });
  22488. var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "main.vue"]]);
  22489. const ElContainer = withInstall(Container, {
  22490. Aside,
  22491. Footer: Footer$2,
  22492. Header: Header$1,
  22493. Main
  22494. });
  22495. const ElAside = withNoopInstall(Aside);
  22496. const ElFooter = withNoopInstall(Footer$2);
  22497. const ElHeader = withNoopInstall(Header$1);
  22498. const ElMain = withNoopInstall(Main);
  22499. var advancedFormat$1 = {exports: {}};
  22500. (function(module, exports) {
  22501. !function(e, t) {
  22502. module.exports = t() ;
  22503. }(commonjsGlobal, function() {
  22504. return function(e, t, r) {
  22505. var n = t.prototype, s = n.format;
  22506. r.en.ordinal = function(e2) {
  22507. var t2 = ["th", "st", "nd", "rd"], r2 = e2 % 100;
  22508. return "[" + e2 + (t2[(r2 - 20) % 10] || t2[r2] || t2[0]) + "]";
  22509. }, n.format = function(e2) {
  22510. var t2 = this, r2 = this.$locale();
  22511. if (!this.isValid())
  22512. return s.bind(this)(e2);
  22513. var n2 = 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) {
  22514. switch (e3) {
  22515. case "Q":
  22516. return Math.ceil((t2.$M + 1) / 3);
  22517. case "Do":
  22518. return r2.ordinal(t2.$D);
  22519. case "gggg":
  22520. return t2.weekYear();
  22521. case "GGGG":
  22522. return t2.isoWeekYear();
  22523. case "wo":
  22524. return r2.ordinal(t2.week(), "W");
  22525. case "w":
  22526. case "ww":
  22527. return n2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  22528. case "W":
  22529. case "WW":
  22530. return n2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  22531. case "k":
  22532. case "kk":
  22533. return n2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  22534. case "X":
  22535. return Math.floor(t2.$d.getTime() / 1e3);
  22536. case "x":
  22537. return t2.$d.getTime();
  22538. case "z":
  22539. return "[" + t2.offsetName() + "]";
  22540. case "zzz":
  22541. return "[" + t2.offsetName("long") + "]";
  22542. default:
  22543. return e3;
  22544. }
  22545. });
  22546. return s.bind(this)(a);
  22547. };
  22548. };
  22549. });
  22550. })(advancedFormat$1);
  22551. var advancedFormat = advancedFormat$1.exports;
  22552. var weekOfYear$1 = {exports: {}};
  22553. (function(module, exports) {
  22554. !function(e, t) {
  22555. module.exports = t() ;
  22556. }(commonjsGlobal, function() {
  22557. var e = "week", t = "year";
  22558. return function(i, n, r) {
  22559. var f = n.prototype;
  22560. f.week = function(i2) {
  22561. if (i2 === void 0 && (i2 = null), i2 !== null)
  22562. return this.add(7 * (i2 - this.week()), "day");
  22563. var n2 = this.$locale().yearStart || 1;
  22564. if (this.month() === 11 && this.date() > 25) {
  22565. var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
  22566. if (f2.isBefore(s))
  22567. return 1;
  22568. }
  22569. var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
  22570. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  22571. }, f.weeks = function(e2) {
  22572. return e2 === void 0 && (e2 = null), this.week(e2);
  22573. };
  22574. };
  22575. });
  22576. })(weekOfYear$1);
  22577. var weekOfYear = weekOfYear$1.exports;
  22578. var weekYear$1 = {exports: {}};
  22579. (function(module, exports) {
  22580. !function(e, t) {
  22581. module.exports = t() ;
  22582. }(commonjsGlobal, function() {
  22583. return function(e, t) {
  22584. t.prototype.weekYear = function() {
  22585. var e2 = this.month(), t2 = this.week(), n = this.year();
  22586. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  22587. };
  22588. };
  22589. });
  22590. })(weekYear$1);
  22591. var weekYear = weekYear$1.exports;
  22592. var dayOfYear$1 = {exports: {}};
  22593. (function(module, exports) {
  22594. !function(e, t) {
  22595. module.exports = t() ;
  22596. }(commonjsGlobal, function() {
  22597. return function(e, t, n) {
  22598. t.prototype.dayOfYear = function(e2) {
  22599. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  22600. return e2 == null ? t2 : this.add(e2 - t2, "day");
  22601. };
  22602. };
  22603. });
  22604. })(dayOfYear$1);
  22605. var dayOfYear = dayOfYear$1.exports;
  22606. var isSameOrAfter$1 = {exports: {}};
  22607. (function(module, exports) {
  22608. !function(e, t) {
  22609. module.exports = t() ;
  22610. }(commonjsGlobal, function() {
  22611. return function(e, t) {
  22612. t.prototype.isSameOrAfter = function(e2, t2) {
  22613. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  22614. };
  22615. };
  22616. });
  22617. })(isSameOrAfter$1);
  22618. var isSameOrAfter = isSameOrAfter$1.exports;
  22619. var isSameOrBefore$1 = {exports: {}};
  22620. (function(module, exports) {
  22621. !function(e, i) {
  22622. module.exports = i() ;
  22623. }(commonjsGlobal, function() {
  22624. return function(e, i) {
  22625. i.prototype.isSameOrBefore = function(e2, i2) {
  22626. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  22627. };
  22628. };
  22629. });
  22630. })(isSameOrBefore$1);
  22631. var isSameOrBefore = isSameOrBefore$1.exports;
  22632. const datePickerProps = buildProps({
  22633. type: {
  22634. type: definePropType(String),
  22635. default: "date"
  22636. }
  22637. });
  22638. const selectionModes = ["date", "dates", "year", "month", "week", "range"];
  22639. const datePickerSharedProps = buildProps({
  22640. disabledDate: {
  22641. type: definePropType(Function)
  22642. },
  22643. date: {
  22644. type: definePropType(Object),
  22645. required: true
  22646. },
  22647. minDate: {
  22648. type: definePropType(Object)
  22649. },
  22650. maxDate: {
  22651. type: definePropType(Object)
  22652. },
  22653. parsedValue: {
  22654. type: definePropType([Object, Array])
  22655. },
  22656. rangeState: {
  22657. type: definePropType(Object),
  22658. default: () => ({
  22659. endDate: null,
  22660. selecting: false
  22661. })
  22662. }
  22663. });
  22664. const panelSharedProps = buildProps({
  22665. type: {
  22666. type: definePropType(String),
  22667. required: true,
  22668. values: datePickTypes
  22669. }
  22670. });
  22671. const panelRangeSharedProps = buildProps({
  22672. unlinkPanels: Boolean,
  22673. parsedValue: {
  22674. type: definePropType(Array)
  22675. }
  22676. });
  22677. const selectionModeWithDefault = (mode) => {
  22678. return {
  22679. type: String,
  22680. values: selectionModes,
  22681. default: mode
  22682. };
  22683. };
  22684. const panelDatePickProps = buildProps({
  22685. ...panelSharedProps,
  22686. parsedValue: {
  22687. type: definePropType([Object, Array])
  22688. },
  22689. visible: {
  22690. type: Boolean
  22691. },
  22692. format: {
  22693. type: String,
  22694. default: ""
  22695. }
  22696. });
  22697. const basicDateTableProps = buildProps({
  22698. ...datePickerSharedProps,
  22699. cellClassName: {
  22700. type: definePropType(Function)
  22701. },
  22702. showWeekNumber: Boolean,
  22703. selectionMode: selectionModeWithDefault("date")
  22704. });
  22705. const isValidRange = (range) => {
  22706. if (!isArray(range))
  22707. return false;
  22708. const [left, right] = range;
  22709. return dayjs.isDayjs(left) && dayjs.isDayjs(right) && left.isSameOrBefore(right);
  22710. };
  22711. const getDefaultValue = (defaultValue, { lang, unit, unlinkPanels }) => {
  22712. let start;
  22713. if (isArray(defaultValue)) {
  22714. let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
  22715. if (!unlinkPanels) {
  22716. right = left.add(1, unit);
  22717. }
  22718. return [left, right];
  22719. } else if (defaultValue) {
  22720. start = dayjs(defaultValue);
  22721. } else {
  22722. start = dayjs();
  22723. }
  22724. start = start.locale(lang);
  22725. return [start, start.add(1, unit)];
  22726. };
  22727. const buildPickerTable = (dimension, rows, {
  22728. columnIndexOffset,
  22729. startDate,
  22730. nextEndDate,
  22731. now,
  22732. unit,
  22733. relativeDateGetter,
  22734. setCellMetadata,
  22735. setRowMetadata
  22736. }) => {
  22737. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  22738. const row = rows[rowIndex];
  22739. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  22740. let cell = row[columnIndex + columnIndexOffset];
  22741. if (!cell) {
  22742. cell = {
  22743. row: rowIndex,
  22744. column: columnIndex,
  22745. type: "normal",
  22746. inRange: false,
  22747. start: false,
  22748. end: false
  22749. };
  22750. }
  22751. const index = rowIndex * dimension.column + columnIndex;
  22752. const nextStartDate = relativeDateGetter(index);
  22753. cell.dayjs = nextStartDate;
  22754. cell.date = nextStartDate.toDate();
  22755. cell.timestamp = nextStartDate.valueOf();
  22756. cell.type = "normal";
  22757. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  22758. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  22759. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  22760. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  22761. } else {
  22762. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  22763. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  22764. }
  22765. const isToday = nextStartDate.isSame(now, unit);
  22766. if (isToday) {
  22767. cell.type = "today";
  22768. }
  22769. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  22770. row[columnIndex + columnIndexOffset] = cell;
  22771. }
  22772. setRowMetadata == null ? void 0 : setRowMetadata(row);
  22773. }
  22774. };
  22775. const basicCellProps = buildProps({
  22776. cell: {
  22777. type: definePropType(Object)
  22778. }
  22779. });
  22780. var ElDatePickerCell = vue.defineComponent({
  22781. name: "ElDatePickerCell",
  22782. props: basicCellProps,
  22783. setup(props) {
  22784. const ns = useNamespace("date-table-cell");
  22785. const {
  22786. slots
  22787. } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  22788. return () => {
  22789. const {
  22790. cell
  22791. } = props;
  22792. if (slots.default) {
  22793. const list = slots.default(cell).filter((item) => {
  22794. return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)";
  22795. });
  22796. if (list.length) {
  22797. return list;
  22798. }
  22799. }
  22800. return vue.createVNode("div", {
  22801. "class": ns.b()
  22802. }, [vue.createVNode("span", {
  22803. "class": ns.e("text")
  22804. }, [cell == null ? void 0 : cell.text])]);
  22805. };
  22806. }
  22807. });
  22808. const _hoisted_1$J = ["aria-label"];
  22809. const _hoisted_2$t = {
  22810. key: 0,
  22811. scope: "col"
  22812. };
  22813. const _hoisted_3$f = ["aria-label"];
  22814. const _hoisted_4$b = ["aria-current", "aria-selected", "tabindex"];
  22815. const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({
  22816. __name: "basic-date-table",
  22817. props: basicDateTableProps,
  22818. emits: ["changerange", "pick", "select"],
  22819. setup(__props, { expose, emit }) {
  22820. const props = __props;
  22821. const ns = useNamespace("date-table");
  22822. const { t, lang } = useLocale();
  22823. const tbodyRef = vue.ref();
  22824. const currentCellRef = vue.ref();
  22825. const lastRow = vue.ref();
  22826. const lastColumn = vue.ref();
  22827. const tableRows = vue.ref([[], [], [], [], [], []]);
  22828. let focusWithClick = false;
  22829. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  22830. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  22831. const offsetDay = vue.computed(() => {
  22832. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  22833. });
  22834. const startDate = vue.computed(() => {
  22835. const startDayOfMonth = props.date.startOf("month");
  22836. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  22837. });
  22838. const WEEKS = vue.computed(() => {
  22839. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  22840. });
  22841. const hasCurrent = vue.computed(() => {
  22842. return flatten(rows.value).some((row) => {
  22843. return row.isCurrent;
  22844. });
  22845. });
  22846. const days = vue.computed(() => {
  22847. const startOfMonth = props.date.startOf("month");
  22848. const startOfMonthDay = startOfMonth.day() || 7;
  22849. const dateCountOfMonth = startOfMonth.daysInMonth();
  22850. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  22851. return {
  22852. startOfMonthDay,
  22853. dateCountOfMonth,
  22854. dateCountOfLastMonth
  22855. };
  22856. });
  22857. const selectedDate = vue.computed(() => {
  22858. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  22859. });
  22860. const setDateText = (cell, {
  22861. count,
  22862. rowIndex,
  22863. columnIndex
  22864. }) => {
  22865. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = vue.unref(days);
  22866. const offset = vue.unref(offsetDay);
  22867. if (rowIndex >= 0 && rowIndex <= 1) {
  22868. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  22869. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  22870. cell.text = count;
  22871. return true;
  22872. } else {
  22873. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  22874. cell.type = "prev-month";
  22875. }
  22876. } else {
  22877. if (count <= dateCountOfMonth) {
  22878. cell.text = count;
  22879. } else {
  22880. cell.text = count - dateCountOfMonth;
  22881. cell.type = "next-month";
  22882. }
  22883. return true;
  22884. }
  22885. return false;
  22886. };
  22887. const setCellMetadata = (cell, {
  22888. columnIndex,
  22889. rowIndex
  22890. }, count) => {
  22891. const { disabledDate, cellClassName } = props;
  22892. const _selectedDate = vue.unref(selectedDate);
  22893. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  22894. const cellDate = cell.dayjs.toDate();
  22895. cell.selected = _selectedDate.find((d) => d.valueOf() === cell.dayjs.valueOf());
  22896. cell.isSelected = !!cell.selected;
  22897. cell.isCurrent = isCurrent(cell);
  22898. cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
  22899. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  22900. return shouldIncrement;
  22901. };
  22902. const setRowMetadata = (row) => {
  22903. if (props.selectionMode === "week") {
  22904. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  22905. const isActive = isWeekActive(row[start + 1]);
  22906. row[start].inRange = isActive;
  22907. row[start].start = isActive;
  22908. row[end].inRange = isActive;
  22909. row[end].end = isActive;
  22910. }
  22911. };
  22912. const rows = vue.computed(() => {
  22913. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  22914. const offset = offsetDay.value;
  22915. const rows_ = tableRows.value;
  22916. const dateUnit = "day";
  22917. let count = 1;
  22918. if (showWeekNumber) {
  22919. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  22920. if (!rows_[rowIndex][0]) {
  22921. rows_[rowIndex][0] = {
  22922. type: "week",
  22923. text: startDate.value.add(rowIndex * 7 + 1, dateUnit).week()
  22924. };
  22925. }
  22926. }
  22927. }
  22928. buildPickerTable({ row: 6, column: 7 }, rows_, {
  22929. startDate: minDate,
  22930. columnIndexOffset: showWeekNumber ? 1 : 0,
  22931. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  22932. now: dayjs().locale(vue.unref(lang)).startOf(dateUnit),
  22933. unit: dateUnit,
  22934. relativeDateGetter: (idx) => startDate.value.add(idx - offset, dateUnit),
  22935. setCellMetadata: (...args) => {
  22936. if (setCellMetadata(...args, count)) {
  22937. count += 1;
  22938. }
  22939. },
  22940. setRowMetadata
  22941. });
  22942. return rows_;
  22943. });
  22944. vue.watch(() => props.date, async () => {
  22945. var _a, _b;
  22946. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  22947. await vue.nextTick();
  22948. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  22949. }
  22950. });
  22951. const focus = async () => {
  22952. var _a;
  22953. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  22954. };
  22955. const isNormalDay = (type = "") => {
  22956. return ["normal", "today"].includes(type);
  22957. };
  22958. const isCurrent = (cell) => {
  22959. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  22960. };
  22961. const cellMatchesDate = (cell, date) => {
  22962. if (!date)
  22963. return false;
  22964. return dayjs(date).locale(lang.value).isSame(props.date.date(Number(cell.text)), "day");
  22965. };
  22966. const getCellClasses = (cell) => {
  22967. const classes = [];
  22968. if (isNormalDay(cell.type) && !cell.disabled) {
  22969. classes.push("available");
  22970. if (cell.type === "today") {
  22971. classes.push("today");
  22972. }
  22973. } else {
  22974. classes.push(cell.type);
  22975. }
  22976. if (isCurrent(cell)) {
  22977. classes.push("current");
  22978. }
  22979. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  22980. classes.push("in-range");
  22981. if (cell.start) {
  22982. classes.push("start-date");
  22983. }
  22984. if (cell.end) {
  22985. classes.push("end-date");
  22986. }
  22987. }
  22988. if (cell.disabled) {
  22989. classes.push("disabled");
  22990. }
  22991. if (cell.selected) {
  22992. classes.push("selected");
  22993. }
  22994. if (cell.customClass) {
  22995. classes.push(cell.customClass);
  22996. }
  22997. return classes.join(" ");
  22998. };
  22999. const getDateOfCell = (row, column) => {
  23000. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - offsetDay.value;
  23001. return startDate.value.add(offsetFromStart, "day");
  23002. };
  23003. const handleMouseMove = (event) => {
  23004. var _a;
  23005. if (!props.rangeState.selecting)
  23006. return;
  23007. let target = event.target;
  23008. if (target.tagName === "SPAN") {
  23009. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  23010. }
  23011. if (target.tagName === "DIV") {
  23012. target = target.parentNode;
  23013. }
  23014. if (target.tagName !== "TD")
  23015. return;
  23016. const row = target.parentNode.rowIndex - 1;
  23017. const column = target.cellIndex;
  23018. if (rows.value[row][column].disabled)
  23019. return;
  23020. if (row !== lastRow.value || column !== lastColumn.value) {
  23021. lastRow.value = row;
  23022. lastColumn.value = column;
  23023. emit("changerange", {
  23024. selecting: true,
  23025. endDate: getDateOfCell(row, column)
  23026. });
  23027. }
  23028. };
  23029. const isSelectedCell = (cell) => {
  23030. return !hasCurrent.value && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  23031. };
  23032. const handleFocus = (event) => {
  23033. if (focusWithClick || hasCurrent.value || props.selectionMode !== "date")
  23034. return;
  23035. handlePickDate(event, true);
  23036. };
  23037. const handleMouseDown = (event) => {
  23038. const target = event.target.closest("td");
  23039. if (!target)
  23040. return;
  23041. focusWithClick = true;
  23042. };
  23043. const handleMouseUp = (event) => {
  23044. const target = event.target.closest("td");
  23045. if (!target)
  23046. return;
  23047. focusWithClick = false;
  23048. };
  23049. const handlePickDate = (event, isKeyboardMovement = false) => {
  23050. const target = event.target.closest("td");
  23051. if (!target)
  23052. return;
  23053. const row = target.parentNode.rowIndex - 1;
  23054. const column = target.cellIndex;
  23055. const cell = rows.value[row][column];
  23056. if (cell.disabled || cell.type === "week")
  23057. return;
  23058. const newDate = getDateOfCell(row, column);
  23059. if (props.selectionMode === "range") {
  23060. if (!props.rangeState.selecting || !props.minDate) {
  23061. emit("pick", { minDate: newDate, maxDate: null });
  23062. emit("select", true);
  23063. } else {
  23064. if (newDate >= props.minDate) {
  23065. emit("pick", { minDate: props.minDate, maxDate: newDate });
  23066. } else {
  23067. emit("pick", { minDate: newDate, maxDate: props.minDate });
  23068. }
  23069. emit("select", false);
  23070. }
  23071. } else if (props.selectionMode === "date") {
  23072. emit("pick", newDate, isKeyboardMovement);
  23073. } else if (props.selectionMode === "week") {
  23074. const weekNumber = newDate.week();
  23075. const value = `${newDate.year()}w${weekNumber}`;
  23076. emit("pick", {
  23077. year: newDate.year(),
  23078. week: weekNumber,
  23079. value,
  23080. date: newDate.startOf("week")
  23081. });
  23082. } else if (props.selectionMode === "dates") {
  23083. const newValue = cell.selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  23084. emit("pick", newValue);
  23085. }
  23086. };
  23087. const isWeekActive = (cell) => {
  23088. if (props.selectionMode !== "week")
  23089. return false;
  23090. let newDate = props.date.startOf("day");
  23091. if (cell.type === "prev-month") {
  23092. newDate = newDate.subtract(1, "month");
  23093. }
  23094. if (cell.type === "next-month") {
  23095. newDate = newDate.add(1, "month");
  23096. }
  23097. newDate = newDate.date(Number.parseInt(cell.text, 10));
  23098. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  23099. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  23100. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  23101. return weekDate.isSame(newDate, "day");
  23102. }
  23103. return false;
  23104. };
  23105. expose({
  23106. focus
  23107. });
  23108. return (_ctx, _cache) => {
  23109. return vue.openBlock(), vue.createElementBlock("table", {
  23110. role: "grid",
  23111. "aria-label": vue.unref(t)("el.datepicker.dateTablePrompt"),
  23112. cellspacing: "0",
  23113. cellpadding: "0",
  23114. class: vue.normalizeClass([vue.unref(ns).b(), { "is-week-mode": _ctx.selectionMode === "week" }]),
  23115. onClick: handlePickDate,
  23116. onMousemove: handleMouseMove,
  23117. onMousedown: handleMouseDown,
  23118. onMouseup: handleMouseUp
  23119. }, [
  23120. vue.createElementVNode("tbody", {
  23121. ref_key: "tbodyRef",
  23122. ref: tbodyRef
  23123. }, [
  23124. vue.createElementVNode("tr", null, [
  23125. _ctx.showWeekNumber ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_2$t, vue.toDisplayString(vue.unref(t)("el.datepicker.week")), 1)) : vue.createCommentVNode("v-if", true),
  23126. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(WEEKS), (week, key) => {
  23127. return vue.openBlock(), vue.createElementBlock("th", {
  23128. key,
  23129. scope: "col",
  23130. "aria-label": vue.unref(t)("el.datepicker.weeksFull." + week)
  23131. }, vue.toDisplayString(vue.unref(t)("el.datepicker.weeks." + week)), 9, _hoisted_3$f);
  23132. }), 128))
  23133. ]),
  23134. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  23135. return vue.openBlock(), vue.createElementBlock("tr", {
  23136. key: rowKey,
  23137. class: vue.normalizeClass([vue.unref(ns).e("row"), { current: isWeekActive(row[1]) }])
  23138. }, [
  23139. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, columnKey) => {
  23140. return vue.openBlock(), vue.createElementBlock("td", {
  23141. key: `${rowKey}.${columnKey}`,
  23142. ref_for: true,
  23143. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  23144. class: vue.normalizeClass(getCellClasses(cell)),
  23145. "aria-current": cell.isCurrent ? "date" : void 0,
  23146. "aria-selected": cell.isCurrent,
  23147. tabindex: isSelectedCell(cell) ? 0 : -1,
  23148. onFocus: handleFocus
  23149. }, [
  23150. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  23151. ], 42, _hoisted_4$b);
  23152. }), 128))
  23153. ], 2);
  23154. }), 128))
  23155. ], 512)
  23156. ], 42, _hoisted_1$J);
  23157. };
  23158. }
  23159. });
  23160. var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["__file", "basic-date-table.vue"]]);
  23161. const basicMonthTableProps = buildProps({
  23162. ...datePickerSharedProps,
  23163. selectionMode: selectionModeWithDefault("month")
  23164. });
  23165. const _hoisted_1$I = ["aria-label"];
  23166. const _hoisted_2$s = ["aria-selected", "aria-label", "tabindex", "onKeydown"];
  23167. const _hoisted_3$e = { class: "cell" };
  23168. const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
  23169. __name: "basic-month-table",
  23170. props: basicMonthTableProps,
  23171. emits: ["changerange", "pick", "select"],
  23172. setup(__props, { expose, emit }) {
  23173. const props = __props;
  23174. const datesInMonth = (year, month, lang2) => {
  23175. const firstDay = dayjs().locale(lang2).startOf("month").month(month).year(year);
  23176. const numOfDays = firstDay.daysInMonth();
  23177. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  23178. };
  23179. const ns = useNamespace("month-table");
  23180. const { t, lang } = useLocale();
  23181. const tbodyRef = vue.ref();
  23182. const currentCellRef = vue.ref();
  23183. const months = vue.ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  23184. const tableRows = vue.ref([
  23185. [],
  23186. [],
  23187. []
  23188. ]);
  23189. const lastRow = vue.ref();
  23190. const lastColumn = vue.ref();
  23191. const rows = vue.computed(() => {
  23192. var _a, _b;
  23193. const rows2 = tableRows.value;
  23194. const now = dayjs().locale(lang.value).startOf("month");
  23195. for (let i = 0; i < 3; i++) {
  23196. const row = rows2[i];
  23197. for (let j = 0; j < 4; j++) {
  23198. const cell = row[j] || (row[j] = {
  23199. row: i,
  23200. column: j,
  23201. type: "normal",
  23202. inRange: false,
  23203. start: false,
  23204. end: false,
  23205. text: -1,
  23206. disabled: false
  23207. });
  23208. cell.type = "normal";
  23209. const index = i * 4 + j;
  23210. const calTime = props.date.startOf("year").month(index);
  23211. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  23212. 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"));
  23213. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  23214. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  23215. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  23216. } else {
  23217. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  23218. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  23219. }
  23220. const isToday = now.isSame(calTime);
  23221. if (isToday) {
  23222. cell.type = "today";
  23223. }
  23224. cell.text = index;
  23225. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
  23226. }
  23227. }
  23228. return rows2;
  23229. });
  23230. const focus = () => {
  23231. var _a;
  23232. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  23233. };
  23234. const getCellStyle = (cell) => {
  23235. const style = {};
  23236. const year = props.date.year();
  23237. const today = new Date();
  23238. const month = cell.text;
  23239. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  23240. style.current = castArray(props.parsedValue).findIndex((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month) >= 0;
  23241. style.today = today.getFullYear() === year && today.getMonth() === month;
  23242. if (cell.inRange) {
  23243. style["in-range"] = true;
  23244. if (cell.start) {
  23245. style["start-date"] = true;
  23246. }
  23247. if (cell.end) {
  23248. style["end-date"] = true;
  23249. }
  23250. }
  23251. return style;
  23252. };
  23253. const isSelectedCell = (cell) => {
  23254. const year = props.date.year();
  23255. const month = cell.text;
  23256. return castArray(props.date).findIndex((date) => date.year() === year && date.month() === month) >= 0;
  23257. };
  23258. const handleMouseMove = (event) => {
  23259. var _a;
  23260. if (!props.rangeState.selecting)
  23261. return;
  23262. let target = event.target;
  23263. if (target.tagName === "A") {
  23264. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  23265. }
  23266. if (target.tagName === "DIV") {
  23267. target = target.parentNode;
  23268. }
  23269. if (target.tagName !== "TD")
  23270. return;
  23271. const row = target.parentNode.rowIndex;
  23272. const column = target.cellIndex;
  23273. if (rows.value[row][column].disabled)
  23274. return;
  23275. if (row !== lastRow.value || column !== lastColumn.value) {
  23276. lastRow.value = row;
  23277. lastColumn.value = column;
  23278. emit("changerange", {
  23279. selecting: true,
  23280. endDate: props.date.startOf("year").month(row * 4 + column)
  23281. });
  23282. }
  23283. };
  23284. const handleMonthTableClick = (event) => {
  23285. var _a;
  23286. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  23287. if ((target == null ? void 0 : target.tagName) !== "TD")
  23288. return;
  23289. if (hasClass(target, "disabled"))
  23290. return;
  23291. const column = target.cellIndex;
  23292. const row = target.parentNode.rowIndex;
  23293. const month = row * 4 + column;
  23294. const newDate = props.date.startOf("year").month(month);
  23295. if (props.selectionMode === "range") {
  23296. if (!props.rangeState.selecting) {
  23297. emit("pick", { minDate: newDate, maxDate: null });
  23298. emit("select", true);
  23299. } else {
  23300. if (props.minDate && newDate >= props.minDate) {
  23301. emit("pick", { minDate: props.minDate, maxDate: newDate });
  23302. } else {
  23303. emit("pick", { minDate: newDate, maxDate: props.minDate });
  23304. }
  23305. emit("select", false);
  23306. }
  23307. } else {
  23308. emit("pick", month);
  23309. }
  23310. };
  23311. vue.watch(() => props.date, async () => {
  23312. var _a, _b;
  23313. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  23314. await vue.nextTick();
  23315. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  23316. }
  23317. });
  23318. expose({
  23319. focus
  23320. });
  23321. return (_ctx, _cache) => {
  23322. return vue.openBlock(), vue.createElementBlock("table", {
  23323. role: "grid",
  23324. "aria-label": vue.unref(t)("el.datepicker.monthTablePrompt"),
  23325. class: vue.normalizeClass(vue.unref(ns).b()),
  23326. onClick: handleMonthTableClick,
  23327. onMousemove: handleMouseMove
  23328. }, [
  23329. vue.createElementVNode("tbody", {
  23330. ref_key: "tbodyRef",
  23331. ref: tbodyRef
  23332. }, [
  23333. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, key) => {
  23334. return vue.openBlock(), vue.createElementBlock("tr", { key }, [
  23335. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key_) => {
  23336. return vue.openBlock(), vue.createElementBlock("td", {
  23337. key: key_,
  23338. ref_for: true,
  23339. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  23340. class: vue.normalizeClass(getCellStyle(cell)),
  23341. "aria-selected": `${isSelectedCell(cell)}`,
  23342. "aria-label": vue.unref(t)(`el.datepicker.month${+cell.text + 1}`),
  23343. tabindex: isSelectedCell(cell) ? 0 : -1,
  23344. onKeydown: [
  23345. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  23346. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  23347. ]
  23348. }, [
  23349. vue.createElementVNode("div", null, [
  23350. vue.createElementVNode("span", _hoisted_3$e, vue.toDisplayString(vue.unref(t)("el.datepicker.months." + months.value[cell.text])), 1)
  23351. ])
  23352. ], 42, _hoisted_2$s);
  23353. }), 128))
  23354. ]);
  23355. }), 128))
  23356. ], 512)
  23357. ], 42, _hoisted_1$I);
  23358. };
  23359. }
  23360. });
  23361. var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__file", "basic-month-table.vue"]]);
  23362. const { date, disabledDate, parsedValue } = datePickerSharedProps;
  23363. const basicYearTableProps = buildProps({
  23364. date,
  23365. disabledDate,
  23366. parsedValue
  23367. });
  23368. const _hoisted_1$H = ["aria-label"];
  23369. const _hoisted_2$r = ["aria-selected", "tabindex", "onKeydown"];
  23370. const _hoisted_3$d = { class: "cell" };
  23371. const _hoisted_4$a = { key: 1 };
  23372. const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({
  23373. __name: "basic-year-table",
  23374. props: basicYearTableProps,
  23375. emits: ["pick"],
  23376. setup(__props, { expose, emit }) {
  23377. const props = __props;
  23378. const datesInYear = (year, lang2) => {
  23379. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  23380. const lastDay = firstDay.endOf("year");
  23381. const numOfDays = lastDay.dayOfYear();
  23382. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  23383. };
  23384. const ns = useNamespace("year-table");
  23385. const { t, lang } = useLocale();
  23386. const tbodyRef = vue.ref();
  23387. const currentCellRef = vue.ref();
  23388. const startYear = vue.computed(() => {
  23389. return Math.floor(props.date.year() / 10) * 10;
  23390. });
  23391. const focus = () => {
  23392. var _a;
  23393. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  23394. };
  23395. const getCellKls = (year) => {
  23396. const kls = {};
  23397. const today = dayjs().locale(lang.value);
  23398. kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  23399. kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
  23400. kls.today = today.year() === year;
  23401. return kls;
  23402. };
  23403. const isSelectedCell = (year) => {
  23404. return year === startYear.value && props.date.year() < startYear.value && props.date.year() > startYear.value + 9 || castArray(props.date).findIndex((date) => date.year() === year) >= 0;
  23405. };
  23406. const handleYearTableClick = (event) => {
  23407. const clickTarget = event.target;
  23408. const target = clickTarget.closest("td");
  23409. if (target && target.textContent) {
  23410. if (hasClass(target, "disabled"))
  23411. return;
  23412. const year = target.textContent || target.innerText;
  23413. emit("pick", Number(year));
  23414. }
  23415. };
  23416. vue.watch(() => props.date, async () => {
  23417. var _a, _b;
  23418. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  23419. await vue.nextTick();
  23420. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  23421. }
  23422. });
  23423. expose({
  23424. focus
  23425. });
  23426. return (_ctx, _cache) => {
  23427. return vue.openBlock(), vue.createElementBlock("table", {
  23428. role: "grid",
  23429. "aria-label": vue.unref(t)("el.datepicker.yearTablePrompt"),
  23430. class: vue.normalizeClass(vue.unref(ns).b()),
  23431. onClick: handleYearTableClick
  23432. }, [
  23433. vue.createElementVNode("tbody", {
  23434. ref_key: "tbodyRef",
  23435. ref: tbodyRef
  23436. }, [
  23437. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(3, (_, i) => {
  23438. return vue.createElementVNode("tr", { key: i }, [
  23439. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(4, (__, j) => {
  23440. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  23441. key: i + "_" + j
  23442. }, [
  23443. i * 4 + j < 10 ? (vue.openBlock(), vue.createElementBlock("td", {
  23444. key: 0,
  23445. ref_for: true,
  23446. ref: (el) => isSelectedCell(vue.unref(startYear) + i * 4 + j) && (currentCellRef.value = el),
  23447. class: vue.normalizeClass(["available", getCellKls(vue.unref(startYear) + i * 4 + j)]),
  23448. "aria-selected": `${isSelectedCell(vue.unref(startYear) + i * 4 + j)}`,
  23449. tabindex: isSelectedCell(vue.unref(startYear) + i * 4 + j) ? 0 : -1,
  23450. onKeydown: [
  23451. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  23452. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  23453. ]
  23454. }, [
  23455. vue.createElementVNode("span", _hoisted_3$d, vue.toDisplayString(vue.unref(startYear) + i * 4 + j), 1)
  23456. ], 42, _hoisted_2$r)) : (vue.openBlock(), vue.createElementBlock("td", _hoisted_4$a))
  23457. ], 64);
  23458. }), 64))
  23459. ]);
  23460. }), 64))
  23461. ], 512)
  23462. ], 10, _hoisted_1$H);
  23463. };
  23464. }
  23465. });
  23466. var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["__file", "basic-year-table.vue"]]);
  23467. const _hoisted_1$G = ["onClick"];
  23468. const _hoisted_2$q = ["aria-label"];
  23469. const _hoisted_3$c = ["aria-label"];
  23470. const _hoisted_4$9 = ["aria-label"];
  23471. const _hoisted_5$7 = ["aria-label"];
  23472. const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
  23473. __name: "panel-date-pick",
  23474. props: panelDatePickProps,
  23475. emits: ["pick", "set-picker-option", "panel-change"],
  23476. setup(__props, { emit: contextEmit }) {
  23477. const props = __props;
  23478. const timeWithinRange = (_, __, ___) => true;
  23479. const ppNs = useNamespace("picker-panel");
  23480. const dpNs = useNamespace("date-picker");
  23481. const attrs = vue.useAttrs();
  23482. const slots = vue.useSlots();
  23483. const { t, lang } = useLocale();
  23484. const pickerBase = vue.inject("EP_PICKER_BASE");
  23485. const popper = vue.inject(TOOLTIP_INJECTION_KEY);
  23486. const { shortcuts, disabledDate, cellClassName, defaultTime, arrowControl } = pickerBase.props;
  23487. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  23488. const currentViewRef = vue.ref();
  23489. const innerDate = vue.ref(dayjs().locale(lang.value));
  23490. const defaultTimeD = vue.computed(() => {
  23491. return dayjs(defaultTime).locale(lang.value);
  23492. });
  23493. const month = vue.computed(() => {
  23494. return innerDate.value.month();
  23495. });
  23496. const year = vue.computed(() => {
  23497. return innerDate.value.year();
  23498. });
  23499. const selectableRange = vue.ref([]);
  23500. const userInputDate = vue.ref(null);
  23501. const userInputTime = vue.ref(null);
  23502. const checkDateWithinRange = (date) => {
  23503. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  23504. };
  23505. const formatEmit = (emitDayjs) => {
  23506. if (defaultTime && !visibleTime.value) {
  23507. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  23508. }
  23509. if (showTime.value)
  23510. return emitDayjs.millisecond(0);
  23511. return emitDayjs.startOf("day");
  23512. };
  23513. const emit = (value, ...args) => {
  23514. if (!value) {
  23515. contextEmit("pick", value, ...args);
  23516. } else if (isArray(value)) {
  23517. const dates = value.map(formatEmit);
  23518. contextEmit("pick", dates, ...args);
  23519. } else {
  23520. contextEmit("pick", formatEmit(value), ...args);
  23521. }
  23522. userInputDate.value = null;
  23523. userInputTime.value = null;
  23524. };
  23525. const handleDatePick = (value, keepOpen) => {
  23526. if (selectionMode.value === "date") {
  23527. value = value;
  23528. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  23529. if (!checkDateWithinRange(newDate)) {
  23530. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  23531. }
  23532. innerDate.value = newDate;
  23533. emit(newDate, showTime.value || keepOpen);
  23534. } else if (selectionMode.value === "week") {
  23535. emit(value.date);
  23536. } else if (selectionMode.value === "dates") {
  23537. emit(value, true);
  23538. }
  23539. };
  23540. const moveByMonth = (forward) => {
  23541. const action = forward ? "add" : "subtract";
  23542. innerDate.value = innerDate.value[action](1, "month");
  23543. handlePanelChange("month");
  23544. };
  23545. const moveByYear = (forward) => {
  23546. const currentDate = innerDate.value;
  23547. const action = forward ? "add" : "subtract";
  23548. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  23549. handlePanelChange("year");
  23550. };
  23551. const currentView = vue.ref("date");
  23552. const yearLabel = vue.computed(() => {
  23553. const yearTranslation = t("el.datepicker.year");
  23554. if (currentView.value === "year") {
  23555. const startYear = Math.floor(year.value / 10) * 10;
  23556. if (yearTranslation) {
  23557. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  23558. }
  23559. return `${startYear} - ${startYear + 9}`;
  23560. }
  23561. return `${year.value} ${yearTranslation}`;
  23562. });
  23563. const handleShortcutClick = (shortcut) => {
  23564. const shortcutValue = isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
  23565. if (shortcutValue) {
  23566. emit(dayjs(shortcutValue).locale(lang.value));
  23567. return;
  23568. }
  23569. if (shortcut.onClick) {
  23570. shortcut.onClick({
  23571. attrs,
  23572. slots,
  23573. emit: contextEmit
  23574. });
  23575. }
  23576. };
  23577. const selectionMode = vue.computed(() => {
  23578. const { type } = props;
  23579. if (["week", "month", "year", "dates"].includes(type))
  23580. return type;
  23581. return "date";
  23582. });
  23583. const keyboardMode = vue.computed(() => {
  23584. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  23585. });
  23586. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  23587. const handleMonthPick = async (month2) => {
  23588. innerDate.value = innerDate.value.startOf("month").month(month2);
  23589. if (selectionMode.value === "month") {
  23590. emit(innerDate.value, false);
  23591. } else {
  23592. currentView.value = "date";
  23593. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  23594. emit(innerDate.value, true);
  23595. await vue.nextTick();
  23596. handleFocusPicker();
  23597. }
  23598. }
  23599. handlePanelChange("month");
  23600. };
  23601. const handleYearPick = async (year2) => {
  23602. if (selectionMode.value === "year") {
  23603. innerDate.value = innerDate.value.startOf("year").year(year2);
  23604. emit(innerDate.value, false);
  23605. } else {
  23606. innerDate.value = innerDate.value.year(year2);
  23607. currentView.value = "month";
  23608. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  23609. emit(innerDate.value, true);
  23610. await vue.nextTick();
  23611. handleFocusPicker();
  23612. }
  23613. }
  23614. handlePanelChange("year");
  23615. };
  23616. const showPicker = async (view) => {
  23617. currentView.value = view;
  23618. await vue.nextTick();
  23619. handleFocusPicker();
  23620. };
  23621. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  23622. const footerVisible = vue.computed(() => {
  23623. return showTime.value || selectionMode.value === "dates";
  23624. });
  23625. const onConfirm = () => {
  23626. if (selectionMode.value === "dates") {
  23627. emit(props.parsedValue);
  23628. } else {
  23629. let result = props.parsedValue;
  23630. if (!result) {
  23631. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  23632. const defaultValueD = getDefaultValue();
  23633. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  23634. }
  23635. innerDate.value = result;
  23636. emit(result);
  23637. }
  23638. };
  23639. const changeToNow = () => {
  23640. const now = dayjs().locale(lang.value);
  23641. const nowDate = now.toDate();
  23642. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  23643. innerDate.value = dayjs().locale(lang.value);
  23644. emit(innerDate.value);
  23645. }
  23646. };
  23647. const timeFormat = vue.computed(() => {
  23648. return extractTimeFormat(props.format);
  23649. });
  23650. const dateFormat = vue.computed(() => {
  23651. return extractDateFormat(props.format);
  23652. });
  23653. const visibleTime = vue.computed(() => {
  23654. if (userInputTime.value)
  23655. return userInputTime.value;
  23656. if (!props.parsedValue && !defaultValue.value)
  23657. return;
  23658. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  23659. });
  23660. const visibleDate = vue.computed(() => {
  23661. if (userInputDate.value)
  23662. return userInputDate.value;
  23663. if (!props.parsedValue && !defaultValue.value)
  23664. return;
  23665. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  23666. });
  23667. const timePickerVisible = vue.ref(false);
  23668. const onTimePickerInputFocus = () => {
  23669. timePickerVisible.value = true;
  23670. };
  23671. const handleTimePickClose = () => {
  23672. timePickerVisible.value = false;
  23673. };
  23674. const getUnits = (date) => {
  23675. return {
  23676. hour: date.hour(),
  23677. minute: date.minute(),
  23678. second: date.second(),
  23679. year: date.year(),
  23680. month: date.month(),
  23681. date: date.date()
  23682. };
  23683. };
  23684. const handleTimePick = (value, visible, first) => {
  23685. const { hour, minute, second } = getUnits(value);
  23686. const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
  23687. innerDate.value = newDate;
  23688. emit(innerDate.value, true);
  23689. if (!first) {
  23690. timePickerVisible.value = visible;
  23691. }
  23692. };
  23693. const handleVisibleTimeChange = (value) => {
  23694. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  23695. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  23696. const { year: year2, month: month2, date } = getUnits(innerDate.value);
  23697. innerDate.value = newDate.year(year2).month(month2).date(date);
  23698. userInputTime.value = null;
  23699. timePickerVisible.value = false;
  23700. emit(innerDate.value, true);
  23701. }
  23702. };
  23703. const handleVisibleDateChange = (value) => {
  23704. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  23705. if (newDate.isValid()) {
  23706. if (disabledDate && disabledDate(newDate.toDate())) {
  23707. return;
  23708. }
  23709. const { hour, minute, second } = getUnits(innerDate.value);
  23710. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  23711. userInputDate.value = null;
  23712. emit(innerDate.value, true);
  23713. }
  23714. };
  23715. const isValidValue = (date) => {
  23716. return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  23717. };
  23718. const formatToString = (value) => {
  23719. if (selectionMode.value === "dates") {
  23720. return value.map((_) => _.format(props.format));
  23721. }
  23722. return value.format(props.format);
  23723. };
  23724. const parseUserInput = (value) => {
  23725. return dayjs(value, props.format).locale(lang.value);
  23726. };
  23727. const getDefaultValue = () => {
  23728. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  23729. if (!defaultValue.value) {
  23730. const defaultTimeDValue = defaultTimeD.value;
  23731. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  23732. }
  23733. return parseDate;
  23734. };
  23735. const handleFocusPicker = async () => {
  23736. var _a;
  23737. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  23738. (_a = currentViewRef.value) == null ? void 0 : _a.focus();
  23739. if (selectionMode.value === "week") {
  23740. handleKeyControl(EVENT_CODE.down);
  23741. }
  23742. }
  23743. };
  23744. const handleKeydownTable = (event) => {
  23745. const { code } = event;
  23746. const validCode = [
  23747. EVENT_CODE.up,
  23748. EVENT_CODE.down,
  23749. EVENT_CODE.left,
  23750. EVENT_CODE.right,
  23751. EVENT_CODE.home,
  23752. EVENT_CODE.end,
  23753. EVENT_CODE.pageUp,
  23754. EVENT_CODE.pageDown
  23755. ];
  23756. if (validCode.includes(code)) {
  23757. handleKeyControl(code);
  23758. event.stopPropagation();
  23759. event.preventDefault();
  23760. }
  23761. if ([EVENT_CODE.enter, EVENT_CODE.space].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  23762. event.preventDefault();
  23763. emit(innerDate.value, false);
  23764. }
  23765. };
  23766. const handleKeyControl = (code) => {
  23767. var _a;
  23768. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  23769. const mapping = {
  23770. year: {
  23771. [up]: -4,
  23772. [down]: 4,
  23773. [left]: -1,
  23774. [right]: 1,
  23775. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  23776. },
  23777. month: {
  23778. [up]: -4,
  23779. [down]: 4,
  23780. [left]: -1,
  23781. [right]: 1,
  23782. offset: (date, step) => date.setMonth(date.getMonth() + step)
  23783. },
  23784. week: {
  23785. [up]: -1,
  23786. [down]: 1,
  23787. [left]: -1,
  23788. [right]: 1,
  23789. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  23790. },
  23791. date: {
  23792. [up]: -7,
  23793. [down]: 7,
  23794. [left]: -1,
  23795. [right]: 1,
  23796. [home]: (date) => -date.getDay(),
  23797. [end]: (date) => -date.getDay() + 6,
  23798. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  23799. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  23800. offset: (date, step) => date.setDate(date.getDate() + step)
  23801. }
  23802. };
  23803. const newDate = innerDate.value.toDate();
  23804. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  23805. const map = mapping[keyboardMode.value];
  23806. if (!map)
  23807. return;
  23808. map.offset(newDate, isFunction(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
  23809. if (disabledDate && disabledDate(newDate)) {
  23810. break;
  23811. }
  23812. const result = dayjs(newDate).locale(lang.value);
  23813. innerDate.value = result;
  23814. contextEmit("pick", result, true);
  23815. break;
  23816. }
  23817. };
  23818. const handlePanelChange = (mode) => {
  23819. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  23820. };
  23821. vue.watch(() => selectionMode.value, (val) => {
  23822. if (["month", "year"].includes(val)) {
  23823. currentView.value = val;
  23824. return;
  23825. }
  23826. currentView.value = "date";
  23827. }, { immediate: true });
  23828. vue.watch(() => currentView.value, () => {
  23829. popper == null ? void 0 : popper.updatePopper();
  23830. });
  23831. vue.watch(() => defaultValue.value, (val) => {
  23832. if (val) {
  23833. innerDate.value = getDefaultValue();
  23834. }
  23835. }, { immediate: true });
  23836. vue.watch(() => props.parsedValue, (val) => {
  23837. if (val) {
  23838. if (selectionMode.value === "dates")
  23839. return;
  23840. if (Array.isArray(val))
  23841. return;
  23842. innerDate.value = val;
  23843. } else {
  23844. innerDate.value = getDefaultValue();
  23845. }
  23846. }, { immediate: true });
  23847. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  23848. contextEmit("set-picker-option", ["formatToString", formatToString]);
  23849. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  23850. contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]);
  23851. return (_ctx, _cache) => {
  23852. return vue.openBlock(), vue.createElementBlock("div", {
  23853. class: vue.normalizeClass([
  23854. vue.unref(ppNs).b(),
  23855. vue.unref(dpNs).b(),
  23856. {
  23857. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  23858. "has-time": vue.unref(showTime)
  23859. }
  23860. ])
  23861. }, [
  23862. vue.createElementVNode("div", {
  23863. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  23864. }, [
  23865. vue.renderSlot(_ctx.$slots, "sidebar", {
  23866. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  23867. }),
  23868. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  23869. key: 0,
  23870. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  23871. }, [
  23872. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  23873. return vue.openBlock(), vue.createElementBlock("button", {
  23874. key,
  23875. type: "button",
  23876. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  23877. onClick: ($event) => handleShortcutClick(shortcut)
  23878. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$G);
  23879. }), 128))
  23880. ], 2)) : vue.createCommentVNode("v-if", true),
  23881. vue.createElementVNode("div", {
  23882. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  23883. }, [
  23884. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  23885. key: 0,
  23886. class: vue.normalizeClass(vue.unref(dpNs).e("time-header"))
  23887. }, [
  23888. vue.createElementVNode("span", {
  23889. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  23890. }, [
  23891. vue.createVNode(vue.unref(ElInput), {
  23892. placeholder: vue.unref(t)("el.datepicker.selectDate"),
  23893. "model-value": vue.unref(visibleDate),
  23894. size: "small",
  23895. "validate-event": false,
  23896. onInput: _cache[0] || (_cache[0] = (val) => userInputDate.value = val),
  23897. onChange: handleVisibleDateChange
  23898. }, null, 8, ["placeholder", "model-value"])
  23899. ], 2),
  23900. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  23901. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  23902. }, [
  23903. vue.createVNode(vue.unref(ElInput), {
  23904. placeholder: vue.unref(t)("el.datepicker.selectTime"),
  23905. "model-value": vue.unref(visibleTime),
  23906. size: "small",
  23907. "validate-event": false,
  23908. onFocus: onTimePickerInputFocus,
  23909. onInput: _cache[1] || (_cache[1] = (val) => userInputTime.value = val),
  23910. onChange: handleVisibleTimeChange
  23911. }, null, 8, ["placeholder", "model-value"]),
  23912. vue.createVNode(vue.unref(TimePickPanel), {
  23913. visible: timePickerVisible.value,
  23914. format: vue.unref(timeFormat),
  23915. "time-arrow-control": vue.unref(arrowControl),
  23916. "parsed-value": innerDate.value,
  23917. onPick: handleTimePick
  23918. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
  23919. ], 2)), [
  23920. [vue.unref(ClickOutside), handleTimePickClose]
  23921. ])
  23922. ], 2)) : vue.createCommentVNode("v-if", true),
  23923. vue.withDirectives(vue.createElementVNode("div", {
  23924. class: vue.normalizeClass([
  23925. vue.unref(dpNs).e("header"),
  23926. (currentView.value === "year" || currentView.value === "month") && vue.unref(dpNs).e("header--bordered")
  23927. ])
  23928. }, [
  23929. vue.createElementVNode("span", {
  23930. class: vue.normalizeClass(vue.unref(dpNs).e("prev-btn"))
  23931. }, [
  23932. vue.createElementVNode("button", {
  23933. type: "button",
  23934. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  23935. class: vue.normalizeClass(["d-arrow-left", vue.unref(ppNs).e("icon-btn")]),
  23936. onClick: _cache[2] || (_cache[2] = ($event) => moveByYear(false))
  23937. }, [
  23938. vue.createVNode(vue.unref(ElIcon), null, {
  23939. default: vue.withCtx(() => [
  23940. vue.createVNode(vue.unref(d_arrow_left_default))
  23941. ]),
  23942. _: 1
  23943. })
  23944. ], 10, _hoisted_2$q),
  23945. vue.withDirectives(vue.createElementVNode("button", {
  23946. type: "button",
  23947. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  23948. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  23949. onClick: _cache[3] || (_cache[3] = ($event) => moveByMonth(false))
  23950. }, [
  23951. vue.createVNode(vue.unref(ElIcon), null, {
  23952. default: vue.withCtx(() => [
  23953. vue.createVNode(vue.unref(arrow_left_default))
  23954. ]),
  23955. _: 1
  23956. })
  23957. ], 10, _hoisted_3$c), [
  23958. [vue.vShow, currentView.value === "date"]
  23959. ])
  23960. ], 2),
  23961. vue.createElementVNode("span", {
  23962. role: "button",
  23963. class: vue.normalizeClass(vue.unref(dpNs).e("header-label")),
  23964. "aria-live": "polite",
  23965. tabindex: "0",
  23966. onKeydown: _cache[4] || (_cache[4] = vue.withKeys(($event) => showPicker("year"), ["enter"])),
  23967. onClick: _cache[5] || (_cache[5] = ($event) => showPicker("year"))
  23968. }, vue.toDisplayString(vue.unref(yearLabel)), 35),
  23969. vue.withDirectives(vue.createElementVNode("span", {
  23970. role: "button",
  23971. "aria-live": "polite",
  23972. tabindex: "0",
  23973. class: vue.normalizeClass([
  23974. vue.unref(dpNs).e("header-label"),
  23975. { active: currentView.value === "month" }
  23976. ]),
  23977. onKeydown: _cache[6] || (_cache[6] = vue.withKeys(($event) => showPicker("month"), ["enter"])),
  23978. onClick: _cache[7] || (_cache[7] = ($event) => showPicker("month"))
  23979. }, vue.toDisplayString(vue.unref(t)(`el.datepicker.month${vue.unref(month) + 1}`)), 35), [
  23980. [vue.vShow, currentView.value === "date"]
  23981. ]),
  23982. vue.createElementVNode("span", {
  23983. class: vue.normalizeClass(vue.unref(dpNs).e("next-btn"))
  23984. }, [
  23985. vue.withDirectives(vue.createElementVNode("button", {
  23986. type: "button",
  23987. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  23988. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  23989. onClick: _cache[8] || (_cache[8] = ($event) => moveByMonth(true))
  23990. }, [
  23991. vue.createVNode(vue.unref(ElIcon), null, {
  23992. default: vue.withCtx(() => [
  23993. vue.createVNode(vue.unref(arrow_right_default))
  23994. ]),
  23995. _: 1
  23996. })
  23997. ], 10, _hoisted_4$9), [
  23998. [vue.vShow, currentView.value === "date"]
  23999. ]),
  24000. vue.createElementVNode("button", {
  24001. type: "button",
  24002. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  24003. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  24004. onClick: _cache[9] || (_cache[9] = ($event) => moveByYear(true))
  24005. }, [
  24006. vue.createVNode(vue.unref(ElIcon), null, {
  24007. default: vue.withCtx(() => [
  24008. vue.createVNode(vue.unref(d_arrow_right_default))
  24009. ]),
  24010. _: 1
  24011. })
  24012. ], 10, _hoisted_5$7)
  24013. ], 2)
  24014. ], 2), [
  24015. [vue.vShow, currentView.value !== "time"]
  24016. ]),
  24017. vue.createElementVNode("div", {
  24018. class: vue.normalizeClass(vue.unref(ppNs).e("content")),
  24019. onKeydown: handleKeydownTable
  24020. }, [
  24021. currentView.value === "date" ? (vue.openBlock(), vue.createBlock(DateTable, {
  24022. key: 0,
  24023. ref_key: "currentViewRef",
  24024. ref: currentViewRef,
  24025. "selection-mode": vue.unref(selectionMode),
  24026. date: innerDate.value,
  24027. "parsed-value": _ctx.parsedValue,
  24028. "disabled-date": vue.unref(disabledDate),
  24029. "cell-class-name": vue.unref(cellClassName),
  24030. onPick: handleDatePick
  24031. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : vue.createCommentVNode("v-if", true),
  24032. currentView.value === "year" ? (vue.openBlock(), vue.createBlock(YearTable, {
  24033. key: 1,
  24034. ref_key: "currentViewRef",
  24035. ref: currentViewRef,
  24036. date: innerDate.value,
  24037. "disabled-date": vue.unref(disabledDate),
  24038. "parsed-value": _ctx.parsedValue,
  24039. onPick: handleYearPick
  24040. }, null, 8, ["date", "disabled-date", "parsed-value"])) : vue.createCommentVNode("v-if", true),
  24041. currentView.value === "month" ? (vue.openBlock(), vue.createBlock(MonthTable, {
  24042. key: 2,
  24043. ref_key: "currentViewRef",
  24044. ref: currentViewRef,
  24045. date: innerDate.value,
  24046. "parsed-value": _ctx.parsedValue,
  24047. "disabled-date": vue.unref(disabledDate),
  24048. onPick: handleMonthPick
  24049. }, null, 8, ["date", "parsed-value", "disabled-date"])) : vue.createCommentVNode("v-if", true)
  24050. ], 34)
  24051. ], 2)
  24052. ], 2),
  24053. vue.withDirectives(vue.createElementVNode("div", {
  24054. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  24055. }, [
  24056. vue.withDirectives(vue.createVNode(vue.unref(ElButton), {
  24057. text: "",
  24058. size: "small",
  24059. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  24060. onClick: changeToNow
  24061. }, {
  24062. default: vue.withCtx(() => [
  24063. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.now")), 1)
  24064. ]),
  24065. _: 1
  24066. }, 8, ["class"]), [
  24067. [vue.vShow, vue.unref(selectionMode) !== "dates"]
  24068. ]),
  24069. vue.createVNode(vue.unref(ElButton), {
  24070. plain: "",
  24071. size: "small",
  24072. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  24073. onClick: onConfirm
  24074. }, {
  24075. default: vue.withCtx(() => [
  24076. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  24077. ]),
  24078. _: 1
  24079. }, 8, ["class"])
  24080. ], 2), [
  24081. [vue.vShow, vue.unref(footerVisible) && currentView.value === "date"]
  24082. ])
  24083. ], 2);
  24084. };
  24085. }
  24086. });
  24087. var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["__file", "panel-date-pick.vue"]]);
  24088. const panelDateRangeProps = buildProps({
  24089. ...panelSharedProps,
  24090. ...panelRangeSharedProps
  24091. });
  24092. const useShortcut = (lang) => {
  24093. const { emit } = vue.getCurrentInstance();
  24094. const attrs = vue.useAttrs();
  24095. const slots = vue.useSlots();
  24096. const handleShortcutClick = (shortcut) => {
  24097. const shortcutValues = isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
  24098. if (shortcutValues) {
  24099. emit("pick", [
  24100. dayjs(shortcutValues[0]).locale(lang.value),
  24101. dayjs(shortcutValues[1]).locale(lang.value)
  24102. ]);
  24103. return;
  24104. }
  24105. if (shortcut.onClick) {
  24106. shortcut.onClick({
  24107. attrs,
  24108. slots,
  24109. emit
  24110. });
  24111. }
  24112. };
  24113. return handleShortcutClick;
  24114. };
  24115. const useRangePicker = (props, {
  24116. defaultValue,
  24117. leftDate,
  24118. rightDate,
  24119. unit,
  24120. onParsedValueChanged
  24121. }) => {
  24122. const { emit } = vue.getCurrentInstance();
  24123. const { pickerNs } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  24124. const drpNs = useNamespace("date-range-picker");
  24125. const { t, lang } = useLocale();
  24126. const handleShortcutClick = useShortcut(lang);
  24127. const minDate = vue.ref();
  24128. const maxDate = vue.ref();
  24129. const rangeState = vue.ref({
  24130. endDate: null,
  24131. selecting: false
  24132. });
  24133. const handleChangeRange = (val) => {
  24134. rangeState.value = val;
  24135. };
  24136. const handleRangeConfirm = (visible = false) => {
  24137. const _minDate = vue.unref(minDate);
  24138. const _maxDate = vue.unref(maxDate);
  24139. if (isValidRange([_minDate, _maxDate])) {
  24140. emit("pick", [_minDate, _maxDate], visible);
  24141. }
  24142. };
  24143. const onSelect = (selecting) => {
  24144. rangeState.value.selecting = selecting;
  24145. if (!selecting) {
  24146. rangeState.value.endDate = null;
  24147. }
  24148. };
  24149. const restoreDefault = () => {
  24150. const [start, end] = getDefaultValue(vue.unref(defaultValue), {
  24151. lang: vue.unref(lang),
  24152. unit,
  24153. unlinkPanels: props.unlinkPanels
  24154. });
  24155. minDate.value = void 0;
  24156. maxDate.value = void 0;
  24157. leftDate.value = start;
  24158. rightDate.value = end;
  24159. };
  24160. vue.watch(defaultValue, (val) => {
  24161. if (val) {
  24162. restoreDefault();
  24163. }
  24164. }, { immediate: true });
  24165. vue.watch(() => props.parsedValue, (parsedValue) => {
  24166. if (isArray(parsedValue) && parsedValue.length === 2) {
  24167. const [start, end] = parsedValue;
  24168. minDate.value = start;
  24169. leftDate.value = start;
  24170. maxDate.value = end;
  24171. onParsedValueChanged(vue.unref(minDate), vue.unref(maxDate));
  24172. } else {
  24173. restoreDefault();
  24174. }
  24175. }, { immediate: true });
  24176. return {
  24177. minDate,
  24178. maxDate,
  24179. rangeState,
  24180. lang,
  24181. ppNs: pickerNs,
  24182. drpNs,
  24183. handleChangeRange,
  24184. handleRangeConfirm,
  24185. handleShortcutClick,
  24186. onSelect,
  24187. t
  24188. };
  24189. };
  24190. const _hoisted_1$F = ["onClick"];
  24191. const _hoisted_2$p = ["disabled"];
  24192. const _hoisted_3$b = ["disabled"];
  24193. const _hoisted_4$8 = ["disabled"];
  24194. const _hoisted_5$6 = ["disabled"];
  24195. const unit$1 = "month";
  24196. const _sfc_main$1h = /* @__PURE__ */ vue.defineComponent({
  24197. __name: "panel-date-range",
  24198. props: panelDateRangeProps,
  24199. emits: [
  24200. "pick",
  24201. "set-picker-option",
  24202. "calendar-change",
  24203. "panel-change"
  24204. ],
  24205. setup(__props, { emit }) {
  24206. const props = __props;
  24207. const pickerBase = vue.inject("EP_PICKER_BASE");
  24208. const {
  24209. disabledDate,
  24210. cellClassName,
  24211. format,
  24212. defaultTime,
  24213. arrowControl,
  24214. clearable
  24215. } = pickerBase.props;
  24216. const shortcuts = vue.toRef(pickerBase.props, "shortcuts");
  24217. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  24218. const { lang } = useLocale();
  24219. const leftDate = vue.ref(dayjs().locale(lang.value));
  24220. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$1));
  24221. const {
  24222. minDate,
  24223. maxDate,
  24224. rangeState,
  24225. ppNs,
  24226. drpNs,
  24227. handleChangeRange,
  24228. handleRangeConfirm,
  24229. handleShortcutClick,
  24230. onSelect,
  24231. t
  24232. } = useRangePicker(props, {
  24233. defaultValue,
  24234. leftDate,
  24235. rightDate,
  24236. unit: unit$1,
  24237. onParsedValueChanged
  24238. });
  24239. const dateUserInput = vue.ref({
  24240. min: null,
  24241. max: null
  24242. });
  24243. const timeUserInput = vue.ref({
  24244. min: null,
  24245. max: null
  24246. });
  24247. const leftLabel = vue.computed(() => {
  24248. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  24249. });
  24250. const rightLabel = vue.computed(() => {
  24251. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  24252. });
  24253. const leftYear = vue.computed(() => {
  24254. return leftDate.value.year();
  24255. });
  24256. const leftMonth = vue.computed(() => {
  24257. return leftDate.value.month();
  24258. });
  24259. const rightYear = vue.computed(() => {
  24260. return rightDate.value.year();
  24261. });
  24262. const rightMonth = vue.computed(() => {
  24263. return rightDate.value.month();
  24264. });
  24265. const hasShortcuts = vue.computed(() => !!shortcuts.value.length);
  24266. const minVisibleDate = vue.computed(() => {
  24267. if (dateUserInput.value.min !== null)
  24268. return dateUserInput.value.min;
  24269. if (minDate.value)
  24270. return minDate.value.format(dateFormat.value);
  24271. return "";
  24272. });
  24273. const maxVisibleDate = vue.computed(() => {
  24274. if (dateUserInput.value.max !== null)
  24275. return dateUserInput.value.max;
  24276. if (maxDate.value || minDate.value)
  24277. return (maxDate.value || minDate.value).format(dateFormat.value);
  24278. return "";
  24279. });
  24280. const minVisibleTime = vue.computed(() => {
  24281. if (timeUserInput.value.min !== null)
  24282. return timeUserInput.value.min;
  24283. if (minDate.value)
  24284. return minDate.value.format(timeFormat.value);
  24285. return "";
  24286. });
  24287. const maxVisibleTime = vue.computed(() => {
  24288. if (timeUserInput.value.max !== null)
  24289. return timeUserInput.value.max;
  24290. if (maxDate.value || minDate.value)
  24291. return (maxDate.value || minDate.value).format(timeFormat.value);
  24292. return "";
  24293. });
  24294. const timeFormat = vue.computed(() => {
  24295. return extractTimeFormat(format);
  24296. });
  24297. const dateFormat = vue.computed(() => {
  24298. return extractDateFormat(format);
  24299. });
  24300. const leftPrevYear = () => {
  24301. leftDate.value = leftDate.value.subtract(1, "year");
  24302. if (!props.unlinkPanels) {
  24303. rightDate.value = leftDate.value.add(1, "month");
  24304. }
  24305. handlePanelChange("year");
  24306. };
  24307. const leftPrevMonth = () => {
  24308. leftDate.value = leftDate.value.subtract(1, "month");
  24309. if (!props.unlinkPanels) {
  24310. rightDate.value = leftDate.value.add(1, "month");
  24311. }
  24312. handlePanelChange("month");
  24313. };
  24314. const rightNextYear = () => {
  24315. if (!props.unlinkPanels) {
  24316. leftDate.value = leftDate.value.add(1, "year");
  24317. rightDate.value = leftDate.value.add(1, "month");
  24318. } else {
  24319. rightDate.value = rightDate.value.add(1, "year");
  24320. }
  24321. handlePanelChange("year");
  24322. };
  24323. const rightNextMonth = () => {
  24324. if (!props.unlinkPanels) {
  24325. leftDate.value = leftDate.value.add(1, "month");
  24326. rightDate.value = leftDate.value.add(1, "month");
  24327. } else {
  24328. rightDate.value = rightDate.value.add(1, "month");
  24329. }
  24330. handlePanelChange("month");
  24331. };
  24332. const leftNextYear = () => {
  24333. leftDate.value = leftDate.value.add(1, "year");
  24334. handlePanelChange("year");
  24335. };
  24336. const leftNextMonth = () => {
  24337. leftDate.value = leftDate.value.add(1, "month");
  24338. handlePanelChange("month");
  24339. };
  24340. const rightPrevYear = () => {
  24341. rightDate.value = rightDate.value.subtract(1, "year");
  24342. handlePanelChange("year");
  24343. };
  24344. const rightPrevMonth = () => {
  24345. rightDate.value = rightDate.value.subtract(1, "month");
  24346. handlePanelChange("month");
  24347. };
  24348. const handlePanelChange = (mode) => {
  24349. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  24350. };
  24351. const enableMonthArrow = vue.computed(() => {
  24352. const nextMonth = (leftMonth.value + 1) % 12;
  24353. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  24354. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  24355. });
  24356. const enableYearArrow = vue.computed(() => {
  24357. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  24358. });
  24359. const btnDisabled = vue.computed(() => {
  24360. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  24361. });
  24362. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  24363. const formatEmit = (emitDayjs, index) => {
  24364. if (!emitDayjs)
  24365. return;
  24366. if (defaultTime) {
  24367. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  24368. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  24369. }
  24370. return emitDayjs;
  24371. };
  24372. const handleRangePick = (val, close = true) => {
  24373. const min_ = val.minDate;
  24374. const max_ = val.maxDate;
  24375. const minDate_ = formatEmit(min_, 0);
  24376. const maxDate_ = formatEmit(max_, 1);
  24377. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  24378. return;
  24379. }
  24380. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  24381. maxDate.value = maxDate_;
  24382. minDate.value = minDate_;
  24383. if (!close || showTime.value)
  24384. return;
  24385. handleRangeConfirm();
  24386. };
  24387. const minTimePickerVisible = vue.ref(false);
  24388. const maxTimePickerVisible = vue.ref(false);
  24389. const handleMinTimeClose = () => {
  24390. minTimePickerVisible.value = false;
  24391. };
  24392. const handleMaxTimeClose = () => {
  24393. maxTimePickerVisible.value = false;
  24394. };
  24395. const handleDateInput = (value, type) => {
  24396. dateUserInput.value[type] = value;
  24397. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  24398. if (parsedValueD.isValid()) {
  24399. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  24400. return;
  24401. }
  24402. if (type === "min") {
  24403. leftDate.value = parsedValueD;
  24404. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  24405. if (!props.unlinkPanels) {
  24406. rightDate.value = parsedValueD.add(1, "month");
  24407. maxDate.value = minDate.value.add(1, "month");
  24408. }
  24409. } else {
  24410. rightDate.value = parsedValueD;
  24411. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  24412. if (!props.unlinkPanels) {
  24413. leftDate.value = parsedValueD.subtract(1, "month");
  24414. minDate.value = maxDate.value.subtract(1, "month");
  24415. }
  24416. }
  24417. }
  24418. };
  24419. const handleDateChange = (_, type) => {
  24420. dateUserInput.value[type] = null;
  24421. };
  24422. const handleTimeInput = (value, type) => {
  24423. timeUserInput.value[type] = value;
  24424. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  24425. if (parsedValueD.isValid()) {
  24426. if (type === "min") {
  24427. minTimePickerVisible.value = true;
  24428. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  24429. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  24430. maxDate.value = minDate.value;
  24431. }
  24432. } else {
  24433. maxTimePickerVisible.value = true;
  24434. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  24435. rightDate.value = maxDate.value;
  24436. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  24437. minDate.value = maxDate.value;
  24438. }
  24439. }
  24440. }
  24441. };
  24442. const handleTimeChange = (value, type) => {
  24443. timeUserInput.value[type] = null;
  24444. if (type === "min") {
  24445. leftDate.value = minDate.value;
  24446. minTimePickerVisible.value = false;
  24447. } else {
  24448. rightDate.value = maxDate.value;
  24449. maxTimePickerVisible.value = false;
  24450. }
  24451. };
  24452. const handleMinTimePick = (value, visible, first) => {
  24453. if (timeUserInput.value.min)
  24454. return;
  24455. if (value) {
  24456. leftDate.value = value;
  24457. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  24458. }
  24459. if (!first) {
  24460. minTimePickerVisible.value = visible;
  24461. }
  24462. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  24463. maxDate.value = minDate.value;
  24464. rightDate.value = value;
  24465. }
  24466. };
  24467. const handleMaxTimePick = (value, visible, first) => {
  24468. if (timeUserInput.value.max)
  24469. return;
  24470. if (value) {
  24471. rightDate.value = value;
  24472. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  24473. }
  24474. if (!first) {
  24475. maxTimePickerVisible.value = visible;
  24476. }
  24477. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  24478. minDate.value = maxDate.value;
  24479. }
  24480. };
  24481. const handleClear = () => {
  24482. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  24483. lang: vue.unref(lang),
  24484. unit: "month",
  24485. unlinkPanels: props.unlinkPanels
  24486. })[0];
  24487. rightDate.value = leftDate.value.add(1, "month");
  24488. emit("pick", null);
  24489. };
  24490. const formatToString = (value) => {
  24491. return isArray(value) ? value.map((_) => _.format(format)) : value.format(format);
  24492. };
  24493. const parseUserInput = (value) => {
  24494. return isArray(value) ? value.map((_) => dayjs(_, format).locale(lang.value)) : dayjs(value, format).locale(lang.value);
  24495. };
  24496. function onParsedValueChanged(minDate2, maxDate2) {
  24497. if (props.unlinkPanels && maxDate2) {
  24498. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  24499. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  24500. const maxDateYear = maxDate2.year();
  24501. const maxDateMonth = maxDate2.month();
  24502. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$1) : maxDate2;
  24503. } else {
  24504. rightDate.value = leftDate.value.add(1, unit$1);
  24505. if (maxDate2) {
  24506. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  24507. }
  24508. }
  24509. }
  24510. emit("set-picker-option", ["isValidValue", isValidRange]);
  24511. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  24512. emit("set-picker-option", ["formatToString", formatToString]);
  24513. emit("set-picker-option", ["handleClear", handleClear]);
  24514. return (_ctx, _cache) => {
  24515. return vue.openBlock(), vue.createElementBlock("div", {
  24516. class: vue.normalizeClass([
  24517. vue.unref(ppNs).b(),
  24518. vue.unref(drpNs).b(),
  24519. {
  24520. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  24521. "has-time": vue.unref(showTime)
  24522. }
  24523. ])
  24524. }, [
  24525. vue.createElementVNode("div", {
  24526. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  24527. }, [
  24528. vue.renderSlot(_ctx.$slots, "sidebar", {
  24529. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  24530. }),
  24531. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  24532. key: 0,
  24533. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  24534. }, [
  24535. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  24536. return vue.openBlock(), vue.createElementBlock("button", {
  24537. key,
  24538. type: "button",
  24539. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  24540. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  24541. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$F);
  24542. }), 128))
  24543. ], 2)) : vue.createCommentVNode("v-if", true),
  24544. vue.createElementVNode("div", {
  24545. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  24546. }, [
  24547. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  24548. key: 0,
  24549. class: vue.normalizeClass(vue.unref(drpNs).e("time-header"))
  24550. }, [
  24551. vue.createElementVNode("span", {
  24552. class: vue.normalizeClass(vue.unref(drpNs).e("editors-wrap"))
  24553. }, [
  24554. vue.createElementVNode("span", {
  24555. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  24556. }, [
  24557. vue.createVNode(vue.unref(ElInput), {
  24558. size: "small",
  24559. disabled: vue.unref(rangeState).selecting,
  24560. placeholder: vue.unref(t)("el.datepicker.startDate"),
  24561. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  24562. "model-value": vue.unref(minVisibleDate),
  24563. "validate-event": false,
  24564. onInput: _cache[0] || (_cache[0] = (val) => handleDateInput(val, "min")),
  24565. onChange: _cache[1] || (_cache[1] = (val) => handleDateChange(val, "min"))
  24566. }, null, 8, ["disabled", "placeholder", "class", "model-value"])
  24567. ], 2),
  24568. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  24569. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  24570. }, [
  24571. vue.createVNode(vue.unref(ElInput), {
  24572. size: "small",
  24573. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  24574. disabled: vue.unref(rangeState).selecting,
  24575. placeholder: vue.unref(t)("el.datepicker.startTime"),
  24576. "model-value": vue.unref(minVisibleTime),
  24577. "validate-event": false,
  24578. onFocus: _cache[2] || (_cache[2] = ($event) => minTimePickerVisible.value = true),
  24579. onInput: _cache[3] || (_cache[3] = (val) => handleTimeInput(val, "min")),
  24580. onChange: _cache[4] || (_cache[4] = (val) => handleTimeChange(val, "min"))
  24581. }, null, 8, ["class", "disabled", "placeholder", "model-value"]),
  24582. vue.createVNode(vue.unref(TimePickPanel), {
  24583. visible: minTimePickerVisible.value,
  24584. format: vue.unref(timeFormat),
  24585. "datetime-role": "start",
  24586. "time-arrow-control": vue.unref(arrowControl),
  24587. "parsed-value": leftDate.value,
  24588. onPick: handleMinTimePick
  24589. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
  24590. ], 2)), [
  24591. [vue.unref(ClickOutside), handleMinTimeClose]
  24592. ])
  24593. ], 2),
  24594. vue.createElementVNode("span", null, [
  24595. vue.createVNode(vue.unref(ElIcon), null, {
  24596. default: vue.withCtx(() => [
  24597. vue.createVNode(vue.unref(arrow_right_default))
  24598. ]),
  24599. _: 1
  24600. })
  24601. ]),
  24602. vue.createElementVNode("span", {
  24603. class: vue.normalizeClass([vue.unref(drpNs).e("editors-wrap"), "is-right"])
  24604. }, [
  24605. vue.createElementVNode("span", {
  24606. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  24607. }, [
  24608. vue.createVNode(vue.unref(ElInput), {
  24609. size: "small",
  24610. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  24611. disabled: vue.unref(rangeState).selecting,
  24612. placeholder: vue.unref(t)("el.datepicker.endDate"),
  24613. "model-value": vue.unref(maxVisibleDate),
  24614. readonly: !vue.unref(minDate),
  24615. "validate-event": false,
  24616. onInput: _cache[5] || (_cache[5] = (val) => handleDateInput(val, "max")),
  24617. onChange: _cache[6] || (_cache[6] = (val) => handleDateChange(val, "max"))
  24618. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"])
  24619. ], 2),
  24620. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  24621. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  24622. }, [
  24623. vue.createVNode(vue.unref(ElInput), {
  24624. size: "small",
  24625. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  24626. disabled: vue.unref(rangeState).selecting,
  24627. placeholder: vue.unref(t)("el.datepicker.endTime"),
  24628. "model-value": vue.unref(maxVisibleTime),
  24629. readonly: !vue.unref(minDate),
  24630. "validate-event": false,
  24631. onFocus: _cache[7] || (_cache[7] = ($event) => vue.unref(minDate) && (maxTimePickerVisible.value = true)),
  24632. onInput: _cache[8] || (_cache[8] = (val) => handleTimeInput(val, "max")),
  24633. onChange: _cache[9] || (_cache[9] = (val) => handleTimeChange(val, "max"))
  24634. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"]),
  24635. vue.createVNode(vue.unref(TimePickPanel), {
  24636. "datetime-role": "end",
  24637. visible: maxTimePickerVisible.value,
  24638. format: vue.unref(timeFormat),
  24639. "time-arrow-control": vue.unref(arrowControl),
  24640. "parsed-value": rightDate.value,
  24641. onPick: handleMaxTimePick
  24642. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
  24643. ], 2)), [
  24644. [vue.unref(ClickOutside), handleMaxTimeClose]
  24645. ])
  24646. ], 2)
  24647. ], 2)) : vue.createCommentVNode("v-if", true),
  24648. vue.createElementVNode("div", {
  24649. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  24650. }, [
  24651. vue.createElementVNode("div", {
  24652. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  24653. }, [
  24654. vue.createElementVNode("button", {
  24655. type: "button",
  24656. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  24657. onClick: leftPrevYear
  24658. }, [
  24659. vue.createVNode(vue.unref(ElIcon), null, {
  24660. default: vue.withCtx(() => [
  24661. vue.createVNode(vue.unref(d_arrow_left_default))
  24662. ]),
  24663. _: 1
  24664. })
  24665. ], 2),
  24666. vue.createElementVNode("button", {
  24667. type: "button",
  24668. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  24669. onClick: leftPrevMonth
  24670. }, [
  24671. vue.createVNode(vue.unref(ElIcon), null, {
  24672. default: vue.withCtx(() => [
  24673. vue.createVNode(vue.unref(arrow_left_default))
  24674. ]),
  24675. _: 1
  24676. })
  24677. ], 2),
  24678. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  24679. key: 0,
  24680. type: "button",
  24681. disabled: !vue.unref(enableYearArrow),
  24682. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-right"]),
  24683. onClick: leftNextYear
  24684. }, [
  24685. vue.createVNode(vue.unref(ElIcon), null, {
  24686. default: vue.withCtx(() => [
  24687. vue.createVNode(vue.unref(d_arrow_right_default))
  24688. ]),
  24689. _: 1
  24690. })
  24691. ], 10, _hoisted_2$p)) : vue.createCommentVNode("v-if", true),
  24692. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  24693. key: 1,
  24694. type: "button",
  24695. disabled: !vue.unref(enableMonthArrow),
  24696. class: vue.normalizeClass([[
  24697. vue.unref(ppNs).e("icon-btn"),
  24698. { "is-disabled": !vue.unref(enableMonthArrow) }
  24699. ], "arrow-right"]),
  24700. onClick: leftNextMonth
  24701. }, [
  24702. vue.createVNode(vue.unref(ElIcon), null, {
  24703. default: vue.withCtx(() => [
  24704. vue.createVNode(vue.unref(arrow_right_default))
  24705. ]),
  24706. _: 1
  24707. })
  24708. ], 10, _hoisted_3$b)) : vue.createCommentVNode("v-if", true),
  24709. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  24710. ], 2),
  24711. vue.createVNode(DateTable, {
  24712. "selection-mode": "range",
  24713. date: leftDate.value,
  24714. "min-date": vue.unref(minDate),
  24715. "max-date": vue.unref(maxDate),
  24716. "range-state": vue.unref(rangeState),
  24717. "disabled-date": vue.unref(disabledDate),
  24718. "cell-class-name": vue.unref(cellClassName),
  24719. onChangerange: vue.unref(handleChangeRange),
  24720. onPick: handleRangePick,
  24721. onSelect: vue.unref(onSelect)
  24722. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  24723. ], 2),
  24724. vue.createElementVNode("div", {
  24725. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  24726. }, [
  24727. vue.createElementVNode("div", {
  24728. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  24729. }, [
  24730. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  24731. key: 0,
  24732. type: "button",
  24733. disabled: !vue.unref(enableYearArrow),
  24734. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  24735. onClick: rightPrevYear
  24736. }, [
  24737. vue.createVNode(vue.unref(ElIcon), null, {
  24738. default: vue.withCtx(() => [
  24739. vue.createVNode(vue.unref(d_arrow_left_default))
  24740. ]),
  24741. _: 1
  24742. })
  24743. ], 10, _hoisted_4$8)) : vue.createCommentVNode("v-if", true),
  24744. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  24745. key: 1,
  24746. type: "button",
  24747. disabled: !vue.unref(enableMonthArrow),
  24748. class: vue.normalizeClass([[
  24749. vue.unref(ppNs).e("icon-btn"),
  24750. { "is-disabled": !vue.unref(enableMonthArrow) }
  24751. ], "arrow-left"]),
  24752. onClick: rightPrevMonth
  24753. }, [
  24754. vue.createVNode(vue.unref(ElIcon), null, {
  24755. default: vue.withCtx(() => [
  24756. vue.createVNode(vue.unref(arrow_left_default))
  24757. ]),
  24758. _: 1
  24759. })
  24760. ], 10, _hoisted_5$6)) : vue.createCommentVNode("v-if", true),
  24761. vue.createElementVNode("button", {
  24762. type: "button",
  24763. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  24764. onClick: rightNextYear
  24765. }, [
  24766. vue.createVNode(vue.unref(ElIcon), null, {
  24767. default: vue.withCtx(() => [
  24768. vue.createVNode(vue.unref(d_arrow_right_default))
  24769. ]),
  24770. _: 1
  24771. })
  24772. ], 2),
  24773. vue.createElementVNode("button", {
  24774. type: "button",
  24775. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  24776. onClick: rightNextMonth
  24777. }, [
  24778. vue.createVNode(vue.unref(ElIcon), null, {
  24779. default: vue.withCtx(() => [
  24780. vue.createVNode(vue.unref(arrow_right_default))
  24781. ]),
  24782. _: 1
  24783. })
  24784. ], 2),
  24785. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  24786. ], 2),
  24787. vue.createVNode(DateTable, {
  24788. "selection-mode": "range",
  24789. date: rightDate.value,
  24790. "min-date": vue.unref(minDate),
  24791. "max-date": vue.unref(maxDate),
  24792. "range-state": vue.unref(rangeState),
  24793. "disabled-date": vue.unref(disabledDate),
  24794. "cell-class-name": vue.unref(cellClassName),
  24795. onChangerange: vue.unref(handleChangeRange),
  24796. onPick: handleRangePick,
  24797. onSelect: vue.unref(onSelect)
  24798. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  24799. ], 2)
  24800. ], 2)
  24801. ], 2),
  24802. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  24803. key: 0,
  24804. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  24805. }, [
  24806. vue.unref(clearable) ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), {
  24807. key: 0,
  24808. text: "",
  24809. size: "small",
  24810. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  24811. onClick: handleClear
  24812. }, {
  24813. default: vue.withCtx(() => [
  24814. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.clear")), 1)
  24815. ]),
  24816. _: 1
  24817. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  24818. vue.createVNode(vue.unref(ElButton), {
  24819. plain: "",
  24820. size: "small",
  24821. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  24822. disabled: vue.unref(btnDisabled),
  24823. onClick: _cache[10] || (_cache[10] = ($event) => vue.unref(handleRangeConfirm)(false))
  24824. }, {
  24825. default: vue.withCtx(() => [
  24826. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  24827. ]),
  24828. _: 1
  24829. }, 8, ["class", "disabled"])
  24830. ], 2)) : vue.createCommentVNode("v-if", true)
  24831. ], 2);
  24832. };
  24833. }
  24834. });
  24835. var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["__file", "panel-date-range.vue"]]);
  24836. const panelMonthRangeProps = buildProps({
  24837. ...panelRangeSharedProps
  24838. });
  24839. const panelMonthRangeEmits = ["pick", "set-picker-option"];
  24840. const useMonthRangeHeader = ({
  24841. unlinkPanels,
  24842. leftDate,
  24843. rightDate
  24844. }) => {
  24845. const { t } = useLocale();
  24846. const leftPrevYear = () => {
  24847. leftDate.value = leftDate.value.subtract(1, "year");
  24848. if (!unlinkPanels.value) {
  24849. rightDate.value = rightDate.value.subtract(1, "year");
  24850. }
  24851. };
  24852. const rightNextYear = () => {
  24853. if (!unlinkPanels.value) {
  24854. leftDate.value = leftDate.value.add(1, "year");
  24855. }
  24856. rightDate.value = rightDate.value.add(1, "year");
  24857. };
  24858. const leftNextYear = () => {
  24859. leftDate.value = leftDate.value.add(1, "year");
  24860. };
  24861. const rightPrevYear = () => {
  24862. rightDate.value = rightDate.value.subtract(1, "year");
  24863. };
  24864. const leftLabel = vue.computed(() => {
  24865. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  24866. });
  24867. const rightLabel = vue.computed(() => {
  24868. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  24869. });
  24870. const leftYear = vue.computed(() => {
  24871. return leftDate.value.year();
  24872. });
  24873. const rightYear = vue.computed(() => {
  24874. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  24875. });
  24876. return {
  24877. leftPrevYear,
  24878. rightNextYear,
  24879. leftNextYear,
  24880. rightPrevYear,
  24881. leftLabel,
  24882. rightLabel,
  24883. leftYear,
  24884. rightYear
  24885. };
  24886. };
  24887. const _hoisted_1$E = ["onClick"];
  24888. const _hoisted_2$o = ["disabled"];
  24889. const _hoisted_3$a = ["disabled"];
  24890. const unit = "year";
  24891. const __default__$Q = vue.defineComponent({
  24892. name: "DatePickerMonthRange"
  24893. });
  24894. const _sfc_main$1g = /* @__PURE__ */ vue.defineComponent({
  24895. ...__default__$Q,
  24896. props: panelMonthRangeProps,
  24897. emits: panelMonthRangeEmits,
  24898. setup(__props, { emit }) {
  24899. const props = __props;
  24900. const { lang } = useLocale();
  24901. const pickerBase = vue.inject("EP_PICKER_BASE");
  24902. const { shortcuts, disabledDate, format } = pickerBase.props;
  24903. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  24904. const leftDate = vue.ref(dayjs().locale(lang.value));
  24905. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit));
  24906. const {
  24907. minDate,
  24908. maxDate,
  24909. rangeState,
  24910. ppNs,
  24911. drpNs,
  24912. handleChangeRange,
  24913. handleRangeConfirm,
  24914. handleShortcutClick,
  24915. onSelect
  24916. } = useRangePicker(props, {
  24917. defaultValue,
  24918. leftDate,
  24919. rightDate,
  24920. unit,
  24921. onParsedValueChanged
  24922. });
  24923. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  24924. const {
  24925. leftPrevYear,
  24926. rightNextYear,
  24927. leftNextYear,
  24928. rightPrevYear,
  24929. leftLabel,
  24930. rightLabel,
  24931. leftYear,
  24932. rightYear
  24933. } = useMonthRangeHeader({
  24934. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  24935. leftDate,
  24936. rightDate
  24937. });
  24938. const enableYearArrow = vue.computed(() => {
  24939. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  24940. });
  24941. const handleRangePick = (val, close = true) => {
  24942. const minDate_ = val.minDate;
  24943. const maxDate_ = val.maxDate;
  24944. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  24945. return;
  24946. }
  24947. maxDate.value = maxDate_;
  24948. minDate.value = minDate_;
  24949. if (!close)
  24950. return;
  24951. handleRangeConfirm();
  24952. };
  24953. const formatToString = (days) => {
  24954. return days.map((day) => day.format(format));
  24955. };
  24956. function onParsedValueChanged(minDate2, maxDate2) {
  24957. if (props.unlinkPanels && maxDate2) {
  24958. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  24959. const maxDateYear = maxDate2.year();
  24960. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit) : maxDate2;
  24961. } else {
  24962. rightDate.value = leftDate.value.add(1, unit);
  24963. }
  24964. }
  24965. emit("set-picker-option", ["formatToString", formatToString]);
  24966. return (_ctx, _cache) => {
  24967. return vue.openBlock(), vue.createElementBlock("div", {
  24968. class: vue.normalizeClass([
  24969. vue.unref(ppNs).b(),
  24970. vue.unref(drpNs).b(),
  24971. {
  24972. "has-sidebar": Boolean(_ctx.$slots.sidebar) || vue.unref(hasShortcuts)
  24973. }
  24974. ])
  24975. }, [
  24976. vue.createElementVNode("div", {
  24977. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  24978. }, [
  24979. vue.renderSlot(_ctx.$slots, "sidebar", {
  24980. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  24981. }),
  24982. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  24983. key: 0,
  24984. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  24985. }, [
  24986. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  24987. return vue.openBlock(), vue.createElementBlock("button", {
  24988. key,
  24989. type: "button",
  24990. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  24991. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  24992. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$E);
  24993. }), 128))
  24994. ], 2)) : vue.createCommentVNode("v-if", true),
  24995. vue.createElementVNode("div", {
  24996. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  24997. }, [
  24998. vue.createElementVNode("div", {
  24999. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  25000. }, [
  25001. vue.createElementVNode("div", {
  25002. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  25003. }, [
  25004. vue.createElementVNode("button", {
  25005. type: "button",
  25006. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  25007. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(leftPrevYear) && vue.unref(leftPrevYear)(...args))
  25008. }, [
  25009. vue.createVNode(vue.unref(ElIcon), null, {
  25010. default: vue.withCtx(() => [
  25011. vue.createVNode(vue.unref(d_arrow_left_default))
  25012. ]),
  25013. _: 1
  25014. })
  25015. ], 2),
  25016. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  25017. key: 0,
  25018. type: "button",
  25019. disabled: !vue.unref(enableYearArrow),
  25020. class: vue.normalizeClass([[
  25021. vue.unref(ppNs).e("icon-btn"),
  25022. { [vue.unref(ppNs).is("disabled")]: !vue.unref(enableYearArrow) }
  25023. ], "d-arrow-right"]),
  25024. onClick: _cache[1] || (_cache[1] = (...args) => vue.unref(leftNextYear) && vue.unref(leftNextYear)(...args))
  25025. }, [
  25026. vue.createVNode(vue.unref(ElIcon), null, {
  25027. default: vue.withCtx(() => [
  25028. vue.createVNode(vue.unref(d_arrow_right_default))
  25029. ]),
  25030. _: 1
  25031. })
  25032. ], 10, _hoisted_2$o)) : vue.createCommentVNode("v-if", true),
  25033. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  25034. ], 2),
  25035. vue.createVNode(MonthTable, {
  25036. "selection-mode": "range",
  25037. date: leftDate.value,
  25038. "min-date": vue.unref(minDate),
  25039. "max-date": vue.unref(maxDate),
  25040. "range-state": vue.unref(rangeState),
  25041. "disabled-date": vue.unref(disabledDate),
  25042. onChangerange: vue.unref(handleChangeRange),
  25043. onPick: handleRangePick,
  25044. onSelect: vue.unref(onSelect)
  25045. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  25046. ], 2),
  25047. vue.createElementVNode("div", {
  25048. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  25049. }, [
  25050. vue.createElementVNode("div", {
  25051. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  25052. }, [
  25053. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  25054. key: 0,
  25055. type: "button",
  25056. disabled: !vue.unref(enableYearArrow),
  25057. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  25058. onClick: _cache[2] || (_cache[2] = (...args) => vue.unref(rightPrevYear) && vue.unref(rightPrevYear)(...args))
  25059. }, [
  25060. vue.createVNode(vue.unref(ElIcon), null, {
  25061. default: vue.withCtx(() => [
  25062. vue.createVNode(vue.unref(d_arrow_left_default))
  25063. ]),
  25064. _: 1
  25065. })
  25066. ], 10, _hoisted_3$a)) : vue.createCommentVNode("v-if", true),
  25067. vue.createElementVNode("button", {
  25068. type: "button",
  25069. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  25070. onClick: _cache[3] || (_cache[3] = (...args) => vue.unref(rightNextYear) && vue.unref(rightNextYear)(...args))
  25071. }, [
  25072. vue.createVNode(vue.unref(ElIcon), null, {
  25073. default: vue.withCtx(() => [
  25074. vue.createVNode(vue.unref(d_arrow_right_default))
  25075. ]),
  25076. _: 1
  25077. })
  25078. ], 2),
  25079. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  25080. ], 2),
  25081. vue.createVNode(MonthTable, {
  25082. "selection-mode": "range",
  25083. date: rightDate.value,
  25084. "min-date": vue.unref(minDate),
  25085. "max-date": vue.unref(maxDate),
  25086. "range-state": vue.unref(rangeState),
  25087. "disabled-date": vue.unref(disabledDate),
  25088. onChangerange: vue.unref(handleChangeRange),
  25089. onPick: handleRangePick,
  25090. onSelect: vue.unref(onSelect)
  25091. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  25092. ], 2)
  25093. ], 2)
  25094. ], 2)
  25095. ], 2);
  25096. };
  25097. }
  25098. });
  25099. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["__file", "panel-month-range.vue"]]);
  25100. const getPanel = function(type) {
  25101. switch (type) {
  25102. case "daterange":
  25103. case "datetimerange": {
  25104. return DateRangePickPanel;
  25105. }
  25106. case "monthrange": {
  25107. return MonthRangePickPanel;
  25108. }
  25109. default: {
  25110. return DatePickPanel;
  25111. }
  25112. }
  25113. };
  25114. dayjs.extend(localeData);
  25115. dayjs.extend(advancedFormat);
  25116. dayjs.extend(customParseFormat);
  25117. dayjs.extend(weekOfYear);
  25118. dayjs.extend(weekYear);
  25119. dayjs.extend(dayOfYear);
  25120. dayjs.extend(isSameOrAfter);
  25121. dayjs.extend(isSameOrBefore);
  25122. var DatePicker = vue.defineComponent({
  25123. name: "ElDatePicker",
  25124. install: null,
  25125. props: {
  25126. ...timePickerDefaultProps,
  25127. ...datePickerProps
  25128. },
  25129. emits: ["update:modelValue"],
  25130. setup(props, {
  25131. expose,
  25132. emit,
  25133. slots
  25134. }) {
  25135. const ns = useNamespace("picker-panel");
  25136. vue.provide("ElPopperOptions", vue.reactive(vue.toRef(props, "popperOptions")));
  25137. vue.provide(ROOT_PICKER_INJECTION_KEY, {
  25138. slots,
  25139. pickerNs: ns
  25140. });
  25141. const commonPicker = vue.ref();
  25142. const refProps = {
  25143. focus: (focusStartInput = true) => {
  25144. var _a;
  25145. (_a = commonPicker.value) == null ? void 0 : _a.focus(focusStartInput);
  25146. },
  25147. handleOpen: () => {
  25148. var _a;
  25149. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  25150. },
  25151. handleClose: () => {
  25152. var _a;
  25153. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  25154. }
  25155. };
  25156. expose(refProps);
  25157. const onModelValueUpdated = (val) => {
  25158. emit("update:modelValue", val);
  25159. };
  25160. return () => {
  25161. var _a;
  25162. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  25163. const Component = getPanel(props.type);
  25164. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  25165. "format": format,
  25166. "type": props.type,
  25167. "ref": commonPicker,
  25168. "onUpdate:modelValue": onModelValueUpdated
  25169. }), {
  25170. default: (scopedProps) => vue.createVNode(Component, scopedProps, null),
  25171. "range-separator": slots["range-separator"]
  25172. });
  25173. };
  25174. }
  25175. });
  25176. const _DatePicker = DatePicker;
  25177. _DatePicker.install = (app) => {
  25178. app.component(_DatePicker.name, _DatePicker);
  25179. };
  25180. const ElDatePicker = _DatePicker;
  25181. const descriptionsKey = "elDescriptions";
  25182. var ElDescriptionsCell = vue.defineComponent({
  25183. name: "ElDescriptionsCell",
  25184. props: {
  25185. cell: {
  25186. type: Object
  25187. },
  25188. tag: {
  25189. type: String
  25190. },
  25191. type: {
  25192. type: String
  25193. }
  25194. },
  25195. setup() {
  25196. const descriptions = vue.inject(descriptionsKey, {});
  25197. return {
  25198. descriptions
  25199. };
  25200. },
  25201. render() {
  25202. var _a, _b, _c, _d, _e, _f;
  25203. const item = getNormalizedProps(this.cell);
  25204. const { border, direction } = this.descriptions;
  25205. const isVertical = direction === "vertical";
  25206. const label = ((_c = (_b = (_a = this.cell) == null ? void 0 : _a.children) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b)) || item.label;
  25207. const content = (_f = (_e = (_d = this.cell) == null ? void 0 : _d.children) == null ? void 0 : _e.default) == null ? void 0 : _f.call(_e);
  25208. const span = item.span;
  25209. const align = item.align ? `is-${item.align}` : "";
  25210. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  25211. const className = item.className;
  25212. const labelClassName = item.labelClassName;
  25213. const style = {
  25214. width: addUnit(item.width),
  25215. minWidth: addUnit(item.minWidth)
  25216. };
  25217. const ns = useNamespace("descriptions");
  25218. switch (this.type) {
  25219. case "label":
  25220. return vue.h(this.tag, {
  25221. style,
  25222. class: [
  25223. ns.e("cell"),
  25224. ns.e("label"),
  25225. ns.is("bordered-label", border),
  25226. ns.is("vertical-label", isVertical),
  25227. labelAlign,
  25228. labelClassName
  25229. ],
  25230. colSpan: isVertical ? span : 1
  25231. }, label);
  25232. case "content":
  25233. return vue.h(this.tag, {
  25234. style,
  25235. class: [
  25236. ns.e("cell"),
  25237. ns.e("content"),
  25238. ns.is("bordered-content", border),
  25239. ns.is("vertical-content", isVertical),
  25240. align,
  25241. className
  25242. ],
  25243. colSpan: isVertical ? span : span * 2 - 1
  25244. }, content);
  25245. default:
  25246. return vue.h("td", {
  25247. style,
  25248. class: [ns.e("cell"), align],
  25249. colSpan: span
  25250. }, [
  25251. vue.h("span", {
  25252. class: [ns.e("label"), labelClassName]
  25253. }, label),
  25254. vue.h("span", {
  25255. class: [ns.e("content"), className]
  25256. }, content)
  25257. ]);
  25258. }
  25259. }
  25260. });
  25261. const descriptionsRowProps = buildProps({
  25262. row: {
  25263. type: Array,
  25264. default: () => []
  25265. }
  25266. });
  25267. const _hoisted_1$D = { key: 1 };
  25268. const __default__$P = vue.defineComponent({
  25269. name: "ElDescriptionsRow"
  25270. });
  25271. const _sfc_main$1f = /* @__PURE__ */ vue.defineComponent({
  25272. ...__default__$P,
  25273. props: descriptionsRowProps,
  25274. setup(__props) {
  25275. const descriptions = vue.inject(descriptionsKey, {});
  25276. return (_ctx, _cache) => {
  25277. return vue.unref(descriptions).direction === "vertical" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  25278. vue.createElementVNode("tr", null, [
  25279. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => {
  25280. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  25281. key: `tr1-${index}`,
  25282. cell,
  25283. tag: "th",
  25284. type: "label"
  25285. }, null, 8, ["cell"]);
  25286. }), 128))
  25287. ]),
  25288. vue.createElementVNode("tr", null, [
  25289. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => {
  25290. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  25291. key: `tr2-${index}`,
  25292. cell,
  25293. tag: "td",
  25294. type: "content"
  25295. }, null, 8, ["cell"]);
  25296. }), 128))
  25297. ])
  25298. ], 64)) : (vue.openBlock(), vue.createElementBlock("tr", _hoisted_1$D, [
  25299. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => {
  25300. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  25301. key: `tr3-${index}`
  25302. }, [
  25303. vue.unref(descriptions).border ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  25304. vue.createVNode(vue.unref(ElDescriptionsCell), {
  25305. cell,
  25306. tag: "td",
  25307. type: "label"
  25308. }, null, 8, ["cell"]),
  25309. vue.createVNode(vue.unref(ElDescriptionsCell), {
  25310. cell,
  25311. tag: "td",
  25312. type: "content"
  25313. }, null, 8, ["cell"])
  25314. ], 64)) : (vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  25315. key: 1,
  25316. cell,
  25317. tag: "td",
  25318. type: "both"
  25319. }, null, 8, ["cell"]))
  25320. ], 64);
  25321. }), 128))
  25322. ]));
  25323. };
  25324. }
  25325. });
  25326. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["__file", "descriptions-row.vue"]]);
  25327. const descriptionProps = buildProps({
  25328. border: {
  25329. type: Boolean,
  25330. default: false
  25331. },
  25332. column: {
  25333. type: Number,
  25334. default: 3
  25335. },
  25336. direction: {
  25337. type: String,
  25338. values: ["horizontal", "vertical"],
  25339. default: "horizontal"
  25340. },
  25341. size: useSizeProp,
  25342. title: {
  25343. type: String,
  25344. default: ""
  25345. },
  25346. extra: {
  25347. type: String,
  25348. default: ""
  25349. }
  25350. });
  25351. const __default__$O = vue.defineComponent({
  25352. name: "ElDescriptions"
  25353. });
  25354. const _sfc_main$1e = /* @__PURE__ */ vue.defineComponent({
  25355. ...__default__$O,
  25356. props: descriptionProps,
  25357. setup(__props) {
  25358. const props = __props;
  25359. const ns = useNamespace("descriptions");
  25360. const descriptionsSize = useSize();
  25361. const slots = vue.useSlots();
  25362. vue.provide(descriptionsKey, props);
  25363. const descriptionKls = vue.computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  25364. const filledNode = (node, span, count, isLast = false) => {
  25365. if (!node.props) {
  25366. node.props = {};
  25367. }
  25368. if (span > count) {
  25369. node.props.span = count;
  25370. }
  25371. if (isLast) {
  25372. node.props.span = span;
  25373. }
  25374. return node;
  25375. };
  25376. const getRows = () => {
  25377. var _a;
  25378. const children = flattedChildren((_a = slots.default) == null ? void 0 : _a.call(slots)).filter((node) => {
  25379. var _a2;
  25380. return ((_a2 = node == null ? void 0 : node.type) == null ? void 0 : _a2.name) === "ElDescriptionsItem";
  25381. });
  25382. const rows = [];
  25383. let temp = [];
  25384. let count = props.column;
  25385. let totalSpan = 0;
  25386. children.forEach((node, index) => {
  25387. var _a2;
  25388. const span = ((_a2 = node.props) == null ? void 0 : _a2.span) || 1;
  25389. if (index < children.length - 1) {
  25390. totalSpan += span > count ? count : span;
  25391. }
  25392. if (index === children.length - 1) {
  25393. const lastSpan = props.column - totalSpan % props.column;
  25394. temp.push(filledNode(node, lastSpan, count, true));
  25395. rows.push(temp);
  25396. return;
  25397. }
  25398. if (span < count) {
  25399. count -= span;
  25400. temp.push(node);
  25401. } else {
  25402. temp.push(filledNode(node, span, count));
  25403. rows.push(temp);
  25404. count = props.column;
  25405. temp = [];
  25406. }
  25407. });
  25408. return rows;
  25409. };
  25410. return (_ctx, _cache) => {
  25411. return vue.openBlock(), vue.createElementBlock("div", {
  25412. class: vue.normalizeClass(vue.unref(descriptionKls))
  25413. }, [
  25414. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  25415. key: 0,
  25416. class: vue.normalizeClass(vue.unref(ns).e("header"))
  25417. }, [
  25418. vue.createElementVNode("div", {
  25419. class: vue.normalizeClass(vue.unref(ns).e("title"))
  25420. }, [
  25421. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  25422. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  25423. ])
  25424. ], 2),
  25425. vue.createElementVNode("div", {
  25426. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  25427. }, [
  25428. vue.renderSlot(_ctx.$slots, "extra", {}, () => [
  25429. vue.createTextVNode(vue.toDisplayString(_ctx.extra), 1)
  25430. ])
  25431. ], 2)
  25432. ], 2)) : vue.createCommentVNode("v-if", true),
  25433. vue.createElementVNode("div", {
  25434. class: vue.normalizeClass(vue.unref(ns).e("body"))
  25435. }, [
  25436. vue.createElementVNode("table", {
  25437. class: vue.normalizeClass([vue.unref(ns).e("table"), vue.unref(ns).is("bordered", _ctx.border)])
  25438. }, [
  25439. vue.createElementVNode("tbody", null, [
  25440. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getRows(), (row, index) => {
  25441. return vue.openBlock(), vue.createBlock(ElDescriptionsRow, {
  25442. key: index,
  25443. row
  25444. }, null, 8, ["row"]);
  25445. }), 128))
  25446. ])
  25447. ], 2)
  25448. ], 2)
  25449. ], 2);
  25450. };
  25451. }
  25452. });
  25453. var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["__file", "description.vue"]]);
  25454. var DescriptionsItem = vue.defineComponent({
  25455. name: "ElDescriptionsItem",
  25456. props: {
  25457. label: {
  25458. type: String,
  25459. default: ""
  25460. },
  25461. span: {
  25462. type: Number,
  25463. default: 1
  25464. },
  25465. width: {
  25466. type: [String, Number],
  25467. default: ""
  25468. },
  25469. minWidth: {
  25470. type: [String, Number],
  25471. default: ""
  25472. },
  25473. align: {
  25474. type: String,
  25475. default: "left"
  25476. },
  25477. labelAlign: {
  25478. type: String,
  25479. default: ""
  25480. },
  25481. className: {
  25482. type: String,
  25483. default: ""
  25484. },
  25485. labelClassName: {
  25486. type: String,
  25487. default: ""
  25488. }
  25489. }
  25490. });
  25491. const ElDescriptions = withInstall(Descriptions, {
  25492. DescriptionsItem
  25493. });
  25494. const ElDescriptionsItem = withNoopInstall(DescriptionsItem);
  25495. const overlayProps = buildProps({
  25496. mask: {
  25497. type: Boolean,
  25498. default: true
  25499. },
  25500. customMaskEvent: {
  25501. type: Boolean,
  25502. default: false
  25503. },
  25504. overlayClass: {
  25505. type: definePropType([
  25506. String,
  25507. Array,
  25508. Object
  25509. ])
  25510. },
  25511. zIndex: {
  25512. type: definePropType([String, Number])
  25513. }
  25514. });
  25515. const overlayEmits = {
  25516. click: (evt) => evt instanceof MouseEvent
  25517. };
  25518. var Overlay$1 = vue.defineComponent({
  25519. name: "ElOverlay",
  25520. props: overlayProps,
  25521. emits: overlayEmits,
  25522. setup(props, { slots, emit }) {
  25523. const ns = useNamespace("overlay");
  25524. const onMaskClick = (e) => {
  25525. emit("click", e);
  25526. };
  25527. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  25528. return () => {
  25529. return props.mask ? vue.createVNode("div", {
  25530. class: [ns.b(), props.overlayClass],
  25531. style: {
  25532. zIndex: props.zIndex
  25533. },
  25534. onClick,
  25535. onMousedown,
  25536. onMouseup
  25537. }, [vue.renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : vue.h("div", {
  25538. class: props.overlayClass,
  25539. style: {
  25540. zIndex: props.zIndex,
  25541. position: "fixed",
  25542. top: "0px",
  25543. right: "0px",
  25544. bottom: "0px",
  25545. left: "0px"
  25546. }
  25547. }, [vue.renderSlot(slots, "default")]);
  25548. };
  25549. }
  25550. });
  25551. const ElOverlay = Overlay$1;
  25552. const dialogContentProps = buildProps({
  25553. center: {
  25554. type: Boolean,
  25555. default: false
  25556. },
  25557. alignCenter: {
  25558. type: Boolean,
  25559. default: false
  25560. },
  25561. closeIcon: {
  25562. type: iconPropType
  25563. },
  25564. customClass: {
  25565. type: String,
  25566. default: ""
  25567. },
  25568. draggable: {
  25569. type: Boolean,
  25570. default: false
  25571. },
  25572. fullscreen: {
  25573. type: Boolean,
  25574. default: false
  25575. },
  25576. showClose: {
  25577. type: Boolean,
  25578. default: true
  25579. },
  25580. title: {
  25581. type: String,
  25582. default: ""
  25583. }
  25584. });
  25585. const dialogContentEmits = {
  25586. close: () => true
  25587. };
  25588. const _hoisted_1$C = ["aria-label"];
  25589. const _hoisted_2$n = ["id"];
  25590. const __default__$N = vue.defineComponent({ name: "ElDialogContent" });
  25591. const _sfc_main$1d = /* @__PURE__ */ vue.defineComponent({
  25592. ...__default__$N,
  25593. props: dialogContentProps,
  25594. emits: dialogContentEmits,
  25595. setup(__props) {
  25596. const props = __props;
  25597. const { t } = useLocale();
  25598. const { Close } = CloseComponents;
  25599. const { dialogRef, headerRef, bodyId, ns, style } = vue.inject(dialogInjectionKey);
  25600. const { focusTrapRef } = vue.inject(FOCUS_TRAP_INJECTION_KEY);
  25601. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  25602. const draggable = vue.computed(() => props.draggable);
  25603. useDraggable(dialogRef, headerRef, draggable);
  25604. return (_ctx, _cache) => {
  25605. return vue.openBlock(), vue.createElementBlock("div", {
  25606. ref: vue.unref(composedDialogRef),
  25607. class: vue.normalizeClass([
  25608. vue.unref(ns).b(),
  25609. vue.unref(ns).is("fullscreen", _ctx.fullscreen),
  25610. vue.unref(ns).is("draggable", vue.unref(draggable)),
  25611. vue.unref(ns).is("align-center", _ctx.alignCenter),
  25612. { [vue.unref(ns).m("center")]: _ctx.center },
  25613. _ctx.customClass
  25614. ]),
  25615. style: vue.normalizeStyle(vue.unref(style)),
  25616. tabindex: "-1"
  25617. }, [
  25618. vue.createElementVNode("header", {
  25619. ref_key: "headerRef",
  25620. ref: headerRef,
  25621. class: vue.normalizeClass(vue.unref(ns).e("header"))
  25622. }, [
  25623. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  25624. vue.createElementVNode("span", {
  25625. role: "heading",
  25626. class: vue.normalizeClass(vue.unref(ns).e("title"))
  25627. }, vue.toDisplayString(_ctx.title), 3)
  25628. ]),
  25629. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  25630. key: 0,
  25631. "aria-label": vue.unref(t)("el.dialog.close"),
  25632. class: vue.normalizeClass(vue.unref(ns).e("headerbtn")),
  25633. type: "button",
  25634. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  25635. }, [
  25636. vue.createVNode(vue.unref(ElIcon), {
  25637. class: vue.normalizeClass(vue.unref(ns).e("close"))
  25638. }, {
  25639. default: vue.withCtx(() => [
  25640. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon || vue.unref(Close))))
  25641. ]),
  25642. _: 1
  25643. }, 8, ["class"])
  25644. ], 10, _hoisted_1$C)) : vue.createCommentVNode("v-if", true)
  25645. ], 2),
  25646. vue.createElementVNode("div", {
  25647. id: vue.unref(bodyId),
  25648. class: vue.normalizeClass(vue.unref(ns).e("body"))
  25649. }, [
  25650. vue.renderSlot(_ctx.$slots, "default")
  25651. ], 10, _hoisted_2$n),
  25652. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("footer", {
  25653. key: 0,
  25654. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  25655. }, [
  25656. vue.renderSlot(_ctx.$slots, "footer")
  25657. ], 2)) : vue.createCommentVNode("v-if", true)
  25658. ], 6);
  25659. };
  25660. }
  25661. });
  25662. var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__file", "dialog-content.vue"]]);
  25663. const dialogProps = buildProps({
  25664. ...dialogContentProps,
  25665. appendToBody: {
  25666. type: Boolean,
  25667. default: false
  25668. },
  25669. beforeClose: {
  25670. type: definePropType(Function)
  25671. },
  25672. destroyOnClose: {
  25673. type: Boolean,
  25674. default: false
  25675. },
  25676. closeOnClickModal: {
  25677. type: Boolean,
  25678. default: true
  25679. },
  25680. closeOnPressEscape: {
  25681. type: Boolean,
  25682. default: true
  25683. },
  25684. lockScroll: {
  25685. type: Boolean,
  25686. default: true
  25687. },
  25688. modal: {
  25689. type: Boolean,
  25690. default: true
  25691. },
  25692. openDelay: {
  25693. type: Number,
  25694. default: 0
  25695. },
  25696. closeDelay: {
  25697. type: Number,
  25698. default: 0
  25699. },
  25700. top: {
  25701. type: String
  25702. },
  25703. modelValue: {
  25704. type: Boolean,
  25705. default: false
  25706. },
  25707. modalClass: String,
  25708. width: {
  25709. type: [String, Number]
  25710. },
  25711. zIndex: {
  25712. type: Number
  25713. },
  25714. trapFocus: {
  25715. type: Boolean,
  25716. default: false
  25717. }
  25718. });
  25719. const dialogEmits = {
  25720. open: () => true,
  25721. opened: () => true,
  25722. close: () => true,
  25723. closed: () => true,
  25724. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  25725. openAutoFocus: () => true,
  25726. closeAutoFocus: () => true
  25727. };
  25728. const useDialog = (props, targetRef) => {
  25729. const instance = vue.getCurrentInstance();
  25730. const emit = instance.emit;
  25731. const { nextZIndex } = useZIndex();
  25732. let lastPosition = "";
  25733. const titleId = useId();
  25734. const bodyId = useId();
  25735. const visible = vue.ref(false);
  25736. const closed = vue.ref(false);
  25737. const rendered = vue.ref(false);
  25738. const zIndex = vue.ref(props.zIndex || nextZIndex());
  25739. let openTimer = void 0;
  25740. let closeTimer = void 0;
  25741. const namespace = useGlobalConfig("namespace", defaultNamespace);
  25742. const style = vue.computed(() => {
  25743. const style2 = {};
  25744. const varPrefix = `--${namespace.value}-dialog`;
  25745. if (!props.fullscreen) {
  25746. if (props.top) {
  25747. style2[`${varPrefix}-margin-top`] = props.top;
  25748. }
  25749. if (props.width) {
  25750. style2[`${varPrefix}-width`] = addUnit(props.width);
  25751. }
  25752. }
  25753. return style2;
  25754. });
  25755. const overlayDialogStyle = vue.computed(() => {
  25756. if (props.alignCenter) {
  25757. return { display: "flex" };
  25758. }
  25759. return {};
  25760. });
  25761. function afterEnter() {
  25762. emit("opened");
  25763. }
  25764. function afterLeave() {
  25765. emit("closed");
  25766. emit(UPDATE_MODEL_EVENT, false);
  25767. if (props.destroyOnClose) {
  25768. rendered.value = false;
  25769. }
  25770. }
  25771. function beforeLeave() {
  25772. emit("close");
  25773. }
  25774. function open() {
  25775. closeTimer == null ? void 0 : closeTimer();
  25776. openTimer == null ? void 0 : openTimer();
  25777. if (props.openDelay && props.openDelay > 0) {
  25778. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  25779. } else {
  25780. doOpen();
  25781. }
  25782. }
  25783. function close() {
  25784. openTimer == null ? void 0 : openTimer();
  25785. closeTimer == null ? void 0 : closeTimer();
  25786. if (props.closeDelay && props.closeDelay > 0) {
  25787. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  25788. } else {
  25789. doClose();
  25790. }
  25791. }
  25792. function handleClose() {
  25793. function hide(shouldCancel) {
  25794. if (shouldCancel)
  25795. return;
  25796. closed.value = true;
  25797. visible.value = false;
  25798. }
  25799. if (props.beforeClose) {
  25800. props.beforeClose(hide);
  25801. } else {
  25802. close();
  25803. }
  25804. }
  25805. function onModalClick() {
  25806. if (props.closeOnClickModal) {
  25807. handleClose();
  25808. }
  25809. }
  25810. function doOpen() {
  25811. if (!isClient)
  25812. return;
  25813. visible.value = true;
  25814. }
  25815. function doClose() {
  25816. visible.value = false;
  25817. }
  25818. function onOpenAutoFocus() {
  25819. emit("openAutoFocus");
  25820. }
  25821. function onCloseAutoFocus() {
  25822. emit("closeAutoFocus");
  25823. }
  25824. function onFocusoutPrevented(event) {
  25825. var _a;
  25826. if (((_a = event.detail) == null ? void 0 : _a.focusReason) === "pointer") {
  25827. event.preventDefault();
  25828. }
  25829. }
  25830. if (props.lockScroll) {
  25831. useLockscreen(visible);
  25832. }
  25833. function onCloseRequested() {
  25834. if (props.closeOnPressEscape) {
  25835. handleClose();
  25836. }
  25837. }
  25838. vue.watch(() => props.modelValue, (val) => {
  25839. if (val) {
  25840. closed.value = false;
  25841. open();
  25842. rendered.value = true;
  25843. zIndex.value = props.zIndex ? zIndex.value++ : nextZIndex();
  25844. vue.nextTick(() => {
  25845. emit("open");
  25846. if (targetRef.value) {
  25847. targetRef.value.scrollTop = 0;
  25848. }
  25849. });
  25850. } else {
  25851. if (visible.value) {
  25852. close();
  25853. }
  25854. }
  25855. });
  25856. vue.watch(() => props.fullscreen, (val) => {
  25857. if (!targetRef.value)
  25858. return;
  25859. if (val) {
  25860. lastPosition = targetRef.value.style.transform;
  25861. targetRef.value.style.transform = "";
  25862. } else {
  25863. targetRef.value.style.transform = lastPosition;
  25864. }
  25865. });
  25866. vue.onMounted(() => {
  25867. if (props.modelValue) {
  25868. visible.value = true;
  25869. rendered.value = true;
  25870. open();
  25871. }
  25872. });
  25873. return {
  25874. afterEnter,
  25875. afterLeave,
  25876. beforeLeave,
  25877. handleClose,
  25878. onModalClick,
  25879. close,
  25880. doClose,
  25881. onOpenAutoFocus,
  25882. onCloseAutoFocus,
  25883. onCloseRequested,
  25884. onFocusoutPrevented,
  25885. titleId,
  25886. bodyId,
  25887. closed,
  25888. style,
  25889. overlayDialogStyle,
  25890. rendered,
  25891. visible,
  25892. zIndex
  25893. };
  25894. };
  25895. const _hoisted_1$B = ["aria-label", "aria-labelledby", "aria-describedby"];
  25896. const __default__$M = vue.defineComponent({
  25897. name: "ElDialog",
  25898. inheritAttrs: false
  25899. });
  25900. const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
  25901. ...__default__$M,
  25902. props: dialogProps,
  25903. emits: dialogEmits,
  25904. setup(__props, { expose }) {
  25905. const props = __props;
  25906. const slots = vue.useSlots();
  25907. useDeprecated({
  25908. scope: "el-dialog",
  25909. from: "the title slot",
  25910. replacement: "the header slot",
  25911. version: "3.0.0",
  25912. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  25913. }, vue.computed(() => !!slots.title));
  25914. useDeprecated({
  25915. scope: "el-dialog",
  25916. from: "custom-class",
  25917. replacement: "class",
  25918. version: "2.3.0",
  25919. ref: "https://element-plus.org/en-US/component/dialog.html#attributes",
  25920. type: "Attribute"
  25921. }, vue.computed(() => !!props.customClass));
  25922. const ns = useNamespace("dialog");
  25923. const dialogRef = vue.ref();
  25924. const headerRef = vue.ref();
  25925. const dialogContentRef = vue.ref();
  25926. const {
  25927. visible,
  25928. titleId,
  25929. bodyId,
  25930. style,
  25931. overlayDialogStyle,
  25932. rendered,
  25933. zIndex,
  25934. afterEnter,
  25935. afterLeave,
  25936. beforeLeave,
  25937. handleClose,
  25938. onModalClick,
  25939. onOpenAutoFocus,
  25940. onCloseAutoFocus,
  25941. onCloseRequested,
  25942. onFocusoutPrevented
  25943. } = useDialog(props, dialogRef);
  25944. vue.provide(dialogInjectionKey, {
  25945. dialogRef,
  25946. headerRef,
  25947. bodyId,
  25948. ns,
  25949. rendered,
  25950. style
  25951. });
  25952. const overlayEvent = useSameTarget(onModalClick);
  25953. const draggable = vue.computed(() => props.draggable && !props.fullscreen);
  25954. expose({
  25955. visible,
  25956. dialogContentRef
  25957. });
  25958. return (_ctx, _cache) => {
  25959. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  25960. to: "body",
  25961. disabled: !_ctx.appendToBody
  25962. }, [
  25963. vue.createVNode(vue.Transition, {
  25964. name: "dialog-fade",
  25965. onAfterEnter: vue.unref(afterEnter),
  25966. onAfterLeave: vue.unref(afterLeave),
  25967. onBeforeLeave: vue.unref(beforeLeave),
  25968. persisted: ""
  25969. }, {
  25970. default: vue.withCtx(() => [
  25971. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  25972. "custom-mask-event": "",
  25973. mask: _ctx.modal,
  25974. "overlay-class": _ctx.modalClass,
  25975. "z-index": vue.unref(zIndex)
  25976. }, {
  25977. default: vue.withCtx(() => [
  25978. vue.createElementVNode("div", {
  25979. role: "dialog",
  25980. "aria-modal": "true",
  25981. "aria-label": _ctx.title || void 0,
  25982. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  25983. "aria-describedby": vue.unref(bodyId),
  25984. class: vue.normalizeClass(`${vue.unref(ns).namespace.value}-overlay-dialog`),
  25985. style: vue.normalizeStyle(vue.unref(overlayDialogStyle)),
  25986. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(overlayEvent).onClick && vue.unref(overlayEvent).onClick(...args)),
  25987. onMousedown: _cache[1] || (_cache[1] = (...args) => vue.unref(overlayEvent).onMousedown && vue.unref(overlayEvent).onMousedown(...args)),
  25988. onMouseup: _cache[2] || (_cache[2] = (...args) => vue.unref(overlayEvent).onMouseup && vue.unref(overlayEvent).onMouseup(...args))
  25989. }, [
  25990. vue.createVNode(vue.unref(ElFocusTrap), {
  25991. loop: "",
  25992. trapped: vue.unref(visible),
  25993. "focus-start-el": "container",
  25994. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  25995. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  25996. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  25997. onReleaseRequested: vue.unref(onCloseRequested)
  25998. }, {
  25999. default: vue.withCtx(() => [
  26000. vue.unref(rendered) ? (vue.openBlock(), vue.createBlock(ElDialogContent, vue.mergeProps({
  26001. key: 0,
  26002. ref_key: "dialogContentRef",
  26003. ref: dialogContentRef
  26004. }, _ctx.$attrs, {
  26005. "custom-class": _ctx.customClass,
  26006. center: _ctx.center,
  26007. "align-center": _ctx.alignCenter,
  26008. "close-icon": _ctx.closeIcon,
  26009. draggable: vue.unref(draggable),
  26010. fullscreen: _ctx.fullscreen,
  26011. "show-close": _ctx.showClose,
  26012. title: _ctx.title,
  26013. onClose: vue.unref(handleClose)
  26014. }), vue.createSlots({
  26015. header: vue.withCtx(() => [
  26016. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  26017. key: 0,
  26018. close: vue.unref(handleClose),
  26019. titleId: vue.unref(titleId),
  26020. titleClass: vue.unref(ns).e("title")
  26021. }) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  26022. ]),
  26023. default: vue.withCtx(() => [
  26024. vue.renderSlot(_ctx.$slots, "default")
  26025. ]),
  26026. _: 2
  26027. }, [
  26028. _ctx.$slots.footer ? {
  26029. name: "footer",
  26030. fn: vue.withCtx(() => [
  26031. vue.renderSlot(_ctx.$slots, "footer")
  26032. ])
  26033. } : void 0
  26034. ]), 1040, ["custom-class", "center", "align-center", "close-icon", "draggable", "fullscreen", "show-close", "title", "onClose"])) : vue.createCommentVNode("v-if", true)
  26035. ]),
  26036. _: 3
  26037. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  26038. ], 46, _hoisted_1$B)
  26039. ]),
  26040. _: 3
  26041. }, 8, ["mask", "overlay-class", "z-index"]), [
  26042. [vue.vShow, vue.unref(visible)]
  26043. ])
  26044. ]),
  26045. _: 3
  26046. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  26047. ], 8, ["disabled"]);
  26048. };
  26049. }
  26050. });
  26051. var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["__file", "dialog.vue"]]);
  26052. const ElDialog = withInstall(Dialog);
  26053. const dividerProps = buildProps({
  26054. direction: {
  26055. type: String,
  26056. values: ["horizontal", "vertical"],
  26057. default: "horizontal"
  26058. },
  26059. contentPosition: {
  26060. type: String,
  26061. values: ["left", "center", "right"],
  26062. default: "center"
  26063. },
  26064. borderStyle: {
  26065. type: definePropType(String),
  26066. default: "solid"
  26067. }
  26068. });
  26069. const __default__$L = vue.defineComponent({
  26070. name: "ElDivider"
  26071. });
  26072. const _sfc_main$1b = /* @__PURE__ */ vue.defineComponent({
  26073. ...__default__$L,
  26074. props: dividerProps,
  26075. setup(__props) {
  26076. const props = __props;
  26077. const ns = useNamespace("divider");
  26078. const dividerStyle = vue.computed(() => {
  26079. return ns.cssVar({
  26080. "border-style": props.borderStyle
  26081. });
  26082. });
  26083. return (_ctx, _cache) => {
  26084. return vue.openBlock(), vue.createElementBlock("div", {
  26085. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.direction)]),
  26086. style: vue.normalizeStyle(vue.unref(dividerStyle)),
  26087. role: "separator"
  26088. }, [
  26089. _ctx.$slots.default && _ctx.direction !== "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  26090. key: 0,
  26091. class: vue.normalizeClass([vue.unref(ns).e("text"), vue.unref(ns).is(_ctx.contentPosition)])
  26092. }, [
  26093. vue.renderSlot(_ctx.$slots, "default")
  26094. ], 2)) : vue.createCommentVNode("v-if", true)
  26095. ], 6);
  26096. };
  26097. }
  26098. });
  26099. var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__file", "divider.vue"]]);
  26100. const ElDivider = withInstall(Divider);
  26101. const drawerProps = buildProps({
  26102. ...dialogProps,
  26103. direction: {
  26104. type: String,
  26105. default: "rtl",
  26106. values: ["ltr", "rtl", "ttb", "btt"]
  26107. },
  26108. size: {
  26109. type: [String, Number],
  26110. default: "30%"
  26111. },
  26112. withHeader: {
  26113. type: Boolean,
  26114. default: true
  26115. },
  26116. modalFade: {
  26117. type: Boolean,
  26118. default: true
  26119. }
  26120. });
  26121. const drawerEmits = dialogEmits;
  26122. const _sfc_main$1a = vue.defineComponent({
  26123. name: "ElDrawer",
  26124. components: {
  26125. ElOverlay,
  26126. ElFocusTrap,
  26127. ElIcon,
  26128. Close: close_default
  26129. },
  26130. inheritAttrs: false,
  26131. props: drawerProps,
  26132. emits: drawerEmits,
  26133. setup(props, { slots }) {
  26134. useDeprecated({
  26135. scope: "el-drawer",
  26136. from: "the title slot",
  26137. replacement: "the header slot",
  26138. version: "3.0.0",
  26139. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  26140. }, vue.computed(() => !!slots.title));
  26141. useDeprecated({
  26142. scope: "el-drawer",
  26143. from: "custom-class",
  26144. replacement: "class",
  26145. version: "2.3.0",
  26146. ref: "https://element-plus.org/en-US/component/drawer.html#attributes",
  26147. type: "Attribute"
  26148. }, vue.computed(() => !!props.customClass));
  26149. const drawerRef = vue.ref();
  26150. const focusStartRef = vue.ref();
  26151. const ns = useNamespace("drawer");
  26152. const { t } = useLocale();
  26153. const isHorizontal = vue.computed(() => props.direction === "rtl" || props.direction === "ltr");
  26154. const drawerSize = vue.computed(() => addUnit(props.size));
  26155. return {
  26156. ...useDialog(props, drawerRef),
  26157. drawerRef,
  26158. focusStartRef,
  26159. isHorizontal,
  26160. drawerSize,
  26161. ns,
  26162. t
  26163. };
  26164. }
  26165. });
  26166. const _hoisted_1$A = ["aria-label", "aria-labelledby", "aria-describedby"];
  26167. const _hoisted_2$m = ["id"];
  26168. const _hoisted_3$9 = ["aria-label"];
  26169. const _hoisted_4$7 = ["id"];
  26170. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  26171. const _component_close = vue.resolveComponent("close");
  26172. const _component_el_icon = vue.resolveComponent("el-icon");
  26173. const _component_el_focus_trap = vue.resolveComponent("el-focus-trap");
  26174. const _component_el_overlay = vue.resolveComponent("el-overlay");
  26175. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  26176. to: "body",
  26177. disabled: !_ctx.appendToBody
  26178. }, [
  26179. vue.createVNode(vue.Transition, {
  26180. name: _ctx.ns.b("fade"),
  26181. onAfterEnter: _ctx.afterEnter,
  26182. onAfterLeave: _ctx.afterLeave,
  26183. onBeforeLeave: _ctx.beforeLeave,
  26184. persisted: ""
  26185. }, {
  26186. default: vue.withCtx(() => [
  26187. vue.withDirectives(vue.createVNode(_component_el_overlay, {
  26188. mask: _ctx.modal,
  26189. "overlay-class": _ctx.modalClass,
  26190. "z-index": _ctx.zIndex,
  26191. onClick: _ctx.onModalClick
  26192. }, {
  26193. default: vue.withCtx(() => [
  26194. vue.createVNode(_component_el_focus_trap, {
  26195. loop: "",
  26196. trapped: _ctx.visible,
  26197. "focus-trap-el": _ctx.drawerRef,
  26198. "focus-start-el": _ctx.focusStartRef,
  26199. onReleaseRequested: _ctx.onCloseRequested
  26200. }, {
  26201. default: vue.withCtx(() => [
  26202. vue.createElementVNode("div", vue.mergeProps({
  26203. ref: "drawerRef",
  26204. "aria-modal": "true",
  26205. "aria-label": _ctx.title || void 0,
  26206. "aria-labelledby": !_ctx.title ? _ctx.titleId : void 0,
  26207. "aria-describedby": _ctx.bodyId
  26208. }, _ctx.$attrs, {
  26209. class: [_ctx.ns.b(), _ctx.direction, _ctx.visible && "open", _ctx.customClass],
  26210. style: _ctx.isHorizontal ? "width: " + _ctx.drawerSize : "height: " + _ctx.drawerSize,
  26211. role: "dialog",
  26212. onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  26213. }, ["stop"]))
  26214. }), [
  26215. vue.createElementVNode("span", {
  26216. ref: "focusStartRef",
  26217. class: vue.normalizeClass(_ctx.ns.e("sr-focus")),
  26218. tabindex: "-1"
  26219. }, null, 2),
  26220. _ctx.withHeader ? (vue.openBlock(), vue.createElementBlock("header", {
  26221. key: 0,
  26222. class: vue.normalizeClass(_ctx.ns.e("header"))
  26223. }, [
  26224. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  26225. key: 0,
  26226. close: _ctx.handleClose,
  26227. titleId: _ctx.titleId,
  26228. titleClass: _ctx.ns.e("title")
  26229. }, () => [
  26230. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  26231. key: 0,
  26232. id: _ctx.titleId,
  26233. role: "heading",
  26234. class: vue.normalizeClass(_ctx.ns.e("title"))
  26235. }, vue.toDisplayString(_ctx.title), 11, _hoisted_2$m)) : vue.createCommentVNode("v-if", true)
  26236. ]) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  26237. vue.createCommentVNode(" DEPRECATED SLOT ")
  26238. ]),
  26239. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  26240. key: 2,
  26241. "aria-label": _ctx.t("el.drawer.close"),
  26242. class: vue.normalizeClass(_ctx.ns.e("close-btn")),
  26243. type: "button",
  26244. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClose && _ctx.handleClose(...args))
  26245. }, [
  26246. vue.createVNode(_component_el_icon, {
  26247. class: vue.normalizeClass(_ctx.ns.e("close"))
  26248. }, {
  26249. default: vue.withCtx(() => [
  26250. vue.createVNode(_component_close)
  26251. ]),
  26252. _: 1
  26253. }, 8, ["class"])
  26254. ], 10, _hoisted_3$9)) : vue.createCommentVNode("v-if", true)
  26255. ], 2)) : vue.createCommentVNode("v-if", true),
  26256. _ctx.rendered ? (vue.openBlock(), vue.createElementBlock("div", {
  26257. key: 1,
  26258. id: _ctx.bodyId,
  26259. class: vue.normalizeClass(_ctx.ns.e("body"))
  26260. }, [
  26261. vue.renderSlot(_ctx.$slots, "default")
  26262. ], 10, _hoisted_4$7)) : vue.createCommentVNode("v-if", true),
  26263. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  26264. key: 2,
  26265. class: vue.normalizeClass(_ctx.ns.e("footer"))
  26266. }, [
  26267. vue.renderSlot(_ctx.$slots, "footer")
  26268. ], 2)) : vue.createCommentVNode("v-if", true)
  26269. ], 16, _hoisted_1$A)
  26270. ]),
  26271. _: 3
  26272. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  26273. ]),
  26274. _: 3
  26275. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  26276. [vue.vShow, _ctx.visible]
  26277. ])
  26278. ]),
  26279. _: 3
  26280. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  26281. ], 8, ["disabled"]);
  26282. }
  26283. var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["render", _sfc_render$p], ["__file", "drawer.vue"]]);
  26284. const ElDrawer = withInstall(Drawer);
  26285. const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
  26286. inheritAttrs: false
  26287. });
  26288. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  26289. return vue.renderSlot(_ctx.$slots, "default");
  26290. }
  26291. var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["render", _sfc_render$o], ["__file", "collection.vue"]]);
  26292. const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
  26293. name: "ElCollectionItem",
  26294. inheritAttrs: false
  26295. });
  26296. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  26297. return vue.renderSlot(_ctx.$slots, "default");
  26298. }
  26299. var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["render", _sfc_render$n], ["__file", "collection-item.vue"]]);
  26300. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  26301. const createCollectionWithScope = (name) => {
  26302. const COLLECTION_NAME = `El${name}Collection`;
  26303. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  26304. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  26305. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  26306. const ElCollection = {
  26307. ...Collection,
  26308. name: COLLECTION_NAME,
  26309. setup() {
  26310. const collectionRef = vue.ref(null);
  26311. const itemMap = /* @__PURE__ */ new Map();
  26312. const getItems = () => {
  26313. const collectionEl = vue.unref(collectionRef);
  26314. if (!collectionEl)
  26315. return [];
  26316. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  26317. const items = [...itemMap.values()];
  26318. return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  26319. };
  26320. vue.provide(COLLECTION_INJECTION_KEY, {
  26321. itemMap,
  26322. getItems,
  26323. collectionRef
  26324. });
  26325. }
  26326. };
  26327. const ElCollectionItem = {
  26328. ...CollectionItem,
  26329. name: COLLECTION_ITEM_NAME,
  26330. setup(_, { attrs }) {
  26331. const collectionItemRef = vue.ref(null);
  26332. const collectionInjection = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  26333. vue.provide(COLLECTION_ITEM_INJECTION_KEY, {
  26334. collectionItemRef
  26335. });
  26336. vue.onMounted(() => {
  26337. const collectionItemEl = vue.unref(collectionItemRef);
  26338. if (collectionItemEl) {
  26339. collectionInjection.itemMap.set(collectionItemEl, {
  26340. ref: collectionItemEl,
  26341. ...attrs
  26342. });
  26343. }
  26344. });
  26345. vue.onBeforeUnmount(() => {
  26346. const collectionItemEl = vue.unref(collectionItemRef);
  26347. collectionInjection.itemMap.delete(collectionItemEl);
  26348. });
  26349. }
  26350. };
  26351. return {
  26352. COLLECTION_INJECTION_KEY,
  26353. COLLECTION_ITEM_INJECTION_KEY,
  26354. ElCollection,
  26355. ElCollectionItem
  26356. };
  26357. };
  26358. const rovingFocusGroupProps = buildProps({
  26359. style: { type: definePropType([String, Array, Object]) },
  26360. currentTabId: {
  26361. type: definePropType(String)
  26362. },
  26363. defaultCurrentTabId: String,
  26364. loop: Boolean,
  26365. dir: {
  26366. type: String,
  26367. values: ["ltr", "rtl"],
  26368. default: "ltr"
  26369. },
  26370. orientation: {
  26371. type: definePropType(String)
  26372. },
  26373. onBlur: Function,
  26374. onFocus: Function,
  26375. onMousedown: Function
  26376. });
  26377. const {
  26378. ElCollection: ElCollection$1,
  26379. ElCollectionItem: ElCollectionItem$1,
  26380. COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY$1,
  26381. COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY$1
  26382. } = createCollectionWithScope("RovingFocusGroup");
  26383. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  26384. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  26385. const MAP_KEY_TO_FOCUS_INTENT = {
  26386. ArrowLeft: "prev",
  26387. ArrowUp: "prev",
  26388. ArrowRight: "next",
  26389. ArrowDown: "next",
  26390. PageUp: "first",
  26391. Home: "first",
  26392. PageDown: "last",
  26393. End: "last"
  26394. };
  26395. const getDirectionAwareKey = (key, dir) => {
  26396. if (dir !== "rtl")
  26397. return key;
  26398. switch (key) {
  26399. case EVENT_CODE.right:
  26400. return EVENT_CODE.left;
  26401. case EVENT_CODE.left:
  26402. return EVENT_CODE.right;
  26403. default:
  26404. return key;
  26405. }
  26406. };
  26407. const getFocusIntent = (event, orientation, dir) => {
  26408. const key = getDirectionAwareKey(event.key, dir);
  26409. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  26410. return void 0;
  26411. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  26412. return void 0;
  26413. return MAP_KEY_TO_FOCUS_INTENT[key];
  26414. };
  26415. const reorderArray = (array, atIdx) => {
  26416. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  26417. };
  26418. const focusFirst = (elements) => {
  26419. const { activeElement: prevActive } = document;
  26420. for (const element of elements) {
  26421. if (element === prevActive)
  26422. return;
  26423. element.focus();
  26424. if (prevActive !== document.activeElement)
  26425. return;
  26426. }
  26427. };
  26428. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  26429. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  26430. const EVT_OPTS = { bubbles: false, cancelable: true };
  26431. const _sfc_main$17 = vue.defineComponent({
  26432. name: "ElRovingFocusGroupImpl",
  26433. inheritAttrs: false,
  26434. props: rovingFocusGroupProps,
  26435. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  26436. setup(props, { emit }) {
  26437. var _a;
  26438. const currentTabbedId = vue.ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null);
  26439. const isBackingOut = vue.ref(false);
  26440. const isClickFocus = vue.ref(false);
  26441. const rovingFocusGroupRef = vue.ref(null);
  26442. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  26443. const rovingFocusGroupRootStyle = vue.computed(() => {
  26444. return [
  26445. {
  26446. outline: "none"
  26447. },
  26448. props.style
  26449. ];
  26450. });
  26451. const onItemFocus = (tabbedId) => {
  26452. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  26453. };
  26454. const onItemShiftTab = () => {
  26455. isBackingOut.value = true;
  26456. };
  26457. const onMousedown = composeEventHandlers((e) => {
  26458. var _a2;
  26459. (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e);
  26460. }, () => {
  26461. isClickFocus.value = true;
  26462. });
  26463. const onFocus = composeEventHandlers((e) => {
  26464. var _a2;
  26465. (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
  26466. }, (e) => {
  26467. const isKeyboardFocus = !vue.unref(isClickFocus);
  26468. const { target, currentTarget } = e;
  26469. if (target === currentTarget && isKeyboardFocus && !vue.unref(isBackingOut)) {
  26470. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  26471. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  26472. if (!entryFocusEvt.defaultPrevented) {
  26473. const items = getItems().filter((item) => item.focusable);
  26474. const activeItem = items.find((item) => item.active);
  26475. const currentItem = items.find((item) => item.id === vue.unref(currentTabbedId));
  26476. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  26477. const candidateNodes = candidates.map((item) => item.ref);
  26478. focusFirst(candidateNodes);
  26479. }
  26480. }
  26481. isClickFocus.value = false;
  26482. });
  26483. const onBlur = composeEventHandlers((e) => {
  26484. var _a2;
  26485. (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e);
  26486. }, () => {
  26487. isBackingOut.value = false;
  26488. });
  26489. const handleEntryFocus = (...args) => {
  26490. emit("entryFocus", ...args);
  26491. };
  26492. vue.provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  26493. currentTabbedId: vue.readonly(currentTabbedId),
  26494. loop: vue.toRef(props, "loop"),
  26495. tabIndex: vue.computed(() => {
  26496. return vue.unref(isBackingOut) ? -1 : 0;
  26497. }),
  26498. rovingFocusGroupRef,
  26499. rovingFocusGroupRootStyle,
  26500. orientation: vue.toRef(props, "orientation"),
  26501. dir: vue.toRef(props, "dir"),
  26502. onItemFocus,
  26503. onItemShiftTab,
  26504. onBlur,
  26505. onFocus,
  26506. onMousedown
  26507. });
  26508. vue.watch(() => props.currentTabId, (val) => {
  26509. currentTabbedId.value = val != null ? val : null;
  26510. });
  26511. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  26512. }
  26513. });
  26514. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  26515. return vue.renderSlot(_ctx.$slots, "default");
  26516. }
  26517. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["render", _sfc_render$m], ["__file", "roving-focus-group-impl.vue"]]);
  26518. const _sfc_main$16 = vue.defineComponent({
  26519. name: "ElRovingFocusGroup",
  26520. components: {
  26521. ElFocusGroupCollection: ElCollection$1,
  26522. ElRovingFocusGroupImpl
  26523. }
  26524. });
  26525. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  26526. const _component_el_roving_focus_group_impl = vue.resolveComponent("el-roving-focus-group-impl");
  26527. const _component_el_focus_group_collection = vue.resolveComponent("el-focus-group-collection");
  26528. return vue.openBlock(), vue.createBlock(_component_el_focus_group_collection, null, {
  26529. default: vue.withCtx(() => [
  26530. vue.createVNode(_component_el_roving_focus_group_impl, vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), {
  26531. default: vue.withCtx(() => [
  26532. vue.renderSlot(_ctx.$slots, "default")
  26533. ]),
  26534. _: 3
  26535. }, 16)
  26536. ]),
  26537. _: 3
  26538. });
  26539. }
  26540. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["render", _sfc_render$l], ["__file", "roving-focus-group.vue"]]);
  26541. const _sfc_main$15 = vue.defineComponent({
  26542. components: {
  26543. ElRovingFocusCollectionItem: ElCollectionItem$1
  26544. },
  26545. props: {
  26546. focusable: {
  26547. type: Boolean,
  26548. default: true
  26549. },
  26550. active: {
  26551. type: Boolean,
  26552. default: false
  26553. }
  26554. },
  26555. emits: ["mousedown", "focus", "keydown"],
  26556. setup(props, { emit }) {
  26557. const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  26558. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  26559. const id = useId();
  26560. const rovingFocusGroupItemRef = vue.ref(null);
  26561. const handleMousedown = composeEventHandlers((e) => {
  26562. emit("mousedown", e);
  26563. }, (e) => {
  26564. if (!props.focusable) {
  26565. e.preventDefault();
  26566. } else {
  26567. onItemFocus(vue.unref(id));
  26568. }
  26569. });
  26570. const handleFocus = composeEventHandlers((e) => {
  26571. emit("focus", e);
  26572. }, () => {
  26573. onItemFocus(vue.unref(id));
  26574. });
  26575. const handleKeydown = composeEventHandlers((e) => {
  26576. emit("keydown", e);
  26577. }, (e) => {
  26578. const { key, shiftKey, target, currentTarget } = e;
  26579. if (key === EVENT_CODE.tab && shiftKey) {
  26580. onItemShiftTab();
  26581. return;
  26582. }
  26583. if (target !== currentTarget)
  26584. return;
  26585. const focusIntent = getFocusIntent(e);
  26586. if (focusIntent) {
  26587. e.preventDefault();
  26588. const items = getItems().filter((item) => item.focusable);
  26589. let elements = items.map((item) => item.ref);
  26590. switch (focusIntent) {
  26591. case "last": {
  26592. elements.reverse();
  26593. break;
  26594. }
  26595. case "prev":
  26596. case "next": {
  26597. if (focusIntent === "prev") {
  26598. elements.reverse();
  26599. }
  26600. const currentIdx = elements.indexOf(currentTarget);
  26601. elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  26602. break;
  26603. }
  26604. }
  26605. vue.nextTick(() => {
  26606. focusFirst(elements);
  26607. });
  26608. }
  26609. });
  26610. const isCurrentTab = vue.computed(() => currentTabbedId.value === vue.unref(id));
  26611. vue.provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  26612. rovingFocusGroupItemRef,
  26613. tabIndex: vue.computed(() => vue.unref(isCurrentTab) ? 0 : -1),
  26614. handleMousedown,
  26615. handleFocus,
  26616. handleKeydown
  26617. });
  26618. return {
  26619. id,
  26620. handleKeydown,
  26621. handleFocus,
  26622. handleMousedown
  26623. };
  26624. }
  26625. });
  26626. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  26627. const _component_el_roving_focus_collection_item = vue.resolveComponent("el-roving-focus-collection-item");
  26628. return vue.openBlock(), vue.createBlock(_component_el_roving_focus_collection_item, {
  26629. id: _ctx.id,
  26630. focusable: _ctx.focusable,
  26631. active: _ctx.active
  26632. }, {
  26633. default: vue.withCtx(() => [
  26634. vue.renderSlot(_ctx.$slots, "default")
  26635. ]),
  26636. _: 3
  26637. }, 8, ["id", "focusable", "active"]);
  26638. }
  26639. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["render", _sfc_render$k], ["__file", "roving-focus-item.vue"]]);
  26640. const dropdownProps = buildProps({
  26641. trigger: useTooltipTriggerProps.trigger,
  26642. effect: {
  26643. ...useTooltipContentProps.effect,
  26644. default: "light"
  26645. },
  26646. type: {
  26647. type: definePropType(String)
  26648. },
  26649. placement: {
  26650. type: definePropType(String),
  26651. default: "bottom"
  26652. },
  26653. popperOptions: {
  26654. type: definePropType(Object),
  26655. default: () => ({})
  26656. },
  26657. id: String,
  26658. size: {
  26659. type: String,
  26660. default: ""
  26661. },
  26662. splitButton: Boolean,
  26663. hideOnClick: {
  26664. type: Boolean,
  26665. default: true
  26666. },
  26667. loop: {
  26668. type: Boolean,
  26669. default: true
  26670. },
  26671. showTimeout: {
  26672. type: Number,
  26673. default: 150
  26674. },
  26675. hideTimeout: {
  26676. type: Number,
  26677. default: 150
  26678. },
  26679. tabindex: {
  26680. type: definePropType([Number, String]),
  26681. default: 0
  26682. },
  26683. maxHeight: {
  26684. type: definePropType([Number, String]),
  26685. default: ""
  26686. },
  26687. popperClass: {
  26688. type: String,
  26689. default: ""
  26690. },
  26691. disabled: {
  26692. type: Boolean,
  26693. default: false
  26694. },
  26695. role: {
  26696. type: String,
  26697. default: "menu"
  26698. },
  26699. buttonProps: {
  26700. type: definePropType(Object)
  26701. },
  26702. teleported: useTooltipContentProps.teleported
  26703. });
  26704. const dropdownItemProps = buildProps({
  26705. command: {
  26706. type: [Object, String, Number],
  26707. default: () => ({})
  26708. },
  26709. disabled: Boolean,
  26710. divided: Boolean,
  26711. textValue: String,
  26712. icon: {
  26713. type: iconPropType
  26714. }
  26715. });
  26716. const dropdownMenuProps = buildProps({
  26717. onKeydown: { type: definePropType(Function) }
  26718. });
  26719. const FIRST_KEYS = [
  26720. EVENT_CODE.down,
  26721. EVENT_CODE.pageDown,
  26722. EVENT_CODE.home
  26723. ];
  26724. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  26725. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  26726. const {
  26727. ElCollection,
  26728. ElCollectionItem,
  26729. COLLECTION_INJECTION_KEY,
  26730. COLLECTION_ITEM_INJECTION_KEY
  26731. } = createCollectionWithScope("Dropdown");
  26732. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  26733. const { ButtonGroup: ElButtonGroup } = ElButton;
  26734. const _sfc_main$14 = vue.defineComponent({
  26735. name: "ElDropdown",
  26736. components: {
  26737. ElButton,
  26738. ElButtonGroup,
  26739. ElScrollbar,
  26740. ElDropdownCollection: ElCollection,
  26741. ElTooltip,
  26742. ElRovingFocusGroup,
  26743. ElOnlyChild: OnlyChild,
  26744. ElIcon,
  26745. ArrowDown: arrow_down_default
  26746. },
  26747. props: dropdownProps,
  26748. emits: ["visible-change", "click", "command"],
  26749. setup(props, { emit }) {
  26750. const _instance = vue.getCurrentInstance();
  26751. const ns = useNamespace("dropdown");
  26752. const { t } = useLocale();
  26753. const triggeringElementRef = vue.ref();
  26754. const referenceElementRef = vue.ref();
  26755. const popperRef = vue.ref(null);
  26756. const contentRef = vue.ref(null);
  26757. const scrollbar = vue.ref(null);
  26758. const currentTabId = vue.ref(null);
  26759. const isUsingKeyboard = vue.ref(false);
  26760. const triggerKeys = [EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.down];
  26761. const wrapStyle = vue.computed(() => ({
  26762. maxHeight: addUnit(props.maxHeight)
  26763. }));
  26764. const dropdownTriggerKls = vue.computed(() => [ns.m(dropdownSize.value)]);
  26765. const defaultTriggerId = useId().value;
  26766. const triggerId = vue.computed(() => {
  26767. return props.id || defaultTriggerId;
  26768. });
  26769. function handleClick() {
  26770. handleClose();
  26771. }
  26772. function handleClose() {
  26773. var _a;
  26774. (_a = popperRef.value) == null ? void 0 : _a.onClose();
  26775. }
  26776. function handleOpen() {
  26777. var _a;
  26778. (_a = popperRef.value) == null ? void 0 : _a.onOpen();
  26779. }
  26780. const dropdownSize = useSize();
  26781. function commandHandler(...args) {
  26782. emit("command", ...args);
  26783. }
  26784. function onItemEnter() {
  26785. }
  26786. function onItemLeave() {
  26787. const contentEl = vue.unref(contentRef);
  26788. contentEl == null ? void 0 : contentEl.focus();
  26789. currentTabId.value = null;
  26790. }
  26791. function handleCurrentTabIdChange(id) {
  26792. currentTabId.value = id;
  26793. }
  26794. function handleEntryFocus(e) {
  26795. if (!isUsingKeyboard.value) {
  26796. e.preventDefault();
  26797. e.stopImmediatePropagation();
  26798. }
  26799. }
  26800. function handleBeforeShowTooltip() {
  26801. emit("visible-change", true);
  26802. }
  26803. function handleShowTooltip(event) {
  26804. if ((event == null ? void 0 : event.type) === "keydown") {
  26805. contentRef.value.focus();
  26806. }
  26807. }
  26808. function handleBeforeHideTooltip() {
  26809. emit("visible-change", false);
  26810. }
  26811. vue.provide(DROPDOWN_INJECTION_KEY, {
  26812. contentRef,
  26813. role: vue.computed(() => props.role),
  26814. triggerId,
  26815. isUsingKeyboard,
  26816. onItemEnter,
  26817. onItemLeave
  26818. });
  26819. vue.provide("elDropdown", {
  26820. instance: _instance,
  26821. dropdownSize,
  26822. handleClick,
  26823. commandHandler,
  26824. trigger: vue.toRef(props, "trigger"),
  26825. hideOnClick: vue.toRef(props, "hideOnClick")
  26826. });
  26827. const onFocusAfterTrapped = (e) => {
  26828. var _a, _b;
  26829. e.preventDefault();
  26830. (_b = (_a = contentRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a, {
  26831. preventScroll: true
  26832. });
  26833. };
  26834. const handlerMainButtonClick = (event) => {
  26835. emit("click", event);
  26836. };
  26837. return {
  26838. t,
  26839. ns,
  26840. scrollbar,
  26841. wrapStyle,
  26842. dropdownTriggerKls,
  26843. dropdownSize,
  26844. triggerId,
  26845. triggerKeys,
  26846. currentTabId,
  26847. handleCurrentTabIdChange,
  26848. handlerMainButtonClick,
  26849. handleEntryFocus,
  26850. handleClose,
  26851. handleOpen,
  26852. handleBeforeShowTooltip,
  26853. handleShowTooltip,
  26854. handleBeforeHideTooltip,
  26855. onFocusAfterTrapped,
  26856. popperRef,
  26857. contentRef,
  26858. triggeringElementRef,
  26859. referenceElementRef
  26860. };
  26861. }
  26862. });
  26863. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  26864. var _a;
  26865. const _component_el_dropdown_collection = vue.resolveComponent("el-dropdown-collection");
  26866. const _component_el_roving_focus_group = vue.resolveComponent("el-roving-focus-group");
  26867. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  26868. const _component_el_only_child = vue.resolveComponent("el-only-child");
  26869. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  26870. const _component_el_button = vue.resolveComponent("el-button");
  26871. const _component_arrow_down = vue.resolveComponent("arrow-down");
  26872. const _component_el_icon = vue.resolveComponent("el-icon");
  26873. const _component_el_button_group = vue.resolveComponent("el-button-group");
  26874. return vue.openBlock(), vue.createElementBlock("div", {
  26875. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  26876. }, [
  26877. vue.createVNode(_component_el_tooltip, {
  26878. ref: "popperRef",
  26879. role: _ctx.role,
  26880. effect: _ctx.effect,
  26881. "fallback-placements": ["bottom", "top"],
  26882. "popper-options": _ctx.popperOptions,
  26883. "gpu-acceleration": false,
  26884. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  26885. "manual-mode": true,
  26886. placement: _ctx.placement,
  26887. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  26888. "reference-element": (_a = _ctx.referenceElementRef) == null ? void 0 : _a.$el,
  26889. trigger: _ctx.trigger,
  26890. "trigger-keys": _ctx.triggerKeys,
  26891. "trigger-target-el": _ctx.contentRef,
  26892. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  26893. "stop-popper-mouse-event": false,
  26894. "virtual-ref": _ctx.triggeringElementRef,
  26895. "virtual-triggering": _ctx.splitButton,
  26896. disabled: _ctx.disabled,
  26897. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  26898. teleported: _ctx.teleported,
  26899. pure: "",
  26900. persistent: "",
  26901. onBeforeShow: _ctx.handleBeforeShowTooltip,
  26902. onShow: _ctx.handleShowTooltip,
  26903. onBeforeHide: _ctx.handleBeforeHideTooltip
  26904. }, vue.createSlots({
  26905. content: vue.withCtx(() => [
  26906. vue.createVNode(_component_el_scrollbar, {
  26907. ref: "scrollbar",
  26908. "wrap-style": _ctx.wrapStyle,
  26909. tag: "div",
  26910. "view-class": _ctx.ns.e("list")
  26911. }, {
  26912. default: vue.withCtx(() => [
  26913. vue.createVNode(_component_el_roving_focus_group, {
  26914. loop: _ctx.loop,
  26915. "current-tab-id": _ctx.currentTabId,
  26916. orientation: "horizontal",
  26917. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange,
  26918. onEntryFocus: _ctx.handleEntryFocus
  26919. }, {
  26920. default: vue.withCtx(() => [
  26921. vue.createVNode(_component_el_dropdown_collection, null, {
  26922. default: vue.withCtx(() => [
  26923. vue.renderSlot(_ctx.$slots, "dropdown")
  26924. ]),
  26925. _: 3
  26926. })
  26927. ]),
  26928. _: 3
  26929. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
  26930. ]),
  26931. _: 3
  26932. }, 8, ["wrap-style", "view-class"])
  26933. ]),
  26934. _: 2
  26935. }, [
  26936. !_ctx.splitButton ? {
  26937. name: "default",
  26938. fn: vue.withCtx(() => [
  26939. vue.createVNode(_component_el_only_child, {
  26940. id: _ctx.triggerId,
  26941. role: "button",
  26942. tabindex: _ctx.tabindex
  26943. }, {
  26944. default: vue.withCtx(() => [
  26945. vue.renderSlot(_ctx.$slots, "default")
  26946. ]),
  26947. _: 3
  26948. }, 8, ["id", "tabindex"])
  26949. ])
  26950. } : void 0
  26951. ]), 1032, ["role", "effect", "popper-options", "hide-after", "placement", "popper-class", "reference-element", "trigger", "trigger-keys", "trigger-target-el", "show-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported", "onBeforeShow", "onShow", "onBeforeHide"]),
  26952. _ctx.splitButton ? (vue.openBlock(), vue.createBlock(_component_el_button_group, { key: 0 }, {
  26953. default: vue.withCtx(() => [
  26954. vue.createVNode(_component_el_button, vue.mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  26955. size: _ctx.dropdownSize,
  26956. type: _ctx.type,
  26957. disabled: _ctx.disabled,
  26958. tabindex: _ctx.tabindex,
  26959. onClick: _ctx.handlerMainButtonClick
  26960. }), {
  26961. default: vue.withCtx(() => [
  26962. vue.renderSlot(_ctx.$slots, "default")
  26963. ]),
  26964. _: 3
  26965. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  26966. vue.createVNode(_component_el_button, vue.mergeProps({
  26967. id: _ctx.triggerId,
  26968. ref: "triggeringElementRef"
  26969. }, _ctx.buttonProps, {
  26970. role: "button",
  26971. size: _ctx.dropdownSize,
  26972. type: _ctx.type,
  26973. class: _ctx.ns.e("caret-button"),
  26974. disabled: _ctx.disabled,
  26975. tabindex: _ctx.tabindex,
  26976. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  26977. }), {
  26978. default: vue.withCtx(() => [
  26979. vue.createVNode(_component_el_icon, {
  26980. class: vue.normalizeClass(_ctx.ns.e("icon"))
  26981. }, {
  26982. default: vue.withCtx(() => [
  26983. vue.createVNode(_component_arrow_down)
  26984. ]),
  26985. _: 1
  26986. }, 8, ["class"])
  26987. ]),
  26988. _: 1
  26989. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  26990. ]),
  26991. _: 3
  26992. })) : vue.createCommentVNode("v-if", true)
  26993. ], 2);
  26994. }
  26995. var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["render", _sfc_render$j], ["__file", "dropdown.vue"]]);
  26996. const _sfc_main$13 = vue.defineComponent({
  26997. name: "DropdownItemImpl",
  26998. components: {
  26999. ElIcon
  27000. },
  27001. props: dropdownItemProps,
  27002. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  27003. setup(_, { emit }) {
  27004. const ns = useNamespace("dropdown");
  27005. const { role: menuRole } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  27006. const { collectionItemRef: dropdownCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  27007. const { collectionItemRef: rovingFocusCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY$1, void 0);
  27008. const {
  27009. rovingFocusGroupItemRef,
  27010. tabIndex,
  27011. handleFocus,
  27012. handleKeydown: handleItemKeydown,
  27013. handleMousedown
  27014. } = vue.inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  27015. const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  27016. const role = vue.computed(() => {
  27017. if (menuRole.value === "menu") {
  27018. return "menuitem";
  27019. } else if (menuRole.value === "navigation") {
  27020. return "link";
  27021. }
  27022. return "button";
  27023. });
  27024. const handleKeydown = composeEventHandlers((e) => {
  27025. const { code } = e;
  27026. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  27027. e.preventDefault();
  27028. e.stopImmediatePropagation();
  27029. emit("clickimpl", e);
  27030. return true;
  27031. }
  27032. }, handleItemKeydown);
  27033. return {
  27034. ns,
  27035. itemRef,
  27036. dataset: {
  27037. [COLLECTION_ITEM_SIGN]: ""
  27038. },
  27039. role,
  27040. tabIndex,
  27041. handleFocus,
  27042. handleKeydown,
  27043. handleMousedown
  27044. };
  27045. }
  27046. });
  27047. const _hoisted_1$z = ["aria-disabled", "tabindex", "role"];
  27048. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  27049. const _component_el_icon = vue.resolveComponent("el-icon");
  27050. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  27051. _ctx.divided ? (vue.openBlock(), vue.createElementBlock("li", vue.mergeProps({
  27052. key: 0,
  27053. role: "separator",
  27054. class: _ctx.ns.bem("menu", "item", "divided")
  27055. }, _ctx.$attrs), null, 16)) : vue.createCommentVNode("v-if", true),
  27056. vue.createElementVNode("li", vue.mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  27057. "aria-disabled": _ctx.disabled,
  27058. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  27059. tabindex: _ctx.tabIndex,
  27060. role: _ctx.role,
  27061. onClick: _cache[0] || (_cache[0] = (e) => _ctx.$emit("clickimpl", e)),
  27062. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  27063. onKeydown: _cache[2] || (_cache[2] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args)),
  27064. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)),
  27065. onPointermove: _cache[4] || (_cache[4] = (e) => _ctx.$emit("pointermove", e)),
  27066. onPointerleave: _cache[5] || (_cache[5] = (e) => _ctx.$emit("pointerleave", e))
  27067. }), [
  27068. _ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
  27069. default: vue.withCtx(() => [
  27070. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  27071. ]),
  27072. _: 1
  27073. })) : vue.createCommentVNode("v-if", true),
  27074. vue.renderSlot(_ctx.$slots, "default")
  27075. ], 16, _hoisted_1$z)
  27076. ], 64);
  27077. }
  27078. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["render", _sfc_render$i], ["__file", "dropdown-item-impl.vue"]]);
  27079. const useDropdown = () => {
  27080. const elDropdown = vue.inject("elDropdown", {});
  27081. const _elDropdownSize = vue.computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  27082. return {
  27083. elDropdown,
  27084. _elDropdownSize
  27085. };
  27086. };
  27087. const _sfc_main$12 = vue.defineComponent({
  27088. name: "ElDropdownItem",
  27089. components: {
  27090. ElDropdownCollectionItem: ElCollectionItem,
  27091. ElRovingFocusItem,
  27092. ElDropdownItemImpl
  27093. },
  27094. inheritAttrs: false,
  27095. props: dropdownItemProps,
  27096. emits: ["pointermove", "pointerleave", "click"],
  27097. setup(props, { emit, attrs }) {
  27098. const { elDropdown } = useDropdown();
  27099. const _instance = vue.getCurrentInstance();
  27100. const itemRef = vue.ref(null);
  27101. const textContent = vue.computed(() => {
  27102. var _a, _b;
  27103. return (_b = (_a = vue.unref(itemRef)) == null ? void 0 : _a.textContent) != null ? _b : "";
  27104. });
  27105. const { onItemEnter, onItemLeave } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  27106. const handlePointerMove = composeEventHandlers((e) => {
  27107. emit("pointermove", e);
  27108. return e.defaultPrevented;
  27109. }, whenMouse((e) => {
  27110. var _a;
  27111. if (props.disabled) {
  27112. onItemLeave(e);
  27113. } else {
  27114. onItemEnter(e);
  27115. if (!e.defaultPrevented) {
  27116. (_a = e.currentTarget) == null ? void 0 : _a.focus();
  27117. }
  27118. }
  27119. }));
  27120. const handlePointerLeave = composeEventHandlers((e) => {
  27121. emit("pointerleave", e);
  27122. return e.defaultPrevented;
  27123. }, whenMouse((e) => {
  27124. onItemLeave(e);
  27125. }));
  27126. const handleClick = composeEventHandlers((e) => {
  27127. if (props.disabled) {
  27128. return;
  27129. }
  27130. emit("click", e);
  27131. return e.type !== "keydown" && e.defaultPrevented;
  27132. }, (e) => {
  27133. var _a, _b, _c;
  27134. if (props.disabled) {
  27135. e.stopImmediatePropagation();
  27136. return;
  27137. }
  27138. if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) {
  27139. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  27140. }
  27141. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  27142. });
  27143. const propsAndAttrs = vue.computed(() => {
  27144. return { ...props, ...attrs };
  27145. });
  27146. return {
  27147. handleClick,
  27148. handlePointerMove,
  27149. handlePointerLeave,
  27150. textContent,
  27151. propsAndAttrs
  27152. };
  27153. }
  27154. });
  27155. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  27156. var _a;
  27157. const _component_el_dropdown_item_impl = vue.resolveComponent("el-dropdown-item-impl");
  27158. const _component_el_roving_focus_item = vue.resolveComponent("el-roving-focus-item");
  27159. const _component_el_dropdown_collection_item = vue.resolveComponent("el-dropdown-collection-item");
  27160. return vue.openBlock(), vue.createBlock(_component_el_dropdown_collection_item, {
  27161. disabled: _ctx.disabled,
  27162. "text-value": (_a = _ctx.textValue) != null ? _a : _ctx.textContent
  27163. }, {
  27164. default: vue.withCtx(() => [
  27165. vue.createVNode(_component_el_roving_focus_item, {
  27166. focusable: !_ctx.disabled
  27167. }, {
  27168. default: vue.withCtx(() => [
  27169. vue.createVNode(_component_el_dropdown_item_impl, vue.mergeProps(_ctx.propsAndAttrs, {
  27170. onPointerleave: _ctx.handlePointerLeave,
  27171. onPointermove: _ctx.handlePointerMove,
  27172. onClickimpl: _ctx.handleClick
  27173. }), {
  27174. default: vue.withCtx(() => [
  27175. vue.renderSlot(_ctx.$slots, "default")
  27176. ]),
  27177. _: 3
  27178. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  27179. ]),
  27180. _: 3
  27181. }, 8, ["focusable"])
  27182. ]),
  27183. _: 3
  27184. }, 8, ["disabled", "text-value"]);
  27185. }
  27186. var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["render", _sfc_render$h], ["__file", "dropdown-item.vue"]]);
  27187. const _sfc_main$11 = vue.defineComponent({
  27188. name: "ElDropdownMenu",
  27189. props: dropdownMenuProps,
  27190. setup(props) {
  27191. const ns = useNamespace("dropdown");
  27192. const { _elDropdownSize } = useDropdown();
  27193. const size = _elDropdownSize.value;
  27194. const { focusTrapRef, onKeydown } = vue.inject(FOCUS_TRAP_INJECTION_KEY, void 0);
  27195. const { contentRef, role, triggerId } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  27196. const { collectionRef: dropdownCollectionRef, getItems } = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  27197. const {
  27198. rovingFocusGroupRef,
  27199. rovingFocusGroupRootStyle,
  27200. tabIndex,
  27201. onBlur,
  27202. onFocus,
  27203. onMousedown
  27204. } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  27205. const { collectionRef: rovingFocusGroupCollectionRef } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  27206. const dropdownKls = vue.computed(() => {
  27207. return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
  27208. });
  27209. const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  27210. const composedKeydown = composeEventHandlers((e) => {
  27211. var _a;
  27212. (_a = props.onKeydown) == null ? void 0 : _a.call(props, e);
  27213. }, (e) => {
  27214. const { currentTarget, code, target } = e;
  27215. currentTarget.contains(target);
  27216. if (EVENT_CODE.tab === code) {
  27217. e.stopImmediatePropagation();
  27218. }
  27219. e.preventDefault();
  27220. if (target !== vue.unref(contentRef))
  27221. return;
  27222. if (!FIRST_LAST_KEYS.includes(code))
  27223. return;
  27224. const items = getItems().filter((item) => !item.disabled);
  27225. const targets = items.map((item) => item.ref);
  27226. if (LAST_KEYS.includes(code)) {
  27227. targets.reverse();
  27228. }
  27229. focusFirst(targets);
  27230. });
  27231. const handleKeydown = (e) => {
  27232. composedKeydown(e);
  27233. onKeydown(e);
  27234. };
  27235. return {
  27236. size,
  27237. rovingFocusGroupRootStyle,
  27238. tabIndex,
  27239. dropdownKls,
  27240. role,
  27241. triggerId,
  27242. dropdownListWrapperRef,
  27243. handleKeydown,
  27244. onBlur,
  27245. onFocus,
  27246. onMousedown
  27247. };
  27248. }
  27249. });
  27250. const _hoisted_1$y = ["role", "aria-labelledby"];
  27251. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  27252. return vue.openBlock(), vue.createElementBlock("ul", {
  27253. ref: _ctx.dropdownListWrapperRef,
  27254. class: vue.normalizeClass(_ctx.dropdownKls),
  27255. style: vue.normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  27256. tabindex: -1,
  27257. role: _ctx.role,
  27258. "aria-labelledby": _ctx.triggerId,
  27259. onBlur: _cache[0] || (_cache[0] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
  27260. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
  27261. onKeydown: _cache[2] || (_cache[2] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args)),
  27262. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.onMousedown && _ctx.onMousedown(...args))
  27263. }, [
  27264. vue.renderSlot(_ctx.$slots, "default")
  27265. ], 46, _hoisted_1$y);
  27266. }
  27267. var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["render", _sfc_render$g], ["__file", "dropdown-menu.vue"]]);
  27268. const ElDropdown = withInstall(Dropdown, {
  27269. DropdownItem,
  27270. DropdownMenu
  27271. });
  27272. const ElDropdownItem = withNoopInstall(DropdownItem);
  27273. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  27274. let id = 0;
  27275. const _sfc_main$10 = vue.defineComponent({
  27276. name: "ImgEmpty",
  27277. setup() {
  27278. const ns = useNamespace("empty");
  27279. return {
  27280. ns,
  27281. id: ++id
  27282. };
  27283. }
  27284. });
  27285. const _hoisted_1$x = {
  27286. viewBox: "0 0 79 86",
  27287. version: "1.1",
  27288. xmlns: "http://www.w3.org/2000/svg",
  27289. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  27290. };
  27291. const _hoisted_2$l = ["id"];
  27292. const _hoisted_3$8 = ["stop-color"];
  27293. const _hoisted_4$6 = ["stop-color"];
  27294. const _hoisted_5$5 = ["id"];
  27295. const _hoisted_6$1 = ["stop-color"];
  27296. const _hoisted_7 = ["stop-color"];
  27297. const _hoisted_8 = ["id"];
  27298. const _hoisted_9 = {
  27299. id: "Illustrations",
  27300. stroke: "none",
  27301. "stroke-width": "1",
  27302. fill: "none",
  27303. "fill-rule": "evenodd"
  27304. };
  27305. const _hoisted_10 = {
  27306. id: "B-type",
  27307. transform: "translate(-1268.000000, -535.000000)"
  27308. };
  27309. const _hoisted_11 = {
  27310. id: "Group-2",
  27311. transform: "translate(1268.000000, 535.000000)"
  27312. };
  27313. const _hoisted_12 = ["fill"];
  27314. const _hoisted_13 = ["fill"];
  27315. const _hoisted_14 = {
  27316. id: "Group-Copy",
  27317. transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)"
  27318. };
  27319. const _hoisted_15 = ["fill"];
  27320. const _hoisted_16 = ["fill"];
  27321. const _hoisted_17 = ["fill"];
  27322. const _hoisted_18 = ["fill"];
  27323. const _hoisted_19 = ["fill"];
  27324. const _hoisted_20 = {
  27325. id: "Rectangle-Copy-17",
  27326. transform: "translate(53.000000, 45.000000)"
  27327. };
  27328. const _hoisted_21 = ["fill", "xlink:href"];
  27329. const _hoisted_22 = ["fill", "mask"];
  27330. const _hoisted_23 = ["fill"];
  27331. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  27332. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$x, [
  27333. vue.createElementVNode("defs", null, [
  27334. vue.createElementVNode("linearGradient", {
  27335. id: `linearGradient-1-${_ctx.id}`,
  27336. x1: "38.8503086%",
  27337. y1: "0%",
  27338. x2: "61.1496914%",
  27339. y2: "100%"
  27340. }, [
  27341. vue.createElementVNode("stop", {
  27342. "stop-color": `var(${_ctx.ns.cssVarBlockName("fill-color-1")})`,
  27343. offset: "0%"
  27344. }, null, 8, _hoisted_3$8),
  27345. vue.createElementVNode("stop", {
  27346. "stop-color": `var(${_ctx.ns.cssVarBlockName("fill-color-4")})`,
  27347. offset: "100%"
  27348. }, null, 8, _hoisted_4$6)
  27349. ], 8, _hoisted_2$l),
  27350. vue.createElementVNode("linearGradient", {
  27351. id: `linearGradient-2-${_ctx.id}`,
  27352. x1: "0%",
  27353. y1: "9.5%",
  27354. x2: "100%",
  27355. y2: "90.5%"
  27356. }, [
  27357. vue.createElementVNode("stop", {
  27358. "stop-color": `var(${_ctx.ns.cssVarBlockName("fill-color-1")})`,
  27359. offset: "0%"
  27360. }, null, 8, _hoisted_6$1),
  27361. vue.createElementVNode("stop", {
  27362. "stop-color": `var(${_ctx.ns.cssVarBlockName("fill-color-6")})`,
  27363. offset: "100%"
  27364. }, null, 8, _hoisted_7)
  27365. ], 8, _hoisted_5$5),
  27366. vue.createElementVNode("rect", {
  27367. id: `path-3-${_ctx.id}`,
  27368. x: "0",
  27369. y: "0",
  27370. width: "17",
  27371. height: "36"
  27372. }, null, 8, _hoisted_8)
  27373. ]),
  27374. vue.createElementVNode("g", _hoisted_9, [
  27375. vue.createElementVNode("g", _hoisted_10, [
  27376. vue.createElementVNode("g", _hoisted_11, [
  27377. vue.createElementVNode("path", {
  27378. id: "Oval-Copy-2",
  27379. 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",
  27380. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-3")})`
  27381. }, null, 8, _hoisted_12),
  27382. vue.createElementVNode("polygon", {
  27383. id: "Rectangle-Copy-14",
  27384. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-7")})`,
  27385. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  27386. points: "13 58 53 58 42 45 2 45"
  27387. }, null, 8, _hoisted_13),
  27388. vue.createElementVNode("g", _hoisted_14, [
  27389. vue.createElementVNode("polygon", {
  27390. id: "Rectangle-Copy-10",
  27391. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-7")})`,
  27392. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  27393. points: "2.84078316e-14 3 18 3 23 7 5 7"
  27394. }, null, 8, _hoisted_15),
  27395. vue.createElementVNode("polygon", {
  27396. id: "Rectangle-Copy-11",
  27397. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-5")})`,
  27398. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  27399. }, null, 8, _hoisted_16),
  27400. vue.createElementVNode("rect", {
  27401. id: "Rectangle-Copy-12",
  27402. fill: `url(#linearGradient-1-${_ctx.id})`,
  27403. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  27404. x: "38",
  27405. y: "7",
  27406. width: "17",
  27407. height: "36"
  27408. }, null, 8, _hoisted_17),
  27409. vue.createElementVNode("polygon", {
  27410. id: "Rectangle-Copy-13",
  27411. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-2")})`,
  27412. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  27413. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  27414. }, null, 8, _hoisted_18)
  27415. ]),
  27416. vue.createElementVNode("rect", {
  27417. id: "Rectangle-Copy-15",
  27418. fill: `url(#linearGradient-2-${_ctx.id})`,
  27419. x: "13",
  27420. y: "45",
  27421. width: "40",
  27422. height: "36"
  27423. }, null, 8, _hoisted_19),
  27424. vue.createElementVNode("g", _hoisted_20, [
  27425. vue.createElementVNode("use", {
  27426. id: "Mask",
  27427. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-8")})`,
  27428. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  27429. "xlink:href": `#path-3-${_ctx.id}`
  27430. }, null, 8, _hoisted_21),
  27431. vue.createElementVNode("polygon", {
  27432. id: "Rectangle-Copy",
  27433. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-9")})`,
  27434. mask: `url(#mask-4-${_ctx.id})`,
  27435. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  27436. points: "7 0 24 0 20 18 7 16.5"
  27437. }, null, 8, _hoisted_22)
  27438. ]),
  27439. vue.createElementVNode("polygon", {
  27440. id: "Rectangle-Copy-18",
  27441. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-2")})`,
  27442. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  27443. points: "62 45 79 45 70 58 53 58"
  27444. }, null, 8, _hoisted_23)
  27445. ])
  27446. ])
  27447. ])
  27448. ]);
  27449. }
  27450. var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["render", _sfc_render$f], ["__file", "img-empty.vue"]]);
  27451. const emptyProps = {
  27452. image: {
  27453. type: String,
  27454. default: ""
  27455. },
  27456. imageSize: Number,
  27457. description: {
  27458. type: String,
  27459. default: ""
  27460. }
  27461. };
  27462. const _hoisted_1$w = ["src"];
  27463. const _hoisted_2$k = { key: 1 };
  27464. const __default__$K = vue.defineComponent({
  27465. name: "ElEmpty"
  27466. });
  27467. const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent({
  27468. ...__default__$K,
  27469. props: emptyProps,
  27470. setup(__props) {
  27471. const props = __props;
  27472. const { t } = useLocale();
  27473. const ns = useNamespace("empty");
  27474. const emptyDescription = vue.computed(() => props.description || t("el.table.emptyText"));
  27475. const imageStyle = vue.computed(() => ({
  27476. width: props.imageSize ? `${props.imageSize}px` : ""
  27477. }));
  27478. return (_ctx, _cache) => {
  27479. return vue.openBlock(), vue.createElementBlock("div", {
  27480. class: vue.normalizeClass(vue.unref(ns).b())
  27481. }, [
  27482. vue.createElementVNode("div", {
  27483. class: vue.normalizeClass(vue.unref(ns).e("image")),
  27484. style: vue.normalizeStyle(vue.unref(imageStyle))
  27485. }, [
  27486. _ctx.image ? (vue.openBlock(), vue.createElementBlock("img", {
  27487. key: 0,
  27488. src: _ctx.image,
  27489. ondragstart: "return false"
  27490. }, null, 8, _hoisted_1$w)) : vue.renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  27491. vue.createVNode(ImgEmpty)
  27492. ])
  27493. ], 6),
  27494. vue.createElementVNode("div", {
  27495. class: vue.normalizeClass(vue.unref(ns).e("description"))
  27496. }, [
  27497. _ctx.$slots.description ? vue.renderSlot(_ctx.$slots, "description", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", _hoisted_2$k, vue.toDisplayString(vue.unref(emptyDescription)), 1))
  27498. ], 2),
  27499. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  27500. key: 0,
  27501. class: vue.normalizeClass(vue.unref(ns).e("bottom"))
  27502. }, [
  27503. vue.renderSlot(_ctx.$slots, "default")
  27504. ], 2)) : vue.createCommentVNode("v-if", true)
  27505. ], 2);
  27506. };
  27507. }
  27508. });
  27509. var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["__file", "empty.vue"]]);
  27510. const ElEmpty = withInstall(Empty);
  27511. const formProps = buildProps({
  27512. model: Object,
  27513. rules: {
  27514. type: definePropType(Object)
  27515. },
  27516. labelPosition: {
  27517. type: String,
  27518. values: ["left", "right", "top"],
  27519. default: "right"
  27520. },
  27521. requireAsteriskPosition: {
  27522. type: String,
  27523. values: ["left", "right"],
  27524. default: "left"
  27525. },
  27526. labelWidth: {
  27527. type: [String, Number],
  27528. default: ""
  27529. },
  27530. labelSuffix: {
  27531. type: String,
  27532. default: ""
  27533. },
  27534. inline: Boolean,
  27535. inlineMessage: Boolean,
  27536. statusIcon: Boolean,
  27537. showMessage: {
  27538. type: Boolean,
  27539. default: true
  27540. },
  27541. size: {
  27542. type: String,
  27543. values: componentSizes
  27544. },
  27545. disabled: Boolean,
  27546. validateOnRuleChange: {
  27547. type: Boolean,
  27548. default: true
  27549. },
  27550. hideRequiredAsterisk: {
  27551. type: Boolean,
  27552. default: false
  27553. },
  27554. scrollToError: Boolean
  27555. });
  27556. const formEmits = {
  27557. validate: (prop, isValid, message) => (isArray(prop) || isString(prop)) && isBoolean(isValid) && isString(message)
  27558. };
  27559. function useFormLabelWidth() {
  27560. const potentialLabelWidthArr = vue.ref([]);
  27561. const autoLabelWidth = vue.computed(() => {
  27562. if (!potentialLabelWidthArr.value.length)
  27563. return "0";
  27564. const max = Math.max(...potentialLabelWidthArr.value);
  27565. return max ? `${max}px` : "";
  27566. });
  27567. function getLabelWidthIndex(width) {
  27568. const index = potentialLabelWidthArr.value.indexOf(width);
  27569. if (index === -1 && autoLabelWidth.value === "0") ;
  27570. return index;
  27571. }
  27572. function registerLabelWidth(val, oldVal) {
  27573. if (val && oldVal) {
  27574. const index = getLabelWidthIndex(oldVal);
  27575. potentialLabelWidthArr.value.splice(index, 1, val);
  27576. } else if (val) {
  27577. potentialLabelWidthArr.value.push(val);
  27578. }
  27579. }
  27580. function deregisterLabelWidth(val) {
  27581. const index = getLabelWidthIndex(val);
  27582. if (index > -1) {
  27583. potentialLabelWidthArr.value.splice(index, 1);
  27584. }
  27585. }
  27586. return {
  27587. autoLabelWidth,
  27588. registerLabelWidth,
  27589. deregisterLabelWidth
  27590. };
  27591. }
  27592. const filterFields = (fields, props) => {
  27593. const normalized = castArray$1(props);
  27594. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  27595. };
  27596. const COMPONENT_NAME$e = "ElForm";
  27597. const __default__$J = vue.defineComponent({
  27598. name: COMPONENT_NAME$e
  27599. });
  27600. const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
  27601. ...__default__$J,
  27602. props: formProps,
  27603. emits: formEmits,
  27604. setup(__props, { expose, emit }) {
  27605. const props = __props;
  27606. const fields = [];
  27607. const formSize = useSize();
  27608. const ns = useNamespace("form");
  27609. const formClasses = vue.computed(() => {
  27610. const { labelPosition, inline } = props;
  27611. return [
  27612. ns.b(),
  27613. ns.m(formSize.value || "default"),
  27614. {
  27615. [ns.m(`label-${labelPosition}`)]: labelPosition,
  27616. [ns.m("inline")]: inline
  27617. }
  27618. ];
  27619. });
  27620. const addField = (field) => {
  27621. fields.push(field);
  27622. };
  27623. const removeField = (field) => {
  27624. if (field.prop) {
  27625. fields.splice(fields.indexOf(field), 1);
  27626. }
  27627. };
  27628. const resetFields = (properties = []) => {
  27629. if (!props.model) {
  27630. return;
  27631. }
  27632. filterFields(fields, properties).forEach((field) => field.resetField());
  27633. };
  27634. const clearValidate = (props2 = []) => {
  27635. filterFields(fields, props2).forEach((field) => field.clearValidate());
  27636. };
  27637. const isValidatable = vue.computed(() => {
  27638. const hasModel = !!props.model;
  27639. return hasModel;
  27640. });
  27641. const obtainValidateFields = (props2) => {
  27642. if (fields.length === 0)
  27643. return [];
  27644. const filteredFields = filterFields(fields, props2);
  27645. if (!filteredFields.length) {
  27646. return [];
  27647. }
  27648. return filteredFields;
  27649. };
  27650. const validate = async (callback) => validateField(void 0, callback);
  27651. const doValidateField = async (props2 = []) => {
  27652. if (!isValidatable.value)
  27653. return false;
  27654. const fields2 = obtainValidateFields(props2);
  27655. if (fields2.length === 0)
  27656. return true;
  27657. let validationErrors = {};
  27658. for (const field of fields2) {
  27659. try {
  27660. await field.validate("");
  27661. } catch (fields3) {
  27662. validationErrors = {
  27663. ...validationErrors,
  27664. ...fields3
  27665. };
  27666. }
  27667. }
  27668. if (Object.keys(validationErrors).length === 0)
  27669. return true;
  27670. return Promise.reject(validationErrors);
  27671. };
  27672. const validateField = async (modelProps = [], callback) => {
  27673. const shouldThrow = !isFunction(callback);
  27674. try {
  27675. const result = await doValidateField(modelProps);
  27676. if (result === true) {
  27677. callback == null ? void 0 : callback(result);
  27678. }
  27679. return result;
  27680. } catch (e) {
  27681. if (e instanceof Error)
  27682. throw e;
  27683. const invalidFields = e;
  27684. if (props.scrollToError) {
  27685. scrollToField(Object.keys(invalidFields)[0]);
  27686. }
  27687. callback == null ? void 0 : callback(false, invalidFields);
  27688. return shouldThrow && Promise.reject(invalidFields);
  27689. }
  27690. };
  27691. const scrollToField = (prop) => {
  27692. var _a;
  27693. const field = filterFields(fields, prop)[0];
  27694. if (field) {
  27695. (_a = field.$el) == null ? void 0 : _a.scrollIntoView();
  27696. }
  27697. };
  27698. vue.watch(() => props.rules, () => {
  27699. if (props.validateOnRuleChange) {
  27700. validate().catch((err) => debugWarn());
  27701. }
  27702. }, { deep: true });
  27703. vue.provide(formContextKey, vue.reactive({
  27704. ...vue.toRefs(props),
  27705. emit,
  27706. resetFields,
  27707. clearValidate,
  27708. validateField,
  27709. addField,
  27710. removeField,
  27711. ...useFormLabelWidth()
  27712. }));
  27713. expose({
  27714. validate,
  27715. validateField,
  27716. resetFields,
  27717. clearValidate,
  27718. scrollToField
  27719. });
  27720. return (_ctx, _cache) => {
  27721. return vue.openBlock(), vue.createElementBlock("form", {
  27722. class: vue.normalizeClass(vue.unref(formClasses))
  27723. }, [
  27724. vue.renderSlot(_ctx.$slots, "default")
  27725. ], 2);
  27726. };
  27727. }
  27728. });
  27729. var Form = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__file", "form.vue"]]);
  27730. function _extends() {
  27731. _extends = Object.assign ? Object.assign.bind() : function(target) {
  27732. for (var i = 1; i < arguments.length; i++) {
  27733. var source = arguments[i];
  27734. for (var key in source) {
  27735. if (Object.prototype.hasOwnProperty.call(source, key)) {
  27736. target[key] = source[key];
  27737. }
  27738. }
  27739. }
  27740. return target;
  27741. };
  27742. return _extends.apply(this, arguments);
  27743. }
  27744. function _inheritsLoose(subClass, superClass) {
  27745. subClass.prototype = Object.create(superClass.prototype);
  27746. subClass.prototype.constructor = subClass;
  27747. _setPrototypeOf(subClass, superClass);
  27748. }
  27749. function _getPrototypeOf(o) {
  27750. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  27751. return o2.__proto__ || Object.getPrototypeOf(o2);
  27752. };
  27753. return _getPrototypeOf(o);
  27754. }
  27755. function _setPrototypeOf(o, p) {
  27756. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  27757. o2.__proto__ = p2;
  27758. return o2;
  27759. };
  27760. return _setPrototypeOf(o, p);
  27761. }
  27762. function _isNativeReflectConstruct() {
  27763. if (typeof Reflect === "undefined" || !Reflect.construct)
  27764. return false;
  27765. if (Reflect.construct.sham)
  27766. return false;
  27767. if (typeof Proxy === "function")
  27768. return true;
  27769. try {
  27770. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  27771. }));
  27772. return true;
  27773. } catch (e) {
  27774. return false;
  27775. }
  27776. }
  27777. function _construct(Parent, args, Class) {
  27778. if (_isNativeReflectConstruct()) {
  27779. _construct = Reflect.construct.bind();
  27780. } else {
  27781. _construct = function _construct2(Parent2, args2, Class2) {
  27782. var a = [null];
  27783. a.push.apply(a, args2);
  27784. var Constructor = Function.bind.apply(Parent2, a);
  27785. var instance = new Constructor();
  27786. if (Class2)
  27787. _setPrototypeOf(instance, Class2.prototype);
  27788. return instance;
  27789. };
  27790. }
  27791. return _construct.apply(null, arguments);
  27792. }
  27793. function _isNativeFunction(fn) {
  27794. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  27795. }
  27796. function _wrapNativeSuper(Class) {
  27797. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  27798. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  27799. if (Class2 === null || !_isNativeFunction(Class2))
  27800. return Class2;
  27801. if (typeof Class2 !== "function") {
  27802. throw new TypeError("Super expression must either be null or a function");
  27803. }
  27804. if (typeof _cache !== "undefined") {
  27805. if (_cache.has(Class2))
  27806. return _cache.get(Class2);
  27807. _cache.set(Class2, Wrapper);
  27808. }
  27809. function Wrapper() {
  27810. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  27811. }
  27812. Wrapper.prototype = Object.create(Class2.prototype, {
  27813. constructor: {
  27814. value: Wrapper,
  27815. enumerable: false,
  27816. writable: true,
  27817. configurable: true
  27818. }
  27819. });
  27820. return _setPrototypeOf(Wrapper, Class2);
  27821. };
  27822. return _wrapNativeSuper(Class);
  27823. }
  27824. var formatRegExp = /%[sdj%]/g;
  27825. var warning = function warning2() {
  27826. };
  27827. if (typeof process !== "undefined" && process.env && false) {
  27828. warning = function warning3(type4, errors) {
  27829. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  27830. if (errors.every(function(e) {
  27831. return typeof e === "string";
  27832. })) {
  27833. console.warn(type4, errors);
  27834. }
  27835. }
  27836. };
  27837. }
  27838. function convertFieldsError(errors) {
  27839. if (!errors || !errors.length)
  27840. return null;
  27841. var fields = {};
  27842. errors.forEach(function(error) {
  27843. var field = error.field;
  27844. fields[field] = fields[field] || [];
  27845. fields[field].push(error);
  27846. });
  27847. return fields;
  27848. }
  27849. function format(template) {
  27850. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  27851. args[_key - 1] = arguments[_key];
  27852. }
  27853. var i = 0;
  27854. var len = args.length;
  27855. if (typeof template === "function") {
  27856. return template.apply(null, args);
  27857. }
  27858. if (typeof template === "string") {
  27859. var str = template.replace(formatRegExp, function(x) {
  27860. if (x === "%%") {
  27861. return "%";
  27862. }
  27863. if (i >= len) {
  27864. return x;
  27865. }
  27866. switch (x) {
  27867. case "%s":
  27868. return String(args[i++]);
  27869. case "%d":
  27870. return Number(args[i++]);
  27871. case "%j":
  27872. try {
  27873. return JSON.stringify(args[i++]);
  27874. } catch (_) {
  27875. return "[Circular]";
  27876. }
  27877. break;
  27878. default:
  27879. return x;
  27880. }
  27881. });
  27882. return str;
  27883. }
  27884. return template;
  27885. }
  27886. function isNativeStringType(type4) {
  27887. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  27888. }
  27889. function isEmptyValue(value, type4) {
  27890. if (value === void 0 || value === null) {
  27891. return true;
  27892. }
  27893. if (type4 === "array" && Array.isArray(value) && !value.length) {
  27894. return true;
  27895. }
  27896. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  27897. return true;
  27898. }
  27899. return false;
  27900. }
  27901. function asyncParallelArray(arr, func, callback) {
  27902. var results = [];
  27903. var total = 0;
  27904. var arrLength = arr.length;
  27905. function count(errors) {
  27906. results.push.apply(results, errors || []);
  27907. total++;
  27908. if (total === arrLength) {
  27909. callback(results);
  27910. }
  27911. }
  27912. arr.forEach(function(a) {
  27913. func(a, count);
  27914. });
  27915. }
  27916. function asyncSerialArray(arr, func, callback) {
  27917. var index = 0;
  27918. var arrLength = arr.length;
  27919. function next(errors) {
  27920. if (errors && errors.length) {
  27921. callback(errors);
  27922. return;
  27923. }
  27924. var original = index;
  27925. index = index + 1;
  27926. if (original < arrLength) {
  27927. func(arr[original], next);
  27928. } else {
  27929. callback([]);
  27930. }
  27931. }
  27932. next([]);
  27933. }
  27934. function flattenObjArr(objArr) {
  27935. var ret = [];
  27936. Object.keys(objArr).forEach(function(k) {
  27937. ret.push.apply(ret, objArr[k] || []);
  27938. });
  27939. return ret;
  27940. }
  27941. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  27942. _inheritsLoose(AsyncValidationError2, _Error);
  27943. function AsyncValidationError2(errors, fields) {
  27944. var _this;
  27945. _this = _Error.call(this, "Async Validation Error") || this;
  27946. _this.errors = errors;
  27947. _this.fields = fields;
  27948. return _this;
  27949. }
  27950. return AsyncValidationError2;
  27951. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  27952. function asyncMap(objArr, option, func, callback, source) {
  27953. if (option.first) {
  27954. var _pending = new Promise(function(resolve, reject) {
  27955. var next = function next2(errors) {
  27956. callback(errors);
  27957. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  27958. };
  27959. var flattenArr = flattenObjArr(objArr);
  27960. asyncSerialArray(flattenArr, func, next);
  27961. });
  27962. _pending["catch"](function(e) {
  27963. return e;
  27964. });
  27965. return _pending;
  27966. }
  27967. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  27968. var objArrKeys = Object.keys(objArr);
  27969. var objArrLength = objArrKeys.length;
  27970. var total = 0;
  27971. var results = [];
  27972. var pending = new Promise(function(resolve, reject) {
  27973. var next = function next2(errors) {
  27974. results.push.apply(results, errors);
  27975. total++;
  27976. if (total === objArrLength) {
  27977. callback(results);
  27978. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  27979. }
  27980. };
  27981. if (!objArrKeys.length) {
  27982. callback(results);
  27983. resolve(source);
  27984. }
  27985. objArrKeys.forEach(function(key) {
  27986. var arr = objArr[key];
  27987. if (firstFields.indexOf(key) !== -1) {
  27988. asyncSerialArray(arr, func, next);
  27989. } else {
  27990. asyncParallelArray(arr, func, next);
  27991. }
  27992. });
  27993. });
  27994. pending["catch"](function(e) {
  27995. return e;
  27996. });
  27997. return pending;
  27998. }
  27999. function isErrorObj(obj) {
  28000. return !!(obj && obj.message !== void 0);
  28001. }
  28002. function getValue(value, path) {
  28003. var v = value;
  28004. for (var i = 0; i < path.length; i++) {
  28005. if (v == void 0) {
  28006. return v;
  28007. }
  28008. v = v[path[i]];
  28009. }
  28010. return v;
  28011. }
  28012. function complementError(rule, source) {
  28013. return function(oe) {
  28014. var fieldValue;
  28015. if (rule.fullFields) {
  28016. fieldValue = getValue(source, rule.fullFields);
  28017. } else {
  28018. fieldValue = source[oe.field || rule.fullField];
  28019. }
  28020. if (isErrorObj(oe)) {
  28021. oe.field = oe.field || rule.fullField;
  28022. oe.fieldValue = fieldValue;
  28023. return oe;
  28024. }
  28025. return {
  28026. message: typeof oe === "function" ? oe() : oe,
  28027. fieldValue,
  28028. field: oe.field || rule.fullField
  28029. };
  28030. };
  28031. }
  28032. function deepMerge(target, source) {
  28033. if (source) {
  28034. for (var s in source) {
  28035. if (source.hasOwnProperty(s)) {
  28036. var value = source[s];
  28037. if (typeof value === "object" && typeof target[s] === "object") {
  28038. target[s] = _extends({}, target[s], value);
  28039. } else {
  28040. target[s] = value;
  28041. }
  28042. }
  28043. }
  28044. }
  28045. return target;
  28046. }
  28047. var required$1 = function required(rule, value, source, errors, options, type4) {
  28048. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  28049. errors.push(format(options.messages.required, rule.fullField));
  28050. }
  28051. };
  28052. var whitespace = function whitespace2(rule, value, source, errors, options) {
  28053. if (/^\s+$/.test(value) || value === "") {
  28054. errors.push(format(options.messages.whitespace, rule.fullField));
  28055. }
  28056. };
  28057. var urlReg;
  28058. var getUrlRegex = function() {
  28059. if (urlReg) {
  28060. return urlReg;
  28061. }
  28062. var word = "[a-fA-F\\d:]";
  28063. var b = function b2(options) {
  28064. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  28065. };
  28066. 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}";
  28067. var v6seg = "[a-fA-F\\d]{1,4}";
  28068. 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();
  28069. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  28070. var v4exact = new RegExp("^" + v4 + "$");
  28071. var v6exact = new RegExp("^" + v6 + "$");
  28072. var ip = function ip2(options) {
  28073. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  28074. };
  28075. ip.v4 = function(options) {
  28076. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  28077. };
  28078. ip.v6 = function(options) {
  28079. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  28080. };
  28081. var protocol = "(?:(?:[a-z]+:)?//)";
  28082. var auth = "(?:\\S+(?::\\S*)?@)?";
  28083. var ipv4 = ip.v4().source;
  28084. var ipv6 = ip.v6().source;
  28085. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  28086. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  28087. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  28088. var port = "(?::\\d{2,5})?";
  28089. var path = '(?:[/?#][^\\s"]*)?';
  28090. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  28091. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  28092. return urlReg;
  28093. };
  28094. var pattern$2 = {
  28095. 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,}))$/,
  28096. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  28097. };
  28098. var types = {
  28099. integer: function integer(value) {
  28100. return types.number(value) && parseInt(value, 10) === value;
  28101. },
  28102. "float": function float(value) {
  28103. return types.number(value) && !types.integer(value);
  28104. },
  28105. array: function array(value) {
  28106. return Array.isArray(value);
  28107. },
  28108. regexp: function regexp(value) {
  28109. if (value instanceof RegExp) {
  28110. return true;
  28111. }
  28112. try {
  28113. return !!new RegExp(value);
  28114. } catch (e) {
  28115. return false;
  28116. }
  28117. },
  28118. date: function date(value) {
  28119. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  28120. },
  28121. number: function number(value) {
  28122. if (isNaN(value)) {
  28123. return false;
  28124. }
  28125. return typeof value === "number";
  28126. },
  28127. object: function object(value) {
  28128. return typeof value === "object" && !types.array(value);
  28129. },
  28130. method: function method(value) {
  28131. return typeof value === "function";
  28132. },
  28133. email: function email(value) {
  28134. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  28135. },
  28136. url: function url(value) {
  28137. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  28138. },
  28139. hex: function hex(value) {
  28140. return typeof value === "string" && !!value.match(pattern$2.hex);
  28141. }
  28142. };
  28143. var type$1 = function type(rule, value, source, errors, options) {
  28144. if (rule.required && value === void 0) {
  28145. required$1(rule, value, source, errors, options);
  28146. return;
  28147. }
  28148. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  28149. var ruleType = rule.type;
  28150. if (custom.indexOf(ruleType) > -1) {
  28151. if (!types[ruleType](value)) {
  28152. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  28153. }
  28154. } else if (ruleType && typeof value !== rule.type) {
  28155. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  28156. }
  28157. };
  28158. var range = function range2(rule, value, source, errors, options) {
  28159. var len = typeof rule.len === "number";
  28160. var min = typeof rule.min === "number";
  28161. var max = typeof rule.max === "number";
  28162. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  28163. var val = value;
  28164. var key = null;
  28165. var num = typeof value === "number";
  28166. var str = typeof value === "string";
  28167. var arr = Array.isArray(value);
  28168. if (num) {
  28169. key = "number";
  28170. } else if (str) {
  28171. key = "string";
  28172. } else if (arr) {
  28173. key = "array";
  28174. }
  28175. if (!key) {
  28176. return false;
  28177. }
  28178. if (arr) {
  28179. val = value.length;
  28180. }
  28181. if (str) {
  28182. val = value.replace(spRegexp, "_").length;
  28183. }
  28184. if (len) {
  28185. if (val !== rule.len) {
  28186. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  28187. }
  28188. } else if (min && !max && val < rule.min) {
  28189. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  28190. } else if (max && !min && val > rule.max) {
  28191. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  28192. } else if (min && max && (val < rule.min || val > rule.max)) {
  28193. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  28194. }
  28195. };
  28196. var ENUM$1 = "enum";
  28197. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  28198. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  28199. if (rule[ENUM$1].indexOf(value) === -1) {
  28200. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  28201. }
  28202. };
  28203. var pattern$1 = function pattern(rule, value, source, errors, options) {
  28204. if (rule.pattern) {
  28205. if (rule.pattern instanceof RegExp) {
  28206. rule.pattern.lastIndex = 0;
  28207. if (!rule.pattern.test(value)) {
  28208. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  28209. }
  28210. } else if (typeof rule.pattern === "string") {
  28211. var _pattern = new RegExp(rule.pattern);
  28212. if (!_pattern.test(value)) {
  28213. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  28214. }
  28215. }
  28216. }
  28217. };
  28218. var rules = {
  28219. required: required$1,
  28220. whitespace,
  28221. type: type$1,
  28222. range,
  28223. "enum": enumerable$1,
  28224. pattern: pattern$1
  28225. };
  28226. var string = function string2(rule, value, callback, source, options) {
  28227. var errors = [];
  28228. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28229. if (validate) {
  28230. if (isEmptyValue(value, "string") && !rule.required) {
  28231. return callback();
  28232. }
  28233. rules.required(rule, value, source, errors, options, "string");
  28234. if (!isEmptyValue(value, "string")) {
  28235. rules.type(rule, value, source, errors, options);
  28236. rules.range(rule, value, source, errors, options);
  28237. rules.pattern(rule, value, source, errors, options);
  28238. if (rule.whitespace === true) {
  28239. rules.whitespace(rule, value, source, errors, options);
  28240. }
  28241. }
  28242. }
  28243. callback(errors);
  28244. };
  28245. var method2 = function method3(rule, value, callback, source, options) {
  28246. var errors = [];
  28247. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28248. if (validate) {
  28249. if (isEmptyValue(value) && !rule.required) {
  28250. return callback();
  28251. }
  28252. rules.required(rule, value, source, errors, options);
  28253. if (value !== void 0) {
  28254. rules.type(rule, value, source, errors, options);
  28255. }
  28256. }
  28257. callback(errors);
  28258. };
  28259. var number2 = function number3(rule, value, callback, source, options) {
  28260. var errors = [];
  28261. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28262. if (validate) {
  28263. if (value === "") {
  28264. value = void 0;
  28265. }
  28266. if (isEmptyValue(value) && !rule.required) {
  28267. return callback();
  28268. }
  28269. rules.required(rule, value, source, errors, options);
  28270. if (value !== void 0) {
  28271. rules.type(rule, value, source, errors, options);
  28272. rules.range(rule, value, source, errors, options);
  28273. }
  28274. }
  28275. callback(errors);
  28276. };
  28277. var _boolean = function _boolean2(rule, value, callback, source, options) {
  28278. var errors = [];
  28279. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28280. if (validate) {
  28281. if (isEmptyValue(value) && !rule.required) {
  28282. return callback();
  28283. }
  28284. rules.required(rule, value, source, errors, options);
  28285. if (value !== void 0) {
  28286. rules.type(rule, value, source, errors, options);
  28287. }
  28288. }
  28289. callback(errors);
  28290. };
  28291. var regexp2 = function regexp3(rule, value, callback, source, options) {
  28292. var errors = [];
  28293. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28294. if (validate) {
  28295. if (isEmptyValue(value) && !rule.required) {
  28296. return callback();
  28297. }
  28298. rules.required(rule, value, source, errors, options);
  28299. if (!isEmptyValue(value)) {
  28300. rules.type(rule, value, source, errors, options);
  28301. }
  28302. }
  28303. callback(errors);
  28304. };
  28305. var integer2 = function integer3(rule, value, callback, source, options) {
  28306. var errors = [];
  28307. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28308. if (validate) {
  28309. if (isEmptyValue(value) && !rule.required) {
  28310. return callback();
  28311. }
  28312. rules.required(rule, value, source, errors, options);
  28313. if (value !== void 0) {
  28314. rules.type(rule, value, source, errors, options);
  28315. rules.range(rule, value, source, errors, options);
  28316. }
  28317. }
  28318. callback(errors);
  28319. };
  28320. var floatFn = function floatFn2(rule, value, callback, source, options) {
  28321. var errors = [];
  28322. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28323. if (validate) {
  28324. if (isEmptyValue(value) && !rule.required) {
  28325. return callback();
  28326. }
  28327. rules.required(rule, value, source, errors, options);
  28328. if (value !== void 0) {
  28329. rules.type(rule, value, source, errors, options);
  28330. rules.range(rule, value, source, errors, options);
  28331. }
  28332. }
  28333. callback(errors);
  28334. };
  28335. var array2 = function array3(rule, value, callback, source, options) {
  28336. var errors = [];
  28337. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28338. if (validate) {
  28339. if ((value === void 0 || value === null) && !rule.required) {
  28340. return callback();
  28341. }
  28342. rules.required(rule, value, source, errors, options, "array");
  28343. if (value !== void 0 && value !== null) {
  28344. rules.type(rule, value, source, errors, options);
  28345. rules.range(rule, value, source, errors, options);
  28346. }
  28347. }
  28348. callback(errors);
  28349. };
  28350. var object2 = function object3(rule, value, callback, source, options) {
  28351. var errors = [];
  28352. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28353. if (validate) {
  28354. if (isEmptyValue(value) && !rule.required) {
  28355. return callback();
  28356. }
  28357. rules.required(rule, value, source, errors, options);
  28358. if (value !== void 0) {
  28359. rules.type(rule, value, source, errors, options);
  28360. }
  28361. }
  28362. callback(errors);
  28363. };
  28364. var ENUM = "enum";
  28365. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  28366. var errors = [];
  28367. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28368. if (validate) {
  28369. if (isEmptyValue(value) && !rule.required) {
  28370. return callback();
  28371. }
  28372. rules.required(rule, value, source, errors, options);
  28373. if (value !== void 0) {
  28374. rules[ENUM](rule, value, source, errors, options);
  28375. }
  28376. }
  28377. callback(errors);
  28378. };
  28379. var pattern2 = function pattern3(rule, value, callback, source, options) {
  28380. var errors = [];
  28381. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28382. if (validate) {
  28383. if (isEmptyValue(value, "string") && !rule.required) {
  28384. return callback();
  28385. }
  28386. rules.required(rule, value, source, errors, options);
  28387. if (!isEmptyValue(value, "string")) {
  28388. rules.pattern(rule, value, source, errors, options);
  28389. }
  28390. }
  28391. callback(errors);
  28392. };
  28393. var date2 = function date3(rule, value, callback, source, options) {
  28394. var errors = [];
  28395. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28396. if (validate) {
  28397. if (isEmptyValue(value, "date") && !rule.required) {
  28398. return callback();
  28399. }
  28400. rules.required(rule, value, source, errors, options);
  28401. if (!isEmptyValue(value, "date")) {
  28402. var dateObject;
  28403. if (value instanceof Date) {
  28404. dateObject = value;
  28405. } else {
  28406. dateObject = new Date(value);
  28407. }
  28408. rules.type(rule, dateObject, source, errors, options);
  28409. if (dateObject) {
  28410. rules.range(rule, dateObject.getTime(), source, errors, options);
  28411. }
  28412. }
  28413. }
  28414. callback(errors);
  28415. };
  28416. var required2 = function required3(rule, value, callback, source, options) {
  28417. var errors = [];
  28418. var type4 = Array.isArray(value) ? "array" : typeof value;
  28419. rules.required(rule, value, source, errors, options, type4);
  28420. callback(errors);
  28421. };
  28422. var type2 = function type3(rule, value, callback, source, options) {
  28423. var ruleType = rule.type;
  28424. var errors = [];
  28425. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28426. if (validate) {
  28427. if (isEmptyValue(value, ruleType) && !rule.required) {
  28428. return callback();
  28429. }
  28430. rules.required(rule, value, source, errors, options, ruleType);
  28431. if (!isEmptyValue(value, ruleType)) {
  28432. rules.type(rule, value, source, errors, options);
  28433. }
  28434. }
  28435. callback(errors);
  28436. };
  28437. var any = function any2(rule, value, callback, source, options) {
  28438. var errors = [];
  28439. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28440. if (validate) {
  28441. if (isEmptyValue(value) && !rule.required) {
  28442. return callback();
  28443. }
  28444. rules.required(rule, value, source, errors, options);
  28445. }
  28446. callback(errors);
  28447. };
  28448. var validators = {
  28449. string,
  28450. method: method2,
  28451. number: number2,
  28452. "boolean": _boolean,
  28453. regexp: regexp2,
  28454. integer: integer2,
  28455. "float": floatFn,
  28456. array: array2,
  28457. object: object2,
  28458. "enum": enumerable2,
  28459. pattern: pattern2,
  28460. date: date2,
  28461. url: type2,
  28462. hex: type2,
  28463. email: type2,
  28464. required: required2,
  28465. any
  28466. };
  28467. function newMessages() {
  28468. return {
  28469. "default": "Validation error on field %s",
  28470. required: "%s is required",
  28471. "enum": "%s must be one of %s",
  28472. whitespace: "%s cannot be empty",
  28473. date: {
  28474. format: "%s date %s is invalid for format %s",
  28475. parse: "%s date could not be parsed, %s is invalid ",
  28476. invalid: "%s date %s is invalid"
  28477. },
  28478. types: {
  28479. string: "%s is not a %s",
  28480. method: "%s is not a %s (function)",
  28481. array: "%s is not an %s",
  28482. object: "%s is not an %s",
  28483. number: "%s is not a %s",
  28484. date: "%s is not a %s",
  28485. "boolean": "%s is not a %s",
  28486. integer: "%s is not an %s",
  28487. "float": "%s is not a %s",
  28488. regexp: "%s is not a valid %s",
  28489. email: "%s is not a valid %s",
  28490. url: "%s is not a valid %s",
  28491. hex: "%s is not a valid %s"
  28492. },
  28493. string: {
  28494. len: "%s must be exactly %s characters",
  28495. min: "%s must be at least %s characters",
  28496. max: "%s cannot be longer than %s characters",
  28497. range: "%s must be between %s and %s characters"
  28498. },
  28499. number: {
  28500. len: "%s must equal %s",
  28501. min: "%s cannot be less than %s",
  28502. max: "%s cannot be greater than %s",
  28503. range: "%s must be between %s and %s"
  28504. },
  28505. array: {
  28506. len: "%s must be exactly %s in length",
  28507. min: "%s cannot be less than %s in length",
  28508. max: "%s cannot be greater than %s in length",
  28509. range: "%s must be between %s and %s in length"
  28510. },
  28511. pattern: {
  28512. mismatch: "%s value %s does not match pattern %s"
  28513. },
  28514. clone: function clone() {
  28515. var cloned = JSON.parse(JSON.stringify(this));
  28516. cloned.clone = this.clone;
  28517. return cloned;
  28518. }
  28519. };
  28520. }
  28521. var messages = newMessages();
  28522. var Schema = /* @__PURE__ */ function() {
  28523. function Schema2(descriptor) {
  28524. this.rules = null;
  28525. this._messages = messages;
  28526. this.define(descriptor);
  28527. }
  28528. var _proto = Schema2.prototype;
  28529. _proto.define = function define(rules2) {
  28530. var _this = this;
  28531. if (!rules2) {
  28532. throw new Error("Cannot configure a schema with no rules");
  28533. }
  28534. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  28535. throw new Error("Rules must be an object");
  28536. }
  28537. this.rules = {};
  28538. Object.keys(rules2).forEach(function(name) {
  28539. var item = rules2[name];
  28540. _this.rules[name] = Array.isArray(item) ? item : [item];
  28541. });
  28542. };
  28543. _proto.messages = function messages2(_messages) {
  28544. if (_messages) {
  28545. this._messages = deepMerge(newMessages(), _messages);
  28546. }
  28547. return this._messages;
  28548. };
  28549. _proto.validate = function validate(source_, o, oc) {
  28550. var _this2 = this;
  28551. if (o === void 0) {
  28552. o = {};
  28553. }
  28554. if (oc === void 0) {
  28555. oc = function oc2() {
  28556. };
  28557. }
  28558. var source = source_;
  28559. var options = o;
  28560. var callback = oc;
  28561. if (typeof options === "function") {
  28562. callback = options;
  28563. options = {};
  28564. }
  28565. if (!this.rules || Object.keys(this.rules).length === 0) {
  28566. if (callback) {
  28567. callback(null, source);
  28568. }
  28569. return Promise.resolve(source);
  28570. }
  28571. function complete(results) {
  28572. var errors = [];
  28573. var fields = {};
  28574. function add(e) {
  28575. if (Array.isArray(e)) {
  28576. var _errors;
  28577. errors = (_errors = errors).concat.apply(_errors, e);
  28578. } else {
  28579. errors.push(e);
  28580. }
  28581. }
  28582. for (var i = 0; i < results.length; i++) {
  28583. add(results[i]);
  28584. }
  28585. if (!errors.length) {
  28586. callback(null, source);
  28587. } else {
  28588. fields = convertFieldsError(errors);
  28589. callback(errors, fields);
  28590. }
  28591. }
  28592. if (options.messages) {
  28593. var messages$1 = this.messages();
  28594. if (messages$1 === messages) {
  28595. messages$1 = newMessages();
  28596. }
  28597. deepMerge(messages$1, options.messages);
  28598. options.messages = messages$1;
  28599. } else {
  28600. options.messages = this.messages();
  28601. }
  28602. var series = {};
  28603. var keys = options.keys || Object.keys(this.rules);
  28604. keys.forEach(function(z) {
  28605. var arr = _this2.rules[z];
  28606. var value = source[z];
  28607. arr.forEach(function(r) {
  28608. var rule = r;
  28609. if (typeof rule.transform === "function") {
  28610. if (source === source_) {
  28611. source = _extends({}, source);
  28612. }
  28613. value = source[z] = rule.transform(value);
  28614. }
  28615. if (typeof rule === "function") {
  28616. rule = {
  28617. validator: rule
  28618. };
  28619. } else {
  28620. rule = _extends({}, rule);
  28621. }
  28622. rule.validator = _this2.getValidationMethod(rule);
  28623. if (!rule.validator) {
  28624. return;
  28625. }
  28626. rule.field = z;
  28627. rule.fullField = rule.fullField || z;
  28628. rule.type = _this2.getType(rule);
  28629. series[z] = series[z] || [];
  28630. series[z].push({
  28631. rule,
  28632. value,
  28633. source,
  28634. field: z
  28635. });
  28636. });
  28637. });
  28638. var errorFields = {};
  28639. return asyncMap(series, options, function(data, doIt) {
  28640. var rule = data.rule;
  28641. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  28642. deep = deep && (rule.required || !rule.required && data.value);
  28643. rule.field = data.field;
  28644. function addFullField(key, schema) {
  28645. return _extends({}, schema, {
  28646. fullField: rule.fullField + "." + key,
  28647. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  28648. });
  28649. }
  28650. function cb(e) {
  28651. if (e === void 0) {
  28652. e = [];
  28653. }
  28654. var errorList = Array.isArray(e) ? e : [e];
  28655. if (!options.suppressWarning && errorList.length) {
  28656. Schema2.warning("async-validator:", errorList);
  28657. }
  28658. if (errorList.length && rule.message !== void 0) {
  28659. errorList = [].concat(rule.message);
  28660. }
  28661. var filledErrors = errorList.map(complementError(rule, source));
  28662. if (options.first && filledErrors.length) {
  28663. errorFields[rule.field] = 1;
  28664. return doIt(filledErrors);
  28665. }
  28666. if (!deep) {
  28667. doIt(filledErrors);
  28668. } else {
  28669. if (rule.required && !data.value) {
  28670. if (rule.message !== void 0) {
  28671. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  28672. } else if (options.error) {
  28673. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  28674. }
  28675. return doIt(filledErrors);
  28676. }
  28677. var fieldsSchema = {};
  28678. if (rule.defaultField) {
  28679. Object.keys(data.value).map(function(key) {
  28680. fieldsSchema[key] = rule.defaultField;
  28681. });
  28682. }
  28683. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  28684. var paredFieldsSchema = {};
  28685. Object.keys(fieldsSchema).forEach(function(field) {
  28686. var fieldSchema = fieldsSchema[field];
  28687. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  28688. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  28689. });
  28690. var schema = new Schema2(paredFieldsSchema);
  28691. schema.messages(options.messages);
  28692. if (data.rule.options) {
  28693. data.rule.options.messages = options.messages;
  28694. data.rule.options.error = options.error;
  28695. }
  28696. schema.validate(data.value, data.rule.options || options, function(errs) {
  28697. var finalErrors = [];
  28698. if (filledErrors && filledErrors.length) {
  28699. finalErrors.push.apply(finalErrors, filledErrors);
  28700. }
  28701. if (errs && errs.length) {
  28702. finalErrors.push.apply(finalErrors, errs);
  28703. }
  28704. doIt(finalErrors.length ? finalErrors : null);
  28705. });
  28706. }
  28707. }
  28708. var res;
  28709. if (rule.asyncValidator) {
  28710. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  28711. } else if (rule.validator) {
  28712. try {
  28713. res = rule.validator(rule, data.value, cb, data.source, options);
  28714. } catch (error) {
  28715. console.error == null ? void 0 : console.error(error);
  28716. if (!options.suppressValidatorError) {
  28717. setTimeout(function() {
  28718. throw error;
  28719. }, 0);
  28720. }
  28721. cb(error.message);
  28722. }
  28723. if (res === true) {
  28724. cb();
  28725. } else if (res === false) {
  28726. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  28727. } else if (res instanceof Array) {
  28728. cb(res);
  28729. } else if (res instanceof Error) {
  28730. cb(res.message);
  28731. }
  28732. }
  28733. if (res && res.then) {
  28734. res.then(function() {
  28735. return cb();
  28736. }, function(e) {
  28737. return cb(e);
  28738. });
  28739. }
  28740. }, function(results) {
  28741. complete(results);
  28742. }, source);
  28743. };
  28744. _proto.getType = function getType(rule) {
  28745. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  28746. rule.type = "pattern";
  28747. }
  28748. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  28749. throw new Error(format("Unknown rule type %s", rule.type));
  28750. }
  28751. return rule.type || "string";
  28752. };
  28753. _proto.getValidationMethod = function getValidationMethod(rule) {
  28754. if (typeof rule.validator === "function") {
  28755. return rule.validator;
  28756. }
  28757. var keys = Object.keys(rule);
  28758. var messageIndex = keys.indexOf("message");
  28759. if (messageIndex !== -1) {
  28760. keys.splice(messageIndex, 1);
  28761. }
  28762. if (keys.length === 1 && keys[0] === "required") {
  28763. return validators.required;
  28764. }
  28765. return validators[this.getType(rule)] || void 0;
  28766. };
  28767. return Schema2;
  28768. }();
  28769. Schema.register = function register(type4, validator) {
  28770. if (typeof validator !== "function") {
  28771. throw new Error("Cannot register a validator by type, validator is not a function");
  28772. }
  28773. validators[type4] = validator;
  28774. };
  28775. Schema.warning = warning;
  28776. Schema.messages = messages;
  28777. Schema.validators = validators;
  28778. const formItemValidateStates = [
  28779. "",
  28780. "error",
  28781. "validating",
  28782. "success"
  28783. ];
  28784. const formItemProps = buildProps({
  28785. label: String,
  28786. labelWidth: {
  28787. type: [String, Number],
  28788. default: ""
  28789. },
  28790. prop: {
  28791. type: definePropType([String, Array])
  28792. },
  28793. required: {
  28794. type: Boolean,
  28795. default: void 0
  28796. },
  28797. rules: {
  28798. type: definePropType([Object, Array])
  28799. },
  28800. error: String,
  28801. validateStatus: {
  28802. type: String,
  28803. values: formItemValidateStates
  28804. },
  28805. for: String,
  28806. inlineMessage: {
  28807. type: [String, Boolean],
  28808. default: ""
  28809. },
  28810. showMessage: {
  28811. type: Boolean,
  28812. default: true
  28813. },
  28814. size: {
  28815. type: String,
  28816. values: componentSizes
  28817. }
  28818. });
  28819. const COMPONENT_NAME$d = "ElLabelWrap";
  28820. var FormLabelWrap = vue.defineComponent({
  28821. name: COMPONENT_NAME$d,
  28822. props: {
  28823. isAutoWidth: Boolean,
  28824. updateAll: Boolean
  28825. },
  28826. setup(props, {
  28827. slots
  28828. }) {
  28829. const formContext = vue.inject(formContextKey, void 0);
  28830. const formItemContext = vue.inject(formItemContextKey);
  28831. if (!formItemContext)
  28832. throwError(COMPONENT_NAME$d, "usage: <el-form-item><label-wrap /></el-form-item>");
  28833. const ns = useNamespace("form");
  28834. const el = vue.ref();
  28835. const computedWidth = vue.ref(0);
  28836. const getLabelWidth = () => {
  28837. var _a;
  28838. if ((_a = el.value) == null ? void 0 : _a.firstElementChild) {
  28839. const width = window.getComputedStyle(el.value.firstElementChild).width;
  28840. return Math.ceil(Number.parseFloat(width));
  28841. } else {
  28842. return 0;
  28843. }
  28844. };
  28845. const updateLabelWidth = (action = "update") => {
  28846. vue.nextTick(() => {
  28847. if (slots.default && props.isAutoWidth) {
  28848. if (action === "update") {
  28849. computedWidth.value = getLabelWidth();
  28850. } else if (action === "remove") {
  28851. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  28852. }
  28853. }
  28854. });
  28855. };
  28856. const updateLabelWidthFn = () => updateLabelWidth("update");
  28857. vue.onMounted(() => {
  28858. updateLabelWidthFn();
  28859. });
  28860. vue.onBeforeUnmount(() => {
  28861. updateLabelWidth("remove");
  28862. });
  28863. vue.onUpdated(() => updateLabelWidthFn());
  28864. vue.watch(computedWidth, (val, oldVal) => {
  28865. if (props.updateAll) {
  28866. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  28867. }
  28868. });
  28869. useResizeObserver(vue.computed(() => {
  28870. var _a, _b;
  28871. return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null;
  28872. }), updateLabelWidthFn);
  28873. return () => {
  28874. var _a, _b;
  28875. if (!slots)
  28876. return null;
  28877. const {
  28878. isAutoWidth
  28879. } = props;
  28880. if (isAutoWidth) {
  28881. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  28882. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  28883. const style = {};
  28884. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  28885. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  28886. const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
  28887. if (marginWidth) {
  28888. style[marginPosition] = `${marginWidth}px`;
  28889. }
  28890. }
  28891. return vue.createVNode("div", {
  28892. "ref": el,
  28893. "class": [ns.be("item", "label-wrap")],
  28894. "style": style
  28895. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  28896. } else {
  28897. return vue.createVNode(vue.Fragment, {
  28898. "ref": el
  28899. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  28900. }
  28901. };
  28902. }
  28903. });
  28904. const _hoisted_1$v = ["role", "aria-labelledby"];
  28905. const __default__$I = vue.defineComponent({
  28906. name: "ElFormItem"
  28907. });
  28908. const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
  28909. ...__default__$I,
  28910. props: formItemProps,
  28911. setup(__props, { expose }) {
  28912. const props = __props;
  28913. const slots = vue.useSlots();
  28914. const formContext = vue.inject(formContextKey, void 0);
  28915. const parentFormItemContext = vue.inject(formItemContextKey, void 0);
  28916. const _size = useSize(void 0, { formItem: false });
  28917. const ns = useNamespace("form-item");
  28918. const labelId = useId().value;
  28919. const inputIds = vue.ref([]);
  28920. const validateState = vue.ref("");
  28921. const validateStateDebounced = refDebounced(validateState, 100);
  28922. const validateMessage = vue.ref("");
  28923. const formItemRef = vue.ref();
  28924. let initialValue = void 0;
  28925. let isResettingField = false;
  28926. const labelStyle = vue.computed(() => {
  28927. if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
  28928. return {};
  28929. }
  28930. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  28931. if (labelWidth)
  28932. return { width: labelWidth };
  28933. return {};
  28934. });
  28935. const contentStyle = vue.computed(() => {
  28936. if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
  28937. return {};
  28938. }
  28939. if (!props.label && !props.labelWidth && isNested) {
  28940. return {};
  28941. }
  28942. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  28943. if (!props.label && !slots.label) {
  28944. return { marginLeft: labelWidth };
  28945. }
  28946. return {};
  28947. });
  28948. const formItemClasses = vue.computed(() => [
  28949. ns.b(),
  28950. ns.m(_size.value),
  28951. ns.is("error", validateState.value === "error"),
  28952. ns.is("validating", validateState.value === "validating"),
  28953. ns.is("success", validateState.value === "success"),
  28954. ns.is("required", isRequired.value || props.required),
  28955. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  28956. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  28957. { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
  28958. ]);
  28959. const _inlineMessage = vue.computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  28960. const validateClasses = vue.computed(() => [
  28961. ns.e("error"),
  28962. { [ns.em("error", "inline")]: _inlineMessage.value }
  28963. ]);
  28964. const propString = vue.computed(() => {
  28965. if (!props.prop)
  28966. return "";
  28967. return isString(props.prop) ? props.prop : props.prop.join(".");
  28968. });
  28969. const hasLabel = vue.computed(() => {
  28970. return !!(props.label || slots.label);
  28971. });
  28972. const labelFor = vue.computed(() => {
  28973. return props.for || inputIds.value.length === 1 ? inputIds.value[0] : void 0;
  28974. });
  28975. const isGroup = vue.computed(() => {
  28976. return !labelFor.value && hasLabel.value;
  28977. });
  28978. const isNested = !!parentFormItemContext;
  28979. const fieldValue = vue.computed(() => {
  28980. const model = formContext == null ? void 0 : formContext.model;
  28981. if (!model || !props.prop) {
  28982. return;
  28983. }
  28984. return getProp(model, props.prop).value;
  28985. });
  28986. const normalizedRules = vue.computed(() => {
  28987. const { required } = props;
  28988. const rules = [];
  28989. if (props.rules) {
  28990. rules.push(...castArray$1(props.rules));
  28991. }
  28992. const formRules = formContext == null ? void 0 : formContext.rules;
  28993. if (formRules && props.prop) {
  28994. const _rules = getProp(formRules, props.prop).value;
  28995. if (_rules) {
  28996. rules.push(...castArray$1(_rules));
  28997. }
  28998. }
  28999. if (required !== void 0) {
  29000. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => Object.keys(rule).includes("required"));
  29001. if (requiredRules.length > 0) {
  29002. for (const [rule, i] of requiredRules) {
  29003. if (rule.required === required)
  29004. continue;
  29005. rules[i] = { ...rule, required };
  29006. }
  29007. } else {
  29008. rules.push({ required });
  29009. }
  29010. }
  29011. return rules;
  29012. });
  29013. const validateEnabled = vue.computed(() => normalizedRules.value.length > 0);
  29014. const getFilteredRule = (trigger) => {
  29015. const rules = normalizedRules.value;
  29016. return rules.filter((rule) => {
  29017. if (!rule.trigger || !trigger)
  29018. return true;
  29019. if (Array.isArray(rule.trigger)) {
  29020. return rule.trigger.includes(trigger);
  29021. } else {
  29022. return rule.trigger === trigger;
  29023. }
  29024. }).map(({ trigger: trigger2, ...rule }) => rule);
  29025. };
  29026. const isRequired = vue.computed(() => normalizedRules.value.some((rule) => rule.required));
  29027. const shouldShowError = vue.computed(() => {
  29028. var _a;
  29029. return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true);
  29030. });
  29031. const currentLabel = vue.computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  29032. const setValidationState = (state) => {
  29033. validateState.value = state;
  29034. };
  29035. const onValidationFailed = (error) => {
  29036. var _a, _b;
  29037. const { errors, fields } = error;
  29038. if (!errors || !fields) {
  29039. console.error(error);
  29040. }
  29041. setValidationState("error");
  29042. validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : "";
  29043. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  29044. };
  29045. const onValidationSucceeded = () => {
  29046. setValidationState("success");
  29047. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  29048. };
  29049. const doValidate = async (rules) => {
  29050. const modelName = propString.value;
  29051. const validator = new Schema({
  29052. [modelName]: rules
  29053. });
  29054. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  29055. onValidationSucceeded();
  29056. return true;
  29057. }).catch((err) => {
  29058. onValidationFailed(err);
  29059. return Promise.reject(err);
  29060. });
  29061. };
  29062. const validate = async (trigger, callback) => {
  29063. if (isResettingField || !props.prop) {
  29064. return false;
  29065. }
  29066. const hasCallback = isFunction(callback);
  29067. if (!validateEnabled.value) {
  29068. callback == null ? void 0 : callback(false);
  29069. return false;
  29070. }
  29071. const rules = getFilteredRule(trigger);
  29072. if (rules.length === 0) {
  29073. callback == null ? void 0 : callback(true);
  29074. return true;
  29075. }
  29076. setValidationState("validating");
  29077. return doValidate(rules).then(() => {
  29078. callback == null ? void 0 : callback(true);
  29079. return true;
  29080. }).catch((err) => {
  29081. const { fields } = err;
  29082. callback == null ? void 0 : callback(false, fields);
  29083. return hasCallback ? false : Promise.reject(fields);
  29084. });
  29085. };
  29086. const clearValidate = () => {
  29087. setValidationState("");
  29088. validateMessage.value = "";
  29089. isResettingField = false;
  29090. };
  29091. const resetField = async () => {
  29092. const model = formContext == null ? void 0 : formContext.model;
  29093. if (!model || !props.prop)
  29094. return;
  29095. const computedValue = getProp(model, props.prop);
  29096. isResettingField = true;
  29097. computedValue.value = clone(initialValue);
  29098. await vue.nextTick();
  29099. clearValidate();
  29100. isResettingField = false;
  29101. };
  29102. const addInputId = (id) => {
  29103. if (!inputIds.value.includes(id)) {
  29104. inputIds.value.push(id);
  29105. }
  29106. };
  29107. const removeInputId = (id) => {
  29108. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  29109. };
  29110. vue.watch(() => props.error, (val) => {
  29111. validateMessage.value = val || "";
  29112. setValidationState(val ? "error" : "");
  29113. }, { immediate: true });
  29114. vue.watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  29115. const context = vue.reactive({
  29116. ...vue.toRefs(props),
  29117. $el: formItemRef,
  29118. size: _size,
  29119. validateState,
  29120. labelId,
  29121. inputIds,
  29122. isGroup,
  29123. hasLabel,
  29124. addInputId,
  29125. removeInputId,
  29126. resetField,
  29127. clearValidate,
  29128. validate
  29129. });
  29130. vue.provide(formItemContextKey, context);
  29131. vue.onMounted(() => {
  29132. if (props.prop) {
  29133. formContext == null ? void 0 : formContext.addField(context);
  29134. initialValue = clone(fieldValue.value);
  29135. }
  29136. });
  29137. vue.onBeforeUnmount(() => {
  29138. formContext == null ? void 0 : formContext.removeField(context);
  29139. });
  29140. expose({
  29141. size: _size,
  29142. validateMessage,
  29143. validateState,
  29144. validate,
  29145. clearValidate,
  29146. resetField
  29147. });
  29148. return (_ctx, _cache) => {
  29149. var _a;
  29150. return vue.openBlock(), vue.createElementBlock("div", {
  29151. ref_key: "formItemRef",
  29152. ref: formItemRef,
  29153. class: vue.normalizeClass(vue.unref(formItemClasses)),
  29154. role: vue.unref(isGroup) ? "group" : void 0,
  29155. "aria-labelledby": vue.unref(isGroup) ? vue.unref(labelId) : void 0
  29156. }, [
  29157. vue.createVNode(vue.unref(FormLabelWrap), {
  29158. "is-auto-width": vue.unref(labelStyle).width === "auto",
  29159. "update-all": ((_a = vue.unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto"
  29160. }, {
  29161. default: vue.withCtx(() => [
  29162. vue.unref(hasLabel) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(labelFor) ? "label" : "div"), {
  29163. key: 0,
  29164. id: vue.unref(labelId),
  29165. for: vue.unref(labelFor),
  29166. class: vue.normalizeClass(vue.unref(ns).e("label")),
  29167. style: vue.normalizeStyle(vue.unref(labelStyle))
  29168. }, {
  29169. default: vue.withCtx(() => [
  29170. vue.renderSlot(_ctx.$slots, "label", { label: vue.unref(currentLabel) }, () => [
  29171. vue.createTextVNode(vue.toDisplayString(vue.unref(currentLabel)), 1)
  29172. ])
  29173. ]),
  29174. _: 3
  29175. }, 8, ["id", "for", "class", "style"])) : vue.createCommentVNode("v-if", true)
  29176. ]),
  29177. _: 3
  29178. }, 8, ["is-auto-width", "update-all"]),
  29179. vue.createElementVNode("div", {
  29180. class: vue.normalizeClass(vue.unref(ns).e("content")),
  29181. style: vue.normalizeStyle(vue.unref(contentStyle))
  29182. }, [
  29183. vue.renderSlot(_ctx.$slots, "default"),
  29184. vue.createVNode(vue.Transition, {
  29185. name: `${vue.unref(ns).namespace.value}-zoom-in-top`
  29186. }, {
  29187. default: vue.withCtx(() => [
  29188. vue.unref(shouldShowError) ? vue.renderSlot(_ctx.$slots, "error", {
  29189. key: 0,
  29190. error: validateMessage.value
  29191. }, () => [
  29192. vue.createElementVNode("div", {
  29193. class: vue.normalizeClass(vue.unref(validateClasses))
  29194. }, vue.toDisplayString(validateMessage.value), 3)
  29195. ]) : vue.createCommentVNode("v-if", true)
  29196. ]),
  29197. _: 3
  29198. }, 8, ["name"])
  29199. ], 6)
  29200. ], 10, _hoisted_1$v);
  29201. };
  29202. }
  29203. });
  29204. var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__file", "form-item.vue"]]);
  29205. const ElForm = withInstall(Form, {
  29206. FormItem
  29207. });
  29208. const ElFormItem = withNoopInstall(FormItem);
  29209. const imageViewerProps = buildProps({
  29210. urlList: {
  29211. type: definePropType(Array),
  29212. default: () => mutable([])
  29213. },
  29214. zIndex: {
  29215. type: Number
  29216. },
  29217. initialIndex: {
  29218. type: Number,
  29219. default: 0
  29220. },
  29221. infinite: {
  29222. type: Boolean,
  29223. default: true
  29224. },
  29225. hideOnClickModal: {
  29226. type: Boolean,
  29227. default: false
  29228. },
  29229. teleported: {
  29230. type: Boolean,
  29231. default: false
  29232. },
  29233. closeOnPressEscape: {
  29234. type: Boolean,
  29235. default: true
  29236. }
  29237. });
  29238. const imageViewerEmits = {
  29239. close: () => true,
  29240. switch: (index) => isNumber(index)
  29241. };
  29242. const _hoisted_1$u = ["src"];
  29243. const __default__$H = vue.defineComponent({
  29244. name: "ElImageViewer"
  29245. });
  29246. const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
  29247. ...__default__$H,
  29248. props: imageViewerProps,
  29249. emits: imageViewerEmits,
  29250. setup(__props, { expose, emit }) {
  29251. const props = __props;
  29252. const modes = {
  29253. CONTAIN: {
  29254. name: "contain",
  29255. icon: vue.markRaw(full_screen_default)
  29256. },
  29257. ORIGINAL: {
  29258. name: "original",
  29259. icon: vue.markRaw(scale_to_original_default)
  29260. }
  29261. };
  29262. const mousewheelEventName = isFirefox() ? "DOMMouseScroll" : "mousewheel";
  29263. const { t } = useLocale();
  29264. const ns = useNamespace("image-viewer");
  29265. const { nextZIndex } = useZIndex();
  29266. const wrapper = vue.ref();
  29267. const imgRefs = vue.ref([]);
  29268. const scopeEventListener = vue.effectScope();
  29269. const loading = vue.ref(true);
  29270. const activeIndex = vue.ref(props.initialIndex);
  29271. const mode = vue.shallowRef(modes.CONTAIN);
  29272. const transform = vue.ref({
  29273. scale: 1,
  29274. deg: 0,
  29275. offsetX: 0,
  29276. offsetY: 0,
  29277. enableTransition: false
  29278. });
  29279. const isSingle = vue.computed(() => {
  29280. const { urlList } = props;
  29281. return urlList.length <= 1;
  29282. });
  29283. const isFirst = vue.computed(() => {
  29284. return activeIndex.value === 0;
  29285. });
  29286. const isLast = vue.computed(() => {
  29287. return activeIndex.value === props.urlList.length - 1;
  29288. });
  29289. const currentImg = vue.computed(() => {
  29290. return props.urlList[activeIndex.value];
  29291. });
  29292. const imgStyle = vue.computed(() => {
  29293. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  29294. let translateX = offsetX / scale;
  29295. let translateY = offsetY / scale;
  29296. switch (deg % 360) {
  29297. case 90:
  29298. case -270:
  29299. [translateX, translateY] = [translateY, -translateX];
  29300. break;
  29301. case 180:
  29302. case -180:
  29303. [translateX, translateY] = [-translateX, -translateY];
  29304. break;
  29305. case 270:
  29306. case -90:
  29307. [translateX, translateY] = [-translateY, translateX];
  29308. break;
  29309. }
  29310. const style = {
  29311. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  29312. transition: enableTransition ? "transform .3s" : ""
  29313. };
  29314. if (mode.value.name === modes.CONTAIN.name) {
  29315. style.maxWidth = style.maxHeight = "100%";
  29316. }
  29317. return style;
  29318. });
  29319. const computedZIndex = vue.computed(() => {
  29320. return isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  29321. });
  29322. function hide() {
  29323. unregisterEventListener();
  29324. emit("close");
  29325. }
  29326. function registerEventListener() {
  29327. const keydownHandler = throttle((e) => {
  29328. switch (e.code) {
  29329. case EVENT_CODE.esc:
  29330. props.closeOnPressEscape && hide();
  29331. break;
  29332. case EVENT_CODE.space:
  29333. toggleMode();
  29334. break;
  29335. case EVENT_CODE.left:
  29336. prev();
  29337. break;
  29338. case EVENT_CODE.up:
  29339. handleActions("zoomIn");
  29340. break;
  29341. case EVENT_CODE.right:
  29342. next();
  29343. break;
  29344. case EVENT_CODE.down:
  29345. handleActions("zoomOut");
  29346. break;
  29347. }
  29348. });
  29349. const mousewheelHandler = throttle((e) => {
  29350. const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
  29351. if (delta > 0) {
  29352. handleActions("zoomIn", {
  29353. zoomRate: 1.2,
  29354. enableTransition: false
  29355. });
  29356. } else {
  29357. handleActions("zoomOut", {
  29358. zoomRate: 1.2,
  29359. enableTransition: false
  29360. });
  29361. }
  29362. });
  29363. scopeEventListener.run(() => {
  29364. useEventListener(document, "keydown", keydownHandler);
  29365. useEventListener(document, mousewheelEventName, mousewheelHandler);
  29366. });
  29367. }
  29368. function unregisterEventListener() {
  29369. scopeEventListener.stop();
  29370. }
  29371. function handleImgLoad() {
  29372. loading.value = false;
  29373. }
  29374. function handleImgError(e) {
  29375. loading.value = false;
  29376. e.target.alt = t("el.image.error");
  29377. }
  29378. function handleMouseDown(e) {
  29379. if (loading.value || e.button !== 0 || !wrapper.value)
  29380. return;
  29381. transform.value.enableTransition = false;
  29382. const { offsetX, offsetY } = transform.value;
  29383. const startX = e.pageX;
  29384. const startY = e.pageY;
  29385. const dragHandler = throttle((ev) => {
  29386. transform.value = {
  29387. ...transform.value,
  29388. offsetX: offsetX + ev.pageX - startX,
  29389. offsetY: offsetY + ev.pageY - startY
  29390. };
  29391. });
  29392. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  29393. useEventListener(document, "mouseup", () => {
  29394. removeMousemove();
  29395. });
  29396. e.preventDefault();
  29397. }
  29398. function reset() {
  29399. transform.value = {
  29400. scale: 1,
  29401. deg: 0,
  29402. offsetX: 0,
  29403. offsetY: 0,
  29404. enableTransition: false
  29405. };
  29406. }
  29407. function toggleMode() {
  29408. if (loading.value)
  29409. return;
  29410. const modeNames = keysOf(modes);
  29411. const modeValues = Object.values(modes);
  29412. const currentMode = mode.value.name;
  29413. const index = modeValues.findIndex((i) => i.name === currentMode);
  29414. const nextIndex = (index + 1) % modeNames.length;
  29415. mode.value = modes[modeNames[nextIndex]];
  29416. reset();
  29417. }
  29418. function setActiveItem(index) {
  29419. const len = props.urlList.length;
  29420. activeIndex.value = (index + len) % len;
  29421. }
  29422. function prev() {
  29423. if (isFirst.value && !props.infinite)
  29424. return;
  29425. setActiveItem(activeIndex.value - 1);
  29426. }
  29427. function next() {
  29428. if (isLast.value && !props.infinite)
  29429. return;
  29430. setActiveItem(activeIndex.value + 1);
  29431. }
  29432. function handleActions(action, options = {}) {
  29433. if (loading.value)
  29434. return;
  29435. const { zoomRate, rotateDeg, enableTransition } = {
  29436. zoomRate: 1.4,
  29437. rotateDeg: 90,
  29438. enableTransition: true,
  29439. ...options
  29440. };
  29441. switch (action) {
  29442. case "zoomOut":
  29443. if (transform.value.scale > 0.2) {
  29444. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  29445. }
  29446. break;
  29447. case "zoomIn":
  29448. if (transform.value.scale < 7) {
  29449. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  29450. }
  29451. break;
  29452. case "clockwise":
  29453. transform.value.deg += rotateDeg;
  29454. break;
  29455. case "anticlockwise":
  29456. transform.value.deg -= rotateDeg;
  29457. break;
  29458. }
  29459. transform.value.enableTransition = enableTransition;
  29460. }
  29461. vue.watch(currentImg, () => {
  29462. vue.nextTick(() => {
  29463. const $img = imgRefs.value[0];
  29464. if (!($img == null ? void 0 : $img.complete)) {
  29465. loading.value = true;
  29466. }
  29467. });
  29468. });
  29469. vue.watch(activeIndex, (val) => {
  29470. reset();
  29471. emit("switch", val);
  29472. });
  29473. vue.onMounted(() => {
  29474. var _a, _b;
  29475. registerEventListener();
  29476. (_b = (_a = wrapper.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  29477. });
  29478. expose({
  29479. setActiveItem
  29480. });
  29481. return (_ctx, _cache) => {
  29482. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  29483. to: "body",
  29484. disabled: !_ctx.teleported
  29485. }, [
  29486. vue.createVNode(vue.Transition, {
  29487. name: "viewer-fade",
  29488. appear: ""
  29489. }, {
  29490. default: vue.withCtx(() => [
  29491. vue.createElementVNode("div", {
  29492. ref_key: "wrapper",
  29493. ref: wrapper,
  29494. tabindex: -1,
  29495. class: vue.normalizeClass(vue.unref(ns).e("wrapper")),
  29496. style: vue.normalizeStyle({ zIndex: vue.unref(computedZIndex) })
  29497. }, [
  29498. vue.createElementVNode("div", {
  29499. class: vue.normalizeClass(vue.unref(ns).e("mask")),
  29500. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"]))
  29501. }, null, 2),
  29502. vue.createCommentVNode(" CLOSE "),
  29503. vue.createElementVNode("span", {
  29504. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("close")]),
  29505. onClick: hide
  29506. }, [
  29507. vue.createVNode(vue.unref(ElIcon), null, {
  29508. default: vue.withCtx(() => [
  29509. vue.createVNode(vue.unref(close_default))
  29510. ]),
  29511. _: 1
  29512. })
  29513. ], 2),
  29514. vue.createCommentVNode(" ARROW "),
  29515. !vue.unref(isSingle) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  29516. vue.createElementVNode("span", {
  29517. class: vue.normalizeClass([
  29518. vue.unref(ns).e("btn"),
  29519. vue.unref(ns).e("prev"),
  29520. vue.unref(ns).is("disabled", !_ctx.infinite && vue.unref(isFirst))
  29521. ]),
  29522. onClick: prev
  29523. }, [
  29524. vue.createVNode(vue.unref(ElIcon), null, {
  29525. default: vue.withCtx(() => [
  29526. vue.createVNode(vue.unref(arrow_left_default))
  29527. ]),
  29528. _: 1
  29529. })
  29530. ], 2),
  29531. vue.createElementVNode("span", {
  29532. class: vue.normalizeClass([
  29533. vue.unref(ns).e("btn"),
  29534. vue.unref(ns).e("next"),
  29535. vue.unref(ns).is("disabled", !_ctx.infinite && vue.unref(isLast))
  29536. ]),
  29537. onClick: next
  29538. }, [
  29539. vue.createVNode(vue.unref(ElIcon), null, {
  29540. default: vue.withCtx(() => [
  29541. vue.createVNode(vue.unref(arrow_right_default))
  29542. ]),
  29543. _: 1
  29544. })
  29545. ], 2)
  29546. ], 64)) : vue.createCommentVNode("v-if", true),
  29547. vue.createCommentVNode(" ACTIONS "),
  29548. vue.createElementVNode("div", {
  29549. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("actions")])
  29550. }, [
  29551. vue.createElementVNode("div", {
  29552. class: vue.normalizeClass(vue.unref(ns).e("actions__inner"))
  29553. }, [
  29554. vue.createVNode(vue.unref(ElIcon), {
  29555. onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
  29556. }, {
  29557. default: vue.withCtx(() => [
  29558. vue.createVNode(vue.unref(zoom_out_default))
  29559. ]),
  29560. _: 1
  29561. }),
  29562. vue.createVNode(vue.unref(ElIcon), {
  29563. onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
  29564. }, {
  29565. default: vue.withCtx(() => [
  29566. vue.createVNode(vue.unref(zoom_in_default))
  29567. ]),
  29568. _: 1
  29569. }),
  29570. vue.createElementVNode("i", {
  29571. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  29572. }, null, 2),
  29573. vue.createVNode(vue.unref(ElIcon), { onClick: toggleMode }, {
  29574. default: vue.withCtx(() => [
  29575. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mode).icon)))
  29576. ]),
  29577. _: 1
  29578. }),
  29579. vue.createElementVNode("i", {
  29580. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  29581. }, null, 2),
  29582. vue.createVNode(vue.unref(ElIcon), {
  29583. onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
  29584. }, {
  29585. default: vue.withCtx(() => [
  29586. vue.createVNode(vue.unref(refresh_left_default))
  29587. ]),
  29588. _: 1
  29589. }),
  29590. vue.createVNode(vue.unref(ElIcon), {
  29591. onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
  29592. }, {
  29593. default: vue.withCtx(() => [
  29594. vue.createVNode(vue.unref(refresh_right_default))
  29595. ]),
  29596. _: 1
  29597. })
  29598. ], 2)
  29599. ], 2),
  29600. vue.createCommentVNode(" CANVAS "),
  29601. vue.createElementVNode("div", {
  29602. class: vue.normalizeClass(vue.unref(ns).e("canvas"))
  29603. }, [
  29604. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.urlList, (url, i) => {
  29605. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("img", {
  29606. ref_for: true,
  29607. ref: (el) => imgRefs.value[i] = el,
  29608. key: url,
  29609. src: url,
  29610. style: vue.normalizeStyle(vue.unref(imgStyle)),
  29611. class: vue.normalizeClass(vue.unref(ns).e("img")),
  29612. onLoad: handleImgLoad,
  29613. onError: handleImgError,
  29614. onMousedown: handleMouseDown
  29615. }, null, 46, _hoisted_1$u)), [
  29616. [vue.vShow, i === activeIndex.value]
  29617. ]);
  29618. }), 128))
  29619. ], 2),
  29620. vue.renderSlot(_ctx.$slots, "default")
  29621. ], 6)
  29622. ]),
  29623. _: 3
  29624. })
  29625. ], 8, ["disabled"]);
  29626. };
  29627. }
  29628. });
  29629. var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__file", "image-viewer.vue"]]);
  29630. const ElImageViewer = withInstall(ImageViewer);
  29631. const imageProps = buildProps({
  29632. hideOnClickModal: {
  29633. type: Boolean,
  29634. default: false
  29635. },
  29636. src: {
  29637. type: String,
  29638. default: ""
  29639. },
  29640. fit: {
  29641. type: String,
  29642. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  29643. default: ""
  29644. },
  29645. loading: {
  29646. type: String,
  29647. values: ["eager", "lazy"]
  29648. },
  29649. lazy: {
  29650. type: Boolean,
  29651. default: false
  29652. },
  29653. scrollContainer: {
  29654. type: definePropType([String, Object])
  29655. },
  29656. previewSrcList: {
  29657. type: definePropType(Array),
  29658. default: () => mutable([])
  29659. },
  29660. previewTeleported: {
  29661. type: Boolean,
  29662. default: false
  29663. },
  29664. zIndex: {
  29665. type: Number
  29666. },
  29667. initialIndex: {
  29668. type: Number,
  29669. default: 0
  29670. },
  29671. infinite: {
  29672. type: Boolean,
  29673. default: true
  29674. },
  29675. closeOnPressEscape: {
  29676. type: Boolean,
  29677. default: true
  29678. }
  29679. });
  29680. const imageEmits = {
  29681. load: (evt) => evt instanceof Event,
  29682. error: (evt) => evt instanceof Event,
  29683. switch: (val) => isNumber(val),
  29684. close: () => true,
  29685. show: () => true
  29686. };
  29687. const _hoisted_1$t = ["src", "loading"];
  29688. const _hoisted_2$j = { key: 0 };
  29689. const __default__$G = vue.defineComponent({
  29690. name: "ElImage",
  29691. inheritAttrs: false
  29692. });
  29693. const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
  29694. ...__default__$G,
  29695. props: imageProps,
  29696. emits: imageEmits,
  29697. setup(__props, { emit }) {
  29698. const props = __props;
  29699. let prevOverflow = "";
  29700. const { t } = useLocale();
  29701. const ns = useNamespace("image");
  29702. const rawAttrs = vue.useAttrs();
  29703. const attrs = useAttrs();
  29704. const imageSrc = vue.ref();
  29705. const hasLoadError = vue.ref(false);
  29706. const isLoading = vue.ref(true);
  29707. const showViewer = vue.ref(false);
  29708. const container = vue.ref();
  29709. const _scrollContainer = vue.ref();
  29710. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  29711. let stopScrollListener;
  29712. let stopWheelListener;
  29713. const containerStyle = vue.computed(() => rawAttrs.style);
  29714. const imageStyle = vue.computed(() => {
  29715. const { fit } = props;
  29716. if (isClient && fit) {
  29717. return { objectFit: fit };
  29718. }
  29719. return {};
  29720. });
  29721. const preview = vue.computed(() => {
  29722. const { previewSrcList } = props;
  29723. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  29724. });
  29725. const imageIndex = vue.computed(() => {
  29726. const { previewSrcList, initialIndex } = props;
  29727. let previewIndex = initialIndex;
  29728. if (initialIndex > previewSrcList.length - 1) {
  29729. previewIndex = 0;
  29730. }
  29731. return previewIndex;
  29732. });
  29733. const isManual = vue.computed(() => {
  29734. if (props.loading === "eager")
  29735. return false;
  29736. return !supportLoading && props.loading === "lazy" || props.lazy;
  29737. });
  29738. const loadImage = () => {
  29739. if (!isClient)
  29740. return;
  29741. isLoading.value = true;
  29742. hasLoadError.value = false;
  29743. imageSrc.value = props.src;
  29744. };
  29745. function handleLoad(event) {
  29746. isLoading.value = false;
  29747. hasLoadError.value = false;
  29748. emit("load", event);
  29749. }
  29750. function handleError(event) {
  29751. isLoading.value = false;
  29752. hasLoadError.value = true;
  29753. emit("error", event);
  29754. }
  29755. function handleLazyLoad() {
  29756. if (isInContainer(container.value, _scrollContainer.value)) {
  29757. loadImage();
  29758. removeLazyLoadListener();
  29759. }
  29760. }
  29761. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200);
  29762. async function addLazyLoadListener() {
  29763. var _a;
  29764. if (!isClient)
  29765. return;
  29766. await vue.nextTick();
  29767. const { scrollContainer } = props;
  29768. if (isElement$1(scrollContainer)) {
  29769. _scrollContainer.value = scrollContainer;
  29770. } else if (isString(scrollContainer) && scrollContainer !== "") {
  29771. _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
  29772. } else if (container.value) {
  29773. _scrollContainer.value = getScrollContainer(container.value);
  29774. }
  29775. if (_scrollContainer.value) {
  29776. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  29777. setTimeout(() => handleLazyLoad(), 100);
  29778. }
  29779. }
  29780. function removeLazyLoadListener() {
  29781. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  29782. return;
  29783. stopScrollListener == null ? void 0 : stopScrollListener();
  29784. _scrollContainer.value = void 0;
  29785. }
  29786. function wheelHandler(e) {
  29787. if (!e.ctrlKey)
  29788. return;
  29789. if (e.deltaY < 0) {
  29790. e.preventDefault();
  29791. return false;
  29792. } else if (e.deltaY > 0) {
  29793. e.preventDefault();
  29794. return false;
  29795. }
  29796. }
  29797. function clickHandler() {
  29798. if (!preview.value)
  29799. return;
  29800. stopWheelListener = useEventListener("wheel", wheelHandler, {
  29801. passive: false
  29802. });
  29803. prevOverflow = document.body.style.overflow;
  29804. document.body.style.overflow = "hidden";
  29805. showViewer.value = true;
  29806. emit("show");
  29807. }
  29808. function closeViewer() {
  29809. stopWheelListener == null ? void 0 : stopWheelListener();
  29810. document.body.style.overflow = prevOverflow;
  29811. showViewer.value = false;
  29812. emit("close");
  29813. }
  29814. function switchViewer(val) {
  29815. emit("switch", val);
  29816. }
  29817. vue.watch(() => props.src, () => {
  29818. if (isManual.value) {
  29819. isLoading.value = true;
  29820. hasLoadError.value = false;
  29821. removeLazyLoadListener();
  29822. addLazyLoadListener();
  29823. } else {
  29824. loadImage();
  29825. }
  29826. });
  29827. vue.onMounted(() => {
  29828. if (isManual.value) {
  29829. addLazyLoadListener();
  29830. } else {
  29831. loadImage();
  29832. }
  29833. });
  29834. return (_ctx, _cache) => {
  29835. return vue.openBlock(), vue.createElementBlock("div", {
  29836. ref_key: "container",
  29837. ref: container,
  29838. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  29839. style: vue.normalizeStyle(vue.unref(containerStyle))
  29840. }, [
  29841. imageSrc.value !== void 0 && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", vue.mergeProps({ key: 0 }, vue.unref(attrs), {
  29842. src: imageSrc.value,
  29843. loading: _ctx.loading,
  29844. style: vue.unref(imageStyle),
  29845. class: [
  29846. vue.unref(ns).e("inner"),
  29847. vue.unref(preview) && vue.unref(ns).e("preview"),
  29848. isLoading.value && vue.unref(ns).is("loading")
  29849. ],
  29850. onClick: clickHandler,
  29851. onLoad: handleLoad,
  29852. onError: handleError
  29853. }), null, 16, _hoisted_1$t)) : vue.createCommentVNode("v-if", true),
  29854. isLoading.value || hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("div", {
  29855. key: 1,
  29856. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  29857. }, [
  29858. isLoading.value ? vue.renderSlot(_ctx.$slots, "placeholder", { key: 0 }, () => [
  29859. vue.createElementVNode("div", {
  29860. class: vue.normalizeClass(vue.unref(ns).e("placeholder"))
  29861. }, null, 2)
  29862. ]) : hasLoadError.value ? vue.renderSlot(_ctx.$slots, "error", { key: 1 }, () => [
  29863. vue.createElementVNode("div", {
  29864. class: vue.normalizeClass(vue.unref(ns).e("error"))
  29865. }, vue.toDisplayString(vue.unref(t)("el.image.error")), 3)
  29866. ]) : vue.createCommentVNode("v-if", true)
  29867. ], 2)) : vue.createCommentVNode("v-if", true),
  29868. vue.unref(preview) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  29869. showViewer.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElImageViewer), {
  29870. key: 0,
  29871. "z-index": _ctx.zIndex,
  29872. "initial-index": vue.unref(imageIndex),
  29873. infinite: _ctx.infinite,
  29874. "url-list": _ctx.previewSrcList,
  29875. "hide-on-click-modal": _ctx.hideOnClickModal,
  29876. teleported: _ctx.previewTeleported,
  29877. "close-on-press-escape": _ctx.closeOnPressEscape,
  29878. onClose: closeViewer,
  29879. onSwitch: switchViewer
  29880. }, {
  29881. default: vue.withCtx(() => [
  29882. _ctx.$slots.viewer ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$j, [
  29883. vue.renderSlot(_ctx.$slots, "viewer")
  29884. ])) : vue.createCommentVNode("v-if", true)
  29885. ]),
  29886. _: 3
  29887. }, 8, ["z-index", "initial-index", "infinite", "url-list", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : vue.createCommentVNode("v-if", true)
  29888. ], 64)) : vue.createCommentVNode("v-if", true)
  29889. ], 6);
  29890. };
  29891. }
  29892. });
  29893. var Image = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__file", "image.vue"]]);
  29894. const ElImage = withInstall(Image);
  29895. const inputNumberProps = buildProps({
  29896. id: {
  29897. type: String,
  29898. default: void 0
  29899. },
  29900. step: {
  29901. type: Number,
  29902. default: 1
  29903. },
  29904. stepStrictly: Boolean,
  29905. max: {
  29906. type: Number,
  29907. default: Number.POSITIVE_INFINITY
  29908. },
  29909. min: {
  29910. type: Number,
  29911. default: Number.NEGATIVE_INFINITY
  29912. },
  29913. modelValue: Number,
  29914. readonly: Boolean,
  29915. disabled: Boolean,
  29916. size: useSizeProp,
  29917. controls: {
  29918. type: Boolean,
  29919. default: true
  29920. },
  29921. controlsPosition: {
  29922. type: String,
  29923. default: "",
  29924. values: ["", "right"]
  29925. },
  29926. valueOnClear: {
  29927. type: [String, Number, null],
  29928. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  29929. default: null
  29930. },
  29931. name: String,
  29932. label: String,
  29933. placeholder: String,
  29934. precision: {
  29935. type: Number,
  29936. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  29937. },
  29938. validateEvent: {
  29939. type: Boolean,
  29940. default: true
  29941. }
  29942. });
  29943. const inputNumberEmits = {
  29944. [CHANGE_EVENT]: (prev, cur) => prev !== cur,
  29945. blur: (e) => e instanceof FocusEvent,
  29946. focus: (e) => e instanceof FocusEvent,
  29947. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  29948. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  29949. };
  29950. const _hoisted_1$s = ["aria-label", "onKeydown"];
  29951. const _hoisted_2$i = ["aria-label", "onKeydown"];
  29952. const __default__$F = vue.defineComponent({
  29953. name: "ElInputNumber"
  29954. });
  29955. const _sfc_main$W = /* @__PURE__ */ vue.defineComponent({
  29956. ...__default__$F,
  29957. props: inputNumberProps,
  29958. emits: inputNumberEmits,
  29959. setup(__props, { expose, emit }) {
  29960. const props = __props;
  29961. const { t } = useLocale();
  29962. const ns = useNamespace("input-number");
  29963. const input = vue.ref();
  29964. const data = vue.reactive({
  29965. currentValue: props.modelValue,
  29966. userInput: null
  29967. });
  29968. const { formItem } = useFormItem();
  29969. const minDisabled = vue.computed(() => isNumber(props.modelValue) && ensurePrecision(props.modelValue, -1) < props.min);
  29970. const maxDisabled = vue.computed(() => isNumber(props.modelValue) && ensurePrecision(props.modelValue) > props.max);
  29971. const numPrecision = vue.computed(() => {
  29972. const stepPrecision = getPrecision(props.step);
  29973. if (!isUndefined(props.precision)) {
  29974. if (stepPrecision > props.precision) ;
  29975. return props.precision;
  29976. } else {
  29977. return Math.max(getPrecision(props.modelValue), stepPrecision);
  29978. }
  29979. });
  29980. const controlsAtRight = vue.computed(() => {
  29981. return props.controls && props.controlsPosition === "right";
  29982. });
  29983. const inputNumberSize = useSize();
  29984. const inputNumberDisabled = useDisabled();
  29985. const displayValue = vue.computed(() => {
  29986. if (data.userInput !== null) {
  29987. return data.userInput;
  29988. }
  29989. let currentValue = data.currentValue;
  29990. if (isNil(currentValue))
  29991. return "";
  29992. if (isNumber(currentValue)) {
  29993. if (Number.isNaN(currentValue))
  29994. return "";
  29995. if (!isUndefined(props.precision)) {
  29996. currentValue = currentValue.toFixed(props.precision);
  29997. }
  29998. }
  29999. return currentValue;
  30000. });
  30001. const toPrecision = (num, pre) => {
  30002. if (isUndefined(pre))
  30003. pre = numPrecision.value;
  30004. if (pre === 0)
  30005. return Math.round(num);
  30006. let snum = String(num);
  30007. const pointPos = snum.indexOf(".");
  30008. if (pointPos === -1)
  30009. return num;
  30010. const nums = snum.replace(".", "").split("");
  30011. const datum = nums[pointPos + pre];
  30012. if (!datum)
  30013. return num;
  30014. const length = snum.length;
  30015. if (snum.charAt(length - 1) === "5") {
  30016. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  30017. }
  30018. return Number.parseFloat(Number(snum).toFixed(pre));
  30019. };
  30020. const getPrecision = (value) => {
  30021. if (isNil(value))
  30022. return 0;
  30023. const valueString = value.toString();
  30024. const dotPosition = valueString.indexOf(".");
  30025. let precision = 0;
  30026. if (dotPosition !== -1) {
  30027. precision = valueString.length - dotPosition - 1;
  30028. }
  30029. return precision;
  30030. };
  30031. const ensurePrecision = (val, coefficient = 1) => {
  30032. if (!isNumber(val))
  30033. return data.currentValue;
  30034. return toPrecision(val + props.step * coefficient);
  30035. };
  30036. const increase = () => {
  30037. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  30038. return;
  30039. const value = Number(displayValue.value) || 0;
  30040. const newVal = ensurePrecision(value);
  30041. setCurrentValue(newVal);
  30042. emit(INPUT_EVENT, data.currentValue);
  30043. };
  30044. const decrease = () => {
  30045. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  30046. return;
  30047. const value = Number(displayValue.value) || 0;
  30048. const newVal = ensurePrecision(value, -1);
  30049. setCurrentValue(newVal);
  30050. emit(INPUT_EVENT, data.currentValue);
  30051. };
  30052. const verifyValue = (value, update) => {
  30053. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  30054. let newVal = Number(value);
  30055. if (isNil(value) || Number.isNaN(newVal)) {
  30056. return null;
  30057. }
  30058. if (value === "") {
  30059. if (valueOnClear === null) {
  30060. return null;
  30061. }
  30062. newVal = isString(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
  30063. }
  30064. if (stepStrictly) {
  30065. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  30066. }
  30067. if (!isUndefined(precision)) {
  30068. newVal = toPrecision(newVal, precision);
  30069. }
  30070. if (newVal > max || newVal < min) {
  30071. newVal = newVal > max ? max : min;
  30072. update && emit(UPDATE_MODEL_EVENT, newVal);
  30073. }
  30074. return newVal;
  30075. };
  30076. const setCurrentValue = (value, emitChange = true) => {
  30077. var _a;
  30078. const oldVal = data.currentValue;
  30079. const newVal = verifyValue(value);
  30080. if (oldVal === newVal)
  30081. return;
  30082. if (!emitChange) {
  30083. emit(UPDATE_MODEL_EVENT, newVal);
  30084. return;
  30085. }
  30086. data.userInput = null;
  30087. emit(UPDATE_MODEL_EVENT, newVal);
  30088. emit(CHANGE_EVENT, newVal, oldVal);
  30089. if (props.validateEvent) {
  30090. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  30091. }
  30092. data.currentValue = newVal;
  30093. };
  30094. const handleInput = (value) => {
  30095. data.userInput = value;
  30096. const newVal = value === "" ? null : Number(value);
  30097. emit(INPUT_EVENT, newVal);
  30098. setCurrentValue(newVal, false);
  30099. };
  30100. const handleInputChange = (value) => {
  30101. const newVal = value !== "" ? Number(value) : "";
  30102. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  30103. setCurrentValue(newVal);
  30104. }
  30105. data.userInput = null;
  30106. };
  30107. const focus = () => {
  30108. var _a, _b;
  30109. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  30110. };
  30111. const blur = () => {
  30112. var _a, _b;
  30113. (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  30114. };
  30115. const handleFocus = (event) => {
  30116. emit("focus", event);
  30117. };
  30118. const handleBlur = (event) => {
  30119. var _a;
  30120. emit("blur", event);
  30121. if (props.validateEvent) {
  30122. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  30123. }
  30124. };
  30125. vue.watch(() => props.modelValue, (value) => {
  30126. const userInput = verifyValue(data.userInput);
  30127. const newValue = verifyValue(value, true);
  30128. if (!userInput || userInput !== newValue) {
  30129. data.currentValue = newValue;
  30130. data.userInput = null;
  30131. }
  30132. }, { immediate: true });
  30133. vue.onMounted(() => {
  30134. var _a;
  30135. const { min, max, modelValue } = props;
  30136. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  30137. innerInput.setAttribute("role", "spinbutton");
  30138. if (Number.isFinite(max)) {
  30139. innerInput.setAttribute("aria-valuemax", String(max));
  30140. } else {
  30141. innerInput.removeAttribute("aria-valuemax");
  30142. }
  30143. if (Number.isFinite(min)) {
  30144. innerInput.setAttribute("aria-valuemin", String(min));
  30145. } else {
  30146. innerInput.removeAttribute("aria-valuemin");
  30147. }
  30148. innerInput.setAttribute("aria-valuenow", String(data.currentValue));
  30149. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  30150. if (!isNumber(modelValue) && modelValue != null) {
  30151. let val = Number(modelValue);
  30152. if (Number.isNaN(val)) {
  30153. val = null;
  30154. }
  30155. emit(UPDATE_MODEL_EVENT, val);
  30156. }
  30157. });
  30158. vue.onUpdated(() => {
  30159. var _a;
  30160. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  30161. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${data.currentValue}`);
  30162. });
  30163. expose({
  30164. focus,
  30165. blur
  30166. });
  30167. return (_ctx, _cache) => {
  30168. return vue.openBlock(), vue.createElementBlock("div", {
  30169. class: vue.normalizeClass([
  30170. vue.unref(ns).b(),
  30171. vue.unref(ns).m(vue.unref(inputNumberSize)),
  30172. vue.unref(ns).is("disabled", vue.unref(inputNumberDisabled)),
  30173. vue.unref(ns).is("without-controls", !_ctx.controls),
  30174. vue.unref(ns).is("controls-right", vue.unref(controlsAtRight))
  30175. ]),
  30176. onDragstart: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  30177. }, ["prevent"]))
  30178. }, [
  30179. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  30180. key: 0,
  30181. role: "button",
  30182. "aria-label": vue.unref(t)("el.inputNumber.decrease"),
  30183. class: vue.normalizeClass([vue.unref(ns).e("decrease"), vue.unref(ns).is("disabled", vue.unref(minDisabled))]),
  30184. onKeydown: vue.withKeys(decrease, ["enter"])
  30185. }, [
  30186. vue.createVNode(vue.unref(ElIcon), null, {
  30187. default: vue.withCtx(() => [
  30188. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_down_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(minus_default), { key: 1 }))
  30189. ]),
  30190. _: 1
  30191. })
  30192. ], 42, _hoisted_1$s)), [
  30193. [vue.unref(vRepeatClick), decrease]
  30194. ]) : vue.createCommentVNode("v-if", true),
  30195. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  30196. key: 1,
  30197. role: "button",
  30198. "aria-label": vue.unref(t)("el.inputNumber.increase"),
  30199. class: vue.normalizeClass([vue.unref(ns).e("increase"), vue.unref(ns).is("disabled", vue.unref(maxDisabled))]),
  30200. onKeydown: vue.withKeys(increase, ["enter"])
  30201. }, [
  30202. vue.createVNode(vue.unref(ElIcon), null, {
  30203. default: vue.withCtx(() => [
  30204. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_up_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(plus_default), { key: 1 }))
  30205. ]),
  30206. _: 1
  30207. })
  30208. ], 42, _hoisted_2$i)), [
  30209. [vue.unref(vRepeatClick), increase]
  30210. ]) : vue.createCommentVNode("v-if", true),
  30211. vue.createVNode(vue.unref(ElInput), {
  30212. id: _ctx.id,
  30213. ref_key: "input",
  30214. ref: input,
  30215. type: "number",
  30216. step: _ctx.step,
  30217. "model-value": vue.unref(displayValue),
  30218. placeholder: _ctx.placeholder,
  30219. readonly: _ctx.readonly,
  30220. disabled: vue.unref(inputNumberDisabled),
  30221. size: vue.unref(inputNumberSize),
  30222. max: _ctx.max,
  30223. min: _ctx.min,
  30224. name: _ctx.name,
  30225. label: _ctx.label,
  30226. "validate-event": false,
  30227. onKeydown: [
  30228. vue.withKeys(vue.withModifiers(increase, ["prevent"]), ["up"]),
  30229. vue.withKeys(vue.withModifiers(decrease, ["prevent"]), ["down"])
  30230. ],
  30231. onBlur: handleBlur,
  30232. onFocus: handleFocus,
  30233. onInput: handleInput,
  30234. onChange: handleInputChange
  30235. }, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "label", "onKeydown"])
  30236. ], 34);
  30237. };
  30238. }
  30239. });
  30240. var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__file", "input-number.vue"]]);
  30241. const ElInputNumber = withInstall(InputNumber);
  30242. const linkProps = buildProps({
  30243. type: {
  30244. type: String,
  30245. values: ["primary", "success", "warning", "info", "danger", "default"],
  30246. default: "default"
  30247. },
  30248. underline: {
  30249. type: Boolean,
  30250. default: true
  30251. },
  30252. disabled: { type: Boolean, default: false },
  30253. href: { type: String, default: "" },
  30254. icon: {
  30255. type: iconPropType
  30256. }
  30257. });
  30258. const linkEmits = {
  30259. click: (evt) => evt instanceof MouseEvent
  30260. };
  30261. const _hoisted_1$r = ["href"];
  30262. const __default__$E = vue.defineComponent({
  30263. name: "ElLink"
  30264. });
  30265. const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
  30266. ...__default__$E,
  30267. props: linkProps,
  30268. emits: linkEmits,
  30269. setup(__props, { emit }) {
  30270. const props = __props;
  30271. const ns = useNamespace("link");
  30272. const linkKls = vue.computed(() => [
  30273. ns.b(),
  30274. ns.m(props.type),
  30275. ns.is("disabled", props.disabled),
  30276. ns.is("underline", props.underline && !props.disabled)
  30277. ]);
  30278. function handleClick(event) {
  30279. if (!props.disabled)
  30280. emit("click", event);
  30281. }
  30282. return (_ctx, _cache) => {
  30283. return vue.openBlock(), vue.createElementBlock("a", {
  30284. class: vue.normalizeClass(vue.unref(linkKls)),
  30285. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  30286. onClick: handleClick
  30287. }, [
  30288. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  30289. default: vue.withCtx(() => [
  30290. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  30291. ]),
  30292. _: 1
  30293. })) : vue.createCommentVNode("v-if", true),
  30294. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  30295. key: 1,
  30296. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  30297. }, [
  30298. vue.renderSlot(_ctx.$slots, "default")
  30299. ], 2)) : vue.createCommentVNode("v-if", true),
  30300. _ctx.$slots.icon ? vue.renderSlot(_ctx.$slots, "icon", { key: 2 }) : vue.createCommentVNode("v-if", true)
  30301. ], 10, _hoisted_1$r);
  30302. };
  30303. }
  30304. });
  30305. var Link = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__file", "link.vue"]]);
  30306. const ElLink = withInstall(Link);
  30307. class SubMenu$1 {
  30308. constructor(parent, domNode) {
  30309. this.parent = parent;
  30310. this.domNode = domNode;
  30311. this.subIndex = 0;
  30312. this.subIndex = 0;
  30313. this.init();
  30314. }
  30315. init() {
  30316. this.subMenuItems = this.domNode.querySelectorAll("li");
  30317. this.addListeners();
  30318. }
  30319. gotoSubIndex(idx) {
  30320. if (idx === this.subMenuItems.length) {
  30321. idx = 0;
  30322. } else if (idx < 0) {
  30323. idx = this.subMenuItems.length - 1;
  30324. }
  30325. this.subMenuItems[idx].focus();
  30326. this.subIndex = idx;
  30327. }
  30328. addListeners() {
  30329. const parentNode = this.parent.domNode;
  30330. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  30331. el.addEventListener("keydown", (event) => {
  30332. let prevDef = false;
  30333. switch (event.code) {
  30334. case EVENT_CODE.down: {
  30335. this.gotoSubIndex(this.subIndex + 1);
  30336. prevDef = true;
  30337. break;
  30338. }
  30339. case EVENT_CODE.up: {
  30340. this.gotoSubIndex(this.subIndex - 1);
  30341. prevDef = true;
  30342. break;
  30343. }
  30344. case EVENT_CODE.tab: {
  30345. triggerEvent(parentNode, "mouseleave");
  30346. break;
  30347. }
  30348. case EVENT_CODE.enter:
  30349. case EVENT_CODE.space: {
  30350. prevDef = true;
  30351. event.currentTarget.click();
  30352. break;
  30353. }
  30354. }
  30355. if (prevDef) {
  30356. event.preventDefault();
  30357. event.stopPropagation();
  30358. }
  30359. return false;
  30360. });
  30361. });
  30362. }
  30363. }
  30364. var SubMenu$2 = SubMenu$1;
  30365. class MenuItem$1 {
  30366. constructor(domNode, namespace) {
  30367. this.domNode = domNode;
  30368. this.submenu = null;
  30369. this.submenu = null;
  30370. this.init(namespace);
  30371. }
  30372. init(namespace) {
  30373. this.domNode.setAttribute("tabindex", "0");
  30374. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  30375. if (menuChild) {
  30376. this.submenu = new SubMenu$2(this, menuChild);
  30377. }
  30378. this.addListeners();
  30379. }
  30380. addListeners() {
  30381. this.domNode.addEventListener("keydown", (event) => {
  30382. let prevDef = false;
  30383. switch (event.code) {
  30384. case EVENT_CODE.down: {
  30385. triggerEvent(event.currentTarget, "mouseenter");
  30386. this.submenu && this.submenu.gotoSubIndex(0);
  30387. prevDef = true;
  30388. break;
  30389. }
  30390. case EVENT_CODE.up: {
  30391. triggerEvent(event.currentTarget, "mouseenter");
  30392. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  30393. prevDef = true;
  30394. break;
  30395. }
  30396. case EVENT_CODE.tab: {
  30397. triggerEvent(event.currentTarget, "mouseleave");
  30398. break;
  30399. }
  30400. case EVENT_CODE.enter:
  30401. case EVENT_CODE.space: {
  30402. prevDef = true;
  30403. event.currentTarget.click();
  30404. break;
  30405. }
  30406. }
  30407. if (prevDef) {
  30408. event.preventDefault();
  30409. }
  30410. });
  30411. }
  30412. }
  30413. var MenuItem$2 = MenuItem$1;
  30414. class Menu$1 {
  30415. constructor(domNode, namespace) {
  30416. this.domNode = domNode;
  30417. this.init(namespace);
  30418. }
  30419. init(namespace) {
  30420. const menuChildren = this.domNode.childNodes;
  30421. Array.from(menuChildren).forEach((child) => {
  30422. if (child.nodeType === 1) {
  30423. new MenuItem$2(child, namespace);
  30424. }
  30425. });
  30426. }
  30427. }
  30428. var Menubar = Menu$1;
  30429. const _sfc_main$U = vue.defineComponent({
  30430. name: "ElMenuCollapseTransition",
  30431. setup() {
  30432. const ns = useNamespace("menu");
  30433. const listeners = {
  30434. onBeforeEnter: (el) => el.style.opacity = "0.2",
  30435. onEnter(el, done) {
  30436. addClass(el, `${ns.namespace.value}-opacity-transition`);
  30437. el.style.opacity = "1";
  30438. done();
  30439. },
  30440. onAfterEnter(el) {
  30441. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  30442. el.style.opacity = "";
  30443. },
  30444. onBeforeLeave(el) {
  30445. if (!el.dataset) {
  30446. el.dataset = {};
  30447. }
  30448. if (hasClass(el, ns.m("collapse"))) {
  30449. removeClass(el, ns.m("collapse"));
  30450. el.dataset.oldOverflow = el.style.overflow;
  30451. el.dataset.scrollWidth = el.clientWidth.toString();
  30452. addClass(el, ns.m("collapse"));
  30453. } else {
  30454. addClass(el, ns.m("collapse"));
  30455. el.dataset.oldOverflow = el.style.overflow;
  30456. el.dataset.scrollWidth = el.clientWidth.toString();
  30457. removeClass(el, ns.m("collapse"));
  30458. }
  30459. el.style.width = `${el.scrollWidth}px`;
  30460. el.style.overflow = "hidden";
  30461. },
  30462. onLeave(el) {
  30463. addClass(el, "horizontal-collapse-transition");
  30464. el.style.width = `${el.dataset.scrollWidth}px`;
  30465. }
  30466. };
  30467. return {
  30468. listeners
  30469. };
  30470. }
  30471. });
  30472. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  30473. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({ mode: "out-in" }, _ctx.listeners), {
  30474. default: vue.withCtx(() => [
  30475. vue.renderSlot(_ctx.$slots, "default")
  30476. ]),
  30477. _: 3
  30478. }, 16);
  30479. }
  30480. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["render", _sfc_render$e], ["__file", "menu-collapse-transition.vue"]]);
  30481. function useMenu(instance, currentIndex) {
  30482. const indexPath = vue.computed(() => {
  30483. let parent = instance.parent;
  30484. const path = [currentIndex.value];
  30485. while (parent.type.name !== "ElMenu") {
  30486. if (parent.props.index) {
  30487. path.unshift(parent.props.index);
  30488. }
  30489. parent = parent.parent;
  30490. }
  30491. return path;
  30492. });
  30493. const parentMenu = vue.computed(() => {
  30494. let parent = instance.parent;
  30495. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  30496. parent = parent.parent;
  30497. }
  30498. return parent;
  30499. });
  30500. return {
  30501. parentMenu,
  30502. indexPath
  30503. };
  30504. }
  30505. function useMenuColor(props) {
  30506. const menuBarColor = vue.computed(() => {
  30507. const color = props.backgroundColor;
  30508. if (!color) {
  30509. return "";
  30510. } else {
  30511. return new TinyColor(color).shade(20).toString();
  30512. }
  30513. });
  30514. return menuBarColor;
  30515. }
  30516. const useMenuCssVar = (props, level) => {
  30517. const ns = useNamespace("menu");
  30518. return vue.computed(() => {
  30519. return ns.cssVarBlock({
  30520. "text-color": props.textColor || "",
  30521. "hover-text-color": props.textColor || "",
  30522. "bg-color": props.backgroundColor || "",
  30523. "hover-bg-color": useMenuColor(props).value || "",
  30524. "active-color": props.activeTextColor || "",
  30525. level: `${level}`
  30526. });
  30527. });
  30528. };
  30529. const subMenuProps = buildProps({
  30530. index: {
  30531. type: String,
  30532. required: true
  30533. },
  30534. showTimeout: {
  30535. type: Number,
  30536. default: 300
  30537. },
  30538. hideTimeout: {
  30539. type: Number,
  30540. default: 300
  30541. },
  30542. popperClass: String,
  30543. disabled: Boolean,
  30544. popperAppendToBody: {
  30545. type: Boolean,
  30546. default: void 0
  30547. },
  30548. popperOffset: {
  30549. type: Number,
  30550. default: 6
  30551. },
  30552. expandCloseIcon: {
  30553. type: iconPropType
  30554. },
  30555. expandOpenIcon: {
  30556. type: iconPropType
  30557. },
  30558. collapseCloseIcon: {
  30559. type: iconPropType
  30560. },
  30561. collapseOpenIcon: {
  30562. type: iconPropType
  30563. }
  30564. });
  30565. const COMPONENT_NAME$c = "ElSubMenu";
  30566. var SubMenu = vue.defineComponent({
  30567. name: COMPONENT_NAME$c,
  30568. props: subMenuProps,
  30569. setup(props, { slots, expose }) {
  30570. const instance = vue.getCurrentInstance();
  30571. const { indexPath, parentMenu } = useMenu(instance, vue.computed(() => props.index));
  30572. const nsMenu = useNamespace("menu");
  30573. const nsSubMenu = useNamespace("sub-menu");
  30574. const rootMenu = vue.inject("rootMenu");
  30575. if (!rootMenu)
  30576. throwError(COMPONENT_NAME$c, "can not inject root menu");
  30577. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  30578. if (!subMenu)
  30579. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  30580. const items = vue.ref({});
  30581. const subMenus = vue.ref({});
  30582. let timeout;
  30583. const mouseInChild = vue.ref(false);
  30584. const verticalTitleRef = vue.ref();
  30585. const vPopper = vue.ref(null);
  30586. const currentPlacement = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  30587. const subMenuTitleIcon = vue.computed(() => {
  30588. 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;
  30589. });
  30590. const isFirstLevel = vue.computed(() => {
  30591. return subMenu.level === 0;
  30592. });
  30593. const appendToBody = vue.computed(() => {
  30594. return props.popperAppendToBody === void 0 ? isFirstLevel.value : Boolean(props.popperAppendToBody);
  30595. });
  30596. const menuTransitionName = vue.computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  30597. const fallbackPlacements = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  30598. "bottom-start",
  30599. "bottom-end",
  30600. "top-start",
  30601. "top-end",
  30602. "right-start",
  30603. "left-start"
  30604. ] : [
  30605. "right-start",
  30606. "left-start",
  30607. "bottom-start",
  30608. "bottom-end",
  30609. "top-start",
  30610. "top-end"
  30611. ]);
  30612. const opened = vue.computed(() => rootMenu.openedMenus.includes(props.index));
  30613. const active = vue.computed(() => {
  30614. let isActive = false;
  30615. Object.values(items.value).forEach((item2) => {
  30616. if (item2.active) {
  30617. isActive = true;
  30618. }
  30619. });
  30620. Object.values(subMenus.value).forEach((subItem) => {
  30621. if (subItem.active) {
  30622. isActive = true;
  30623. }
  30624. });
  30625. return isActive;
  30626. });
  30627. const backgroundColor = vue.computed(() => rootMenu.props.backgroundColor || "");
  30628. const activeTextColor = vue.computed(() => rootMenu.props.activeTextColor || "");
  30629. const textColor = vue.computed(() => rootMenu.props.textColor || "");
  30630. const mode = vue.computed(() => rootMenu.props.mode);
  30631. const item = vue.reactive({
  30632. index: props.index,
  30633. indexPath,
  30634. active
  30635. });
  30636. const titleStyle = vue.computed(() => {
  30637. if (mode.value !== "horizontal") {
  30638. return {
  30639. color: textColor.value
  30640. };
  30641. }
  30642. return {
  30643. borderBottomColor: active.value ? rootMenu.props.activeTextColor ? activeTextColor.value : "" : "transparent",
  30644. color: active.value ? activeTextColor.value : textColor.value
  30645. };
  30646. });
  30647. const doDestroy = () => {
  30648. var _a, _b, _c;
  30649. return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  30650. };
  30651. const handleCollapseToggle = (value) => {
  30652. if (!value) {
  30653. doDestroy();
  30654. }
  30655. };
  30656. const handleClick = () => {
  30657. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  30658. return;
  30659. rootMenu.handleSubMenuClick({
  30660. index: props.index,
  30661. indexPath: indexPath.value,
  30662. active: active.value
  30663. });
  30664. };
  30665. const handleMouseenter = (event, showTimeout = props.showTimeout) => {
  30666. var _a;
  30667. if (event.type === "focus") {
  30668. return;
  30669. }
  30670. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  30671. return;
  30672. }
  30673. subMenu.mouseInChild.value = true;
  30674. timeout == null ? void 0 : timeout();
  30675. ({ stop: timeout } = useTimeoutFn(() => {
  30676. rootMenu.openMenu(props.index, indexPath.value);
  30677. }, showTimeout));
  30678. if (appendToBody.value) {
  30679. (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
  30680. }
  30681. };
  30682. const handleMouseleave = (deepDispatch = false) => {
  30683. var _a, _b;
  30684. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  30685. return;
  30686. }
  30687. timeout == null ? void 0 : timeout();
  30688. subMenu.mouseInChild.value = false;
  30689. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), props.hideTimeout));
  30690. if (appendToBody.value && deepDispatch) {
  30691. if (((_a = instance.parent) == null ? void 0 : _a.type.name) === "ElSubMenu") {
  30692. (_b = subMenu.handleMouseleave) == null ? void 0 : _b.call(subMenu, true);
  30693. }
  30694. }
  30695. };
  30696. vue.watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  30697. {
  30698. const addSubMenu = (item2) => {
  30699. subMenus.value[item2.index] = item2;
  30700. };
  30701. const removeSubMenu = (item2) => {
  30702. delete subMenus.value[item2.index];
  30703. };
  30704. vue.provide(`subMenu:${instance.uid}`, {
  30705. addSubMenu,
  30706. removeSubMenu,
  30707. handleMouseleave,
  30708. mouseInChild,
  30709. level: subMenu.level + 1
  30710. });
  30711. }
  30712. expose({
  30713. opened
  30714. });
  30715. vue.onMounted(() => {
  30716. rootMenu.addSubMenu(item);
  30717. subMenu.addSubMenu(item);
  30718. });
  30719. vue.onBeforeUnmount(() => {
  30720. subMenu.removeSubMenu(item);
  30721. rootMenu.removeSubMenu(item);
  30722. });
  30723. return () => {
  30724. var _a;
  30725. const titleTag = [
  30726. (_a = slots.title) == null ? void 0 : _a.call(slots),
  30727. vue.h(ElIcon, {
  30728. class: nsSubMenu.e("icon-arrow"),
  30729. style: {
  30730. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  30731. }
  30732. }, {
  30733. default: () => isString(subMenuTitleIcon.value) ? vue.h(instance.appContext.components[subMenuTitleIcon.value]) : vue.h(subMenuTitleIcon.value)
  30734. })
  30735. ];
  30736. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  30737. const child = rootMenu.isMenuPopup ? vue.h(ElTooltip, {
  30738. ref: vPopper,
  30739. visible: opened.value,
  30740. effect: "light",
  30741. pure: true,
  30742. offset: props.popperOffset,
  30743. showArrow: false,
  30744. persistent: true,
  30745. popperClass: props.popperClass,
  30746. placement: currentPlacement.value,
  30747. teleported: appendToBody.value,
  30748. fallbackPlacements: fallbackPlacements.value,
  30749. transition: menuTransitionName.value,
  30750. gpuAcceleration: false
  30751. }, {
  30752. content: () => {
  30753. var _a2;
  30754. return vue.h("div", {
  30755. class: [
  30756. nsMenu.m(mode.value),
  30757. nsMenu.m("popup-container"),
  30758. props.popperClass
  30759. ],
  30760. onMouseenter: (evt) => handleMouseenter(evt, 100),
  30761. onMouseleave: () => handleMouseleave(true),
  30762. onFocus: (evt) => handleMouseenter(evt, 100)
  30763. }, [
  30764. vue.h("ul", {
  30765. class: [
  30766. nsMenu.b(),
  30767. nsMenu.m("popup"),
  30768. nsMenu.m(`popup-${currentPlacement.value}`)
  30769. ],
  30770. style: ulStyle.value
  30771. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
  30772. ]);
  30773. },
  30774. default: () => vue.h("div", {
  30775. class: nsSubMenu.e("title"),
  30776. style: [
  30777. titleStyle.value,
  30778. { backgroundColor: backgroundColor.value }
  30779. ],
  30780. onClick: handleClick
  30781. }, titleTag)
  30782. }) : vue.h(vue.Fragment, {}, [
  30783. vue.h("div", {
  30784. class: nsSubMenu.e("title"),
  30785. style: [
  30786. titleStyle.value,
  30787. { backgroundColor: backgroundColor.value }
  30788. ],
  30789. ref: verticalTitleRef,
  30790. onClick: handleClick
  30791. }, titleTag),
  30792. vue.h(_CollapseTransition, {}, {
  30793. default: () => {
  30794. var _a2;
  30795. return vue.withDirectives(vue.h("ul", {
  30796. role: "menu",
  30797. class: [nsMenu.b(), nsMenu.m("inline")],
  30798. style: ulStyle.value
  30799. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vue.vShow, opened.value]]);
  30800. }
  30801. })
  30802. ]);
  30803. return vue.h("li", {
  30804. class: [
  30805. nsSubMenu.b(),
  30806. nsSubMenu.is("active", active.value),
  30807. nsSubMenu.is("opened", opened.value),
  30808. nsSubMenu.is("disabled", props.disabled)
  30809. ],
  30810. role: "menuitem",
  30811. ariaHaspopup: true,
  30812. ariaExpanded: opened.value,
  30813. onMouseenter: handleMouseenter,
  30814. onMouseleave: () => handleMouseleave(true),
  30815. onFocus: handleMouseenter
  30816. }, [child]);
  30817. };
  30818. }
  30819. });
  30820. const menuProps = buildProps({
  30821. mode: {
  30822. type: String,
  30823. values: ["horizontal", "vertical"],
  30824. default: "vertical"
  30825. },
  30826. defaultActive: {
  30827. type: String,
  30828. default: ""
  30829. },
  30830. defaultOpeneds: {
  30831. type: definePropType(Array),
  30832. default: () => mutable([])
  30833. },
  30834. uniqueOpened: Boolean,
  30835. router: Boolean,
  30836. menuTrigger: {
  30837. type: String,
  30838. values: ["hover", "click"],
  30839. default: "hover"
  30840. },
  30841. collapse: Boolean,
  30842. backgroundColor: String,
  30843. textColor: String,
  30844. activeTextColor: String,
  30845. collapseTransition: {
  30846. type: Boolean,
  30847. default: true
  30848. },
  30849. ellipsis: {
  30850. type: Boolean,
  30851. default: true
  30852. }
  30853. });
  30854. const checkIndexPath = (indexPath) => Array.isArray(indexPath) && indexPath.every((path) => isString(path));
  30855. const menuEmits = {
  30856. close: (index, indexPath) => isString(index) && checkIndexPath(indexPath),
  30857. open: (index, indexPath) => isString(index) && checkIndexPath(indexPath),
  30858. select: (index, indexPath, item, routerResult) => isString(index) && checkIndexPath(indexPath) && isObject$1(item) && (routerResult === void 0 || routerResult instanceof Promise)
  30859. };
  30860. var Menu = vue.defineComponent({
  30861. name: "ElMenu",
  30862. props: menuProps,
  30863. emits: menuEmits,
  30864. setup(props, { emit, slots, expose }) {
  30865. const instance = vue.getCurrentInstance();
  30866. const router = instance.appContext.config.globalProperties.$router;
  30867. const menu = vue.ref();
  30868. const nsMenu = useNamespace("menu");
  30869. const nsSubMenu = useNamespace("sub-menu");
  30870. const sliceIndex = vue.ref(-1);
  30871. const openedMenus = vue.ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  30872. const activeIndex = vue.ref(props.defaultActive);
  30873. const items = vue.ref({});
  30874. const subMenus = vue.ref({});
  30875. const isMenuPopup = vue.computed(() => {
  30876. return props.mode === "horizontal" || props.mode === "vertical" && props.collapse;
  30877. });
  30878. const initMenu = () => {
  30879. const activeItem = activeIndex.value && items.value[activeIndex.value];
  30880. if (!activeItem || props.mode === "horizontal" || props.collapse)
  30881. return;
  30882. const indexPath = activeItem.indexPath;
  30883. indexPath.forEach((index) => {
  30884. const subMenu = subMenus.value[index];
  30885. subMenu && openMenu(index, subMenu.indexPath);
  30886. });
  30887. };
  30888. const openMenu = (index, indexPath) => {
  30889. if (openedMenus.value.includes(index))
  30890. return;
  30891. if (props.uniqueOpened) {
  30892. openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2));
  30893. }
  30894. openedMenus.value.push(index);
  30895. emit("open", index, indexPath);
  30896. };
  30897. const closeMenu = (index, indexPath) => {
  30898. const i = openedMenus.value.indexOf(index);
  30899. if (i !== -1) {
  30900. openedMenus.value.splice(i, 1);
  30901. }
  30902. emit("close", index, indexPath);
  30903. };
  30904. const handleSubMenuClick = ({
  30905. index,
  30906. indexPath
  30907. }) => {
  30908. const isOpened = openedMenus.value.includes(index);
  30909. if (isOpened) {
  30910. closeMenu(index, indexPath);
  30911. } else {
  30912. openMenu(index, indexPath);
  30913. }
  30914. };
  30915. const handleMenuItemClick = (menuItem) => {
  30916. if (props.mode === "horizontal" || props.collapse) {
  30917. openedMenus.value = [];
  30918. }
  30919. const { index, indexPath } = menuItem;
  30920. if (index === void 0 || indexPath === void 0)
  30921. return;
  30922. if (props.router && router) {
  30923. const route = menuItem.route || index;
  30924. const routerResult = router.push(route).then((res) => {
  30925. if (!res)
  30926. activeIndex.value = index;
  30927. return res;
  30928. });
  30929. emit("select", index, indexPath, { index, indexPath, route }, routerResult);
  30930. } else {
  30931. activeIndex.value = index;
  30932. emit("select", index, indexPath, { index, indexPath });
  30933. }
  30934. };
  30935. const updateActiveIndex = (val) => {
  30936. const itemsInData = items.value;
  30937. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  30938. if (item) {
  30939. activeIndex.value = item.index;
  30940. } else {
  30941. activeIndex.value = val;
  30942. }
  30943. };
  30944. const calcSliceIndex = () => {
  30945. var _a, _b;
  30946. if (!menu.value)
  30947. return -1;
  30948. const items2 = Array.from((_b = (_a = menu.value) == null ? void 0 : _a.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#text" || item.nodeValue);
  30949. const moreItemWidth = 64;
  30950. const paddingLeft = Number.parseInt(getComputedStyle(menu.value).paddingLeft, 10);
  30951. const paddingRight = Number.parseInt(getComputedStyle(menu.value).paddingRight, 10);
  30952. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  30953. let calcWidth = 0;
  30954. let sliceIndex2 = 0;
  30955. items2.forEach((item, index) => {
  30956. calcWidth += item.offsetWidth || 0;
  30957. if (calcWidth <= menuWidth - moreItemWidth) {
  30958. sliceIndex2 = index + 1;
  30959. }
  30960. });
  30961. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  30962. };
  30963. const debounce = (fn, wait = 33.34) => {
  30964. let timmer;
  30965. return () => {
  30966. timmer && clearTimeout(timmer);
  30967. timmer = setTimeout(() => {
  30968. fn();
  30969. }, wait);
  30970. };
  30971. };
  30972. let isFirstTimeRender = true;
  30973. const handleResize = () => {
  30974. const callback = () => {
  30975. sliceIndex.value = -1;
  30976. vue.nextTick(() => {
  30977. sliceIndex.value = calcSliceIndex();
  30978. });
  30979. };
  30980. isFirstTimeRender ? callback() : debounce(callback)();
  30981. isFirstTimeRender = false;
  30982. };
  30983. vue.watch(() => props.defaultActive, (currentActive) => {
  30984. if (!items.value[currentActive]) {
  30985. activeIndex.value = "";
  30986. }
  30987. updateActiveIndex(currentActive);
  30988. });
  30989. vue.watch(() => props.collapse, (value) => {
  30990. if (value)
  30991. openedMenus.value = [];
  30992. });
  30993. vue.watch(items.value, initMenu);
  30994. let resizeStopper;
  30995. vue.watchEffect(() => {
  30996. if (props.mode === "horizontal" && props.ellipsis)
  30997. resizeStopper = useResizeObserver(menu, handleResize).stop;
  30998. else
  30999. resizeStopper == null ? void 0 : resizeStopper();
  31000. });
  31001. {
  31002. const addSubMenu = (item) => {
  31003. subMenus.value[item.index] = item;
  31004. };
  31005. const removeSubMenu = (item) => {
  31006. delete subMenus.value[item.index];
  31007. };
  31008. const addMenuItem = (item) => {
  31009. items.value[item.index] = item;
  31010. };
  31011. const removeMenuItem = (item) => {
  31012. delete items.value[item.index];
  31013. };
  31014. vue.provide("rootMenu", vue.reactive({
  31015. props,
  31016. openedMenus,
  31017. items,
  31018. subMenus,
  31019. activeIndex,
  31020. isMenuPopup,
  31021. addMenuItem,
  31022. removeMenuItem,
  31023. addSubMenu,
  31024. removeSubMenu,
  31025. openMenu,
  31026. closeMenu,
  31027. handleMenuItemClick,
  31028. handleSubMenuClick
  31029. }));
  31030. vue.provide(`subMenu:${instance.uid}`, {
  31031. addSubMenu,
  31032. removeSubMenu,
  31033. mouseInChild: vue.ref(false),
  31034. level: 0
  31035. });
  31036. }
  31037. vue.onMounted(() => {
  31038. if (props.mode === "horizontal") {
  31039. new Menubar(instance.vnode.el, nsMenu.namespace.value);
  31040. }
  31041. });
  31042. {
  31043. const open = (index) => {
  31044. const { indexPath } = subMenus.value[index];
  31045. indexPath.forEach((i) => openMenu(i, indexPath));
  31046. };
  31047. expose({
  31048. open,
  31049. close: closeMenu,
  31050. handleResize
  31051. });
  31052. }
  31053. return () => {
  31054. var _a, _b;
  31055. let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
  31056. const vShowMore = [];
  31057. if (props.mode === "horizontal" && menu.value) {
  31058. const originalSlot = flattedChildren(slot);
  31059. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  31060. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  31061. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  31062. slot = slotDefault;
  31063. vShowMore.push(vue.h(SubMenu, {
  31064. index: "sub-menu-more",
  31065. class: nsSubMenu.e("hide-arrow")
  31066. }, {
  31067. title: () => vue.h(ElIcon, {
  31068. class: nsSubMenu.e("icon-more")
  31069. }, { default: () => vue.h(more_default) }),
  31070. default: () => slotMore
  31071. }));
  31072. }
  31073. }
  31074. const ulStyle = useMenuCssVar(props, 0);
  31075. const vMenu = vue.h("ul", {
  31076. key: String(props.collapse),
  31077. role: "menubar",
  31078. ref: menu,
  31079. style: ulStyle.value,
  31080. class: {
  31081. [nsMenu.b()]: true,
  31082. [nsMenu.m(props.mode)]: true,
  31083. [nsMenu.m("collapse")]: props.collapse
  31084. }
  31085. }, [...slot, ...vShowMore]);
  31086. if (props.collapseTransition && props.mode === "vertical") {
  31087. return vue.h(ElMenuCollapseTransition, () => vMenu);
  31088. }
  31089. return vMenu;
  31090. };
  31091. }
  31092. });
  31093. const menuItemProps = buildProps({
  31094. index: {
  31095. type: definePropType([String, null]),
  31096. default: null
  31097. },
  31098. route: {
  31099. type: definePropType([String, Object])
  31100. },
  31101. disabled: Boolean
  31102. });
  31103. const menuItemEmits = {
  31104. click: (item) => isString(item.index) && Array.isArray(item.indexPath)
  31105. };
  31106. const COMPONENT_NAME$b = "ElMenuItem";
  31107. const _sfc_main$T = vue.defineComponent({
  31108. name: COMPONENT_NAME$b,
  31109. components: {
  31110. ElTooltip
  31111. },
  31112. props: menuItemProps,
  31113. emits: menuItemEmits,
  31114. setup(props, { emit }) {
  31115. const instance = vue.getCurrentInstance();
  31116. const rootMenu = vue.inject("rootMenu");
  31117. const nsMenu = useNamespace("menu");
  31118. const nsMenuItem = useNamespace("menu-item");
  31119. if (!rootMenu)
  31120. throwError(COMPONENT_NAME$b, "can not inject root menu");
  31121. const { parentMenu, indexPath } = useMenu(instance, vue.toRef(props, "index"));
  31122. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  31123. if (!subMenu)
  31124. throwError(COMPONENT_NAME$b, "can not inject sub menu");
  31125. const active = vue.computed(() => props.index === rootMenu.activeIndex);
  31126. const item = vue.reactive({
  31127. index: props.index,
  31128. indexPath,
  31129. active
  31130. });
  31131. const handleClick = () => {
  31132. if (!props.disabled) {
  31133. rootMenu.handleMenuItemClick({
  31134. index: props.index,
  31135. indexPath: indexPath.value,
  31136. route: props.route
  31137. });
  31138. emit("click", item);
  31139. }
  31140. };
  31141. vue.onMounted(() => {
  31142. subMenu.addSubMenu(item);
  31143. rootMenu.addMenuItem(item);
  31144. });
  31145. vue.onBeforeUnmount(() => {
  31146. subMenu.removeSubMenu(item);
  31147. rootMenu.removeMenuItem(item);
  31148. });
  31149. return {
  31150. Effect,
  31151. parentMenu,
  31152. rootMenu,
  31153. active,
  31154. nsMenu,
  31155. nsMenuItem,
  31156. handleClick
  31157. };
  31158. }
  31159. });
  31160. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  31161. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  31162. return vue.openBlock(), vue.createElementBlock("li", {
  31163. class: vue.normalizeClass([
  31164. _ctx.nsMenuItem.b(),
  31165. _ctx.nsMenuItem.is("active", _ctx.active),
  31166. _ctx.nsMenuItem.is("disabled", _ctx.disabled)
  31167. ]),
  31168. role: "menuitem",
  31169. tabindex: "-1",
  31170. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  31171. }, [
  31172. _ctx.parentMenu.type.name === "ElMenu" && _ctx.rootMenu.props.collapse && _ctx.$slots.title ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  31173. key: 0,
  31174. effect: _ctx.Effect.DARK,
  31175. placement: "right",
  31176. "fallback-placements": ["left"],
  31177. persistent: ""
  31178. }, {
  31179. content: vue.withCtx(() => [
  31180. vue.renderSlot(_ctx.$slots, "title")
  31181. ]),
  31182. default: vue.withCtx(() => [
  31183. vue.createElementVNode("div", {
  31184. class: vue.normalizeClass(_ctx.nsMenu.be("tooltip", "trigger"))
  31185. }, [
  31186. vue.renderSlot(_ctx.$slots, "default")
  31187. ], 2)
  31188. ]),
  31189. _: 3
  31190. }, 8, ["effect"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  31191. vue.renderSlot(_ctx.$slots, "default"),
  31192. vue.renderSlot(_ctx.$slots, "title")
  31193. ], 64))
  31194. ], 2);
  31195. }
  31196. var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["render", _sfc_render$d], ["__file", "menu-item.vue"]]);
  31197. const menuItemGroupProps = {
  31198. title: String
  31199. };
  31200. const COMPONENT_NAME$a = "ElMenuItemGroup";
  31201. const _sfc_main$S = vue.defineComponent({
  31202. name: COMPONENT_NAME$a,
  31203. props: menuItemGroupProps,
  31204. setup() {
  31205. const ns = useNamespace("menu-item-group");
  31206. return {
  31207. ns
  31208. };
  31209. }
  31210. });
  31211. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  31212. return vue.openBlock(), vue.createElementBlock("li", {
  31213. class: vue.normalizeClass(_ctx.ns.b())
  31214. }, [
  31215. vue.createElementVNode("div", {
  31216. class: vue.normalizeClass(_ctx.ns.e("title"))
  31217. }, [
  31218. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  31219. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  31220. ], 64)) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  31221. ], 2),
  31222. vue.createElementVNode("ul", null, [
  31223. vue.renderSlot(_ctx.$slots, "default")
  31224. ])
  31225. ], 2);
  31226. }
  31227. var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["render", _sfc_render$c], ["__file", "menu-item-group.vue"]]);
  31228. const ElMenu = withInstall(Menu, {
  31229. MenuItem,
  31230. MenuItemGroup,
  31231. SubMenu
  31232. });
  31233. const ElMenuItem = withNoopInstall(MenuItem);
  31234. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  31235. const ElSubMenu = withNoopInstall(SubMenu);
  31236. const pageHeaderProps = buildProps({
  31237. icon: {
  31238. type: iconPropType,
  31239. default: () => back_default
  31240. },
  31241. title: String,
  31242. content: {
  31243. type: String,
  31244. default: ""
  31245. }
  31246. });
  31247. const pageHeaderEmits = {
  31248. back: () => true
  31249. };
  31250. const _hoisted_1$q = ["aria-label"];
  31251. const __default__$D = vue.defineComponent({
  31252. name: "ElPageHeader"
  31253. });
  31254. const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
  31255. ...__default__$D,
  31256. props: pageHeaderProps,
  31257. emits: pageHeaderEmits,
  31258. setup(__props, { emit }) {
  31259. const slots = vue.useSlots();
  31260. const { t } = useLocale();
  31261. const ns = useNamespace("page-header");
  31262. const kls = vue.computed(() => {
  31263. return [
  31264. ns.b(),
  31265. {
  31266. [ns.m("has-breadcrumb")]: !!slots.breadcrumb,
  31267. [ns.m("has-extra")]: !!slots.extra,
  31268. [ns.is("contentful")]: !!slots.default
  31269. }
  31270. ];
  31271. });
  31272. function handleClick() {
  31273. emit("back");
  31274. }
  31275. return (_ctx, _cache) => {
  31276. return vue.openBlock(), vue.createElementBlock("div", {
  31277. class: vue.normalizeClass(vue.unref(kls))
  31278. }, [
  31279. _ctx.$slots.breadcrumb ? (vue.openBlock(), vue.createElementBlock("div", {
  31280. key: 0,
  31281. class: vue.normalizeClass(vue.unref(ns).e("breadcrumb"))
  31282. }, [
  31283. vue.renderSlot(_ctx.$slots, "breadcrumb")
  31284. ], 2)) : vue.createCommentVNode("v-if", true),
  31285. vue.createElementVNode("div", {
  31286. class: vue.normalizeClass(vue.unref(ns).e("header"))
  31287. }, [
  31288. vue.createElementVNode("div", {
  31289. class: vue.normalizeClass(vue.unref(ns).e("left"))
  31290. }, [
  31291. vue.createElementVNode("div", {
  31292. class: vue.normalizeClass(vue.unref(ns).e("back")),
  31293. role: "button",
  31294. tabindex: "0",
  31295. onClick: handleClick
  31296. }, [
  31297. _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("div", {
  31298. key: 0,
  31299. "aria-label": _ctx.title || vue.unref(t)("el.pageHeader.title"),
  31300. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  31301. }, [
  31302. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  31303. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  31304. default: vue.withCtx(() => [
  31305. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  31306. ]),
  31307. _: 1
  31308. })) : vue.createCommentVNode("v-if", true)
  31309. ])
  31310. ], 10, _hoisted_1$q)) : vue.createCommentVNode("v-if", true),
  31311. vue.createElementVNode("div", {
  31312. class: vue.normalizeClass(vue.unref(ns).e("title"))
  31313. }, [
  31314. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  31315. vue.createTextVNode(vue.toDisplayString(_ctx.title || vue.unref(t)("el.pageHeader.title")), 1)
  31316. ])
  31317. ], 2)
  31318. ], 2),
  31319. vue.createVNode(vue.unref(ElDivider), { direction: "vertical" }),
  31320. vue.createElementVNode("div", {
  31321. class: vue.normalizeClass(vue.unref(ns).e("content"))
  31322. }, [
  31323. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  31324. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  31325. ])
  31326. ], 2)
  31327. ], 2),
  31328. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  31329. key: 0,
  31330. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  31331. }, [
  31332. vue.renderSlot(_ctx.$slots, "extra")
  31333. ], 2)) : vue.createCommentVNode("v-if", true)
  31334. ], 2),
  31335. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  31336. key: 1,
  31337. class: vue.normalizeClass(vue.unref(ns).e("main"))
  31338. }, [
  31339. vue.renderSlot(_ctx.$slots, "default")
  31340. ], 2)) : vue.createCommentVNode("v-if", true)
  31341. ], 2);
  31342. };
  31343. }
  31344. });
  31345. var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "page-header.vue"]]);
  31346. const ElPageHeader = withInstall(PageHeader);
  31347. const paginationPrevProps = buildProps({
  31348. disabled: Boolean,
  31349. currentPage: {
  31350. type: Number,
  31351. default: 1
  31352. },
  31353. prevText: {
  31354. type: String
  31355. },
  31356. prevIcon: {
  31357. type: iconPropType
  31358. }
  31359. });
  31360. const paginationPrevEmits = {
  31361. click: (evt) => evt instanceof MouseEvent
  31362. };
  31363. const _hoisted_1$p = ["disabled", "aria-disabled"];
  31364. const _hoisted_2$h = { key: 0 };
  31365. const __default__$C = vue.defineComponent({
  31366. name: "ElPaginationPrev"
  31367. });
  31368. const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
  31369. ...__default__$C,
  31370. props: paginationPrevProps,
  31371. emits: paginationPrevEmits,
  31372. setup(__props) {
  31373. const props = __props;
  31374. const internalDisabled = vue.computed(() => props.disabled || props.currentPage <= 1);
  31375. return (_ctx, _cache) => {
  31376. return vue.openBlock(), vue.createElementBlock("button", {
  31377. type: "button",
  31378. class: "btn-prev",
  31379. disabled: vue.unref(internalDisabled),
  31380. "aria-disabled": vue.unref(internalDisabled),
  31381. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  31382. }, [
  31383. _ctx.prevText ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$h, vue.toDisplayString(_ctx.prevText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  31384. default: vue.withCtx(() => [
  31385. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prevIcon)))
  31386. ]),
  31387. _: 1
  31388. }))
  31389. ], 8, _hoisted_1$p);
  31390. };
  31391. }
  31392. });
  31393. var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__file", "prev.vue"]]);
  31394. const paginationNextProps = buildProps({
  31395. disabled: Boolean,
  31396. currentPage: {
  31397. type: Number,
  31398. default: 1
  31399. },
  31400. pageCount: {
  31401. type: Number,
  31402. default: 50
  31403. },
  31404. nextText: {
  31405. type: String
  31406. },
  31407. nextIcon: {
  31408. type: iconPropType
  31409. }
  31410. });
  31411. const _hoisted_1$o = ["disabled", "aria-disabled"];
  31412. const _hoisted_2$g = { key: 0 };
  31413. const __default__$B = vue.defineComponent({
  31414. name: "ElPaginationNext"
  31415. });
  31416. const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
  31417. ...__default__$B,
  31418. props: paginationNextProps,
  31419. emits: ["click"],
  31420. setup(__props) {
  31421. const props = __props;
  31422. const internalDisabled = vue.computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  31423. return (_ctx, _cache) => {
  31424. return vue.openBlock(), vue.createElementBlock("button", {
  31425. type: "button",
  31426. class: "btn-next",
  31427. disabled: vue.unref(internalDisabled),
  31428. "aria-disabled": vue.unref(internalDisabled),
  31429. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  31430. }, [
  31431. _ctx.nextText ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$g, vue.toDisplayString(_ctx.nextText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  31432. default: vue.withCtx(() => [
  31433. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.nextIcon)))
  31434. ]),
  31435. _: 1
  31436. }))
  31437. ], 8, _hoisted_1$o);
  31438. };
  31439. }
  31440. });
  31441. var Next = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__file", "next.vue"]]);
  31442. const selectGroupKey = "ElSelectGroup";
  31443. const selectKey = "ElSelect";
  31444. function useOption$1(props, states) {
  31445. const select = vue.inject(selectKey);
  31446. const selectGroup = vue.inject(selectGroupKey, { disabled: false });
  31447. const isObject = vue.computed(() => {
  31448. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  31449. });
  31450. const itemSelected = vue.computed(() => {
  31451. if (!select.props.multiple) {
  31452. return isEqual(props.value, select.props.modelValue);
  31453. } else {
  31454. return contains(select.props.modelValue, props.value);
  31455. }
  31456. });
  31457. const limitReached = vue.computed(() => {
  31458. if (select.props.multiple) {
  31459. const modelValue = select.props.modelValue || [];
  31460. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  31461. } else {
  31462. return false;
  31463. }
  31464. });
  31465. const currentLabel = vue.computed(() => {
  31466. return props.label || (isObject.value ? "" : props.value);
  31467. });
  31468. const currentValue = vue.computed(() => {
  31469. return props.value || props.label || "";
  31470. });
  31471. const isDisabled = vue.computed(() => {
  31472. return props.disabled || states.groupDisabled || limitReached.value;
  31473. });
  31474. const instance = vue.getCurrentInstance();
  31475. const contains = (arr = [], target) => {
  31476. if (!isObject.value) {
  31477. return arr && arr.includes(target);
  31478. } else {
  31479. const valueKey = select.props.valueKey;
  31480. return arr && arr.some((item) => {
  31481. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  31482. });
  31483. }
  31484. };
  31485. const isEqual = (a, b) => {
  31486. if (!isObject.value) {
  31487. return a === b;
  31488. } else {
  31489. const { valueKey } = select.props;
  31490. return get(a, valueKey) === get(b, valueKey);
  31491. }
  31492. };
  31493. const hoverItem = () => {
  31494. if (!props.disabled && !selectGroup.disabled) {
  31495. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  31496. }
  31497. };
  31498. vue.watch(() => currentLabel.value, () => {
  31499. if (!props.created && !select.props.remote)
  31500. select.setSelected();
  31501. });
  31502. vue.watch(() => props.value, (val, oldVal) => {
  31503. const { remote, valueKey } = select.props;
  31504. if (!Object.is(val, oldVal)) {
  31505. select.onOptionDestroy(oldVal, instance.proxy);
  31506. select.onOptionCreate(instance.proxy);
  31507. }
  31508. if (!props.created && !remote) {
  31509. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  31510. return;
  31511. }
  31512. select.setSelected();
  31513. }
  31514. });
  31515. vue.watch(() => selectGroup.disabled, () => {
  31516. states.groupDisabled = selectGroup.disabled;
  31517. }, { immediate: true });
  31518. const { queryChange } = vue.toRaw(select);
  31519. vue.watch(queryChange, (changes) => {
  31520. const { query } = vue.unref(changes);
  31521. const regexp = new RegExp(escapeStringRegexp(query), "i");
  31522. states.visible = regexp.test(currentLabel.value) || props.created;
  31523. if (!states.visible) {
  31524. select.filteredOptionsCount--;
  31525. }
  31526. });
  31527. return {
  31528. select,
  31529. currentLabel,
  31530. currentValue,
  31531. itemSelected,
  31532. isDisabled,
  31533. hoverItem
  31534. };
  31535. }
  31536. const _sfc_main$O = vue.defineComponent({
  31537. name: "ElOption",
  31538. componentName: "ElOption",
  31539. props: {
  31540. value: {
  31541. required: true,
  31542. type: [String, Number, Boolean, Object]
  31543. },
  31544. label: [String, Number],
  31545. created: Boolean,
  31546. disabled: {
  31547. type: Boolean,
  31548. default: false
  31549. }
  31550. },
  31551. setup(props) {
  31552. const ns = useNamespace("select");
  31553. const states = vue.reactive({
  31554. index: -1,
  31555. groupDisabled: false,
  31556. visible: true,
  31557. hitState: false,
  31558. hover: false
  31559. });
  31560. const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption$1(props, states);
  31561. const { visible, hover } = vue.toRefs(states);
  31562. const vm = vue.getCurrentInstance().proxy;
  31563. select.onOptionCreate(vm);
  31564. vue.onBeforeUnmount(() => {
  31565. const key = vm.value;
  31566. const { selected } = select;
  31567. const selectedOptions = select.props.multiple ? selected : [selected];
  31568. const doesSelected = selectedOptions.some((item) => {
  31569. return item.value === vm.value;
  31570. });
  31571. vue.nextTick(() => {
  31572. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  31573. select.cachedOptions.delete(key);
  31574. }
  31575. });
  31576. select.onOptionDestroy(key, vm);
  31577. });
  31578. function selectOptionClick() {
  31579. if (props.disabled !== true && states.groupDisabled !== true) {
  31580. select.handleOptionSelect(vm, true);
  31581. }
  31582. }
  31583. return {
  31584. ns,
  31585. currentLabel,
  31586. itemSelected,
  31587. isDisabled,
  31588. select,
  31589. hoverItem,
  31590. visible,
  31591. hover,
  31592. selectOptionClick,
  31593. states
  31594. };
  31595. }
  31596. });
  31597. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  31598. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  31599. class: vue.normalizeClass([
  31600. _ctx.ns.be("dropdown", "item"),
  31601. _ctx.ns.is("disabled", _ctx.isDisabled),
  31602. {
  31603. selected: _ctx.itemSelected,
  31604. hover: _ctx.hover
  31605. }
  31606. ]),
  31607. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  31608. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  31609. }, [
  31610. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  31611. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentLabel), 1)
  31612. ])
  31613. ], 34)), [
  31614. [vue.vShow, _ctx.visible]
  31615. ]);
  31616. }
  31617. var Option = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$b], ["__file", "option.vue"]]);
  31618. const _sfc_main$N = vue.defineComponent({
  31619. name: "ElSelectDropdown",
  31620. componentName: "ElSelectDropdown",
  31621. setup() {
  31622. const select = vue.inject(selectKey);
  31623. const ns = useNamespace("select");
  31624. const popperClass = vue.computed(() => select.props.popperClass);
  31625. const isMultiple = vue.computed(() => select.props.multiple);
  31626. const isFitInputWidth = vue.computed(() => select.props.fitInputWidth);
  31627. const minWidth = vue.ref("");
  31628. function updateMinWidth() {
  31629. var _a;
  31630. minWidth.value = `${(_a = select.selectWrapper) == null ? void 0 : _a.offsetWidth}px`;
  31631. }
  31632. vue.onMounted(() => {
  31633. updateMinWidth();
  31634. useResizeObserver(select.selectWrapper, updateMinWidth);
  31635. });
  31636. return {
  31637. ns,
  31638. minWidth,
  31639. popperClass,
  31640. isMultiple,
  31641. isFitInputWidth
  31642. };
  31643. }
  31644. });
  31645. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  31646. return vue.openBlock(), vue.createElementBlock("div", {
  31647. class: vue.normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  31648. style: vue.normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  31649. }, [
  31650. vue.renderSlot(_ctx.$slots, "default")
  31651. ], 6);
  31652. }
  31653. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]);
  31654. function useSelectStates(props) {
  31655. const { t } = useLocale();
  31656. return vue.reactive({
  31657. options: /* @__PURE__ */ new Map(),
  31658. cachedOptions: /* @__PURE__ */ new Map(),
  31659. createdLabel: null,
  31660. createdSelected: false,
  31661. selected: props.multiple ? [] : {},
  31662. inputLength: 20,
  31663. inputWidth: 0,
  31664. optionsCount: 0,
  31665. filteredOptionsCount: 0,
  31666. visible: false,
  31667. softFocus: false,
  31668. selectedLabel: "",
  31669. hoverIndex: -1,
  31670. query: "",
  31671. previousQuery: null,
  31672. inputHovering: false,
  31673. cachedPlaceHolder: "",
  31674. currentPlaceholder: t("el.select.placeholder"),
  31675. menuVisibleOnFocus: false,
  31676. isOnComposition: false,
  31677. isSilentBlur: false,
  31678. prefixWidth: 11,
  31679. tagInMultiLine: false,
  31680. mouseEnter: false
  31681. });
  31682. }
  31683. const useSelect$3 = (props, states, ctx) => {
  31684. const { t } = useLocale();
  31685. const ns = useNamespace("select");
  31686. useDeprecated({
  31687. from: "suffixTransition",
  31688. replacement: "override style scheme",
  31689. version: "2.3.0",
  31690. scope: "props",
  31691. ref: "https://element-plus.org/en-US/component/select.html#select-attributes"
  31692. }, vue.computed(() => props.suffixTransition === false));
  31693. const reference = vue.ref(null);
  31694. const input = vue.ref(null);
  31695. const tooltipRef = vue.ref(null);
  31696. const tags = vue.ref(null);
  31697. const selectWrapper = vue.ref(null);
  31698. const scrollbar = vue.ref(null);
  31699. const hoverOption = vue.ref(-1);
  31700. const queryChange = vue.shallowRef({ query: "" });
  31701. const groupQueryChange = vue.shallowRef("");
  31702. const { form, formItem } = useFormItem();
  31703. const readonly = vue.computed(() => !props.filterable || props.multiple || !states.visible);
  31704. const selectDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  31705. const showClose = vue.computed(() => {
  31706. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  31707. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  31708. return criteria;
  31709. });
  31710. const iconComponent = vue.computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  31711. const iconReverse = vue.computed(() => ns.is("reverse", iconComponent.value && states.visible && props.suffixTransition));
  31712. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  31713. const emptyText = vue.computed(() => {
  31714. if (props.loading) {
  31715. return props.loadingText || t("el.select.loading");
  31716. } else {
  31717. if (props.remote && states.query === "" && states.options.size === 0)
  31718. return false;
  31719. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  31720. return props.noMatchText || t("el.select.noMatch");
  31721. }
  31722. if (states.options.size === 0) {
  31723. return props.noDataText || t("el.select.noData");
  31724. }
  31725. }
  31726. return null;
  31727. });
  31728. const optionsArray = vue.computed(() => Array.from(states.options.values()));
  31729. const cachedOptionsArray = vue.computed(() => Array.from(states.cachedOptions.values()));
  31730. const showNewOption = vue.computed(() => {
  31731. const hasExistingOption = optionsArray.value.filter((option) => {
  31732. return !option.created;
  31733. }).some((option) => {
  31734. return option.currentLabel === states.query;
  31735. });
  31736. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  31737. });
  31738. const selectSize = useSize();
  31739. const collapseTagSize = vue.computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  31740. const dropMenuVisible = vue.computed({
  31741. get() {
  31742. return states.visible && emptyText.value !== false;
  31743. },
  31744. set(val) {
  31745. states.visible = val;
  31746. }
  31747. });
  31748. vue.watch([() => selectDisabled.value, () => selectSize.value, () => form == null ? void 0 : form.size], () => {
  31749. vue.nextTick(() => {
  31750. resetInputHeight();
  31751. });
  31752. });
  31753. vue.watch(() => props.placeholder, (val) => {
  31754. states.cachedPlaceHolder = states.currentPlaceholder = val;
  31755. });
  31756. vue.watch(() => props.modelValue, (val, oldVal) => {
  31757. if (props.multiple) {
  31758. resetInputHeight();
  31759. if (val && val.length > 0 || input.value && states.query !== "") {
  31760. states.currentPlaceholder = "";
  31761. } else {
  31762. states.currentPlaceholder = states.cachedPlaceHolder;
  31763. }
  31764. if (props.filterable && !props.reserveKeyword) {
  31765. states.query = "";
  31766. handleQueryChange(states.query);
  31767. }
  31768. }
  31769. setSelected();
  31770. if (props.filterable && !props.multiple) {
  31771. states.inputLength = 20;
  31772. }
  31773. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  31774. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  31775. }
  31776. }, {
  31777. flush: "post",
  31778. deep: true
  31779. });
  31780. vue.watch(() => states.visible, (val) => {
  31781. var _a, _b, _c;
  31782. if (!val) {
  31783. if (props.filterable) {
  31784. if (isFunction(props.filterMethod)) {
  31785. props.filterMethod("");
  31786. }
  31787. if (isFunction(props.remoteMethod)) {
  31788. props.remoteMethod("");
  31789. }
  31790. }
  31791. input.value && input.value.blur();
  31792. states.query = "";
  31793. states.previousQuery = null;
  31794. states.selectedLabel = "";
  31795. states.inputLength = 20;
  31796. states.menuVisibleOnFocus = false;
  31797. resetHoverIndex();
  31798. vue.nextTick(() => {
  31799. if (input.value && input.value.value === "" && states.selected.length === 0) {
  31800. states.currentPlaceholder = states.cachedPlaceHolder;
  31801. }
  31802. });
  31803. if (!props.multiple) {
  31804. if (states.selected) {
  31805. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  31806. states.selectedLabel = states.createdLabel;
  31807. } else {
  31808. states.selectedLabel = states.selected.currentLabel;
  31809. }
  31810. if (props.filterable)
  31811. states.query = states.selectedLabel;
  31812. }
  31813. if (props.filterable) {
  31814. states.currentPlaceholder = states.cachedPlaceHolder;
  31815. }
  31816. }
  31817. } else {
  31818. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  31819. if (props.filterable) {
  31820. states.filteredOptionsCount = states.optionsCount;
  31821. states.query = props.remote ? "" : states.selectedLabel;
  31822. if (props.multiple) {
  31823. (_c = input.value) == null ? void 0 : _c.focus();
  31824. } else {
  31825. if (states.selectedLabel) {
  31826. states.currentPlaceholder = `${states.selectedLabel}`;
  31827. states.selectedLabel = "";
  31828. }
  31829. }
  31830. handleQueryChange(states.query);
  31831. if (!props.multiple && !props.remote) {
  31832. queryChange.value.query = "";
  31833. vue.triggerRef(queryChange);
  31834. vue.triggerRef(groupQueryChange);
  31835. }
  31836. }
  31837. }
  31838. ctx.emit("visible-change", val);
  31839. });
  31840. vue.watch(() => states.options.entries(), () => {
  31841. var _a, _b, _c;
  31842. if (!isClient)
  31843. return;
  31844. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  31845. if (props.multiple) {
  31846. resetInputHeight();
  31847. }
  31848. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  31849. if (!Array.from(inputs).includes(document.activeElement)) {
  31850. setSelected();
  31851. }
  31852. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  31853. checkDefaultFirstOption();
  31854. }
  31855. }, {
  31856. flush: "post"
  31857. });
  31858. vue.watch(() => states.hoverIndex, (val) => {
  31859. if (isNumber(val) && val > -1) {
  31860. hoverOption.value = optionsArray.value[val] || {};
  31861. } else {
  31862. hoverOption.value = {};
  31863. }
  31864. optionsArray.value.forEach((option) => {
  31865. option.hover = hoverOption.value === option;
  31866. });
  31867. });
  31868. const resetInputHeight = () => {
  31869. if (props.collapseTags && !props.filterable)
  31870. return;
  31871. vue.nextTick(() => {
  31872. var _a, _b;
  31873. if (!reference.value)
  31874. return;
  31875. const input2 = reference.value.$el.querySelector("input");
  31876. const _tags = tags.value;
  31877. const sizeInMap = getComponentSize(selectSize.value || (form == null ? void 0 : form.size));
  31878. input2.style.height = `${(states.selected.length === 0 ? sizeInMap : Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)) - 2}px`;
  31879. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  31880. if (states.visible && emptyText.value !== false) {
  31881. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  31882. }
  31883. });
  31884. };
  31885. const handleQueryChange = async (val) => {
  31886. if (states.previousQuery === val || states.isOnComposition)
  31887. return;
  31888. if (states.previousQuery === null && (isFunction(props.filterMethod) || isFunction(props.remoteMethod))) {
  31889. states.previousQuery = val;
  31890. return;
  31891. }
  31892. states.previousQuery = val;
  31893. vue.nextTick(() => {
  31894. var _a, _b;
  31895. if (states.visible)
  31896. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  31897. });
  31898. states.hoverIndex = -1;
  31899. if (props.multiple && props.filterable) {
  31900. vue.nextTick(() => {
  31901. const length = input.value.value.length * 15 + 20;
  31902. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  31903. managePlaceholder();
  31904. resetInputHeight();
  31905. });
  31906. }
  31907. if (props.remote && isFunction(props.remoteMethod)) {
  31908. states.hoverIndex = -1;
  31909. props.remoteMethod(val);
  31910. } else if (isFunction(props.filterMethod)) {
  31911. props.filterMethod(val);
  31912. vue.triggerRef(groupQueryChange);
  31913. } else {
  31914. states.filteredOptionsCount = states.optionsCount;
  31915. queryChange.value.query = val;
  31916. vue.triggerRef(queryChange);
  31917. vue.triggerRef(groupQueryChange);
  31918. }
  31919. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  31920. await vue.nextTick();
  31921. checkDefaultFirstOption();
  31922. }
  31923. };
  31924. const managePlaceholder = () => {
  31925. if (states.currentPlaceholder !== "") {
  31926. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  31927. }
  31928. };
  31929. const checkDefaultFirstOption = () => {
  31930. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  31931. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  31932. const firstOriginOption = optionsInDropdown[0];
  31933. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  31934. };
  31935. const setSelected = () => {
  31936. var _a;
  31937. if (!props.multiple) {
  31938. const option = getOption(props.modelValue);
  31939. if ((_a = option.props) == null ? void 0 : _a.created) {
  31940. states.createdLabel = option.props.value;
  31941. states.createdSelected = true;
  31942. } else {
  31943. states.createdSelected = false;
  31944. }
  31945. states.selectedLabel = option.currentLabel;
  31946. states.selected = option;
  31947. if (props.filterable)
  31948. states.query = states.selectedLabel;
  31949. return;
  31950. } else {
  31951. states.selectedLabel = "";
  31952. }
  31953. const result = [];
  31954. if (Array.isArray(props.modelValue)) {
  31955. props.modelValue.forEach((value) => {
  31956. result.push(getOption(value));
  31957. });
  31958. }
  31959. states.selected = result;
  31960. vue.nextTick(() => {
  31961. resetInputHeight();
  31962. });
  31963. };
  31964. const getOption = (value) => {
  31965. let option;
  31966. const isObjectValue = toRawType(value).toLowerCase() === "object";
  31967. const isNull = toRawType(value).toLowerCase() === "null";
  31968. const isUndefined = toRawType(value).toLowerCase() === "undefined";
  31969. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  31970. const cachedOption = cachedOptionsArray.value[i];
  31971. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  31972. if (isEqualValue) {
  31973. option = {
  31974. value,
  31975. currentLabel: cachedOption.currentLabel,
  31976. isDisabled: cachedOption.isDisabled
  31977. };
  31978. break;
  31979. }
  31980. }
  31981. if (option)
  31982. return option;
  31983. const label = isObjectValue ? value.label : !isNull && !isUndefined ? value : "";
  31984. const newOption = {
  31985. value,
  31986. currentLabel: label
  31987. };
  31988. if (props.multiple) {
  31989. newOption.hitState = false;
  31990. }
  31991. return newOption;
  31992. };
  31993. const resetHoverIndex = () => {
  31994. setTimeout(() => {
  31995. const valueKey = props.valueKey;
  31996. if (!props.multiple) {
  31997. states.hoverIndex = optionsArray.value.findIndex((item) => {
  31998. return getValueKey(item) === getValueKey(states.selected);
  31999. });
  32000. } else {
  32001. if (states.selected.length > 0) {
  32002. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  32003. return optionsArray.value.findIndex((item) => {
  32004. return get(item, valueKey) === get(selected, valueKey);
  32005. });
  32006. }));
  32007. } else {
  32008. states.hoverIndex = -1;
  32009. }
  32010. }
  32011. }, 300);
  32012. };
  32013. const handleResize = () => {
  32014. var _a, _b;
  32015. resetInputWidth();
  32016. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  32017. if (props.multiple && !props.filterable)
  32018. resetInputHeight();
  32019. };
  32020. const resetInputWidth = () => {
  32021. var _a;
  32022. states.inputWidth = (_a = reference.value) == null ? void 0 : _a.$el.getBoundingClientRect().width;
  32023. };
  32024. const onInputChange = () => {
  32025. if (props.filterable && states.query !== states.selectedLabel) {
  32026. states.query = states.selectedLabel;
  32027. handleQueryChange(states.query);
  32028. }
  32029. };
  32030. const debouncedOnInputChange = debounce(() => {
  32031. onInputChange();
  32032. }, debounce$1.value);
  32033. const debouncedQueryChange = debounce((e) => {
  32034. handleQueryChange(e.target.value);
  32035. }, debounce$1.value);
  32036. const emitChange = (val) => {
  32037. if (!isEqual$1(props.modelValue, val)) {
  32038. ctx.emit(CHANGE_EVENT, val);
  32039. }
  32040. };
  32041. const deletePrevTag = (e) => {
  32042. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  32043. const value = props.modelValue.slice();
  32044. value.pop();
  32045. ctx.emit(UPDATE_MODEL_EVENT, value);
  32046. emitChange(value);
  32047. }
  32048. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  32049. states.currentPlaceholder = states.cachedPlaceHolder;
  32050. }
  32051. };
  32052. const deleteTag = (event, tag) => {
  32053. const index = states.selected.indexOf(tag);
  32054. if (index > -1 && !selectDisabled.value) {
  32055. const value = props.modelValue.slice();
  32056. value.splice(index, 1);
  32057. ctx.emit(UPDATE_MODEL_EVENT, value);
  32058. emitChange(value);
  32059. ctx.emit("remove-tag", tag.value);
  32060. }
  32061. event.stopPropagation();
  32062. };
  32063. const deleteSelected = (event) => {
  32064. event.stopPropagation();
  32065. const value = props.multiple ? [] : "";
  32066. if (!isString(value)) {
  32067. for (const item of states.selected) {
  32068. if (item.isDisabled)
  32069. value.push(item.value);
  32070. }
  32071. }
  32072. ctx.emit(UPDATE_MODEL_EVENT, value);
  32073. emitChange(value);
  32074. states.hoverIndex = -1;
  32075. states.visible = false;
  32076. ctx.emit("clear");
  32077. };
  32078. const handleOptionSelect = (option, byClick) => {
  32079. var _a;
  32080. if (props.multiple) {
  32081. const value = (props.modelValue || []).slice();
  32082. const optionIndex = getValueIndex(value, option.value);
  32083. if (optionIndex > -1) {
  32084. value.splice(optionIndex, 1);
  32085. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  32086. value.push(option.value);
  32087. }
  32088. ctx.emit(UPDATE_MODEL_EVENT, value);
  32089. emitChange(value);
  32090. if (option.created) {
  32091. states.query = "";
  32092. handleQueryChange("");
  32093. states.inputLength = 20;
  32094. }
  32095. if (props.filterable)
  32096. (_a = input.value) == null ? void 0 : _a.focus();
  32097. } else {
  32098. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  32099. emitChange(option.value);
  32100. states.visible = false;
  32101. }
  32102. states.isSilentBlur = byClick;
  32103. setSoftFocus();
  32104. if (states.visible)
  32105. return;
  32106. vue.nextTick(() => {
  32107. scrollToOption(option);
  32108. });
  32109. };
  32110. const getValueIndex = (arr = [], value) => {
  32111. if (!isObject$1(value))
  32112. return arr.indexOf(value);
  32113. const valueKey = props.valueKey;
  32114. let index = -1;
  32115. arr.some((item, i) => {
  32116. if (vue.toRaw(get(item, valueKey)) === get(value, valueKey)) {
  32117. index = i;
  32118. return true;
  32119. }
  32120. return false;
  32121. });
  32122. return index;
  32123. };
  32124. const setSoftFocus = () => {
  32125. states.softFocus = true;
  32126. const _input = input.value || reference.value;
  32127. if (_input) {
  32128. _input == null ? void 0 : _input.focus();
  32129. }
  32130. };
  32131. const scrollToOption = (option) => {
  32132. var _a, _b, _c, _d, _e;
  32133. const targetOption = Array.isArray(option) ? option[0] : option;
  32134. let target = null;
  32135. if (targetOption == null ? void 0 : targetOption.value) {
  32136. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  32137. if (options.length > 0) {
  32138. target = options[0].$el;
  32139. }
  32140. }
  32141. if (tooltipRef.value && target) {
  32142. 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, `.${ns.be("dropdown", "wrap")}`);
  32143. if (menu) {
  32144. scrollIntoView(menu, target);
  32145. }
  32146. }
  32147. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  32148. };
  32149. const onOptionCreate = (vm) => {
  32150. states.optionsCount++;
  32151. states.filteredOptionsCount++;
  32152. states.options.set(vm.value, vm);
  32153. states.cachedOptions.set(vm.value, vm);
  32154. };
  32155. const onOptionDestroy = (key, vm) => {
  32156. if (states.options.get(key) === vm) {
  32157. states.optionsCount--;
  32158. states.filteredOptionsCount--;
  32159. states.options.delete(key);
  32160. }
  32161. };
  32162. const resetInputState = (e) => {
  32163. if (e.code !== EVENT_CODE.backspace)
  32164. toggleLastOptionHitState(false);
  32165. states.inputLength = input.value.value.length * 15 + 20;
  32166. resetInputHeight();
  32167. };
  32168. const toggleLastOptionHitState = (hit) => {
  32169. if (!Array.isArray(states.selected))
  32170. return;
  32171. const option = states.selected[states.selected.length - 1];
  32172. if (!option)
  32173. return;
  32174. if (hit === true || hit === false) {
  32175. option.hitState = hit;
  32176. return hit;
  32177. }
  32178. option.hitState = !option.hitState;
  32179. return option.hitState;
  32180. };
  32181. const handleComposition = (event) => {
  32182. const text = event.target.value;
  32183. if (event.type === "compositionend") {
  32184. states.isOnComposition = false;
  32185. vue.nextTick(() => handleQueryChange(text));
  32186. } else {
  32187. const lastCharacter = text[text.length - 1] || "";
  32188. states.isOnComposition = !isKorean(lastCharacter);
  32189. }
  32190. };
  32191. const handleMenuEnter = () => {
  32192. vue.nextTick(() => scrollToOption(states.selected));
  32193. };
  32194. const handleFocus = (event) => {
  32195. if (!states.softFocus) {
  32196. if (props.automaticDropdown || props.filterable) {
  32197. if (props.filterable && !states.visible) {
  32198. states.menuVisibleOnFocus = true;
  32199. }
  32200. states.visible = true;
  32201. }
  32202. ctx.emit("focus", event);
  32203. } else {
  32204. states.softFocus = false;
  32205. }
  32206. };
  32207. const blur = () => {
  32208. var _a;
  32209. states.visible = false;
  32210. (_a = reference.value) == null ? void 0 : _a.blur();
  32211. };
  32212. const handleBlur = (event) => {
  32213. vue.nextTick(() => {
  32214. if (states.isSilentBlur) {
  32215. states.isSilentBlur = false;
  32216. } else {
  32217. ctx.emit("blur", event);
  32218. }
  32219. });
  32220. states.softFocus = false;
  32221. };
  32222. const handleClearClick = (event) => {
  32223. deleteSelected(event);
  32224. };
  32225. const handleClose = () => {
  32226. states.visible = false;
  32227. };
  32228. const handleKeydownEscape = (event) => {
  32229. if (states.visible) {
  32230. event.preventDefault();
  32231. event.stopPropagation();
  32232. states.visible = false;
  32233. }
  32234. };
  32235. const toggleMenu = (e) => {
  32236. var _a;
  32237. if (e && !states.mouseEnter) {
  32238. return;
  32239. }
  32240. if (!selectDisabled.value) {
  32241. if (states.menuVisibleOnFocus) {
  32242. states.menuVisibleOnFocus = false;
  32243. } else {
  32244. if (!tooltipRef.value || !tooltipRef.value.isFocusInsideContent()) {
  32245. states.visible = !states.visible;
  32246. }
  32247. }
  32248. if (states.visible) {
  32249. (_a = input.value || reference.value) == null ? void 0 : _a.focus();
  32250. }
  32251. }
  32252. };
  32253. const selectOption = () => {
  32254. if (!states.visible) {
  32255. toggleMenu();
  32256. } else {
  32257. if (optionsArray.value[states.hoverIndex]) {
  32258. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  32259. }
  32260. }
  32261. };
  32262. const getValueKey = (item) => {
  32263. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  32264. };
  32265. const optionsAllDisabled = vue.computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  32266. const navigateOptions = (direction) => {
  32267. if (!states.visible) {
  32268. states.visible = true;
  32269. return;
  32270. }
  32271. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  32272. return;
  32273. if (states.isOnComposition)
  32274. return;
  32275. if (!optionsAllDisabled.value) {
  32276. if (direction === "next") {
  32277. states.hoverIndex++;
  32278. if (states.hoverIndex === states.options.size) {
  32279. states.hoverIndex = 0;
  32280. }
  32281. } else if (direction === "prev") {
  32282. states.hoverIndex--;
  32283. if (states.hoverIndex < 0) {
  32284. states.hoverIndex = states.options.size - 1;
  32285. }
  32286. }
  32287. const option = optionsArray.value[states.hoverIndex];
  32288. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  32289. navigateOptions(direction);
  32290. }
  32291. vue.nextTick(() => scrollToOption(hoverOption.value));
  32292. }
  32293. };
  32294. const handleMouseEnter = () => {
  32295. states.mouseEnter = true;
  32296. };
  32297. const handleMouseLeave = () => {
  32298. states.mouseEnter = false;
  32299. };
  32300. return {
  32301. optionsArray,
  32302. selectSize,
  32303. handleResize,
  32304. debouncedOnInputChange,
  32305. debouncedQueryChange,
  32306. deletePrevTag,
  32307. deleteTag,
  32308. deleteSelected,
  32309. handleOptionSelect,
  32310. scrollToOption,
  32311. readonly,
  32312. resetInputHeight,
  32313. showClose,
  32314. iconComponent,
  32315. iconReverse,
  32316. showNewOption,
  32317. collapseTagSize,
  32318. setSelected,
  32319. managePlaceholder,
  32320. selectDisabled,
  32321. emptyText,
  32322. toggleLastOptionHitState,
  32323. resetInputState,
  32324. handleComposition,
  32325. onOptionCreate,
  32326. onOptionDestroy,
  32327. handleMenuEnter,
  32328. handleFocus,
  32329. blur,
  32330. handleBlur,
  32331. handleClearClick,
  32332. handleClose,
  32333. handleKeydownEscape,
  32334. toggleMenu,
  32335. selectOption,
  32336. getValueKey,
  32337. navigateOptions,
  32338. dropMenuVisible,
  32339. queryChange,
  32340. groupQueryChange,
  32341. reference,
  32342. input,
  32343. tooltipRef,
  32344. tags,
  32345. selectWrapper,
  32346. scrollbar,
  32347. handleMouseEnter,
  32348. handleMouseLeave
  32349. };
  32350. };
  32351. const COMPONENT_NAME$9 = "ElSelect";
  32352. const _sfc_main$M = vue.defineComponent({
  32353. name: COMPONENT_NAME$9,
  32354. componentName: COMPONENT_NAME$9,
  32355. components: {
  32356. ElInput,
  32357. ElSelectMenu: ElSelectMenu$1,
  32358. ElOption: Option,
  32359. ElTag,
  32360. ElScrollbar,
  32361. ElTooltip,
  32362. ElIcon
  32363. },
  32364. directives: { ClickOutside },
  32365. props: {
  32366. name: String,
  32367. id: String,
  32368. modelValue: {
  32369. type: [Array, String, Number, Boolean, Object],
  32370. default: void 0
  32371. },
  32372. autocomplete: {
  32373. type: String,
  32374. default: "off"
  32375. },
  32376. automaticDropdown: Boolean,
  32377. size: {
  32378. type: String,
  32379. validator: isValidComponentSize
  32380. },
  32381. effect: {
  32382. type: String,
  32383. default: "light"
  32384. },
  32385. disabled: Boolean,
  32386. clearable: Boolean,
  32387. filterable: Boolean,
  32388. allowCreate: Boolean,
  32389. loading: Boolean,
  32390. popperClass: {
  32391. type: String,
  32392. default: ""
  32393. },
  32394. remote: Boolean,
  32395. loadingText: String,
  32396. noMatchText: String,
  32397. noDataText: String,
  32398. remoteMethod: Function,
  32399. filterMethod: Function,
  32400. multiple: Boolean,
  32401. multipleLimit: {
  32402. type: Number,
  32403. default: 0
  32404. },
  32405. placeholder: {
  32406. type: String
  32407. },
  32408. defaultFirstOption: Boolean,
  32409. reserveKeyword: {
  32410. type: Boolean,
  32411. default: true
  32412. },
  32413. valueKey: {
  32414. type: String,
  32415. default: "value"
  32416. },
  32417. collapseTags: Boolean,
  32418. collapseTagsTooltip: {
  32419. type: Boolean,
  32420. default: false
  32421. },
  32422. teleported: useTooltipContentProps.teleported,
  32423. persistent: {
  32424. type: Boolean,
  32425. default: true
  32426. },
  32427. clearIcon: {
  32428. type: iconPropType,
  32429. default: circle_close_default
  32430. },
  32431. fitInputWidth: {
  32432. type: Boolean,
  32433. default: false
  32434. },
  32435. suffixIcon: {
  32436. type: iconPropType,
  32437. default: arrow_down_default
  32438. },
  32439. tagType: { ...tagProps.type, default: "info" },
  32440. validateEvent: {
  32441. type: Boolean,
  32442. default: true
  32443. },
  32444. remoteShowSuffix: {
  32445. type: Boolean,
  32446. default: false
  32447. },
  32448. suffixTransition: {
  32449. type: Boolean,
  32450. default: true
  32451. },
  32452. placement: {
  32453. type: String,
  32454. values: Ee,
  32455. default: "bottom-start"
  32456. }
  32457. },
  32458. emits: [
  32459. UPDATE_MODEL_EVENT,
  32460. CHANGE_EVENT,
  32461. "remove-tag",
  32462. "clear",
  32463. "visible-change",
  32464. "focus",
  32465. "blur"
  32466. ],
  32467. setup(props, ctx) {
  32468. const nsSelect = useNamespace("select");
  32469. const nsInput = useNamespace("input");
  32470. const { t } = useLocale();
  32471. const states = useSelectStates(props);
  32472. const {
  32473. optionsArray,
  32474. selectSize,
  32475. readonly,
  32476. handleResize,
  32477. collapseTagSize,
  32478. debouncedOnInputChange,
  32479. debouncedQueryChange,
  32480. deletePrevTag,
  32481. deleteTag,
  32482. deleteSelected,
  32483. handleOptionSelect,
  32484. scrollToOption,
  32485. setSelected,
  32486. resetInputHeight,
  32487. managePlaceholder,
  32488. showClose,
  32489. selectDisabled,
  32490. iconComponent,
  32491. iconReverse,
  32492. showNewOption,
  32493. emptyText,
  32494. toggleLastOptionHitState,
  32495. resetInputState,
  32496. handleComposition,
  32497. onOptionCreate,
  32498. onOptionDestroy,
  32499. handleMenuEnter,
  32500. handleFocus,
  32501. blur,
  32502. handleBlur,
  32503. handleClearClick,
  32504. handleClose,
  32505. handleKeydownEscape,
  32506. toggleMenu,
  32507. selectOption,
  32508. getValueKey,
  32509. navigateOptions,
  32510. dropMenuVisible,
  32511. reference,
  32512. input,
  32513. tooltipRef,
  32514. tags,
  32515. selectWrapper,
  32516. scrollbar,
  32517. queryChange,
  32518. groupQueryChange,
  32519. handleMouseEnter,
  32520. handleMouseLeave
  32521. } = useSelect$3(props, states, ctx);
  32522. const { focus } = useFocus(reference);
  32523. const {
  32524. inputWidth,
  32525. selected,
  32526. inputLength,
  32527. filteredOptionsCount,
  32528. visible,
  32529. softFocus,
  32530. selectedLabel,
  32531. hoverIndex,
  32532. query,
  32533. inputHovering,
  32534. currentPlaceholder,
  32535. menuVisibleOnFocus,
  32536. isOnComposition,
  32537. isSilentBlur,
  32538. options,
  32539. cachedOptions,
  32540. optionsCount,
  32541. prefixWidth,
  32542. tagInMultiLine
  32543. } = vue.toRefs(states);
  32544. const wrapperKls = vue.computed(() => {
  32545. const classList = [nsSelect.b()];
  32546. const _selectSize = vue.unref(selectSize);
  32547. if (_selectSize) {
  32548. classList.push(nsSelect.m(_selectSize));
  32549. }
  32550. if (props.disabled) {
  32551. classList.push(nsSelect.m("disabled"));
  32552. }
  32553. return classList;
  32554. });
  32555. const selectTagsStyle = vue.computed(() => ({
  32556. maxWidth: `${vue.unref(inputWidth) - 32}px`,
  32557. width: "100%"
  32558. }));
  32559. const tagTextStyle = vue.computed(() => {
  32560. const maxWidth = vue.unref(inputWidth) > 123 ? vue.unref(inputWidth) - 123 : vue.unref(inputWidth) - 75;
  32561. return { maxWidth: `${maxWidth}px` };
  32562. });
  32563. vue.provide(selectKey, vue.reactive({
  32564. props,
  32565. options,
  32566. optionsArray,
  32567. cachedOptions,
  32568. optionsCount,
  32569. filteredOptionsCount,
  32570. hoverIndex,
  32571. handleOptionSelect,
  32572. onOptionCreate,
  32573. onOptionDestroy,
  32574. selectWrapper,
  32575. selected,
  32576. setSelected,
  32577. queryChange,
  32578. groupQueryChange
  32579. }));
  32580. vue.onMounted(() => {
  32581. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || t("el.select.placeholder");
  32582. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  32583. currentPlaceholder.value = "";
  32584. }
  32585. useResizeObserver(selectWrapper, handleResize);
  32586. if (props.remote && props.multiple) {
  32587. resetInputHeight();
  32588. }
  32589. vue.nextTick(() => {
  32590. const refEl = reference.value && reference.value.$el;
  32591. if (!refEl)
  32592. return;
  32593. inputWidth.value = refEl.getBoundingClientRect().width;
  32594. if (ctx.slots.prefix) {
  32595. const prefix = refEl.querySelector(`.${nsInput.e("prefix")}`);
  32596. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  32597. }
  32598. });
  32599. setSelected();
  32600. });
  32601. if (props.multiple && !Array.isArray(props.modelValue)) {
  32602. ctx.emit(UPDATE_MODEL_EVENT, []);
  32603. }
  32604. if (!props.multiple && Array.isArray(props.modelValue)) {
  32605. ctx.emit(UPDATE_MODEL_EVENT, "");
  32606. }
  32607. const popperPaneRef = vue.computed(() => {
  32608. var _a, _b;
  32609. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  32610. });
  32611. return {
  32612. tagInMultiLine,
  32613. prefixWidth,
  32614. selectSize,
  32615. readonly,
  32616. handleResize,
  32617. collapseTagSize,
  32618. debouncedOnInputChange,
  32619. debouncedQueryChange,
  32620. deletePrevTag,
  32621. deleteTag,
  32622. deleteSelected,
  32623. handleOptionSelect,
  32624. scrollToOption,
  32625. inputWidth,
  32626. selected,
  32627. inputLength,
  32628. filteredOptionsCount,
  32629. visible,
  32630. softFocus,
  32631. selectedLabel,
  32632. hoverIndex,
  32633. query,
  32634. inputHovering,
  32635. currentPlaceholder,
  32636. menuVisibleOnFocus,
  32637. isOnComposition,
  32638. isSilentBlur,
  32639. options,
  32640. resetInputHeight,
  32641. managePlaceholder,
  32642. showClose,
  32643. selectDisabled,
  32644. iconComponent,
  32645. iconReverse,
  32646. showNewOption,
  32647. emptyText,
  32648. toggleLastOptionHitState,
  32649. resetInputState,
  32650. handleComposition,
  32651. handleMenuEnter,
  32652. handleFocus,
  32653. blur,
  32654. handleBlur,
  32655. handleClearClick,
  32656. handleClose,
  32657. handleKeydownEscape,
  32658. toggleMenu,
  32659. selectOption,
  32660. getValueKey,
  32661. navigateOptions,
  32662. dropMenuVisible,
  32663. focus,
  32664. reference,
  32665. input,
  32666. tooltipRef,
  32667. popperPaneRef,
  32668. tags,
  32669. selectWrapper,
  32670. scrollbar,
  32671. wrapperKls,
  32672. selectTagsStyle,
  32673. nsSelect,
  32674. tagTextStyle,
  32675. handleMouseEnter,
  32676. handleMouseLeave
  32677. };
  32678. }
  32679. });
  32680. const _hoisted_1$n = ["disabled", "autocomplete"];
  32681. const _hoisted_2$f = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  32682. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  32683. const _component_el_tag = vue.resolveComponent("el-tag");
  32684. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  32685. const _component_el_icon = vue.resolveComponent("el-icon");
  32686. const _component_el_input = vue.resolveComponent("el-input");
  32687. const _component_el_option = vue.resolveComponent("el-option");
  32688. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  32689. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  32690. const _directive_click_outside = vue.resolveDirective("click-outside");
  32691. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  32692. ref: "selectWrapper",
  32693. class: vue.normalizeClass(_ctx.wrapperKls),
  32694. onMouseenter: _cache[22] || (_cache[22] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  32695. onMouseleave: _cache[23] || (_cache[23] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  32696. onClick: _cache[24] || (_cache[24] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  32697. }, [
  32698. vue.createVNode(_component_el_tooltip, {
  32699. ref: "tooltipRef",
  32700. visible: _ctx.dropMenuVisible,
  32701. placement: _ctx.placement,
  32702. teleported: _ctx.teleported,
  32703. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  32704. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  32705. effect: _ctx.effect,
  32706. pure: "",
  32707. trigger: "click",
  32708. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  32709. "stop-popper-mouse-event": false,
  32710. "gpu-acceleration": false,
  32711. persistent: _ctx.persistent,
  32712. onShow: _ctx.handleMenuEnter
  32713. }, {
  32714. default: vue.withCtx(() => [
  32715. vue.createElementVNode("div", {
  32716. class: "select-trigger",
  32717. onMouseenter: _cache[20] || (_cache[20] = ($event) => _ctx.inputHovering = true),
  32718. onMouseleave: _cache[21] || (_cache[21] = ($event) => _ctx.inputHovering = false)
  32719. }, [
  32720. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", {
  32721. key: 0,
  32722. ref: "tags",
  32723. class: vue.normalizeClass(_ctx.nsSelect.e("tags")),
  32724. style: vue.normalizeStyle(_ctx.selectTagsStyle)
  32725. }, [
  32726. _ctx.collapseTags && _ctx.selected.length ? (vue.openBlock(), vue.createElementBlock("span", {
  32727. key: 0,
  32728. class: vue.normalizeClass([
  32729. _ctx.nsSelect.b("tags-wrapper"),
  32730. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  32731. ])
  32732. }, [
  32733. vue.createVNode(_component_el_tag, {
  32734. closable: !_ctx.selectDisabled && !_ctx.selected[0].isDisabled,
  32735. size: _ctx.collapseTagSize,
  32736. hit: _ctx.selected[0].hitState,
  32737. type: _ctx.tagType,
  32738. "disable-transitions": "",
  32739. onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.selected[0]))
  32740. }, {
  32741. default: vue.withCtx(() => [
  32742. vue.createElementVNode("span", {
  32743. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")),
  32744. style: vue.normalizeStyle(_ctx.tagTextStyle)
  32745. }, vue.toDisplayString(_ctx.selected[0].currentLabel), 7)
  32746. ]),
  32747. _: 1
  32748. }, 8, ["closable", "size", "hit", "type"]),
  32749. _ctx.selected.length > 1 ? (vue.openBlock(), vue.createBlock(_component_el_tag, {
  32750. key: 0,
  32751. closable: false,
  32752. size: _ctx.collapseTagSize,
  32753. type: _ctx.tagType,
  32754. "disable-transitions": ""
  32755. }, {
  32756. default: vue.withCtx(() => [
  32757. _ctx.collapseTagsTooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  32758. key: 0,
  32759. disabled: _ctx.dropMenuVisible,
  32760. "fallback-placements": ["bottom", "top", "right", "left"],
  32761. effect: _ctx.effect,
  32762. placement: "bottom",
  32763. teleported: _ctx.teleported
  32764. }, {
  32765. default: vue.withCtx(() => [
  32766. vue.createElementVNode("span", {
  32767. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  32768. }, "+ " + vue.toDisplayString(_ctx.selected.length - 1), 3)
  32769. ]),
  32770. content: vue.withCtx(() => [
  32771. vue.createElementVNode("div", {
  32772. class: vue.normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  32773. }, [
  32774. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.selected.slice(1), (item, idx) => {
  32775. return vue.openBlock(), vue.createElementBlock("div", {
  32776. key: idx,
  32777. class: vue.normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  32778. }, [
  32779. (vue.openBlock(), vue.createBlock(_component_el_tag, {
  32780. key: _ctx.getValueKey(item),
  32781. class: "in-tooltip",
  32782. closable: !_ctx.selectDisabled && !item.isDisabled,
  32783. size: _ctx.collapseTagSize,
  32784. hit: item.hitState,
  32785. type: _ctx.tagType,
  32786. "disable-transitions": "",
  32787. style: { margin: "2px" },
  32788. onClose: ($event) => _ctx.deleteTag($event, item)
  32789. }, {
  32790. default: vue.withCtx(() => [
  32791. vue.createElementVNode("span", {
  32792. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")),
  32793. style: vue.normalizeStyle({
  32794. maxWidth: _ctx.inputWidth - 75 + "px"
  32795. })
  32796. }, vue.toDisplayString(item.currentLabel), 7)
  32797. ]),
  32798. _: 2
  32799. }, 1032, ["closable", "size", "hit", "type", "onClose"]))
  32800. ], 2);
  32801. }), 128))
  32802. ], 2)
  32803. ]),
  32804. _: 1
  32805. }, 8, ["disabled", "effect", "teleported"])) : (vue.openBlock(), vue.createElementBlock("span", {
  32806. key: 1,
  32807. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  32808. }, "+ " + vue.toDisplayString(_ctx.selected.length - 1), 3))
  32809. ]),
  32810. _: 1
  32811. }, 8, ["size", "type"])) : vue.createCommentVNode("v-if", true)
  32812. ], 2)) : vue.createCommentVNode("v-if", true),
  32813. vue.createCommentVNode(" <div> "),
  32814. !_ctx.collapseTags ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  32815. key: 1,
  32816. onAfterLeave: _ctx.resetInputHeight
  32817. }, {
  32818. default: vue.withCtx(() => [
  32819. vue.createElementVNode("span", {
  32820. class: vue.normalizeClass([
  32821. _ctx.nsSelect.b("tags-wrapper"),
  32822. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  32823. ])
  32824. }, [
  32825. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.selected, (item) => {
  32826. return vue.openBlock(), vue.createBlock(_component_el_tag, {
  32827. key: _ctx.getValueKey(item),
  32828. closable: !_ctx.selectDisabled && !item.isDisabled,
  32829. size: _ctx.collapseTagSize,
  32830. hit: item.hitState,
  32831. type: _ctx.tagType,
  32832. "disable-transitions": "",
  32833. onClose: ($event) => _ctx.deleteTag($event, item)
  32834. }, {
  32835. default: vue.withCtx(() => [
  32836. vue.createElementVNode("span", {
  32837. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")),
  32838. style: vue.normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  32839. }, vue.toDisplayString(item.currentLabel), 7)
  32840. ]),
  32841. _: 2
  32842. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  32843. }), 128))
  32844. ], 2)
  32845. ]),
  32846. _: 1
  32847. }, 8, ["onAfterLeave"])) : vue.createCommentVNode("v-if", true),
  32848. vue.createCommentVNode(" </div> "),
  32849. _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  32850. key: 2,
  32851. ref: "input",
  32852. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.query = $event),
  32853. type: "text",
  32854. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  32855. disabled: _ctx.selectDisabled,
  32856. autocomplete: _ctx.autocomplete,
  32857. style: vue.normalizeStyle({
  32858. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  32859. flexGrow: 1,
  32860. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  32861. maxWidth: `${_ctx.inputWidth - 42}px`
  32862. }),
  32863. onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  32864. onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  32865. onKeyup: _cache[4] || (_cache[4] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  32866. onKeydown: [
  32867. _cache[5] || (_cache[5] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  32868. _cache[6] || (_cache[6] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  32869. _cache[7] || (_cache[7] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  32870. _cache[8] || (_cache[8] = vue.withKeys((...args) => _ctx.handleKeydownEscape && _ctx.handleKeydownEscape(...args), ["esc"])),
  32871. _cache[9] || (_cache[9] = vue.withKeys(vue.withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  32872. _cache[10] || (_cache[10] = vue.withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  32873. _cache[11] || (_cache[11] = vue.withKeys(($event) => _ctx.visible = false, ["tab"]))
  32874. ],
  32875. onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  32876. onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  32877. onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  32878. onInput: _cache[15] || (_cache[15] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  32879. }, null, 46, _hoisted_1$n)), [
  32880. [vue.vModelText, _ctx.query]
  32881. ]) : vue.createCommentVNode("v-if", true)
  32882. ], 6)) : vue.createCommentVNode("v-if", true),
  32883. vue.createVNode(_component_el_input, {
  32884. id: _ctx.id,
  32885. ref: "reference",
  32886. modelValue: _ctx.selectedLabel,
  32887. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.selectedLabel = $event),
  32888. type: "text",
  32889. placeholder: _ctx.currentPlaceholder,
  32890. name: _ctx.name,
  32891. autocomplete: _ctx.autocomplete,
  32892. size: _ctx.selectSize,
  32893. disabled: _ctx.selectDisabled,
  32894. readonly: _ctx.readonly,
  32895. "validate-event": false,
  32896. class: vue.normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  32897. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  32898. onFocus: _ctx.handleFocus,
  32899. onBlur: _ctx.handleBlur,
  32900. onInput: _ctx.debouncedOnInputChange,
  32901. onPaste: _ctx.debouncedOnInputChange,
  32902. onCompositionstart: _ctx.handleComposition,
  32903. onCompositionupdate: _ctx.handleComposition,
  32904. onCompositionend: _ctx.handleComposition,
  32905. onKeydown: [
  32906. _cache[17] || (_cache[17] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  32907. _cache[18] || (_cache[18] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  32908. vue.withKeys(vue.withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  32909. vue.withKeys(_ctx.handleKeydownEscape, ["esc"]),
  32910. _cache[19] || (_cache[19] = vue.withKeys(($event) => _ctx.visible = false, ["tab"]))
  32911. ]
  32912. }, vue.createSlots({
  32913. suffix: vue.withCtx(() => [
  32914. _ctx.iconComponent && !_ctx.showClose ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  32915. key: 0,
  32916. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  32917. }, {
  32918. default: vue.withCtx(() => [
  32919. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  32920. ]),
  32921. _: 1
  32922. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  32923. _ctx.showClose && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  32924. key: 1,
  32925. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  32926. onClick: _ctx.handleClearClick
  32927. }, {
  32928. default: vue.withCtx(() => [
  32929. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  32930. ]),
  32931. _: 1
  32932. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  32933. ]),
  32934. _: 2
  32935. }, [
  32936. _ctx.$slots.prefix ? {
  32937. name: "prefix",
  32938. fn: vue.withCtx(() => [
  32939. vue.createElementVNode("div", _hoisted_2$f, [
  32940. vue.renderSlot(_ctx.$slots, "prefix")
  32941. ])
  32942. ])
  32943. } : void 0
  32944. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  32945. ], 32)
  32946. ]),
  32947. content: vue.withCtx(() => [
  32948. vue.createVNode(_component_el_select_menu, null, {
  32949. default: vue.withCtx(() => [
  32950. vue.withDirectives(vue.createVNode(_component_el_scrollbar, {
  32951. ref: "scrollbar",
  32952. tag: "ul",
  32953. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  32954. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  32955. class: vue.normalizeClass([
  32956. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  32957. ])
  32958. }, {
  32959. default: vue.withCtx(() => [
  32960. _ctx.showNewOption ? (vue.openBlock(), vue.createBlock(_component_el_option, {
  32961. key: 0,
  32962. value: _ctx.query,
  32963. created: true
  32964. }, null, 8, ["value"])) : vue.createCommentVNode("v-if", true),
  32965. vue.renderSlot(_ctx.$slots, "default")
  32966. ]),
  32967. _: 3
  32968. }, 8, ["wrap-class", "view-class", "class"]), [
  32969. [vue.vShow, _ctx.options.size > 0 && !_ctx.loading]
  32970. ]),
  32971. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  32972. _ctx.$slots.empty ? vue.renderSlot(_ctx.$slots, "empty", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", {
  32973. key: 1,
  32974. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  32975. }, vue.toDisplayString(_ctx.emptyText), 3))
  32976. ], 64)) : vue.createCommentVNode("v-if", true)
  32977. ]),
  32978. _: 3
  32979. })
  32980. ]),
  32981. _: 3
  32982. }, 8, ["visible", "placement", "teleported", "popper-class", "effect", "transition", "persistent", "onShow"])
  32983. ], 34)), [
  32984. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  32985. ]);
  32986. }
  32987. var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$9], ["__file", "select.vue"]]);
  32988. const _sfc_main$L = vue.defineComponent({
  32989. name: "ElOptionGroup",
  32990. componentName: "ElOptionGroup",
  32991. props: {
  32992. label: String,
  32993. disabled: {
  32994. type: Boolean,
  32995. default: false
  32996. }
  32997. },
  32998. setup(props) {
  32999. const ns = useNamespace("select");
  33000. const visible = vue.ref(true);
  33001. const instance = vue.getCurrentInstance();
  33002. const children = vue.ref([]);
  33003. vue.provide(selectGroupKey, vue.reactive({
  33004. ...vue.toRefs(props)
  33005. }));
  33006. const select = vue.inject(selectKey);
  33007. vue.onMounted(() => {
  33008. children.value = flattedChildren(instance.subTree);
  33009. });
  33010. const flattedChildren = (node) => {
  33011. const children2 = [];
  33012. if (Array.isArray(node.children)) {
  33013. node.children.forEach((child) => {
  33014. var _a;
  33015. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  33016. children2.push(child.component.proxy);
  33017. } else if ((_a = child.children) == null ? void 0 : _a.length) {
  33018. children2.push(...flattedChildren(child));
  33019. }
  33020. });
  33021. }
  33022. return children2;
  33023. };
  33024. const { groupQueryChange } = vue.toRaw(select);
  33025. vue.watch(groupQueryChange, () => {
  33026. visible.value = children.value.some((option) => option.visible === true);
  33027. }, { flush: "post" });
  33028. return {
  33029. visible,
  33030. ns
  33031. };
  33032. }
  33033. });
  33034. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  33035. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("ul", {
  33036. class: vue.normalizeClass(_ctx.ns.be("group", "wrap"))
  33037. }, [
  33038. vue.createElementVNode("li", {
  33039. class: vue.normalizeClass(_ctx.ns.be("group", "title"))
  33040. }, vue.toDisplayString(_ctx.label), 3),
  33041. vue.createElementVNode("li", null, [
  33042. vue.createElementVNode("ul", {
  33043. class: vue.normalizeClass(_ctx.ns.b("group"))
  33044. }, [
  33045. vue.renderSlot(_ctx.$slots, "default")
  33046. ], 2)
  33047. ])
  33048. ], 2)), [
  33049. [vue.vShow, _ctx.visible]
  33050. ]);
  33051. }
  33052. var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$8], ["__file", "option-group.vue"]]);
  33053. const ElSelect = withInstall(Select$1, {
  33054. Option,
  33055. OptionGroup
  33056. });
  33057. const ElOption = withNoopInstall(Option);
  33058. const ElOptionGroup = withNoopInstall(OptionGroup);
  33059. const usePagination = () => vue.inject(elPaginationKey, {});
  33060. const paginationSizesProps = buildProps({
  33061. pageSize: {
  33062. type: Number,
  33063. required: true
  33064. },
  33065. pageSizes: {
  33066. type: definePropType(Array),
  33067. default: () => mutable([10, 20, 30, 40, 50, 100])
  33068. },
  33069. popperClass: {
  33070. type: String
  33071. },
  33072. disabled: Boolean,
  33073. size: {
  33074. type: String,
  33075. values: componentSizes
  33076. }
  33077. });
  33078. const __default__$A = vue.defineComponent({
  33079. name: "ElPaginationSizes"
  33080. });
  33081. const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
  33082. ...__default__$A,
  33083. props: paginationSizesProps,
  33084. emits: ["page-size-change"],
  33085. setup(__props, { emit }) {
  33086. const props = __props;
  33087. const { t } = useLocale();
  33088. const ns = useNamespace("pagination");
  33089. const pagination = usePagination();
  33090. const innerPageSize = vue.ref(props.pageSize);
  33091. vue.watch(() => props.pageSizes, (newVal, oldVal) => {
  33092. if (isEqual$1(newVal, oldVal))
  33093. return;
  33094. if (Array.isArray(newVal)) {
  33095. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  33096. emit("page-size-change", pageSize);
  33097. }
  33098. });
  33099. vue.watch(() => props.pageSize, (newVal) => {
  33100. innerPageSize.value = newVal;
  33101. });
  33102. const innerPageSizes = vue.computed(() => props.pageSizes);
  33103. function handleChange(val) {
  33104. var _a;
  33105. if (val !== innerPageSize.value) {
  33106. innerPageSize.value = val;
  33107. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  33108. }
  33109. }
  33110. return (_ctx, _cache) => {
  33111. return vue.openBlock(), vue.createElementBlock("span", {
  33112. class: vue.normalizeClass(vue.unref(ns).e("sizes"))
  33113. }, [
  33114. vue.createVNode(vue.unref(ElSelect), {
  33115. "model-value": innerPageSize.value,
  33116. disabled: _ctx.disabled,
  33117. "popper-class": _ctx.popperClass,
  33118. size: _ctx.size,
  33119. "validate-event": false,
  33120. onChange: handleChange
  33121. }, {
  33122. default: vue.withCtx(() => [
  33123. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(innerPageSizes), (item) => {
  33124. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  33125. key: item,
  33126. value: item,
  33127. label: item + vue.unref(t)("el.pagination.pagesize")
  33128. }, null, 8, ["value", "label"]);
  33129. }), 128))
  33130. ]),
  33131. _: 1
  33132. }, 8, ["model-value", "disabled", "popper-class", "size"])
  33133. ], 2);
  33134. };
  33135. }
  33136. });
  33137. var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__file", "sizes.vue"]]);
  33138. const paginationJumperProps = buildProps({
  33139. size: {
  33140. type: String,
  33141. values: componentSizes
  33142. }
  33143. });
  33144. const _hoisted_1$m = ["disabled"];
  33145. const __default__$z = vue.defineComponent({
  33146. name: "ElPaginationJumper"
  33147. });
  33148. const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
  33149. ...__default__$z,
  33150. props: paginationJumperProps,
  33151. setup(__props) {
  33152. const { t } = useLocale();
  33153. const ns = useNamespace("pagination");
  33154. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  33155. const userInput = vue.ref();
  33156. const innerValue = vue.computed(() => {
  33157. var _a;
  33158. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  33159. });
  33160. function handleInput(val) {
  33161. userInput.value = +val;
  33162. }
  33163. function handleChange(val) {
  33164. val = Math.trunc(+val);
  33165. changeEvent == null ? void 0 : changeEvent(+val);
  33166. userInput.value = void 0;
  33167. }
  33168. return (_ctx, _cache) => {
  33169. return vue.openBlock(), vue.createElementBlock("span", {
  33170. class: vue.normalizeClass(vue.unref(ns).e("jump")),
  33171. disabled: vue.unref(disabled)
  33172. }, [
  33173. vue.createElementVNode("span", {
  33174. class: vue.normalizeClass([vue.unref(ns).e("goto")])
  33175. }, vue.toDisplayString(vue.unref(t)("el.pagination.goto")), 3),
  33176. vue.createVNode(vue.unref(ElInput), {
  33177. size: _ctx.size,
  33178. class: vue.normalizeClass([vue.unref(ns).e("editor"), vue.unref(ns).is("in-pagination")]),
  33179. min: 1,
  33180. max: vue.unref(pageCount),
  33181. disabled: vue.unref(disabled),
  33182. "model-value": vue.unref(innerValue),
  33183. "validate-event": false,
  33184. type: "number",
  33185. "onUpdate:modelValue": handleInput,
  33186. onChange: handleChange
  33187. }, null, 8, ["size", "class", "max", "disabled", "model-value"]),
  33188. vue.createElementVNode("span", {
  33189. class: vue.normalizeClass([vue.unref(ns).e("classifier")])
  33190. }, vue.toDisplayString(vue.unref(t)("el.pagination.pageClassifier")), 3)
  33191. ], 10, _hoisted_1$m);
  33192. };
  33193. }
  33194. });
  33195. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__file", "jumper.vue"]]);
  33196. const paginationTotalProps = buildProps({
  33197. total: {
  33198. type: Number,
  33199. default: 1e3
  33200. }
  33201. });
  33202. const _hoisted_1$l = ["disabled"];
  33203. const __default__$y = vue.defineComponent({
  33204. name: "ElPaginationTotal"
  33205. });
  33206. const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
  33207. ...__default__$y,
  33208. props: paginationTotalProps,
  33209. setup(__props) {
  33210. const { t } = useLocale();
  33211. const ns = useNamespace("pagination");
  33212. const { disabled } = usePagination();
  33213. return (_ctx, _cache) => {
  33214. return vue.openBlock(), vue.createElementBlock("span", {
  33215. class: vue.normalizeClass(vue.unref(ns).e("total")),
  33216. disabled: vue.unref(disabled)
  33217. }, vue.toDisplayString(vue.unref(t)("el.pagination.total", {
  33218. total: _ctx.total
  33219. })), 11, _hoisted_1$l);
  33220. };
  33221. }
  33222. });
  33223. var Total = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "total.vue"]]);
  33224. const paginationPagerProps = buildProps({
  33225. currentPage: {
  33226. type: Number,
  33227. default: 1
  33228. },
  33229. pageCount: {
  33230. type: Number,
  33231. required: true
  33232. },
  33233. pagerCount: {
  33234. type: Number,
  33235. default: 7
  33236. },
  33237. disabled: Boolean
  33238. });
  33239. const _hoisted_1$k = ["onKeyup"];
  33240. const _hoisted_2$e = ["aria-current", "tabindex"];
  33241. const _hoisted_3$7 = ["tabindex"];
  33242. const _hoisted_4$5 = ["aria-current", "tabindex"];
  33243. const _hoisted_5$4 = ["tabindex"];
  33244. const _hoisted_6 = ["aria-current", "tabindex"];
  33245. const __default__$x = vue.defineComponent({
  33246. name: "ElPaginationPager"
  33247. });
  33248. const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
  33249. ...__default__$x,
  33250. props: paginationPagerProps,
  33251. emits: ["change"],
  33252. setup(__props, { emit }) {
  33253. const props = __props;
  33254. const nsPager = useNamespace("pager");
  33255. const nsIcon = useNamespace("icon");
  33256. const showPrevMore = vue.ref(false);
  33257. const showNextMore = vue.ref(false);
  33258. const quickPrevHover = vue.ref(false);
  33259. const quickNextHover = vue.ref(false);
  33260. const quickPrevFocus = vue.ref(false);
  33261. const quickNextFocus = vue.ref(false);
  33262. const pagers = vue.computed(() => {
  33263. const pagerCount = props.pagerCount;
  33264. const halfPagerCount = (pagerCount - 1) / 2;
  33265. const currentPage = Number(props.currentPage);
  33266. const pageCount = Number(props.pageCount);
  33267. let showPrevMore2 = false;
  33268. let showNextMore2 = false;
  33269. if (pageCount > pagerCount) {
  33270. if (currentPage > pagerCount - halfPagerCount) {
  33271. showPrevMore2 = true;
  33272. }
  33273. if (currentPage < pageCount - halfPagerCount) {
  33274. showNextMore2 = true;
  33275. }
  33276. }
  33277. const array = [];
  33278. if (showPrevMore2 && !showNextMore2) {
  33279. const startPage = pageCount - (pagerCount - 2);
  33280. for (let i = startPage; i < pageCount; i++) {
  33281. array.push(i);
  33282. }
  33283. } else if (!showPrevMore2 && showNextMore2) {
  33284. for (let i = 2; i < pagerCount; i++) {
  33285. array.push(i);
  33286. }
  33287. } else if (showPrevMore2 && showNextMore2) {
  33288. const offset = Math.floor(pagerCount / 2) - 1;
  33289. for (let i = currentPage - offset; i <= currentPage + offset; i++) {
  33290. array.push(i);
  33291. }
  33292. } else {
  33293. for (let i = 2; i < pageCount; i++) {
  33294. array.push(i);
  33295. }
  33296. }
  33297. return array;
  33298. });
  33299. const tabindex = vue.computed(() => props.disabled ? -1 : 0);
  33300. vue.watchEffect(() => {
  33301. const halfPagerCount = (props.pagerCount - 1) / 2;
  33302. showPrevMore.value = false;
  33303. showNextMore.value = false;
  33304. if (props.pageCount > props.pagerCount) {
  33305. if (props.currentPage > props.pagerCount - halfPagerCount) {
  33306. showPrevMore.value = true;
  33307. }
  33308. if (props.currentPage < props.pageCount - halfPagerCount) {
  33309. showNextMore.value = true;
  33310. }
  33311. }
  33312. });
  33313. function onMouseEnter(forward = false) {
  33314. if (props.disabled)
  33315. return;
  33316. if (forward) {
  33317. quickPrevHover.value = true;
  33318. } else {
  33319. quickNextHover.value = true;
  33320. }
  33321. }
  33322. function onFocus(forward = false) {
  33323. if (forward) {
  33324. quickPrevFocus.value = true;
  33325. } else {
  33326. quickNextFocus.value = true;
  33327. }
  33328. }
  33329. function onEnter(e) {
  33330. const target = e.target;
  33331. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  33332. const newPage = Number(target.textContent);
  33333. if (newPage !== props.currentPage) {
  33334. emit("change", newPage);
  33335. }
  33336. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  33337. onPagerClick(e);
  33338. }
  33339. }
  33340. function onPagerClick(event) {
  33341. const target = event.target;
  33342. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  33343. return;
  33344. }
  33345. let newPage = Number(target.textContent);
  33346. const pageCount = props.pageCount;
  33347. const currentPage = props.currentPage;
  33348. const pagerCountOffset = props.pagerCount - 2;
  33349. if (target.className.includes("more")) {
  33350. if (target.className.includes("quickprev")) {
  33351. newPage = currentPage - pagerCountOffset;
  33352. } else if (target.className.includes("quicknext")) {
  33353. newPage = currentPage + pagerCountOffset;
  33354. }
  33355. }
  33356. if (!Number.isNaN(+newPage)) {
  33357. if (newPage < 1) {
  33358. newPage = 1;
  33359. }
  33360. if (newPage > pageCount) {
  33361. newPage = pageCount;
  33362. }
  33363. }
  33364. if (newPage !== currentPage) {
  33365. emit("change", newPage);
  33366. }
  33367. }
  33368. return (_ctx, _cache) => {
  33369. return vue.openBlock(), vue.createElementBlock("ul", {
  33370. class: vue.normalizeClass(vue.unref(nsPager).b()),
  33371. onClick: onPagerClick,
  33372. onKeyup: vue.withKeys(onEnter, ["enter"])
  33373. }, [
  33374. _ctx.pageCount > 0 ? (vue.openBlock(), vue.createElementBlock("li", {
  33375. key: 0,
  33376. class: vue.normalizeClass([[
  33377. vue.unref(nsPager).is("active", _ctx.currentPage === 1),
  33378. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33379. ], "number"]),
  33380. "aria-current": _ctx.currentPage === 1,
  33381. tabindex: vue.unref(tabindex)
  33382. }, " 1 ", 10, _hoisted_2$e)) : vue.createCommentVNode("v-if", true),
  33383. showPrevMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  33384. key: 1,
  33385. class: vue.normalizeClass([
  33386. "more",
  33387. "btn-quickprev",
  33388. vue.unref(nsIcon).b(),
  33389. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33390. ]),
  33391. tabindex: vue.unref(tabindex),
  33392. onMouseenter: _cache[0] || (_cache[0] = ($event) => onMouseEnter(true)),
  33393. onMouseleave: _cache[1] || (_cache[1] = ($event) => quickPrevHover.value = false),
  33394. onFocus: _cache[2] || (_cache[2] = ($event) => onFocus(true)),
  33395. onBlur: _cache[3] || (_cache[3] = ($event) => quickPrevFocus.value = false)
  33396. }, [
  33397. (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 }))
  33398. ], 42, _hoisted_3$7)) : vue.createCommentVNode("v-if", true),
  33399. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pagers), (pager) => {
  33400. return vue.openBlock(), vue.createElementBlock("li", {
  33401. key: pager,
  33402. class: vue.normalizeClass([[
  33403. vue.unref(nsPager).is("active", _ctx.currentPage === pager),
  33404. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33405. ], "number"]),
  33406. "aria-current": _ctx.currentPage === pager,
  33407. tabindex: vue.unref(tabindex)
  33408. }, vue.toDisplayString(pager), 11, _hoisted_4$5);
  33409. }), 128)),
  33410. showNextMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  33411. key: 2,
  33412. class: vue.normalizeClass([
  33413. "more",
  33414. "btn-quicknext",
  33415. vue.unref(nsIcon).b(),
  33416. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33417. ]),
  33418. tabindex: vue.unref(tabindex),
  33419. onMouseenter: _cache[4] || (_cache[4] = ($event) => onMouseEnter()),
  33420. onMouseleave: _cache[5] || (_cache[5] = ($event) => quickNextHover.value = false),
  33421. onFocus: _cache[6] || (_cache[6] = ($event) => onFocus()),
  33422. onBlur: _cache[7] || (_cache[7] = ($event) => quickNextFocus.value = false)
  33423. }, [
  33424. (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 }))
  33425. ], 42, _hoisted_5$4)) : vue.createCommentVNode("v-if", true),
  33426. _ctx.pageCount > 1 ? (vue.openBlock(), vue.createElementBlock("li", {
  33427. key: 3,
  33428. class: vue.normalizeClass([[
  33429. vue.unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  33430. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33431. ], "number"]),
  33432. "aria-current": _ctx.currentPage === _ctx.pageCount,
  33433. tabindex: vue.unref(tabindex)
  33434. }, vue.toDisplayString(_ctx.pageCount), 11, _hoisted_6)) : vue.createCommentVNode("v-if", true)
  33435. ], 42, _hoisted_1$k);
  33436. };
  33437. }
  33438. });
  33439. var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "pager.vue"]]);
  33440. const isAbsent = (v) => typeof v !== "number";
  33441. const paginationProps = buildProps({
  33442. total: Number,
  33443. pageSize: Number,
  33444. defaultPageSize: Number,
  33445. currentPage: Number,
  33446. defaultCurrentPage: Number,
  33447. pageCount: Number,
  33448. pagerCount: {
  33449. type: Number,
  33450. validator: (value) => {
  33451. return typeof value === "number" && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  33452. },
  33453. default: 7
  33454. },
  33455. layout: {
  33456. type: String,
  33457. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  33458. },
  33459. pageSizes: {
  33460. type: definePropType(Array),
  33461. default: () => mutable([10, 20, 30, 40, 50, 100])
  33462. },
  33463. popperClass: {
  33464. type: String,
  33465. default: ""
  33466. },
  33467. prevText: {
  33468. type: String,
  33469. default: ""
  33470. },
  33471. prevIcon: {
  33472. type: iconPropType,
  33473. default: () => arrow_left_default
  33474. },
  33475. nextText: {
  33476. type: String,
  33477. default: ""
  33478. },
  33479. nextIcon: {
  33480. type: iconPropType,
  33481. default: () => arrow_right_default
  33482. },
  33483. small: Boolean,
  33484. background: Boolean,
  33485. disabled: Boolean,
  33486. hideOnSinglePage: Boolean
  33487. });
  33488. const paginationEmits = {
  33489. "update:current-page": (val) => typeof val === "number",
  33490. "update:page-size": (val) => typeof val === "number",
  33491. "size-change": (val) => typeof val === "number",
  33492. "current-change": (val) => typeof val === "number",
  33493. "prev-click": (val) => typeof val === "number",
  33494. "next-click": (val) => typeof val === "number"
  33495. };
  33496. const componentName = "ElPagination";
  33497. var Pagination = vue.defineComponent({
  33498. name: componentName,
  33499. props: paginationProps,
  33500. emits: paginationEmits,
  33501. setup(props, { emit, slots }) {
  33502. const { t } = useLocale();
  33503. const ns = useNamespace("pagination");
  33504. const vnodeProps = vue.getCurrentInstance().vnode.props || {};
  33505. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  33506. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  33507. const assertValidUsage = vue.computed(() => {
  33508. if (isAbsent(props.total) && isAbsent(props.pageCount))
  33509. return false;
  33510. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  33511. return false;
  33512. if (props.layout.includes("sizes")) {
  33513. if (!isAbsent(props.pageCount)) {
  33514. if (!hasPageSizeListener)
  33515. return false;
  33516. } else if (!isAbsent(props.total)) {
  33517. if (!isAbsent(props.pageSize)) {
  33518. if (!hasPageSizeListener) {
  33519. return false;
  33520. }
  33521. }
  33522. }
  33523. }
  33524. return true;
  33525. });
  33526. const innerPageSize = vue.ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  33527. const innerCurrentPage = vue.ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  33528. const pageSizeBridge = vue.computed({
  33529. get() {
  33530. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  33531. },
  33532. set(v) {
  33533. if (isAbsent(props.pageSize)) {
  33534. innerPageSize.value = v;
  33535. }
  33536. if (hasPageSizeListener) {
  33537. emit("update:page-size", v);
  33538. emit("size-change", v);
  33539. }
  33540. }
  33541. });
  33542. const pageCountBridge = vue.computed(() => {
  33543. let pageCount = 0;
  33544. if (!isAbsent(props.pageCount)) {
  33545. pageCount = props.pageCount;
  33546. } else if (!isAbsent(props.total)) {
  33547. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  33548. }
  33549. return pageCount;
  33550. });
  33551. const currentPageBridge = vue.computed({
  33552. get() {
  33553. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  33554. },
  33555. set(v) {
  33556. let newCurrentPage = v;
  33557. if (v < 1) {
  33558. newCurrentPage = 1;
  33559. } else if (v > pageCountBridge.value) {
  33560. newCurrentPage = pageCountBridge.value;
  33561. }
  33562. if (isAbsent(props.currentPage)) {
  33563. innerCurrentPage.value = newCurrentPage;
  33564. }
  33565. if (hasCurrentPageListener) {
  33566. emit("update:current-page", newCurrentPage);
  33567. emit("current-change", newCurrentPage);
  33568. }
  33569. }
  33570. });
  33571. vue.watch(pageCountBridge, (val) => {
  33572. if (currentPageBridge.value > val)
  33573. currentPageBridge.value = val;
  33574. });
  33575. function handleCurrentChange(val) {
  33576. currentPageBridge.value = val;
  33577. }
  33578. function handleSizeChange(val) {
  33579. pageSizeBridge.value = val;
  33580. const newPageCount = pageCountBridge.value;
  33581. if (currentPageBridge.value > newPageCount) {
  33582. currentPageBridge.value = newPageCount;
  33583. }
  33584. }
  33585. function prev() {
  33586. if (props.disabled)
  33587. return;
  33588. currentPageBridge.value -= 1;
  33589. emit("prev-click", currentPageBridge.value);
  33590. }
  33591. function next() {
  33592. if (props.disabled)
  33593. return;
  33594. currentPageBridge.value += 1;
  33595. emit("next-click", currentPageBridge.value);
  33596. }
  33597. function addClass(element, cls) {
  33598. if (element) {
  33599. if (!element.props) {
  33600. element.props = {};
  33601. }
  33602. element.props.class = [element.props.class, cls].join(" ");
  33603. }
  33604. }
  33605. vue.provide(elPaginationKey, {
  33606. pageCount: pageCountBridge,
  33607. disabled: vue.computed(() => props.disabled),
  33608. currentPage: currentPageBridge,
  33609. changeEvent: handleCurrentChange,
  33610. handleSizeChange
  33611. });
  33612. return () => {
  33613. var _a, _b;
  33614. if (!assertValidUsage.value) {
  33615. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  33616. return null;
  33617. }
  33618. if (!props.layout)
  33619. return null;
  33620. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  33621. return null;
  33622. const rootChildren = [];
  33623. const rightWrapperChildren = [];
  33624. const rightWrapperRoot = vue.h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  33625. const TEMPLATE_MAP = {
  33626. prev: vue.h(Prev, {
  33627. disabled: props.disabled,
  33628. currentPage: currentPageBridge.value,
  33629. prevText: props.prevText,
  33630. prevIcon: props.prevIcon,
  33631. onClick: prev
  33632. }),
  33633. jumper: vue.h(Jumper, {
  33634. size: props.small ? "small" : "default"
  33635. }),
  33636. pager: vue.h(Pager, {
  33637. currentPage: currentPageBridge.value,
  33638. pageCount: pageCountBridge.value,
  33639. pagerCount: props.pagerCount,
  33640. onChange: handleCurrentChange,
  33641. disabled: props.disabled
  33642. }),
  33643. next: vue.h(Next, {
  33644. disabled: props.disabled,
  33645. currentPage: currentPageBridge.value,
  33646. pageCount: pageCountBridge.value,
  33647. nextText: props.nextText,
  33648. nextIcon: props.nextIcon,
  33649. onClick: next
  33650. }),
  33651. sizes: vue.h(Sizes, {
  33652. pageSize: pageSizeBridge.value,
  33653. pageSizes: props.pageSizes,
  33654. popperClass: props.popperClass,
  33655. disabled: props.disabled,
  33656. size: props.small ? "small" : "default"
  33657. }),
  33658. slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
  33659. total: vue.h(Total, { total: isAbsent(props.total) ? 0 : props.total })
  33660. };
  33661. const components = props.layout.split(",").map((item) => item.trim());
  33662. let haveRightWrapper = false;
  33663. components.forEach((c) => {
  33664. if (c === "->") {
  33665. haveRightWrapper = true;
  33666. return;
  33667. }
  33668. if (!haveRightWrapper) {
  33669. rootChildren.push(TEMPLATE_MAP[c]);
  33670. } else {
  33671. rightWrapperChildren.push(TEMPLATE_MAP[c]);
  33672. }
  33673. });
  33674. addClass(rootChildren[0], ns.is("first"));
  33675. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  33676. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  33677. addClass(rightWrapperChildren[0], ns.is("first"));
  33678. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  33679. rootChildren.push(rightWrapperRoot);
  33680. }
  33681. return vue.h("div", {
  33682. role: "pagination",
  33683. "aria-label": "pagination",
  33684. class: [
  33685. ns.b(),
  33686. ns.is("background", props.background),
  33687. {
  33688. [ns.m("small")]: props.small
  33689. }
  33690. ]
  33691. }, rootChildren);
  33692. };
  33693. }
  33694. });
  33695. const ElPagination = withInstall(Pagination);
  33696. const popconfirmProps = buildProps({
  33697. title: String,
  33698. confirmButtonText: String,
  33699. cancelButtonText: String,
  33700. confirmButtonType: {
  33701. type: String,
  33702. values: buttonTypes,
  33703. default: "primary"
  33704. },
  33705. cancelButtonType: {
  33706. type: String,
  33707. values: buttonTypes,
  33708. default: "text"
  33709. },
  33710. icon: {
  33711. type: iconPropType,
  33712. default: () => question_filled_default
  33713. },
  33714. iconColor: {
  33715. type: String,
  33716. default: "#f90"
  33717. },
  33718. hideIcon: {
  33719. type: Boolean,
  33720. default: false
  33721. },
  33722. hideAfter: {
  33723. type: Number,
  33724. default: 200
  33725. },
  33726. onConfirm: {
  33727. type: definePropType(Function)
  33728. },
  33729. onCancel: {
  33730. type: definePropType(Function)
  33731. },
  33732. teleported: useTooltipContentProps.teleported,
  33733. persistent: useTooltipContentProps.persistent,
  33734. width: {
  33735. type: [String, Number],
  33736. default: 150
  33737. }
  33738. });
  33739. const __default__$w = vue.defineComponent({
  33740. name: "ElPopconfirm"
  33741. });
  33742. const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
  33743. ...__default__$w,
  33744. props: popconfirmProps,
  33745. setup(__props) {
  33746. const props = __props;
  33747. const { t } = useLocale();
  33748. const ns = useNamespace("popconfirm");
  33749. const tooltipRef = vue.ref();
  33750. const hidePopper = () => {
  33751. var _a, _b;
  33752. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
  33753. };
  33754. const style = vue.computed(() => {
  33755. return {
  33756. width: addUnit(props.width)
  33757. };
  33758. });
  33759. const confirm = (e) => {
  33760. var _a;
  33761. (_a = props.onConfirm) == null ? void 0 : _a.call(props, e);
  33762. hidePopper();
  33763. };
  33764. const cancel = (e) => {
  33765. var _a;
  33766. (_a = props.onCancel) == null ? void 0 : _a.call(props, e);
  33767. hidePopper();
  33768. };
  33769. const finalConfirmButtonText = vue.computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  33770. const finalCancelButtonText = vue.computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  33771. return (_ctx, _cache) => {
  33772. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  33773. ref_key: "tooltipRef",
  33774. ref: tooltipRef,
  33775. trigger: "click",
  33776. effect: "light"
  33777. }, _ctx.$attrs, {
  33778. "popper-class": `${vue.unref(ns).namespace.value}-popover`,
  33779. "popper-style": vue.unref(style),
  33780. teleported: _ctx.teleported,
  33781. "fallback-placements": ["bottom", "top", "right", "left"],
  33782. "hide-after": _ctx.hideAfter,
  33783. persistent: _ctx.persistent
  33784. }), {
  33785. content: vue.withCtx(() => [
  33786. vue.createElementVNode("div", {
  33787. class: vue.normalizeClass(vue.unref(ns).b())
  33788. }, [
  33789. vue.createElementVNode("div", {
  33790. class: vue.normalizeClass(vue.unref(ns).e("main"))
  33791. }, [
  33792. !_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  33793. key: 0,
  33794. class: vue.normalizeClass(vue.unref(ns).e("icon")),
  33795. style: vue.normalizeStyle({ color: _ctx.iconColor })
  33796. }, {
  33797. default: vue.withCtx(() => [
  33798. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  33799. ]),
  33800. _: 1
  33801. }, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true),
  33802. vue.createTextVNode(" " + vue.toDisplayString(_ctx.title), 1)
  33803. ], 2),
  33804. vue.createElementVNode("div", {
  33805. class: vue.normalizeClass(vue.unref(ns).e("action"))
  33806. }, [
  33807. vue.createVNode(vue.unref(ElButton), {
  33808. size: "small",
  33809. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  33810. text: _ctx.cancelButtonType === "text",
  33811. onClick: cancel
  33812. }, {
  33813. default: vue.withCtx(() => [
  33814. vue.createTextVNode(vue.toDisplayString(vue.unref(finalCancelButtonText)), 1)
  33815. ]),
  33816. _: 1
  33817. }, 8, ["type", "text"]),
  33818. vue.createVNode(vue.unref(ElButton), {
  33819. size: "small",
  33820. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  33821. text: _ctx.confirmButtonType === "text",
  33822. onClick: confirm
  33823. }, {
  33824. default: vue.withCtx(() => [
  33825. vue.createTextVNode(vue.toDisplayString(vue.unref(finalConfirmButtonText)), 1)
  33826. ]),
  33827. _: 1
  33828. }, 8, ["type", "text"])
  33829. ], 2)
  33830. ], 2)
  33831. ]),
  33832. default: vue.withCtx(() => [
  33833. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  33834. ]),
  33835. _: 3
  33836. }, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  33837. };
  33838. }
  33839. });
  33840. var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "popconfirm.vue"]]);
  33841. const ElPopconfirm = withInstall(Popconfirm);
  33842. const popoverProps = buildProps({
  33843. trigger: useTooltipTriggerProps.trigger,
  33844. placement: dropdownProps.placement,
  33845. disabled: useTooltipTriggerProps.disabled,
  33846. visible: useTooltipContentProps.visible,
  33847. transition: useTooltipContentProps.transition,
  33848. popperOptions: dropdownProps.popperOptions,
  33849. tabindex: dropdownProps.tabindex,
  33850. content: useTooltipContentProps.content,
  33851. popperStyle: useTooltipContentProps.popperStyle,
  33852. popperClass: useTooltipContentProps.popperClass,
  33853. enterable: {
  33854. ...useTooltipContentProps.enterable,
  33855. default: true
  33856. },
  33857. effect: {
  33858. ...useTooltipContentProps.effect,
  33859. default: "light"
  33860. },
  33861. teleported: useTooltipContentProps.teleported,
  33862. title: String,
  33863. width: {
  33864. type: [String, Number],
  33865. default: 150
  33866. },
  33867. offset: {
  33868. type: Number,
  33869. default: void 0
  33870. },
  33871. showAfter: {
  33872. type: Number,
  33873. default: 0
  33874. },
  33875. hideAfter: {
  33876. type: Number,
  33877. default: 200
  33878. },
  33879. autoClose: {
  33880. type: Number,
  33881. default: 0
  33882. },
  33883. showArrow: {
  33884. type: Boolean,
  33885. default: true
  33886. },
  33887. persistent: {
  33888. type: Boolean,
  33889. default: true
  33890. },
  33891. "onUpdate:visible": {
  33892. type: Function
  33893. }
  33894. });
  33895. const popoverEmits = {
  33896. "update:visible": (value) => isBoolean(value),
  33897. "before-enter": () => true,
  33898. "before-leave": () => true,
  33899. "after-enter": () => true,
  33900. "after-leave": () => true
  33901. };
  33902. const updateEventKeyRaw = `onUpdate:visible`;
  33903. const __default__$v = vue.defineComponent({
  33904. name: "ElPopover"
  33905. });
  33906. const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
  33907. ...__default__$v,
  33908. props: popoverProps,
  33909. emits: popoverEmits,
  33910. setup(__props, { expose, emit }) {
  33911. const props = __props;
  33912. const onUpdateVisible = vue.computed(() => {
  33913. return props[updateEventKeyRaw];
  33914. });
  33915. const ns = useNamespace("popover");
  33916. const tooltipRef = vue.ref();
  33917. const popperRef = vue.computed(() => {
  33918. var _a;
  33919. return (_a = vue.unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  33920. });
  33921. const style = vue.computed(() => {
  33922. return [
  33923. {
  33924. width: addUnit(props.width)
  33925. },
  33926. props.popperStyle
  33927. ];
  33928. });
  33929. const kls = vue.computed(() => {
  33930. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  33931. });
  33932. const gpuAcceleration = vue.computed(() => {
  33933. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  33934. });
  33935. const hide = () => {
  33936. var _a;
  33937. (_a = tooltipRef.value) == null ? void 0 : _a.hide();
  33938. };
  33939. const beforeEnter = () => {
  33940. emit("before-enter");
  33941. };
  33942. const beforeLeave = () => {
  33943. emit("before-leave");
  33944. };
  33945. const afterEnter = () => {
  33946. emit("after-enter");
  33947. };
  33948. const afterLeave = () => {
  33949. emit("update:visible", false);
  33950. emit("after-leave");
  33951. };
  33952. expose({
  33953. popperRef,
  33954. hide
  33955. });
  33956. return (_ctx, _cache) => {
  33957. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  33958. ref_key: "tooltipRef",
  33959. ref: tooltipRef
  33960. }, _ctx.$attrs, {
  33961. trigger: _ctx.trigger,
  33962. placement: _ctx.placement,
  33963. disabled: _ctx.disabled,
  33964. visible: _ctx.visible,
  33965. transition: _ctx.transition,
  33966. "popper-options": _ctx.popperOptions,
  33967. tabindex: _ctx.tabindex,
  33968. content: _ctx.content,
  33969. offset: _ctx.offset,
  33970. "show-after": _ctx.showAfter,
  33971. "hide-after": _ctx.hideAfter,
  33972. "auto-close": _ctx.autoClose,
  33973. "show-arrow": _ctx.showArrow,
  33974. "aria-label": _ctx.title,
  33975. effect: _ctx.effect,
  33976. enterable: _ctx.enterable,
  33977. "popper-class": vue.unref(kls),
  33978. "popper-style": vue.unref(style),
  33979. teleported: _ctx.teleported,
  33980. persistent: _ctx.persistent,
  33981. "gpu-acceleration": vue.unref(gpuAcceleration),
  33982. "onUpdate:visible": vue.unref(onUpdateVisible),
  33983. onBeforeShow: beforeEnter,
  33984. onBeforeHide: beforeLeave,
  33985. onShow: afterEnter,
  33986. onHide: afterLeave
  33987. }), {
  33988. content: vue.withCtx(() => [
  33989. _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  33990. key: 0,
  33991. class: vue.normalizeClass(vue.unref(ns).e("title")),
  33992. role: "title"
  33993. }, vue.toDisplayString(_ctx.title), 3)) : vue.createCommentVNode("v-if", true),
  33994. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  33995. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  33996. ])
  33997. ]),
  33998. default: vue.withCtx(() => [
  33999. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  34000. ]),
  34001. _: 3
  34002. }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]);
  34003. };
  34004. }
  34005. });
  34006. var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "popover.vue"]]);
  34007. const attachEvents = (el, binding) => {
  34008. const popperComponent = binding.arg || binding.value;
  34009. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  34010. if (popover) {
  34011. popover.triggerRef = el;
  34012. }
  34013. };
  34014. var PopoverDirective = {
  34015. mounted(el, binding) {
  34016. attachEvents(el, binding);
  34017. },
  34018. updated(el, binding) {
  34019. attachEvents(el, binding);
  34020. }
  34021. };
  34022. const VPopover = "popover";
  34023. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  34024. const ElPopover = withInstall(Popover, {
  34025. directive: ElPopoverDirective
  34026. });
  34027. const progressProps = buildProps({
  34028. type: {
  34029. type: String,
  34030. default: "line",
  34031. values: ["line", "circle", "dashboard"]
  34032. },
  34033. percentage: {
  34034. type: Number,
  34035. default: 0,
  34036. validator: (val) => val >= 0 && val <= 100
  34037. },
  34038. status: {
  34039. type: String,
  34040. default: "",
  34041. values: ["", "success", "exception", "warning"]
  34042. },
  34043. indeterminate: {
  34044. type: Boolean,
  34045. default: false
  34046. },
  34047. duration: {
  34048. type: Number,
  34049. default: 3
  34050. },
  34051. strokeWidth: {
  34052. type: Number,
  34053. default: 6
  34054. },
  34055. strokeLinecap: {
  34056. type: definePropType(String),
  34057. default: "round"
  34058. },
  34059. textInside: {
  34060. type: Boolean,
  34061. default: false
  34062. },
  34063. width: {
  34064. type: Number,
  34065. default: 126
  34066. },
  34067. showText: {
  34068. type: Boolean,
  34069. default: true
  34070. },
  34071. color: {
  34072. type: definePropType([
  34073. String,
  34074. Array,
  34075. Function
  34076. ]),
  34077. default: ""
  34078. },
  34079. format: {
  34080. type: definePropType(Function),
  34081. default: (percentage) => `${percentage}%`
  34082. }
  34083. });
  34084. const _hoisted_1$j = ["aria-valuenow"];
  34085. const _hoisted_2$d = { viewBox: "0 0 100 100" };
  34086. const _hoisted_3$6 = ["d", "stroke", "stroke-width"];
  34087. const _hoisted_4$4 = ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"];
  34088. const _hoisted_5$3 = { key: 0 };
  34089. const __default__$u = vue.defineComponent({
  34090. name: "ElProgress"
  34091. });
  34092. const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
  34093. ...__default__$u,
  34094. props: progressProps,
  34095. setup(__props) {
  34096. const props = __props;
  34097. const STATUS_COLOR_MAP = {
  34098. success: "#13ce66",
  34099. exception: "#ff4949",
  34100. warning: "#e6a23c",
  34101. default: "#20a0ff"
  34102. };
  34103. const ns = useNamespace("progress");
  34104. const barStyle = vue.computed(() => ({
  34105. width: `${props.percentage}%`,
  34106. animationDuration: `${props.duration}s`,
  34107. backgroundColor: getCurrentColor(props.percentage)
  34108. }));
  34109. const relativeStrokeWidth = vue.computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  34110. const radius = vue.computed(() => {
  34111. if (["circle", "dashboard"].includes(props.type)) {
  34112. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  34113. }
  34114. return 0;
  34115. });
  34116. const trackPath = vue.computed(() => {
  34117. const r = radius.value;
  34118. const isDashboard = props.type === "dashboard";
  34119. return `
  34120. M 50 50
  34121. m 0 ${isDashboard ? "" : "-"}${r}
  34122. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  34123. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  34124. `;
  34125. });
  34126. const perimeter = vue.computed(() => 2 * Math.PI * radius.value);
  34127. const rate = vue.computed(() => props.type === "dashboard" ? 0.75 : 1);
  34128. const strokeDashoffset = vue.computed(() => {
  34129. const offset = -1 * perimeter.value * (1 - rate.value) / 2;
  34130. return `${offset}px`;
  34131. });
  34132. const trailPathStyle = vue.computed(() => ({
  34133. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  34134. strokeDashoffset: strokeDashoffset.value
  34135. }));
  34136. const circlePathStyle = vue.computed(() => ({
  34137. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  34138. strokeDashoffset: strokeDashoffset.value,
  34139. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  34140. }));
  34141. const stroke = vue.computed(() => {
  34142. let ret;
  34143. if (props.color) {
  34144. ret = getCurrentColor(props.percentage);
  34145. } else {
  34146. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  34147. }
  34148. return ret;
  34149. });
  34150. const statusIcon = vue.computed(() => {
  34151. if (props.status === "warning") {
  34152. return warning_filled_default;
  34153. }
  34154. if (props.type === "line") {
  34155. return props.status === "success" ? circle_check_default : circle_close_default;
  34156. } else {
  34157. return props.status === "success" ? check_default : close_default;
  34158. }
  34159. });
  34160. const progressTextSize = vue.computed(() => {
  34161. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  34162. });
  34163. const content = vue.computed(() => props.format(props.percentage));
  34164. function getColors(color) {
  34165. const span = 100 / color.length;
  34166. const seriesColors = color.map((seriesColor, index) => {
  34167. if (isString(seriesColor)) {
  34168. return {
  34169. color: seriesColor,
  34170. percentage: (index + 1) * span
  34171. };
  34172. }
  34173. return seriesColor;
  34174. });
  34175. return seriesColors.sort((a, b) => a.percentage - b.percentage);
  34176. }
  34177. const getCurrentColor = (percentage) => {
  34178. var _a;
  34179. const { color } = props;
  34180. if (isFunction(color)) {
  34181. return color(percentage);
  34182. } else if (isString(color)) {
  34183. return color;
  34184. } else {
  34185. const colors = getColors(color);
  34186. for (const color2 of colors) {
  34187. if (color2.percentage > percentage)
  34188. return color2.color;
  34189. }
  34190. return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
  34191. }
  34192. };
  34193. return (_ctx, _cache) => {
  34194. return vue.openBlock(), vue.createElementBlock("div", {
  34195. class: vue.normalizeClass([
  34196. vue.unref(ns).b(),
  34197. vue.unref(ns).m(_ctx.type),
  34198. vue.unref(ns).is(_ctx.status),
  34199. {
  34200. [vue.unref(ns).m("without-text")]: !_ctx.showText,
  34201. [vue.unref(ns).m("text-inside")]: _ctx.textInside
  34202. }
  34203. ]),
  34204. role: "progressbar",
  34205. "aria-valuenow": _ctx.percentage,
  34206. "aria-valuemin": "0",
  34207. "aria-valuemax": "100"
  34208. }, [
  34209. _ctx.type === "line" ? (vue.openBlock(), vue.createElementBlock("div", {
  34210. key: 0,
  34211. class: vue.normalizeClass(vue.unref(ns).b("bar"))
  34212. }, [
  34213. vue.createElementVNode("div", {
  34214. class: vue.normalizeClass(vue.unref(ns).be("bar", "outer")),
  34215. style: vue.normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  34216. }, [
  34217. vue.createElementVNode("div", {
  34218. class: vue.normalizeClass([
  34219. vue.unref(ns).be("bar", "inner"),
  34220. { [vue.unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }
  34221. ]),
  34222. style: vue.normalizeStyle(vue.unref(barStyle))
  34223. }, [
  34224. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  34225. key: 0,
  34226. class: vue.normalizeClass(vue.unref(ns).be("bar", "innerText"))
  34227. }, [
  34228. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  34229. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(content)), 1)
  34230. ])
  34231. ], 2)) : vue.createCommentVNode("v-if", true)
  34232. ], 6)
  34233. ], 6)
  34234. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  34235. key: 1,
  34236. class: vue.normalizeClass(vue.unref(ns).b("circle")),
  34237. style: vue.normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  34238. }, [
  34239. (vue.openBlock(), vue.createElementBlock("svg", _hoisted_2$d, [
  34240. vue.createElementVNode("path", {
  34241. class: vue.normalizeClass(vue.unref(ns).be("circle", "track")),
  34242. d: vue.unref(trackPath),
  34243. stroke: `var(${vue.unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  34244. "stroke-width": vue.unref(relativeStrokeWidth),
  34245. fill: "none",
  34246. style: vue.normalizeStyle(vue.unref(trailPathStyle))
  34247. }, null, 14, _hoisted_3$6),
  34248. vue.createElementVNode("path", {
  34249. class: vue.normalizeClass(vue.unref(ns).be("circle", "path")),
  34250. d: vue.unref(trackPath),
  34251. stroke: vue.unref(stroke),
  34252. fill: "none",
  34253. opacity: _ctx.percentage ? 1 : 0,
  34254. "stroke-linecap": _ctx.strokeLinecap,
  34255. "stroke-width": vue.unref(relativeStrokeWidth),
  34256. style: vue.normalizeStyle(vue.unref(circlePathStyle))
  34257. }, null, 14, _hoisted_4$4)
  34258. ]))
  34259. ], 6)),
  34260. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  34261. key: 2,
  34262. class: vue.normalizeClass(vue.unref(ns).e("text")),
  34263. style: vue.normalizeStyle({ fontSize: `${vue.unref(progressTextSize)}px` })
  34264. }, [
  34265. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  34266. !_ctx.status ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$3, vue.toDisplayString(vue.unref(content)), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  34267. default: vue.withCtx(() => [
  34268. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(statusIcon))))
  34269. ]),
  34270. _: 1
  34271. }))
  34272. ])
  34273. ], 6)) : vue.createCommentVNode("v-if", true)
  34274. ], 10, _hoisted_1$j);
  34275. };
  34276. }
  34277. });
  34278. var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "progress.vue"]]);
  34279. const ElProgress = withInstall(Progress);
  34280. const rateProps = buildProps({
  34281. modelValue: {
  34282. type: Number,
  34283. default: 0
  34284. },
  34285. id: {
  34286. type: String,
  34287. default: void 0
  34288. },
  34289. lowThreshold: {
  34290. type: Number,
  34291. default: 2
  34292. },
  34293. highThreshold: {
  34294. type: Number,
  34295. default: 4
  34296. },
  34297. max: {
  34298. type: Number,
  34299. default: 5
  34300. },
  34301. colors: {
  34302. type: definePropType([Array, Object]),
  34303. default: () => mutable(["", "", ""])
  34304. },
  34305. voidColor: {
  34306. type: String,
  34307. default: ""
  34308. },
  34309. disabledVoidColor: {
  34310. type: String,
  34311. default: ""
  34312. },
  34313. icons: {
  34314. type: definePropType([Array, Object]),
  34315. default: () => [star_filled_default, star_filled_default, star_filled_default]
  34316. },
  34317. voidIcon: {
  34318. type: iconPropType,
  34319. default: () => star_default
  34320. },
  34321. disabledVoidIcon: {
  34322. type: iconPropType,
  34323. default: () => star_filled_default
  34324. },
  34325. disabled: {
  34326. type: Boolean
  34327. },
  34328. allowHalf: {
  34329. type: Boolean
  34330. },
  34331. showText: {
  34332. type: Boolean
  34333. },
  34334. showScore: {
  34335. type: Boolean
  34336. },
  34337. textColor: {
  34338. type: String,
  34339. default: ""
  34340. },
  34341. texts: {
  34342. type: definePropType(Array),
  34343. default: () => mutable([
  34344. "Extremely bad",
  34345. "Disappointed",
  34346. "Fair",
  34347. "Satisfied",
  34348. "Surprise"
  34349. ])
  34350. },
  34351. scoreTemplate: {
  34352. type: String,
  34353. default: "{value}"
  34354. },
  34355. size: {
  34356. type: String,
  34357. validator: isValidComponentSize
  34358. },
  34359. label: {
  34360. type: String,
  34361. default: void 0
  34362. },
  34363. clearable: {
  34364. type: Boolean,
  34365. default: false
  34366. }
  34367. });
  34368. const rateEmits = {
  34369. [CHANGE_EVENT]: (value) => isNumber(value),
  34370. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  34371. };
  34372. const _hoisted_1$i = ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"];
  34373. const _hoisted_2$c = ["onMousemove", "onClick"];
  34374. const __default__$t = vue.defineComponent({
  34375. name: "ElRate"
  34376. });
  34377. const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
  34378. ...__default__$t,
  34379. props: rateProps,
  34380. emits: rateEmits,
  34381. setup(__props, { expose, emit }) {
  34382. const props = __props;
  34383. function getValueFromMap(value, map) {
  34384. const isExcludedObject = (val) => isObject$1(val);
  34385. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  34386. const val = map[key];
  34387. const excluded = isExcludedObject(val) ? val.excluded : false;
  34388. return excluded ? value < key : value <= key;
  34389. }).sort((a, b) => a - b);
  34390. const matchedValue = map[matchedKeys[0]];
  34391. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  34392. }
  34393. const formContext = vue.inject(formContextKey, void 0);
  34394. const formItemContext = vue.inject(formItemContextKey, void 0);
  34395. const rateSize = useSize();
  34396. const ns = useNamespace("rate");
  34397. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  34398. formItemContext
  34399. });
  34400. const currentValue = vue.ref(props.modelValue);
  34401. const hoverIndex = vue.ref(-1);
  34402. const pointerAtLeftHalf = vue.ref(true);
  34403. const rateClasses = vue.computed(() => [ns.b(), ns.m(rateSize.value)]);
  34404. const rateDisabled = vue.computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  34405. const rateStyles = vue.computed(() => {
  34406. return ns.cssVarBlock({
  34407. "void-color": props.voidColor,
  34408. "disabled-void-color": props.disabledVoidColor,
  34409. "fill-color": activeColor.value
  34410. });
  34411. });
  34412. const text = vue.computed(() => {
  34413. let result = "";
  34414. if (props.showScore) {
  34415. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  34416. } else if (props.showText) {
  34417. result = props.texts[Math.ceil(currentValue.value) - 1];
  34418. }
  34419. return result;
  34420. });
  34421. const valueDecimal = vue.computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  34422. const colorMap = vue.computed(() => isArray(props.colors) ? {
  34423. [props.lowThreshold]: props.colors[0],
  34424. [props.highThreshold]: { value: props.colors[1], excluded: true },
  34425. [props.max]: props.colors[2]
  34426. } : props.colors);
  34427. const activeColor = vue.computed(() => {
  34428. const color = getValueFromMap(currentValue.value, colorMap.value);
  34429. return isObject$1(color) ? "" : color;
  34430. });
  34431. const decimalStyle = vue.computed(() => {
  34432. let width = "";
  34433. if (rateDisabled.value) {
  34434. width = `${valueDecimal.value}%`;
  34435. } else if (props.allowHalf) {
  34436. width = "50%";
  34437. }
  34438. return {
  34439. color: activeColor.value,
  34440. width
  34441. };
  34442. });
  34443. const componentMap = vue.computed(() => {
  34444. let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons };
  34445. icons = vue.markRaw(icons);
  34446. return isArray(icons) ? {
  34447. [props.lowThreshold]: icons[0],
  34448. [props.highThreshold]: {
  34449. value: icons[1],
  34450. excluded: true
  34451. },
  34452. [props.max]: icons[2]
  34453. } : icons;
  34454. });
  34455. const decimalIconComponent = vue.computed(() => getValueFromMap(props.modelValue, componentMap.value));
  34456. const voidComponent = vue.computed(() => rateDisabled.value ? isString(props.disabledVoidIcon) ? props.disabledVoidIcon : vue.markRaw(props.disabledVoidIcon) : isString(props.voidIcon) ? props.voidIcon : vue.markRaw(props.voidIcon));
  34457. const activeComponent = vue.computed(() => getValueFromMap(currentValue.value, componentMap.value));
  34458. function showDecimalIcon(item) {
  34459. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  34460. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  34461. return showWhenDisabled || showWhenAllowHalf;
  34462. }
  34463. function emitValue(value) {
  34464. if (props.clearable && value === props.modelValue) {
  34465. value = 0;
  34466. }
  34467. emit(UPDATE_MODEL_EVENT, value);
  34468. if (props.modelValue !== value) {
  34469. emit("change", value);
  34470. }
  34471. }
  34472. function selectValue(value) {
  34473. if (rateDisabled.value) {
  34474. return;
  34475. }
  34476. if (props.allowHalf && pointerAtLeftHalf.value) {
  34477. emitValue(currentValue.value);
  34478. } else {
  34479. emitValue(value);
  34480. }
  34481. }
  34482. function handleKey(e) {
  34483. if (rateDisabled.value) {
  34484. return;
  34485. }
  34486. let _currentValue = currentValue.value;
  34487. const code = e.code;
  34488. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  34489. if (props.allowHalf) {
  34490. _currentValue += 0.5;
  34491. } else {
  34492. _currentValue += 1;
  34493. }
  34494. e.stopPropagation();
  34495. e.preventDefault();
  34496. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  34497. if (props.allowHalf) {
  34498. _currentValue -= 0.5;
  34499. } else {
  34500. _currentValue -= 1;
  34501. }
  34502. e.stopPropagation();
  34503. e.preventDefault();
  34504. }
  34505. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  34506. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  34507. emit(UPDATE_MODEL_EVENT, _currentValue);
  34508. emit("change", _currentValue);
  34509. return _currentValue;
  34510. }
  34511. function setCurrentValue(value, event) {
  34512. if (rateDisabled.value) {
  34513. return;
  34514. }
  34515. if (props.allowHalf) {
  34516. let target = event.target;
  34517. if (hasClass(target, ns.e("item"))) {
  34518. target = target.querySelector(`.${ns.e("icon")}`);
  34519. }
  34520. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  34521. target = target.parentNode;
  34522. }
  34523. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  34524. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  34525. } else {
  34526. currentValue.value = value;
  34527. }
  34528. hoverIndex.value = value;
  34529. }
  34530. function resetCurrentValue() {
  34531. if (rateDisabled.value) {
  34532. return;
  34533. }
  34534. if (props.allowHalf) {
  34535. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  34536. }
  34537. currentValue.value = props.modelValue;
  34538. hoverIndex.value = -1;
  34539. }
  34540. vue.watch(() => props.modelValue, (val) => {
  34541. currentValue.value = val;
  34542. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  34543. });
  34544. if (!props.modelValue) {
  34545. emit(UPDATE_MODEL_EVENT, 0);
  34546. }
  34547. expose({
  34548. setCurrentValue,
  34549. resetCurrentValue
  34550. });
  34551. return (_ctx, _cache) => {
  34552. var _a;
  34553. return vue.openBlock(), vue.createElementBlock("div", {
  34554. id: vue.unref(inputId),
  34555. class: vue.normalizeClass([vue.unref(rateClasses), vue.unref(ns).is("disabled", vue.unref(rateDisabled))]),
  34556. role: "slider",
  34557. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "rating" : void 0,
  34558. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
  34559. "aria-valuenow": currentValue.value,
  34560. "aria-valuetext": vue.unref(text) || void 0,
  34561. "aria-valuemin": "0",
  34562. "aria-valuemax": _ctx.max,
  34563. tabindex: "0",
  34564. style: vue.normalizeStyle(vue.unref(rateStyles)),
  34565. onKeydown: handleKey
  34566. }, [
  34567. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.max, (item, key) => {
  34568. return vue.openBlock(), vue.createElementBlock("span", {
  34569. key,
  34570. class: vue.normalizeClass(vue.unref(ns).e("item")),
  34571. onMousemove: ($event) => setCurrentValue(item, $event),
  34572. onMouseleave: resetCurrentValue,
  34573. onClick: ($event) => selectValue(item)
  34574. }, [
  34575. vue.createVNode(vue.unref(ElIcon), {
  34576. class: vue.normalizeClass([
  34577. vue.unref(ns).e("icon"),
  34578. { hover: hoverIndex.value === item },
  34579. vue.unref(ns).is("active", item <= currentValue.value)
  34580. ])
  34581. }, {
  34582. default: vue.withCtx(() => [
  34583. !showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  34584. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), null, null, 512)), [
  34585. [vue.vShow, item <= currentValue.value]
  34586. ]),
  34587. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), null, null, 512)), [
  34588. [vue.vShow, !(item <= currentValue.value)]
  34589. ])
  34590. ], 64)) : vue.createCommentVNode("v-if", true),
  34591. showDecimalIcon(item) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  34592. key: 1,
  34593. style: vue.normalizeStyle(vue.unref(decimalStyle)),
  34594. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("decimal")])
  34595. }, {
  34596. default: vue.withCtx(() => [
  34597. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(decimalIconComponent))))
  34598. ]),
  34599. _: 1
  34600. }, 8, ["style", "class"])) : vue.createCommentVNode("v-if", true)
  34601. ]),
  34602. _: 2
  34603. }, 1032, ["class"])
  34604. ], 42, _hoisted_2$c);
  34605. }), 128)),
  34606. _ctx.showText || _ctx.showScore ? (vue.openBlock(), vue.createElementBlock("span", {
  34607. key: 0,
  34608. class: vue.normalizeClass(vue.unref(ns).e("text"))
  34609. }, vue.toDisplayString(vue.unref(text)), 3)) : vue.createCommentVNode("v-if", true)
  34610. ], 46, _hoisted_1$i);
  34611. };
  34612. }
  34613. });
  34614. var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__file", "rate.vue"]]);
  34615. const ElRate = withInstall(Rate);
  34616. const IconMap = {
  34617. success: "icon-success",
  34618. warning: "icon-warning",
  34619. error: "icon-error",
  34620. info: "icon-info"
  34621. };
  34622. const IconComponentMap = {
  34623. [IconMap.success]: circle_check_filled_default,
  34624. [IconMap.warning]: warning_filled_default,
  34625. [IconMap.error]: circle_close_filled_default,
  34626. [IconMap.info]: info_filled_default
  34627. };
  34628. const resultProps = buildProps({
  34629. title: {
  34630. type: String,
  34631. default: ""
  34632. },
  34633. subTitle: {
  34634. type: String,
  34635. default: ""
  34636. },
  34637. icon: {
  34638. type: String,
  34639. values: ["success", "warning", "info", "error"],
  34640. default: "info"
  34641. }
  34642. });
  34643. const __default__$s = vue.defineComponent({
  34644. name: "ElResult"
  34645. });
  34646. const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
  34647. ...__default__$s,
  34648. props: resultProps,
  34649. setup(__props) {
  34650. const props = __props;
  34651. const ns = useNamespace("result");
  34652. const resultIcon = vue.computed(() => {
  34653. const icon = props.icon;
  34654. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  34655. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  34656. return {
  34657. class: iconClass,
  34658. component: iconComponent
  34659. };
  34660. });
  34661. return (_ctx, _cache) => {
  34662. return vue.openBlock(), vue.createElementBlock("div", {
  34663. class: vue.normalizeClass(vue.unref(ns).b())
  34664. }, [
  34665. vue.createElementVNode("div", {
  34666. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  34667. }, [
  34668. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  34669. vue.unref(resultIcon).component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(resultIcon).component), {
  34670. key: 0,
  34671. class: vue.normalizeClass(vue.unref(resultIcon).class)
  34672. }, null, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  34673. ])
  34674. ], 2),
  34675. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("div", {
  34676. key: 0,
  34677. class: vue.normalizeClass(vue.unref(ns).e("title"))
  34678. }, [
  34679. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  34680. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.title), 1)
  34681. ])
  34682. ], 2)) : vue.createCommentVNode("v-if", true),
  34683. _ctx.subTitle || _ctx.$slots["sub-title"] ? (vue.openBlock(), vue.createElementBlock("div", {
  34684. key: 1,
  34685. class: vue.normalizeClass(vue.unref(ns).e("subtitle"))
  34686. }, [
  34687. vue.renderSlot(_ctx.$slots, "sub-title", {}, () => [
  34688. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.subTitle), 1)
  34689. ])
  34690. ], 2)) : vue.createCommentVNode("v-if", true),
  34691. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  34692. key: 2,
  34693. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  34694. }, [
  34695. vue.renderSlot(_ctx.$slots, "extra")
  34696. ], 2)) : vue.createCommentVNode("v-if", true)
  34697. ], 2);
  34698. };
  34699. }
  34700. });
  34701. var Result = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__file", "result.vue"]]);
  34702. const ElResult = withInstall(Result);
  34703. const RowJustify = [
  34704. "start",
  34705. "center",
  34706. "end",
  34707. "space-around",
  34708. "space-between",
  34709. "space-evenly"
  34710. ];
  34711. const RowAlign = ["top", "middle", "bottom"];
  34712. const rowProps = buildProps({
  34713. tag: {
  34714. type: String,
  34715. default: "div"
  34716. },
  34717. gutter: {
  34718. type: Number,
  34719. default: 0
  34720. },
  34721. justify: {
  34722. type: String,
  34723. values: RowJustify,
  34724. default: "start"
  34725. },
  34726. align: {
  34727. type: String,
  34728. values: RowAlign,
  34729. default: "top"
  34730. }
  34731. });
  34732. const __default__$r = vue.defineComponent({
  34733. name: "ElRow"
  34734. });
  34735. const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
  34736. ...__default__$r,
  34737. props: rowProps,
  34738. setup(__props) {
  34739. const props = __props;
  34740. const ns = useNamespace("row");
  34741. const gutter = vue.computed(() => props.gutter);
  34742. vue.provide(rowContextKey, {
  34743. gutter
  34744. });
  34745. const style = vue.computed(() => {
  34746. const styles = {};
  34747. if (!props.gutter) {
  34748. return styles;
  34749. }
  34750. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  34751. return styles;
  34752. });
  34753. const rowKls = vue.computed(() => [
  34754. ns.b(),
  34755. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  34756. ns.is(`align-${props.align}`, props.align !== "top")
  34757. ]);
  34758. return (_ctx, _cache) => {
  34759. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  34760. class: vue.normalizeClass(vue.unref(rowKls)),
  34761. style: vue.normalizeStyle(vue.unref(style))
  34762. }, {
  34763. default: vue.withCtx(() => [
  34764. vue.renderSlot(_ctx.$slots, "default")
  34765. ]),
  34766. _: 3
  34767. }, 8, ["class", "style"]);
  34768. };
  34769. }
  34770. });
  34771. var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__file", "row.vue"]]);
  34772. const ElRow = withInstall(Row$1);
  34773. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  34774. return typeof value === "number" && value !== value;
  34775. };
  34776. function isEqual(first, second) {
  34777. if (first === second) {
  34778. return true;
  34779. }
  34780. if (safeIsNaN(first) && safeIsNaN(second)) {
  34781. return true;
  34782. }
  34783. return false;
  34784. }
  34785. function areInputsEqual(newInputs, lastInputs) {
  34786. if (newInputs.length !== lastInputs.length) {
  34787. return false;
  34788. }
  34789. for (var i = 0; i < newInputs.length; i++) {
  34790. if (!isEqual(newInputs[i], lastInputs[i])) {
  34791. return false;
  34792. }
  34793. }
  34794. return true;
  34795. }
  34796. function memoizeOne(resultFn, isEqual2) {
  34797. if (isEqual2 === void 0) {
  34798. isEqual2 = areInputsEqual;
  34799. }
  34800. var cache = null;
  34801. function memoized() {
  34802. var newArgs = [];
  34803. for (var _i = 0; _i < arguments.length; _i++) {
  34804. newArgs[_i] = arguments[_i];
  34805. }
  34806. if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
  34807. return cache.lastResult;
  34808. }
  34809. var lastResult = resultFn.apply(this, newArgs);
  34810. cache = {
  34811. lastResult,
  34812. lastArgs: newArgs,
  34813. lastThis: this
  34814. };
  34815. return lastResult;
  34816. }
  34817. memoized.clear = function clear() {
  34818. cache = null;
  34819. };
  34820. return memoized;
  34821. }
  34822. const useCache = () => {
  34823. const vm = vue.getCurrentInstance();
  34824. const props = vm.proxy.$props;
  34825. return vue.computed(() => {
  34826. const _getItemStyleCache = (_, __, ___) => ({});
  34827. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  34828. });
  34829. };
  34830. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  34831. const ITEM_RENDER_EVT = "itemRendered";
  34832. const SCROLL_EVT = "scroll";
  34833. const FORWARD = "forward";
  34834. const BACKWARD = "backward";
  34835. const AUTO_ALIGNMENT = "auto";
  34836. const SMART_ALIGNMENT = "smart";
  34837. const START_ALIGNMENT = "start";
  34838. const CENTERED_ALIGNMENT = "center";
  34839. const END_ALIGNMENT = "end";
  34840. const HORIZONTAL = "horizontal";
  34841. const VERTICAL = "vertical";
  34842. const LTR = "ltr";
  34843. const RTL = "rtl";
  34844. const RTL_OFFSET_NAG = "negative";
  34845. const RTL_OFFSET_POS_ASC = "positive-ascending";
  34846. const RTL_OFFSET_POS_DESC = "positive-descending";
  34847. const ScrollbarDirKey = {
  34848. [HORIZONTAL]: "left",
  34849. [VERTICAL]: "top"
  34850. };
  34851. const SCROLLBAR_MIN_SIZE = 20;
  34852. const LayoutKeys = {
  34853. [HORIZONTAL]: "deltaX",
  34854. [VERTICAL]: "deltaY"
  34855. };
  34856. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  34857. let frameHandle;
  34858. let offset = 0;
  34859. const hasReachedEdge = (offset2) => {
  34860. const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value;
  34861. return edgeReached;
  34862. };
  34863. const onWheel = (e) => {
  34864. cAF(frameHandle);
  34865. const newOffset = e[LayoutKeys[layout.value]];
  34866. if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
  34867. return;
  34868. offset += newOffset;
  34869. if (!isFirefox()) {
  34870. e.preventDefault();
  34871. }
  34872. frameHandle = rAF(() => {
  34873. onWheelDelta(offset);
  34874. offset = 0;
  34875. });
  34876. };
  34877. return {
  34878. hasReachedEdge,
  34879. onWheel
  34880. };
  34881. };
  34882. var useWheel$1 = useWheel;
  34883. const itemSize$1 = buildProp({
  34884. type: definePropType([Number, Function]),
  34885. required: true
  34886. });
  34887. const estimatedItemSize = buildProp({
  34888. type: Number
  34889. });
  34890. const cache = buildProp({
  34891. type: Number,
  34892. default: 2
  34893. });
  34894. const direction = buildProp({
  34895. type: String,
  34896. values: ["ltr", "rtl"],
  34897. default: "ltr"
  34898. });
  34899. const initScrollOffset = buildProp({
  34900. type: Number,
  34901. default: 0
  34902. });
  34903. const total = buildProp({
  34904. type: Number,
  34905. required: true
  34906. });
  34907. const layout = buildProp({
  34908. type: String,
  34909. values: ["horizontal", "vertical"],
  34910. default: VERTICAL
  34911. });
  34912. const virtualizedProps = buildProps({
  34913. className: {
  34914. type: String,
  34915. default: ""
  34916. },
  34917. containerElement: {
  34918. type: definePropType([String, Object]),
  34919. default: "div"
  34920. },
  34921. data: {
  34922. type: definePropType(Array),
  34923. default: () => mutable([])
  34924. },
  34925. direction,
  34926. height: {
  34927. type: [String, Number],
  34928. required: true
  34929. },
  34930. innerElement: {
  34931. type: [String, Object],
  34932. default: "div"
  34933. },
  34934. style: {
  34935. type: definePropType([Object, String, Array])
  34936. },
  34937. useIsScrolling: {
  34938. type: Boolean,
  34939. default: false
  34940. },
  34941. width: {
  34942. type: [Number, String],
  34943. required: false
  34944. },
  34945. perfMode: {
  34946. type: Boolean,
  34947. default: true
  34948. },
  34949. scrollbarAlwaysOn: {
  34950. type: Boolean,
  34951. default: false
  34952. }
  34953. });
  34954. const virtualizedListProps = buildProps({
  34955. cache,
  34956. estimatedItemSize,
  34957. layout,
  34958. initScrollOffset,
  34959. total,
  34960. itemSize: itemSize$1,
  34961. ...virtualizedProps
  34962. });
  34963. const scrollbarSize = {
  34964. type: Number,
  34965. default: 6
  34966. };
  34967. const startGap = { type: Number, default: 0 };
  34968. const endGap = { type: Number, default: 2 };
  34969. const virtualizedGridProps = buildProps({
  34970. columnCache: cache,
  34971. columnWidth: itemSize$1,
  34972. estimatedColumnWidth: estimatedItemSize,
  34973. estimatedRowHeight: estimatedItemSize,
  34974. initScrollLeft: initScrollOffset,
  34975. initScrollTop: initScrollOffset,
  34976. itemKey: {
  34977. type: definePropType(Function),
  34978. default: ({
  34979. columnIndex,
  34980. rowIndex
  34981. }) => `${rowIndex}:${columnIndex}`
  34982. },
  34983. rowCache: cache,
  34984. rowHeight: itemSize$1,
  34985. totalColumn: total,
  34986. totalRow: total,
  34987. hScrollbarSize: scrollbarSize,
  34988. vScrollbarSize: scrollbarSize,
  34989. scrollbarStartGap: startGap,
  34990. scrollbarEndGap: endGap,
  34991. ...virtualizedProps
  34992. });
  34993. const virtualizedScrollbarProps = buildProps({
  34994. alwaysOn: Boolean,
  34995. class: String,
  34996. layout,
  34997. total,
  34998. ratio: {
  34999. type: Number,
  35000. required: true
  35001. },
  35002. clientSize: {
  35003. type: Number,
  35004. required: true
  35005. },
  35006. scrollFrom: {
  35007. type: Number,
  35008. required: true
  35009. },
  35010. scrollbarSize,
  35011. startGap,
  35012. endGap,
  35013. visible: Boolean
  35014. });
  35015. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  35016. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  35017. const isRTL = (dir) => dir === RTL;
  35018. let cachedRTLResult = null;
  35019. function getRTLOffsetType(recalculate = false) {
  35020. if (cachedRTLResult === null || recalculate) {
  35021. const outerDiv = document.createElement("div");
  35022. const outerStyle = outerDiv.style;
  35023. outerStyle.width = "50px";
  35024. outerStyle.height = "50px";
  35025. outerStyle.overflow = "scroll";
  35026. outerStyle.direction = "rtl";
  35027. const innerDiv = document.createElement("div");
  35028. const innerStyle = innerDiv.style;
  35029. innerStyle.width = "100px";
  35030. innerStyle.height = "100px";
  35031. outerDiv.appendChild(innerDiv);
  35032. document.body.appendChild(outerDiv);
  35033. if (outerDiv.scrollLeft > 0) {
  35034. cachedRTLResult = RTL_OFFSET_POS_DESC;
  35035. } else {
  35036. outerDiv.scrollLeft = 1;
  35037. if (outerDiv.scrollLeft === 0) {
  35038. cachedRTLResult = RTL_OFFSET_NAG;
  35039. } else {
  35040. cachedRTLResult = RTL_OFFSET_POS_ASC;
  35041. }
  35042. }
  35043. document.body.removeChild(outerDiv);
  35044. return cachedRTLResult;
  35045. }
  35046. return cachedRTLResult;
  35047. }
  35048. function renderThumbStyle({ move, size, bar }, layout) {
  35049. const style = {};
  35050. const translate = `translate${bar.axis}(${move}px)`;
  35051. style[bar.size] = size;
  35052. style.transform = translate;
  35053. style.msTransform = translate;
  35054. style.webkitTransform = translate;
  35055. if (layout === "horizontal") {
  35056. style.height = "100%";
  35057. } else {
  35058. style.width = "100%";
  35059. }
  35060. return style;
  35061. }
  35062. const ScrollBar = vue.defineComponent({
  35063. name: "ElVirtualScrollBar",
  35064. props: virtualizedScrollbarProps,
  35065. emits: ["scroll", "start-move", "stop-move"],
  35066. setup(props, { emit }) {
  35067. const GAP = vue.computed(() => props.startGap + props.endGap);
  35068. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  35069. const nsScrollbar = useNamespace("scrollbar");
  35070. const trackRef = vue.ref();
  35071. const thumbRef = vue.ref();
  35072. let frameHandle = null;
  35073. let onselectstartStore = null;
  35074. const state = vue.reactive({
  35075. isDragging: false,
  35076. traveled: 0
  35077. });
  35078. const bar = vue.computed(() => BAR_MAP[props.layout]);
  35079. const trackSize = vue.computed(() => props.clientSize - vue.unref(GAP));
  35080. const trackStyle = vue.computed(() => ({
  35081. position: "absolute",
  35082. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  35083. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  35084. [ScrollbarDirKey[props.layout]]: "2px",
  35085. right: "2px",
  35086. bottom: "2px",
  35087. borderRadius: "4px"
  35088. }));
  35089. const thumbSize = vue.computed(() => {
  35090. const ratio = props.ratio;
  35091. const clientSize = props.clientSize;
  35092. if (ratio >= 100) {
  35093. return Number.POSITIVE_INFINITY;
  35094. }
  35095. if (ratio >= 50) {
  35096. return ratio * clientSize / 100;
  35097. }
  35098. const SCROLLBAR_MAX_SIZE = clientSize / 3;
  35099. return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  35100. });
  35101. const thumbStyle = vue.computed(() => {
  35102. if (!Number.isFinite(thumbSize.value)) {
  35103. return {
  35104. display: "none"
  35105. };
  35106. }
  35107. const thumb = `${thumbSize.value}px`;
  35108. const style = renderThumbStyle({
  35109. bar: bar.value,
  35110. size: thumb,
  35111. move: state.traveled
  35112. }, props.layout);
  35113. return style;
  35114. });
  35115. const totalSteps = vue.computed(() => Math.floor(props.clientSize - thumbSize.value - vue.unref(GAP)));
  35116. const attachEvents = () => {
  35117. window.addEventListener("mousemove", onMouseMove);
  35118. window.addEventListener("mouseup", onMouseUp);
  35119. const thumbEl = vue.unref(thumbRef);
  35120. if (!thumbEl)
  35121. return;
  35122. onselectstartStore = document.onselectstart;
  35123. document.onselectstart = () => false;
  35124. thumbEl.addEventListener("touchmove", onMouseMove);
  35125. thumbEl.addEventListener("touchend", onMouseUp);
  35126. };
  35127. const detachEvents = () => {
  35128. window.removeEventListener("mousemove", onMouseMove);
  35129. window.removeEventListener("mouseup", onMouseUp);
  35130. document.onselectstart = onselectstartStore;
  35131. onselectstartStore = null;
  35132. const thumbEl = vue.unref(thumbRef);
  35133. if (!thumbEl)
  35134. return;
  35135. thumbEl.removeEventListener("touchmove", onMouseMove);
  35136. thumbEl.removeEventListener("touchend", onMouseUp);
  35137. };
  35138. const onThumbMouseDown = (e) => {
  35139. e.stopImmediatePropagation();
  35140. if (e.ctrlKey || [1, 2].includes(e.button)) {
  35141. return;
  35142. }
  35143. state.isDragging = true;
  35144. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  35145. emit("start-move");
  35146. attachEvents();
  35147. };
  35148. const onMouseUp = () => {
  35149. state.isDragging = false;
  35150. state[bar.value.axis] = 0;
  35151. emit("stop-move");
  35152. detachEvents();
  35153. };
  35154. const onMouseMove = (e) => {
  35155. const { isDragging } = state;
  35156. if (!isDragging)
  35157. return;
  35158. if (!thumbRef.value || !trackRef.value)
  35159. return;
  35160. const prevPage = state[bar.value.axis];
  35161. if (!prevPage)
  35162. return;
  35163. cAF(frameHandle);
  35164. const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  35165. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  35166. const distance = offset - thumbClickPosition;
  35167. frameHandle = rAF(() => {
  35168. state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value));
  35169. emit("scroll", distance, totalSteps.value);
  35170. });
  35171. };
  35172. const clickTrackHandler = (e) => {
  35173. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  35174. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  35175. const distance = offset - thumbHalf;
  35176. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  35177. emit("scroll", distance, totalSteps.value);
  35178. };
  35179. vue.watch(() => props.scrollFrom, (v) => {
  35180. if (state.isDragging)
  35181. return;
  35182. state.traveled = Math.ceil(v * totalSteps.value);
  35183. });
  35184. vue.onBeforeUnmount(() => {
  35185. detachEvents();
  35186. });
  35187. return () => {
  35188. return vue.h("div", {
  35189. role: "presentation",
  35190. ref: trackRef,
  35191. class: [
  35192. nsVirtualScrollbar.b(),
  35193. props.class,
  35194. (props.alwaysOn || state.isDragging) && "always-on"
  35195. ],
  35196. style: trackStyle.value,
  35197. onMousedown: vue.withModifiers(clickTrackHandler, ["stop", "prevent"]),
  35198. onTouchstartPrevent: onThumbMouseDown
  35199. }, vue.h("div", {
  35200. ref: thumbRef,
  35201. class: nsScrollbar.e("thumb"),
  35202. style: thumbStyle.value,
  35203. onMousedown: onThumbMouseDown
  35204. }, []));
  35205. };
  35206. }
  35207. });
  35208. var Scrollbar = ScrollBar;
  35209. const createList = ({
  35210. name,
  35211. getOffset,
  35212. getItemSize,
  35213. getItemOffset,
  35214. getEstimatedTotalSize,
  35215. getStartIndexForOffset,
  35216. getStopIndexForStartIndex,
  35217. initCache,
  35218. clearCache,
  35219. validateProps
  35220. }) => {
  35221. return vue.defineComponent({
  35222. name: name != null ? name : "ElVirtualList",
  35223. props: virtualizedListProps,
  35224. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  35225. setup(props, { emit, expose }) {
  35226. validateProps(props);
  35227. const instance = vue.getCurrentInstance();
  35228. const ns = useNamespace("vl");
  35229. const dynamicSizeCache = vue.ref(initCache(props, instance));
  35230. const getItemStyleCache = useCache();
  35231. const windowRef = vue.ref();
  35232. const innerRef = vue.ref();
  35233. const scrollbarRef = vue.ref();
  35234. const states = vue.ref({
  35235. isScrolling: false,
  35236. scrollDir: "forward",
  35237. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  35238. updateRequested: false,
  35239. isScrollbarDragging: false,
  35240. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  35241. });
  35242. const itemsToRender = vue.computed(() => {
  35243. const { total, cache } = props;
  35244. const { isScrolling, scrollDir, scrollOffset } = vue.unref(states);
  35245. if (total === 0) {
  35246. return [0, 0, 0, 0];
  35247. }
  35248. const startIndex = getStartIndexForOffset(props, scrollOffset, vue.unref(dynamicSizeCache));
  35249. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, vue.unref(dynamicSizeCache));
  35250. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  35251. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  35252. return [
  35253. Math.max(0, startIndex - cacheBackward),
  35254. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  35255. startIndex,
  35256. stopIndex
  35257. ];
  35258. });
  35259. const estimatedTotalSize = vue.computed(() => getEstimatedTotalSize(props, vue.unref(dynamicSizeCache)));
  35260. const _isHorizontal = vue.computed(() => isHorizontal(props.layout));
  35261. const windowStyle = vue.computed(() => [
  35262. {
  35263. position: "relative",
  35264. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  35265. WebkitOverflowScrolling: "touch",
  35266. willChange: "transform"
  35267. },
  35268. {
  35269. direction: props.direction,
  35270. height: isNumber(props.height) ? `${props.height}px` : props.height,
  35271. width: isNumber(props.width) ? `${props.width}px` : props.width
  35272. },
  35273. props.style
  35274. ]);
  35275. const innerStyle = vue.computed(() => {
  35276. const size = vue.unref(estimatedTotalSize);
  35277. const horizontal = vue.unref(_isHorizontal);
  35278. return {
  35279. height: horizontal ? "100%" : `${size}px`,
  35280. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  35281. width: horizontal ? `${size}px` : "100%"
  35282. };
  35283. });
  35284. const clientSize = vue.computed(() => _isHorizontal.value ? props.width : props.height);
  35285. const { onWheel } = useWheel$1({
  35286. atStartEdge: vue.computed(() => states.value.scrollOffset <= 0),
  35287. atEndEdge: vue.computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  35288. layout: vue.computed(() => props.layout)
  35289. }, (offset) => {
  35290. var _a, _b;
  35291. (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a);
  35292. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  35293. });
  35294. const emitEvents = () => {
  35295. const { total } = props;
  35296. if (total > 0) {
  35297. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = vue.unref(itemsToRender);
  35298. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  35299. }
  35300. const { scrollDir, scrollOffset, updateRequested } = vue.unref(states);
  35301. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  35302. };
  35303. const scrollVertically = (e) => {
  35304. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  35305. const _states = vue.unref(states);
  35306. if (_states.scrollOffset === scrollTop) {
  35307. return;
  35308. }
  35309. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  35310. states.value = {
  35311. ..._states,
  35312. isScrolling: true,
  35313. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  35314. scrollOffset,
  35315. updateRequested: false
  35316. };
  35317. vue.nextTick(resetIsScrolling);
  35318. };
  35319. const scrollHorizontally = (e) => {
  35320. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  35321. const _states = vue.unref(states);
  35322. if (_states.scrollOffset === scrollLeft) {
  35323. return;
  35324. }
  35325. const { direction } = props;
  35326. let scrollOffset = scrollLeft;
  35327. if (direction === RTL) {
  35328. switch (getRTLOffsetType()) {
  35329. case RTL_OFFSET_NAG: {
  35330. scrollOffset = -scrollLeft;
  35331. break;
  35332. }
  35333. case RTL_OFFSET_POS_DESC: {
  35334. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  35335. break;
  35336. }
  35337. }
  35338. }
  35339. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  35340. states.value = {
  35341. ..._states,
  35342. isScrolling: true,
  35343. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  35344. scrollOffset,
  35345. updateRequested: false
  35346. };
  35347. vue.nextTick(resetIsScrolling);
  35348. };
  35349. const onScroll = (e) => {
  35350. vue.unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  35351. emitEvents();
  35352. };
  35353. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  35354. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  35355. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  35356. };
  35357. const scrollTo = (offset) => {
  35358. offset = Math.max(offset, 0);
  35359. if (offset === vue.unref(states).scrollOffset) {
  35360. return;
  35361. }
  35362. states.value = {
  35363. ...vue.unref(states),
  35364. scrollOffset: offset,
  35365. scrollDir: getScrollDir(vue.unref(states).scrollOffset, offset),
  35366. updateRequested: true
  35367. };
  35368. vue.nextTick(resetIsScrolling);
  35369. };
  35370. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  35371. const { scrollOffset } = vue.unref(states);
  35372. idx = Math.max(0, Math.min(idx, props.total - 1));
  35373. scrollTo(getOffset(props, idx, alignment, scrollOffset, vue.unref(dynamicSizeCache)));
  35374. };
  35375. const getItemStyle = (idx) => {
  35376. const { direction, itemSize, layout } = props;
  35377. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  35378. let style;
  35379. if (hasOwn(itemStyleCache, String(idx))) {
  35380. style = itemStyleCache[idx];
  35381. } else {
  35382. const offset = getItemOffset(props, idx, vue.unref(dynamicSizeCache));
  35383. const size = getItemSize(props, idx, vue.unref(dynamicSizeCache));
  35384. const horizontal = vue.unref(_isHorizontal);
  35385. const isRtl = direction === RTL;
  35386. const offsetHorizontal = horizontal ? offset : 0;
  35387. itemStyleCache[idx] = style = {
  35388. position: "absolute",
  35389. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  35390. right: isRtl ? `${offsetHorizontal}px` : void 0,
  35391. top: !horizontal ? `${offset}px` : 0,
  35392. height: !horizontal ? `${size}px` : "100%",
  35393. width: horizontal ? `${size}px` : "100%"
  35394. };
  35395. }
  35396. return style;
  35397. };
  35398. const resetIsScrolling = () => {
  35399. states.value.isScrolling = false;
  35400. vue.nextTick(() => {
  35401. getItemStyleCache.value(-1, null, null);
  35402. });
  35403. };
  35404. const resetScrollTop = () => {
  35405. const window = windowRef.value;
  35406. if (window) {
  35407. window.scrollTop = 0;
  35408. }
  35409. };
  35410. vue.onMounted(() => {
  35411. if (!isClient)
  35412. return;
  35413. const { initScrollOffset } = props;
  35414. const windowElement = vue.unref(windowRef);
  35415. if (isNumber(initScrollOffset) && windowElement) {
  35416. if (vue.unref(_isHorizontal)) {
  35417. windowElement.scrollLeft = initScrollOffset;
  35418. } else {
  35419. windowElement.scrollTop = initScrollOffset;
  35420. }
  35421. }
  35422. emitEvents();
  35423. });
  35424. vue.onUpdated(() => {
  35425. const { direction, layout } = props;
  35426. const { scrollOffset, updateRequested } = vue.unref(states);
  35427. const windowElement = vue.unref(windowRef);
  35428. if (updateRequested && windowElement) {
  35429. if (layout === HORIZONTAL) {
  35430. if (direction === RTL) {
  35431. switch (getRTLOffsetType()) {
  35432. case RTL_OFFSET_NAG: {
  35433. windowElement.scrollLeft = -scrollOffset;
  35434. break;
  35435. }
  35436. case RTL_OFFSET_POS_ASC: {
  35437. windowElement.scrollLeft = scrollOffset;
  35438. break;
  35439. }
  35440. default: {
  35441. const { clientWidth, scrollWidth } = windowElement;
  35442. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  35443. break;
  35444. }
  35445. }
  35446. } else {
  35447. windowElement.scrollLeft = scrollOffset;
  35448. }
  35449. } else {
  35450. windowElement.scrollTop = scrollOffset;
  35451. }
  35452. }
  35453. });
  35454. const api = {
  35455. ns,
  35456. clientSize,
  35457. estimatedTotalSize,
  35458. windowStyle,
  35459. windowRef,
  35460. innerRef,
  35461. innerStyle,
  35462. itemsToRender,
  35463. scrollbarRef,
  35464. states,
  35465. getItemStyle,
  35466. onScroll,
  35467. onScrollbarScroll,
  35468. onWheel,
  35469. scrollTo,
  35470. scrollToItem,
  35471. resetScrollTop
  35472. };
  35473. expose({
  35474. windowRef,
  35475. innerRef,
  35476. getItemStyleCache,
  35477. scrollTo,
  35478. scrollToItem,
  35479. resetScrollTop,
  35480. states
  35481. });
  35482. return api;
  35483. },
  35484. render(ctx) {
  35485. var _a;
  35486. const {
  35487. $slots,
  35488. className,
  35489. clientSize,
  35490. containerElement,
  35491. data,
  35492. getItemStyle,
  35493. innerElement,
  35494. itemsToRender,
  35495. innerStyle,
  35496. layout,
  35497. total,
  35498. onScroll,
  35499. onScrollbarScroll,
  35500. onWheel,
  35501. states,
  35502. useIsScrolling,
  35503. windowStyle,
  35504. ns
  35505. } = ctx;
  35506. const [start, end] = itemsToRender;
  35507. const Container = vue.resolveDynamicComponent(containerElement);
  35508. const Inner = vue.resolveDynamicComponent(innerElement);
  35509. const children = [];
  35510. if (total > 0) {
  35511. for (let i = start; i <= end; i++) {
  35512. children.push((_a = $slots.default) == null ? void 0 : _a.call($slots, {
  35513. data,
  35514. key: i,
  35515. index: i,
  35516. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  35517. style: getItemStyle(i)
  35518. }));
  35519. }
  35520. }
  35521. const InnerNode = [
  35522. vue.h(Inner, {
  35523. style: innerStyle,
  35524. ref: "innerRef"
  35525. }, !isString(Inner) ? {
  35526. default: () => children
  35527. } : children)
  35528. ];
  35529. const scrollbar = vue.h(Scrollbar, {
  35530. ref: "scrollbarRef",
  35531. clientSize,
  35532. layout,
  35533. onScroll: onScrollbarScroll,
  35534. ratio: clientSize * 100 / this.estimatedTotalSize,
  35535. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  35536. total
  35537. });
  35538. const listContainer = vue.h(Container, {
  35539. class: [ns.e("window"), className],
  35540. style: windowStyle,
  35541. onScroll,
  35542. onWheel,
  35543. ref: "windowRef",
  35544. key: 0
  35545. }, !isString(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  35546. return vue.h("div", {
  35547. key: 0,
  35548. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  35549. }, [listContainer, scrollbar]);
  35550. }
  35551. });
  35552. };
  35553. var createList$1 = createList;
  35554. const FixedSizeList = createList$1({
  35555. name: "ElFixedSizeList",
  35556. getItemOffset: ({ itemSize }, index) => index * itemSize,
  35557. getItemSize: ({ itemSize }) => itemSize,
  35558. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  35559. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  35560. const size = isHorizontal(layout) ? width : height;
  35561. const lastItemOffset = Math.max(0, total * itemSize - size);
  35562. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  35563. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  35564. if (alignment === SMART_ALIGNMENT) {
  35565. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  35566. alignment = AUTO_ALIGNMENT;
  35567. } else {
  35568. alignment = CENTERED_ALIGNMENT;
  35569. }
  35570. }
  35571. switch (alignment) {
  35572. case START_ALIGNMENT: {
  35573. return maxOffset;
  35574. }
  35575. case END_ALIGNMENT: {
  35576. return minOffset;
  35577. }
  35578. case CENTERED_ALIGNMENT: {
  35579. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  35580. if (middleOffset < Math.ceil(size / 2)) {
  35581. return 0;
  35582. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  35583. return lastItemOffset;
  35584. } else {
  35585. return middleOffset;
  35586. }
  35587. }
  35588. case AUTO_ALIGNMENT:
  35589. default: {
  35590. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  35591. return scrollOffset;
  35592. } else if (scrollOffset < minOffset) {
  35593. return minOffset;
  35594. } else {
  35595. return maxOffset;
  35596. }
  35597. }
  35598. }
  35599. },
  35600. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  35601. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  35602. const offset = startIndex * itemSize;
  35603. const size = isHorizontal(layout) ? width : height;
  35604. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  35605. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  35606. },
  35607. initCache() {
  35608. return void 0;
  35609. },
  35610. clearCache: true,
  35611. validateProps() {
  35612. }
  35613. });
  35614. var FixedSizeList$1 = FixedSizeList;
  35615. const getItemFromCache$1 = (props, index, listCache) => {
  35616. const { itemSize } = props;
  35617. const { items, lastVisitedIndex } = listCache;
  35618. if (index > lastVisitedIndex) {
  35619. let offset = 0;
  35620. if (lastVisitedIndex >= 0) {
  35621. const item = items[lastVisitedIndex];
  35622. offset = item.offset + item.size;
  35623. }
  35624. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  35625. const size = itemSize(i);
  35626. items[i] = {
  35627. offset,
  35628. size
  35629. };
  35630. offset += size;
  35631. }
  35632. listCache.lastVisitedIndex = index;
  35633. }
  35634. return items[index];
  35635. };
  35636. const findItem$1 = (props, listCache, offset) => {
  35637. const { items, lastVisitedIndex } = listCache;
  35638. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  35639. if (lastVisitedOffset >= offset) {
  35640. return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  35641. }
  35642. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  35643. };
  35644. const bs$1 = (props, listCache, low, high, offset) => {
  35645. while (low <= high) {
  35646. const mid = low + Math.floor((high - low) / 2);
  35647. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  35648. if (currentOffset === offset) {
  35649. return mid;
  35650. } else if (currentOffset < offset) {
  35651. low = mid + 1;
  35652. } else if (currentOffset > offset) {
  35653. high = mid - 1;
  35654. }
  35655. }
  35656. return Math.max(0, low - 1);
  35657. };
  35658. const es$1 = (props, listCache, index, offset) => {
  35659. const { total } = props;
  35660. let exponent = 1;
  35661. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  35662. index += exponent;
  35663. exponent *= 2;
  35664. }
  35665. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  35666. };
  35667. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  35668. let totalSizeOfMeasuredItems = 0;
  35669. if (lastVisitedIndex >= total) {
  35670. lastVisitedIndex = total - 1;
  35671. }
  35672. if (lastVisitedIndex >= 0) {
  35673. const item = items[lastVisitedIndex];
  35674. totalSizeOfMeasuredItems = item.offset + item.size;
  35675. }
  35676. const numUnmeasuredItems = total - lastVisitedIndex - 1;
  35677. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  35678. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  35679. };
  35680. const DynamicSizeList = createList$1({
  35681. name: "ElDynamicSizeList",
  35682. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  35683. getItemSize: (_, index, { items }) => items[index].size,
  35684. getEstimatedTotalSize,
  35685. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  35686. const { height, layout, width } = props;
  35687. const size = isHorizontal(layout) ? width : height;
  35688. const item = getItemFromCache$1(props, index, listCache);
  35689. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  35690. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  35691. const minOffset = Math.max(0, item.offset - size + item.size);
  35692. if (alignment === SMART_ALIGNMENT) {
  35693. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  35694. alignment = AUTO_ALIGNMENT;
  35695. } else {
  35696. alignment = CENTERED_ALIGNMENT;
  35697. }
  35698. }
  35699. switch (alignment) {
  35700. case START_ALIGNMENT: {
  35701. return maxOffset;
  35702. }
  35703. case END_ALIGNMENT: {
  35704. return minOffset;
  35705. }
  35706. case CENTERED_ALIGNMENT: {
  35707. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  35708. }
  35709. case AUTO_ALIGNMENT:
  35710. default: {
  35711. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  35712. return scrollOffset;
  35713. } else if (scrollOffset < minOffset) {
  35714. return minOffset;
  35715. } else {
  35716. return maxOffset;
  35717. }
  35718. }
  35719. }
  35720. },
  35721. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  35722. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  35723. const { height, total, layout, width } = props;
  35724. const size = isHorizontal(layout) ? width : height;
  35725. const item = getItemFromCache$1(props, startIndex, listCache);
  35726. const maxOffset = scrollOffset + size;
  35727. let offset = item.offset + item.size;
  35728. let stopIndex = startIndex;
  35729. while (stopIndex < total - 1 && offset < maxOffset) {
  35730. stopIndex++;
  35731. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  35732. }
  35733. return stopIndex;
  35734. },
  35735. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  35736. const cache = {
  35737. items: {},
  35738. estimatedItemSize,
  35739. lastVisitedIndex: -1
  35740. };
  35741. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  35742. var _a, _b;
  35743. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  35744. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1);
  35745. if (forceUpdate) {
  35746. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  35747. }
  35748. };
  35749. return cache;
  35750. },
  35751. clearCache: false,
  35752. validateProps: ({ itemSize }) => {
  35753. }
  35754. });
  35755. var DynamicSizeList$1 = DynamicSizeList;
  35756. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  35757. let frameHandle = null;
  35758. let xOffset = 0;
  35759. let yOffset = 0;
  35760. const hasReachedEdge = (x, y) => {
  35761. const xEdgeReached = x < 0 && atXStartEdge.value || x > 0 && atXEndEdge.value;
  35762. const yEdgeReached = y < 0 && atYStartEdge.value || y > 0 && atYEndEdge.value;
  35763. return xEdgeReached && yEdgeReached;
  35764. };
  35765. const onWheel = (e) => {
  35766. cAF(frameHandle);
  35767. let x = e.deltaX;
  35768. let y = e.deltaY;
  35769. if (Math.abs(x) > Math.abs(y)) {
  35770. y = 0;
  35771. } else {
  35772. x = 0;
  35773. }
  35774. if (e.shiftKey && y !== 0) {
  35775. x = y;
  35776. y = 0;
  35777. }
  35778. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y))
  35779. return;
  35780. xOffset += x;
  35781. yOffset += y;
  35782. if (!isFirefox()) {
  35783. e.preventDefault();
  35784. }
  35785. frameHandle = rAF(() => {
  35786. onWheelDelta(xOffset, yOffset);
  35787. xOffset = 0;
  35788. yOffset = 0;
  35789. });
  35790. };
  35791. return {
  35792. hasReachedEdge,
  35793. onWheel
  35794. };
  35795. };
  35796. const createGrid = ({
  35797. name,
  35798. clearCache,
  35799. getColumnPosition,
  35800. getColumnStartIndexForOffset,
  35801. getColumnStopIndexForStartIndex,
  35802. getEstimatedTotalHeight,
  35803. getEstimatedTotalWidth,
  35804. getColumnOffset,
  35805. getRowOffset,
  35806. getRowPosition,
  35807. getRowStartIndexForOffset,
  35808. getRowStopIndexForStartIndex,
  35809. initCache,
  35810. injectToInstance,
  35811. validateProps
  35812. }) => {
  35813. return vue.defineComponent({
  35814. name: name != null ? name : "ElVirtualList",
  35815. props: virtualizedGridProps,
  35816. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  35817. setup(props, { emit, expose, slots }) {
  35818. const ns = useNamespace("vl");
  35819. validateProps(props);
  35820. const instance = vue.getCurrentInstance();
  35821. const cache = vue.ref(initCache(props, instance));
  35822. injectToInstance == null ? void 0 : injectToInstance(instance, cache);
  35823. const windowRef = vue.ref();
  35824. const hScrollbar = vue.ref();
  35825. const vScrollbar = vue.ref();
  35826. const innerRef = vue.ref(null);
  35827. const states = vue.ref({
  35828. isScrolling: false,
  35829. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  35830. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  35831. updateRequested: false,
  35832. xAxisScrollDir: FORWARD,
  35833. yAxisScrollDir: FORWARD
  35834. });
  35835. const getItemStyleCache = useCache();
  35836. const parsedHeight = vue.computed(() => Number.parseInt(`${props.height}`, 10));
  35837. const parsedWidth = vue.computed(() => Number.parseInt(`${props.width}`, 10));
  35838. const columnsToRender = vue.computed(() => {
  35839. const { totalColumn, totalRow, columnCache } = props;
  35840. const { isScrolling, xAxisScrollDir, scrollLeft } = vue.unref(states);
  35841. if (totalColumn === 0 || totalRow === 0) {
  35842. return [0, 0, 0, 0];
  35843. }
  35844. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, vue.unref(cache));
  35845. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, vue.unref(cache));
  35846. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  35847. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  35848. return [
  35849. Math.max(0, startIndex - cacheBackward),
  35850. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  35851. startIndex,
  35852. stopIndex
  35853. ];
  35854. });
  35855. const rowsToRender = vue.computed(() => {
  35856. const { totalColumn, totalRow, rowCache } = props;
  35857. const { isScrolling, yAxisScrollDir, scrollTop } = vue.unref(states);
  35858. if (totalColumn === 0 || totalRow === 0) {
  35859. return [0, 0, 0, 0];
  35860. }
  35861. const startIndex = getRowStartIndexForOffset(props, scrollTop, vue.unref(cache));
  35862. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, vue.unref(cache));
  35863. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  35864. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  35865. return [
  35866. Math.max(0, startIndex - cacheBackward),
  35867. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  35868. startIndex,
  35869. stopIndex
  35870. ];
  35871. });
  35872. const estimatedTotalHeight = vue.computed(() => getEstimatedTotalHeight(props, vue.unref(cache)));
  35873. const estimatedTotalWidth = vue.computed(() => getEstimatedTotalWidth(props, vue.unref(cache)));
  35874. const windowStyle = vue.computed(() => {
  35875. var _a;
  35876. return [
  35877. {
  35878. position: "relative",
  35879. overflow: "hidden",
  35880. WebkitOverflowScrolling: "touch",
  35881. willChange: "transform"
  35882. },
  35883. {
  35884. direction: props.direction,
  35885. height: isNumber(props.height) ? `${props.height}px` : props.height,
  35886. width: isNumber(props.width) ? `${props.width}px` : props.width
  35887. },
  35888. (_a = props.style) != null ? _a : {}
  35889. ];
  35890. });
  35891. const innerStyle = vue.computed(() => {
  35892. const width = `${vue.unref(estimatedTotalWidth)}px`;
  35893. const height = `${vue.unref(estimatedTotalHeight)}px`;
  35894. return {
  35895. height,
  35896. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  35897. width
  35898. };
  35899. });
  35900. const emitEvents = () => {
  35901. const { totalColumn, totalRow } = props;
  35902. if (totalColumn > 0 && totalRow > 0) {
  35903. const [
  35904. columnCacheStart,
  35905. columnCacheEnd,
  35906. columnVisibleStart,
  35907. columnVisibleEnd
  35908. ] = vue.unref(columnsToRender);
  35909. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = vue.unref(rowsToRender);
  35910. emit(ITEM_RENDER_EVT, {
  35911. columnCacheStart,
  35912. columnCacheEnd,
  35913. rowCacheStart,
  35914. rowCacheEnd,
  35915. columnVisibleStart,
  35916. columnVisibleEnd,
  35917. rowVisibleStart,
  35918. rowVisibleEnd
  35919. });
  35920. }
  35921. const {
  35922. scrollLeft,
  35923. scrollTop,
  35924. updateRequested,
  35925. xAxisScrollDir,
  35926. yAxisScrollDir
  35927. } = vue.unref(states);
  35928. emit(SCROLL_EVT, {
  35929. xAxisScrollDir,
  35930. scrollLeft,
  35931. yAxisScrollDir,
  35932. scrollTop,
  35933. updateRequested
  35934. });
  35935. };
  35936. const onScroll = (e) => {
  35937. const {
  35938. clientHeight,
  35939. clientWidth,
  35940. scrollHeight,
  35941. scrollLeft,
  35942. scrollTop,
  35943. scrollWidth
  35944. } = e.currentTarget;
  35945. const _states = vue.unref(states);
  35946. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  35947. return;
  35948. }
  35949. let _scrollLeft = scrollLeft;
  35950. if (isRTL(props.direction)) {
  35951. switch (getRTLOffsetType()) {
  35952. case RTL_OFFSET_NAG:
  35953. _scrollLeft = -scrollLeft;
  35954. break;
  35955. case RTL_OFFSET_POS_DESC:
  35956. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  35957. break;
  35958. }
  35959. }
  35960. states.value = {
  35961. ..._states,
  35962. isScrolling: true,
  35963. scrollLeft: _scrollLeft,
  35964. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  35965. updateRequested: true,
  35966. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  35967. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  35968. };
  35969. vue.nextTick(() => resetIsScrolling());
  35970. onUpdated();
  35971. emitEvents();
  35972. };
  35973. const onVerticalScroll = (distance, totalSteps) => {
  35974. const height = vue.unref(parsedHeight);
  35975. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  35976. scrollTo({
  35977. scrollTop: Math.min(estimatedTotalHeight.value - height, offset)
  35978. });
  35979. };
  35980. const onHorizontalScroll = (distance, totalSteps) => {
  35981. const width = vue.unref(parsedWidth);
  35982. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  35983. scrollTo({
  35984. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset)
  35985. });
  35986. };
  35987. const { onWheel } = useGridWheel({
  35988. atXStartEdge: vue.computed(() => states.value.scrollLeft <= 0),
  35989. atXEndEdge: vue.computed(() => states.value.scrollLeft >= estimatedTotalWidth.value),
  35990. atYStartEdge: vue.computed(() => states.value.scrollTop <= 0),
  35991. atYEndEdge: vue.computed(() => states.value.scrollTop >= estimatedTotalHeight.value)
  35992. }, (x, y) => {
  35993. var _a, _b, _c, _d;
  35994. (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a);
  35995. (_d = (_c = hScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  35996. const width = vue.unref(parsedWidth);
  35997. const height = vue.unref(parsedHeight);
  35998. scrollTo({
  35999. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  36000. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  36001. });
  36002. });
  36003. const scrollTo = ({
  36004. scrollLeft = states.value.scrollLeft,
  36005. scrollTop = states.value.scrollTop
  36006. }) => {
  36007. scrollLeft = Math.max(scrollLeft, 0);
  36008. scrollTop = Math.max(scrollTop, 0);
  36009. const _states = vue.unref(states);
  36010. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  36011. return;
  36012. }
  36013. states.value = {
  36014. ..._states,
  36015. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  36016. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  36017. scrollLeft,
  36018. scrollTop,
  36019. updateRequested: true
  36020. };
  36021. vue.nextTick(() => resetIsScrolling());
  36022. onUpdated();
  36023. emitEvents();
  36024. };
  36025. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  36026. const _states = vue.unref(states);
  36027. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  36028. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  36029. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  36030. const _cache = vue.unref(cache);
  36031. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  36032. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  36033. scrollTo({
  36034. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  36035. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  36036. });
  36037. };
  36038. const getItemStyle = (rowIndex, columnIndex) => {
  36039. const { columnWidth, direction, rowHeight } = props;
  36040. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  36041. const key = `${rowIndex},${columnIndex}`;
  36042. if (hasOwn(itemStyleCache, key)) {
  36043. return itemStyleCache[key];
  36044. } else {
  36045. const [, left] = getColumnPosition(props, columnIndex, vue.unref(cache));
  36046. const _cache = vue.unref(cache);
  36047. const rtl = isRTL(direction);
  36048. const [height, top] = getRowPosition(props, rowIndex, _cache);
  36049. const [width] = getColumnPosition(props, columnIndex, _cache);
  36050. itemStyleCache[key] = {
  36051. position: "absolute",
  36052. left: rtl ? void 0 : `${left}px`,
  36053. right: rtl ? `${left}px` : void 0,
  36054. top: `${top}px`,
  36055. height: `${height}px`,
  36056. width: `${width}px`
  36057. };
  36058. return itemStyleCache[key];
  36059. }
  36060. };
  36061. const resetIsScrolling = () => {
  36062. states.value.isScrolling = false;
  36063. vue.nextTick(() => {
  36064. getItemStyleCache.value(-1, null, null);
  36065. });
  36066. };
  36067. vue.onMounted(() => {
  36068. if (!isClient)
  36069. return;
  36070. const { initScrollLeft, initScrollTop } = props;
  36071. const windowElement = vue.unref(windowRef);
  36072. if (windowElement) {
  36073. if (isNumber(initScrollLeft)) {
  36074. windowElement.scrollLeft = initScrollLeft;
  36075. }
  36076. if (isNumber(initScrollTop)) {
  36077. windowElement.scrollTop = initScrollTop;
  36078. }
  36079. }
  36080. emitEvents();
  36081. });
  36082. const onUpdated = () => {
  36083. const { direction } = props;
  36084. const { scrollLeft, scrollTop, updateRequested } = vue.unref(states);
  36085. const windowElement = vue.unref(windowRef);
  36086. if (updateRequested && windowElement) {
  36087. if (direction === RTL) {
  36088. switch (getRTLOffsetType()) {
  36089. case RTL_OFFSET_NAG: {
  36090. windowElement.scrollLeft = -scrollLeft;
  36091. break;
  36092. }
  36093. case RTL_OFFSET_POS_ASC: {
  36094. windowElement.scrollLeft = scrollLeft;
  36095. break;
  36096. }
  36097. default: {
  36098. const { clientWidth, scrollWidth } = windowElement;
  36099. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  36100. break;
  36101. }
  36102. }
  36103. } else {
  36104. windowElement.scrollLeft = Math.max(0, scrollLeft);
  36105. }
  36106. windowElement.scrollTop = Math.max(0, scrollTop);
  36107. }
  36108. };
  36109. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  36110. expose({
  36111. windowRef,
  36112. innerRef,
  36113. getItemStyleCache,
  36114. scrollTo,
  36115. scrollToItem,
  36116. states,
  36117. resetAfterColumnIndex,
  36118. resetAfterRowIndex,
  36119. resetAfter
  36120. });
  36121. const renderScrollbars = () => {
  36122. const {
  36123. scrollbarAlwaysOn,
  36124. scrollbarStartGap,
  36125. scrollbarEndGap,
  36126. totalColumn,
  36127. totalRow
  36128. } = props;
  36129. const width = vue.unref(parsedWidth);
  36130. const height = vue.unref(parsedHeight);
  36131. const estimatedWidth = vue.unref(estimatedTotalWidth);
  36132. const estimatedHeight = vue.unref(estimatedTotalHeight);
  36133. const { scrollLeft, scrollTop } = vue.unref(states);
  36134. const horizontalScrollbar = vue.h(Scrollbar, {
  36135. ref: hScrollbar,
  36136. alwaysOn: scrollbarAlwaysOn,
  36137. startGap: scrollbarStartGap,
  36138. endGap: scrollbarEndGap,
  36139. class: ns.e("horizontal"),
  36140. clientSize: width,
  36141. layout: "horizontal",
  36142. onScroll: onHorizontalScroll,
  36143. ratio: width * 100 / estimatedWidth,
  36144. scrollFrom: scrollLeft / (estimatedWidth - width),
  36145. total: totalRow,
  36146. visible: true
  36147. });
  36148. const verticalScrollbar = vue.h(Scrollbar, {
  36149. ref: vScrollbar,
  36150. alwaysOn: scrollbarAlwaysOn,
  36151. startGap: scrollbarStartGap,
  36152. endGap: scrollbarEndGap,
  36153. class: ns.e("vertical"),
  36154. clientSize: height,
  36155. layout: "vertical",
  36156. onScroll: onVerticalScroll,
  36157. ratio: height * 100 / estimatedHeight,
  36158. scrollFrom: scrollTop / (estimatedHeight - height),
  36159. total: totalColumn,
  36160. visible: true
  36161. });
  36162. return {
  36163. horizontalScrollbar,
  36164. verticalScrollbar
  36165. };
  36166. };
  36167. const renderItems = () => {
  36168. var _a;
  36169. const [columnStart, columnEnd] = vue.unref(columnsToRender);
  36170. const [rowStart, rowEnd] = vue.unref(rowsToRender);
  36171. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  36172. const children = [];
  36173. if (totalRow > 0 && totalColumn > 0) {
  36174. for (let row = rowStart; row <= rowEnd; row++) {
  36175. for (let column = columnStart; column <= columnEnd; column++) {
  36176. children.push((_a = slots.default) == null ? void 0 : _a.call(slots, {
  36177. columnIndex: column,
  36178. data,
  36179. key: itemKey({ columnIndex: column, data, rowIndex: row }),
  36180. isScrolling: useIsScrolling ? vue.unref(states).isScrolling : void 0,
  36181. style: getItemStyle(row, column),
  36182. rowIndex: row
  36183. }));
  36184. }
  36185. }
  36186. }
  36187. return children;
  36188. };
  36189. const renderInner = () => {
  36190. const Inner = vue.resolveDynamicComponent(props.innerElement);
  36191. const children = renderItems();
  36192. return [
  36193. vue.h(Inner, {
  36194. style: vue.unref(innerStyle),
  36195. ref: innerRef
  36196. }, !isString(Inner) ? {
  36197. default: () => children
  36198. } : children)
  36199. ];
  36200. };
  36201. const renderWindow = () => {
  36202. const Container = vue.resolveDynamicComponent(props.containerElement);
  36203. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  36204. const Inner = renderInner();
  36205. return vue.h("div", {
  36206. key: 0,
  36207. class: ns.e("wrapper")
  36208. }, [
  36209. vue.h(Container, {
  36210. class: props.className,
  36211. style: vue.unref(windowStyle),
  36212. onScroll,
  36213. onWheel,
  36214. ref: windowRef
  36215. }, !isString(Container) ? { default: () => Inner } : Inner),
  36216. horizontalScrollbar,
  36217. verticalScrollbar
  36218. ]);
  36219. };
  36220. return renderWindow;
  36221. }
  36222. });
  36223. };
  36224. var createGrid$1 = createGrid;
  36225. const FixedSizeGrid = createGrid$1({
  36226. name: "ElFixedSizeGrid",
  36227. getColumnPosition: ({ columnWidth }, index) => [
  36228. columnWidth,
  36229. index * columnWidth
  36230. ],
  36231. getRowPosition: ({ rowHeight }, index) => [
  36232. rowHeight,
  36233. index * rowHeight
  36234. ],
  36235. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  36236. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  36237. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  36238. width = Number(width);
  36239. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  36240. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  36241. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  36242. if (alignment === "smart") {
  36243. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  36244. alignment = AUTO_ALIGNMENT;
  36245. } else {
  36246. alignment = CENTERED_ALIGNMENT;
  36247. }
  36248. }
  36249. switch (alignment) {
  36250. case START_ALIGNMENT:
  36251. return maxOffset;
  36252. case END_ALIGNMENT:
  36253. return minOffset;
  36254. case CENTERED_ALIGNMENT: {
  36255. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  36256. if (middleOffset < Math.ceil(width / 2)) {
  36257. return 0;
  36258. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  36259. return lastColumnOffset;
  36260. } else {
  36261. return middleOffset;
  36262. }
  36263. }
  36264. case AUTO_ALIGNMENT:
  36265. default:
  36266. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  36267. return scrollLeft;
  36268. } else if (minOffset > maxOffset) {
  36269. return minOffset;
  36270. } else if (scrollLeft < minOffset) {
  36271. return minOffset;
  36272. } else {
  36273. return maxOffset;
  36274. }
  36275. }
  36276. },
  36277. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  36278. height = Number(height);
  36279. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  36280. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  36281. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  36282. if (align === SMART_ALIGNMENT) {
  36283. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  36284. align = AUTO_ALIGNMENT;
  36285. } else {
  36286. align = CENTERED_ALIGNMENT;
  36287. }
  36288. }
  36289. switch (align) {
  36290. case START_ALIGNMENT:
  36291. return maxOffset;
  36292. case END_ALIGNMENT:
  36293. return minOffset;
  36294. case CENTERED_ALIGNMENT: {
  36295. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  36296. if (middleOffset < Math.ceil(height / 2)) {
  36297. return 0;
  36298. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  36299. return lastRowOffset;
  36300. } else {
  36301. return middleOffset;
  36302. }
  36303. }
  36304. case AUTO_ALIGNMENT:
  36305. default:
  36306. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  36307. return scrollTop;
  36308. } else if (minOffset > maxOffset) {
  36309. return minOffset;
  36310. } else if (scrollTop < minOffset) {
  36311. return minOffset;
  36312. } else {
  36313. return maxOffset;
  36314. }
  36315. }
  36316. },
  36317. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  36318. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  36319. const left = startIndex * columnWidth;
  36320. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  36321. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  36322. },
  36323. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  36324. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  36325. const top = startIndex * rowHeight;
  36326. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  36327. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  36328. },
  36329. initCache: () => void 0,
  36330. clearCache: true,
  36331. validateProps: ({ columnWidth, rowHeight }) => {
  36332. }
  36333. });
  36334. var FixedSizeGrid$1 = FixedSizeGrid;
  36335. const { max, min, floor } = Math;
  36336. const ACCESS_SIZER_KEY_MAP = {
  36337. column: "columnWidth",
  36338. row: "rowHeight"
  36339. };
  36340. const ACCESS_LAST_VISITED_KEY_MAP = {
  36341. column: "lastVisitedColumnIndex",
  36342. row: "lastVisitedRowIndex"
  36343. };
  36344. const getItemFromCache = (props, index, gridCache, type) => {
  36345. const [cachedItems, sizer, lastVisited] = [
  36346. gridCache[type],
  36347. props[ACCESS_SIZER_KEY_MAP[type]],
  36348. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  36349. ];
  36350. if (index > lastVisited) {
  36351. let offset = 0;
  36352. if (lastVisited >= 0) {
  36353. const item = cachedItems[lastVisited];
  36354. offset = item.offset + item.size;
  36355. }
  36356. for (let i = lastVisited + 1; i <= index; i++) {
  36357. const size = sizer(i);
  36358. cachedItems[i] = {
  36359. offset,
  36360. size
  36361. };
  36362. offset += size;
  36363. }
  36364. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  36365. }
  36366. return cachedItems[index];
  36367. };
  36368. const bs = (props, gridCache, low, high, offset, type) => {
  36369. while (low <= high) {
  36370. const mid = low + floor((high - low) / 2);
  36371. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  36372. if (currentOffset === offset) {
  36373. return mid;
  36374. } else if (currentOffset < offset) {
  36375. low = mid + 1;
  36376. } else {
  36377. high = mid - 1;
  36378. }
  36379. }
  36380. return max(0, low - 1);
  36381. };
  36382. const es = (props, gridCache, idx, offset, type) => {
  36383. const total = type === "column" ? props.totalColumn : props.totalRow;
  36384. let exponent = 1;
  36385. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  36386. idx += exponent;
  36387. exponent *= 2;
  36388. }
  36389. return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type);
  36390. };
  36391. const findItem = (props, gridCache, offset, type) => {
  36392. const [cache, lastVisitedIndex] = [
  36393. gridCache[type],
  36394. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  36395. ];
  36396. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0;
  36397. if (lastVisitedItemOffset >= offset) {
  36398. return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  36399. }
  36400. return es(props, gridCache, max(0, lastVisitedIndex), offset, type);
  36401. };
  36402. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  36403. let sizeOfVisitedRows = 0;
  36404. if (lastVisitedRowIndex >= totalRow) {
  36405. lastVisitedRowIndex = totalRow - 1;
  36406. }
  36407. if (lastVisitedRowIndex >= 0) {
  36408. const item = row[lastVisitedRowIndex];
  36409. sizeOfVisitedRows = item.offset + item.size;
  36410. }
  36411. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  36412. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  36413. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  36414. };
  36415. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  36416. let sizeOfVisitedColumns = 0;
  36417. if (lastVisitedColumnIndex > totalColumn) {
  36418. lastVisitedColumnIndex = totalColumn - 1;
  36419. }
  36420. if (lastVisitedColumnIndex >= 0) {
  36421. const item = column[lastVisitedColumnIndex];
  36422. sizeOfVisitedColumns = item.offset + item.size;
  36423. }
  36424. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  36425. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  36426. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  36427. };
  36428. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  36429. column: getEstimatedTotalWidth,
  36430. row: getEstimatedTotalHeight
  36431. };
  36432. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  36433. const [size, estimatedSizeAssociates] = [
  36434. type === "row" ? props.height : props.width,
  36435. ACCESS_ESTIMATED_SIZE_KEY_MAP[type]
  36436. ];
  36437. const item = getItemFromCache(props, index, cache, type);
  36438. const estimatedSize = estimatedSizeAssociates(props, cache);
  36439. const maxOffset = max(0, min(estimatedSize - size, item.offset));
  36440. const minOffset = max(0, item.offset - size + scrollBarWidth + item.size);
  36441. if (alignment === SMART_ALIGNMENT) {
  36442. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  36443. alignment = AUTO_ALIGNMENT;
  36444. } else {
  36445. alignment = CENTERED_ALIGNMENT;
  36446. }
  36447. }
  36448. switch (alignment) {
  36449. case START_ALIGNMENT: {
  36450. return maxOffset;
  36451. }
  36452. case END_ALIGNMENT: {
  36453. return minOffset;
  36454. }
  36455. case CENTERED_ALIGNMENT: {
  36456. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  36457. }
  36458. case AUTO_ALIGNMENT:
  36459. default: {
  36460. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  36461. return scrollOffset;
  36462. } else if (minOffset > maxOffset) {
  36463. return minOffset;
  36464. } else if (scrollOffset < minOffset) {
  36465. return minOffset;
  36466. } else {
  36467. return maxOffset;
  36468. }
  36469. }
  36470. }
  36471. };
  36472. const DynamicSizeGrid = createGrid$1({
  36473. name: "ElDynamicSizeGrid",
  36474. getColumnPosition: (props, idx, cache) => {
  36475. const item = getItemFromCache(props, idx, cache, "column");
  36476. return [item.size, item.offset];
  36477. },
  36478. getRowPosition: (props, idx, cache) => {
  36479. const item = getItemFromCache(props, idx, cache, "row");
  36480. return [item.size, item.offset];
  36481. },
  36482. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  36483. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  36484. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  36485. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  36486. const item = getItemFromCache(props, startIndex, cache, "column");
  36487. const maxOffset = scrollLeft + props.width;
  36488. let offset = item.offset + item.size;
  36489. let stopIndex = startIndex;
  36490. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  36491. stopIndex++;
  36492. offset += getItemFromCache(props, startIndex, cache, "column").size;
  36493. }
  36494. return stopIndex;
  36495. },
  36496. getEstimatedTotalHeight,
  36497. getEstimatedTotalWidth,
  36498. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  36499. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  36500. const { totalRow, height } = props;
  36501. const item = getItemFromCache(props, startIndex, cache, "row");
  36502. const maxOffset = scrollTop + height;
  36503. let offset = item.size + item.offset;
  36504. let stopIndex = startIndex;
  36505. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  36506. stopIndex++;
  36507. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  36508. }
  36509. return stopIndex;
  36510. },
  36511. injectToInstance: (instance, cache) => {
  36512. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  36513. var _a, _b;
  36514. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  36515. if (isNumber(columnIndex)) {
  36516. cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  36517. }
  36518. if (isNumber(rowIndex)) {
  36519. cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  36520. }
  36521. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null);
  36522. if (forceUpdate)
  36523. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  36524. };
  36525. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  36526. resetAfter({
  36527. columnIndex
  36528. }, forceUpdate);
  36529. };
  36530. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  36531. resetAfter({
  36532. rowIndex
  36533. }, forceUpdate);
  36534. };
  36535. Object.assign(instance.proxy, {
  36536. resetAfterColumnIndex,
  36537. resetAfterRowIndex,
  36538. resetAfter
  36539. });
  36540. },
  36541. initCache: ({
  36542. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  36543. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  36544. }) => {
  36545. const cache = {
  36546. column: {},
  36547. estimatedColumnWidth,
  36548. estimatedRowHeight,
  36549. lastVisitedColumnIndex: -1,
  36550. lastVisitedRowIndex: -1,
  36551. row: {}
  36552. };
  36553. return cache;
  36554. },
  36555. clearCache: false,
  36556. validateProps: ({ columnWidth, rowHeight }) => {
  36557. }
  36558. });
  36559. var DynamicSizeGrid$1 = DynamicSizeGrid;
  36560. const _sfc_main$A = vue.defineComponent({
  36561. props: {
  36562. item: {
  36563. type: Object,
  36564. required: true
  36565. },
  36566. style: Object,
  36567. height: Number
  36568. },
  36569. setup() {
  36570. const ns = useNamespace("select");
  36571. return {
  36572. ns
  36573. };
  36574. }
  36575. });
  36576. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  36577. return _ctx.item.isTitle ? (vue.openBlock(), vue.createElementBlock("div", {
  36578. key: 0,
  36579. class: vue.normalizeClass(_ctx.ns.be("group", "title")),
  36580. style: vue.normalizeStyle([_ctx.style, { lineHeight: `${_ctx.height}px` }])
  36581. }, vue.toDisplayString(_ctx.item.label), 7)) : (vue.openBlock(), vue.createElementBlock("div", {
  36582. key: 1,
  36583. class: vue.normalizeClass(_ctx.ns.be("group", "split")),
  36584. style: vue.normalizeStyle(_ctx.style)
  36585. }, [
  36586. vue.createElementVNode("span", {
  36587. class: vue.normalizeClass(_ctx.ns.be("group", "split-dash")),
  36588. style: vue.normalizeStyle({ top: `${_ctx.height / 2}px` })
  36589. }, null, 6)
  36590. ], 6));
  36591. }
  36592. var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$7], ["__file", "group-item.vue"]]);
  36593. function useOption(props, { emit }) {
  36594. return {
  36595. hoverItem: () => {
  36596. if (!props.disabled) {
  36597. emit("hover", props.index);
  36598. }
  36599. },
  36600. selectOptionClick: () => {
  36601. if (!props.disabled) {
  36602. emit("select", props.item, props.index);
  36603. }
  36604. }
  36605. };
  36606. }
  36607. const SelectProps = {
  36608. allowCreate: Boolean,
  36609. autocomplete: {
  36610. type: String,
  36611. default: "none"
  36612. },
  36613. automaticDropdown: Boolean,
  36614. clearable: Boolean,
  36615. clearIcon: {
  36616. type: [String, Object],
  36617. default: circle_close_default
  36618. },
  36619. effect: {
  36620. type: String,
  36621. default: "light"
  36622. },
  36623. collapseTags: Boolean,
  36624. collapseTagsTooltip: {
  36625. type: Boolean,
  36626. default: false
  36627. },
  36628. defaultFirstOption: Boolean,
  36629. disabled: Boolean,
  36630. estimatedOptionHeight: {
  36631. type: Number,
  36632. default: void 0
  36633. },
  36634. filterable: Boolean,
  36635. filterMethod: Function,
  36636. height: {
  36637. type: Number,
  36638. default: 170
  36639. },
  36640. itemHeight: {
  36641. type: Number,
  36642. default: 34
  36643. },
  36644. id: String,
  36645. loading: Boolean,
  36646. loadingText: String,
  36647. label: String,
  36648. modelValue: [Array, String, Number, Boolean, Object],
  36649. multiple: Boolean,
  36650. multipleLimit: {
  36651. type: Number,
  36652. default: 0
  36653. },
  36654. name: String,
  36655. noDataText: String,
  36656. noMatchText: String,
  36657. remoteMethod: Function,
  36658. reserveKeyword: {
  36659. type: Boolean,
  36660. default: true
  36661. },
  36662. options: {
  36663. type: Array,
  36664. required: true
  36665. },
  36666. placeholder: {
  36667. type: String
  36668. },
  36669. teleported: useTooltipContentProps.teleported,
  36670. persistent: {
  36671. type: Boolean,
  36672. default: true
  36673. },
  36674. popperClass: {
  36675. type: String,
  36676. default: ""
  36677. },
  36678. popperOptions: {
  36679. type: Object,
  36680. default: () => ({})
  36681. },
  36682. remote: Boolean,
  36683. size: {
  36684. type: String,
  36685. validator: isValidComponentSize
  36686. },
  36687. valueKey: {
  36688. type: String,
  36689. default: "value"
  36690. },
  36691. scrollbarAlwaysOn: {
  36692. type: Boolean,
  36693. default: false
  36694. },
  36695. validateEvent: {
  36696. type: Boolean,
  36697. default: true
  36698. },
  36699. placement: {
  36700. type: definePropType(String),
  36701. values: Ee,
  36702. default: "bottom-start"
  36703. }
  36704. };
  36705. const OptionProps = {
  36706. data: Array,
  36707. disabled: Boolean,
  36708. hovering: Boolean,
  36709. item: Object,
  36710. index: Number,
  36711. style: Object,
  36712. selected: Boolean,
  36713. created: Boolean
  36714. };
  36715. const _sfc_main$z = vue.defineComponent({
  36716. props: OptionProps,
  36717. emits: ["select", "hover"],
  36718. setup(props, { emit }) {
  36719. const ns = useNamespace("select");
  36720. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  36721. return {
  36722. ns,
  36723. hoverItem,
  36724. selectOptionClick
  36725. };
  36726. }
  36727. });
  36728. const _hoisted_1$h = ["aria-selected"];
  36729. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  36730. return vue.openBlock(), vue.createElementBlock("li", {
  36731. "aria-selected": _ctx.selected,
  36732. style: vue.normalizeStyle(_ctx.style),
  36733. class: vue.normalizeClass([
  36734. _ctx.ns.be("dropdown", "option-item"),
  36735. _ctx.ns.is("selected", _ctx.selected),
  36736. _ctx.ns.is("disabled", _ctx.disabled),
  36737. _ctx.ns.is("created", _ctx.created),
  36738. { hover: _ctx.hovering }
  36739. ]),
  36740. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  36741. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  36742. }, [
  36743. vue.renderSlot(_ctx.$slots, "default", {
  36744. item: _ctx.item,
  36745. index: _ctx.index,
  36746. disabled: _ctx.disabled
  36747. }, () => [
  36748. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.item.label), 1)
  36749. ])
  36750. ], 46, _hoisted_1$h);
  36751. }
  36752. var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$6], ["__file", "option-item.vue"]]);
  36753. const selectV2InjectionKey = "ElSelectV2Injection";
  36754. var ElSelectMenu = vue.defineComponent({
  36755. name: "ElSelectDropdown",
  36756. props: {
  36757. data: {
  36758. type: Array,
  36759. required: true
  36760. },
  36761. hoveringIndex: Number,
  36762. width: Number
  36763. },
  36764. setup(props, {
  36765. slots,
  36766. expose
  36767. }) {
  36768. const select = vue.inject(selectV2InjectionKey);
  36769. const ns = useNamespace("select");
  36770. const cachedHeights = vue.ref([]);
  36771. const listRef = vue.ref();
  36772. const size = vue.computed(() => props.data.length);
  36773. vue.watch(() => size.value, () => {
  36774. var _a, _b;
  36775. (_b = (_a = select.popper.value).updatePopper) == null ? void 0 : _b.call(_a);
  36776. });
  36777. const isSized = vue.computed(() => isUndefined(select.props.estimatedOptionHeight));
  36778. const listProps = vue.computed(() => {
  36779. if (isSized.value) {
  36780. return {
  36781. itemSize: select.props.itemHeight
  36782. };
  36783. }
  36784. return {
  36785. estimatedSize: select.props.estimatedOptionHeight,
  36786. itemSize: (idx) => cachedHeights.value[idx]
  36787. };
  36788. });
  36789. const contains = (arr = [], target) => {
  36790. const {
  36791. props: {
  36792. valueKey
  36793. }
  36794. } = select;
  36795. if (!isObject$1(target)) {
  36796. return arr.includes(target);
  36797. }
  36798. return arr && arr.some((item) => {
  36799. return get(item, valueKey) === get(target, valueKey);
  36800. });
  36801. };
  36802. const isEqual = (selected, target) => {
  36803. if (!isObject$1(target)) {
  36804. return selected === target;
  36805. } else {
  36806. const {
  36807. valueKey
  36808. } = select.props;
  36809. return get(selected, valueKey) === get(target, valueKey);
  36810. }
  36811. };
  36812. const isItemSelected = (modelValue, target) => {
  36813. const {
  36814. valueKey
  36815. } = select.props;
  36816. if (select.props.multiple) {
  36817. return contains(modelValue, get(target, valueKey));
  36818. }
  36819. return isEqual(modelValue, get(target, valueKey));
  36820. };
  36821. const isItemDisabled = (modelValue, selected) => {
  36822. const {
  36823. disabled,
  36824. multiple,
  36825. multipleLimit
  36826. } = select.props;
  36827. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  36828. };
  36829. const isItemHovering = (target) => props.hoveringIndex === target;
  36830. const scrollToItem = (index) => {
  36831. const list = listRef.value;
  36832. if (list) {
  36833. list.scrollToItem(index);
  36834. }
  36835. };
  36836. const resetScrollTop = () => {
  36837. const list = listRef.value;
  36838. if (list) {
  36839. list.resetScrollTop();
  36840. }
  36841. };
  36842. expose({
  36843. listRef,
  36844. isSized,
  36845. isItemDisabled,
  36846. isItemHovering,
  36847. isItemSelected,
  36848. scrollToItem,
  36849. resetScrollTop
  36850. });
  36851. const Item = (itemProps) => {
  36852. const {
  36853. index,
  36854. data,
  36855. style
  36856. } = itemProps;
  36857. const sized = vue.unref(isSized);
  36858. const {
  36859. itemSize,
  36860. estimatedSize
  36861. } = vue.unref(listProps);
  36862. const {
  36863. modelValue
  36864. } = select.props;
  36865. const {
  36866. onSelect,
  36867. onHover
  36868. } = select;
  36869. const item = data[index];
  36870. if (item.type === "Group") {
  36871. return vue.createVNode(GroupItem, {
  36872. "item": item,
  36873. "style": style,
  36874. "height": sized ? itemSize : estimatedSize
  36875. }, null);
  36876. }
  36877. const isSelected = isItemSelected(modelValue, item);
  36878. const isDisabled = isItemDisabled(modelValue, isSelected);
  36879. const isHovering = isItemHovering(index);
  36880. return vue.createVNode(OptionItem, vue.mergeProps(itemProps, {
  36881. "selected": isSelected,
  36882. "disabled": item.disabled || isDisabled,
  36883. "created": !!item.created,
  36884. "hovering": isHovering,
  36885. "item": item,
  36886. "onSelect": onSelect,
  36887. "onHover": onHover
  36888. }), {
  36889. default: (props2) => {
  36890. var _a;
  36891. return ((_a = slots.default) == null ? void 0 : _a.call(slots, props2)) || vue.createVNode("span", null, [item.label]);
  36892. }
  36893. });
  36894. };
  36895. const {
  36896. onKeyboardNavigate,
  36897. onKeyboardSelect
  36898. } = select;
  36899. const onForward = () => {
  36900. onKeyboardNavigate("forward");
  36901. };
  36902. const onBackward = () => {
  36903. onKeyboardNavigate("backward");
  36904. };
  36905. const onEscOrTab = () => {
  36906. select.expanded = false;
  36907. };
  36908. const onKeydown = (e) => {
  36909. const {
  36910. code
  36911. } = e;
  36912. const {
  36913. tab,
  36914. esc,
  36915. down,
  36916. up,
  36917. enter
  36918. } = EVENT_CODE;
  36919. if (code !== tab) {
  36920. e.preventDefault();
  36921. e.stopPropagation();
  36922. }
  36923. switch (code) {
  36924. case tab:
  36925. case esc: {
  36926. onEscOrTab();
  36927. break;
  36928. }
  36929. case down: {
  36930. onForward();
  36931. break;
  36932. }
  36933. case up: {
  36934. onBackward();
  36935. break;
  36936. }
  36937. case enter: {
  36938. onKeyboardSelect();
  36939. break;
  36940. }
  36941. }
  36942. };
  36943. return () => {
  36944. var _a;
  36945. const {
  36946. data,
  36947. width
  36948. } = props;
  36949. const {
  36950. height,
  36951. multiple,
  36952. scrollbarAlwaysOn
  36953. } = select.props;
  36954. if (data.length === 0) {
  36955. return vue.createVNode("div", {
  36956. "class": ns.b("dropdown"),
  36957. "style": {
  36958. width: `${width}px`
  36959. }
  36960. }, [(_a = slots.empty) == null ? void 0 : _a.call(slots)]);
  36961. }
  36962. const List = vue.unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1;
  36963. return vue.createVNode("div", {
  36964. "class": [ns.b("dropdown"), ns.is("multiple", multiple)]
  36965. }, [vue.createVNode(List, vue.mergeProps({
  36966. "ref": listRef
  36967. }, vue.unref(listProps), {
  36968. "className": ns.be("dropdown", "list"),
  36969. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  36970. "data": data,
  36971. "height": height,
  36972. "width": width,
  36973. "total": data.length,
  36974. "onKeydown": onKeydown
  36975. }), {
  36976. default: (props2) => vue.createVNode(Item, props2, null)
  36977. })]);
  36978. };
  36979. }
  36980. });
  36981. function useAllowCreate(props, states) {
  36982. const createOptionCount = vue.ref(0);
  36983. const cachedSelectedOption = vue.ref(null);
  36984. const enableAllowCreateMode = vue.computed(() => {
  36985. return props.allowCreate && props.filterable;
  36986. });
  36987. function hasExistingOption(query) {
  36988. const hasValue = (option) => option.value === query;
  36989. return props.options && props.options.some(hasValue) || states.createdOptions.some(hasValue);
  36990. }
  36991. function selectNewOption(option) {
  36992. if (!enableAllowCreateMode.value) {
  36993. return;
  36994. }
  36995. if (props.multiple && option.created) {
  36996. createOptionCount.value++;
  36997. } else {
  36998. cachedSelectedOption.value = option;
  36999. }
  37000. }
  37001. function createNewOption(query) {
  37002. if (enableAllowCreateMode.value) {
  37003. if (query && query.length > 0 && !hasExistingOption(query)) {
  37004. const newOption = {
  37005. value: query,
  37006. label: query,
  37007. created: true,
  37008. disabled: false
  37009. };
  37010. if (states.createdOptions.length >= createOptionCount.value) {
  37011. states.createdOptions[createOptionCount.value] = newOption;
  37012. } else {
  37013. states.createdOptions.push(newOption);
  37014. }
  37015. } else {
  37016. if (props.multiple) {
  37017. states.createdOptions.length = createOptionCount.value;
  37018. } else {
  37019. const selectedOption = cachedSelectedOption.value;
  37020. states.createdOptions.length = 0;
  37021. if (selectedOption && selectedOption.created) {
  37022. states.createdOptions.push(selectedOption);
  37023. }
  37024. }
  37025. }
  37026. }
  37027. }
  37028. function removeNewOption(option) {
  37029. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === option.label) {
  37030. return;
  37031. }
  37032. const idx = states.createdOptions.findIndex((it) => it.value === option.value);
  37033. if (~idx) {
  37034. states.createdOptions.splice(idx, 1);
  37035. createOptionCount.value--;
  37036. }
  37037. }
  37038. function clearAllNewOption() {
  37039. if (enableAllowCreateMode.value) {
  37040. states.createdOptions.length = 0;
  37041. createOptionCount.value = 0;
  37042. }
  37043. }
  37044. return {
  37045. createNewOption,
  37046. removeNewOption,
  37047. selectNewOption,
  37048. clearAllNewOption
  37049. };
  37050. }
  37051. const flattenOptions = (options) => {
  37052. const flattened = [];
  37053. options.forEach((option) => {
  37054. if (isArray(option.options)) {
  37055. flattened.push({
  37056. label: option.label,
  37057. isTitle: true,
  37058. type: "Group"
  37059. });
  37060. option.options.forEach((o) => {
  37061. flattened.push(o);
  37062. });
  37063. flattened.push({
  37064. type: "Group"
  37065. });
  37066. } else {
  37067. flattened.push(option);
  37068. }
  37069. });
  37070. return flattened;
  37071. };
  37072. function useInput(handleInput) {
  37073. const isComposing = vue.ref(false);
  37074. const handleCompositionStart = () => {
  37075. isComposing.value = true;
  37076. };
  37077. const handleCompositionUpdate = (event) => {
  37078. const text = event.target.value;
  37079. const lastCharacter = text[text.length - 1] || "";
  37080. isComposing.value = !isKorean(lastCharacter);
  37081. };
  37082. const handleCompositionEnd = (event) => {
  37083. if (isComposing.value) {
  37084. isComposing.value = false;
  37085. if (isFunction(handleInput)) {
  37086. handleInput(event);
  37087. }
  37088. }
  37089. };
  37090. return {
  37091. handleCompositionStart,
  37092. handleCompositionUpdate,
  37093. handleCompositionEnd
  37094. };
  37095. }
  37096. const DEFAULT_INPUT_PLACEHOLDER = "";
  37097. const MINIMUM_INPUT_WIDTH = 11;
  37098. const TAG_BASE_WIDTH = {
  37099. larget: 51,
  37100. default: 42,
  37101. small: 33
  37102. };
  37103. const useSelect$1 = (props, emit) => {
  37104. const { t } = useLocale();
  37105. const nsSelectV2 = useNamespace("select-v2");
  37106. const nsInput = useNamespace("input");
  37107. const { form: elForm, formItem: elFormItem } = useFormItem();
  37108. const states = vue.reactive({
  37109. inputValue: DEFAULT_INPUT_PLACEHOLDER,
  37110. displayInputValue: DEFAULT_INPUT_PLACEHOLDER,
  37111. calculatedWidth: 0,
  37112. cachedPlaceholder: "",
  37113. cachedOptions: [],
  37114. createdOptions: [],
  37115. createdLabel: "",
  37116. createdSelected: false,
  37117. currentPlaceholder: "",
  37118. hoveringIndex: -1,
  37119. comboBoxHovering: false,
  37120. isOnComposition: false,
  37121. isSilentBlur: false,
  37122. isComposing: false,
  37123. inputLength: 20,
  37124. selectWidth: 200,
  37125. initialInputHeight: 0,
  37126. previousQuery: null,
  37127. previousValue: void 0,
  37128. query: "",
  37129. selectedLabel: "",
  37130. softFocus: false,
  37131. tagInMultiLine: false
  37132. });
  37133. const selectedIndex = vue.ref(-1);
  37134. const popperSize = vue.ref(-1);
  37135. const controlRef = vue.ref(null);
  37136. const inputRef = vue.ref(null);
  37137. const menuRef = vue.ref(null);
  37138. const popper = vue.ref(null);
  37139. const selectRef = vue.ref(null);
  37140. const selectionRef = vue.ref(null);
  37141. const calculatorRef = vue.ref(null);
  37142. const expanded = vue.ref(false);
  37143. const selectDisabled = vue.computed(() => props.disabled || (elForm == null ? void 0 : elForm.disabled));
  37144. const popupHeight = vue.computed(() => {
  37145. const totalHeight = filteredOptions.value.length * 34;
  37146. return totalHeight > props.height ? props.height : totalHeight;
  37147. });
  37148. const hasModelValue = vue.computed(() => {
  37149. return !isNil(props.modelValue);
  37150. });
  37151. const showClearBtn = vue.computed(() => {
  37152. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : hasModelValue.value;
  37153. const criteria = props.clearable && !selectDisabled.value && states.comboBoxHovering && hasValue;
  37154. return criteria;
  37155. });
  37156. const iconComponent = vue.computed(() => props.remote && props.filterable ? "" : arrow_up_default);
  37157. const iconReverse = vue.computed(() => iconComponent.value && nsSelectV2.is("reverse", expanded.value));
  37158. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  37159. const validateIcon = vue.computed(() => ValidateComponentsMap[validateState.value]);
  37160. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  37161. const emptyText = vue.computed(() => {
  37162. const options = filteredOptions.value;
  37163. if (props.loading) {
  37164. return props.loadingText || t("el.select.loading");
  37165. } else {
  37166. if (props.remote && states.inputValue === "" && options.length === 0)
  37167. return false;
  37168. if (props.filterable && states.inputValue && options.length > 0) {
  37169. return props.noMatchText || t("el.select.noMatch");
  37170. }
  37171. if (options.length === 0) {
  37172. return props.noDataText || t("el.select.noData");
  37173. }
  37174. }
  37175. return null;
  37176. });
  37177. const filteredOptions = vue.computed(() => {
  37178. const isValidOption = (o) => {
  37179. const query = states.inputValue;
  37180. const regexp = new RegExp(escapeStringRegexp(query), "i");
  37181. const containsQueryString = query ? regexp.test(o.label || "") : true;
  37182. return containsQueryString;
  37183. };
  37184. if (props.loading) {
  37185. return [];
  37186. }
  37187. return flattenOptions(props.options.concat(states.createdOptions).map((v) => {
  37188. if (isArray(v.options)) {
  37189. const filtered = v.options.filter(isValidOption);
  37190. if (filtered.length > 0) {
  37191. return {
  37192. ...v,
  37193. options: filtered
  37194. };
  37195. }
  37196. } else {
  37197. if (props.remote || isValidOption(v)) {
  37198. return v;
  37199. }
  37200. }
  37201. return null;
  37202. }).filter((v) => v !== null));
  37203. });
  37204. const optionsAllDisabled = vue.computed(() => filteredOptions.value.every((option) => option.disabled));
  37205. const selectSize = useSize();
  37206. const collapseTagSize = vue.computed(() => selectSize.value === "small" ? "small" : "default");
  37207. const tagMaxWidth = vue.computed(() => {
  37208. const select = selectionRef.value;
  37209. const size = collapseTagSize.value || "default";
  37210. const paddingLeft = select ? Number.parseInt(getComputedStyle(select).paddingLeft) : 0;
  37211. const paddingRight = select ? Number.parseInt(getComputedStyle(select).paddingRight) : 0;
  37212. return states.selectWidth - paddingRight - paddingLeft - TAG_BASE_WIDTH[size];
  37213. });
  37214. const calculatePopperSize = () => {
  37215. var _a;
  37216. popperSize.value = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200;
  37217. };
  37218. const inputWrapperStyle = vue.computed(() => {
  37219. return {
  37220. width: `${states.calculatedWidth === 0 ? MINIMUM_INPUT_WIDTH : Math.ceil(states.calculatedWidth) + MINIMUM_INPUT_WIDTH}px`
  37221. };
  37222. });
  37223. const shouldShowPlaceholder = vue.computed(() => {
  37224. if (isArray(props.modelValue)) {
  37225. return props.modelValue.length === 0 && !states.displayInputValue;
  37226. }
  37227. return props.filterable ? states.displayInputValue.length === 0 : true;
  37228. });
  37229. const currentPlaceholder = vue.computed(() => {
  37230. const _placeholder = props.placeholder || t("el.select.placeholder");
  37231. return props.multiple || isNil(props.modelValue) ? _placeholder : states.selectedLabel;
  37232. });
  37233. const popperRef = vue.computed(() => {
  37234. var _a, _b;
  37235. return (_b = (_a = popper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  37236. });
  37237. const indexRef = vue.computed(() => {
  37238. if (props.multiple) {
  37239. const len = props.modelValue.length;
  37240. if (props.modelValue.length > 0) {
  37241. return filteredOptions.value.findIndex((o) => o.value === props.modelValue[len - 1]);
  37242. }
  37243. } else {
  37244. if (props.modelValue) {
  37245. return filteredOptions.value.findIndex((o) => o.value === props.modelValue);
  37246. }
  37247. }
  37248. return -1;
  37249. });
  37250. const dropdownMenuVisible = vue.computed({
  37251. get() {
  37252. return expanded.value && emptyText.value !== false;
  37253. },
  37254. set(val) {
  37255. expanded.value = val;
  37256. }
  37257. });
  37258. const {
  37259. createNewOption,
  37260. removeNewOption,
  37261. selectNewOption,
  37262. clearAllNewOption
  37263. } = useAllowCreate(props, states);
  37264. const {
  37265. handleCompositionStart,
  37266. handleCompositionUpdate,
  37267. handleCompositionEnd
  37268. } = useInput((e) => onInput(e));
  37269. const focusAndUpdatePopup = () => {
  37270. var _a, _b, _c;
  37271. (_b = (_a = inputRef.value).focus) == null ? void 0 : _b.call(_a);
  37272. (_c = popper.value) == null ? void 0 : _c.updatePopper();
  37273. };
  37274. const toggleMenu = () => {
  37275. if (props.automaticDropdown)
  37276. return;
  37277. if (!selectDisabled.value) {
  37278. if (states.isComposing)
  37279. states.softFocus = true;
  37280. return vue.nextTick(() => {
  37281. var _a, _b;
  37282. expanded.value = !expanded.value;
  37283. (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  37284. });
  37285. }
  37286. };
  37287. const onInputChange = () => {
  37288. if (props.filterable && states.inputValue !== states.selectedLabel) {
  37289. states.query = states.selectedLabel;
  37290. }
  37291. handleQueryChange(states.inputValue);
  37292. return vue.nextTick(() => {
  37293. createNewOption(states.inputValue);
  37294. });
  37295. };
  37296. const debouncedOnInputChange = debounce(onInputChange, debounce$1.value);
  37297. const handleQueryChange = (val) => {
  37298. if (states.previousQuery === val) {
  37299. return;
  37300. }
  37301. states.previousQuery = val;
  37302. if (props.filterable && isFunction(props.filterMethod)) {
  37303. props.filterMethod(val);
  37304. } else if (props.filterable && props.remote && isFunction(props.remoteMethod)) {
  37305. props.remoteMethod(val);
  37306. }
  37307. };
  37308. const emitChange = (val) => {
  37309. if (!isEqual$1(props.modelValue, val)) {
  37310. emit(CHANGE_EVENT, val);
  37311. }
  37312. };
  37313. const update = (val) => {
  37314. emit(UPDATE_MODEL_EVENT, val);
  37315. emitChange(val);
  37316. states.previousValue = val == null ? void 0 : val.toString();
  37317. };
  37318. const getValueIndex = (arr = [], value) => {
  37319. if (!isObject$1(value)) {
  37320. return arr.indexOf(value);
  37321. }
  37322. const valueKey = props.valueKey;
  37323. let index = -1;
  37324. arr.some((item, i) => {
  37325. if (get(item, valueKey) === get(value, valueKey)) {
  37326. index = i;
  37327. return true;
  37328. }
  37329. return false;
  37330. });
  37331. return index;
  37332. };
  37333. const getValueKey = (item) => {
  37334. return isObject$1(item) ? get(item, props.valueKey) : item;
  37335. };
  37336. const getLabel = (item) => {
  37337. return isObject$1(item) ? item.label : item;
  37338. };
  37339. const resetInputHeight = () => {
  37340. if (props.collapseTags && !props.filterable) {
  37341. return;
  37342. }
  37343. return vue.nextTick(() => {
  37344. var _a, _b;
  37345. if (!inputRef.value)
  37346. return;
  37347. const selection = selectionRef.value;
  37348. selectRef.value.height = selection.offsetHeight;
  37349. if (expanded.value && emptyText.value !== false) {
  37350. (_b = (_a = popper.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  37351. }
  37352. });
  37353. };
  37354. const handleResize = () => {
  37355. var _a, _b;
  37356. resetInputWidth();
  37357. calculatePopperSize();
  37358. (_b = (_a = popper.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  37359. if (props.multiple) {
  37360. return resetInputHeight();
  37361. }
  37362. };
  37363. const resetInputWidth = () => {
  37364. const select = selectionRef.value;
  37365. if (select) {
  37366. states.selectWidth = select.getBoundingClientRect().width;
  37367. }
  37368. };
  37369. const onSelect = (option, idx, byClick = true) => {
  37370. var _a, _b;
  37371. if (props.multiple) {
  37372. let selectedOptions = props.modelValue.slice();
  37373. const index = getValueIndex(selectedOptions, getValueKey(option));
  37374. if (index > -1) {
  37375. selectedOptions = [
  37376. ...selectedOptions.slice(0, index),
  37377. ...selectedOptions.slice(index + 1)
  37378. ];
  37379. states.cachedOptions.splice(index, 1);
  37380. removeNewOption(option);
  37381. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  37382. selectedOptions = [...selectedOptions, getValueKey(option)];
  37383. states.cachedOptions.push(option);
  37384. selectNewOption(option);
  37385. updateHoveringIndex(idx);
  37386. }
  37387. update(selectedOptions);
  37388. if (option.created) {
  37389. states.query = "";
  37390. handleQueryChange("");
  37391. states.inputLength = 20;
  37392. }
  37393. if (props.filterable && !props.reserveKeyword) {
  37394. (_b = (_a = inputRef.value).focus) == null ? void 0 : _b.call(_a);
  37395. onUpdateInputValue("");
  37396. }
  37397. if (props.filterable) {
  37398. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  37399. }
  37400. resetInputHeight();
  37401. setSoftFocus();
  37402. } else {
  37403. selectedIndex.value = idx;
  37404. states.selectedLabel = option.label;
  37405. update(getValueKey(option));
  37406. expanded.value = false;
  37407. states.isComposing = false;
  37408. states.isSilentBlur = byClick;
  37409. selectNewOption(option);
  37410. if (!option.created) {
  37411. clearAllNewOption();
  37412. }
  37413. updateHoveringIndex(idx);
  37414. }
  37415. };
  37416. const deleteTag = (event, tag) => {
  37417. const { valueKey } = props;
  37418. const index = props.modelValue.indexOf(get(tag, valueKey));
  37419. if (index > -1 && !selectDisabled.value) {
  37420. const value = [
  37421. ...props.modelValue.slice(0, index),
  37422. ...props.modelValue.slice(index + 1)
  37423. ];
  37424. states.cachedOptions.splice(index, 1);
  37425. update(value);
  37426. emit("remove-tag", get(tag, valueKey));
  37427. states.softFocus = true;
  37428. removeNewOption(tag);
  37429. return vue.nextTick(focusAndUpdatePopup);
  37430. }
  37431. event.stopPropagation();
  37432. };
  37433. const handleFocus = (event) => {
  37434. const focused = states.isComposing;
  37435. states.isComposing = true;
  37436. if (!states.softFocus) {
  37437. if (!focused)
  37438. emit("focus", event);
  37439. } else {
  37440. states.softFocus = false;
  37441. }
  37442. };
  37443. const handleBlur = (event) => {
  37444. states.softFocus = false;
  37445. return vue.nextTick(() => {
  37446. var _a, _b;
  37447. (_b = (_a = inputRef.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  37448. if (calculatorRef.value) {
  37449. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  37450. }
  37451. if (states.isSilentBlur) {
  37452. states.isSilentBlur = false;
  37453. } else {
  37454. if (states.isComposing) {
  37455. emit("blur", event);
  37456. }
  37457. }
  37458. states.isComposing = false;
  37459. });
  37460. };
  37461. const handleEsc = () => {
  37462. if (states.displayInputValue.length > 0) {
  37463. onUpdateInputValue("");
  37464. } else {
  37465. expanded.value = false;
  37466. }
  37467. };
  37468. const handleDel = (e) => {
  37469. if (states.displayInputValue.length === 0) {
  37470. e.preventDefault();
  37471. const selected = props.modelValue.slice();
  37472. selected.pop();
  37473. removeNewOption(states.cachedOptions.pop());
  37474. update(selected);
  37475. }
  37476. };
  37477. const handleClear = () => {
  37478. let emptyValue;
  37479. if (isArray(props.modelValue)) {
  37480. emptyValue = [];
  37481. } else {
  37482. emptyValue = void 0;
  37483. }
  37484. states.softFocus = true;
  37485. if (props.multiple) {
  37486. states.cachedOptions = [];
  37487. } else {
  37488. states.selectedLabel = "";
  37489. }
  37490. expanded.value = false;
  37491. update(emptyValue);
  37492. emit("clear");
  37493. clearAllNewOption();
  37494. return vue.nextTick(focusAndUpdatePopup);
  37495. };
  37496. const onUpdateInputValue = (val) => {
  37497. states.displayInputValue = val;
  37498. states.inputValue = val;
  37499. };
  37500. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  37501. const options = filteredOptions.value;
  37502. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value) {
  37503. return;
  37504. }
  37505. if (!expanded.value) {
  37506. return toggleMenu();
  37507. }
  37508. if (hoveringIndex === void 0) {
  37509. hoveringIndex = states.hoveringIndex;
  37510. }
  37511. let newIndex = -1;
  37512. if (direction === "forward") {
  37513. newIndex = hoveringIndex + 1;
  37514. if (newIndex >= options.length) {
  37515. newIndex = 0;
  37516. }
  37517. } else if (direction === "backward") {
  37518. newIndex = hoveringIndex - 1;
  37519. if (newIndex < 0 || newIndex >= options.length) {
  37520. newIndex = options.length - 1;
  37521. }
  37522. }
  37523. const option = options[newIndex];
  37524. if (option.disabled || option.type === "Group") {
  37525. return onKeyboardNavigate(direction, newIndex);
  37526. } else {
  37527. updateHoveringIndex(newIndex);
  37528. scrollToItem(newIndex);
  37529. }
  37530. };
  37531. const onKeyboardSelect = () => {
  37532. if (!expanded.value) {
  37533. return toggleMenu();
  37534. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  37535. onSelect(filteredOptions.value[states.hoveringIndex], states.hoveringIndex, false);
  37536. }
  37537. };
  37538. const updateHoveringIndex = (idx) => {
  37539. states.hoveringIndex = idx;
  37540. };
  37541. const resetHoveringIndex = () => {
  37542. states.hoveringIndex = -1;
  37543. };
  37544. const setSoftFocus = () => {
  37545. var _a;
  37546. const _input = inputRef.value;
  37547. if (_input) {
  37548. (_a = _input.focus) == null ? void 0 : _a.call(_input);
  37549. }
  37550. };
  37551. const onInput = (event) => {
  37552. const value = event.target.value;
  37553. onUpdateInputValue(value);
  37554. if (states.displayInputValue.length > 0 && !expanded.value) {
  37555. expanded.value = true;
  37556. }
  37557. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  37558. if (props.multiple) {
  37559. resetInputHeight();
  37560. }
  37561. if (props.remote) {
  37562. debouncedOnInputChange();
  37563. } else {
  37564. return onInputChange();
  37565. }
  37566. };
  37567. const handleClickOutside = () => {
  37568. expanded.value = false;
  37569. return handleBlur();
  37570. };
  37571. const handleMenuEnter = () => {
  37572. states.inputValue = states.displayInputValue;
  37573. return vue.nextTick(() => {
  37574. if (~indexRef.value) {
  37575. updateHoveringIndex(indexRef.value);
  37576. scrollToItem(states.hoveringIndex);
  37577. }
  37578. });
  37579. };
  37580. const scrollToItem = (index) => {
  37581. menuRef.value.scrollToItem(index);
  37582. };
  37583. const initStates = () => {
  37584. resetHoveringIndex();
  37585. if (props.multiple) {
  37586. if (props.modelValue.length > 0) {
  37587. let initHovering = false;
  37588. states.cachedOptions.length = 0;
  37589. states.previousValue = props.modelValue.toString();
  37590. props.modelValue.forEach((selected) => {
  37591. const itemIndex = filteredOptions.value.findIndex((option) => getValueKey(option) === selected);
  37592. if (~itemIndex) {
  37593. states.cachedOptions.push(filteredOptions.value[itemIndex]);
  37594. if (!initHovering) {
  37595. updateHoveringIndex(itemIndex);
  37596. }
  37597. initHovering = true;
  37598. }
  37599. });
  37600. } else {
  37601. states.cachedOptions = [];
  37602. states.previousValue = void 0;
  37603. }
  37604. } else {
  37605. if (hasModelValue.value) {
  37606. states.previousValue = props.modelValue;
  37607. const options = filteredOptions.value;
  37608. const selectedItemIndex = options.findIndex((option) => getValueKey(option) === getValueKey(props.modelValue));
  37609. if (~selectedItemIndex) {
  37610. states.selectedLabel = options[selectedItemIndex].label;
  37611. updateHoveringIndex(selectedItemIndex);
  37612. } else {
  37613. states.selectedLabel = `${props.modelValue}`;
  37614. }
  37615. } else {
  37616. states.selectedLabel = "";
  37617. states.previousValue = void 0;
  37618. }
  37619. }
  37620. clearAllNewOption();
  37621. calculatePopperSize();
  37622. };
  37623. vue.watch(expanded, (val) => {
  37624. var _a, _b;
  37625. emit("visible-change", val);
  37626. if (val) {
  37627. (_b = (_a = popper.value).update) == null ? void 0 : _b.call(_a);
  37628. } else {
  37629. states.displayInputValue = "";
  37630. states.previousQuery = null;
  37631. createNewOption("");
  37632. }
  37633. });
  37634. vue.watch(() => props.modelValue, (val, oldVal) => {
  37635. var _a;
  37636. if (!val || val.toString() !== states.previousValue) {
  37637. initStates();
  37638. }
  37639. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  37640. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  37641. }
  37642. }, {
  37643. deep: true
  37644. });
  37645. vue.watch(() => props.options, () => {
  37646. const input = inputRef.value;
  37647. if (!input || input && document.activeElement !== input) {
  37648. initStates();
  37649. }
  37650. }, {
  37651. deep: true
  37652. });
  37653. vue.watch(filteredOptions, () => {
  37654. return vue.nextTick(menuRef.value.resetScrollTop);
  37655. });
  37656. vue.onMounted(() => {
  37657. initStates();
  37658. });
  37659. useResizeObserver(selectRef, handleResize);
  37660. return {
  37661. collapseTagSize,
  37662. currentPlaceholder,
  37663. expanded,
  37664. emptyText,
  37665. popupHeight,
  37666. debounce: debounce$1,
  37667. filteredOptions,
  37668. iconComponent,
  37669. iconReverse,
  37670. inputWrapperStyle,
  37671. popperSize,
  37672. dropdownMenuVisible,
  37673. hasModelValue,
  37674. shouldShowPlaceholder,
  37675. selectDisabled,
  37676. selectSize,
  37677. showClearBtn,
  37678. states,
  37679. tagMaxWidth,
  37680. nsSelectV2,
  37681. nsInput,
  37682. calculatorRef,
  37683. controlRef,
  37684. inputRef,
  37685. menuRef,
  37686. popper,
  37687. selectRef,
  37688. selectionRef,
  37689. popperRef,
  37690. validateState,
  37691. validateIcon,
  37692. debouncedOnInputChange,
  37693. deleteTag,
  37694. getLabel,
  37695. getValueKey,
  37696. handleBlur,
  37697. handleClear,
  37698. handleClickOutside,
  37699. handleDel,
  37700. handleEsc,
  37701. handleFocus,
  37702. handleMenuEnter,
  37703. handleResize,
  37704. toggleMenu,
  37705. scrollTo: scrollToItem,
  37706. onInput,
  37707. onKeyboardNavigate,
  37708. onKeyboardSelect,
  37709. onSelect,
  37710. onHover: updateHoveringIndex,
  37711. onUpdateInputValue,
  37712. handleCompositionStart,
  37713. handleCompositionEnd,
  37714. handleCompositionUpdate
  37715. };
  37716. };
  37717. var useSelect$2 = useSelect$1;
  37718. const _sfc_main$y = vue.defineComponent({
  37719. name: "ElSelectV2",
  37720. components: {
  37721. ElSelectMenu,
  37722. ElTag,
  37723. ElTooltip,
  37724. ElIcon
  37725. },
  37726. directives: { ClickOutside, ModelText: vue.vModelText },
  37727. props: SelectProps,
  37728. emits: [
  37729. UPDATE_MODEL_EVENT,
  37730. CHANGE_EVENT,
  37731. "remove-tag",
  37732. "clear",
  37733. "visible-change",
  37734. "focus",
  37735. "blur"
  37736. ],
  37737. setup(props, { emit }) {
  37738. const API = useSelect$2(props, emit);
  37739. vue.provide(selectV2InjectionKey, {
  37740. props: vue.reactive({
  37741. ...vue.toRefs(props),
  37742. height: API.popupHeight
  37743. }),
  37744. popper: API.popper,
  37745. onSelect: API.onSelect,
  37746. onHover: API.onHover,
  37747. onKeyboardNavigate: API.onKeyboardNavigate,
  37748. onKeyboardSelect: API.onKeyboardSelect
  37749. });
  37750. return API;
  37751. }
  37752. });
  37753. const _hoisted_1$g = { key: 0 };
  37754. const _hoisted_2$b = ["id", "autocomplete", "aria-expanded", "aria-labelledby", "disabled", "readonly", "name", "unselectable"];
  37755. const _hoisted_3$5 = ["textContent"];
  37756. const _hoisted_4$3 = ["id", "aria-labelledby", "aria-expanded", "autocomplete", "disabled", "name", "readonly", "unselectable"];
  37757. const _hoisted_5$2 = ["textContent"];
  37758. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  37759. const _component_el_tag = vue.resolveComponent("el-tag");
  37760. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  37761. const _component_el_icon = vue.resolveComponent("el-icon");
  37762. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  37763. const _directive_model_text = vue.resolveDirective("model-text");
  37764. const _directive_click_outside = vue.resolveDirective("click-outside");
  37765. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  37766. ref: "selectRef",
  37767. class: vue.normalizeClass([_ctx.nsSelectV2.b(), _ctx.nsSelectV2.m(_ctx.selectSize)]),
  37768. onClick: _cache[25] || (_cache[25] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"])),
  37769. onMouseenter: _cache[26] || (_cache[26] = ($event) => _ctx.states.comboBoxHovering = true),
  37770. onMouseleave: _cache[27] || (_cache[27] = ($event) => _ctx.states.comboBoxHovering = false)
  37771. }, [
  37772. vue.createVNode(_component_el_tooltip, {
  37773. ref: "popper",
  37774. visible: _ctx.dropdownMenuVisible,
  37775. teleported: _ctx.teleported,
  37776. "popper-class": [_ctx.nsSelectV2.e("popper"), _ctx.popperClass],
  37777. "gpu-acceleration": false,
  37778. "stop-popper-mouse-event": false,
  37779. "popper-options": _ctx.popperOptions,
  37780. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  37781. effect: _ctx.effect,
  37782. placement: _ctx.placement,
  37783. pure: "",
  37784. transition: `${_ctx.nsSelectV2.namespace.value}-zoom-in-top`,
  37785. trigger: "click",
  37786. persistent: _ctx.persistent,
  37787. onBeforeShow: _ctx.handleMenuEnter,
  37788. onHide: _cache[24] || (_cache[24] = ($event) => _ctx.states.inputValue = _ctx.states.displayInputValue)
  37789. }, {
  37790. default: vue.withCtx(() => {
  37791. var _a;
  37792. return [
  37793. vue.createElementVNode("div", {
  37794. ref: "selectionRef",
  37795. class: vue.normalizeClass([
  37796. _ctx.nsSelectV2.e("wrapper"),
  37797. _ctx.nsSelectV2.is("focused", _ctx.states.isComposing || _ctx.expanded),
  37798. _ctx.nsSelectV2.is("hovering", _ctx.states.comboBoxHovering),
  37799. _ctx.nsSelectV2.is("filterable", _ctx.filterable),
  37800. _ctx.nsSelectV2.is("disabled", _ctx.selectDisabled)
  37801. ])
  37802. }, [
  37803. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
  37804. vue.renderSlot(_ctx.$slots, "prefix")
  37805. ])) : vue.createCommentVNode("v-if", true),
  37806. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", {
  37807. key: 1,
  37808. class: vue.normalizeClass(_ctx.nsSelectV2.e("selection"))
  37809. }, [
  37810. _ctx.collapseTags && _ctx.modelValue.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  37811. key: 0,
  37812. class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  37813. }, [
  37814. vue.createVNode(_component_el_tag, {
  37815. closable: !_ctx.selectDisabled && !((_a = _ctx.states.cachedOptions[0]) == null ? void 0 : _a.disable),
  37816. size: _ctx.collapseTagSize,
  37817. type: "info",
  37818. "disable-transitions": "",
  37819. onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.states.cachedOptions[0]))
  37820. }, {
  37821. default: vue.withCtx(() => {
  37822. var _a2;
  37823. return [
  37824. vue.createElementVNode("span", {
  37825. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  37826. style: vue.normalizeStyle({
  37827. maxWidth: `${_ctx.tagMaxWidth}px`
  37828. })
  37829. }, vue.toDisplayString((_a2 = _ctx.states.cachedOptions[0]) == null ? void 0 : _a2.label), 7)
  37830. ];
  37831. }),
  37832. _: 1
  37833. }, 8, ["closable", "size"]),
  37834. _ctx.modelValue.length > 1 ? (vue.openBlock(), vue.createBlock(_component_el_tag, {
  37835. key: 0,
  37836. closable: false,
  37837. size: _ctx.collapseTagSize,
  37838. type: "info",
  37839. "disable-transitions": ""
  37840. }, {
  37841. default: vue.withCtx(() => [
  37842. _ctx.collapseTagsTooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  37843. key: 0,
  37844. disabled: _ctx.dropdownMenuVisible,
  37845. "fallback-placements": ["bottom", "top", "right", "left"],
  37846. effect: _ctx.effect,
  37847. placement: "bottom",
  37848. teleported: false
  37849. }, {
  37850. default: vue.withCtx(() => [
  37851. vue.createElementVNode("span", {
  37852. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  37853. style: vue.normalizeStyle({
  37854. maxWidth: `${_ctx.tagMaxWidth}px`
  37855. })
  37856. }, "+ " + vue.toDisplayString(_ctx.modelValue.length - 1), 7)
  37857. ]),
  37858. content: vue.withCtx(() => [
  37859. vue.createElementVNode("div", {
  37860. class: vue.normalizeClass(_ctx.nsSelectV2.e("selection"))
  37861. }, [
  37862. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.states.cachedOptions.slice(1), (selected, idx) => {
  37863. return vue.openBlock(), vue.createElementBlock("div", {
  37864. key: idx,
  37865. class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  37866. }, [
  37867. (vue.openBlock(), vue.createBlock(_component_el_tag, {
  37868. key: _ctx.getValueKey(selected),
  37869. closable: !_ctx.selectDisabled && !selected.disabled,
  37870. size: _ctx.collapseTagSize,
  37871. class: "in-tooltip",
  37872. type: "info",
  37873. "disable-transitions": "",
  37874. onClose: ($event) => _ctx.deleteTag($event, selected)
  37875. }, {
  37876. default: vue.withCtx(() => [
  37877. vue.createElementVNode("span", {
  37878. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  37879. style: vue.normalizeStyle({
  37880. maxWidth: `${_ctx.tagMaxWidth}px`
  37881. })
  37882. }, vue.toDisplayString(_ctx.getLabel(selected)), 7)
  37883. ]),
  37884. _: 2
  37885. }, 1032, ["closable", "size", "onClose"]))
  37886. ], 2);
  37887. }), 128))
  37888. ], 2)
  37889. ]),
  37890. _: 1
  37891. }, 8, ["disabled", "effect"])) : (vue.openBlock(), vue.createElementBlock("span", {
  37892. key: 1,
  37893. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  37894. style: vue.normalizeStyle({
  37895. maxWidth: `${_ctx.tagMaxWidth}px`
  37896. })
  37897. }, "+ " + vue.toDisplayString(_ctx.modelValue.length - 1), 7))
  37898. ]),
  37899. _: 1
  37900. }, 8, ["size"])) : vue.createCommentVNode("v-if", true)
  37901. ], 2)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(_ctx.states.cachedOptions, (selected, idx) => {
  37902. return vue.openBlock(), vue.createElementBlock("div", {
  37903. key: idx,
  37904. class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  37905. }, [
  37906. (vue.openBlock(), vue.createBlock(_component_el_tag, {
  37907. key: _ctx.getValueKey(selected),
  37908. closable: !_ctx.selectDisabled && !selected.disabled,
  37909. size: _ctx.collapseTagSize,
  37910. type: "info",
  37911. "disable-transitions": "",
  37912. onClose: ($event) => _ctx.deleteTag($event, selected)
  37913. }, {
  37914. default: vue.withCtx(() => [
  37915. vue.createElementVNode("span", {
  37916. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  37917. style: vue.normalizeStyle({
  37918. maxWidth: `${_ctx.tagMaxWidth}px`
  37919. })
  37920. }, vue.toDisplayString(_ctx.getLabel(selected)), 7)
  37921. ]),
  37922. _: 2
  37923. }, 1032, ["closable", "size", "onClose"]))
  37924. ], 2);
  37925. }), 128)),
  37926. vue.createElementVNode("div", {
  37927. class: vue.normalizeClass([
  37928. _ctx.nsSelectV2.e("selected-item"),
  37929. _ctx.nsSelectV2.e("input-wrapper")
  37930. ]),
  37931. style: vue.normalizeStyle(_ctx.inputWrapperStyle)
  37932. }, [
  37933. vue.withDirectives(vue.createElementVNode("input", {
  37934. id: _ctx.id,
  37935. ref: "inputRef",
  37936. autocomplete: _ctx.autocomplete,
  37937. "aria-autocomplete": "list",
  37938. "aria-haspopup": "listbox",
  37939. autocapitalize: "off",
  37940. "aria-expanded": _ctx.expanded,
  37941. "aria-labelledby": _ctx.label,
  37942. class: vue.normalizeClass([
  37943. _ctx.nsSelectV2.is(_ctx.selectSize),
  37944. _ctx.nsSelectV2.e("combobox-input")
  37945. ]),
  37946. disabled: _ctx.disabled,
  37947. role: "combobox",
  37948. readonly: !_ctx.filterable,
  37949. spellcheck: "false",
  37950. type: "text",
  37951. name: _ctx.name,
  37952. unselectable: _ctx.expanded ? "on" : void 0,
  37953. "onUpdate:modelValue": _cache[1] || (_cache[1] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args)),
  37954. onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  37955. onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  37956. onInput: _cache[4] || (_cache[4] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  37957. onCompositionstart: _cache[5] || (_cache[5] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  37958. onCompositionupdate: _cache[6] || (_cache[6] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  37959. onCompositionend: _cache[7] || (_cache[7] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  37960. onKeydown: [
  37961. _cache[8] || (_cache[8] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  37962. _cache[9] || (_cache[9] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  37963. _cache[10] || (_cache[10] = vue.withKeys(vue.withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  37964. _cache[11] || (_cache[11] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])),
  37965. _cache[12] || (_cache[12] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleDel && _ctx.handleDel(...args), ["stop"]), ["delete"]))
  37966. ]
  37967. }, null, 42, _hoisted_2$b), [
  37968. [_directive_model_text, _ctx.states.displayInputValue]
  37969. ]),
  37970. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  37971. key: 0,
  37972. ref: "calculatorRef",
  37973. "aria-hidden": "true",
  37974. class: vue.normalizeClass(_ctx.nsSelectV2.e("input-calculator")),
  37975. textContent: vue.toDisplayString(_ctx.states.displayInputValue)
  37976. }, null, 10, _hoisted_3$5)) : vue.createCommentVNode("v-if", true)
  37977. ], 6)
  37978. ], 2)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  37979. vue.createElementVNode("div", {
  37980. class: vue.normalizeClass([
  37981. _ctx.nsSelectV2.e("selected-item"),
  37982. _ctx.nsSelectV2.e("input-wrapper")
  37983. ])
  37984. }, [
  37985. vue.withDirectives(vue.createElementVNode("input", {
  37986. id: _ctx.id,
  37987. ref: "inputRef",
  37988. "aria-autocomplete": "list",
  37989. "aria-haspopup": "listbox",
  37990. "aria-labelledby": _ctx.label,
  37991. "aria-expanded": _ctx.expanded,
  37992. autocapitalize: "off",
  37993. autocomplete: _ctx.autocomplete,
  37994. class: vue.normalizeClass(_ctx.nsSelectV2.e("combobox-input")),
  37995. disabled: _ctx.disabled,
  37996. name: _ctx.name,
  37997. role: "combobox",
  37998. readonly: !_ctx.filterable,
  37999. spellcheck: "false",
  38000. type: "text",
  38001. unselectable: _ctx.expanded ? "on" : void 0,
  38002. onCompositionstart: _cache[13] || (_cache[13] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  38003. onCompositionupdate: _cache[14] || (_cache[14] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  38004. onCompositionend: _cache[15] || (_cache[15] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  38005. onFocus: _cache[16] || (_cache[16] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  38006. onBlur: _cache[17] || (_cache[17] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  38007. onInput: _cache[18] || (_cache[18] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  38008. onKeydown: [
  38009. _cache[19] || (_cache[19] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  38010. _cache[20] || (_cache[20] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  38011. _cache[21] || (_cache[21] = vue.withKeys(vue.withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  38012. _cache[22] || (_cache[22] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"]))
  38013. ],
  38014. "onUpdate:modelValue": _cache[23] || (_cache[23] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args))
  38015. }, null, 42, _hoisted_4$3), [
  38016. [_directive_model_text, _ctx.states.displayInputValue]
  38017. ])
  38018. ], 2),
  38019. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  38020. key: 0,
  38021. ref: "calculatorRef",
  38022. "aria-hidden": "true",
  38023. class: vue.normalizeClass([
  38024. _ctx.nsSelectV2.e("selected-item"),
  38025. _ctx.nsSelectV2.e("input-calculator")
  38026. ]),
  38027. textContent: vue.toDisplayString(_ctx.states.displayInputValue)
  38028. }, null, 10, _hoisted_5$2)) : vue.createCommentVNode("v-if", true)
  38029. ], 64)),
  38030. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("span", {
  38031. key: 3,
  38032. class: vue.normalizeClass([
  38033. _ctx.nsSelectV2.e("placeholder"),
  38034. _ctx.nsSelectV2.is("transparent", _ctx.multiple ? _ctx.modelValue.length === 0 : !_ctx.hasModelValue)
  38035. ])
  38036. }, vue.toDisplayString(_ctx.currentPlaceholder), 3)) : vue.createCommentVNode("v-if", true),
  38037. vue.createElementVNode("span", {
  38038. class: vue.normalizeClass(_ctx.nsSelectV2.e("suffix"))
  38039. }, [
  38040. _ctx.iconComponent ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_icon, {
  38041. key: 0,
  38042. class: vue.normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  38043. }, {
  38044. default: vue.withCtx(() => [
  38045. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  38046. ]),
  38047. _: 1
  38048. }, 8, ["class"])), [
  38049. [vue.vShow, !_ctx.showClearBtn]
  38050. ]) : vue.createCommentVNode("v-if", true),
  38051. _ctx.showClearBtn && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  38052. key: 1,
  38053. class: vue.normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon")]),
  38054. onClick: vue.withModifiers(_ctx.handleClear, ["prevent", "stop"])
  38055. }, {
  38056. default: vue.withCtx(() => [
  38057. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  38058. ]),
  38059. _: 1
  38060. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  38061. _ctx.validateState && _ctx.validateIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  38062. key: 2,
  38063. class: vue.normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  38064. }, {
  38065. default: vue.withCtx(() => [
  38066. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  38067. ]),
  38068. _: 1
  38069. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  38070. ], 2)
  38071. ], 2)
  38072. ];
  38073. }),
  38074. content: vue.withCtx(() => [
  38075. vue.createVNode(_component_el_select_menu, {
  38076. ref: "menuRef",
  38077. data: _ctx.filteredOptions,
  38078. width: _ctx.popperSize,
  38079. "hovering-index": _ctx.states.hoveringIndex,
  38080. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  38081. }, {
  38082. default: vue.withCtx((scope) => [
  38083. vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(scope)))
  38084. ]),
  38085. empty: vue.withCtx(() => [
  38086. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  38087. vue.createElementVNode("p", {
  38088. class: vue.normalizeClass(_ctx.nsSelectV2.e("empty"))
  38089. }, vue.toDisplayString(_ctx.emptyText ? _ctx.emptyText : ""), 3)
  38090. ])
  38091. ]),
  38092. _: 3
  38093. }, 8, ["data", "width", "hovering-index", "scrollbar-always-on"])
  38094. ]),
  38095. _: 3
  38096. }, 8, ["visible", "teleported", "popper-class", "popper-options", "effect", "placement", "transition", "persistent", "onBeforeShow"])
  38097. ], 34)), [
  38098. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  38099. ]);
  38100. }
  38101. var Select = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", _sfc_render$5], ["__file", "select.vue"]]);
  38102. Select.install = (app) => {
  38103. app.component(Select.name, Select);
  38104. };
  38105. const _Select = Select;
  38106. const ElSelectV2 = _Select;
  38107. const skeletonProps = buildProps({
  38108. animated: {
  38109. type: Boolean,
  38110. default: false
  38111. },
  38112. count: {
  38113. type: Number,
  38114. default: 1
  38115. },
  38116. rows: {
  38117. type: Number,
  38118. default: 3
  38119. },
  38120. loading: {
  38121. type: Boolean,
  38122. default: true
  38123. },
  38124. throttle: {
  38125. type: Number
  38126. }
  38127. });
  38128. const skeletonItemProps = buildProps({
  38129. variant: {
  38130. type: String,
  38131. values: [
  38132. "circle",
  38133. "rect",
  38134. "h1",
  38135. "h3",
  38136. "text",
  38137. "caption",
  38138. "p",
  38139. "image",
  38140. "button"
  38141. ],
  38142. default: "text"
  38143. }
  38144. });
  38145. const __default__$q = vue.defineComponent({
  38146. name: "ElSkeletonItem"
  38147. });
  38148. const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
  38149. ...__default__$q,
  38150. props: skeletonItemProps,
  38151. setup(__props) {
  38152. const ns = useNamespace("skeleton");
  38153. return (_ctx, _cache) => {
  38154. return vue.openBlock(), vue.createElementBlock("div", {
  38155. class: vue.normalizeClass([vue.unref(ns).e("item"), vue.unref(ns).e(_ctx.variant)])
  38156. }, [
  38157. _ctx.variant === "image" ? (vue.openBlock(), vue.createBlock(vue.unref(picture_filled_default), { key: 0 })) : vue.createCommentVNode("v-if", true)
  38158. ], 2);
  38159. };
  38160. }
  38161. });
  38162. var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__file", "skeleton-item.vue"]]);
  38163. const __default__$p = vue.defineComponent({
  38164. name: "ElSkeleton"
  38165. });
  38166. const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
  38167. ...__default__$p,
  38168. props: skeletonProps,
  38169. setup(__props, { expose }) {
  38170. const props = __props;
  38171. const ns = useNamespace("skeleton");
  38172. const uiLoading = useThrottleRender(vue.toRef(props, "loading"), props.throttle);
  38173. expose({
  38174. uiLoading
  38175. });
  38176. return (_ctx, _cache) => {
  38177. return vue.unref(uiLoading) ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  38178. key: 0,
  38179. class: [vue.unref(ns).b(), vue.unref(ns).is("animated", _ctx.animated)]
  38180. }, _ctx.$attrs), [
  38181. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.count, (i) => {
  38182. return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: i }, [
  38183. _ctx.loading ? vue.renderSlot(_ctx.$slots, "template", { key: i }, () => [
  38184. vue.createVNode(SkeletonItem, {
  38185. class: vue.normalizeClass(vue.unref(ns).is("first")),
  38186. variant: "p"
  38187. }, null, 8, ["class"]),
  38188. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rows, (item) => {
  38189. return vue.openBlock(), vue.createBlock(SkeletonItem, {
  38190. key: item,
  38191. class: vue.normalizeClass([
  38192. vue.unref(ns).e("paragraph"),
  38193. vue.unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  38194. ]),
  38195. variant: "p"
  38196. }, null, 8, ["class"]);
  38197. }), 128))
  38198. ]) : vue.createCommentVNode("v-if", true)
  38199. ], 64);
  38200. }), 128))
  38201. ], 16)) : vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.mergeProps({ key: 1 }, _ctx.$attrs)));
  38202. };
  38203. }
  38204. });
  38205. var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "skeleton.vue"]]);
  38206. const ElSkeleton = withInstall(Skeleton, {
  38207. SkeletonItem
  38208. });
  38209. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  38210. const sliderProps = buildProps({
  38211. modelValue: {
  38212. type: definePropType([Number, Array]),
  38213. default: 0
  38214. },
  38215. id: {
  38216. type: String,
  38217. default: void 0
  38218. },
  38219. min: {
  38220. type: Number,
  38221. default: 0
  38222. },
  38223. max: {
  38224. type: Number,
  38225. default: 100
  38226. },
  38227. step: {
  38228. type: Number,
  38229. default: 1
  38230. },
  38231. showInput: Boolean,
  38232. showInputControls: {
  38233. type: Boolean,
  38234. default: true
  38235. },
  38236. size: useSizeProp,
  38237. inputSize: useSizeProp,
  38238. showStops: Boolean,
  38239. showTooltip: {
  38240. type: Boolean,
  38241. default: true
  38242. },
  38243. formatTooltip: {
  38244. type: definePropType(Function),
  38245. default: void 0
  38246. },
  38247. disabled: Boolean,
  38248. range: Boolean,
  38249. vertical: Boolean,
  38250. height: String,
  38251. debounce: {
  38252. type: Number,
  38253. default: 300
  38254. },
  38255. label: {
  38256. type: String,
  38257. default: void 0
  38258. },
  38259. rangeStartLabel: {
  38260. type: String,
  38261. default: void 0
  38262. },
  38263. rangeEndLabel: {
  38264. type: String,
  38265. default: void 0
  38266. },
  38267. formatValueText: {
  38268. type: definePropType(Function),
  38269. default: void 0
  38270. },
  38271. tooltipClass: {
  38272. type: String,
  38273. default: void 0
  38274. },
  38275. placement: {
  38276. type: String,
  38277. values: Ee,
  38278. default: "top"
  38279. },
  38280. marks: {
  38281. type: definePropType(Object)
  38282. },
  38283. validateEvent: {
  38284. type: Boolean,
  38285. default: true
  38286. }
  38287. });
  38288. const isValidValue$1 = (value) => isNumber(value) || isArray(value) && value.every(isNumber);
  38289. const sliderEmits = {
  38290. [UPDATE_MODEL_EVENT]: isValidValue$1,
  38291. [INPUT_EVENT]: isValidValue$1,
  38292. [CHANGE_EVENT]: isValidValue$1
  38293. };
  38294. const useLifecycle = (props, initData, resetSize) => {
  38295. const sliderWrapper = vue.ref();
  38296. vue.onMounted(async () => {
  38297. if (props.range) {
  38298. if (Array.isArray(props.modelValue)) {
  38299. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  38300. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  38301. } else {
  38302. initData.firstValue = props.min;
  38303. initData.secondValue = props.max;
  38304. }
  38305. initData.oldValue = [initData.firstValue, initData.secondValue];
  38306. } else {
  38307. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  38308. initData.firstValue = props.min;
  38309. } else {
  38310. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  38311. }
  38312. initData.oldValue = initData.firstValue;
  38313. }
  38314. useEventListener(window, "resize", resetSize);
  38315. await vue.nextTick();
  38316. resetSize();
  38317. });
  38318. return {
  38319. sliderWrapper
  38320. };
  38321. };
  38322. const useMarks = (props) => {
  38323. return vue.computed(() => {
  38324. if (!props.marks) {
  38325. return [];
  38326. }
  38327. const marksKeys = Object.keys(props.marks);
  38328. return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  38329. point,
  38330. position: (point - props.min) * 100 / (props.max - props.min),
  38331. mark: props.marks[point]
  38332. }));
  38333. });
  38334. };
  38335. const useSlide = (props, initData, emit) => {
  38336. const { form: elForm, formItem: elFormItem } = useFormItem();
  38337. const slider = vue.shallowRef();
  38338. const firstButton = vue.ref();
  38339. const secondButton = vue.ref();
  38340. const buttonRefs = {
  38341. firstButton,
  38342. secondButton
  38343. };
  38344. const sliderDisabled = vue.computed(() => {
  38345. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  38346. });
  38347. const minValue = vue.computed(() => {
  38348. return Math.min(initData.firstValue, initData.secondValue);
  38349. });
  38350. const maxValue = vue.computed(() => {
  38351. return Math.max(initData.firstValue, initData.secondValue);
  38352. });
  38353. const barSize = vue.computed(() => {
  38354. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  38355. });
  38356. const barStart = vue.computed(() => {
  38357. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  38358. });
  38359. const runwayStyle = vue.computed(() => {
  38360. return props.vertical ? { height: props.height } : {};
  38361. });
  38362. const barStyle = vue.computed(() => {
  38363. return props.vertical ? {
  38364. height: barSize.value,
  38365. bottom: barStart.value
  38366. } : {
  38367. width: barSize.value,
  38368. left: barStart.value
  38369. };
  38370. });
  38371. const resetSize = () => {
  38372. if (slider.value) {
  38373. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  38374. }
  38375. };
  38376. const getButtonRefByPercent = (percent) => {
  38377. const targetValue = props.min + percent * (props.max - props.min) / 100;
  38378. if (!props.range) {
  38379. return firstButton;
  38380. }
  38381. let buttonRefName;
  38382. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  38383. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  38384. } else {
  38385. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  38386. }
  38387. return buttonRefs[buttonRefName];
  38388. };
  38389. const setPosition = (percent) => {
  38390. const buttonRef = getButtonRefByPercent(percent);
  38391. buttonRef.value.setPosition(percent);
  38392. return buttonRef;
  38393. };
  38394. const setFirstValue = (firstValue) => {
  38395. initData.firstValue = firstValue;
  38396. _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
  38397. };
  38398. const setSecondValue = (secondValue) => {
  38399. initData.secondValue = secondValue;
  38400. if (props.range) {
  38401. _emit([minValue.value, maxValue.value]);
  38402. }
  38403. };
  38404. const _emit = (val) => {
  38405. emit(UPDATE_MODEL_EVENT, val);
  38406. emit(INPUT_EVENT, val);
  38407. };
  38408. const emitChange = async () => {
  38409. await vue.nextTick();
  38410. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  38411. };
  38412. const handleSliderPointerEvent = (event) => {
  38413. var _a, _b, _c, _d, _e, _f;
  38414. if (sliderDisabled.value || initData.dragging)
  38415. return;
  38416. resetSize();
  38417. let newPercent = 0;
  38418. if (props.vertical) {
  38419. const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  38420. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  38421. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  38422. } else {
  38423. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  38424. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  38425. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  38426. }
  38427. if (newPercent < 0 || newPercent > 100)
  38428. return;
  38429. return setPosition(newPercent);
  38430. };
  38431. const onSliderWrapperPrevent = (event) => {
  38432. var _a, _b;
  38433. if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  38434. event.preventDefault();
  38435. }
  38436. };
  38437. const onSliderDown = async (event) => {
  38438. const buttonRef = handleSliderPointerEvent(event);
  38439. if (buttonRef) {
  38440. await vue.nextTick();
  38441. buttonRef.value.onButtonDown(event);
  38442. }
  38443. };
  38444. const onSliderClick = (event) => {
  38445. const buttonRef = handleSliderPointerEvent(event);
  38446. if (buttonRef) {
  38447. emitChange();
  38448. }
  38449. };
  38450. return {
  38451. elFormItem,
  38452. slider,
  38453. firstButton,
  38454. secondButton,
  38455. sliderDisabled,
  38456. minValue,
  38457. maxValue,
  38458. runwayStyle,
  38459. barStyle,
  38460. resetSize,
  38461. setPosition,
  38462. emitChange,
  38463. onSliderWrapperPrevent,
  38464. onSliderClick,
  38465. onSliderDown,
  38466. setFirstValue,
  38467. setSecondValue
  38468. };
  38469. };
  38470. const { left, down, right, up, home, end, pageUp, pageDown } = EVENT_CODE;
  38471. const useTooltip = (props, formatTooltip, showTooltip) => {
  38472. const tooltip = vue.ref();
  38473. const tooltipVisible = vue.ref(false);
  38474. const enableFormat = vue.computed(() => {
  38475. return formatTooltip.value instanceof Function;
  38476. });
  38477. const formatValue = vue.computed(() => {
  38478. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  38479. });
  38480. const displayTooltip = debounce(() => {
  38481. showTooltip.value && (tooltipVisible.value = true);
  38482. }, 50);
  38483. const hideTooltip = debounce(() => {
  38484. showTooltip.value && (tooltipVisible.value = false);
  38485. }, 50);
  38486. return {
  38487. tooltip,
  38488. tooltipVisible,
  38489. formatValue,
  38490. displayTooltip,
  38491. hideTooltip
  38492. };
  38493. };
  38494. const useSliderButton = (props, initData, emit) => {
  38495. const {
  38496. disabled,
  38497. min,
  38498. max,
  38499. step,
  38500. showTooltip,
  38501. precision,
  38502. sliderSize,
  38503. formatTooltip,
  38504. emitChange,
  38505. resetSize,
  38506. updateDragging
  38507. } = vue.inject(sliderContextKey);
  38508. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  38509. const button = vue.ref();
  38510. const currentPosition = vue.computed(() => {
  38511. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  38512. });
  38513. const wrapperStyle = vue.computed(() => {
  38514. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  38515. });
  38516. const handleMouseEnter = () => {
  38517. initData.hovering = true;
  38518. displayTooltip();
  38519. };
  38520. const handleMouseLeave = () => {
  38521. initData.hovering = false;
  38522. if (!initData.dragging) {
  38523. hideTooltip();
  38524. }
  38525. };
  38526. const onButtonDown = (event) => {
  38527. if (disabled.value)
  38528. return;
  38529. event.preventDefault();
  38530. onDragStart(event);
  38531. window.addEventListener("mousemove", onDragging);
  38532. window.addEventListener("touchmove", onDragging);
  38533. window.addEventListener("mouseup", onDragEnd);
  38534. window.addEventListener("touchend", onDragEnd);
  38535. window.addEventListener("contextmenu", onDragEnd);
  38536. button.value.focus();
  38537. };
  38538. const incrementPosition = (amount) => {
  38539. if (disabled.value)
  38540. return;
  38541. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  38542. setPosition(initData.newPosition);
  38543. emitChange();
  38544. };
  38545. const onLeftKeyDown = () => {
  38546. incrementPosition(-step.value);
  38547. };
  38548. const onRightKeyDown = () => {
  38549. incrementPosition(step.value);
  38550. };
  38551. const onPageDownKeyDown = () => {
  38552. incrementPosition(-step.value * 4);
  38553. };
  38554. const onPageUpKeyDown = () => {
  38555. incrementPosition(step.value * 4);
  38556. };
  38557. const onHomeKeyDown = () => {
  38558. if (disabled.value)
  38559. return;
  38560. setPosition(0);
  38561. emitChange();
  38562. };
  38563. const onEndKeyDown = () => {
  38564. if (disabled.value)
  38565. return;
  38566. setPosition(100);
  38567. emitChange();
  38568. };
  38569. const onKeyDown = (event) => {
  38570. let isPreventDefault = true;
  38571. if ([left, down].includes(event.key)) {
  38572. onLeftKeyDown();
  38573. } else if ([right, up].includes(event.key)) {
  38574. onRightKeyDown();
  38575. } else if (event.key === home) {
  38576. onHomeKeyDown();
  38577. } else if (event.key === end) {
  38578. onEndKeyDown();
  38579. } else if (event.key === pageDown) {
  38580. onPageDownKeyDown();
  38581. } else if (event.key === pageUp) {
  38582. onPageUpKeyDown();
  38583. } else {
  38584. isPreventDefault = false;
  38585. }
  38586. isPreventDefault && event.preventDefault();
  38587. };
  38588. const getClientXY = (event) => {
  38589. let clientX;
  38590. let clientY;
  38591. if (event.type.startsWith("touch")) {
  38592. clientY = event.touches[0].clientY;
  38593. clientX = event.touches[0].clientX;
  38594. } else {
  38595. clientY = event.clientY;
  38596. clientX = event.clientX;
  38597. }
  38598. return {
  38599. clientX,
  38600. clientY
  38601. };
  38602. };
  38603. const onDragStart = (event) => {
  38604. initData.dragging = true;
  38605. initData.isClick = true;
  38606. const { clientX, clientY } = getClientXY(event);
  38607. if (props.vertical) {
  38608. initData.startY = clientY;
  38609. } else {
  38610. initData.startX = clientX;
  38611. }
  38612. initData.startPosition = Number.parseFloat(currentPosition.value);
  38613. initData.newPosition = initData.startPosition;
  38614. };
  38615. const onDragging = (event) => {
  38616. if (initData.dragging) {
  38617. initData.isClick = false;
  38618. displayTooltip();
  38619. resetSize();
  38620. let diff;
  38621. const { clientX, clientY } = getClientXY(event);
  38622. if (props.vertical) {
  38623. initData.currentY = clientY;
  38624. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  38625. } else {
  38626. initData.currentX = clientX;
  38627. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  38628. }
  38629. initData.newPosition = initData.startPosition + diff;
  38630. setPosition(initData.newPosition);
  38631. }
  38632. };
  38633. const onDragEnd = () => {
  38634. if (initData.dragging) {
  38635. setTimeout(() => {
  38636. initData.dragging = false;
  38637. if (!initData.hovering) {
  38638. hideTooltip();
  38639. }
  38640. if (!initData.isClick) {
  38641. setPosition(initData.newPosition);
  38642. }
  38643. emitChange();
  38644. }, 0);
  38645. window.removeEventListener("mousemove", onDragging);
  38646. window.removeEventListener("touchmove", onDragging);
  38647. window.removeEventListener("mouseup", onDragEnd);
  38648. window.removeEventListener("touchend", onDragEnd);
  38649. window.removeEventListener("contextmenu", onDragEnd);
  38650. }
  38651. };
  38652. const setPosition = async (newPosition) => {
  38653. if (newPosition === null || Number.isNaN(+newPosition))
  38654. return;
  38655. if (newPosition < 0) {
  38656. newPosition = 0;
  38657. } else if (newPosition > 100) {
  38658. newPosition = 100;
  38659. }
  38660. const lengthPerStep = 100 / ((max.value - min.value) / step.value);
  38661. const steps = Math.round(newPosition / lengthPerStep);
  38662. let value = steps * lengthPerStep * (max.value - min.value) * 0.01 + min.value;
  38663. value = Number.parseFloat(value.toFixed(precision.value));
  38664. if (value !== props.modelValue) {
  38665. emit(UPDATE_MODEL_EVENT, value);
  38666. }
  38667. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  38668. initData.oldValue = props.modelValue;
  38669. }
  38670. await vue.nextTick();
  38671. initData.dragging && displayTooltip();
  38672. tooltip.value.updatePopper();
  38673. };
  38674. vue.watch(() => initData.dragging, (val) => {
  38675. updateDragging(val);
  38676. });
  38677. return {
  38678. disabled,
  38679. button,
  38680. tooltip,
  38681. tooltipVisible,
  38682. showTooltip,
  38683. wrapperStyle,
  38684. formatValue,
  38685. handleMouseEnter,
  38686. handleMouseLeave,
  38687. onButtonDown,
  38688. onKeyDown,
  38689. setPosition
  38690. };
  38691. };
  38692. const useStops = (props, initData, minValue, maxValue) => {
  38693. const stops = vue.computed(() => {
  38694. if (!props.showStops || props.min > props.max)
  38695. return [];
  38696. if (props.step === 0) {
  38697. return [];
  38698. }
  38699. const stopCount = (props.max - props.min) / props.step;
  38700. const stepWidth = 100 * props.step / (props.max - props.min);
  38701. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  38702. if (props.range) {
  38703. return result.filter((step) => {
  38704. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  38705. });
  38706. } else {
  38707. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  38708. }
  38709. });
  38710. const getStopStyle = (position) => {
  38711. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  38712. };
  38713. return {
  38714. stops,
  38715. getStopStyle
  38716. };
  38717. };
  38718. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  38719. const _emit = (val) => {
  38720. emit(UPDATE_MODEL_EVENT, val);
  38721. emit(INPUT_EVENT, val);
  38722. };
  38723. const valueChanged = () => {
  38724. if (props.range) {
  38725. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  38726. } else {
  38727. return props.modelValue !== initData.oldValue;
  38728. }
  38729. };
  38730. const setValues = () => {
  38731. var _a, _b;
  38732. if (props.min > props.max) {
  38733. throwError("Slider", "min should not be greater than max.");
  38734. return;
  38735. }
  38736. const val = props.modelValue;
  38737. if (props.range && Array.isArray(val)) {
  38738. if (val[1] < props.min) {
  38739. _emit([props.min, props.min]);
  38740. } else if (val[0] > props.max) {
  38741. _emit([props.max, props.max]);
  38742. } else if (val[0] < props.min) {
  38743. _emit([props.min, val[1]]);
  38744. } else if (val[1] > props.max) {
  38745. _emit([val[0], props.max]);
  38746. } else {
  38747. initData.firstValue = val[0];
  38748. initData.secondValue = val[1];
  38749. if (valueChanged()) {
  38750. if (props.validateEvent) {
  38751. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  38752. }
  38753. initData.oldValue = val.slice();
  38754. }
  38755. }
  38756. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  38757. if (val < props.min) {
  38758. _emit(props.min);
  38759. } else if (val > props.max) {
  38760. _emit(props.max);
  38761. } else {
  38762. initData.firstValue = val;
  38763. if (valueChanged()) {
  38764. if (props.validateEvent) {
  38765. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn());
  38766. }
  38767. initData.oldValue = val;
  38768. }
  38769. }
  38770. }
  38771. };
  38772. setValues();
  38773. vue.watch(() => initData.dragging, (val) => {
  38774. if (!val) {
  38775. setValues();
  38776. }
  38777. });
  38778. vue.watch(() => props.modelValue, (val, oldVal) => {
  38779. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  38780. return;
  38781. }
  38782. setValues();
  38783. }, {
  38784. deep: true
  38785. });
  38786. vue.watch(() => [props.min, props.max], () => {
  38787. setValues();
  38788. });
  38789. };
  38790. const sliderButtonProps = buildProps({
  38791. modelValue: {
  38792. type: Number,
  38793. default: 0
  38794. },
  38795. vertical: Boolean,
  38796. tooltipClass: String,
  38797. placement: {
  38798. type: String,
  38799. values: Ee,
  38800. default: "top"
  38801. }
  38802. });
  38803. const sliderButtonEmits = {
  38804. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  38805. };
  38806. const _hoisted_1$f = ["tabindex"];
  38807. const __default__$o = vue.defineComponent({
  38808. name: "ElSliderButton"
  38809. });
  38810. const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
  38811. ...__default__$o,
  38812. props: sliderButtonProps,
  38813. emits: sliderButtonEmits,
  38814. setup(__props, { expose, emit }) {
  38815. const props = __props;
  38816. const ns = useNamespace("slider");
  38817. const initData = vue.reactive({
  38818. hovering: false,
  38819. dragging: false,
  38820. isClick: false,
  38821. startX: 0,
  38822. currentX: 0,
  38823. startY: 0,
  38824. currentY: 0,
  38825. startPosition: 0,
  38826. newPosition: 0,
  38827. oldValue: props.modelValue
  38828. });
  38829. const {
  38830. disabled,
  38831. button,
  38832. tooltip,
  38833. showTooltip,
  38834. tooltipVisible,
  38835. wrapperStyle,
  38836. formatValue,
  38837. handleMouseEnter,
  38838. handleMouseLeave,
  38839. onButtonDown,
  38840. onKeyDown,
  38841. setPosition
  38842. } = useSliderButton(props, initData, emit);
  38843. const { hovering, dragging } = vue.toRefs(initData);
  38844. expose({
  38845. onButtonDown,
  38846. onKeyDown,
  38847. setPosition,
  38848. hovering,
  38849. dragging
  38850. });
  38851. return (_ctx, _cache) => {
  38852. return vue.openBlock(), vue.createElementBlock("div", {
  38853. ref_key: "button",
  38854. ref: button,
  38855. class: vue.normalizeClass([vue.unref(ns).e("button-wrapper"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }]),
  38856. style: vue.normalizeStyle(vue.unref(wrapperStyle)),
  38857. tabindex: vue.unref(disabled) ? -1 : 0,
  38858. onMouseenter: _cache[0] || (_cache[0] = (...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args)),
  38859. onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args)),
  38860. onMousedown: _cache[2] || (_cache[2] = (...args) => vue.unref(onButtonDown) && vue.unref(onButtonDown)(...args)),
  38861. onTouchstart: _cache[3] || (_cache[3] = (...args) => vue.unref(onButtonDown) && vue.unref(onButtonDown)(...args)),
  38862. onFocus: _cache[4] || (_cache[4] = (...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args)),
  38863. onBlur: _cache[5] || (_cache[5] = (...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args)),
  38864. onKeydown: _cache[6] || (_cache[6] = (...args) => vue.unref(onKeyDown) && vue.unref(onKeyDown)(...args))
  38865. }, [
  38866. vue.createVNode(vue.unref(ElTooltip), {
  38867. ref_key: "tooltip",
  38868. ref: tooltip,
  38869. visible: vue.unref(tooltipVisible),
  38870. placement: _ctx.placement,
  38871. "fallback-placements": ["top", "bottom", "right", "left"],
  38872. "stop-popper-mouse-event": false,
  38873. "popper-class": _ctx.tooltipClass,
  38874. disabled: !vue.unref(showTooltip),
  38875. persistent: ""
  38876. }, {
  38877. content: vue.withCtx(() => [
  38878. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(formatValue)), 1)
  38879. ]),
  38880. default: vue.withCtx(() => [
  38881. vue.createElementVNode("div", {
  38882. class: vue.normalizeClass([vue.unref(ns).e("button"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }])
  38883. }, null, 2)
  38884. ]),
  38885. _: 1
  38886. }, 8, ["visible", "placement", "popper-class", "disabled"])
  38887. ], 46, _hoisted_1$f);
  38888. };
  38889. }
  38890. });
  38891. var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "button.vue"]]);
  38892. const sliderMarkerProps = buildProps({
  38893. mark: {
  38894. type: definePropType([String, Object]),
  38895. default: void 0
  38896. }
  38897. });
  38898. var SliderMarker = vue.defineComponent({
  38899. name: "ElSliderMarker",
  38900. props: sliderMarkerProps,
  38901. setup(props) {
  38902. const ns = useNamespace("slider");
  38903. const label = vue.computed(() => {
  38904. return isString(props.mark) ? props.mark : props.mark.label;
  38905. });
  38906. const style = vue.computed(() => isString(props.mark) ? void 0 : props.mark.style);
  38907. return () => vue.h("div", {
  38908. class: ns.e("marks-text"),
  38909. style: style.value
  38910. }, label.value);
  38911. }
  38912. });
  38913. const _hoisted_1$e = ["id", "role", "aria-label", "aria-labelledby"];
  38914. const _hoisted_2$a = { key: 1 };
  38915. const __default__$n = vue.defineComponent({
  38916. name: "ElSlider"
  38917. });
  38918. const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
  38919. ...__default__$n,
  38920. props: sliderProps,
  38921. emits: sliderEmits,
  38922. setup(__props, { expose, emit }) {
  38923. const props = __props;
  38924. const ns = useNamespace("slider");
  38925. const { t } = useLocale();
  38926. const initData = vue.reactive({
  38927. firstValue: 0,
  38928. secondValue: 0,
  38929. oldValue: 0,
  38930. dragging: false,
  38931. sliderSize: 1
  38932. });
  38933. const {
  38934. elFormItem,
  38935. slider,
  38936. firstButton,
  38937. secondButton,
  38938. sliderDisabled,
  38939. minValue,
  38940. maxValue,
  38941. runwayStyle,
  38942. barStyle,
  38943. resetSize,
  38944. emitChange,
  38945. onSliderWrapperPrevent,
  38946. onSliderClick,
  38947. onSliderDown,
  38948. setFirstValue,
  38949. setSecondValue
  38950. } = useSlide(props, initData, emit);
  38951. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  38952. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  38953. formItemContext: elFormItem
  38954. });
  38955. const sliderWrapperSize = useSize();
  38956. const sliderInputSize = vue.computed(() => props.inputSize || sliderWrapperSize.value);
  38957. const groupLabel = vue.computed(() => {
  38958. return props.label || t("el.slider.defaultLabel", {
  38959. min: props.min,
  38960. max: props.max
  38961. });
  38962. });
  38963. const firstButtonLabel = vue.computed(() => {
  38964. if (props.range) {
  38965. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  38966. } else {
  38967. return groupLabel.value;
  38968. }
  38969. });
  38970. const firstValueText = vue.computed(() => {
  38971. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  38972. });
  38973. const secondButtonLabel = vue.computed(() => {
  38974. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  38975. });
  38976. const secondValueText = vue.computed(() => {
  38977. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  38978. });
  38979. const sliderKls = vue.computed(() => [
  38980. ns.b(),
  38981. ns.m(sliderWrapperSize.value),
  38982. ns.is("vertical", props.vertical),
  38983. { [ns.m("with-input")]: props.showInput }
  38984. ]);
  38985. const markList = useMarks(props);
  38986. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  38987. const precision = vue.computed(() => {
  38988. const precisions = [props.min, props.max, props.step].map((item) => {
  38989. const decimal = `${item}`.split(".")[1];
  38990. return decimal ? decimal.length : 0;
  38991. });
  38992. return Math.max.apply(null, precisions);
  38993. });
  38994. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  38995. const { firstValue, secondValue, sliderSize } = vue.toRefs(initData);
  38996. const updateDragging = (val) => {
  38997. initData.dragging = val;
  38998. };
  38999. vue.provide(sliderContextKey, {
  39000. ...vue.toRefs(props),
  39001. sliderSize,
  39002. disabled: sliderDisabled,
  39003. precision,
  39004. emitChange,
  39005. resetSize,
  39006. updateDragging
  39007. });
  39008. expose({
  39009. onSliderClick
  39010. });
  39011. return (_ctx, _cache) => {
  39012. var _a, _b;
  39013. return vue.openBlock(), vue.createElementBlock("div", {
  39014. id: _ctx.range ? vue.unref(inputId) : void 0,
  39015. ref_key: "sliderWrapper",
  39016. ref: sliderWrapper,
  39017. class: vue.normalizeClass(vue.unref(sliderKls)),
  39018. role: _ctx.range ? "group" : void 0,
  39019. "aria-label": _ctx.range && !vue.unref(isLabeledByFormItem) ? vue.unref(groupLabel) : void 0,
  39020. "aria-labelledby": _ctx.range && vue.unref(isLabeledByFormItem) ? (_a = vue.unref(elFormItem)) == null ? void 0 : _a.labelId : void 0,
  39021. onTouchstart: _cache[2] || (_cache[2] = (...args) => vue.unref(onSliderWrapperPrevent) && vue.unref(onSliderWrapperPrevent)(...args)),
  39022. onTouchmove: _cache[3] || (_cache[3] = (...args) => vue.unref(onSliderWrapperPrevent) && vue.unref(onSliderWrapperPrevent)(...args))
  39023. }, [
  39024. vue.createElementVNode("div", {
  39025. ref_key: "slider",
  39026. ref: slider,
  39027. class: vue.normalizeClass([
  39028. vue.unref(ns).e("runway"),
  39029. { "show-input": _ctx.showInput && !_ctx.range },
  39030. vue.unref(ns).is("disabled", vue.unref(sliderDisabled))
  39031. ]),
  39032. style: vue.normalizeStyle(vue.unref(runwayStyle)),
  39033. onMousedown: _cache[0] || (_cache[0] = (...args) => vue.unref(onSliderDown) && vue.unref(onSliderDown)(...args)),
  39034. onTouchstart: _cache[1] || (_cache[1] = (...args) => vue.unref(onSliderDown) && vue.unref(onSliderDown)(...args))
  39035. }, [
  39036. vue.createElementVNode("div", {
  39037. class: vue.normalizeClass(vue.unref(ns).e("bar")),
  39038. style: vue.normalizeStyle(vue.unref(barStyle))
  39039. }, null, 6),
  39040. vue.createVNode(SliderButton, {
  39041. id: !_ctx.range ? vue.unref(inputId) : void 0,
  39042. ref_key: "firstButton",
  39043. ref: firstButton,
  39044. "model-value": vue.unref(firstValue),
  39045. vertical: _ctx.vertical,
  39046. "tooltip-class": _ctx.tooltipClass,
  39047. placement: _ctx.placement,
  39048. role: "slider",
  39049. "aria-label": _ctx.range || !vue.unref(isLabeledByFormItem) ? vue.unref(firstButtonLabel) : void 0,
  39050. "aria-labelledby": !_ctx.range && vue.unref(isLabeledByFormItem) ? (_b = vue.unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  39051. "aria-valuemin": _ctx.min,
  39052. "aria-valuemax": _ctx.range ? vue.unref(secondValue) : _ctx.max,
  39053. "aria-valuenow": vue.unref(firstValue),
  39054. "aria-valuetext": vue.unref(firstValueText),
  39055. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  39056. "aria-disabled": vue.unref(sliderDisabled),
  39057. "onUpdate:modelValue": vue.unref(setFirstValue)
  39058. }, 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"]),
  39059. _ctx.range ? (vue.openBlock(), vue.createBlock(SliderButton, {
  39060. key: 0,
  39061. ref_key: "secondButton",
  39062. ref: secondButton,
  39063. "model-value": vue.unref(secondValue),
  39064. vertical: _ctx.vertical,
  39065. "tooltip-class": _ctx.tooltipClass,
  39066. placement: _ctx.placement,
  39067. role: "slider",
  39068. "aria-label": vue.unref(secondButtonLabel),
  39069. "aria-valuemin": vue.unref(firstValue),
  39070. "aria-valuemax": _ctx.max,
  39071. "aria-valuenow": vue.unref(secondValue),
  39072. "aria-valuetext": vue.unref(secondValueText),
  39073. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  39074. "aria-disabled": vue.unref(sliderDisabled),
  39075. "onUpdate:modelValue": vue.unref(setSecondValue)
  39076. }, 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),
  39077. _ctx.showStops ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$a, [
  39078. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(stops), (item, key) => {
  39079. return vue.openBlock(), vue.createElementBlock("div", {
  39080. key,
  39081. class: vue.normalizeClass(vue.unref(ns).e("stop")),
  39082. style: vue.normalizeStyle(vue.unref(getStopStyle)(item))
  39083. }, null, 6);
  39084. }), 128))
  39085. ])) : vue.createCommentVNode("v-if", true),
  39086. vue.unref(markList).length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  39087. vue.createElementVNode("div", null, [
  39088. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  39089. return vue.openBlock(), vue.createElementBlock("div", {
  39090. key,
  39091. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  39092. class: vue.normalizeClass([vue.unref(ns).e("stop"), vue.unref(ns).e("marks-stop")])
  39093. }, null, 6);
  39094. }), 128))
  39095. ]),
  39096. vue.createElementVNode("div", {
  39097. class: vue.normalizeClass(vue.unref(ns).e("marks"))
  39098. }, [
  39099. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  39100. return vue.openBlock(), vue.createBlock(vue.unref(SliderMarker), {
  39101. key,
  39102. mark: item.mark,
  39103. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position))
  39104. }, null, 8, ["mark", "style"]);
  39105. }), 128))
  39106. ], 2)
  39107. ], 64)) : vue.createCommentVNode("v-if", true)
  39108. ], 38),
  39109. _ctx.showInput && !_ctx.range ? (vue.openBlock(), vue.createBlock(vue.unref(ElInputNumber), {
  39110. key: 0,
  39111. ref: "input",
  39112. "model-value": vue.unref(firstValue),
  39113. class: vue.normalizeClass(vue.unref(ns).e("input")),
  39114. step: _ctx.step,
  39115. disabled: vue.unref(sliderDisabled),
  39116. controls: _ctx.showInputControls,
  39117. min: _ctx.min,
  39118. max: _ctx.max,
  39119. debounce: _ctx.debounce,
  39120. size: vue.unref(sliderInputSize),
  39121. "onUpdate:modelValue": vue.unref(setFirstValue),
  39122. onChange: vue.unref(emitChange)
  39123. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : vue.createCommentVNode("v-if", true)
  39124. ], 42, _hoisted_1$e);
  39125. };
  39126. }
  39127. });
  39128. var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "slider.vue"]]);
  39129. const ElSlider = withInstall(Slider);
  39130. const spaceItemProps = buildProps({
  39131. prefixCls: {
  39132. type: String
  39133. }
  39134. });
  39135. const SpaceItem = vue.defineComponent({
  39136. name: "ElSpaceItem",
  39137. props: spaceItemProps,
  39138. setup(props, { slots }) {
  39139. const ns = useNamespace("space");
  39140. const classes = vue.computed(() => `${props.prefixCls || ns.b()}__item`);
  39141. return () => vue.h("div", { class: classes.value }, vue.renderSlot(slots, "default"));
  39142. }
  39143. });
  39144. var Item = SpaceItem;
  39145. const SIZE_MAP = {
  39146. small: 8,
  39147. default: 12,
  39148. large: 16
  39149. };
  39150. function useSpace(props) {
  39151. const ns = useNamespace("space");
  39152. const classes = vue.computed(() => [ns.b(), ns.m(props.direction), props.class]);
  39153. const horizontalSize = vue.ref(0);
  39154. const verticalSize = vue.ref(0);
  39155. const containerStyle = vue.computed(() => {
  39156. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {};
  39157. const alignment = {
  39158. alignItems: props.alignment
  39159. };
  39160. return [wrapKls, alignment, props.style];
  39161. });
  39162. const itemStyle = vue.computed(() => {
  39163. const itemBaseStyle = {
  39164. paddingBottom: `${verticalSize.value}px`,
  39165. marginRight: `${horizontalSize.value}px`
  39166. };
  39167. const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  39168. return [itemBaseStyle, fillStyle];
  39169. });
  39170. vue.watchEffect(() => {
  39171. const { size = "small", wrap, direction: dir, fill } = props;
  39172. if (isArray(size)) {
  39173. const [h = 0, v = 0] = size;
  39174. horizontalSize.value = h;
  39175. verticalSize.value = v;
  39176. } else {
  39177. let val;
  39178. if (isNumber(size)) {
  39179. val = size;
  39180. } else {
  39181. val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  39182. }
  39183. if ((wrap || fill) && dir === "horizontal") {
  39184. horizontalSize.value = verticalSize.value = val;
  39185. } else {
  39186. if (dir === "horizontal") {
  39187. horizontalSize.value = val;
  39188. verticalSize.value = 0;
  39189. } else {
  39190. verticalSize.value = val;
  39191. horizontalSize.value = 0;
  39192. }
  39193. }
  39194. }
  39195. });
  39196. return {
  39197. classes,
  39198. containerStyle,
  39199. itemStyle
  39200. };
  39201. }
  39202. const spaceProps = buildProps({
  39203. direction: {
  39204. type: String,
  39205. values: ["horizontal", "vertical"],
  39206. default: "horizontal"
  39207. },
  39208. class: {
  39209. type: definePropType([
  39210. String,
  39211. Object,
  39212. Array
  39213. ]),
  39214. default: ""
  39215. },
  39216. style: {
  39217. type: definePropType([String, Array, Object]),
  39218. default: ""
  39219. },
  39220. alignment: {
  39221. type: definePropType(String),
  39222. default: "center"
  39223. },
  39224. prefixCls: {
  39225. type: String
  39226. },
  39227. spacer: {
  39228. type: definePropType([Object, String, Number, Array]),
  39229. default: null,
  39230. validator: (val) => vue.isVNode(val) || isNumber(val) || isString(val)
  39231. },
  39232. wrap: Boolean,
  39233. fill: Boolean,
  39234. fillRatio: {
  39235. type: Number,
  39236. default: 100
  39237. },
  39238. size: {
  39239. type: [String, Array, Number],
  39240. values: componentSizes,
  39241. validator: (val) => {
  39242. return isNumber(val) || isArray(val) && val.length === 2 && val.every(isNumber);
  39243. }
  39244. }
  39245. });
  39246. const Space = vue.defineComponent({
  39247. name: "ElSpace",
  39248. props: spaceProps,
  39249. setup(props, { slots }) {
  39250. const { classes, containerStyle, itemStyle } = useSpace(props);
  39251. function extractChildren(children, parentKey = "", extractedChildren = []) {
  39252. const { prefixCls } = props;
  39253. children.forEach((child, loopKey) => {
  39254. if (isFragment(child)) {
  39255. if (isArray(child.children)) {
  39256. child.children.forEach((nested, key) => {
  39257. if (isFragment(nested) && isArray(nested.children)) {
  39258. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  39259. } else {
  39260. extractedChildren.push(vue.createVNode(Item, {
  39261. style: itemStyle.value,
  39262. prefixCls,
  39263. key: `nested-${parentKey + key}`
  39264. }, {
  39265. default: () => [nested]
  39266. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  39267. }
  39268. });
  39269. }
  39270. } else if (isValidElementNode(child)) {
  39271. extractedChildren.push(vue.createVNode(Item, {
  39272. style: itemStyle.value,
  39273. prefixCls,
  39274. key: `LoopKey${parentKey + loopKey}`
  39275. }, {
  39276. default: () => [child]
  39277. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  39278. }
  39279. });
  39280. return extractedChildren;
  39281. }
  39282. return () => {
  39283. var _a;
  39284. const { spacer, direction } = props;
  39285. const children = vue.renderSlot(slots, "default", { key: 0 }, () => []);
  39286. if (((_a = children.children) != null ? _a : []).length === 0)
  39287. return null;
  39288. if (isArray(children.children)) {
  39289. let extractedChildren = extractChildren(children.children);
  39290. if (spacer) {
  39291. const len = extractedChildren.length - 1;
  39292. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  39293. const children2 = [...acc, child];
  39294. if (idx !== len) {
  39295. children2.push(vue.createVNode("span", {
  39296. style: [
  39297. itemStyle.value,
  39298. direction === "vertical" ? "width: 100%" : null
  39299. ],
  39300. key: idx
  39301. }, [
  39302. vue.isVNode(spacer) ? spacer : vue.createTextVNode(spacer, PatchFlags.TEXT)
  39303. ], PatchFlags.STYLE));
  39304. }
  39305. return children2;
  39306. }, []);
  39307. }
  39308. return vue.createVNode("div", {
  39309. class: classes.value,
  39310. style: containerStyle.value
  39311. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  39312. }
  39313. return children.children;
  39314. };
  39315. }
  39316. });
  39317. const ElSpace = withInstall(Space);
  39318. const stepsProps = buildProps({
  39319. space: {
  39320. type: [Number, String],
  39321. default: ""
  39322. },
  39323. active: {
  39324. type: Number,
  39325. default: 0
  39326. },
  39327. direction: {
  39328. type: String,
  39329. default: "horizontal",
  39330. values: ["horizontal", "vertical"]
  39331. },
  39332. alignCenter: {
  39333. type: Boolean
  39334. },
  39335. simple: {
  39336. type: Boolean
  39337. },
  39338. finishStatus: {
  39339. type: String,
  39340. values: ["wait", "process", "finish", "error", "success"],
  39341. default: "finish"
  39342. },
  39343. processStatus: {
  39344. type: String,
  39345. values: ["wait", "process", "finish", "error", "success"],
  39346. default: "process"
  39347. }
  39348. });
  39349. const stepsEmits = {
  39350. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber)
  39351. };
  39352. const __default__$m = vue.defineComponent({
  39353. name: "ElSteps"
  39354. });
  39355. const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
  39356. ...__default__$m,
  39357. props: stepsProps,
  39358. emits: stepsEmits,
  39359. setup(__props, { emit }) {
  39360. const props = __props;
  39361. const ns = useNamespace("steps");
  39362. const steps = vue.ref([]);
  39363. vue.watch(steps, () => {
  39364. steps.value.forEach((instance, index) => {
  39365. instance.setIndex(index);
  39366. });
  39367. });
  39368. vue.provide("ElSteps", { props, steps });
  39369. vue.watch(() => props.active, (newVal, oldVal) => {
  39370. emit(CHANGE_EVENT, newVal, oldVal);
  39371. });
  39372. return (_ctx, _cache) => {
  39373. return vue.openBlock(), vue.createElementBlock("div", {
  39374. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  39375. }, [
  39376. vue.renderSlot(_ctx.$slots, "default")
  39377. ], 2);
  39378. };
  39379. }
  39380. });
  39381. var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "steps.vue"]]);
  39382. const stepProps = buildProps({
  39383. title: {
  39384. type: String,
  39385. default: ""
  39386. },
  39387. icon: {
  39388. type: iconPropType
  39389. },
  39390. description: {
  39391. type: String,
  39392. default: ""
  39393. },
  39394. status: {
  39395. type: String,
  39396. values: ["", "wait", "process", "finish", "error", "success"],
  39397. default: ""
  39398. }
  39399. });
  39400. const __default__$l = vue.defineComponent({
  39401. name: "ElStep"
  39402. });
  39403. const _sfc_main$s = vue.defineComponent({
  39404. ...__default__$l,
  39405. props: stepProps,
  39406. setup(__props) {
  39407. const props = __props;
  39408. const ns = useNamespace("step");
  39409. const index = vue.ref(-1);
  39410. const lineStyle = vue.ref({});
  39411. const internalStatus = vue.ref("");
  39412. const parent = vue.inject("ElSteps");
  39413. const currentInstance = vue.getCurrentInstance();
  39414. vue.onMounted(() => {
  39415. vue.watch([
  39416. () => parent.props.active,
  39417. () => parent.props.processStatus,
  39418. () => parent.props.finishStatus
  39419. ], ([active]) => {
  39420. updateStatus(active);
  39421. }, { immediate: true });
  39422. });
  39423. vue.onBeforeUnmount(() => {
  39424. parent.steps.value = parent.steps.value.filter((instance) => instance.uid !== (currentInstance == null ? void 0 : currentInstance.uid));
  39425. });
  39426. const currentStatus = vue.computed(() => {
  39427. return props.status || internalStatus.value;
  39428. });
  39429. const prevStatus = vue.computed(() => {
  39430. const prevStep = parent.steps.value[index.value - 1];
  39431. return prevStep ? prevStep.currentStatus : "wait";
  39432. });
  39433. const isCenter = vue.computed(() => {
  39434. return parent.props.alignCenter;
  39435. });
  39436. const isVertical = vue.computed(() => {
  39437. return parent.props.direction === "vertical";
  39438. });
  39439. const isSimple = vue.computed(() => {
  39440. return parent.props.simple;
  39441. });
  39442. const stepsCount = vue.computed(() => {
  39443. return parent.steps.value.length;
  39444. });
  39445. const isLast = vue.computed(() => {
  39446. var _a;
  39447. return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid);
  39448. });
  39449. const space = vue.computed(() => {
  39450. return isSimple.value ? "" : parent.props.space;
  39451. });
  39452. const style = vue.computed(() => {
  39453. const style2 = {
  39454. flexBasis: typeof space.value === "number" ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  39455. };
  39456. if (isVertical.value)
  39457. return style2;
  39458. if (isLast.value) {
  39459. style2.maxWidth = `${100 / stepsCount.value}%`;
  39460. }
  39461. return style2;
  39462. });
  39463. const setIndex = (val) => {
  39464. index.value = val;
  39465. };
  39466. const calcProgress = (status) => {
  39467. let step = 100;
  39468. const style2 = {};
  39469. style2.transitionDelay = `${150 * index.value}ms`;
  39470. if (status === parent.props.processStatus) {
  39471. step = 0;
  39472. } else if (status === "wait") {
  39473. step = 0;
  39474. style2.transitionDelay = `${-150 * index.value}ms`;
  39475. }
  39476. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  39477. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  39478. lineStyle.value = style2;
  39479. };
  39480. const updateStatus = (activeIndex) => {
  39481. if (activeIndex > index.value) {
  39482. internalStatus.value = parent.props.finishStatus;
  39483. } else if (activeIndex === index.value && prevStatus.value !== "error") {
  39484. internalStatus.value = parent.props.processStatus;
  39485. } else {
  39486. internalStatus.value = "wait";
  39487. }
  39488. const prevChild = parent.steps.value[index.value - 1];
  39489. if (prevChild)
  39490. prevChild.calcProgress(internalStatus.value);
  39491. };
  39492. const stepItemState = vue.reactive({
  39493. uid: vue.computed(() => currentInstance == null ? void 0 : currentInstance.uid),
  39494. currentStatus,
  39495. setIndex,
  39496. calcProgress
  39497. });
  39498. parent.steps.value = [...parent.steps.value, stepItemState];
  39499. return (_ctx, _cache) => {
  39500. return vue.openBlock(), vue.createElementBlock("div", {
  39501. style: vue.normalizeStyle(vue.unref(style)),
  39502. class: vue.normalizeClass([
  39503. vue.unref(ns).b(),
  39504. vue.unref(ns).is(vue.unref(isSimple) ? "simple" : vue.unref(parent).props.direction),
  39505. vue.unref(ns).is("flex", vue.unref(isLast) && !vue.unref(space) && !vue.unref(isCenter)),
  39506. vue.unref(ns).is("center", vue.unref(isCenter) && !vue.unref(isVertical) && !vue.unref(isSimple))
  39507. ])
  39508. }, [
  39509. vue.createCommentVNode(" icon & line "),
  39510. vue.createElementVNode("div", {
  39511. class: vue.normalizeClass([vue.unref(ns).e("head"), vue.unref(ns).is(vue.unref(currentStatus))])
  39512. }, [
  39513. !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  39514. key: 0,
  39515. class: vue.normalizeClass(vue.unref(ns).e("line"))
  39516. }, [
  39517. vue.createElementVNode("i", {
  39518. class: vue.normalizeClass(vue.unref(ns).e("line-inner")),
  39519. style: vue.normalizeStyle(lineStyle.value)
  39520. }, null, 6)
  39521. ], 2)) : vue.createCommentVNode("v-if", true),
  39522. vue.createElementVNode("div", {
  39523. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  39524. }, [
  39525. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  39526. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  39527. key: 0,
  39528. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  39529. }, {
  39530. default: vue.withCtx(() => [
  39531. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  39532. ]),
  39533. _: 1
  39534. }, 8, ["class"])) : vue.unref(currentStatus) === "success" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  39535. key: 1,
  39536. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  39537. }, {
  39538. default: vue.withCtx(() => [
  39539. vue.createVNode(vue.unref(check_default))
  39540. ]),
  39541. _: 1
  39542. }, 8, ["class"])) : vue.unref(currentStatus) === "error" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  39543. key: 2,
  39544. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  39545. }, {
  39546. default: vue.withCtx(() => [
  39547. vue.createVNode(vue.unref(close_default))
  39548. ]),
  39549. _: 1
  39550. }, 8, ["class"])) : !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  39551. key: 3,
  39552. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  39553. }, vue.toDisplayString(index.value + 1), 3)) : vue.createCommentVNode("v-if", true)
  39554. ])
  39555. ], 2)
  39556. ], 2),
  39557. vue.createCommentVNode(" title & description "),
  39558. vue.createElementVNode("div", {
  39559. class: vue.normalizeClass(vue.unref(ns).e("main"))
  39560. }, [
  39561. vue.createElementVNode("div", {
  39562. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(ns).is(vue.unref(currentStatus))])
  39563. }, [
  39564. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  39565. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  39566. ])
  39567. ], 2),
  39568. vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  39569. key: 0,
  39570. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  39571. }, null, 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  39572. key: 1,
  39573. class: vue.normalizeClass([vue.unref(ns).e("description"), vue.unref(ns).is(vue.unref(currentStatus))])
  39574. }, [
  39575. vue.renderSlot(_ctx.$slots, "description", {}, () => [
  39576. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  39577. ])
  39578. ], 2))
  39579. ], 2)
  39580. ], 6);
  39581. };
  39582. }
  39583. });
  39584. var Step = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "item.vue"]]);
  39585. const ElSteps = withInstall(Steps, {
  39586. Step
  39587. });
  39588. const ElStep = withNoopInstall(Step);
  39589. const switchProps = buildProps({
  39590. modelValue: {
  39591. type: [Boolean, String, Number],
  39592. default: false
  39593. },
  39594. value: {
  39595. type: [Boolean, String, Number],
  39596. default: false
  39597. },
  39598. disabled: {
  39599. type: Boolean,
  39600. default: false
  39601. },
  39602. width: {
  39603. type: [String, Number],
  39604. default: ""
  39605. },
  39606. inlinePrompt: {
  39607. type: Boolean,
  39608. default: false
  39609. },
  39610. activeIcon: {
  39611. type: iconPropType
  39612. },
  39613. inactiveIcon: {
  39614. type: iconPropType
  39615. },
  39616. activeText: {
  39617. type: String,
  39618. default: ""
  39619. },
  39620. inactiveText: {
  39621. type: String,
  39622. default: ""
  39623. },
  39624. activeColor: {
  39625. type: String,
  39626. default: ""
  39627. },
  39628. inactiveColor: {
  39629. type: String,
  39630. default: ""
  39631. },
  39632. borderColor: {
  39633. type: String,
  39634. default: ""
  39635. },
  39636. activeValue: {
  39637. type: [Boolean, String, Number],
  39638. default: true
  39639. },
  39640. inactiveValue: {
  39641. type: [Boolean, String, Number],
  39642. default: false
  39643. },
  39644. name: {
  39645. type: String,
  39646. default: ""
  39647. },
  39648. validateEvent: {
  39649. type: Boolean,
  39650. default: true
  39651. },
  39652. id: String,
  39653. loading: {
  39654. type: Boolean,
  39655. default: false
  39656. },
  39657. beforeChange: {
  39658. type: definePropType(Function)
  39659. },
  39660. size: {
  39661. type: String,
  39662. validator: isValidComponentSize
  39663. },
  39664. tabindex: {
  39665. type: [String, Number]
  39666. }
  39667. });
  39668. const switchEmits = {
  39669. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  39670. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  39671. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  39672. };
  39673. const _hoisted_1$d = ["onClick"];
  39674. const _hoisted_2$9 = ["id", "aria-checked", "aria-disabled", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
  39675. const _hoisted_3$4 = ["aria-hidden"];
  39676. const _hoisted_4$2 = ["aria-hidden"];
  39677. const _hoisted_5$1 = ["aria-hidden"];
  39678. const COMPONENT_NAME$8 = "ElSwitch";
  39679. const __default__$k = vue.defineComponent({
  39680. name: COMPONENT_NAME$8
  39681. });
  39682. const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
  39683. ...__default__$k,
  39684. props: switchProps,
  39685. emits: switchEmits,
  39686. setup(__props, { expose, emit }) {
  39687. const props = __props;
  39688. const vm = vue.getCurrentInstance();
  39689. const { formItem } = useFormItem();
  39690. const switchSize = useSize();
  39691. const ns = useNamespace("switch");
  39692. useDeprecated({
  39693. from: '"value"',
  39694. replacement: '"model-value" or "v-model"',
  39695. scope: COMPONENT_NAME$8,
  39696. version: "2.3.0",
  39697. ref: "https://element-plus.org/en-US/component/switch.html#attributes",
  39698. type: "Attribute"
  39699. }, vue.computed(() => {
  39700. var _a;
  39701. return !!((_a = vm.vnode.props) == null ? void 0 : _a.value);
  39702. }));
  39703. const { inputId } = useFormItemInputId(props, {
  39704. formItemContext: formItem
  39705. });
  39706. const switchDisabled = useDisabled(vue.computed(() => props.loading));
  39707. const isControlled = vue.ref(props.modelValue !== false);
  39708. const input = vue.ref();
  39709. const core = vue.ref();
  39710. const switchKls = vue.computed(() => [
  39711. ns.b(),
  39712. ns.m(switchSize.value),
  39713. ns.is("disabled", switchDisabled.value),
  39714. ns.is("checked", checked.value)
  39715. ]);
  39716. const coreStyle = vue.computed(() => ({
  39717. width: addUnit(props.width)
  39718. }));
  39719. vue.watch(() => props.modelValue, () => {
  39720. isControlled.value = true;
  39721. });
  39722. vue.watch(() => props.value, () => {
  39723. isControlled.value = false;
  39724. });
  39725. const actualValue = vue.computed(() => {
  39726. return isControlled.value ? props.modelValue : props.value;
  39727. });
  39728. const checked = vue.computed(() => actualValue.value === props.activeValue);
  39729. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  39730. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  39731. emit(CHANGE_EVENT, props.inactiveValue);
  39732. emit(INPUT_EVENT, props.inactiveValue);
  39733. }
  39734. vue.watch(checked, (val) => {
  39735. var _a;
  39736. input.value.checked = val;
  39737. if (props.validateEvent) {
  39738. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  39739. }
  39740. });
  39741. const handleChange = () => {
  39742. const val = checked.value ? props.inactiveValue : props.activeValue;
  39743. emit(UPDATE_MODEL_EVENT, val);
  39744. emit(CHANGE_EVENT, val);
  39745. emit(INPUT_EVENT, val);
  39746. vue.nextTick(() => {
  39747. input.value.checked = checked.value;
  39748. });
  39749. };
  39750. const switchValue = () => {
  39751. if (switchDisabled.value)
  39752. return;
  39753. const { beforeChange } = props;
  39754. if (!beforeChange) {
  39755. handleChange();
  39756. return;
  39757. }
  39758. const shouldChange = beforeChange();
  39759. const isPromiseOrBool = [
  39760. isPromise(shouldChange),
  39761. isBoolean(shouldChange)
  39762. ].includes(true);
  39763. if (!isPromiseOrBool) {
  39764. throwError(COMPONENT_NAME$8, "beforeChange must return type `Promise<boolean>` or `boolean`");
  39765. }
  39766. if (isPromise(shouldChange)) {
  39767. shouldChange.then((result) => {
  39768. if (result) {
  39769. handleChange();
  39770. }
  39771. }).catch((e) => {
  39772. });
  39773. } else if (shouldChange) {
  39774. handleChange();
  39775. }
  39776. };
  39777. const styles = vue.computed(() => {
  39778. return ns.cssVarBlock({
  39779. ...props.activeColor ? { "on-color": props.activeColor } : null,
  39780. ...props.inactiveColor ? { "off-color": props.inactiveColor } : null,
  39781. ...props.borderColor ? { "border-color": props.borderColor } : null
  39782. });
  39783. });
  39784. const focus = () => {
  39785. var _a, _b;
  39786. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  39787. };
  39788. vue.onMounted(() => {
  39789. input.value.checked = checked.value;
  39790. });
  39791. expose({
  39792. focus,
  39793. checked
  39794. });
  39795. return (_ctx, _cache) => {
  39796. return vue.openBlock(), vue.createElementBlock("div", {
  39797. class: vue.normalizeClass(vue.unref(switchKls)),
  39798. style: vue.normalizeStyle(vue.unref(styles)),
  39799. onClick: vue.withModifiers(switchValue, ["prevent"])
  39800. }, [
  39801. vue.createElementVNode("input", {
  39802. id: vue.unref(inputId),
  39803. ref_key: "input",
  39804. ref: input,
  39805. class: vue.normalizeClass(vue.unref(ns).e("input")),
  39806. type: "checkbox",
  39807. role: "switch",
  39808. "aria-checked": vue.unref(checked),
  39809. "aria-disabled": vue.unref(switchDisabled),
  39810. name: _ctx.name,
  39811. "true-value": _ctx.activeValue,
  39812. "false-value": _ctx.inactiveValue,
  39813. disabled: vue.unref(switchDisabled),
  39814. tabindex: _ctx.tabindex,
  39815. onChange: handleChange,
  39816. onKeydown: vue.withKeys(switchValue, ["enter"])
  39817. }, null, 42, _hoisted_2$9),
  39818. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (vue.openBlock(), vue.createElementBlock("span", {
  39819. key: 0,
  39820. class: vue.normalizeClass([
  39821. vue.unref(ns).e("label"),
  39822. vue.unref(ns).em("label", "left"),
  39823. vue.unref(ns).is("active", !vue.unref(checked))
  39824. ])
  39825. }, [
  39826. _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  39827. default: vue.withCtx(() => [
  39828. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveIcon)))
  39829. ]),
  39830. _: 1
  39831. })) : vue.createCommentVNode("v-if", true),
  39832. !_ctx.inactiveIcon && _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  39833. key: 1,
  39834. "aria-hidden": vue.unref(checked)
  39835. }, vue.toDisplayString(_ctx.inactiveText), 9, _hoisted_3$4)) : vue.createCommentVNode("v-if", true)
  39836. ], 2)) : vue.createCommentVNode("v-if", true),
  39837. vue.createElementVNode("span", {
  39838. ref_key: "core",
  39839. ref: core,
  39840. class: vue.normalizeClass(vue.unref(ns).e("core")),
  39841. style: vue.normalizeStyle(vue.unref(coreStyle))
  39842. }, [
  39843. _ctx.inlinePrompt ? (vue.openBlock(), vue.createElementBlock("div", {
  39844. key: 0,
  39845. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  39846. }, [
  39847. _ctx.activeIcon || _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  39848. key: 0,
  39849. class: vue.normalizeClass(vue.unref(ns).is("icon"))
  39850. }, {
  39851. default: vue.withCtx(() => [
  39852. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  39853. ]),
  39854. _: 1
  39855. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  39856. key: 1,
  39857. class: vue.normalizeClass(vue.unref(ns).is("text")),
  39858. "aria-hidden": !vue.unref(checked)
  39859. }, vue.toDisplayString(vue.unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4$2)) : vue.createCommentVNode("v-if", true)
  39860. ], 2)) : vue.createCommentVNode("v-if", true),
  39861. vue.createElementVNode("div", {
  39862. class: vue.normalizeClass(vue.unref(ns).e("action"))
  39863. }, [
  39864. _ctx.loading ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  39865. key: 0,
  39866. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  39867. }, {
  39868. default: vue.withCtx(() => [
  39869. vue.createVNode(vue.unref(loading_default))
  39870. ]),
  39871. _: 1
  39872. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  39873. ], 2)
  39874. ], 6),
  39875. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (vue.openBlock(), vue.createElementBlock("span", {
  39876. key: 1,
  39877. class: vue.normalizeClass([
  39878. vue.unref(ns).e("label"),
  39879. vue.unref(ns).em("label", "right"),
  39880. vue.unref(ns).is("active", vue.unref(checked))
  39881. ])
  39882. }, [
  39883. _ctx.activeIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  39884. default: vue.withCtx(() => [
  39885. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeIcon)))
  39886. ]),
  39887. _: 1
  39888. })) : vue.createCommentVNode("v-if", true),
  39889. !_ctx.activeIcon && _ctx.activeText ? (vue.openBlock(), vue.createElementBlock("span", {
  39890. key: 1,
  39891. "aria-hidden": !vue.unref(checked)
  39892. }, vue.toDisplayString(_ctx.activeText), 9, _hoisted_5$1)) : vue.createCommentVNode("v-if", true)
  39893. ], 2)) : vue.createCommentVNode("v-if", true)
  39894. ], 14, _hoisted_1$d);
  39895. };
  39896. }
  39897. });
  39898. var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__file", "switch.vue"]]);
  39899. const ElSwitch = withInstall(Switch);
  39900. var matchHtmlRegExp = /["'&<>]/;
  39901. var escapeHtml_1 = escapeHtml;
  39902. function escapeHtml(string) {
  39903. var str = "" + string;
  39904. var match = matchHtmlRegExp.exec(str);
  39905. if (!match) {
  39906. return str;
  39907. }
  39908. var escape;
  39909. var html = "";
  39910. var index = 0;
  39911. var lastIndex = 0;
  39912. for (index = match.index; index < str.length; index++) {
  39913. switch (str.charCodeAt(index)) {
  39914. case 34:
  39915. escape = "&quot;";
  39916. break;
  39917. case 38:
  39918. escape = "&amp;";
  39919. break;
  39920. case 39:
  39921. escape = "&#39;";
  39922. break;
  39923. case 60:
  39924. escape = "&lt;";
  39925. break;
  39926. case 62:
  39927. escape = "&gt;";
  39928. break;
  39929. default:
  39930. continue;
  39931. }
  39932. if (lastIndex !== index) {
  39933. html += str.substring(lastIndex, index);
  39934. }
  39935. lastIndex = index + 1;
  39936. html += escape;
  39937. }
  39938. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  39939. }
  39940. /*!
  39941. * escape-html
  39942. * Copyright(c) 2012-2013 TJ Holowaychuk
  39943. * Copyright(c) 2015 Andreas Lubbe
  39944. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  39945. * MIT Licensed
  39946. */
  39947. const getCell = function(event) {
  39948. var _a;
  39949. return (_a = event.target) == null ? void 0 : _a.closest("td");
  39950. };
  39951. const isObject = function(obj) {
  39952. return obj !== null && typeof obj === "object";
  39953. };
  39954. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  39955. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  39956. return array;
  39957. }
  39958. if (typeof reverse === "string") {
  39959. reverse = reverse === "descending" ? -1 : 1;
  39960. } else {
  39961. reverse = reverse && reverse < 0 ? -1 : 1;
  39962. }
  39963. const getKey = sortMethod ? null : function(value, index) {
  39964. if (sortBy) {
  39965. if (!Array.isArray(sortBy)) {
  39966. sortBy = [sortBy];
  39967. }
  39968. return sortBy.map((by) => {
  39969. if (typeof by === "string") {
  39970. return get(value, by);
  39971. } else {
  39972. return by(value, index, array);
  39973. }
  39974. });
  39975. }
  39976. if (sortKey !== "$key") {
  39977. if (isObject(value) && "$value" in value)
  39978. value = value.$value;
  39979. }
  39980. return [isObject(value) ? get(value, sortKey) : value];
  39981. };
  39982. const compare = function(a, b) {
  39983. if (sortMethod) {
  39984. return sortMethod(a.value, b.value);
  39985. }
  39986. for (let i = 0, len = a.key.length; i < len; i++) {
  39987. if (a.key[i] < b.key[i]) {
  39988. return -1;
  39989. }
  39990. if (a.key[i] > b.key[i]) {
  39991. return 1;
  39992. }
  39993. }
  39994. return 0;
  39995. };
  39996. return array.map((value, index) => {
  39997. return {
  39998. value,
  39999. index,
  40000. key: getKey ? getKey(value, index) : null
  40001. };
  40002. }).sort((a, b) => {
  40003. let order = compare(a, b);
  40004. if (!order) {
  40005. order = a.index - b.index;
  40006. }
  40007. return order * +reverse;
  40008. }).map((item) => item.value);
  40009. };
  40010. const getColumnById = function(table, columnId) {
  40011. let column = null;
  40012. table.columns.forEach((item) => {
  40013. if (item.id === columnId) {
  40014. column = item;
  40015. }
  40016. });
  40017. return column;
  40018. };
  40019. const getColumnByKey = function(table, columnKey) {
  40020. let column = null;
  40021. for (let i = 0; i < table.columns.length; i++) {
  40022. const item = table.columns[i];
  40023. if (item.columnKey === columnKey) {
  40024. column = item;
  40025. break;
  40026. }
  40027. }
  40028. if (!column)
  40029. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  40030. return column;
  40031. };
  40032. const getColumnByCell = function(table, cell, namespace) {
  40033. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  40034. if (matches) {
  40035. return getColumnById(table, matches[0]);
  40036. }
  40037. return null;
  40038. };
  40039. const getRowIdentity = (row, rowKey) => {
  40040. if (!row)
  40041. throw new Error("Row is required when get row identity");
  40042. if (typeof rowKey === "string") {
  40043. if (!rowKey.includes(".")) {
  40044. return `${row[rowKey]}`;
  40045. }
  40046. const key = rowKey.split(".");
  40047. let current = row;
  40048. for (const element of key) {
  40049. current = current[element];
  40050. }
  40051. return `${current}`;
  40052. } else if (typeof rowKey === "function") {
  40053. return rowKey.call(null, row);
  40054. }
  40055. };
  40056. const getKeysMap = function(array, rowKey) {
  40057. const arrayMap = {};
  40058. (array || []).forEach((row, index) => {
  40059. arrayMap[getRowIdentity(row, rowKey)] = { row, index };
  40060. });
  40061. return arrayMap;
  40062. };
  40063. function mergeOptions(defaults, config) {
  40064. const options = {};
  40065. let key;
  40066. for (key in defaults) {
  40067. options[key] = defaults[key];
  40068. }
  40069. for (key in config) {
  40070. if (hasOwn(config, key)) {
  40071. const value = config[key];
  40072. if (typeof value !== "undefined") {
  40073. options[key] = value;
  40074. }
  40075. }
  40076. }
  40077. return options;
  40078. }
  40079. function parseWidth(width) {
  40080. if (width === "")
  40081. return width;
  40082. if (width !== void 0) {
  40083. width = Number.parseInt(width, 10);
  40084. if (Number.isNaN(width)) {
  40085. width = "";
  40086. }
  40087. }
  40088. return width;
  40089. }
  40090. function parseMinWidth(minWidth) {
  40091. if (minWidth === "")
  40092. return minWidth;
  40093. if (minWidth !== void 0) {
  40094. minWidth = parseWidth(minWidth);
  40095. if (Number.isNaN(minWidth)) {
  40096. minWidth = 80;
  40097. }
  40098. }
  40099. return minWidth;
  40100. }
  40101. function parseHeight(height) {
  40102. if (typeof height === "number") {
  40103. return height;
  40104. }
  40105. if (typeof height === "string") {
  40106. if (/^\d+(?:px)?$/.test(height)) {
  40107. return Number.parseInt(height, 10);
  40108. } else {
  40109. return height;
  40110. }
  40111. }
  40112. return null;
  40113. }
  40114. function compose(...funcs) {
  40115. if (funcs.length === 0) {
  40116. return (arg) => arg;
  40117. }
  40118. if (funcs.length === 1) {
  40119. return funcs[0];
  40120. }
  40121. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  40122. }
  40123. function toggleRowStatus(statusArr, row, newVal) {
  40124. let changed = false;
  40125. const index = statusArr.indexOf(row);
  40126. const included = index !== -1;
  40127. const toggleStatus = (type) => {
  40128. if (type === "add") {
  40129. statusArr.push(row);
  40130. } else {
  40131. statusArr.splice(index, 1);
  40132. }
  40133. changed = true;
  40134. if (isArray(row.children)) {
  40135. row.children.forEach((item) => {
  40136. toggleRowStatus(statusArr, item, newVal != null ? newVal : !included);
  40137. });
  40138. }
  40139. };
  40140. if (isBoolean(newVal)) {
  40141. if (newVal && !included) {
  40142. toggleStatus("add");
  40143. } else if (!newVal && included) {
  40144. toggleStatus("remove");
  40145. }
  40146. } else {
  40147. included ? toggleStatus("remove") : toggleStatus("add");
  40148. }
  40149. return changed;
  40150. }
  40151. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren") {
  40152. const isNil = (array) => !(Array.isArray(array) && array.length);
  40153. function _walker(parent, children, level) {
  40154. cb(parent, children, level);
  40155. children.forEach((item) => {
  40156. if (item[lazyKey]) {
  40157. cb(item, null, level + 1);
  40158. return;
  40159. }
  40160. const children2 = item[childrenKey];
  40161. if (!isNil(children2)) {
  40162. _walker(item, children2, level + 1);
  40163. }
  40164. });
  40165. }
  40166. root.forEach((item) => {
  40167. if (item[lazyKey]) {
  40168. cb(item, null, 0);
  40169. return;
  40170. }
  40171. const children = item[childrenKey];
  40172. if (!isNil(children)) {
  40173. _walker(item, children, 0);
  40174. }
  40175. });
  40176. }
  40177. let removePopper;
  40178. function createTablePopper(parentNode, trigger, popperContent, popperOptions, tooltipEffect) {
  40179. const { nextZIndex } = useZIndex();
  40180. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  40181. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  40182. function renderContent() {
  40183. const isLight = tooltipEffect === "light";
  40184. const content2 = document.createElement("div");
  40185. content2.className = `${ns}-popper ${isLight ? "is-light" : "is-dark"}`;
  40186. popperContent = escapeHtml_1(popperContent);
  40187. content2.innerHTML = popperContent;
  40188. content2.style.zIndex = String(nextZIndex());
  40189. parentNode == null ? void 0 : parentNode.appendChild(content2);
  40190. return content2;
  40191. }
  40192. function renderArrow() {
  40193. const arrow2 = document.createElement("div");
  40194. arrow2.className = `${ns}-popper__arrow`;
  40195. return arrow2;
  40196. }
  40197. function showPopper() {
  40198. popperInstance && popperInstance.update();
  40199. }
  40200. removePopper == null ? void 0 : removePopper();
  40201. removePopper = () => {
  40202. try {
  40203. popperInstance && popperInstance.destroy();
  40204. content && (parentNode == null ? void 0 : parentNode.removeChild(content));
  40205. trigger.removeEventListener("mouseenter", showPopper);
  40206. trigger.removeEventListener("mouseleave", removePopper);
  40207. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper);
  40208. removePopper = void 0;
  40209. } catch (e) {
  40210. }
  40211. };
  40212. let popperInstance = null;
  40213. const content = renderContent();
  40214. const arrow = renderArrow();
  40215. content.appendChild(arrow);
  40216. popperInstance = yn(trigger, content, {
  40217. strategy: "absolute",
  40218. modifiers: [
  40219. {
  40220. name: "offset",
  40221. options: {
  40222. offset: [0, 8]
  40223. }
  40224. },
  40225. {
  40226. name: "arrow",
  40227. options: {
  40228. element: arrow,
  40229. padding: 10
  40230. }
  40231. }
  40232. ],
  40233. ...popperOptions
  40234. });
  40235. trigger.addEventListener("mouseenter", showPopper);
  40236. trigger.addEventListener("mouseleave", removePopper);
  40237. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  40238. return popperInstance;
  40239. }
  40240. function getCurrentColumns(column) {
  40241. if (column.children) {
  40242. return flatMap(column.children, getCurrentColumns);
  40243. } else {
  40244. return [column];
  40245. }
  40246. }
  40247. function getColSpan(colSpan, column) {
  40248. return colSpan + column.colSpan;
  40249. }
  40250. const isFixedColumn = (index, fixed, store, realColumns) => {
  40251. let start = 0;
  40252. let after = index;
  40253. const columns = store.states.columns.value;
  40254. if (realColumns) {
  40255. const curColumns = getCurrentColumns(realColumns[index]);
  40256. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  40257. start = preColumns.reduce(getColSpan, 0);
  40258. after = start + curColumns.reduce(getColSpan, 0) - 1;
  40259. } else {
  40260. start = index;
  40261. }
  40262. let fixedLayout;
  40263. switch (fixed) {
  40264. case "left":
  40265. if (after < store.states.fixedLeafColumnsLength.value) {
  40266. fixedLayout = "left";
  40267. }
  40268. break;
  40269. case "right":
  40270. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  40271. fixedLayout = "right";
  40272. }
  40273. break;
  40274. default:
  40275. if (after < store.states.fixedLeafColumnsLength.value) {
  40276. fixedLayout = "left";
  40277. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  40278. fixedLayout = "right";
  40279. }
  40280. }
  40281. return fixedLayout ? {
  40282. direction: fixedLayout,
  40283. start,
  40284. after
  40285. } : {};
  40286. };
  40287. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  40288. const classes = [];
  40289. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  40290. if (direction) {
  40291. const isLeft = direction === "left";
  40292. classes.push(`${namespace}-fixed-column--${direction}`);
  40293. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  40294. classes.push("is-last-column");
  40295. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  40296. classes.push("is-first-column");
  40297. }
  40298. }
  40299. return classes;
  40300. };
  40301. function getOffset(offset, column) {
  40302. return offset + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  40303. }
  40304. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  40305. const {
  40306. direction,
  40307. start = 0,
  40308. after = 0
  40309. } = isFixedColumn(index, fixed, store, realColumns);
  40310. if (!direction) {
  40311. return;
  40312. }
  40313. const styles = {};
  40314. const isLeft = direction === "left";
  40315. const columns = store.states.columns.value;
  40316. if (isLeft) {
  40317. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  40318. } else {
  40319. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  40320. }
  40321. return styles;
  40322. };
  40323. const ensurePosition = (style, key) => {
  40324. if (!style)
  40325. return;
  40326. if (!Number.isNaN(style[key])) {
  40327. style[key] = `${style[key]}px`;
  40328. }
  40329. };
  40330. function useExpand(watcherData) {
  40331. const instance = vue.getCurrentInstance();
  40332. const defaultExpandAll = vue.ref(false);
  40333. const expandRows = vue.ref([]);
  40334. const updateExpandRows = () => {
  40335. const data = watcherData.data.value || [];
  40336. const rowKey = watcherData.rowKey.value;
  40337. if (defaultExpandAll.value) {
  40338. expandRows.value = data.slice();
  40339. } else if (rowKey) {
  40340. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  40341. expandRows.value = data.reduce((prev, row) => {
  40342. const rowId = getRowIdentity(row, rowKey);
  40343. const rowInfo = expandRowsMap[rowId];
  40344. if (rowInfo) {
  40345. prev.push(row);
  40346. }
  40347. return prev;
  40348. }, []);
  40349. } else {
  40350. expandRows.value = [];
  40351. }
  40352. };
  40353. const toggleRowExpansion = (row, expanded) => {
  40354. const changed = toggleRowStatus(expandRows.value, row, expanded);
  40355. if (changed) {
  40356. instance.emit("expand-change", row, expandRows.value.slice());
  40357. }
  40358. };
  40359. const setExpandRowKeys = (rowKeys) => {
  40360. instance.store.assertRowKey();
  40361. const data = watcherData.data.value || [];
  40362. const rowKey = watcherData.rowKey.value;
  40363. const keysMap = getKeysMap(data, rowKey);
  40364. expandRows.value = rowKeys.reduce((prev, cur) => {
  40365. const info = keysMap[cur];
  40366. if (info) {
  40367. prev.push(info.row);
  40368. }
  40369. return prev;
  40370. }, []);
  40371. };
  40372. const isRowExpanded = (row) => {
  40373. const rowKey = watcherData.rowKey.value;
  40374. if (rowKey) {
  40375. const expandMap = getKeysMap(expandRows.value, rowKey);
  40376. return !!expandMap[getRowIdentity(row, rowKey)];
  40377. }
  40378. return expandRows.value.includes(row);
  40379. };
  40380. return {
  40381. updateExpandRows,
  40382. toggleRowExpansion,
  40383. setExpandRowKeys,
  40384. isRowExpanded,
  40385. states: {
  40386. expandRows,
  40387. defaultExpandAll
  40388. }
  40389. };
  40390. }
  40391. function useCurrent(watcherData) {
  40392. const instance = vue.getCurrentInstance();
  40393. const _currentRowKey = vue.ref(null);
  40394. const currentRow = vue.ref(null);
  40395. const setCurrentRowKey = (key) => {
  40396. instance.store.assertRowKey();
  40397. _currentRowKey.value = key;
  40398. setCurrentRowByKey(key);
  40399. };
  40400. const restoreCurrentRowKey = () => {
  40401. _currentRowKey.value = null;
  40402. };
  40403. const setCurrentRowByKey = (key) => {
  40404. const { data, rowKey } = watcherData;
  40405. let _currentRow = null;
  40406. if (rowKey.value) {
  40407. _currentRow = (vue.unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  40408. }
  40409. currentRow.value = _currentRow;
  40410. instance.emit("current-change", currentRow.value, null);
  40411. };
  40412. const updateCurrentRow = (_currentRow) => {
  40413. const oldCurrentRow = currentRow.value;
  40414. if (_currentRow && _currentRow !== oldCurrentRow) {
  40415. currentRow.value = _currentRow;
  40416. instance.emit("current-change", currentRow.value, oldCurrentRow);
  40417. return;
  40418. }
  40419. if (!_currentRow && oldCurrentRow) {
  40420. currentRow.value = null;
  40421. instance.emit("current-change", null, oldCurrentRow);
  40422. }
  40423. };
  40424. const updateCurrentRowData = () => {
  40425. const rowKey = watcherData.rowKey.value;
  40426. const data = watcherData.data.value || [];
  40427. const oldCurrentRow = currentRow.value;
  40428. if (!data.includes(oldCurrentRow) && oldCurrentRow) {
  40429. if (rowKey) {
  40430. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  40431. setCurrentRowByKey(currentRowKey);
  40432. } else {
  40433. currentRow.value = null;
  40434. }
  40435. if (currentRow.value === null) {
  40436. instance.emit("current-change", null, oldCurrentRow);
  40437. }
  40438. } else if (_currentRowKey.value) {
  40439. setCurrentRowByKey(_currentRowKey.value);
  40440. restoreCurrentRowKey();
  40441. }
  40442. };
  40443. return {
  40444. setCurrentRowKey,
  40445. restoreCurrentRowKey,
  40446. setCurrentRowByKey,
  40447. updateCurrentRow,
  40448. updateCurrentRowData,
  40449. states: {
  40450. _currentRowKey,
  40451. currentRow
  40452. }
  40453. };
  40454. }
  40455. function useTree$2(watcherData) {
  40456. const expandRowKeys = vue.ref([]);
  40457. const treeData = vue.ref({});
  40458. const indent = vue.ref(16);
  40459. const lazy = vue.ref(false);
  40460. const lazyTreeNodeMap = vue.ref({});
  40461. const lazyColumnIdentifier = vue.ref("hasChildren");
  40462. const childrenColumnName = vue.ref("children");
  40463. const instance = vue.getCurrentInstance();
  40464. const normalizedData = vue.computed(() => {
  40465. if (!watcherData.rowKey.value)
  40466. return {};
  40467. const data = watcherData.data.value || [];
  40468. return normalize(data);
  40469. });
  40470. const normalizedLazyNode = vue.computed(() => {
  40471. const rowKey = watcherData.rowKey.value;
  40472. const keys = Object.keys(lazyTreeNodeMap.value);
  40473. const res = {};
  40474. if (!keys.length)
  40475. return res;
  40476. keys.forEach((key) => {
  40477. if (lazyTreeNodeMap.value[key].length) {
  40478. const item = { children: [] };
  40479. lazyTreeNodeMap.value[key].forEach((row) => {
  40480. const currentRowKey = getRowIdentity(row, rowKey);
  40481. item.children.push(currentRowKey);
  40482. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  40483. res[currentRowKey] = { children: [] };
  40484. }
  40485. });
  40486. res[key] = item;
  40487. }
  40488. });
  40489. return res;
  40490. });
  40491. const normalize = (data) => {
  40492. const rowKey = watcherData.rowKey.value;
  40493. const res = {};
  40494. walkTreeNode(data, (parent, children, level) => {
  40495. const parentId = getRowIdentity(parent, rowKey);
  40496. if (Array.isArray(children)) {
  40497. res[parentId] = {
  40498. children: children.map((row) => getRowIdentity(row, rowKey)),
  40499. level
  40500. };
  40501. } else if (lazy.value) {
  40502. res[parentId] = {
  40503. children: [],
  40504. lazy: true,
  40505. level
  40506. };
  40507. }
  40508. }, childrenColumnName.value, lazyColumnIdentifier.value);
  40509. return res;
  40510. };
  40511. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a) => (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value)()) => {
  40512. var _a2;
  40513. const nested = normalizedData.value;
  40514. const normalizedLazyNode_ = normalizedLazyNode.value;
  40515. const keys = Object.keys(nested);
  40516. const newTreeData = {};
  40517. if (keys.length) {
  40518. const oldTreeData = vue.unref(treeData);
  40519. const rootLazyRowKeys = [];
  40520. const getExpanded = (oldValue, key) => {
  40521. if (ifChangeExpandRowKeys) {
  40522. if (expandRowKeys.value) {
  40523. return ifExpandAll || expandRowKeys.value.includes(key);
  40524. } else {
  40525. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  40526. }
  40527. } else {
  40528. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  40529. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  40530. }
  40531. };
  40532. keys.forEach((key) => {
  40533. const oldValue = oldTreeData[key];
  40534. const newValue = { ...nested[key] };
  40535. newValue.expanded = getExpanded(oldValue, key);
  40536. if (newValue.lazy) {
  40537. const { loaded = false, loading = false } = oldValue || {};
  40538. newValue.loaded = !!loaded;
  40539. newValue.loading = !!loading;
  40540. rootLazyRowKeys.push(key);
  40541. }
  40542. newTreeData[key] = newValue;
  40543. });
  40544. const lazyKeys = Object.keys(normalizedLazyNode_);
  40545. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  40546. lazyKeys.forEach((key) => {
  40547. const oldValue = oldTreeData[key];
  40548. const lazyNodeChildren = normalizedLazyNode_[key].children;
  40549. if (rootLazyRowKeys.includes(key)) {
  40550. if (newTreeData[key].children.length !== 0) {
  40551. throw new Error("[ElTable]children must be an empty array.");
  40552. }
  40553. newTreeData[key].children = lazyNodeChildren;
  40554. } else {
  40555. const { loaded = false, loading = false } = oldValue || {};
  40556. newTreeData[key] = {
  40557. lazy: true,
  40558. loaded: !!loaded,
  40559. loading: !!loading,
  40560. expanded: getExpanded(oldValue, key),
  40561. children: lazyNodeChildren,
  40562. level: ""
  40563. };
  40564. }
  40565. });
  40566. }
  40567. }
  40568. treeData.value = newTreeData;
  40569. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  40570. };
  40571. vue.watch(() => expandRowKeys.value, () => {
  40572. updateTreeData(true);
  40573. });
  40574. vue.watch(() => normalizedData.value, () => {
  40575. updateTreeData();
  40576. });
  40577. vue.watch(() => normalizedLazyNode.value, () => {
  40578. updateTreeData();
  40579. });
  40580. const updateTreeExpandKeys = (value) => {
  40581. expandRowKeys.value = value;
  40582. updateTreeData();
  40583. };
  40584. const toggleTreeExpansion = (row, expanded) => {
  40585. instance.store.assertRowKey();
  40586. const rowKey = watcherData.rowKey.value;
  40587. const id = getRowIdentity(row, rowKey);
  40588. const data = id && treeData.value[id];
  40589. if (id && data && "expanded" in data) {
  40590. const oldExpanded = data.expanded;
  40591. expanded = typeof expanded === "undefined" ? !data.expanded : expanded;
  40592. treeData.value[id].expanded = expanded;
  40593. if (oldExpanded !== expanded) {
  40594. instance.emit("expand-change", row, expanded);
  40595. }
  40596. instance.store.updateTableScrollY();
  40597. }
  40598. };
  40599. const loadOrToggle = (row) => {
  40600. instance.store.assertRowKey();
  40601. const rowKey = watcherData.rowKey.value;
  40602. const id = getRowIdentity(row, rowKey);
  40603. const data = treeData.value[id];
  40604. if (lazy.value && data && "loaded" in data && !data.loaded) {
  40605. loadData(row, id, data);
  40606. } else {
  40607. toggleTreeExpansion(row, void 0);
  40608. }
  40609. };
  40610. const loadData = (row, key, treeNode) => {
  40611. const { load } = instance.props;
  40612. if (load && !treeData.value[key].loaded) {
  40613. treeData.value[key].loading = true;
  40614. load(row, treeNode, (data) => {
  40615. if (!Array.isArray(data)) {
  40616. throw new TypeError("[ElTable] data must be an array");
  40617. }
  40618. treeData.value[key].loading = false;
  40619. treeData.value[key].loaded = true;
  40620. treeData.value[key].expanded = true;
  40621. if (data.length) {
  40622. lazyTreeNodeMap.value[key] = data;
  40623. }
  40624. instance.emit("expand-change", row, true);
  40625. });
  40626. }
  40627. };
  40628. return {
  40629. loadData,
  40630. loadOrToggle,
  40631. toggleTreeExpansion,
  40632. updateTreeExpandKeys,
  40633. updateTreeData,
  40634. normalize,
  40635. states: {
  40636. expandRowKeys,
  40637. treeData,
  40638. indent,
  40639. lazy,
  40640. lazyTreeNodeMap,
  40641. lazyColumnIdentifier,
  40642. childrenColumnName
  40643. }
  40644. };
  40645. }
  40646. const sortData = (data, states) => {
  40647. const sortingColumn = states.sortingColumn;
  40648. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  40649. return data;
  40650. }
  40651. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  40652. };
  40653. const doFlattenColumns = (columns) => {
  40654. const result = [];
  40655. columns.forEach((column) => {
  40656. if (column.children) {
  40657. result.push.apply(result, doFlattenColumns(column.children));
  40658. } else {
  40659. result.push(column);
  40660. }
  40661. });
  40662. return result;
  40663. };
  40664. function useWatcher$1() {
  40665. var _a;
  40666. const instance = vue.getCurrentInstance();
  40667. const { size: tableSize } = vue.toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
  40668. const rowKey = vue.ref(null);
  40669. const data = vue.ref([]);
  40670. const _data = vue.ref([]);
  40671. const isComplex = vue.ref(false);
  40672. const _columns = vue.ref([]);
  40673. const originColumns = vue.ref([]);
  40674. const columns = vue.ref([]);
  40675. const fixedColumns = vue.ref([]);
  40676. const rightFixedColumns = vue.ref([]);
  40677. const leafColumns = vue.ref([]);
  40678. const fixedLeafColumns = vue.ref([]);
  40679. const rightFixedLeafColumns = vue.ref([]);
  40680. const leafColumnsLength = vue.ref(0);
  40681. const fixedLeafColumnsLength = vue.ref(0);
  40682. const rightFixedLeafColumnsLength = vue.ref(0);
  40683. const isAllSelected = vue.ref(false);
  40684. const selection = vue.ref([]);
  40685. const reserveSelection = vue.ref(false);
  40686. const selectOnIndeterminate = vue.ref(false);
  40687. const selectable = vue.ref(null);
  40688. const filters = vue.ref({});
  40689. const filteredData = vue.ref(null);
  40690. const sortingColumn = vue.ref(null);
  40691. const sortProp = vue.ref(null);
  40692. const sortOrder = vue.ref(null);
  40693. const hoverRow = vue.ref(null);
  40694. vue.watch(data, () => instance.state && scheduleLayout(false), {
  40695. deep: true
  40696. });
  40697. const assertRowKey = () => {
  40698. if (!rowKey.value)
  40699. throw new Error("[ElTable] prop row-key is required");
  40700. };
  40701. const updateChildFixed = (column) => {
  40702. var _a2;
  40703. (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => {
  40704. childColumn.fixed = column.fixed;
  40705. updateChildFixed(childColumn);
  40706. });
  40707. };
  40708. const updateColumns = () => {
  40709. _columns.value.forEach((column) => {
  40710. updateChildFixed(column);
  40711. });
  40712. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  40713. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  40714. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  40715. _columns.value[0].fixed = true;
  40716. fixedColumns.value.unshift(_columns.value[0]);
  40717. }
  40718. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  40719. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  40720. const leafColumns2 = doFlattenColumns(notFixedColumns);
  40721. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  40722. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  40723. leafColumnsLength.value = leafColumns2.length;
  40724. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  40725. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  40726. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  40727. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  40728. };
  40729. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  40730. if (needUpdateColumns) {
  40731. updateColumns();
  40732. }
  40733. if (immediate) {
  40734. instance.state.doLayout();
  40735. } else {
  40736. instance.state.debouncedUpdateLayout();
  40737. }
  40738. };
  40739. const isSelected = (row) => {
  40740. return selection.value.includes(row);
  40741. };
  40742. const clearSelection = () => {
  40743. isAllSelected.value = false;
  40744. const oldSelection = selection.value;
  40745. if (oldSelection.length) {
  40746. selection.value = [];
  40747. instance.emit("selection-change", []);
  40748. }
  40749. };
  40750. const cleanSelection = () => {
  40751. let deleted;
  40752. if (rowKey.value) {
  40753. deleted = [];
  40754. const selectedMap = getKeysMap(selection.value, rowKey.value);
  40755. const dataMap = getKeysMap(data.value, rowKey.value);
  40756. for (const key in selectedMap) {
  40757. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  40758. deleted.push(selectedMap[key].row);
  40759. }
  40760. }
  40761. } else {
  40762. deleted = selection.value.filter((item) => !data.value.includes(item));
  40763. }
  40764. if (deleted.length) {
  40765. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  40766. selection.value = newSelection;
  40767. instance.emit("selection-change", newSelection.slice());
  40768. }
  40769. };
  40770. const getSelectionRows = () => {
  40771. return (selection.value || []).slice();
  40772. };
  40773. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  40774. const changed = toggleRowStatus(selection.value, row, selected);
  40775. if (changed) {
  40776. const newSelection = (selection.value || []).slice();
  40777. if (emitChange) {
  40778. instance.emit("select", newSelection, row);
  40779. }
  40780. instance.emit("selection-change", newSelection);
  40781. }
  40782. };
  40783. const _toggleAllSelection = () => {
  40784. var _a2, _b;
  40785. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  40786. isAllSelected.value = value;
  40787. let selectionChanged = false;
  40788. let childrenCount = 0;
  40789. const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
  40790. data.value.forEach((row, index) => {
  40791. const rowIndex = index + childrenCount;
  40792. if (selectable.value) {
  40793. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  40794. selectionChanged = true;
  40795. }
  40796. } else {
  40797. if (toggleRowStatus(selection.value, row, value)) {
  40798. selectionChanged = true;
  40799. }
  40800. }
  40801. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  40802. });
  40803. if (selectionChanged) {
  40804. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  40805. }
  40806. instance.emit("select-all", selection.value);
  40807. };
  40808. const updateSelectionByRowKey = () => {
  40809. const selectedMap = getKeysMap(selection.value, rowKey.value);
  40810. data.value.forEach((row) => {
  40811. const rowId = getRowIdentity(row, rowKey.value);
  40812. const rowInfo = selectedMap[rowId];
  40813. if (rowInfo) {
  40814. selection.value[rowInfo.index] = row;
  40815. }
  40816. });
  40817. };
  40818. const updateAllSelected = () => {
  40819. var _a2, _b, _c;
  40820. if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
  40821. isAllSelected.value = false;
  40822. return;
  40823. }
  40824. let selectedMap;
  40825. if (rowKey.value) {
  40826. selectedMap = getKeysMap(selection.value, rowKey.value);
  40827. }
  40828. const isSelected2 = function(row) {
  40829. if (selectedMap) {
  40830. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  40831. } else {
  40832. return selection.value.includes(row);
  40833. }
  40834. };
  40835. let isAllSelected_ = true;
  40836. let selectedCount = 0;
  40837. let childrenCount = 0;
  40838. for (let i = 0, j = (data.value || []).length; i < j; i++) {
  40839. const keyProp = (_c = (_b = instance == null ? void 0 : instance.store) == null ? void 0 : _b.states) == null ? void 0 : _c.rowKey.value;
  40840. const rowIndex = i + childrenCount;
  40841. const item = data.value[i];
  40842. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  40843. if (!isSelected2(item)) {
  40844. if (!selectable.value || isRowSelectable) {
  40845. isAllSelected_ = false;
  40846. break;
  40847. }
  40848. } else {
  40849. selectedCount++;
  40850. }
  40851. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  40852. }
  40853. if (selectedCount === 0)
  40854. isAllSelected_ = false;
  40855. isAllSelected.value = isAllSelected_;
  40856. };
  40857. const getChildrenCount = (rowKey2) => {
  40858. var _a2;
  40859. if (!instance || !instance.store)
  40860. return 0;
  40861. const { treeData } = instance.store.states;
  40862. let count = 0;
  40863. const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
  40864. if (children) {
  40865. count += children.length;
  40866. children.forEach((childKey) => {
  40867. count += getChildrenCount(childKey);
  40868. });
  40869. }
  40870. return count;
  40871. };
  40872. const updateFilters = (columns2, values) => {
  40873. if (!Array.isArray(columns2)) {
  40874. columns2 = [columns2];
  40875. }
  40876. const filters_ = {};
  40877. columns2.forEach((col) => {
  40878. filters.value[col.id] = values;
  40879. filters_[col.columnKey || col.id] = values;
  40880. });
  40881. return filters_;
  40882. };
  40883. const updateSort = (column, prop, order) => {
  40884. if (sortingColumn.value && sortingColumn.value !== column) {
  40885. sortingColumn.value.order = null;
  40886. }
  40887. sortingColumn.value = column;
  40888. sortProp.value = prop;
  40889. sortOrder.value = order;
  40890. };
  40891. const execFilter = () => {
  40892. let sourceData = vue.unref(_data);
  40893. Object.keys(filters.value).forEach((columnId) => {
  40894. const values = filters.value[columnId];
  40895. if (!values || values.length === 0)
  40896. return;
  40897. const column = getColumnById({
  40898. columns: columns.value
  40899. }, columnId);
  40900. if (column && column.filterMethod) {
  40901. sourceData = sourceData.filter((row) => {
  40902. return values.some((value) => column.filterMethod.call(null, value, row, column));
  40903. });
  40904. }
  40905. });
  40906. filteredData.value = sourceData;
  40907. };
  40908. const execSort = () => {
  40909. data.value = sortData(filteredData.value, {
  40910. sortingColumn: sortingColumn.value,
  40911. sortProp: sortProp.value,
  40912. sortOrder: sortOrder.value
  40913. });
  40914. };
  40915. const execQuery = (ignore = void 0) => {
  40916. if (!(ignore && ignore.filter)) {
  40917. execFilter();
  40918. }
  40919. execSort();
  40920. };
  40921. const clearFilter = (columnKeys) => {
  40922. const { tableHeaderRef } = instance.refs;
  40923. if (!tableHeaderRef)
  40924. return;
  40925. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  40926. const keys = Object.keys(panels);
  40927. if (!keys.length)
  40928. return;
  40929. if (typeof columnKeys === "string") {
  40930. columnKeys = [columnKeys];
  40931. }
  40932. if (Array.isArray(columnKeys)) {
  40933. const columns_ = columnKeys.map((key) => getColumnByKey({
  40934. columns: columns.value
  40935. }, key));
  40936. keys.forEach((key) => {
  40937. const column = columns_.find((col) => col.id === key);
  40938. if (column) {
  40939. column.filteredValue = [];
  40940. }
  40941. });
  40942. instance.store.commit("filterChange", {
  40943. column: columns_,
  40944. values: [],
  40945. silent: true,
  40946. multi: true
  40947. });
  40948. } else {
  40949. keys.forEach((key) => {
  40950. const column = columns.value.find((col) => col.id === key);
  40951. if (column) {
  40952. column.filteredValue = [];
  40953. }
  40954. });
  40955. filters.value = {};
  40956. instance.store.commit("filterChange", {
  40957. column: {},
  40958. values: [],
  40959. silent: true
  40960. });
  40961. }
  40962. };
  40963. const clearSort = () => {
  40964. if (!sortingColumn.value)
  40965. return;
  40966. updateSort(null, null, null);
  40967. instance.store.commit("changeSortCondition", {
  40968. silent: true
  40969. });
  40970. };
  40971. const {
  40972. setExpandRowKeys,
  40973. toggleRowExpansion,
  40974. updateExpandRows,
  40975. states: expandStates,
  40976. isRowExpanded
  40977. } = useExpand({
  40978. data,
  40979. rowKey
  40980. });
  40981. const {
  40982. updateTreeExpandKeys,
  40983. toggleTreeExpansion,
  40984. updateTreeData,
  40985. loadOrToggle,
  40986. states: treeStates
  40987. } = useTree$2({
  40988. data,
  40989. rowKey
  40990. });
  40991. const {
  40992. updateCurrentRowData,
  40993. updateCurrentRow,
  40994. setCurrentRowKey,
  40995. states: currentData
  40996. } = useCurrent({
  40997. data,
  40998. rowKey
  40999. });
  41000. const setExpandRowKeysAdapter = (val) => {
  41001. setExpandRowKeys(val);
  41002. updateTreeExpandKeys(val);
  41003. };
  41004. const toggleRowExpansionAdapter = (row, expanded) => {
  41005. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  41006. if (hasExpandColumn) {
  41007. toggleRowExpansion(row, expanded);
  41008. } else {
  41009. toggleTreeExpansion(row, expanded);
  41010. }
  41011. };
  41012. return {
  41013. assertRowKey,
  41014. updateColumns,
  41015. scheduleLayout,
  41016. isSelected,
  41017. clearSelection,
  41018. cleanSelection,
  41019. getSelectionRows,
  41020. toggleRowSelection,
  41021. _toggleAllSelection,
  41022. toggleAllSelection: null,
  41023. updateSelectionByRowKey,
  41024. updateAllSelected,
  41025. updateFilters,
  41026. updateCurrentRow,
  41027. updateSort,
  41028. execFilter,
  41029. execSort,
  41030. execQuery,
  41031. clearFilter,
  41032. clearSort,
  41033. toggleRowExpansion,
  41034. setExpandRowKeysAdapter,
  41035. setCurrentRowKey,
  41036. toggleRowExpansionAdapter,
  41037. isRowExpanded,
  41038. updateExpandRows,
  41039. updateCurrentRowData,
  41040. loadOrToggle,
  41041. updateTreeData,
  41042. states: {
  41043. tableSize,
  41044. rowKey,
  41045. data,
  41046. _data,
  41047. isComplex,
  41048. _columns,
  41049. originColumns,
  41050. columns,
  41051. fixedColumns,
  41052. rightFixedColumns,
  41053. leafColumns,
  41054. fixedLeafColumns,
  41055. rightFixedLeafColumns,
  41056. leafColumnsLength,
  41057. fixedLeafColumnsLength,
  41058. rightFixedLeafColumnsLength,
  41059. isAllSelected,
  41060. selection,
  41061. reserveSelection,
  41062. selectOnIndeterminate,
  41063. selectable,
  41064. filters,
  41065. filteredData,
  41066. sortingColumn,
  41067. sortProp,
  41068. sortOrder,
  41069. hoverRow,
  41070. ...expandStates,
  41071. ...treeStates,
  41072. ...currentData
  41073. }
  41074. };
  41075. }
  41076. function replaceColumn(array, column) {
  41077. return array.map((item) => {
  41078. var _a;
  41079. if (item.id === column.id) {
  41080. return column;
  41081. } else if ((_a = item.children) == null ? void 0 : _a.length) {
  41082. item.children = replaceColumn(item.children, column);
  41083. }
  41084. return item;
  41085. });
  41086. }
  41087. function sortColumn(array) {
  41088. array.forEach((item) => {
  41089. var _a, _b;
  41090. item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
  41091. if ((_b = item.children) == null ? void 0 : _b.length) {
  41092. sortColumn(item.children);
  41093. }
  41094. });
  41095. array.sort((cur, pre) => cur.no - pre.no);
  41096. }
  41097. function useStore() {
  41098. const instance = vue.getCurrentInstance();
  41099. const watcher = useWatcher$1();
  41100. const ns = useNamespace("table");
  41101. const mutations = {
  41102. setData(states, data) {
  41103. const dataInstanceChanged = vue.unref(states._data) !== data;
  41104. states.data.value = data;
  41105. states._data.value = data;
  41106. instance.store.execQuery();
  41107. instance.store.updateCurrentRowData();
  41108. instance.store.updateExpandRows();
  41109. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  41110. if (vue.unref(states.reserveSelection)) {
  41111. instance.store.assertRowKey();
  41112. instance.store.updateSelectionByRowKey();
  41113. } else {
  41114. if (dataInstanceChanged) {
  41115. instance.store.clearSelection();
  41116. } else {
  41117. instance.store.cleanSelection();
  41118. }
  41119. }
  41120. instance.store.updateAllSelected();
  41121. if (instance.$ready) {
  41122. instance.store.scheduleLayout();
  41123. }
  41124. },
  41125. insertColumn(states, column, parent) {
  41126. const array = vue.unref(states._columns);
  41127. let newColumns = [];
  41128. if (!parent) {
  41129. array.push(column);
  41130. newColumns = array;
  41131. } else {
  41132. if (parent && !parent.children) {
  41133. parent.children = [];
  41134. }
  41135. parent.children.push(column);
  41136. newColumns = replaceColumn(array, parent);
  41137. }
  41138. sortColumn(newColumns);
  41139. states._columns.value = newColumns;
  41140. if (column.type === "selection") {
  41141. states.selectable.value = column.selectable;
  41142. states.reserveSelection.value = column.reserveSelection;
  41143. }
  41144. if (instance.$ready) {
  41145. instance.store.updateColumns();
  41146. instance.store.scheduleLayout();
  41147. }
  41148. },
  41149. removeColumn(states, column, parent) {
  41150. const array = vue.unref(states._columns) || [];
  41151. if (parent) {
  41152. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  41153. if (parent.children.length === 0) {
  41154. delete parent.children;
  41155. }
  41156. states._columns.value = replaceColumn(array, parent);
  41157. } else {
  41158. const index = array.indexOf(column);
  41159. if (index > -1) {
  41160. array.splice(index, 1);
  41161. states._columns.value = array;
  41162. }
  41163. }
  41164. if (instance.$ready) {
  41165. instance.store.updateColumns();
  41166. instance.store.scheduleLayout();
  41167. }
  41168. },
  41169. sort(states, options) {
  41170. const { prop, order, init } = options;
  41171. if (prop) {
  41172. const column = vue.unref(states.columns).find((column2) => column2.property === prop);
  41173. if (column) {
  41174. column.order = order;
  41175. instance.store.updateSort(column, prop, order);
  41176. instance.store.commit("changeSortCondition", { init });
  41177. }
  41178. }
  41179. },
  41180. changeSortCondition(states, options) {
  41181. const { sortingColumn, sortProp, sortOrder } = states;
  41182. const columnValue = vue.unref(sortingColumn), propValue = vue.unref(sortProp), orderValue = vue.unref(sortOrder);
  41183. if (orderValue === null) {
  41184. states.sortingColumn.value = null;
  41185. states.sortProp.value = null;
  41186. }
  41187. const ignore = { filter: true };
  41188. instance.store.execQuery(ignore);
  41189. if (!options || !(options.silent || options.init)) {
  41190. instance.emit("sort-change", {
  41191. column: columnValue,
  41192. prop: propValue,
  41193. order: orderValue
  41194. });
  41195. }
  41196. instance.store.updateTableScrollY();
  41197. },
  41198. filterChange(_states, options) {
  41199. const { column, values, silent } = options;
  41200. const newFilters = instance.store.updateFilters(column, values);
  41201. instance.store.execQuery();
  41202. if (!silent) {
  41203. instance.emit("filter-change", newFilters);
  41204. }
  41205. instance.store.updateTableScrollY();
  41206. },
  41207. toggleAllSelection() {
  41208. instance.store.toggleAllSelection();
  41209. },
  41210. rowSelectedChanged(_states, row) {
  41211. instance.store.toggleRowSelection(row);
  41212. instance.store.updateAllSelected();
  41213. },
  41214. setHoverRow(states, row) {
  41215. states.hoverRow.value = row;
  41216. },
  41217. setCurrentRow(_states, row) {
  41218. instance.store.updateCurrentRow(row);
  41219. }
  41220. };
  41221. const commit = function(name, ...args) {
  41222. const mutations2 = instance.store.mutations;
  41223. if (mutations2[name]) {
  41224. mutations2[name].apply(instance, [instance.store.states].concat(args));
  41225. } else {
  41226. throw new Error(`Action not found: ${name}`);
  41227. }
  41228. };
  41229. const updateTableScrollY = function() {
  41230. vue.nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  41231. };
  41232. return {
  41233. ns,
  41234. ...watcher,
  41235. mutations,
  41236. commit,
  41237. updateTableScrollY
  41238. };
  41239. }
  41240. const InitialStateMap = {
  41241. rowKey: "rowKey",
  41242. defaultExpandAll: "defaultExpandAll",
  41243. selectOnIndeterminate: "selectOnIndeterminate",
  41244. indent: "indent",
  41245. lazy: "lazy",
  41246. data: "data",
  41247. ["treeProps.hasChildren"]: {
  41248. key: "lazyColumnIdentifier",
  41249. default: "hasChildren"
  41250. },
  41251. ["treeProps.children"]: {
  41252. key: "childrenColumnName",
  41253. default: "children"
  41254. }
  41255. };
  41256. function createStore(table, props) {
  41257. if (!table) {
  41258. throw new Error("Table is required.");
  41259. }
  41260. const store = useStore();
  41261. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  41262. Object.keys(InitialStateMap).forEach((key) => {
  41263. handleValue(getArrKeysValue(props, key), key, store);
  41264. });
  41265. proxyTableProps(store, props);
  41266. return store;
  41267. }
  41268. function proxyTableProps(store, props) {
  41269. Object.keys(InitialStateMap).forEach((key) => {
  41270. vue.watch(() => getArrKeysValue(props, key), (value) => {
  41271. handleValue(value, key, store);
  41272. });
  41273. });
  41274. }
  41275. function handleValue(value, propsKey, store) {
  41276. let newVal = value;
  41277. let storeKey = InitialStateMap[propsKey];
  41278. if (typeof InitialStateMap[propsKey] === "object") {
  41279. storeKey = storeKey.key;
  41280. newVal = newVal || InitialStateMap[propsKey].default;
  41281. }
  41282. store.states[storeKey].value = newVal;
  41283. }
  41284. function getArrKeysValue(props, keys) {
  41285. if (keys.includes(".")) {
  41286. const keyList = keys.split(".");
  41287. let value = props;
  41288. keyList.forEach((key) => {
  41289. value = value[key];
  41290. });
  41291. return value;
  41292. } else {
  41293. return props[keys];
  41294. }
  41295. }
  41296. class TableLayout {
  41297. constructor(options) {
  41298. this.observers = [];
  41299. this.table = null;
  41300. this.store = null;
  41301. this.columns = [];
  41302. this.fit = true;
  41303. this.showHeader = true;
  41304. this.height = vue.ref(null);
  41305. this.scrollX = vue.ref(false);
  41306. this.scrollY = vue.ref(false);
  41307. this.bodyWidth = vue.ref(null);
  41308. this.fixedWidth = vue.ref(null);
  41309. this.rightFixedWidth = vue.ref(null);
  41310. this.gutterWidth = 0;
  41311. for (const name in options) {
  41312. if (hasOwn(options, name)) {
  41313. if (vue.isRef(this[name])) {
  41314. this[name].value = options[name];
  41315. } else {
  41316. this[name] = options[name];
  41317. }
  41318. }
  41319. }
  41320. if (!this.table) {
  41321. throw new Error("Table is required for Table Layout");
  41322. }
  41323. if (!this.store) {
  41324. throw new Error("Store is required for Table Layout");
  41325. }
  41326. }
  41327. updateScrollY() {
  41328. const height = this.height.value;
  41329. if (height === null)
  41330. return false;
  41331. const scrollBarRef = this.table.refs.scrollBarRef;
  41332. if (this.table.vnode.el && scrollBarRef) {
  41333. let scrollY = true;
  41334. const prevScrollY = this.scrollY.value;
  41335. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  41336. this.scrollY.value = scrollY;
  41337. return prevScrollY !== scrollY;
  41338. }
  41339. return false;
  41340. }
  41341. setHeight(value, prop = "height") {
  41342. if (!isClient)
  41343. return;
  41344. const el = this.table.vnode.el;
  41345. value = parseHeight(value);
  41346. this.height.value = Number(value);
  41347. if (!el && (value || value === 0))
  41348. return vue.nextTick(() => this.setHeight(value, prop));
  41349. if (typeof value === "number") {
  41350. el.style[prop] = `${value}px`;
  41351. this.updateElsHeight();
  41352. } else if (typeof value === "string") {
  41353. el.style[prop] = value;
  41354. this.updateElsHeight();
  41355. }
  41356. }
  41357. setMaxHeight(value) {
  41358. this.setHeight(value, "max-height");
  41359. }
  41360. getFlattenColumns() {
  41361. const flattenColumns = [];
  41362. const columns = this.table.store.states.columns.value;
  41363. columns.forEach((column) => {
  41364. if (column.isColumnGroup) {
  41365. flattenColumns.push.apply(flattenColumns, column.columns);
  41366. } else {
  41367. flattenColumns.push(column);
  41368. }
  41369. });
  41370. return flattenColumns;
  41371. }
  41372. updateElsHeight() {
  41373. this.updateScrollY();
  41374. this.notifyObservers("scrollable");
  41375. }
  41376. headerDisplayNone(elm) {
  41377. if (!elm)
  41378. return true;
  41379. let headerChild = elm;
  41380. while (headerChild.tagName !== "DIV") {
  41381. if (getComputedStyle(headerChild).display === "none") {
  41382. return true;
  41383. }
  41384. headerChild = headerChild.parentElement;
  41385. }
  41386. return false;
  41387. }
  41388. updateColumnsWidth() {
  41389. if (!isClient)
  41390. return;
  41391. const fit = this.fit;
  41392. const bodyWidth = this.table.vnode.el.clientWidth;
  41393. let bodyMinWidth = 0;
  41394. const flattenColumns = this.getFlattenColumns();
  41395. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  41396. flattenColumns.forEach((column) => {
  41397. if (typeof column.width === "number" && column.realWidth)
  41398. column.realWidth = null;
  41399. });
  41400. if (flexColumns.length > 0 && fit) {
  41401. flattenColumns.forEach((column) => {
  41402. bodyMinWidth += Number(column.width || column.minWidth || 80);
  41403. });
  41404. if (bodyMinWidth <= bodyWidth) {
  41405. this.scrollX.value = false;
  41406. const totalFlexWidth = bodyWidth - bodyMinWidth;
  41407. if (flexColumns.length === 1) {
  41408. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  41409. } else {
  41410. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  41411. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  41412. let noneFirstWidth = 0;
  41413. flexColumns.forEach((column, index) => {
  41414. if (index === 0)
  41415. return;
  41416. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  41417. noneFirstWidth += flexWidth;
  41418. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  41419. });
  41420. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  41421. }
  41422. } else {
  41423. this.scrollX.value = true;
  41424. flexColumns.forEach((column) => {
  41425. column.realWidth = Number(column.minWidth);
  41426. });
  41427. }
  41428. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  41429. this.table.state.resizeState.value.width = this.bodyWidth.value;
  41430. } else {
  41431. flattenColumns.forEach((column) => {
  41432. if (!column.width && !column.minWidth) {
  41433. column.realWidth = 80;
  41434. } else {
  41435. column.realWidth = Number(column.width || column.minWidth);
  41436. }
  41437. bodyMinWidth += column.realWidth;
  41438. });
  41439. this.scrollX.value = bodyMinWidth > bodyWidth;
  41440. this.bodyWidth.value = bodyMinWidth;
  41441. }
  41442. const fixedColumns = this.store.states.fixedColumns.value;
  41443. if (fixedColumns.length > 0) {
  41444. let fixedWidth = 0;
  41445. fixedColumns.forEach((column) => {
  41446. fixedWidth += Number(column.realWidth || column.width);
  41447. });
  41448. this.fixedWidth.value = fixedWidth;
  41449. }
  41450. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  41451. if (rightFixedColumns.length > 0) {
  41452. let rightFixedWidth = 0;
  41453. rightFixedColumns.forEach((column) => {
  41454. rightFixedWidth += Number(column.realWidth || column.width);
  41455. });
  41456. this.rightFixedWidth.value = rightFixedWidth;
  41457. }
  41458. this.notifyObservers("columns");
  41459. }
  41460. addObserver(observer) {
  41461. this.observers.push(observer);
  41462. }
  41463. removeObserver(observer) {
  41464. const index = this.observers.indexOf(observer);
  41465. if (index !== -1) {
  41466. this.observers.splice(index, 1);
  41467. }
  41468. }
  41469. notifyObservers(event) {
  41470. const observers = this.observers;
  41471. observers.forEach((observer) => {
  41472. var _a, _b;
  41473. switch (event) {
  41474. case "columns":
  41475. (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this);
  41476. break;
  41477. case "scrollable":
  41478. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  41479. break;
  41480. default:
  41481. throw new Error(`Table Layout don't have event ${event}.`);
  41482. }
  41483. });
  41484. }
  41485. }
  41486. var TableLayout$1 = TableLayout;
  41487. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  41488. const _sfc_main$q = vue.defineComponent({
  41489. name: "ElTableFilterPanel",
  41490. components: {
  41491. ElCheckbox,
  41492. ElCheckboxGroup,
  41493. ElScrollbar,
  41494. ElTooltip,
  41495. ElIcon,
  41496. ArrowDown: arrow_down_default,
  41497. ArrowUp: arrow_up_default
  41498. },
  41499. directives: { ClickOutside },
  41500. props: {
  41501. placement: {
  41502. type: String,
  41503. default: "bottom-start"
  41504. },
  41505. store: {
  41506. type: Object
  41507. },
  41508. column: {
  41509. type: Object
  41510. },
  41511. upDataColumn: {
  41512. type: Function
  41513. }
  41514. },
  41515. setup(props) {
  41516. const instance = vue.getCurrentInstance();
  41517. const { t } = useLocale();
  41518. const ns = useNamespace("table-filter");
  41519. const parent = instance == null ? void 0 : instance.parent;
  41520. if (!parent.filterPanels.value[props.column.id]) {
  41521. parent.filterPanels.value[props.column.id] = instance;
  41522. }
  41523. const tooltipVisible = vue.ref(false);
  41524. const tooltip = vue.ref(null);
  41525. const filters = vue.computed(() => {
  41526. return props.column && props.column.filters;
  41527. });
  41528. const filterValue = vue.computed({
  41529. get: () => {
  41530. var _a;
  41531. return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
  41532. },
  41533. set: (value) => {
  41534. if (filteredValue.value) {
  41535. if (typeof value !== "undefined" && value !== null) {
  41536. filteredValue.value.splice(0, 1, value);
  41537. } else {
  41538. filteredValue.value.splice(0, 1);
  41539. }
  41540. }
  41541. }
  41542. });
  41543. const filteredValue = vue.computed({
  41544. get() {
  41545. if (props.column) {
  41546. return props.column.filteredValue || [];
  41547. }
  41548. return [];
  41549. },
  41550. set(value) {
  41551. if (props.column) {
  41552. props.upDataColumn("filteredValue", value);
  41553. }
  41554. }
  41555. });
  41556. const multiple = vue.computed(() => {
  41557. if (props.column) {
  41558. return props.column.filterMultiple;
  41559. }
  41560. return true;
  41561. });
  41562. const isActive = (filter) => {
  41563. return filter.value === filterValue.value;
  41564. };
  41565. const hidden = () => {
  41566. tooltipVisible.value = false;
  41567. };
  41568. const showFilterPanel = (e) => {
  41569. e.stopPropagation();
  41570. tooltipVisible.value = !tooltipVisible.value;
  41571. };
  41572. const hideFilterPanel = () => {
  41573. tooltipVisible.value = false;
  41574. };
  41575. const handleConfirm = () => {
  41576. confirmFilter(filteredValue.value);
  41577. hidden();
  41578. };
  41579. const handleReset = () => {
  41580. filteredValue.value = [];
  41581. confirmFilter(filteredValue.value);
  41582. hidden();
  41583. };
  41584. const handleSelect = (_filterValue) => {
  41585. filterValue.value = _filterValue;
  41586. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  41587. confirmFilter(filteredValue.value);
  41588. } else {
  41589. confirmFilter([]);
  41590. }
  41591. hidden();
  41592. };
  41593. const confirmFilter = (filteredValue2) => {
  41594. props.store.commit("filterChange", {
  41595. column: props.column,
  41596. values: filteredValue2
  41597. });
  41598. props.store.updateAllSelected();
  41599. };
  41600. vue.watch(tooltipVisible, (value) => {
  41601. if (props.column) {
  41602. props.upDataColumn("filterOpened", value);
  41603. }
  41604. }, {
  41605. immediate: true
  41606. });
  41607. const popperPaneRef = vue.computed(() => {
  41608. var _a, _b;
  41609. return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  41610. });
  41611. return {
  41612. tooltipVisible,
  41613. multiple,
  41614. filteredValue,
  41615. filterValue,
  41616. filters,
  41617. handleConfirm,
  41618. handleReset,
  41619. handleSelect,
  41620. isActive,
  41621. t,
  41622. ns,
  41623. showFilterPanel,
  41624. hideFilterPanel,
  41625. popperPaneRef,
  41626. tooltip
  41627. };
  41628. }
  41629. });
  41630. const _hoisted_1$c = { key: 0 };
  41631. const _hoisted_2$8 = ["disabled"];
  41632. const _hoisted_3$3 = ["label", "onClick"];
  41633. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  41634. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  41635. const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group");
  41636. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  41637. const _component_arrow_up = vue.resolveComponent("arrow-up");
  41638. const _component_arrow_down = vue.resolveComponent("arrow-down");
  41639. const _component_el_icon = vue.resolveComponent("el-icon");
  41640. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  41641. const _directive_click_outside = vue.resolveDirective("click-outside");
  41642. return vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  41643. ref: "tooltip",
  41644. visible: _ctx.tooltipVisible,
  41645. offset: 0,
  41646. placement: _ctx.placement,
  41647. "show-arrow": false,
  41648. "stop-popper-mouse-event": false,
  41649. teleported: "",
  41650. effect: "light",
  41651. pure: "",
  41652. "popper-class": _ctx.ns.b(),
  41653. persistent: ""
  41654. }, {
  41655. content: vue.withCtx(() => [
  41656. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
  41657. vue.createElementVNode("div", {
  41658. class: vue.normalizeClass(_ctx.ns.e("content"))
  41659. }, [
  41660. vue.createVNode(_component_el_scrollbar, {
  41661. "wrap-class": _ctx.ns.e("wrap")
  41662. }, {
  41663. default: vue.withCtx(() => [
  41664. vue.createVNode(_component_el_checkbox_group, {
  41665. modelValue: _ctx.filteredValue,
  41666. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  41667. class: vue.normalizeClass(_ctx.ns.e("checkbox-group"))
  41668. }, {
  41669. default: vue.withCtx(() => [
  41670. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  41671. return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  41672. key: filter.value,
  41673. label: filter.value
  41674. }, {
  41675. default: vue.withCtx(() => [
  41676. vue.createTextVNode(vue.toDisplayString(filter.text), 1)
  41677. ]),
  41678. _: 2
  41679. }, 1032, ["label"]);
  41680. }), 128))
  41681. ]),
  41682. _: 1
  41683. }, 8, ["modelValue", "class"])
  41684. ]),
  41685. _: 1
  41686. }, 8, ["wrap-class"])
  41687. ], 2),
  41688. vue.createElementVNode("div", {
  41689. class: vue.normalizeClass(_ctx.ns.e("bottom"))
  41690. }, [
  41691. vue.createElementVNode("button", {
  41692. class: vue.normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  41693. disabled: _ctx.filteredValue.length === 0,
  41694. type: "button",
  41695. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  41696. }, vue.toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$8),
  41697. vue.createElementVNode("button", {
  41698. type: "button",
  41699. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  41700. }, vue.toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  41701. ], 2)
  41702. ])) : (vue.openBlock(), vue.createElementBlock("ul", {
  41703. key: 1,
  41704. class: vue.normalizeClass(_ctx.ns.e("list"))
  41705. }, [
  41706. vue.createElementVNode("li", {
  41707. class: vue.normalizeClass([
  41708. _ctx.ns.e("list-item"),
  41709. {
  41710. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  41711. }
  41712. ]),
  41713. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  41714. }, vue.toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  41715. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  41716. return vue.openBlock(), vue.createElementBlock("li", {
  41717. key: filter.value,
  41718. class: vue.normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  41719. label: filter.value,
  41720. onClick: ($event) => _ctx.handleSelect(filter.value)
  41721. }, vue.toDisplayString(filter.text), 11, _hoisted_3$3);
  41722. }), 128))
  41723. ], 2))
  41724. ]),
  41725. default: vue.withCtx(() => [
  41726. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  41727. class: vue.normalizeClass([
  41728. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  41729. `${_ctx.ns.namespace.value}-none-outline`
  41730. ]),
  41731. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  41732. }, [
  41733. vue.createVNode(_component_el_icon, null, {
  41734. default: vue.withCtx(() => [
  41735. _ctx.column.filterOpened ? (vue.openBlock(), vue.createBlock(_component_arrow_up, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_arrow_down, { key: 1 }))
  41736. ]),
  41737. _: 1
  41738. })
  41739. ], 2)), [
  41740. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  41741. ])
  41742. ]),
  41743. _: 1
  41744. }, 8, ["visible", "placement", "popper-class"]);
  41745. }
  41746. var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]);
  41747. function useLayoutObserver(root) {
  41748. const instance = vue.getCurrentInstance();
  41749. vue.onBeforeMount(() => {
  41750. tableLayout.value.addObserver(instance);
  41751. });
  41752. vue.onMounted(() => {
  41753. onColumnsChange(tableLayout.value);
  41754. onScrollableChange(tableLayout.value);
  41755. });
  41756. vue.onUpdated(() => {
  41757. onColumnsChange(tableLayout.value);
  41758. onScrollableChange(tableLayout.value);
  41759. });
  41760. vue.onUnmounted(() => {
  41761. tableLayout.value.removeObserver(instance);
  41762. });
  41763. const tableLayout = vue.computed(() => {
  41764. const layout = root.layout;
  41765. if (!layout) {
  41766. throw new Error("Can not find table layout.");
  41767. }
  41768. return layout;
  41769. });
  41770. const onColumnsChange = (layout) => {
  41771. var _a;
  41772. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
  41773. if (!cols.length)
  41774. return;
  41775. const flattenColumns = layout.getFlattenColumns();
  41776. const columnsMap = {};
  41777. flattenColumns.forEach((column) => {
  41778. columnsMap[column.id] = column;
  41779. });
  41780. for (let i = 0, j = cols.length; i < j; i++) {
  41781. const col = cols[i];
  41782. const name = col.getAttribute("name");
  41783. const column = columnsMap[name];
  41784. if (column) {
  41785. col.setAttribute("width", column.realWidth || column.width);
  41786. }
  41787. }
  41788. };
  41789. const onScrollableChange = (layout) => {
  41790. var _a, _b;
  41791. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
  41792. for (let i = 0, j = cols.length; i < j; i++) {
  41793. const col = cols[i];
  41794. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  41795. }
  41796. const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  41797. for (let i = 0, j = ths.length; i < j; i++) {
  41798. const th = ths[i];
  41799. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  41800. th.style.display = layout.scrollY.value ? "" : "none";
  41801. }
  41802. };
  41803. return {
  41804. tableLayout: tableLayout.value,
  41805. onColumnsChange,
  41806. onScrollableChange
  41807. };
  41808. }
  41809. const TABLE_INJECTION_KEY = Symbol("ElTable");
  41810. function useEvent(props, emit) {
  41811. const instance = vue.getCurrentInstance();
  41812. const parent = vue.inject(TABLE_INJECTION_KEY);
  41813. const handleFilterClick = (event) => {
  41814. event.stopPropagation();
  41815. return;
  41816. };
  41817. const handleHeaderClick = (event, column) => {
  41818. if (!column.filters && column.sortable) {
  41819. handleSortClick(event, column, false);
  41820. } else if (column.filterable && !column.sortable) {
  41821. handleFilterClick(event);
  41822. }
  41823. parent == null ? void 0 : parent.emit("header-click", column, event);
  41824. };
  41825. const handleHeaderContextMenu = (event, column) => {
  41826. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  41827. };
  41828. const draggingColumn = vue.ref(null);
  41829. const dragging = vue.ref(false);
  41830. const dragState = vue.ref({});
  41831. const handleMouseDown = (event, column) => {
  41832. if (!isClient)
  41833. return;
  41834. if (column.children && column.children.length > 0)
  41835. return;
  41836. if (draggingColumn.value && props.border) {
  41837. dragging.value = true;
  41838. const table = parent;
  41839. emit("set-drag-visible", true);
  41840. const tableEl = table == null ? void 0 : table.vnode.el;
  41841. const tableLeft = tableEl.getBoundingClientRect().left;
  41842. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  41843. const columnRect = columnEl.getBoundingClientRect();
  41844. const minLeft = columnRect.left - tableLeft + 30;
  41845. addClass(columnEl, "noclick");
  41846. dragState.value = {
  41847. startMouseLeft: event.clientX,
  41848. startLeft: columnRect.right - tableLeft,
  41849. startColumnLeft: columnRect.left - tableLeft,
  41850. tableLeft
  41851. };
  41852. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  41853. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  41854. document.onselectstart = function() {
  41855. return false;
  41856. };
  41857. document.ondragstart = function() {
  41858. return false;
  41859. };
  41860. const handleMouseMove2 = (event2) => {
  41861. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  41862. const proxyLeft = dragState.value.startLeft + deltaLeft;
  41863. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  41864. };
  41865. const handleMouseUp = () => {
  41866. if (dragging.value) {
  41867. const { startColumnLeft, startLeft } = dragState.value;
  41868. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  41869. const columnWidth = finalLeft - startColumnLeft;
  41870. column.width = column.realWidth = columnWidth;
  41871. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  41872. requestAnimationFrame(() => {
  41873. props.store.scheduleLayout(false, true);
  41874. });
  41875. document.body.style.cursor = "";
  41876. dragging.value = false;
  41877. draggingColumn.value = null;
  41878. dragState.value = {};
  41879. emit("set-drag-visible", false);
  41880. }
  41881. document.removeEventListener("mousemove", handleMouseMove2);
  41882. document.removeEventListener("mouseup", handleMouseUp);
  41883. document.onselectstart = null;
  41884. document.ondragstart = null;
  41885. setTimeout(() => {
  41886. removeClass(columnEl, "noclick");
  41887. }, 0);
  41888. };
  41889. document.addEventListener("mousemove", handleMouseMove2);
  41890. document.addEventListener("mouseup", handleMouseUp);
  41891. }
  41892. };
  41893. const handleMouseMove = (event, column) => {
  41894. var _a;
  41895. if (column.children && column.children.length > 0)
  41896. return;
  41897. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  41898. if (!column || !column.resizable)
  41899. return;
  41900. if (!dragging.value && props.border) {
  41901. const rect = target.getBoundingClientRect();
  41902. const bodyStyle = document.body.style;
  41903. if (rect.width > 12 && rect.right - event.pageX < 8) {
  41904. bodyStyle.cursor = "col-resize";
  41905. if (hasClass(target, "is-sortable")) {
  41906. target.style.cursor = "col-resize";
  41907. }
  41908. draggingColumn.value = column;
  41909. } else if (!dragging.value) {
  41910. bodyStyle.cursor = "";
  41911. if (hasClass(target, "is-sortable")) {
  41912. target.style.cursor = "pointer";
  41913. }
  41914. draggingColumn.value = null;
  41915. }
  41916. }
  41917. };
  41918. const handleMouseOut = () => {
  41919. if (!isClient)
  41920. return;
  41921. document.body.style.cursor = "";
  41922. };
  41923. const toggleOrder = ({ order, sortOrders }) => {
  41924. if (order === "")
  41925. return sortOrders[0];
  41926. const index = sortOrders.indexOf(order || null);
  41927. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  41928. };
  41929. const handleSortClick = (event, column, givenOrder) => {
  41930. var _a;
  41931. event.stopPropagation();
  41932. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  41933. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  41934. if (target) {
  41935. if (hasClass(target, "noclick")) {
  41936. removeClass(target, "noclick");
  41937. return;
  41938. }
  41939. }
  41940. if (!column.sortable)
  41941. return;
  41942. const states = props.store.states;
  41943. let sortProp = states.sortProp.value;
  41944. let sortOrder;
  41945. const sortingColumn = states.sortingColumn.value;
  41946. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  41947. if (sortingColumn) {
  41948. sortingColumn.order = null;
  41949. }
  41950. states.sortingColumn.value = column;
  41951. sortProp = column.property;
  41952. }
  41953. if (!order) {
  41954. sortOrder = column.order = null;
  41955. } else {
  41956. sortOrder = column.order = order;
  41957. }
  41958. states.sortProp.value = sortProp;
  41959. states.sortOrder.value = sortOrder;
  41960. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  41961. };
  41962. return {
  41963. handleHeaderClick,
  41964. handleHeaderContextMenu,
  41965. handleMouseDown,
  41966. handleMouseMove,
  41967. handleMouseOut,
  41968. handleSortClick,
  41969. handleFilterClick
  41970. };
  41971. }
  41972. function useStyle$2(props) {
  41973. const parent = vue.inject(TABLE_INJECTION_KEY);
  41974. const ns = useNamespace("table");
  41975. const getHeaderRowStyle = (rowIndex) => {
  41976. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  41977. if (typeof headerRowStyle === "function") {
  41978. return headerRowStyle.call(null, { rowIndex });
  41979. }
  41980. return headerRowStyle;
  41981. };
  41982. const getHeaderRowClass = (rowIndex) => {
  41983. const classes = [];
  41984. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  41985. if (typeof headerRowClassName === "string") {
  41986. classes.push(headerRowClassName);
  41987. } else if (typeof headerRowClassName === "function") {
  41988. classes.push(headerRowClassName.call(null, { rowIndex }));
  41989. }
  41990. return classes.join(" ");
  41991. };
  41992. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  41993. var _a;
  41994. let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
  41995. if (typeof headerCellStyles === "function") {
  41996. headerCellStyles = headerCellStyles.call(null, {
  41997. rowIndex,
  41998. columnIndex,
  41999. row,
  42000. column
  42001. });
  42002. }
  42003. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  42004. ensurePosition(fixedStyle, "left");
  42005. ensurePosition(fixedStyle, "right");
  42006. return Object.assign({}, headerCellStyles, fixedStyle);
  42007. };
  42008. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  42009. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  42010. const classes = [
  42011. column.id,
  42012. column.order,
  42013. column.headerAlign,
  42014. column.className,
  42015. column.labelClassName,
  42016. ...fixedClasses
  42017. ];
  42018. if (!column.children) {
  42019. classes.push("is-leaf");
  42020. }
  42021. if (column.sortable) {
  42022. classes.push("is-sortable");
  42023. }
  42024. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  42025. if (typeof headerCellClassName === "string") {
  42026. classes.push(headerCellClassName);
  42027. } else if (typeof headerCellClassName === "function") {
  42028. classes.push(headerCellClassName.call(null, {
  42029. rowIndex,
  42030. columnIndex,
  42031. row,
  42032. column
  42033. }));
  42034. }
  42035. classes.push(ns.e("cell"));
  42036. return classes.filter((className) => Boolean(className)).join(" ");
  42037. };
  42038. return {
  42039. getHeaderRowStyle,
  42040. getHeaderRowClass,
  42041. getHeaderCellStyle,
  42042. getHeaderCellClass
  42043. };
  42044. }
  42045. const getAllColumns = (columns) => {
  42046. const result = [];
  42047. columns.forEach((column) => {
  42048. if (column.children) {
  42049. result.push(column);
  42050. result.push.apply(result, getAllColumns(column.children));
  42051. } else {
  42052. result.push(column);
  42053. }
  42054. });
  42055. return result;
  42056. };
  42057. const convertToRows = (originColumns) => {
  42058. let maxLevel = 1;
  42059. const traverse = (column, parent) => {
  42060. if (parent) {
  42061. column.level = parent.level + 1;
  42062. if (maxLevel < column.level) {
  42063. maxLevel = column.level;
  42064. }
  42065. }
  42066. if (column.children) {
  42067. let colSpan = 0;
  42068. column.children.forEach((subColumn) => {
  42069. traverse(subColumn, column);
  42070. colSpan += subColumn.colSpan;
  42071. });
  42072. column.colSpan = colSpan;
  42073. } else {
  42074. column.colSpan = 1;
  42075. }
  42076. };
  42077. originColumns.forEach((column) => {
  42078. column.level = 1;
  42079. traverse(column, void 0);
  42080. });
  42081. const rows = [];
  42082. for (let i = 0; i < maxLevel; i++) {
  42083. rows.push([]);
  42084. }
  42085. const allColumns = getAllColumns(originColumns);
  42086. allColumns.forEach((column) => {
  42087. if (!column.children) {
  42088. column.rowSpan = maxLevel - column.level + 1;
  42089. } else {
  42090. column.rowSpan = 1;
  42091. column.children.forEach((col) => col.isSubColumn = true);
  42092. }
  42093. rows[column.level - 1].push(column);
  42094. });
  42095. return rows;
  42096. };
  42097. function useUtils$1(props) {
  42098. const parent = vue.inject(TABLE_INJECTION_KEY);
  42099. const columnRows = vue.computed(() => {
  42100. return convertToRows(props.store.states.originColumns.value);
  42101. });
  42102. const isGroup = vue.computed(() => {
  42103. const result = columnRows.value.length > 1;
  42104. if (result && parent) {
  42105. parent.state.isGroup.value = true;
  42106. }
  42107. return result;
  42108. });
  42109. const toggleAllSelection = (event) => {
  42110. event.stopPropagation();
  42111. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  42112. };
  42113. return {
  42114. isGroup,
  42115. toggleAllSelection,
  42116. columnRows
  42117. };
  42118. }
  42119. var TableHeader = vue.defineComponent({
  42120. name: "ElTableHeader",
  42121. components: {
  42122. ElCheckbox
  42123. },
  42124. props: {
  42125. fixed: {
  42126. type: String,
  42127. default: ""
  42128. },
  42129. store: {
  42130. required: true,
  42131. type: Object
  42132. },
  42133. border: Boolean,
  42134. defaultSort: {
  42135. type: Object,
  42136. default: () => {
  42137. return {
  42138. prop: "",
  42139. order: ""
  42140. };
  42141. }
  42142. }
  42143. },
  42144. setup(props, { emit }) {
  42145. const instance = vue.getCurrentInstance();
  42146. const parent = vue.inject(TABLE_INJECTION_KEY);
  42147. const ns = useNamespace("table");
  42148. const filterPanels = vue.ref({});
  42149. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  42150. vue.onMounted(async () => {
  42151. await vue.nextTick();
  42152. await vue.nextTick();
  42153. const { prop, order } = props.defaultSort;
  42154. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  42155. });
  42156. const {
  42157. handleHeaderClick,
  42158. handleHeaderContextMenu,
  42159. handleMouseDown,
  42160. handleMouseMove,
  42161. handleMouseOut,
  42162. handleSortClick,
  42163. handleFilterClick
  42164. } = useEvent(props, emit);
  42165. const {
  42166. getHeaderRowStyle,
  42167. getHeaderRowClass,
  42168. getHeaderCellStyle,
  42169. getHeaderCellClass
  42170. } = useStyle$2(props);
  42171. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  42172. instance.state = {
  42173. onColumnsChange,
  42174. onScrollableChange
  42175. };
  42176. instance.filterPanels = filterPanels;
  42177. return {
  42178. ns,
  42179. filterPanels,
  42180. onColumnsChange,
  42181. onScrollableChange,
  42182. columnRows,
  42183. getHeaderRowClass,
  42184. getHeaderRowStyle,
  42185. getHeaderCellClass,
  42186. getHeaderCellStyle,
  42187. handleHeaderClick,
  42188. handleHeaderContextMenu,
  42189. handleMouseDown,
  42190. handleMouseMove,
  42191. handleMouseOut,
  42192. handleSortClick,
  42193. handleFilterClick,
  42194. isGroup,
  42195. toggleAllSelection
  42196. };
  42197. },
  42198. render() {
  42199. const {
  42200. ns,
  42201. isGroup,
  42202. columnRows,
  42203. getHeaderCellStyle,
  42204. getHeaderCellClass,
  42205. getHeaderRowClass,
  42206. getHeaderRowStyle,
  42207. handleHeaderClick,
  42208. handleHeaderContextMenu,
  42209. handleMouseDown,
  42210. handleMouseMove,
  42211. handleSortClick,
  42212. handleMouseOut,
  42213. store,
  42214. $parent
  42215. } = this;
  42216. let rowSpan = 1;
  42217. return vue.h("thead", {
  42218. class: { [ns.is("group")]: isGroup }
  42219. }, columnRows.map((subColumns, rowIndex) => vue.h("tr", {
  42220. class: getHeaderRowClass(rowIndex),
  42221. key: rowIndex,
  42222. style: getHeaderRowStyle(rowIndex)
  42223. }, subColumns.map((column, cellIndex) => {
  42224. if (column.rowSpan > rowSpan) {
  42225. rowSpan = column.rowSpan;
  42226. }
  42227. return vue.h("th", {
  42228. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  42229. colspan: column.colSpan,
  42230. key: `${column.id}-thead`,
  42231. rowspan: column.rowSpan,
  42232. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  42233. onClick: ($event) => handleHeaderClick($event, column),
  42234. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  42235. onMousedown: ($event) => handleMouseDown($event, column),
  42236. onMousemove: ($event) => handleMouseMove($event, column),
  42237. onMouseout: handleMouseOut
  42238. }, [
  42239. vue.h("div", {
  42240. class: [
  42241. "cell",
  42242. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  42243. ]
  42244. }, [
  42245. column.renderHeader ? column.renderHeader({
  42246. column,
  42247. $index: cellIndex,
  42248. store,
  42249. _self: $parent
  42250. }) : column.label,
  42251. column.sortable && vue.h("span", {
  42252. onClick: ($event) => handleSortClick($event, column),
  42253. class: "caret-wrapper"
  42254. }, [
  42255. vue.h("i", {
  42256. onClick: ($event) => handleSortClick($event, column, "ascending"),
  42257. class: "sort-caret ascending"
  42258. }),
  42259. vue.h("i", {
  42260. onClick: ($event) => handleSortClick($event, column, "descending"),
  42261. class: "sort-caret descending"
  42262. })
  42263. ]),
  42264. column.filterable && vue.h(FilterPanel, {
  42265. store,
  42266. placement: column.filterPlacement || "bottom-start",
  42267. column,
  42268. upDataColumn: (key, value) => {
  42269. column[key] = value;
  42270. }
  42271. })
  42272. ])
  42273. ]);
  42274. }))));
  42275. }
  42276. });
  42277. function useEvents(props) {
  42278. const parent = vue.inject(TABLE_INJECTION_KEY);
  42279. const tooltipContent = vue.ref("");
  42280. const tooltipTrigger = vue.ref(vue.h("div"));
  42281. const handleEvent = (event, row, name) => {
  42282. var _a;
  42283. const table = parent;
  42284. const cell = getCell(event);
  42285. let column;
  42286. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  42287. if (cell) {
  42288. column = getColumnByCell({
  42289. columns: props.store.states.columns.value
  42290. }, cell, namespace);
  42291. if (column) {
  42292. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  42293. }
  42294. }
  42295. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  42296. };
  42297. const handleDoubleClick = (event, row) => {
  42298. handleEvent(event, row, "dblclick");
  42299. };
  42300. const handleClick = (event, row) => {
  42301. props.store.commit("setCurrentRow", row);
  42302. handleEvent(event, row, "click");
  42303. };
  42304. const handleContextMenu = (event, row) => {
  42305. handleEvent(event, row, "contextmenu");
  42306. };
  42307. const handleMouseEnter = debounce((index) => {
  42308. props.store.commit("setHoverRow", index);
  42309. }, 30);
  42310. const handleMouseLeave = debounce(() => {
  42311. props.store.commit("setHoverRow", null);
  42312. }, 30);
  42313. const handleCellMouseEnter = (event, row, tooltipEffect) => {
  42314. var _a;
  42315. const table = parent;
  42316. const cell = getCell(event);
  42317. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  42318. if (cell) {
  42319. const column = getColumnByCell({
  42320. columns: props.store.states.columns.value
  42321. }, cell, namespace);
  42322. const hoverState = table.hoverState = { cell, column, row };
  42323. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  42324. }
  42325. const cellChild = event.target.querySelector(".cell");
  42326. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  42327. return;
  42328. }
  42329. const range = document.createRange();
  42330. range.setStart(cellChild, 0);
  42331. range.setEnd(cellChild, cellChild.childNodes.length);
  42332. const rangeWidth = range.getBoundingClientRect().width;
  42333. const padding = (Number.parseInt(getStyle(cellChild, "paddingLeft"), 10) || 0) + (Number.parseInt(getStyle(cellChild, "paddingRight"), 10) || 0);
  42334. if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
  42335. createTablePopper(parent == null ? void 0 : parent.refs.tableWrapper, cell, cell.innerText || cell.textContent, {
  42336. placement: "top",
  42337. strategy: "fixed"
  42338. }, tooltipEffect);
  42339. }
  42340. };
  42341. const handleCellMouseLeave = (event) => {
  42342. const cell = getCell(event);
  42343. if (!cell)
  42344. return;
  42345. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  42346. 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);
  42347. };
  42348. return {
  42349. handleDoubleClick,
  42350. handleClick,
  42351. handleContextMenu,
  42352. handleMouseEnter,
  42353. handleMouseLeave,
  42354. handleCellMouseEnter,
  42355. handleCellMouseLeave,
  42356. tooltipContent,
  42357. tooltipTrigger
  42358. };
  42359. }
  42360. function useStyles$1(props) {
  42361. const parent = vue.inject(TABLE_INJECTION_KEY);
  42362. const ns = useNamespace("table");
  42363. const getRowStyle = (row, rowIndex) => {
  42364. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  42365. if (typeof rowStyle === "function") {
  42366. return rowStyle.call(null, {
  42367. row,
  42368. rowIndex
  42369. });
  42370. }
  42371. return rowStyle || null;
  42372. };
  42373. const getRowClass = (row, rowIndex) => {
  42374. const classes = [ns.e("row")];
  42375. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  42376. classes.push("current-row");
  42377. }
  42378. if (props.stripe && rowIndex % 2 === 1) {
  42379. classes.push(ns.em("row", "striped"));
  42380. }
  42381. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  42382. if (typeof rowClassName === "string") {
  42383. classes.push(rowClassName);
  42384. } else if (typeof rowClassName === "function") {
  42385. classes.push(rowClassName.call(null, {
  42386. row,
  42387. rowIndex
  42388. }));
  42389. }
  42390. return classes;
  42391. };
  42392. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  42393. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  42394. let cellStyles = cellStyle != null ? cellStyle : {};
  42395. if (typeof cellStyle === "function") {
  42396. cellStyles = cellStyle.call(null, {
  42397. rowIndex,
  42398. columnIndex,
  42399. row,
  42400. column
  42401. });
  42402. }
  42403. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  42404. ensurePosition(fixedStyle, "left");
  42405. ensurePosition(fixedStyle, "right");
  42406. return Object.assign({}, cellStyles, fixedStyle);
  42407. };
  42408. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  42409. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  42410. const classes = [column.id, column.align, column.className, ...fixedClasses];
  42411. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  42412. if (typeof cellClassName === "string") {
  42413. classes.push(cellClassName);
  42414. } else if (typeof cellClassName === "function") {
  42415. classes.push(cellClassName.call(null, {
  42416. rowIndex,
  42417. columnIndex,
  42418. row,
  42419. column
  42420. }));
  42421. }
  42422. classes.push(ns.e("cell"));
  42423. return classes.filter((className) => Boolean(className)).join(" ");
  42424. };
  42425. const getSpan = (row, column, rowIndex, columnIndex) => {
  42426. let rowspan = 1;
  42427. let colspan = 1;
  42428. const fn = parent == null ? void 0 : parent.props.spanMethod;
  42429. if (typeof fn === "function") {
  42430. const result = fn({
  42431. row,
  42432. column,
  42433. rowIndex,
  42434. columnIndex
  42435. });
  42436. if (Array.isArray(result)) {
  42437. rowspan = result[0];
  42438. colspan = result[1];
  42439. } else if (typeof result === "object") {
  42440. rowspan = result.rowspan;
  42441. colspan = result.colspan;
  42442. }
  42443. }
  42444. return { rowspan, colspan };
  42445. };
  42446. const getColspanRealWidth = (columns, colspan, index) => {
  42447. if (colspan < 1) {
  42448. return columns[index].realWidth;
  42449. }
  42450. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  42451. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  42452. };
  42453. return {
  42454. getRowStyle,
  42455. getRowClass,
  42456. getCellStyle,
  42457. getCellClass,
  42458. getSpan,
  42459. getColspanRealWidth
  42460. };
  42461. }
  42462. function useRender$1(props) {
  42463. const parent = vue.inject(TABLE_INJECTION_KEY);
  42464. const ns = useNamespace("table");
  42465. const {
  42466. handleDoubleClick,
  42467. handleClick,
  42468. handleContextMenu,
  42469. handleMouseEnter,
  42470. handleMouseLeave,
  42471. handleCellMouseEnter,
  42472. handleCellMouseLeave,
  42473. tooltipContent,
  42474. tooltipTrigger
  42475. } = useEvents(props);
  42476. const {
  42477. getRowStyle,
  42478. getRowClass,
  42479. getCellStyle,
  42480. getCellClass,
  42481. getSpan,
  42482. getColspanRealWidth
  42483. } = useStyles$1(props);
  42484. const firstDefaultColumnIndex = vue.computed(() => {
  42485. return props.store.states.columns.value.findIndex(({ type }) => type === "default");
  42486. });
  42487. const getKeyOfRow = (row, index) => {
  42488. const rowKey = parent.props.rowKey;
  42489. if (rowKey) {
  42490. return getRowIdentity(row, rowKey);
  42491. }
  42492. return index;
  42493. };
  42494. const rowRender = (row, $index, treeRowData, expanded = false) => {
  42495. const { tooltipEffect, store } = props;
  42496. const { indent, columns } = store.states;
  42497. const rowClasses = getRowClass(row, $index);
  42498. let display = true;
  42499. if (treeRowData) {
  42500. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  42501. display = treeRowData.display;
  42502. }
  42503. const displayStyle = display ? null : {
  42504. display: "none"
  42505. };
  42506. return vue.h("tr", {
  42507. style: [displayStyle, getRowStyle(row, $index)],
  42508. class: rowClasses,
  42509. key: getKeyOfRow(row, $index),
  42510. onDblclick: ($event) => handleDoubleClick($event, row),
  42511. onClick: ($event) => handleClick($event, row),
  42512. onContextmenu: ($event) => handleContextMenu($event, row),
  42513. onMouseenter: () => handleMouseEnter($index),
  42514. onMouseleave: handleMouseLeave
  42515. }, columns.value.map((column, cellIndex) => {
  42516. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  42517. if (!rowspan || !colspan) {
  42518. return null;
  42519. }
  42520. const columnData = { ...column };
  42521. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  42522. const data = {
  42523. store: props.store,
  42524. _self: props.context || parent,
  42525. column: columnData,
  42526. row,
  42527. $index,
  42528. cellIndex,
  42529. expanded
  42530. };
  42531. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  42532. data.treeNode = {
  42533. indent: treeRowData.level * indent.value,
  42534. level: treeRowData.level
  42535. };
  42536. if (typeof treeRowData.expanded === "boolean") {
  42537. data.treeNode.expanded = treeRowData.expanded;
  42538. if ("loading" in treeRowData) {
  42539. data.treeNode.loading = treeRowData.loading;
  42540. }
  42541. if ("noLazyChildren" in treeRowData) {
  42542. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  42543. }
  42544. }
  42545. }
  42546. const baseKey = `${$index},${cellIndex}`;
  42547. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  42548. const tdChildren = cellChildren(cellIndex, column, data);
  42549. return vue.h("td", {
  42550. style: getCellStyle($index, cellIndex, row, column),
  42551. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  42552. key: `${patchKey}${baseKey}`,
  42553. rowspan,
  42554. colspan,
  42555. onMouseenter: ($event) => handleCellMouseEnter($event, row, tooltipEffect),
  42556. onMouseleave: handleCellMouseLeave
  42557. }, [tdChildren]);
  42558. }));
  42559. };
  42560. const cellChildren = (cellIndex, column, data) => {
  42561. return column.renderCell(data);
  42562. };
  42563. const wrappedRowRender = (row, $index) => {
  42564. const store = props.store;
  42565. const { isRowExpanded, assertRowKey } = store;
  42566. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  42567. const columns = store.states.columns.value;
  42568. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  42569. if (hasExpandColumn) {
  42570. const expanded = isRowExpanded(row);
  42571. const tr = rowRender(row, $index, void 0, expanded);
  42572. const renderExpanded = parent.renderExpanded;
  42573. if (expanded) {
  42574. if (!renderExpanded) {
  42575. console.error("[Element Error]renderExpanded is required.");
  42576. return tr;
  42577. }
  42578. return [
  42579. [
  42580. tr,
  42581. vue.h("tr", {
  42582. key: `expanded-row__${tr.key}`
  42583. }, [
  42584. vue.h("td", {
  42585. colspan: columns.length,
  42586. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  42587. }, [renderExpanded({ row, $index, store, expanded })])
  42588. ])
  42589. ]
  42590. ];
  42591. } else {
  42592. return [[tr]];
  42593. }
  42594. } else if (Object.keys(treeData.value).length) {
  42595. assertRowKey();
  42596. const key = getRowIdentity(row, rowKey.value);
  42597. let cur = treeData.value[key];
  42598. let treeRowData = null;
  42599. if (cur) {
  42600. treeRowData = {
  42601. expanded: cur.expanded,
  42602. level: cur.level,
  42603. display: true
  42604. };
  42605. if (typeof cur.lazy === "boolean") {
  42606. if (typeof cur.loaded === "boolean" && cur.loaded) {
  42607. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  42608. }
  42609. treeRowData.loading = cur.loading;
  42610. }
  42611. }
  42612. const tmp = [rowRender(row, $index, treeRowData)];
  42613. if (cur) {
  42614. let i = 0;
  42615. const traverse = (children, parent2) => {
  42616. if (!(children && children.length && parent2))
  42617. return;
  42618. children.forEach((node) => {
  42619. const innerTreeRowData = {
  42620. display: parent2.display && parent2.expanded,
  42621. level: parent2.level + 1,
  42622. expanded: false,
  42623. noLazyChildren: false,
  42624. loading: false
  42625. };
  42626. const childKey = getRowIdentity(node, rowKey.value);
  42627. if (childKey === void 0 || childKey === null) {
  42628. throw new Error("For nested data item, row-key is required.");
  42629. }
  42630. cur = { ...treeData.value[childKey] };
  42631. if (cur) {
  42632. innerTreeRowData.expanded = cur.expanded;
  42633. cur.level = cur.level || innerTreeRowData.level;
  42634. cur.display = !!(cur.expanded && innerTreeRowData.display);
  42635. if (typeof cur.lazy === "boolean") {
  42636. if (typeof cur.loaded === "boolean" && cur.loaded) {
  42637. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  42638. }
  42639. innerTreeRowData.loading = cur.loading;
  42640. }
  42641. }
  42642. i++;
  42643. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  42644. if (cur) {
  42645. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  42646. traverse(nodes2, cur);
  42647. }
  42648. });
  42649. };
  42650. cur.display = true;
  42651. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  42652. traverse(nodes, cur);
  42653. }
  42654. return tmp;
  42655. } else {
  42656. return rowRender(row, $index, void 0);
  42657. }
  42658. };
  42659. return {
  42660. wrappedRowRender,
  42661. tooltipContent,
  42662. tooltipTrigger
  42663. };
  42664. }
  42665. const defaultProps$2 = {
  42666. store: {
  42667. required: true,
  42668. type: Object
  42669. },
  42670. stripe: Boolean,
  42671. tooltipEffect: String,
  42672. context: {
  42673. default: () => ({}),
  42674. type: Object
  42675. },
  42676. rowClassName: [String, Function],
  42677. rowStyle: [Object, Function],
  42678. fixed: {
  42679. type: String,
  42680. default: ""
  42681. },
  42682. highlight: Boolean
  42683. };
  42684. var defaultProps$3 = defaultProps$2;
  42685. var TableBody = vue.defineComponent({
  42686. name: "ElTableBody",
  42687. props: defaultProps$3,
  42688. setup(props) {
  42689. const instance = vue.getCurrentInstance();
  42690. const parent = vue.inject(TABLE_INJECTION_KEY);
  42691. const ns = useNamespace("table");
  42692. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  42693. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  42694. vue.watch(props.store.states.hoverRow, (newVal, oldVal) => {
  42695. if (!props.store.states.isComplex.value || !isClient)
  42696. return;
  42697. let raf = window.requestAnimationFrame;
  42698. if (!raf) {
  42699. raf = (fn) => window.setTimeout(fn, 16);
  42700. }
  42701. raf(() => {
  42702. const el = instance == null ? void 0 : instance.vnode.el;
  42703. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  42704. const oldRow = rows[oldVal];
  42705. const newRow = rows[newVal];
  42706. if (oldRow) {
  42707. removeClass(oldRow, "hover-row");
  42708. }
  42709. if (newRow) {
  42710. addClass(newRow, "hover-row");
  42711. }
  42712. });
  42713. });
  42714. vue.onUnmounted(() => {
  42715. var _a;
  42716. (_a = removePopper) == null ? void 0 : _a();
  42717. });
  42718. return {
  42719. ns,
  42720. onColumnsChange,
  42721. onScrollableChange,
  42722. wrappedRowRender,
  42723. tooltipContent,
  42724. tooltipTrigger
  42725. };
  42726. },
  42727. render() {
  42728. const { wrappedRowRender, store } = this;
  42729. const data = store.states.data.value || [];
  42730. return vue.h("tbody", {}, [
  42731. data.reduce((acc, row) => {
  42732. return acc.concat(wrappedRowRender(row, acc.length));
  42733. }, [])
  42734. ]);
  42735. }
  42736. });
  42737. function hColgroup(props) {
  42738. const isAuto = props.tableLayout === "auto";
  42739. let columns = props.columns || [];
  42740. if (isAuto) {
  42741. if (columns.every((column) => column.width === void 0)) {
  42742. columns = [];
  42743. }
  42744. }
  42745. const getPropsData = (column) => {
  42746. const propsData = {
  42747. key: `${props.tableLayout}_${column.id}`,
  42748. style: {},
  42749. name: void 0
  42750. };
  42751. if (isAuto) {
  42752. propsData.style = {
  42753. width: `${column.width}px`
  42754. };
  42755. } else {
  42756. propsData.name = column.id;
  42757. }
  42758. return propsData;
  42759. };
  42760. return vue.h("colgroup", {}, columns.map((column) => vue.h("col", getPropsData(column))));
  42761. }
  42762. hColgroup.props = ["columns", "tableLayout"];
  42763. function useMapState() {
  42764. const table = vue.inject(TABLE_INJECTION_KEY);
  42765. const store = table == null ? void 0 : table.store;
  42766. const leftFixedLeafCount = vue.computed(() => {
  42767. return store.states.fixedLeafColumnsLength.value;
  42768. });
  42769. const rightFixedLeafCount = vue.computed(() => {
  42770. return store.states.rightFixedColumns.value.length;
  42771. });
  42772. const columnsCount = vue.computed(() => {
  42773. return store.states.columns.value.length;
  42774. });
  42775. const leftFixedCount = vue.computed(() => {
  42776. return store.states.fixedColumns.value.length;
  42777. });
  42778. const rightFixedCount = vue.computed(() => {
  42779. return store.states.rightFixedColumns.value.length;
  42780. });
  42781. return {
  42782. leftFixedLeafCount,
  42783. rightFixedLeafCount,
  42784. columnsCount,
  42785. leftFixedCount,
  42786. rightFixedCount,
  42787. columns: store.states.columns
  42788. };
  42789. }
  42790. function useStyle$1(props) {
  42791. const { columns } = useMapState();
  42792. const ns = useNamespace("table");
  42793. const getCellClasses = (columns2, cellIndex) => {
  42794. const column = columns2[cellIndex];
  42795. const classes = [
  42796. ns.e("cell"),
  42797. column.id,
  42798. column.align,
  42799. column.labelClassName,
  42800. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  42801. ];
  42802. if (column.className) {
  42803. classes.push(column.className);
  42804. }
  42805. if (!column.children) {
  42806. classes.push(ns.is("leaf"));
  42807. }
  42808. return classes;
  42809. };
  42810. const getCellStyles = (column, cellIndex) => {
  42811. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  42812. ensurePosition(fixedStyle, "left");
  42813. ensurePosition(fixedStyle, "right");
  42814. return fixedStyle;
  42815. };
  42816. return {
  42817. getCellClasses,
  42818. getCellStyles,
  42819. columns
  42820. };
  42821. }
  42822. var TableFooter = vue.defineComponent({
  42823. name: "ElTableFooter",
  42824. props: {
  42825. fixed: {
  42826. type: String,
  42827. default: ""
  42828. },
  42829. store: {
  42830. required: true,
  42831. type: Object
  42832. },
  42833. summaryMethod: Function,
  42834. sumText: String,
  42835. border: Boolean,
  42836. defaultSort: {
  42837. type: Object,
  42838. default: () => {
  42839. return {
  42840. prop: "",
  42841. order: ""
  42842. };
  42843. }
  42844. }
  42845. },
  42846. setup(props) {
  42847. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  42848. const ns = useNamespace("table");
  42849. return {
  42850. ns,
  42851. getCellClasses,
  42852. getCellStyles,
  42853. columns
  42854. };
  42855. },
  42856. render() {
  42857. const {
  42858. columns,
  42859. getCellStyles,
  42860. getCellClasses,
  42861. summaryMethod,
  42862. sumText,
  42863. ns
  42864. } = this;
  42865. const data = this.store.states.data.value;
  42866. let sums = [];
  42867. if (summaryMethod) {
  42868. sums = summaryMethod({
  42869. columns,
  42870. data
  42871. });
  42872. } else {
  42873. columns.forEach((column, index) => {
  42874. if (index === 0) {
  42875. sums[index] = sumText;
  42876. return;
  42877. }
  42878. const values = data.map((item) => Number(item[column.property]));
  42879. const precisions = [];
  42880. let notNumber = true;
  42881. values.forEach((value) => {
  42882. if (!Number.isNaN(+value)) {
  42883. notNumber = false;
  42884. const decimal = `${value}`.split(".")[1];
  42885. precisions.push(decimal ? decimal.length : 0);
  42886. }
  42887. });
  42888. const precision = Math.max.apply(null, precisions);
  42889. if (!notNumber) {
  42890. sums[index] = values.reduce((prev, curr) => {
  42891. const value = Number(curr);
  42892. if (!Number.isNaN(+value)) {
  42893. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  42894. } else {
  42895. return prev;
  42896. }
  42897. }, 0);
  42898. } else {
  42899. sums[index] = "";
  42900. }
  42901. });
  42902. }
  42903. return vue.h("table", {
  42904. class: ns.e("footer"),
  42905. cellspacing: "0",
  42906. cellpadding: "0",
  42907. border: "0"
  42908. }, [
  42909. hColgroup({
  42910. columns
  42911. }),
  42912. vue.h("tbody", [
  42913. vue.h("tr", {}, [
  42914. ...columns.map((column, cellIndex) => vue.h("td", {
  42915. key: cellIndex,
  42916. colspan: column.colSpan,
  42917. rowspan: column.rowSpan,
  42918. class: getCellClasses(columns, cellIndex),
  42919. style: getCellStyles(column, cellIndex)
  42920. }, [
  42921. vue.h("div", {
  42922. class: ["cell", column.labelClassName]
  42923. }, [sums[cellIndex]])
  42924. ]))
  42925. ])
  42926. ])
  42927. ]);
  42928. }
  42929. });
  42930. function useUtils(store) {
  42931. const setCurrentRow = (row) => {
  42932. store.commit("setCurrentRow", row);
  42933. };
  42934. const getSelectionRows = () => {
  42935. return store.getSelectionRows();
  42936. };
  42937. const toggleRowSelection = (row, selected) => {
  42938. store.toggleRowSelection(row, selected, false);
  42939. store.updateAllSelected();
  42940. };
  42941. const clearSelection = () => {
  42942. store.clearSelection();
  42943. };
  42944. const clearFilter = (columnKeys) => {
  42945. store.clearFilter(columnKeys);
  42946. };
  42947. const toggleAllSelection = () => {
  42948. store.commit("toggleAllSelection");
  42949. };
  42950. const toggleRowExpansion = (row, expanded) => {
  42951. store.toggleRowExpansionAdapter(row, expanded);
  42952. };
  42953. const clearSort = () => {
  42954. store.clearSort();
  42955. };
  42956. const sort = (prop, order) => {
  42957. store.commit("sort", { prop, order });
  42958. };
  42959. return {
  42960. setCurrentRow,
  42961. getSelectionRows,
  42962. toggleRowSelection,
  42963. clearSelection,
  42964. clearFilter,
  42965. toggleAllSelection,
  42966. toggleRowExpansion,
  42967. clearSort,
  42968. sort
  42969. };
  42970. }
  42971. function useStyle(props, layout, store, table) {
  42972. const isHidden = vue.ref(false);
  42973. const renderExpanded = vue.ref(null);
  42974. const resizeProxyVisible = vue.ref(false);
  42975. const setDragVisible = (visible) => {
  42976. resizeProxyVisible.value = visible;
  42977. };
  42978. const resizeState = vue.ref({
  42979. width: null,
  42980. height: null,
  42981. headerHeight: null
  42982. });
  42983. const isGroup = vue.ref(false);
  42984. const scrollbarViewStyle = {
  42985. display: "inline-block",
  42986. verticalAlign: "middle"
  42987. };
  42988. const tableWidth = vue.ref();
  42989. const tableScrollHeight = vue.ref(0);
  42990. const bodyScrollHeight = vue.ref(0);
  42991. const headerScrollHeight = vue.ref(0);
  42992. const footerScrollHeight = vue.ref(0);
  42993. vue.watchEffect(() => {
  42994. layout.setHeight(props.height);
  42995. });
  42996. vue.watchEffect(() => {
  42997. layout.setMaxHeight(props.maxHeight);
  42998. });
  42999. vue.watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  43000. if (!vue.unref(rowKey) || !vue.unref(currentRowKey))
  43001. return;
  43002. store.setCurrentRowKey(`${currentRowKey}`);
  43003. }, {
  43004. immediate: true
  43005. });
  43006. vue.watch(() => props.data, (data) => {
  43007. table.store.commit("setData", data);
  43008. }, {
  43009. immediate: true,
  43010. deep: true
  43011. });
  43012. vue.watchEffect(() => {
  43013. if (props.expandRowKeys) {
  43014. store.setExpandRowKeysAdapter(props.expandRowKeys);
  43015. }
  43016. });
  43017. const handleMouseLeave = () => {
  43018. table.store.commit("setHoverRow", null);
  43019. if (table.hoverState)
  43020. table.hoverState = null;
  43021. };
  43022. const handleHeaderFooterMousewheel = (event, data) => {
  43023. const { pixelX, pixelY } = data;
  43024. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  43025. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  43026. }
  43027. };
  43028. const shouldUpdateHeight = vue.computed(() => {
  43029. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  43030. });
  43031. const tableBodyStyles = vue.computed(() => {
  43032. return {
  43033. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  43034. };
  43035. });
  43036. const doLayout = () => {
  43037. if (shouldUpdateHeight.value) {
  43038. layout.updateElsHeight();
  43039. }
  43040. layout.updateColumnsWidth();
  43041. requestAnimationFrame(syncPosition);
  43042. };
  43043. vue.onMounted(async () => {
  43044. await vue.nextTick();
  43045. store.updateColumns();
  43046. bindEvents();
  43047. requestAnimationFrame(doLayout);
  43048. const el = table.vnode.el;
  43049. const tableHeader = table.refs.headerWrapper;
  43050. if (props.flexible && el && el.parentElement) {
  43051. el.parentElement.style.minWidth = "0";
  43052. }
  43053. resizeState.value = {
  43054. width: tableWidth.value = el.offsetWidth,
  43055. height: el.offsetHeight,
  43056. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  43057. };
  43058. store.states.columns.value.forEach((column) => {
  43059. if (column.filteredValue && column.filteredValue.length) {
  43060. table.store.commit("filterChange", {
  43061. column,
  43062. values: column.filteredValue,
  43063. silent: true
  43064. });
  43065. }
  43066. });
  43067. table.$ready = true;
  43068. });
  43069. const setScrollClassByEl = (el, className) => {
  43070. if (!el)
  43071. return;
  43072. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  43073. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  43074. el.className = classList.join(" ");
  43075. };
  43076. const setScrollClass = (className) => {
  43077. const { tableWrapper } = table.refs;
  43078. setScrollClassByEl(tableWrapper, className);
  43079. };
  43080. const hasScrollClass = (className) => {
  43081. const { tableWrapper } = table.refs;
  43082. return !!(tableWrapper && tableWrapper.classList.contains(className));
  43083. };
  43084. const syncPosition = function() {
  43085. if (!table.refs.scrollBarRef)
  43086. return;
  43087. if (!layout.scrollX.value) {
  43088. const scrollingNoneClass = "is-scrolling-none";
  43089. if (!hasScrollClass(scrollingNoneClass)) {
  43090. setScrollClass(scrollingNoneClass);
  43091. }
  43092. return;
  43093. }
  43094. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  43095. if (!scrollContainer)
  43096. return;
  43097. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  43098. const { headerWrapper, footerWrapper } = table.refs;
  43099. if (headerWrapper)
  43100. headerWrapper.scrollLeft = scrollLeft;
  43101. if (footerWrapper)
  43102. footerWrapper.scrollLeft = scrollLeft;
  43103. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  43104. if (scrollLeft >= maxScrollLeftPosition) {
  43105. setScrollClass("is-scrolling-right");
  43106. } else if (scrollLeft === 0) {
  43107. setScrollClass("is-scrolling-left");
  43108. } else {
  43109. setScrollClass("is-scrolling-middle");
  43110. }
  43111. };
  43112. const bindEvents = () => {
  43113. if (!table.refs.scrollBarRef)
  43114. return;
  43115. if (table.refs.scrollBarRef.wrapRef) {
  43116. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  43117. passive: true
  43118. });
  43119. }
  43120. if (props.fit) {
  43121. useResizeObserver(table.vnode.el, resizeListener);
  43122. } else {
  43123. useEventListener(window, "resize", resizeListener);
  43124. }
  43125. useResizeObserver(table.refs.bodyWrapper, () => {
  43126. var _a, _b;
  43127. resizeListener();
  43128. (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update();
  43129. });
  43130. };
  43131. const resizeListener = () => {
  43132. var _a, _b, _c;
  43133. const el = table.vnode.el;
  43134. if (!table.$ready || !el)
  43135. return;
  43136. let shouldUpdateLayout = false;
  43137. const {
  43138. width: oldWidth,
  43139. height: oldHeight,
  43140. headerHeight: oldHeaderHeight
  43141. } = resizeState.value;
  43142. const width = tableWidth.value = el.offsetWidth;
  43143. if (oldWidth !== width) {
  43144. shouldUpdateLayout = true;
  43145. }
  43146. const height = el.offsetHeight;
  43147. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  43148. shouldUpdateLayout = true;
  43149. }
  43150. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
  43151. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  43152. shouldUpdateLayout = true;
  43153. }
  43154. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  43155. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  43156. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  43157. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value;
  43158. if (shouldUpdateLayout) {
  43159. resizeState.value = {
  43160. width,
  43161. height,
  43162. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  43163. };
  43164. doLayout();
  43165. }
  43166. };
  43167. const tableSize = useSize();
  43168. const bodyWidth = vue.computed(() => {
  43169. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  43170. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  43171. });
  43172. const tableLayout = vue.computed(() => {
  43173. if (props.maxHeight)
  43174. return "fixed";
  43175. return props.tableLayout;
  43176. });
  43177. const emptyBlockStyle = vue.computed(() => {
  43178. if (props.data && props.data.length)
  43179. return null;
  43180. let height = "100%";
  43181. if (props.height && bodyScrollHeight.value) {
  43182. height = `${bodyScrollHeight.value}px`;
  43183. }
  43184. const width = tableWidth.value;
  43185. return {
  43186. width: width ? `${width}px` : "",
  43187. height
  43188. };
  43189. });
  43190. const tableInnerStyle = vue.computed(() => {
  43191. if (props.height) {
  43192. return {
  43193. height: !Number.isNaN(Number(props.height)) ? `${props.height}px` : props.height
  43194. };
  43195. }
  43196. if (props.maxHeight) {
  43197. return {
  43198. maxHeight: !Number.isNaN(Number(props.maxHeight)) ? `${props.maxHeight}px` : props.maxHeight
  43199. };
  43200. }
  43201. return {};
  43202. });
  43203. const scrollbarStyle = vue.computed(() => {
  43204. if (props.height) {
  43205. return {
  43206. height: "100%"
  43207. };
  43208. }
  43209. if (props.maxHeight) {
  43210. if (!Number.isNaN(Number(props.maxHeight))) {
  43211. const maxHeight = props.maxHeight;
  43212. const reachMaxHeight = tableScrollHeight.value >= Number(maxHeight);
  43213. if (reachMaxHeight) {
  43214. return {
  43215. maxHeight: `${tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value}px`
  43216. };
  43217. }
  43218. } else {
  43219. return {
  43220. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  43221. };
  43222. }
  43223. }
  43224. return {};
  43225. });
  43226. const handleFixedMousewheel = (event, data) => {
  43227. const bodyWrapper = table.refs.bodyWrapper;
  43228. if (Math.abs(data.spinY) > 0) {
  43229. const currentScrollTop = bodyWrapper.scrollTop;
  43230. if (data.pixelY < 0 && currentScrollTop !== 0) {
  43231. event.preventDefault();
  43232. }
  43233. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  43234. event.preventDefault();
  43235. }
  43236. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  43237. } else {
  43238. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  43239. }
  43240. };
  43241. return {
  43242. isHidden,
  43243. renderExpanded,
  43244. setDragVisible,
  43245. isGroup,
  43246. handleMouseLeave,
  43247. handleHeaderFooterMousewheel,
  43248. tableSize,
  43249. emptyBlockStyle,
  43250. handleFixedMousewheel,
  43251. resizeProxyVisible,
  43252. bodyWidth,
  43253. resizeState,
  43254. doLayout,
  43255. tableBodyStyles,
  43256. tableLayout,
  43257. scrollbarViewStyle,
  43258. tableInnerStyle,
  43259. scrollbarStyle
  43260. };
  43261. }
  43262. var defaultProps$1 = {
  43263. data: {
  43264. type: Array,
  43265. default: () => []
  43266. },
  43267. size: String,
  43268. width: [String, Number],
  43269. height: [String, Number],
  43270. maxHeight: [String, Number],
  43271. fit: {
  43272. type: Boolean,
  43273. default: true
  43274. },
  43275. stripe: Boolean,
  43276. border: Boolean,
  43277. rowKey: [String, Function],
  43278. showHeader: {
  43279. type: Boolean,
  43280. default: true
  43281. },
  43282. showSummary: Boolean,
  43283. sumText: String,
  43284. summaryMethod: Function,
  43285. rowClassName: [String, Function],
  43286. rowStyle: [Object, Function],
  43287. cellClassName: [String, Function],
  43288. cellStyle: [Object, Function],
  43289. headerRowClassName: [String, Function],
  43290. headerRowStyle: [Object, Function],
  43291. headerCellClassName: [String, Function],
  43292. headerCellStyle: [Object, Function],
  43293. highlightCurrentRow: Boolean,
  43294. currentRowKey: [String, Number],
  43295. emptyText: String,
  43296. expandRowKeys: Array,
  43297. defaultExpandAll: Boolean,
  43298. defaultSort: Object,
  43299. tooltipEffect: String,
  43300. spanMethod: Function,
  43301. selectOnIndeterminate: {
  43302. type: Boolean,
  43303. default: true
  43304. },
  43305. indent: {
  43306. type: Number,
  43307. default: 16
  43308. },
  43309. treeProps: {
  43310. type: Object,
  43311. default: () => {
  43312. return {
  43313. hasChildren: "hasChildren",
  43314. children: "children"
  43315. };
  43316. }
  43317. },
  43318. lazy: Boolean,
  43319. load: Function,
  43320. style: {
  43321. type: Object,
  43322. default: () => ({})
  43323. },
  43324. className: {
  43325. type: String,
  43326. default: ""
  43327. },
  43328. tableLayout: {
  43329. type: String,
  43330. default: "fixed"
  43331. },
  43332. scrollbarAlwaysOn: {
  43333. type: Boolean,
  43334. default: false
  43335. },
  43336. flexible: Boolean
  43337. };
  43338. const useScrollbar$1 = () => {
  43339. const scrollBarRef = vue.ref();
  43340. const scrollTo = (options, yCoord) => {
  43341. const scrollbar = scrollBarRef.value;
  43342. if (scrollbar) {
  43343. scrollbar.scrollTo(options, yCoord);
  43344. }
  43345. };
  43346. const setScrollPosition = (position, offset) => {
  43347. const scrollbar = scrollBarRef.value;
  43348. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) {
  43349. scrollbar[`setScroll${position}`](offset);
  43350. }
  43351. };
  43352. const setScrollTop = (top) => setScrollPosition("Top", top);
  43353. const setScrollLeft = (left) => setScrollPosition("Left", left);
  43354. return {
  43355. scrollBarRef,
  43356. scrollTo,
  43357. setScrollTop,
  43358. setScrollLeft
  43359. };
  43360. };
  43361. let tableIdSeed = 1;
  43362. const _sfc_main$p = vue.defineComponent({
  43363. name: "ElTable",
  43364. directives: {
  43365. Mousewheel
  43366. },
  43367. components: {
  43368. TableHeader,
  43369. TableBody,
  43370. TableFooter,
  43371. ElScrollbar,
  43372. hColgroup
  43373. },
  43374. props: defaultProps$1,
  43375. emits: [
  43376. "select",
  43377. "select-all",
  43378. "selection-change",
  43379. "cell-mouse-enter",
  43380. "cell-mouse-leave",
  43381. "cell-contextmenu",
  43382. "cell-click",
  43383. "cell-dblclick",
  43384. "row-click",
  43385. "row-contextmenu",
  43386. "row-dblclick",
  43387. "header-click",
  43388. "header-contextmenu",
  43389. "sort-change",
  43390. "filter-change",
  43391. "current-change",
  43392. "header-dragend",
  43393. "expand-change"
  43394. ],
  43395. setup(props) {
  43396. const { t } = useLocale();
  43397. const ns = useNamespace("table");
  43398. const table = vue.getCurrentInstance();
  43399. vue.provide(TABLE_INJECTION_KEY, table);
  43400. const store = createStore(table, props);
  43401. table.store = store;
  43402. const layout = new TableLayout$1({
  43403. store: table.store,
  43404. table,
  43405. fit: props.fit,
  43406. showHeader: props.showHeader
  43407. });
  43408. table.layout = layout;
  43409. const isEmpty = vue.computed(() => (store.states.data.value || []).length === 0);
  43410. const {
  43411. setCurrentRow,
  43412. getSelectionRows,
  43413. toggleRowSelection,
  43414. clearSelection,
  43415. clearFilter,
  43416. toggleAllSelection,
  43417. toggleRowExpansion,
  43418. clearSort,
  43419. sort
  43420. } = useUtils(store);
  43421. const {
  43422. isHidden,
  43423. renderExpanded,
  43424. setDragVisible,
  43425. isGroup,
  43426. handleMouseLeave,
  43427. handleHeaderFooterMousewheel,
  43428. tableSize,
  43429. emptyBlockStyle,
  43430. handleFixedMousewheel,
  43431. resizeProxyVisible,
  43432. bodyWidth,
  43433. resizeState,
  43434. doLayout,
  43435. tableBodyStyles,
  43436. tableLayout,
  43437. scrollbarViewStyle,
  43438. tableInnerStyle,
  43439. scrollbarStyle
  43440. } = useStyle(props, layout, store, table);
  43441. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  43442. const debouncedUpdateLayout = debounce(doLayout, 50);
  43443. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  43444. table.tableId = tableId;
  43445. table.state = {
  43446. isGroup,
  43447. resizeState,
  43448. doLayout,
  43449. debouncedUpdateLayout
  43450. };
  43451. const computedSumText = vue.computed(() => props.sumText || t("el.table.sumText"));
  43452. const computedEmptyText = vue.computed(() => {
  43453. return props.emptyText || t("el.table.emptyText");
  43454. });
  43455. return {
  43456. ns,
  43457. layout,
  43458. store,
  43459. handleHeaderFooterMousewheel,
  43460. handleMouseLeave,
  43461. tableId,
  43462. tableSize,
  43463. isHidden,
  43464. isEmpty,
  43465. renderExpanded,
  43466. resizeProxyVisible,
  43467. resizeState,
  43468. isGroup,
  43469. bodyWidth,
  43470. tableBodyStyles,
  43471. emptyBlockStyle,
  43472. debouncedUpdateLayout,
  43473. handleFixedMousewheel,
  43474. setCurrentRow,
  43475. getSelectionRows,
  43476. toggleRowSelection,
  43477. clearSelection,
  43478. clearFilter,
  43479. toggleAllSelection,
  43480. toggleRowExpansion,
  43481. clearSort,
  43482. doLayout,
  43483. sort,
  43484. t,
  43485. setDragVisible,
  43486. context: table,
  43487. computedSumText,
  43488. computedEmptyText,
  43489. tableLayout,
  43490. scrollbarViewStyle,
  43491. tableInnerStyle,
  43492. scrollbarStyle,
  43493. scrollBarRef,
  43494. scrollTo,
  43495. setScrollLeft,
  43496. setScrollTop
  43497. };
  43498. }
  43499. });
  43500. const _hoisted_1$b = ["data-prefix"];
  43501. const _hoisted_2$7 = {
  43502. ref: "hiddenColumns",
  43503. class: "hidden-columns"
  43504. };
  43505. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  43506. const _component_hColgroup = vue.resolveComponent("hColgroup");
  43507. const _component_table_header = vue.resolveComponent("table-header");
  43508. const _component_table_body = vue.resolveComponent("table-body");
  43509. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  43510. const _component_table_footer = vue.resolveComponent("table-footer");
  43511. const _directive_mousewheel = vue.resolveDirective("mousewheel");
  43512. return vue.openBlock(), vue.createElementBlock("div", {
  43513. ref: "tableWrapper",
  43514. class: vue.normalizeClass([
  43515. {
  43516. [_ctx.ns.m("fit")]: _ctx.fit,
  43517. [_ctx.ns.m("striped")]: _ctx.stripe,
  43518. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  43519. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  43520. [_ctx.ns.m("group")]: _ctx.isGroup,
  43521. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  43522. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  43523. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  43524. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  43525. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  43526. "has-footer": _ctx.showSummary
  43527. },
  43528. _ctx.ns.m(_ctx.tableSize),
  43529. _ctx.className,
  43530. _ctx.ns.b(),
  43531. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  43532. ]),
  43533. style: vue.normalizeStyle(_ctx.style),
  43534. "data-prefix": _ctx.ns.namespace.value,
  43535. onMouseleave: _cache[0] || (_cache[0] = ($event) => _ctx.handleMouseLeave())
  43536. }, [
  43537. vue.createElementVNode("div", {
  43538. class: vue.normalizeClass(_ctx.ns.e("inner-wrapper")),
  43539. style: vue.normalizeStyle(_ctx.tableInnerStyle)
  43540. }, [
  43541. vue.createElementVNode("div", _hoisted_2$7, [
  43542. vue.renderSlot(_ctx.$slots, "default")
  43543. ], 512),
  43544. _ctx.showHeader && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  43545. key: 0,
  43546. ref: "headerWrapper",
  43547. class: vue.normalizeClass(_ctx.ns.e("header-wrapper"))
  43548. }, [
  43549. vue.createElementVNode("table", {
  43550. ref: "tableHeader",
  43551. class: vue.normalizeClass(_ctx.ns.e("header")),
  43552. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  43553. border: "0",
  43554. cellpadding: "0",
  43555. cellspacing: "0"
  43556. }, [
  43557. vue.createVNode(_component_hColgroup, {
  43558. columns: _ctx.store.states.columns.value,
  43559. "table-layout": _ctx.tableLayout
  43560. }, null, 8, ["columns", "table-layout"]),
  43561. vue.createVNode(_component_table_header, {
  43562. ref: "tableHeaderRef",
  43563. border: _ctx.border,
  43564. "default-sort": _ctx.defaultSort,
  43565. store: _ctx.store,
  43566. onSetDragVisible: _ctx.setDragVisible
  43567. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  43568. ], 6)
  43569. ], 2)), [
  43570. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  43571. ]) : vue.createCommentVNode("v-if", true),
  43572. vue.createElementVNode("div", {
  43573. ref: "bodyWrapper",
  43574. class: vue.normalizeClass(_ctx.ns.e("body-wrapper"))
  43575. }, [
  43576. vue.createVNode(_component_el_scrollbar, {
  43577. ref: "scrollBarRef",
  43578. "view-style": _ctx.scrollbarViewStyle,
  43579. "wrap-style": _ctx.scrollbarStyle,
  43580. always: _ctx.scrollbarAlwaysOn
  43581. }, {
  43582. default: vue.withCtx(() => [
  43583. vue.createElementVNode("table", {
  43584. ref: "tableBody",
  43585. class: vue.normalizeClass(_ctx.ns.e("body")),
  43586. cellspacing: "0",
  43587. cellpadding: "0",
  43588. border: "0",
  43589. style: vue.normalizeStyle({
  43590. width: _ctx.bodyWidth,
  43591. tableLayout: _ctx.tableLayout
  43592. })
  43593. }, [
  43594. vue.createVNode(_component_hColgroup, {
  43595. columns: _ctx.store.states.columns.value,
  43596. "table-layout": _ctx.tableLayout
  43597. }, null, 8, ["columns", "table-layout"]),
  43598. _ctx.showHeader && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_header, {
  43599. key: 0,
  43600. ref: "tableHeaderRef",
  43601. border: _ctx.border,
  43602. "default-sort": _ctx.defaultSort,
  43603. store: _ctx.store,
  43604. onSetDragVisible: _ctx.setDragVisible
  43605. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])) : vue.createCommentVNode("v-if", true),
  43606. vue.createVNode(_component_table_body, {
  43607. context: _ctx.context,
  43608. highlight: _ctx.highlightCurrentRow,
  43609. "row-class-name": _ctx.rowClassName,
  43610. "tooltip-effect": _ctx.tooltipEffect,
  43611. "row-style": _ctx.rowStyle,
  43612. store: _ctx.store,
  43613. stripe: _ctx.stripe
  43614. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "row-style", "store", "stripe"])
  43615. ], 6),
  43616. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  43617. key: 0,
  43618. ref: "emptyBlock",
  43619. style: vue.normalizeStyle(_ctx.emptyBlockStyle),
  43620. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  43621. }, [
  43622. vue.createElementVNode("span", {
  43623. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  43624. }, [
  43625. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  43626. vue.createTextVNode(vue.toDisplayString(_ctx.computedEmptyText), 1)
  43627. ])
  43628. ], 2)
  43629. ], 6)) : vue.createCommentVNode("v-if", true),
  43630. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  43631. key: 1,
  43632. ref: "appendWrapper",
  43633. class: vue.normalizeClass(_ctx.ns.e("append-wrapper"))
  43634. }, [
  43635. vue.renderSlot(_ctx.$slots, "append")
  43636. ], 2)) : vue.createCommentVNode("v-if", true)
  43637. ]),
  43638. _: 3
  43639. }, 8, ["view-style", "wrap-style", "always"])
  43640. ], 2),
  43641. _ctx.showSummary ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  43642. key: 1,
  43643. ref: "footerWrapper",
  43644. class: vue.normalizeClass(_ctx.ns.e("footer-wrapper"))
  43645. }, [
  43646. vue.createVNode(_component_table_footer, {
  43647. border: _ctx.border,
  43648. "default-sort": _ctx.defaultSort,
  43649. store: _ctx.store,
  43650. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  43651. "sum-text": _ctx.computedSumText,
  43652. "summary-method": _ctx.summaryMethod
  43653. }, null, 8, ["border", "default-sort", "store", "style", "sum-text", "summary-method"])
  43654. ], 2)), [
  43655. [vue.vShow, !_ctx.isEmpty],
  43656. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  43657. ]) : vue.createCommentVNode("v-if", true),
  43658. _ctx.border || _ctx.isGroup ? (vue.openBlock(), vue.createElementBlock("div", {
  43659. key: 2,
  43660. class: vue.normalizeClass(_ctx.ns.e("border-left-patch"))
  43661. }, null, 2)) : vue.createCommentVNode("v-if", true)
  43662. ], 6),
  43663. vue.withDirectives(vue.createElementVNode("div", {
  43664. ref: "resizeProxy",
  43665. class: vue.normalizeClass(_ctx.ns.e("column-resize-proxy"))
  43666. }, null, 2), [
  43667. [vue.vShow, _ctx.resizeProxyVisible]
  43668. ])
  43669. ], 46, _hoisted_1$b);
  43670. }
  43671. var Table = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$3], ["__file", "table.vue"]]);
  43672. const defaultClassNames = {
  43673. selection: "table-column--selection",
  43674. expand: "table__expand-column"
  43675. };
  43676. const cellStarts = {
  43677. default: {
  43678. order: ""
  43679. },
  43680. selection: {
  43681. width: 48,
  43682. minWidth: 48,
  43683. realWidth: 48,
  43684. order: ""
  43685. },
  43686. expand: {
  43687. width: 48,
  43688. minWidth: 48,
  43689. realWidth: 48,
  43690. order: ""
  43691. },
  43692. index: {
  43693. width: 48,
  43694. minWidth: 48,
  43695. realWidth: 48,
  43696. order: ""
  43697. }
  43698. };
  43699. const getDefaultClassName = (type) => {
  43700. return defaultClassNames[type] || "";
  43701. };
  43702. const cellForced = {
  43703. selection: {
  43704. renderHeader({ store }) {
  43705. function isDisabled() {
  43706. return store.states.data.value && store.states.data.value.length === 0;
  43707. }
  43708. return vue.h(ElCheckbox, {
  43709. disabled: isDisabled(),
  43710. size: store.states.tableSize.value,
  43711. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  43712. "onUpdate:modelValue": store.toggleAllSelection,
  43713. modelValue: store.states.isAllSelected.value
  43714. });
  43715. },
  43716. renderCell({
  43717. row,
  43718. column,
  43719. store,
  43720. $index
  43721. }) {
  43722. return vue.h(ElCheckbox, {
  43723. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  43724. size: store.states.tableSize.value,
  43725. onChange: () => {
  43726. store.commit("rowSelectedChanged", row);
  43727. },
  43728. onClick: (event) => event.stopPropagation(),
  43729. modelValue: store.isSelected(row)
  43730. });
  43731. },
  43732. sortable: false,
  43733. resizable: false
  43734. },
  43735. index: {
  43736. renderHeader({ column }) {
  43737. return column.label || "#";
  43738. },
  43739. renderCell({
  43740. column,
  43741. $index
  43742. }) {
  43743. let i = $index + 1;
  43744. const index = column.index;
  43745. if (typeof index === "number") {
  43746. i = $index + index;
  43747. } else if (typeof index === "function") {
  43748. i = index($index);
  43749. }
  43750. return vue.h("div", {}, [i]);
  43751. },
  43752. sortable: false
  43753. },
  43754. expand: {
  43755. renderHeader({ column }) {
  43756. return column.label || "";
  43757. },
  43758. renderCell({
  43759. row,
  43760. store,
  43761. expanded
  43762. }) {
  43763. const { ns } = store;
  43764. const classes = [ns.e("expand-icon")];
  43765. if (expanded) {
  43766. classes.push(ns.em("expand-icon", "expanded"));
  43767. }
  43768. const callback = function(e) {
  43769. e.stopPropagation();
  43770. store.toggleRowExpansion(row);
  43771. };
  43772. return vue.h("div", {
  43773. class: classes,
  43774. onClick: callback
  43775. }, {
  43776. default: () => {
  43777. return [
  43778. vue.h(ElIcon, null, {
  43779. default: () => {
  43780. return [vue.h(arrow_right_default)];
  43781. }
  43782. })
  43783. ];
  43784. }
  43785. });
  43786. },
  43787. sortable: false,
  43788. resizable: false
  43789. }
  43790. };
  43791. function defaultRenderCell({
  43792. row,
  43793. column,
  43794. $index
  43795. }) {
  43796. var _a;
  43797. const property = column.property;
  43798. const value = property && getProp(row, property).value;
  43799. if (column && column.formatter) {
  43800. return column.formatter(row, column, value, $index);
  43801. }
  43802. return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
  43803. }
  43804. function treeCellPrefix({
  43805. row,
  43806. treeNode,
  43807. store
  43808. }, createPlacehoder = false) {
  43809. const { ns } = store;
  43810. if (!treeNode) {
  43811. if (createPlacehoder) {
  43812. return [
  43813. vue.h("span", {
  43814. class: ns.e("placeholder")
  43815. })
  43816. ];
  43817. }
  43818. return null;
  43819. }
  43820. const ele = [];
  43821. const callback = function(e) {
  43822. e.stopPropagation();
  43823. if (treeNode.loading) {
  43824. return;
  43825. }
  43826. store.loadOrToggle(row);
  43827. };
  43828. if (treeNode.indent) {
  43829. ele.push(vue.h("span", {
  43830. class: ns.e("indent"),
  43831. style: { "padding-left": `${treeNode.indent}px` }
  43832. }));
  43833. }
  43834. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  43835. const expandClasses = [
  43836. ns.e("expand-icon"),
  43837. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  43838. ];
  43839. let icon = arrow_right_default;
  43840. if (treeNode.loading) {
  43841. icon = loading_default;
  43842. }
  43843. ele.push(vue.h("div", {
  43844. class: expandClasses,
  43845. onClick: callback
  43846. }, {
  43847. default: () => {
  43848. return [
  43849. vue.h(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  43850. default: () => [vue.h(icon)]
  43851. })
  43852. ];
  43853. }
  43854. }));
  43855. } else {
  43856. ele.push(vue.h("span", {
  43857. class: ns.e("placeholder")
  43858. }));
  43859. }
  43860. return ele;
  43861. }
  43862. function getAllAliases(props, aliases) {
  43863. return props.reduce((prev, cur) => {
  43864. prev[cur] = cur;
  43865. return prev;
  43866. }, aliases);
  43867. }
  43868. function useWatcher(owner, props_) {
  43869. const instance = vue.getCurrentInstance();
  43870. const registerComplexWatchers = () => {
  43871. const props = ["fixed"];
  43872. const aliases = {
  43873. realWidth: "width",
  43874. realMinWidth: "minWidth"
  43875. };
  43876. const allAliases = getAllAliases(props, aliases);
  43877. Object.keys(allAliases).forEach((key) => {
  43878. const columnKey = aliases[key];
  43879. if (hasOwn(props_, columnKey)) {
  43880. vue.watch(() => props_[columnKey], (newVal) => {
  43881. let value = newVal;
  43882. if (columnKey === "width" && key === "realWidth") {
  43883. value = parseWidth(newVal);
  43884. }
  43885. if (columnKey === "minWidth" && key === "realMinWidth") {
  43886. value = parseMinWidth(newVal);
  43887. }
  43888. instance.columnConfig.value[columnKey] = value;
  43889. instance.columnConfig.value[key] = value;
  43890. const updateColumns = columnKey === "fixed";
  43891. owner.value.store.scheduleLayout(updateColumns);
  43892. });
  43893. }
  43894. });
  43895. };
  43896. const registerNormalWatchers = () => {
  43897. const props = [
  43898. "label",
  43899. "filters",
  43900. "filterMultiple",
  43901. "sortable",
  43902. "index",
  43903. "formatter",
  43904. "className",
  43905. "labelClassName",
  43906. "showOverflowTooltip"
  43907. ];
  43908. const aliases = {
  43909. property: "prop",
  43910. align: "realAlign",
  43911. headerAlign: "realHeaderAlign"
  43912. };
  43913. const allAliases = getAllAliases(props, aliases);
  43914. Object.keys(allAliases).forEach((key) => {
  43915. const columnKey = aliases[key];
  43916. if (hasOwn(props_, columnKey)) {
  43917. vue.watch(() => props_[columnKey], (newVal) => {
  43918. instance.columnConfig.value[key] = newVal;
  43919. });
  43920. }
  43921. });
  43922. };
  43923. return {
  43924. registerComplexWatchers,
  43925. registerNormalWatchers
  43926. };
  43927. }
  43928. function useRender(props, slots, owner) {
  43929. const instance = vue.getCurrentInstance();
  43930. const columnId = vue.ref("");
  43931. const isSubColumn = vue.ref(false);
  43932. const realAlign = vue.ref();
  43933. const realHeaderAlign = vue.ref();
  43934. const ns = useNamespace("table");
  43935. vue.watchEffect(() => {
  43936. realAlign.value = props.align ? `is-${props.align}` : null;
  43937. realAlign.value;
  43938. });
  43939. vue.watchEffect(() => {
  43940. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  43941. realHeaderAlign.value;
  43942. });
  43943. const columnOrTableParent = vue.computed(() => {
  43944. let parent = instance.vnode.vParent || instance.parent;
  43945. while (parent && !parent.tableId && !parent.columnId) {
  43946. parent = parent.vnode.vParent || parent.parent;
  43947. }
  43948. return parent;
  43949. });
  43950. const hasTreeColumn = vue.computed(() => {
  43951. const { store } = instance.parent;
  43952. if (!store)
  43953. return false;
  43954. const { treeData } = store.states;
  43955. const treeDataValue = treeData.value;
  43956. return treeDataValue && Object.keys(treeDataValue).length > 0;
  43957. });
  43958. const realWidth = vue.ref(parseWidth(props.width));
  43959. const realMinWidth = vue.ref(parseMinWidth(props.minWidth));
  43960. const setColumnWidth = (column) => {
  43961. if (realWidth.value)
  43962. column.width = realWidth.value;
  43963. if (realMinWidth.value) {
  43964. column.minWidth = realMinWidth.value;
  43965. }
  43966. if (!realWidth.value && realMinWidth.value) {
  43967. column.width = void 0;
  43968. }
  43969. if (!column.minWidth) {
  43970. column.minWidth = 80;
  43971. }
  43972. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  43973. return column;
  43974. };
  43975. const setColumnForcedProps = (column) => {
  43976. const type = column.type;
  43977. const source = cellForced[type] || {};
  43978. Object.keys(source).forEach((prop) => {
  43979. const value = source[prop];
  43980. if (prop !== "className" && value !== void 0) {
  43981. column[prop] = value;
  43982. }
  43983. });
  43984. const className = getDefaultClassName(type);
  43985. if (className) {
  43986. const forceClass = `${vue.unref(ns.namespace)}-${className}`;
  43987. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  43988. }
  43989. return column;
  43990. };
  43991. const checkSubColumn = (children) => {
  43992. if (Array.isArray(children)) {
  43993. children.forEach((child) => check(child));
  43994. } else {
  43995. check(children);
  43996. }
  43997. function check(item) {
  43998. var _a;
  43999. if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") {
  44000. item.vParent = instance;
  44001. }
  44002. }
  44003. };
  44004. const setColumnRenders = (column) => {
  44005. if (props.renderHeader) ; else if (column.type !== "selection") {
  44006. column.renderHeader = (scope) => {
  44007. instance.columnConfig.value["label"];
  44008. const renderHeader = slots.header;
  44009. return renderHeader ? renderHeader(scope) : column.label;
  44010. };
  44011. }
  44012. let originRenderCell = column.renderCell;
  44013. if (column.type === "expand") {
  44014. column.renderCell = (data) => vue.h("div", {
  44015. class: "cell"
  44016. }, [originRenderCell(data)]);
  44017. owner.value.renderExpanded = (data) => {
  44018. return slots.default ? slots.default(data) : slots.default;
  44019. };
  44020. } else {
  44021. originRenderCell = originRenderCell || defaultRenderCell;
  44022. column.renderCell = (data) => {
  44023. let children = null;
  44024. if (slots.default) {
  44025. const vnodes = slots.default(data);
  44026. children = vnodes.some((v) => v.type !== vue.Comment) ? vnodes : originRenderCell(data);
  44027. } else {
  44028. children = originRenderCell(data);
  44029. }
  44030. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === 0 && data.column.type !== "selection";
  44031. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  44032. const props2 = {
  44033. class: "cell",
  44034. style: {}
  44035. };
  44036. if (column.showOverflowTooltip) {
  44037. props2.class = `${props2.class} ${vue.unref(ns.namespace)}-tooltip`;
  44038. props2.style = {
  44039. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  44040. };
  44041. }
  44042. checkSubColumn(children);
  44043. return vue.h("div", props2, [prefix, children]);
  44044. };
  44045. }
  44046. return column;
  44047. };
  44048. const getPropsData = (...propsKey) => {
  44049. return propsKey.reduce((prev, cur) => {
  44050. if (Array.isArray(cur)) {
  44051. cur.forEach((key) => {
  44052. prev[key] = props[key];
  44053. });
  44054. }
  44055. return prev;
  44056. }, {});
  44057. };
  44058. const getColumnElIndex = (children, child) => {
  44059. return Array.prototype.indexOf.call(children, child);
  44060. };
  44061. return {
  44062. columnId,
  44063. realAlign,
  44064. isSubColumn,
  44065. realHeaderAlign,
  44066. columnOrTableParent,
  44067. setColumnWidth,
  44068. setColumnForcedProps,
  44069. setColumnRenders,
  44070. getPropsData,
  44071. getColumnElIndex
  44072. };
  44073. }
  44074. var defaultProps = {
  44075. type: {
  44076. type: String,
  44077. default: "default"
  44078. },
  44079. label: String,
  44080. className: String,
  44081. labelClassName: String,
  44082. property: String,
  44083. prop: String,
  44084. width: {
  44085. type: [String, Number],
  44086. default: ""
  44087. },
  44088. minWidth: {
  44089. type: [String, Number],
  44090. default: ""
  44091. },
  44092. renderHeader: Function,
  44093. sortable: {
  44094. type: [Boolean, String],
  44095. default: false
  44096. },
  44097. sortMethod: Function,
  44098. sortBy: [String, Function, Array],
  44099. resizable: {
  44100. type: Boolean,
  44101. default: true
  44102. },
  44103. columnKey: String,
  44104. align: String,
  44105. headerAlign: String,
  44106. showTooltipWhenOverflow: Boolean,
  44107. showOverflowTooltip: Boolean,
  44108. fixed: [Boolean, String],
  44109. formatter: Function,
  44110. selectable: Function,
  44111. reserveSelection: Boolean,
  44112. filterMethod: Function,
  44113. filteredValue: Array,
  44114. filters: Array,
  44115. filterPlacement: String,
  44116. filterMultiple: {
  44117. type: Boolean,
  44118. default: true
  44119. },
  44120. index: [Number, Function],
  44121. sortOrders: {
  44122. type: Array,
  44123. default: () => {
  44124. return ["ascending", "descending", null];
  44125. },
  44126. validator: (val) => {
  44127. return val.every((order) => ["ascending", "descending", null].includes(order));
  44128. }
  44129. }
  44130. };
  44131. let columnIdSeed = 1;
  44132. var ElTableColumn$1 = vue.defineComponent({
  44133. name: "ElTableColumn",
  44134. components: {
  44135. ElCheckbox
  44136. },
  44137. props: defaultProps,
  44138. setup(props, { slots }) {
  44139. const instance = vue.getCurrentInstance();
  44140. const columnConfig = vue.ref({});
  44141. const owner = vue.computed(() => {
  44142. let parent2 = instance.parent;
  44143. while (parent2 && !parent2.tableId) {
  44144. parent2 = parent2.parent;
  44145. }
  44146. return parent2;
  44147. });
  44148. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  44149. const {
  44150. columnId,
  44151. isSubColumn,
  44152. realHeaderAlign,
  44153. columnOrTableParent,
  44154. setColumnWidth,
  44155. setColumnForcedProps,
  44156. setColumnRenders,
  44157. getPropsData,
  44158. getColumnElIndex,
  44159. realAlign
  44160. } = useRender(props, slots, owner);
  44161. const parent = columnOrTableParent.value;
  44162. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  44163. vue.onBeforeMount(() => {
  44164. isSubColumn.value = owner.value !== parent;
  44165. const type = props.type || "default";
  44166. const sortable = props.sortable === "" ? true : props.sortable;
  44167. const defaults = {
  44168. ...cellStarts[type],
  44169. id: columnId.value,
  44170. type,
  44171. property: props.prop || props.property,
  44172. align: realAlign,
  44173. headerAlign: realHeaderAlign,
  44174. showOverflowTooltip: props.showOverflowTooltip || props.showTooltipWhenOverflow,
  44175. filterable: props.filters || props.filterMethod,
  44176. filteredValue: [],
  44177. filterPlacement: "",
  44178. isColumnGroup: false,
  44179. isSubColumn: false,
  44180. filterOpened: false,
  44181. sortable,
  44182. index: props.index,
  44183. rawColumnKey: instance.vnode.key
  44184. };
  44185. const basicProps = [
  44186. "columnKey",
  44187. "label",
  44188. "className",
  44189. "labelClassName",
  44190. "type",
  44191. "renderHeader",
  44192. "formatter",
  44193. "fixed",
  44194. "resizable"
  44195. ];
  44196. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  44197. const selectProps = ["selectable", "reserveSelection"];
  44198. const filterProps = [
  44199. "filterMethod",
  44200. "filters",
  44201. "filterMultiple",
  44202. "filterOpened",
  44203. "filteredValue",
  44204. "filterPlacement"
  44205. ];
  44206. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  44207. column = mergeOptions(defaults, column);
  44208. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  44209. column = chains(column);
  44210. columnConfig.value = column;
  44211. registerNormalWatchers();
  44212. registerComplexWatchers();
  44213. });
  44214. vue.onMounted(() => {
  44215. var _a;
  44216. const parent2 = columnOrTableParent.value;
  44217. const children = isSubColumn.value ? parent2.vnode.el.children : (_a = parent2.refs.hiddenColumns) == null ? void 0 : _a.children;
  44218. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  44219. columnConfig.value.getColumnIndex = getColumnIndex;
  44220. const columnIndex = getColumnIndex();
  44221. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null);
  44222. });
  44223. vue.onBeforeUnmount(() => {
  44224. owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null);
  44225. });
  44226. instance.columnId = columnId.value;
  44227. instance.columnConfig = columnConfig;
  44228. return;
  44229. },
  44230. render() {
  44231. var _a, _b, _c;
  44232. try {
  44233. const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
  44234. row: {},
  44235. column: {},
  44236. $index: -1
  44237. });
  44238. const children = [];
  44239. if (Array.isArray(renderDefault)) {
  44240. for (const childNode of renderDefault) {
  44241. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  44242. children.push(childNode);
  44243. } else if (childNode.type === vue.Fragment && Array.isArray(childNode.children)) {
  44244. childNode.children.forEach((vnode2) => {
  44245. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString(vnode2 == null ? void 0 : vnode2.children)) {
  44246. children.push(vnode2);
  44247. }
  44248. });
  44249. }
  44250. }
  44251. }
  44252. const vnode = vue.h("div", children);
  44253. return vnode;
  44254. } catch (e) {
  44255. return vue.h("div", []);
  44256. }
  44257. }
  44258. });
  44259. const ElTable = withInstall(Table, {
  44260. TableColumn: ElTableColumn$1
  44261. });
  44262. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  44263. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  44264. SortOrder2["ASC"] = "asc";
  44265. SortOrder2["DESC"] = "desc";
  44266. return SortOrder2;
  44267. })(SortOrder || {});
  44268. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  44269. Alignment2["CENTER"] = "center";
  44270. Alignment2["RIGHT"] = "right";
  44271. return Alignment2;
  44272. })(Alignment || {});
  44273. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  44274. FixedDir2["LEFT"] = "left";
  44275. FixedDir2["RIGHT"] = "right";
  44276. return FixedDir2;
  44277. })(FixedDir || {});
  44278. const oppositeOrderMap = {
  44279. ["asc" /* ASC */]: "desc" /* DESC */,
  44280. ["desc" /* DESC */]: "asc" /* ASC */
  44281. };
  44282. const placeholderSign = Symbol("placeholder");
  44283. const calcColumnStyle = (column, fixedColumn, fixed) => {
  44284. var _a;
  44285. const flex = {
  44286. flexGrow: 0,
  44287. flexShrink: 0,
  44288. ...fixed ? {} : {
  44289. flexGrow: column.flexGrow || 0,
  44290. flexShrink: column.flexShrink || 1
  44291. }
  44292. };
  44293. if (!fixed) {
  44294. flex.flexShrink = 1;
  44295. }
  44296. const style = {
  44297. ...(_a = column.style) != null ? _a : {},
  44298. ...flex,
  44299. flexBasis: "auto",
  44300. width: column.width
  44301. };
  44302. if (!fixedColumn) {
  44303. if (column.maxWidth)
  44304. style.maxWidth = column.maxWidth;
  44305. if (column.minWidth)
  44306. style.minWidth = column.minWidth;
  44307. }
  44308. return style;
  44309. };
  44310. function useColumns(props, columns, fixed) {
  44311. const visibleColumns = vue.computed(() => {
  44312. return vue.unref(columns).filter((column) => !column.hidden);
  44313. });
  44314. const fixedColumnsOnLeft = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  44315. const fixedColumnsOnRight = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "right"));
  44316. const normalColumns = vue.computed(() => vue.unref(visibleColumns).filter((column) => !column.fixed));
  44317. const mainColumns = vue.computed(() => {
  44318. const ret = [];
  44319. vue.unref(fixedColumnsOnLeft).forEach((column) => {
  44320. ret.push({
  44321. ...column,
  44322. placeholderSign
  44323. });
  44324. });
  44325. vue.unref(normalColumns).forEach((column) => {
  44326. ret.push(column);
  44327. });
  44328. vue.unref(fixedColumnsOnRight).forEach((column) => {
  44329. ret.push({
  44330. ...column,
  44331. placeholderSign
  44332. });
  44333. });
  44334. return ret;
  44335. });
  44336. const hasFixedColumns = vue.computed(() => {
  44337. return vue.unref(fixedColumnsOnLeft).length || vue.unref(fixedColumnsOnRight).length;
  44338. });
  44339. const columnsStyles = vue.computed(() => {
  44340. const _columns = vue.unref(columns);
  44341. return _columns.reduce((style, column) => {
  44342. style[column.key] = calcColumnStyle(column, vue.unref(fixed), props.fixed);
  44343. return style;
  44344. }, {});
  44345. });
  44346. const columnsTotalWidth = vue.computed(() => {
  44347. return vue.unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  44348. });
  44349. const getColumn = (key) => {
  44350. return vue.unref(columns).find((column) => column.key === key);
  44351. };
  44352. const getColumnStyle = (key) => {
  44353. return vue.unref(columnsStyles)[key];
  44354. };
  44355. const updateColumnWidth = (column, width) => {
  44356. column.width = width;
  44357. };
  44358. function onColumnSorted(e) {
  44359. var _a;
  44360. const { key } = e.currentTarget.dataset;
  44361. if (!key)
  44362. return;
  44363. const { sortState, sortBy } = props;
  44364. let order = SortOrder.ASC;
  44365. if (isObject$1(sortState)) {
  44366. order = oppositeOrderMap[sortState[key]];
  44367. } else {
  44368. order = oppositeOrderMap[sortBy.order];
  44369. }
  44370. (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order });
  44371. }
  44372. return {
  44373. columns,
  44374. columnsStyles,
  44375. columnsTotalWidth,
  44376. fixedColumnsOnLeft,
  44377. fixedColumnsOnRight,
  44378. hasFixedColumns,
  44379. mainColumns,
  44380. normalColumns,
  44381. visibleColumns,
  44382. getColumn,
  44383. getColumnStyle,
  44384. updateColumnWidth,
  44385. onColumnSorted
  44386. };
  44387. }
  44388. const useScrollbar = (props, {
  44389. mainTableRef,
  44390. leftTableRef,
  44391. rightTableRef,
  44392. onMaybeEndReached
  44393. }) => {
  44394. const scrollPos = vue.ref({ scrollLeft: 0, scrollTop: 0 });
  44395. function doScroll(params) {
  44396. var _a, _b, _c;
  44397. const { scrollTop } = params;
  44398. (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(params);
  44399. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  44400. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  44401. }
  44402. function scrollTo(params) {
  44403. scrollPos.value = params;
  44404. doScroll(params);
  44405. }
  44406. function scrollToTop(scrollTop) {
  44407. scrollPos.value.scrollTop = scrollTop;
  44408. doScroll(vue.unref(scrollPos));
  44409. }
  44410. function scrollToLeft(scrollLeft) {
  44411. var _a, _b;
  44412. scrollPos.value.scrollLeft = scrollLeft;
  44413. (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, vue.unref(scrollPos));
  44414. }
  44415. function onScroll(params) {
  44416. var _a;
  44417. scrollTo(params);
  44418. (_a = props.onScroll) == null ? void 0 : _a.call(props, params);
  44419. }
  44420. function onVerticalScroll({ scrollTop }) {
  44421. const { scrollTop: currentScrollTop } = vue.unref(scrollPos);
  44422. if (scrollTop !== currentScrollTop)
  44423. scrollToTop(scrollTop);
  44424. }
  44425. function scrollToRow(row, strategy = "auto") {
  44426. var _a;
  44427. (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy);
  44428. }
  44429. vue.watch(() => vue.unref(scrollPos).scrollTop, (cur, prev) => {
  44430. if (cur > prev)
  44431. onMaybeEndReached();
  44432. });
  44433. return {
  44434. scrollPos,
  44435. scrollTo,
  44436. scrollToLeft,
  44437. scrollToTop,
  44438. scrollToRow,
  44439. onScroll,
  44440. onVerticalScroll
  44441. };
  44442. };
  44443. const useRow = (props, { mainTableRef, leftTableRef, rightTableRef, onMaybeEndReached }) => {
  44444. const vm = vue.getCurrentInstance();
  44445. const { emit } = vm;
  44446. const isResetting = vue.shallowRef(false);
  44447. const hoveringRowKey = vue.shallowRef(null);
  44448. const expandedRowKeys = vue.ref(props.defaultExpandedRowKeys || []);
  44449. const lastRenderedRowIndex = vue.ref(-1);
  44450. const resetIndex = vue.shallowRef(null);
  44451. const rowHeights = vue.ref({});
  44452. const pendingRowHeights = vue.ref({});
  44453. const leftTableHeights = vue.shallowRef({});
  44454. const mainTableHeights = vue.shallowRef({});
  44455. const rightTableHeights = vue.shallowRef({});
  44456. const isDynamic = vue.computed(() => isNumber(props.estimatedRowHeight));
  44457. function onRowsRendered(params) {
  44458. var _a;
  44459. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params);
  44460. if (params.rowCacheEnd > vue.unref(lastRenderedRowIndex)) {
  44461. lastRenderedRowIndex.value = params.rowCacheEnd;
  44462. }
  44463. }
  44464. function onRowHovered({ hovered, rowKey }) {
  44465. hoveringRowKey.value = hovered ? rowKey : null;
  44466. }
  44467. function onRowExpanded({
  44468. expanded,
  44469. rowData,
  44470. rowIndex,
  44471. rowKey
  44472. }) {
  44473. var _a, _b;
  44474. const _expandedRowKeys = [...vue.unref(expandedRowKeys)];
  44475. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  44476. if (expanded) {
  44477. if (currentKeyIndex === -1)
  44478. _expandedRowKeys.push(rowKey);
  44479. } else {
  44480. if (currentKeyIndex > -1)
  44481. _expandedRowKeys.splice(currentKeyIndex, 1);
  44482. }
  44483. expandedRowKeys.value = _expandedRowKeys;
  44484. emit("update:expandedRowKeys", _expandedRowKeys);
  44485. (_a = props.onRowExpand) == null ? void 0 : _a.call(props, {
  44486. expanded,
  44487. rowData,
  44488. rowIndex,
  44489. rowKey
  44490. });
  44491. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  44492. }
  44493. const flushingRowHeights = debounce(() => {
  44494. var _a, _b, _c, _d;
  44495. isResetting.value = true;
  44496. rowHeights.value = { ...vue.unref(rowHeights), ...vue.unref(pendingRowHeights) };
  44497. resetAfterIndex(vue.unref(resetIndex), false);
  44498. pendingRowHeights.value = {};
  44499. resetIndex.value = null;
  44500. (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate();
  44501. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  44502. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  44503. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  44504. isResetting.value = false;
  44505. }, 0);
  44506. function resetAfterIndex(index, forceUpdate = false) {
  44507. if (!vue.unref(isDynamic))
  44508. return;
  44509. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  44510. const table = vue.unref(tableRef);
  44511. if (table)
  44512. table.resetAfterRowIndex(index, forceUpdate);
  44513. });
  44514. }
  44515. function resetHeights(rowKey, height, rowIdx) {
  44516. const resetIdx = vue.unref(resetIndex);
  44517. if (resetIdx === null) {
  44518. resetIndex.value = rowIdx;
  44519. } else {
  44520. if (resetIdx > rowIdx) {
  44521. resetIndex.value = rowIdx;
  44522. }
  44523. }
  44524. pendingRowHeights.value[rowKey] = height;
  44525. }
  44526. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  44527. if (!fixedDir) {
  44528. mainTableHeights.value[rowKey] = height;
  44529. } else {
  44530. if (fixedDir === FixedDir.RIGHT) {
  44531. rightTableHeights.value[rowKey] = height;
  44532. } else {
  44533. leftTableHeights.value[rowKey] = height;
  44534. }
  44535. }
  44536. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0));
  44537. if (vue.unref(rowHeights)[rowKey] !== maximumHeight) {
  44538. resetHeights(rowKey, maximumHeight, rowIndex);
  44539. flushingRowHeights();
  44540. }
  44541. }
  44542. vue.watch(lastRenderedRowIndex, () => onMaybeEndReached());
  44543. return {
  44544. hoveringRowKey,
  44545. expandedRowKeys,
  44546. lastRenderedRowIndex,
  44547. isDynamic,
  44548. isResetting,
  44549. rowHeights,
  44550. resetAfterIndex,
  44551. onRowExpanded,
  44552. onRowHovered,
  44553. onRowsRendered,
  44554. onRowHeightChange
  44555. };
  44556. };
  44557. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  44558. const depthMap = vue.ref({});
  44559. const flattenedData = vue.computed(() => {
  44560. const depths = {};
  44561. const { data: data2, rowKey } = props;
  44562. const _expandedRowKeys = vue.unref(expandedRowKeys);
  44563. if (!_expandedRowKeys || !_expandedRowKeys.length)
  44564. return data2;
  44565. const array = [];
  44566. const keysSet = /* @__PURE__ */ new Set();
  44567. _expandedRowKeys.forEach((x) => keysSet.add(x));
  44568. let copy = data2.slice();
  44569. copy.forEach((x) => depths[x[rowKey]] = 0);
  44570. while (copy.length > 0) {
  44571. const item = copy.shift();
  44572. array.push(item);
  44573. if (keysSet.has(item[rowKey]) && Array.isArray(item.children) && item.children.length > 0) {
  44574. copy = [...item.children, ...copy];
  44575. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  44576. }
  44577. }
  44578. depthMap.value = depths;
  44579. return array;
  44580. });
  44581. const data = vue.computed(() => {
  44582. const { data: data2, expandColumnKey } = props;
  44583. return expandColumnKey ? vue.unref(flattenedData) : data2;
  44584. });
  44585. vue.watch(data, (val, prev) => {
  44586. if (val !== prev) {
  44587. lastRenderedRowIndex.value = -1;
  44588. resetAfterIndex(0, true);
  44589. }
  44590. });
  44591. return {
  44592. data,
  44593. depthMap
  44594. };
  44595. };
  44596. const sumReducer = (sum2, num) => sum2 + num;
  44597. const sum = (listLike) => {
  44598. return isArray(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  44599. };
  44600. const tryCall = (fLike, params, defaultRet = {}) => {
  44601. return isFunction(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  44602. };
  44603. const enforceUnit = (style) => {
  44604. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  44605. style[key] = addUnit(style[key]);
  44606. });
  44607. return style;
  44608. };
  44609. const componentToSlot = (ComponentLike) => vue.isVNode(ComponentLike) ? (props) => vue.h(ComponentLike, props) : ComponentLike;
  44610. const useStyles = (props, {
  44611. columnsTotalWidth,
  44612. data,
  44613. fixedColumnsOnLeft,
  44614. fixedColumnsOnRight
  44615. }) => {
  44616. const bodyWidth = vue.computed(() => {
  44617. const { fixed, width, vScrollbarSize } = props;
  44618. const ret = width - vScrollbarSize;
  44619. return fixed ? Math.max(Math.round(vue.unref(columnsTotalWidth)), ret) : ret;
  44620. });
  44621. const headerWidth = vue.computed(() => vue.unref(bodyWidth) + (props.fixed ? props.vScrollbarSize : 0));
  44622. const mainTableHeight = vue.computed(() => {
  44623. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  44624. if (maxHeight > 0) {
  44625. const _fixedRowsHeight = vue.unref(fixedRowsHeight);
  44626. const _rowsHeight = vue.unref(rowsHeight);
  44627. const _headerHeight = vue.unref(headerHeight);
  44628. const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  44629. return Math.min(total, maxHeight - footerHeight2);
  44630. }
  44631. return height - footerHeight2;
  44632. });
  44633. const rowsHeight = vue.computed(() => {
  44634. const { rowHeight, estimatedRowHeight } = props;
  44635. const _data = vue.unref(data);
  44636. if (isNumber(estimatedRowHeight)) {
  44637. return _data.length * estimatedRowHeight;
  44638. }
  44639. return _data.length * rowHeight;
  44640. });
  44641. const fixedTableHeight = vue.computed(() => {
  44642. const { maxHeight } = props;
  44643. const tableHeight = vue.unref(mainTableHeight);
  44644. if (isNumber(maxHeight) && maxHeight > 0)
  44645. return tableHeight;
  44646. const totalHeight = vue.unref(rowsHeight) + vue.unref(headerHeight) + vue.unref(fixedRowsHeight);
  44647. return Math.min(tableHeight, totalHeight);
  44648. });
  44649. const mapColumn = (column) => column.width;
  44650. const leftTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnLeft).map(mapColumn)));
  44651. const rightTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnRight).map(mapColumn)));
  44652. const headerHeight = vue.computed(() => sum(props.headerHeight));
  44653. const fixedRowsHeight = vue.computed(() => {
  44654. var _a;
  44655. return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight;
  44656. });
  44657. const windowHeight = vue.computed(() => {
  44658. return vue.unref(mainTableHeight) - vue.unref(headerHeight) - vue.unref(fixedRowsHeight);
  44659. });
  44660. const rootStyle = vue.computed(() => {
  44661. const { style = {}, height, width } = props;
  44662. return enforceUnit({
  44663. ...style,
  44664. height,
  44665. width
  44666. });
  44667. });
  44668. const footerHeight = vue.computed(() => enforceUnit({ height: props.footerHeight }));
  44669. const emptyStyle = vue.computed(() => ({
  44670. top: addUnit(vue.unref(headerHeight)),
  44671. bottom: addUnit(props.footerHeight),
  44672. width: addUnit(props.width)
  44673. }));
  44674. return {
  44675. bodyWidth,
  44676. fixedTableHeight,
  44677. mainTableHeight,
  44678. leftTableWidth,
  44679. rightTableWidth,
  44680. headerWidth,
  44681. rowsHeight,
  44682. windowHeight,
  44683. footerHeight,
  44684. emptyStyle,
  44685. rootStyle,
  44686. headerHeight
  44687. };
  44688. };
  44689. const useAutoResize = (props) => {
  44690. const sizer = vue.ref();
  44691. const width$ = vue.ref(0);
  44692. const height$ = vue.ref(0);
  44693. let resizerStopper;
  44694. vue.onMounted(() => {
  44695. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  44696. const { width, height } = entry.contentRect;
  44697. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  44698. const left = Number.parseInt(paddingLeft) || 0;
  44699. const right = Number.parseInt(paddingRight) || 0;
  44700. const top = Number.parseInt(paddingTop) || 0;
  44701. const bottom = Number.parseInt(paddingBottom) || 0;
  44702. width$.value = width - left - right;
  44703. height$.value = height - top - bottom;
  44704. }).stop;
  44705. });
  44706. vue.onBeforeUnmount(() => {
  44707. resizerStopper == null ? void 0 : resizerStopper();
  44708. });
  44709. vue.watch([width$, height$], ([width, height]) => {
  44710. var _a;
  44711. (_a = props.onResize) == null ? void 0 : _a.call(props, {
  44712. width,
  44713. height
  44714. });
  44715. });
  44716. return {
  44717. sizer,
  44718. width: width$,
  44719. height: height$
  44720. };
  44721. };
  44722. function useTable(props) {
  44723. const mainTableRef = vue.ref();
  44724. const leftTableRef = vue.ref();
  44725. const rightTableRef = vue.ref();
  44726. const {
  44727. columns,
  44728. columnsStyles,
  44729. columnsTotalWidth,
  44730. fixedColumnsOnLeft,
  44731. fixedColumnsOnRight,
  44732. hasFixedColumns,
  44733. mainColumns,
  44734. onColumnSorted
  44735. } = useColumns(props, vue.toRef(props, "columns"), vue.toRef(props, "fixed"));
  44736. const {
  44737. scrollTo,
  44738. scrollToLeft,
  44739. scrollToTop,
  44740. scrollToRow,
  44741. onScroll,
  44742. onVerticalScroll,
  44743. scrollPos
  44744. } = useScrollbar(props, {
  44745. mainTableRef,
  44746. leftTableRef,
  44747. rightTableRef,
  44748. onMaybeEndReached
  44749. });
  44750. const {
  44751. expandedRowKeys,
  44752. hoveringRowKey,
  44753. lastRenderedRowIndex,
  44754. isDynamic,
  44755. isResetting,
  44756. rowHeights,
  44757. resetAfterIndex,
  44758. onRowExpanded,
  44759. onRowHeightChange,
  44760. onRowHovered,
  44761. onRowsRendered
  44762. } = useRow(props, {
  44763. mainTableRef,
  44764. leftTableRef,
  44765. rightTableRef,
  44766. onMaybeEndReached
  44767. });
  44768. const { data, depthMap } = useData(props, {
  44769. expandedRowKeys,
  44770. lastRenderedRowIndex,
  44771. resetAfterIndex
  44772. });
  44773. const {
  44774. bodyWidth,
  44775. fixedTableHeight,
  44776. mainTableHeight,
  44777. leftTableWidth,
  44778. rightTableWidth,
  44779. headerWidth,
  44780. rowsHeight,
  44781. windowHeight,
  44782. footerHeight,
  44783. emptyStyle,
  44784. rootStyle,
  44785. headerHeight
  44786. } = useStyles(props, {
  44787. columnsTotalWidth,
  44788. data,
  44789. fixedColumnsOnLeft,
  44790. fixedColumnsOnRight
  44791. });
  44792. const isScrolling = vue.shallowRef(false);
  44793. const containerRef = vue.ref();
  44794. const showEmpty = vue.computed(() => {
  44795. const noData = vue.unref(data).length === 0;
  44796. return isArray(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  44797. });
  44798. function getRowHeight(rowIndex) {
  44799. const { estimatedRowHeight, rowHeight, rowKey } = props;
  44800. if (!estimatedRowHeight)
  44801. return rowHeight;
  44802. return vue.unref(rowHeights)[vue.unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  44803. }
  44804. function onMaybeEndReached() {
  44805. const { onEndReached } = props;
  44806. if (!onEndReached)
  44807. return;
  44808. const { scrollTop } = vue.unref(scrollPos);
  44809. const _totalHeight = vue.unref(rowsHeight);
  44810. const clientHeight = vue.unref(windowHeight);
  44811. const heightUntilEnd = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  44812. if (vue.unref(lastRenderedRowIndex) >= 0 && _totalHeight === scrollTop + vue.unref(mainTableHeight) - vue.unref(headerHeight)) {
  44813. onEndReached(heightUntilEnd);
  44814. }
  44815. }
  44816. vue.watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  44817. deep: true
  44818. });
  44819. return {
  44820. columns,
  44821. containerRef,
  44822. mainTableRef,
  44823. leftTableRef,
  44824. rightTableRef,
  44825. isDynamic,
  44826. isResetting,
  44827. isScrolling,
  44828. hoveringRowKey,
  44829. hasFixedColumns,
  44830. columnsStyles,
  44831. columnsTotalWidth,
  44832. data,
  44833. expandedRowKeys,
  44834. depthMap,
  44835. fixedColumnsOnLeft,
  44836. fixedColumnsOnRight,
  44837. mainColumns,
  44838. bodyWidth,
  44839. emptyStyle,
  44840. rootStyle,
  44841. headerWidth,
  44842. footerHeight,
  44843. mainTableHeight,
  44844. fixedTableHeight,
  44845. leftTableWidth,
  44846. rightTableWidth,
  44847. showEmpty,
  44848. getRowHeight,
  44849. onColumnSorted,
  44850. onRowHovered,
  44851. onRowExpanded,
  44852. onRowsRendered,
  44853. onRowHeightChange,
  44854. scrollTo,
  44855. scrollToLeft,
  44856. scrollToTop,
  44857. scrollToRow,
  44858. onScroll,
  44859. onVerticalScroll
  44860. };
  44861. }
  44862. const TableV2InjectionKey = Symbol("tableV2");
  44863. const classType = String;
  44864. const columns = {
  44865. type: definePropType(Array),
  44866. required: true
  44867. };
  44868. const fixedDataType = {
  44869. type: definePropType(Array)
  44870. };
  44871. const dataType = {
  44872. ...fixedDataType,
  44873. required: true
  44874. };
  44875. const expandColumnKey = String;
  44876. const expandKeys = {
  44877. type: definePropType(Array),
  44878. default: () => mutable([])
  44879. };
  44880. const requiredNumber = {
  44881. type: Number,
  44882. required: true
  44883. };
  44884. const rowKey = {
  44885. type: definePropType([String, Number, Symbol]),
  44886. default: "id"
  44887. };
  44888. const styleType = {
  44889. type: definePropType(Object)
  44890. };
  44891. const tableV2RowProps = buildProps({
  44892. class: String,
  44893. columns,
  44894. columnsStyles: {
  44895. type: definePropType(Object),
  44896. required: true
  44897. },
  44898. depth: Number,
  44899. expandColumnKey,
  44900. estimatedRowHeight: {
  44901. ...virtualizedGridProps.estimatedRowHeight,
  44902. default: void 0
  44903. },
  44904. isScrolling: Boolean,
  44905. onRowExpand: {
  44906. type: definePropType(Function)
  44907. },
  44908. onRowHover: {
  44909. type: definePropType(Function)
  44910. },
  44911. onRowHeightChange: {
  44912. type: definePropType(Function)
  44913. },
  44914. rowData: {
  44915. type: definePropType(Object),
  44916. required: true
  44917. },
  44918. rowEventHandlers: {
  44919. type: definePropType(Object)
  44920. },
  44921. rowIndex: {
  44922. type: Number,
  44923. required: true
  44924. },
  44925. rowKey,
  44926. style: {
  44927. type: definePropType(Object)
  44928. }
  44929. });
  44930. const requiredNumberType = {
  44931. type: Number,
  44932. required: true
  44933. };
  44934. const tableV2HeaderProps = buildProps({
  44935. class: String,
  44936. columns,
  44937. fixedHeaderData: {
  44938. type: definePropType(Array)
  44939. },
  44940. headerData: {
  44941. type: definePropType(Array),
  44942. required: true
  44943. },
  44944. headerHeight: {
  44945. type: definePropType([Number, Array]),
  44946. default: 50
  44947. },
  44948. rowWidth: requiredNumberType,
  44949. rowHeight: {
  44950. type: Number,
  44951. default: 50
  44952. },
  44953. height: requiredNumberType,
  44954. width: requiredNumberType
  44955. });
  44956. const tableV2GridProps = buildProps({
  44957. columns,
  44958. data: dataType,
  44959. fixedData: fixedDataType,
  44960. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  44961. width: requiredNumber,
  44962. height: requiredNumber,
  44963. headerWidth: requiredNumber,
  44964. headerHeight: tableV2HeaderProps.headerHeight,
  44965. bodyWidth: requiredNumber,
  44966. rowHeight: requiredNumber,
  44967. cache: virtualizedListProps.cache,
  44968. useIsScrolling: Boolean,
  44969. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  44970. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  44971. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  44972. class: classType,
  44973. style: styleType,
  44974. containerStyle: styleType,
  44975. getRowHeight: {
  44976. type: definePropType(Function),
  44977. required: true
  44978. },
  44979. rowKey: tableV2RowProps.rowKey,
  44980. onRowsRendered: {
  44981. type: definePropType(Function)
  44982. },
  44983. onScroll: {
  44984. type: definePropType(Function)
  44985. }
  44986. });
  44987. const tableV2Props = buildProps({
  44988. cache: tableV2GridProps.cache,
  44989. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  44990. rowKey,
  44991. headerClass: {
  44992. type: definePropType([
  44993. String,
  44994. Function
  44995. ])
  44996. },
  44997. headerProps: {
  44998. type: definePropType([
  44999. Object,
  45000. Function
  45001. ])
  45002. },
  45003. headerCellProps: {
  45004. type: definePropType([
  45005. Object,
  45006. Function
  45007. ])
  45008. },
  45009. headerHeight: tableV2HeaderProps.headerHeight,
  45010. footerHeight: {
  45011. type: Number,
  45012. default: 0
  45013. },
  45014. rowClass: {
  45015. type: definePropType([String, Function])
  45016. },
  45017. rowProps: {
  45018. type: definePropType([Object, Function])
  45019. },
  45020. rowHeight: {
  45021. type: Number,
  45022. default: 50
  45023. },
  45024. cellProps: {
  45025. type: definePropType([
  45026. Object,
  45027. Function
  45028. ])
  45029. },
  45030. columns,
  45031. data: dataType,
  45032. dataGetter: {
  45033. type: definePropType(Function)
  45034. },
  45035. fixedData: fixedDataType,
  45036. expandColumnKey: tableV2RowProps.expandColumnKey,
  45037. expandedRowKeys: expandKeys,
  45038. defaultExpandedRowKeys: expandKeys,
  45039. class: classType,
  45040. fixed: Boolean,
  45041. style: {
  45042. type: definePropType(Object)
  45043. },
  45044. width: requiredNumber,
  45045. height: requiredNumber,
  45046. maxHeight: Number,
  45047. useIsScrolling: Boolean,
  45048. indentSize: {
  45049. type: Number,
  45050. default: 12
  45051. },
  45052. iconSize: {
  45053. type: Number,
  45054. default: 12
  45055. },
  45056. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  45057. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  45058. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  45059. sortBy: {
  45060. type: definePropType(Object),
  45061. default: () => ({})
  45062. },
  45063. sortState: {
  45064. type: definePropType(Object),
  45065. default: void 0
  45066. },
  45067. onColumnSort: {
  45068. type: definePropType(Function)
  45069. },
  45070. onExpandedRowsChange: {
  45071. type: definePropType(Function)
  45072. },
  45073. onEndReached: {
  45074. type: definePropType(Function)
  45075. },
  45076. onRowExpand: tableV2RowProps.onRowExpand,
  45077. onScroll: tableV2GridProps.onScroll,
  45078. onRowsRendered: tableV2GridProps.onRowsRendered,
  45079. rowEventHandlers: tableV2RowProps.rowEventHandlers
  45080. });
  45081. const TableV2Cell = (props, {
  45082. slots
  45083. }) => {
  45084. var _a;
  45085. const {
  45086. cellData,
  45087. style
  45088. } = props;
  45089. const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || "";
  45090. return vue.createVNode("div", {
  45091. "class": props.class,
  45092. "title": displayText,
  45093. "style": style
  45094. }, [slots.default ? slots.default(props) : displayText]);
  45095. };
  45096. TableV2Cell.displayName = "ElTableV2Cell";
  45097. TableV2Cell.inheritAttrs = false;
  45098. var TableCell = TableV2Cell;
  45099. const HeaderCell = (props, {
  45100. slots
  45101. }) => {
  45102. var _a, _b;
  45103. return slots.default ? slots.default(props) : vue.createVNode("div", {
  45104. "class": props.class,
  45105. "title": (_a = props.column) == null ? void 0 : _a.title
  45106. }, [(_b = props.column) == null ? void 0 : _b.title]);
  45107. };
  45108. HeaderCell.displayName = "ElTableV2HeaderCell";
  45109. HeaderCell.inheritAttrs = false;
  45110. var HeaderCell$1 = HeaderCell;
  45111. const tableV2HeaderRowProps = buildProps({
  45112. class: String,
  45113. columns,
  45114. columnsStyles: {
  45115. type: definePropType(Object),
  45116. required: true
  45117. },
  45118. headerIndex: Number,
  45119. style: { type: definePropType(Object) }
  45120. });
  45121. const TableV2HeaderRow = vue.defineComponent({
  45122. name: "ElTableV2HeaderRow",
  45123. props: tableV2HeaderRowProps,
  45124. setup(props, {
  45125. slots
  45126. }) {
  45127. return () => {
  45128. const {
  45129. columns,
  45130. columnsStyles,
  45131. headerIndex,
  45132. style
  45133. } = props;
  45134. let Cells = columns.map((column, columnIndex) => {
  45135. return slots.cell({
  45136. columns,
  45137. column,
  45138. columnIndex,
  45139. headerIndex,
  45140. style: columnsStyles[column.key]
  45141. });
  45142. });
  45143. if (slots.header) {
  45144. Cells = slots.header({
  45145. cells: Cells.map((node) => {
  45146. if (isArray(node) && node.length === 1) {
  45147. return node[0];
  45148. }
  45149. return node;
  45150. }),
  45151. columns,
  45152. headerIndex
  45153. });
  45154. }
  45155. return vue.createVNode("div", {
  45156. "class": props.class,
  45157. "style": style
  45158. }, [Cells]);
  45159. };
  45160. }
  45161. });
  45162. var HeaderRow = TableV2HeaderRow;
  45163. const COMPONENT_NAME$7 = "ElTableV2Header";
  45164. const TableV2Header = vue.defineComponent({
  45165. name: COMPONENT_NAME$7,
  45166. props: tableV2HeaderProps,
  45167. setup(props, {
  45168. slots,
  45169. expose
  45170. }) {
  45171. const ns = useNamespace("table-v2");
  45172. const headerRef = vue.ref();
  45173. const headerStyle = vue.computed(() => enforceUnit({
  45174. width: props.width,
  45175. height: props.height
  45176. }));
  45177. const rowStyle = vue.computed(() => enforceUnit({
  45178. width: props.rowWidth,
  45179. height: props.height
  45180. }));
  45181. const headerHeights = vue.computed(() => castArray$1(vue.unref(props.headerHeight)));
  45182. const scrollToLeft = (left) => {
  45183. const headerEl = vue.unref(headerRef);
  45184. vue.nextTick(() => {
  45185. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  45186. left
  45187. });
  45188. });
  45189. };
  45190. const renderFixedRows = () => {
  45191. const fixedRowClassName = ns.e("fixed-header-row");
  45192. const {
  45193. columns,
  45194. fixedHeaderData,
  45195. rowHeight
  45196. } = props;
  45197. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  45198. var _a;
  45199. const style = enforceUnit({
  45200. height: rowHeight,
  45201. width: "100%"
  45202. });
  45203. return (_a = slots.fixed) == null ? void 0 : _a.call(slots, {
  45204. class: fixedRowClassName,
  45205. columns,
  45206. rowData: fixedRowData,
  45207. rowIndex: -(fixedRowIndex + 1),
  45208. style
  45209. });
  45210. });
  45211. };
  45212. const renderDynamicRows = () => {
  45213. const dynamicRowClassName = ns.e("dynamic-header-row");
  45214. const {
  45215. columns
  45216. } = props;
  45217. return vue.unref(headerHeights).map((rowHeight, rowIndex) => {
  45218. var _a;
  45219. const style = enforceUnit({
  45220. width: "100%",
  45221. height: rowHeight
  45222. });
  45223. return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, {
  45224. class: dynamicRowClassName,
  45225. columns,
  45226. headerIndex: rowIndex,
  45227. style
  45228. });
  45229. });
  45230. };
  45231. expose({
  45232. scrollToLeft
  45233. });
  45234. return () => {
  45235. if (props.height <= 0)
  45236. return;
  45237. return vue.createVNode("div", {
  45238. "ref": headerRef,
  45239. "class": props.class,
  45240. "style": vue.unref(headerStyle)
  45241. }, [vue.createVNode("div", {
  45242. "style": vue.unref(rowStyle),
  45243. "class": ns.e("header")
  45244. }, [renderDynamicRows(), renderFixedRows()])]);
  45245. };
  45246. }
  45247. });
  45248. var Header = TableV2Header;
  45249. const useTableRow = (props) => {
  45250. const {
  45251. isScrolling
  45252. } = vue.inject(TableV2InjectionKey);
  45253. const measured = vue.ref(false);
  45254. const rowRef = vue.ref();
  45255. const measurable = vue.computed(() => {
  45256. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  45257. });
  45258. const doMeasure = (isInit = false) => {
  45259. const $rowRef = vue.unref(rowRef);
  45260. if (!$rowRef)
  45261. return;
  45262. const {
  45263. columns,
  45264. onRowHeightChange,
  45265. rowKey,
  45266. rowIndex,
  45267. style
  45268. } = props;
  45269. const {
  45270. height
  45271. } = $rowRef.getBoundingClientRect();
  45272. measured.value = true;
  45273. vue.nextTick(() => {
  45274. if (isInit || height !== Number.parseInt(style.height)) {
  45275. const firstColumn = columns[0];
  45276. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  45277. onRowHeightChange == null ? void 0 : onRowHeightChange({
  45278. rowKey,
  45279. height,
  45280. rowIndex
  45281. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  45282. }
  45283. });
  45284. };
  45285. const eventHandlers = vue.computed(() => {
  45286. const {
  45287. rowData,
  45288. rowIndex,
  45289. rowKey,
  45290. onRowHover
  45291. } = props;
  45292. const handlers = props.rowEventHandlers || {};
  45293. const eventHandlers2 = {};
  45294. Object.entries(handlers).forEach(([eventName, handler]) => {
  45295. if (isFunction(handler)) {
  45296. eventHandlers2[eventName] = (event) => {
  45297. handler({
  45298. event,
  45299. rowData,
  45300. rowIndex,
  45301. rowKey
  45302. });
  45303. };
  45304. }
  45305. });
  45306. if (onRowHover) {
  45307. [{
  45308. name: "onMouseleave",
  45309. hovered: false
  45310. }, {
  45311. name: "onMouseenter",
  45312. hovered: true
  45313. }].forEach(({
  45314. name,
  45315. hovered
  45316. }) => {
  45317. const existedHandler = eventHandlers2[name];
  45318. eventHandlers2[name] = (event) => {
  45319. onRowHover({
  45320. event,
  45321. hovered,
  45322. rowData,
  45323. rowIndex,
  45324. rowKey
  45325. });
  45326. existedHandler == null ? void 0 : existedHandler(event);
  45327. };
  45328. });
  45329. }
  45330. return eventHandlers2;
  45331. });
  45332. const onExpand = (expanded) => {
  45333. const {
  45334. onRowExpand,
  45335. rowData,
  45336. rowIndex,
  45337. rowKey
  45338. } = props;
  45339. onRowExpand == null ? void 0 : onRowExpand({
  45340. expanded,
  45341. rowData,
  45342. rowIndex,
  45343. rowKey
  45344. });
  45345. };
  45346. vue.onMounted(() => {
  45347. if (vue.unref(measurable)) {
  45348. doMeasure(true);
  45349. }
  45350. });
  45351. return {
  45352. isScrolling,
  45353. measurable,
  45354. measured,
  45355. rowRef,
  45356. eventHandlers,
  45357. onExpand
  45358. };
  45359. };
  45360. const COMPONENT_NAME$6 = "ElTableV2TableRow";
  45361. const TableV2Row = vue.defineComponent({
  45362. name: COMPONENT_NAME$6,
  45363. props: tableV2RowProps,
  45364. setup(props, {
  45365. expose,
  45366. slots,
  45367. attrs
  45368. }) {
  45369. const {
  45370. eventHandlers,
  45371. isScrolling,
  45372. measurable,
  45373. measured,
  45374. rowRef,
  45375. onExpand
  45376. } = useTableRow(props);
  45377. expose({
  45378. onExpand
  45379. });
  45380. return () => {
  45381. const {
  45382. columns,
  45383. columnsStyles,
  45384. expandColumnKey,
  45385. depth,
  45386. rowData,
  45387. rowIndex,
  45388. style
  45389. } = props;
  45390. let ColumnCells = columns.map((column, columnIndex) => {
  45391. const expandable = isArray(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  45392. return slots.cell({
  45393. column,
  45394. columns,
  45395. columnIndex,
  45396. depth,
  45397. style: columnsStyles[column.key],
  45398. rowData,
  45399. rowIndex,
  45400. isScrolling: vue.unref(isScrolling),
  45401. expandIconProps: expandable ? {
  45402. rowData,
  45403. rowIndex,
  45404. onExpand
  45405. } : void 0
  45406. });
  45407. });
  45408. if (slots.row) {
  45409. ColumnCells = slots.row({
  45410. cells: ColumnCells.map((node) => {
  45411. if (isArray(node) && node.length === 1) {
  45412. return node[0];
  45413. }
  45414. return node;
  45415. }),
  45416. style,
  45417. columns,
  45418. depth,
  45419. rowData,
  45420. rowIndex,
  45421. isScrolling: vue.unref(isScrolling)
  45422. });
  45423. }
  45424. if (vue.unref(measurable)) {
  45425. const {
  45426. height,
  45427. ...exceptHeightStyle
  45428. } = style || {};
  45429. const _measured = vue.unref(measured);
  45430. return vue.createVNode("div", vue.mergeProps({
  45431. "ref": rowRef,
  45432. "class": props.class,
  45433. "style": _measured ? style : exceptHeightStyle
  45434. }, attrs, vue.unref(eventHandlers)), [ColumnCells]);
  45435. }
  45436. return vue.createVNode("div", vue.mergeProps(attrs, {
  45437. "ref": rowRef,
  45438. "class": props.class,
  45439. "style": style
  45440. }, vue.unref(eventHandlers)), [ColumnCells]);
  45441. };
  45442. }
  45443. });
  45444. var Row = TableV2Row;
  45445. const SortIcon = (props) => {
  45446. const {
  45447. sortOrder
  45448. } = props;
  45449. return vue.createVNode(ElIcon, {
  45450. "size": 14,
  45451. "class": props.class
  45452. }, {
  45453. default: () => [sortOrder === SortOrder.ASC ? vue.createVNode(sort_up_default, null, null) : vue.createVNode(sort_down_default, null, null)]
  45454. });
  45455. };
  45456. var SortIcon$1 = SortIcon;
  45457. const ExpandIcon = (props) => {
  45458. const {
  45459. expanded,
  45460. expandable,
  45461. onExpand,
  45462. style,
  45463. size
  45464. } = props;
  45465. const expandIconProps = {
  45466. onClick: expandable ? () => onExpand(!expanded) : void 0,
  45467. class: props.class
  45468. };
  45469. return vue.createVNode(ElIcon, vue.mergeProps(expandIconProps, {
  45470. "size": size,
  45471. "style": style
  45472. }), {
  45473. default: () => [vue.createVNode(arrow_right_default, null, null)]
  45474. });
  45475. };
  45476. var ExpandIcon$1 = ExpandIcon;
  45477. const COMPONENT_NAME$5 = "ElTableV2Grid";
  45478. const useTableGrid = (props) => {
  45479. const headerRef = vue.ref();
  45480. const bodyRef = vue.ref();
  45481. const totalHeight = vue.computed(() => {
  45482. const {
  45483. data,
  45484. rowHeight,
  45485. estimatedRowHeight
  45486. } = props;
  45487. if (estimatedRowHeight) {
  45488. return;
  45489. }
  45490. return data.length * rowHeight;
  45491. });
  45492. const fixedRowHeight = vue.computed(() => {
  45493. const {
  45494. fixedData,
  45495. rowHeight
  45496. } = props;
  45497. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  45498. });
  45499. const headerHeight = vue.computed(() => sum(props.headerHeight));
  45500. const gridHeight = vue.computed(() => {
  45501. const {
  45502. height
  45503. } = props;
  45504. return Math.max(0, height - vue.unref(headerHeight) - vue.unref(fixedRowHeight));
  45505. });
  45506. const hasHeader = vue.computed(() => {
  45507. return vue.unref(headerHeight) + vue.unref(fixedRowHeight) > 0;
  45508. });
  45509. const itemKey = ({
  45510. data,
  45511. rowIndex
  45512. }) => data[rowIndex][props.rowKey];
  45513. function onItemRendered({
  45514. rowCacheStart,
  45515. rowCacheEnd,
  45516. rowVisibleStart,
  45517. rowVisibleEnd
  45518. }) {
  45519. var _a;
  45520. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, {
  45521. rowCacheStart,
  45522. rowCacheEnd,
  45523. rowVisibleStart,
  45524. rowVisibleEnd
  45525. });
  45526. }
  45527. function resetAfterRowIndex(index, forceUpdate2) {
  45528. var _a;
  45529. (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2);
  45530. }
  45531. function scrollTo(leftOrOptions, top) {
  45532. const header$ = vue.unref(headerRef);
  45533. const body$ = vue.unref(bodyRef);
  45534. if (!header$ || !body$)
  45535. return;
  45536. if (isObject$1(leftOrOptions)) {
  45537. header$.scrollToLeft(leftOrOptions.scrollLeft);
  45538. body$.scrollTo(leftOrOptions);
  45539. } else {
  45540. header$.scrollToLeft(leftOrOptions);
  45541. body$.scrollTo({
  45542. scrollLeft: leftOrOptions,
  45543. scrollTop: top
  45544. });
  45545. }
  45546. }
  45547. function scrollToTop(scrollTop) {
  45548. var _a;
  45549. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollTo({
  45550. scrollTop
  45551. });
  45552. }
  45553. function scrollToRow(row, strategy) {
  45554. var _a;
  45555. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy);
  45556. }
  45557. function forceUpdate() {
  45558. var _a, _b;
  45559. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.$forceUpdate();
  45560. (_b = vue.unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  45561. }
  45562. return {
  45563. bodyRef,
  45564. forceUpdate,
  45565. fixedRowHeight,
  45566. gridHeight,
  45567. hasHeader,
  45568. headerHeight,
  45569. headerRef,
  45570. totalHeight,
  45571. itemKey,
  45572. onItemRendered,
  45573. resetAfterRowIndex,
  45574. scrollTo,
  45575. scrollToTop,
  45576. scrollToRow
  45577. };
  45578. };
  45579. const TableGrid = vue.defineComponent({
  45580. name: COMPONENT_NAME$5,
  45581. props: tableV2GridProps,
  45582. setup(props, {
  45583. slots,
  45584. expose
  45585. }) {
  45586. const {
  45587. ns
  45588. } = vue.inject(TableV2InjectionKey);
  45589. const {
  45590. bodyRef,
  45591. fixedRowHeight,
  45592. gridHeight,
  45593. hasHeader,
  45594. headerRef,
  45595. headerHeight,
  45596. totalHeight,
  45597. forceUpdate,
  45598. itemKey,
  45599. onItemRendered,
  45600. resetAfterRowIndex,
  45601. scrollTo,
  45602. scrollToTop,
  45603. scrollToRow
  45604. } = useTableGrid(props);
  45605. expose({
  45606. forceUpdate,
  45607. totalHeight,
  45608. scrollTo,
  45609. scrollToTop,
  45610. scrollToRow,
  45611. resetAfterRowIndex
  45612. });
  45613. const getColumnWidth = () => props.bodyWidth;
  45614. return () => {
  45615. const {
  45616. cache,
  45617. columns,
  45618. data,
  45619. fixedData,
  45620. useIsScrolling,
  45621. scrollbarAlwaysOn,
  45622. scrollbarEndGap,
  45623. scrollbarStartGap,
  45624. style,
  45625. rowHeight,
  45626. bodyWidth,
  45627. estimatedRowHeight,
  45628. headerWidth,
  45629. height,
  45630. width,
  45631. getRowHeight,
  45632. onScroll
  45633. } = props;
  45634. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  45635. const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1;
  45636. const _headerHeight = vue.unref(headerHeight);
  45637. return vue.createVNode("div", {
  45638. "role": "table",
  45639. "class": [ns.e("table"), props.class],
  45640. "style": style
  45641. }, [vue.createVNode(Grid, {
  45642. "ref": bodyRef,
  45643. "data": data,
  45644. "useIsScrolling": useIsScrolling,
  45645. "itemKey": itemKey,
  45646. "columnCache": 0,
  45647. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  45648. "totalColumn": 1,
  45649. "totalRow": data.length,
  45650. "rowCache": cache,
  45651. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  45652. "width": width,
  45653. "height": vue.unref(gridHeight),
  45654. "class": ns.e("body"),
  45655. "scrollbarStartGap": scrollbarStartGap,
  45656. "scrollbarEndGap": scrollbarEndGap,
  45657. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  45658. "onScroll": onScroll,
  45659. "onItemRendered": onItemRendered,
  45660. "perfMode": false
  45661. }, {
  45662. default: (params) => {
  45663. var _a;
  45664. const rowData = data[params.rowIndex];
  45665. return (_a = slots.row) == null ? void 0 : _a.call(slots, {
  45666. ...params,
  45667. columns,
  45668. rowData
  45669. });
  45670. }
  45671. }), vue.unref(hasHeader) && vue.createVNode(Header, {
  45672. "ref": headerRef,
  45673. "class": ns.e("header-wrapper"),
  45674. "columns": columns,
  45675. "headerData": data,
  45676. "headerHeight": props.headerHeight,
  45677. "fixedHeaderData": fixedData,
  45678. "rowWidth": headerWidth,
  45679. "rowHeight": rowHeight,
  45680. "width": width,
  45681. "height": Math.min(_headerHeight + vue.unref(fixedRowHeight), height)
  45682. }, {
  45683. dynamic: slots.header,
  45684. fixed: slots.row
  45685. })]);
  45686. };
  45687. }
  45688. });
  45689. function _isSlot$5(s) {
  45690. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  45691. }
  45692. const MainTable = (props, {
  45693. slots
  45694. }) => {
  45695. const {
  45696. mainTableRef,
  45697. ...rest
  45698. } = props;
  45699. return vue.createVNode(TableGrid, vue.mergeProps({
  45700. "ref": mainTableRef
  45701. }, rest), _isSlot$5(slots) ? slots : {
  45702. default: () => [slots]
  45703. });
  45704. };
  45705. function _isSlot$4(s) {
  45706. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  45707. }
  45708. const LeftTable$1 = (props, {
  45709. slots
  45710. }) => {
  45711. if (!props.columns.length)
  45712. return;
  45713. const {
  45714. leftTableRef,
  45715. ...rest
  45716. } = props;
  45717. return vue.createVNode(TableGrid, vue.mergeProps({
  45718. "ref": leftTableRef
  45719. }, rest), _isSlot$4(slots) ? slots : {
  45720. default: () => [slots]
  45721. });
  45722. };
  45723. function _isSlot$3(s) {
  45724. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  45725. }
  45726. const LeftTable = (props, {
  45727. slots
  45728. }) => {
  45729. if (!props.columns.length)
  45730. return;
  45731. const {
  45732. rightTableRef,
  45733. ...rest
  45734. } = props;
  45735. return vue.createVNode(TableGrid, vue.mergeProps({
  45736. "ref": rightTableRef
  45737. }, rest), _isSlot$3(slots) ? slots : {
  45738. default: () => [slots]
  45739. });
  45740. };
  45741. function _isSlot$2(s) {
  45742. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  45743. }
  45744. const RowRenderer = (props, {
  45745. slots
  45746. }) => {
  45747. const {
  45748. columns,
  45749. columnsStyles,
  45750. depthMap,
  45751. expandColumnKey,
  45752. expandedRowKeys,
  45753. estimatedRowHeight,
  45754. hasFixedColumns,
  45755. hoveringRowKey,
  45756. rowData,
  45757. rowIndex,
  45758. style,
  45759. isScrolling,
  45760. rowProps,
  45761. rowClass,
  45762. rowKey,
  45763. rowEventHandlers,
  45764. ns,
  45765. onRowHovered,
  45766. onRowExpanded
  45767. } = props;
  45768. const rowKls = tryCall(rowClass, {
  45769. columns,
  45770. rowData,
  45771. rowIndex
  45772. }, "");
  45773. const additionalProps = tryCall(rowProps, {
  45774. columns,
  45775. rowData,
  45776. rowIndex
  45777. });
  45778. const _rowKey = rowData[rowKey];
  45779. const depth = depthMap[_rowKey] || 0;
  45780. const canExpand = Boolean(expandColumnKey);
  45781. const isFixedRow = rowIndex < 0;
  45782. const kls = [ns.e("row"), rowKls, {
  45783. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,
  45784. [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey),
  45785. [ns.is("hovered")]: !isScrolling && _rowKey === hoveringRowKey,
  45786. [ns.is("fixed")]: !depth && isFixedRow,
  45787. [ns.is("customized")]: Boolean(slots.row)
  45788. }];
  45789. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  45790. const _rowProps = {
  45791. ...additionalProps,
  45792. columns,
  45793. columnsStyles,
  45794. class: kls,
  45795. depth,
  45796. expandColumnKey,
  45797. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  45798. isScrolling,
  45799. rowIndex,
  45800. rowData,
  45801. rowKey: _rowKey,
  45802. rowEventHandlers,
  45803. style
  45804. };
  45805. return vue.createVNode(Row, vue.mergeProps(_rowProps, {
  45806. "onRowHover": onRowHover,
  45807. "onRowExpand": onRowExpanded
  45808. }), _isSlot$2(slots) ? slots : {
  45809. default: () => [slots]
  45810. });
  45811. };
  45812. const CellRenderer = ({
  45813. columns,
  45814. column,
  45815. columnIndex,
  45816. depth,
  45817. expandIconProps,
  45818. isScrolling,
  45819. rowData,
  45820. rowIndex,
  45821. style,
  45822. expandedRowKeys,
  45823. ns,
  45824. cellProps: _cellProps,
  45825. expandColumnKey,
  45826. indentSize,
  45827. iconSize,
  45828. rowKey
  45829. }, {
  45830. slots
  45831. }) => {
  45832. const cellStyle = enforceUnit(style);
  45833. if (column.placeholderSign === placeholderSign) {
  45834. return vue.createVNode("div", {
  45835. "class": ns.em("row-cell", "placeholder"),
  45836. "style": cellStyle
  45837. }, null);
  45838. }
  45839. const {
  45840. cellRenderer,
  45841. dataKey,
  45842. dataGetter
  45843. } = column;
  45844. const columnCellRenderer = componentToSlot(cellRenderer);
  45845. const CellComponent = columnCellRenderer || slots.default || ((props) => vue.createVNode(TableCell, props, null));
  45846. const cellData = isFunction(dataGetter) ? dataGetter({
  45847. columns,
  45848. column,
  45849. columnIndex,
  45850. rowData,
  45851. rowIndex
  45852. }) : get(rowData, dataKey != null ? dataKey : "");
  45853. const extraCellProps = tryCall(_cellProps, {
  45854. cellData,
  45855. columns,
  45856. column,
  45857. columnIndex,
  45858. rowIndex,
  45859. rowData
  45860. });
  45861. const cellProps = {
  45862. class: ns.e("cell-text"),
  45863. columns,
  45864. column,
  45865. columnIndex,
  45866. cellData,
  45867. isScrolling,
  45868. rowData,
  45869. rowIndex
  45870. };
  45871. const Cell = CellComponent(cellProps);
  45872. const kls = [ns.e("row-cell"), column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  45873. const expandable = rowIndex >= 0 && column.key === expandColumnKey;
  45874. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  45875. let IconOrPlaceholder;
  45876. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  45877. if (expandable) {
  45878. if (isObject$1(expandIconProps)) {
  45879. IconOrPlaceholder = vue.createVNode(ExpandIcon$1, vue.mergeProps(expandIconProps, {
  45880. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  45881. "size": iconSize,
  45882. "expanded": expanded,
  45883. "style": iconStyle,
  45884. "expandable": true
  45885. }), null);
  45886. } else {
  45887. IconOrPlaceholder = vue.createVNode("div", {
  45888. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  45889. }, null);
  45890. }
  45891. }
  45892. return vue.createVNode("div", vue.mergeProps({
  45893. "class": kls,
  45894. "style": cellStyle
  45895. }, extraCellProps), [IconOrPlaceholder, Cell]);
  45896. };
  45897. CellRenderer.inheritAttrs = false;
  45898. function _isSlot$1(s) {
  45899. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  45900. }
  45901. const HeaderRenderer = ({
  45902. columns,
  45903. columnsStyles,
  45904. headerIndex,
  45905. style,
  45906. headerClass,
  45907. headerProps,
  45908. ns
  45909. }, {
  45910. slots
  45911. }) => {
  45912. const param = {
  45913. columns,
  45914. headerIndex
  45915. };
  45916. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), {
  45917. [ns.is("customized")]: Boolean(slots.header)
  45918. }];
  45919. const extraProps = {
  45920. ...tryCall(headerProps, param),
  45921. columnsStyles,
  45922. class: kls,
  45923. columns,
  45924. headerIndex,
  45925. style
  45926. };
  45927. return vue.createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  45928. default: () => [slots]
  45929. });
  45930. };
  45931. const HeaderCellRenderer = (props, {
  45932. slots
  45933. }) => {
  45934. const {
  45935. column,
  45936. ns,
  45937. style,
  45938. onColumnSorted
  45939. } = props;
  45940. const cellStyle = enforceUnit(style);
  45941. if (column.placeholderSign === placeholderSign) {
  45942. return vue.createVNode("div", {
  45943. "class": ns.em("header-row-cell", "placeholder"),
  45944. "style": cellStyle
  45945. }, null);
  45946. }
  45947. const {
  45948. headerCellRenderer,
  45949. headerClass,
  45950. sortable
  45951. } = column;
  45952. const cellProps = {
  45953. ...props,
  45954. class: ns.e("header-cell-text")
  45955. };
  45956. const cellRenderer = componentToSlot(headerCellRenderer) || slots.default || ((props2) => vue.createVNode(HeaderCell$1, props2, null));
  45957. const Cell = cellRenderer(cellProps);
  45958. const {
  45959. sortBy,
  45960. sortState,
  45961. headerCellProps
  45962. } = props;
  45963. let sorting, sortOrder;
  45964. if (sortState) {
  45965. const order = sortState[column.key];
  45966. sorting = Boolean(oppositeOrderMap[order]);
  45967. sortOrder = sorting ? order : SortOrder.ASC;
  45968. } else {
  45969. sorting = column.key === sortBy.key;
  45970. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  45971. }
  45972. 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")];
  45973. const cellWrapperProps = {
  45974. ...tryCall(headerCellProps, props),
  45975. onClick: column.sortable ? onColumnSorted : void 0,
  45976. class: cellKls,
  45977. style: cellStyle,
  45978. ["data-key"]: column.key
  45979. };
  45980. return vue.createVNode("div", cellWrapperProps, [Cell, sortable && vue.createVNode(SortIcon$1, {
  45981. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  45982. "sortOrder": sortOrder
  45983. }, null)]);
  45984. };
  45985. const Footer$1 = (props, {
  45986. slots
  45987. }) => {
  45988. var _a;
  45989. return vue.createVNode("div", {
  45990. "class": props.class,
  45991. "style": props.style
  45992. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  45993. };
  45994. Footer$1.displayName = "ElTableV2Footer";
  45995. const Footer = (props, {
  45996. slots
  45997. }) => {
  45998. return vue.createVNode("div", {
  45999. "class": props.class,
  46000. "style": props.style
  46001. }, [slots.default ? slots.default() : vue.createVNode(ElEmpty, null, null)]);
  46002. };
  46003. Footer.displayName = "ElTableV2Empty";
  46004. const Overlay = (props, {
  46005. slots
  46006. }) => {
  46007. var _a;
  46008. return vue.createVNode("div", {
  46009. "class": props.class,
  46010. "style": props.style
  46011. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  46012. };
  46013. Overlay.displayName = "ElTableV2Overlay";
  46014. function _isSlot(s) {
  46015. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  46016. }
  46017. const COMPONENT_NAME$4 = "ElTableV2";
  46018. const TableV2 = vue.defineComponent({
  46019. name: COMPONENT_NAME$4,
  46020. props: tableV2Props,
  46021. setup(props, {
  46022. slots,
  46023. expose
  46024. }) {
  46025. const ns = useNamespace("table-v2");
  46026. const {
  46027. columnsStyles,
  46028. fixedColumnsOnLeft,
  46029. fixedColumnsOnRight,
  46030. mainColumns,
  46031. mainTableHeight,
  46032. fixedTableHeight,
  46033. leftTableWidth,
  46034. rightTableWidth,
  46035. data,
  46036. depthMap,
  46037. expandedRowKeys,
  46038. hasFixedColumns,
  46039. hoveringRowKey,
  46040. mainTableRef,
  46041. leftTableRef,
  46042. rightTableRef,
  46043. isDynamic,
  46044. isResetting,
  46045. isScrolling,
  46046. bodyWidth,
  46047. emptyStyle,
  46048. rootStyle,
  46049. headerWidth,
  46050. footerHeight,
  46051. showEmpty,
  46052. scrollTo,
  46053. scrollToLeft,
  46054. scrollToTop,
  46055. scrollToRow,
  46056. getRowHeight,
  46057. onColumnSorted,
  46058. onRowHeightChange,
  46059. onRowHovered,
  46060. onRowExpanded,
  46061. onRowsRendered,
  46062. onScroll,
  46063. onVerticalScroll
  46064. } = useTable(props);
  46065. expose({
  46066. scrollTo,
  46067. scrollToLeft,
  46068. scrollToTop,
  46069. scrollToRow
  46070. });
  46071. vue.provide(TableV2InjectionKey, {
  46072. ns,
  46073. isResetting,
  46074. hoveringRowKey,
  46075. isScrolling
  46076. });
  46077. return () => {
  46078. const {
  46079. cache,
  46080. cellProps,
  46081. estimatedRowHeight,
  46082. expandColumnKey,
  46083. fixedData,
  46084. headerHeight,
  46085. headerClass,
  46086. headerProps,
  46087. headerCellProps,
  46088. sortBy,
  46089. sortState,
  46090. rowHeight,
  46091. rowClass,
  46092. rowEventHandlers,
  46093. rowKey,
  46094. rowProps,
  46095. scrollbarAlwaysOn,
  46096. indentSize,
  46097. iconSize,
  46098. useIsScrolling,
  46099. vScrollbarSize,
  46100. width
  46101. } = props;
  46102. const _data = vue.unref(data);
  46103. const mainTableProps = {
  46104. cache,
  46105. class: ns.e("main"),
  46106. columns: vue.unref(mainColumns),
  46107. data: _data,
  46108. fixedData,
  46109. estimatedRowHeight,
  46110. bodyWidth: vue.unref(bodyWidth),
  46111. headerHeight,
  46112. headerWidth: vue.unref(headerWidth),
  46113. height: vue.unref(mainTableHeight),
  46114. mainTableRef,
  46115. rowKey,
  46116. rowHeight,
  46117. scrollbarAlwaysOn,
  46118. scrollbarStartGap: 2,
  46119. scrollbarEndGap: vScrollbarSize,
  46120. useIsScrolling,
  46121. width,
  46122. getRowHeight,
  46123. onRowsRendered,
  46124. onScroll
  46125. };
  46126. const leftColumnsWidth = vue.unref(leftTableWidth);
  46127. const _fixedTableHeight = vue.unref(fixedTableHeight);
  46128. const leftTableProps = {
  46129. cache,
  46130. class: ns.e("left"),
  46131. columns: vue.unref(fixedColumnsOnLeft),
  46132. data: _data,
  46133. estimatedRowHeight,
  46134. leftTableRef,
  46135. rowHeight,
  46136. bodyWidth: leftColumnsWidth,
  46137. headerWidth: leftColumnsWidth,
  46138. headerHeight,
  46139. height: _fixedTableHeight,
  46140. rowKey,
  46141. scrollbarAlwaysOn,
  46142. scrollbarStartGap: 2,
  46143. scrollbarEndGap: vScrollbarSize,
  46144. useIsScrolling,
  46145. width: leftColumnsWidth,
  46146. getRowHeight,
  46147. onScroll: onVerticalScroll
  46148. };
  46149. const rightColumnsWidth = vue.unref(rightTableWidth);
  46150. const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize;
  46151. const rightTableProps = {
  46152. cache,
  46153. class: ns.e("right"),
  46154. columns: vue.unref(fixedColumnsOnRight),
  46155. data: _data,
  46156. estimatedRowHeight,
  46157. rightTableRef,
  46158. rowHeight,
  46159. bodyWidth: rightColumnsWidthWithScrollbar,
  46160. headerWidth: rightColumnsWidthWithScrollbar,
  46161. headerHeight,
  46162. height: _fixedTableHeight,
  46163. rowKey,
  46164. scrollbarAlwaysOn,
  46165. scrollbarStartGap: 2,
  46166. scrollbarEndGap: vScrollbarSize,
  46167. width: rightColumnsWidthWithScrollbar,
  46168. style: `--${vue.unref(ns.namespace)}-table-scrollbar-size: ${vScrollbarSize}px`,
  46169. useIsScrolling,
  46170. getRowHeight,
  46171. onScroll: onVerticalScroll
  46172. };
  46173. const _columnsStyles = vue.unref(columnsStyles);
  46174. const tableRowProps = {
  46175. ns,
  46176. depthMap: vue.unref(depthMap),
  46177. columnsStyles: _columnsStyles,
  46178. expandColumnKey,
  46179. expandedRowKeys: vue.unref(expandedRowKeys),
  46180. estimatedRowHeight,
  46181. hasFixedColumns: vue.unref(hasFixedColumns),
  46182. hoveringRowKey: vue.unref(hoveringRowKey),
  46183. rowProps,
  46184. rowClass,
  46185. rowKey,
  46186. rowEventHandlers,
  46187. onRowHovered,
  46188. onRowExpanded,
  46189. onRowHeightChange
  46190. };
  46191. const tableCellProps = {
  46192. cellProps,
  46193. expandColumnKey,
  46194. indentSize,
  46195. iconSize,
  46196. rowKey,
  46197. expandedRowKeys: vue.unref(expandedRowKeys),
  46198. ns
  46199. };
  46200. const tableHeaderProps = {
  46201. ns,
  46202. headerClass,
  46203. headerProps,
  46204. columnsStyles: _columnsStyles
  46205. };
  46206. const tableHeaderCellProps = {
  46207. ns,
  46208. sortBy,
  46209. sortState,
  46210. headerCellProps,
  46211. onColumnSorted
  46212. };
  46213. const tableSlots = {
  46214. row: (props2) => vue.createVNode(RowRenderer, vue.mergeProps(props2, tableRowProps), {
  46215. row: slots.row,
  46216. cell: (props3) => {
  46217. let _slot;
  46218. return slots.cell ? vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  46219. "style": _columnsStyles[props3.column.key]
  46220. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  46221. default: () => [_slot]
  46222. }) : vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  46223. "style": _columnsStyles[props3.column.key]
  46224. }), null);
  46225. }
  46226. }),
  46227. header: (props2) => vue.createVNode(HeaderRenderer, vue.mergeProps(props2, tableHeaderProps), {
  46228. header: slots.header,
  46229. cell: (props3) => {
  46230. let _slot2;
  46231. return slots["header-cell"] ? vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  46232. "style": _columnsStyles[props3.column.key]
  46233. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  46234. default: () => [_slot2]
  46235. }) : vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  46236. "style": _columnsStyles[props3.column.key]
  46237. }), null);
  46238. }
  46239. })
  46240. };
  46241. const rootKls = [props.class, ns.b(), ns.e("root"), {
  46242. [ns.is("dynamic")]: vue.unref(isDynamic)
  46243. }];
  46244. const footerProps = {
  46245. class: ns.e("footer"),
  46246. style: vue.unref(footerHeight)
  46247. };
  46248. return vue.createVNode("div", {
  46249. "class": rootKls,
  46250. "style": vue.unref(rootStyle)
  46251. }, [vue.createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  46252. default: () => [tableSlots]
  46253. }), vue.createVNode(LeftTable$1, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  46254. default: () => [tableSlots]
  46255. }), vue.createVNode(LeftTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  46256. default: () => [tableSlots]
  46257. }), slots.footer && vue.createVNode(Footer$1, footerProps, {
  46258. default: slots.footer
  46259. }), vue.unref(showEmpty) && vue.createVNode(Footer, {
  46260. "class": ns.e("empty"),
  46261. "style": vue.unref(emptyStyle)
  46262. }, {
  46263. default: slots.empty
  46264. }), slots.overlay && vue.createVNode(Overlay, {
  46265. "class": ns.e("overlay")
  46266. }, {
  46267. default: slots.overlay
  46268. })]);
  46269. };
  46270. }
  46271. });
  46272. var TableV2$1 = TableV2;
  46273. const autoResizerProps = buildProps({
  46274. disableWidth: Boolean,
  46275. disableHeight: Boolean,
  46276. onResize: {
  46277. type: definePropType(Function)
  46278. }
  46279. });
  46280. const AutoResizer = vue.defineComponent({
  46281. name: "ElAutoResizer",
  46282. props: autoResizerProps,
  46283. setup(props, {
  46284. slots
  46285. }) {
  46286. const ns = useNamespace("auto-resizer");
  46287. const {
  46288. height,
  46289. width,
  46290. sizer
  46291. } = useAutoResize(props);
  46292. const style = {
  46293. width: "100%",
  46294. height: "100%"
  46295. };
  46296. return () => {
  46297. var _a;
  46298. return vue.createVNode("div", {
  46299. "ref": sizer,
  46300. "class": ns.b(),
  46301. "style": style
  46302. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  46303. height: height.value,
  46304. width: width.value
  46305. })]);
  46306. };
  46307. }
  46308. });
  46309. const ElTableV2 = withInstall(TableV2$1);
  46310. const ElAutoResizer = withInstall(AutoResizer);
  46311. const tabBarProps = buildProps({
  46312. tabs: {
  46313. type: definePropType(Array),
  46314. default: () => mutable([])
  46315. }
  46316. });
  46317. const COMPONENT_NAME$3 = "ElTabBar";
  46318. const __default__$j = vue.defineComponent({
  46319. name: COMPONENT_NAME$3
  46320. });
  46321. const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
  46322. ...__default__$j,
  46323. props: tabBarProps,
  46324. setup(__props, { expose }) {
  46325. const props = __props;
  46326. const instance = vue.getCurrentInstance();
  46327. const rootTabs = vue.inject(tabsRootContextKey);
  46328. if (!rootTabs)
  46329. throwError(COMPONENT_NAME$3, "<el-tabs><el-tab-bar /></el-tabs>");
  46330. const ns = useNamespace("tabs");
  46331. const barRef = vue.ref();
  46332. const barStyle = vue.ref();
  46333. const getBarStyle = () => {
  46334. let offset = 0;
  46335. let tabSize = 0;
  46336. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  46337. const sizeDir = sizeName === "width" ? "x" : "y";
  46338. props.tabs.every((tab) => {
  46339. var _a, _b, _c, _d;
  46340. const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
  46341. if (!$el)
  46342. return false;
  46343. if (!tab.active) {
  46344. return true;
  46345. }
  46346. tabSize = $el[`client${capitalize(sizeName)}`];
  46347. const position = sizeDir === "x" ? "left" : "top";
  46348. offset = $el[`offset${capitalize(position)}`] - ((_d = (_c = $el.parentElement) == null ? void 0 : _c[`offset${capitalize(position)}`]) != null ? _d : 0);
  46349. const scrollwrapEl = $el.closest(".is-scrollable");
  46350. if (scrollwrapEl) {
  46351. const scrollWrapStyle = window.getComputedStyle(scrollwrapEl);
  46352. offset += Number.parseFloat(scrollWrapStyle[`padding${capitalize(position)}`]);
  46353. }
  46354. const tabStyles = window.getComputedStyle($el);
  46355. if (sizeName === "width") {
  46356. if (props.tabs.length > 1) {
  46357. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  46358. }
  46359. offset += Number.parseFloat(tabStyles.paddingLeft);
  46360. }
  46361. return false;
  46362. });
  46363. return {
  46364. [sizeName]: `${tabSize}px`,
  46365. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  46366. };
  46367. };
  46368. const update = () => barStyle.value = getBarStyle();
  46369. vue.watch(() => props.tabs, async () => {
  46370. await vue.nextTick();
  46371. update();
  46372. }, { immediate: true });
  46373. useResizeObserver(barRef, () => update());
  46374. expose({
  46375. ref: barRef,
  46376. update
  46377. });
  46378. return (_ctx, _cache) => {
  46379. return vue.openBlock(), vue.createElementBlock("div", {
  46380. ref_key: "barRef",
  46381. ref: barRef,
  46382. class: vue.normalizeClass([vue.unref(ns).e("active-bar"), vue.unref(ns).is(vue.unref(rootTabs).props.tabPosition)]),
  46383. style: vue.normalizeStyle(barStyle.value)
  46384. }, null, 6);
  46385. };
  46386. }
  46387. });
  46388. var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__file", "tab-bar.vue"]]);
  46389. const tabNavProps = buildProps({
  46390. panes: {
  46391. type: definePropType(Array),
  46392. default: () => mutable([])
  46393. },
  46394. currentName: {
  46395. type: [String, Number],
  46396. default: ""
  46397. },
  46398. editable: Boolean,
  46399. type: {
  46400. type: String,
  46401. values: ["card", "border-card", ""],
  46402. default: ""
  46403. },
  46404. stretch: Boolean
  46405. });
  46406. const tabNavEmits = {
  46407. tabClick: (tab, tabName, ev) => ev instanceof Event,
  46408. tabRemove: (tab, ev) => ev instanceof Event
  46409. };
  46410. const COMPONENT_NAME$2 = "ElTabNav";
  46411. const TabNav = vue.defineComponent({
  46412. name: COMPONENT_NAME$2,
  46413. props: tabNavProps,
  46414. emits: tabNavEmits,
  46415. setup(props, {
  46416. expose,
  46417. emit
  46418. }) {
  46419. const vm = vue.getCurrentInstance();
  46420. const rootTabs = vue.inject(tabsRootContextKey);
  46421. if (!rootTabs)
  46422. throwError(COMPONENT_NAME$2, `<el-tabs><tab-nav /></el-tabs>`);
  46423. const ns = useNamespace("tabs");
  46424. const visibility = useDocumentVisibility();
  46425. const focused = useWindowFocus();
  46426. const navScroll$ = vue.ref();
  46427. const nav$ = vue.ref();
  46428. const el$ = vue.ref();
  46429. const scrollable = vue.ref(false);
  46430. const navOffset = vue.ref(0);
  46431. const isFocus = vue.ref(false);
  46432. const focusable = vue.ref(true);
  46433. const sizeName = vue.computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height");
  46434. const navStyle = vue.computed(() => {
  46435. const dir = sizeName.value === "width" ? "X" : "Y";
  46436. return {
  46437. transform: `translate${dir}(-${navOffset.value}px)`
  46438. };
  46439. });
  46440. const scrollPrev = () => {
  46441. if (!navScroll$.value)
  46442. return;
  46443. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  46444. const currentOffset = navOffset.value;
  46445. if (!currentOffset)
  46446. return;
  46447. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  46448. navOffset.value = newOffset;
  46449. };
  46450. const scrollNext = () => {
  46451. if (!navScroll$.value || !nav$.value)
  46452. return;
  46453. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  46454. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  46455. const currentOffset = navOffset.value;
  46456. if (navSize - currentOffset <= containerSize)
  46457. return;
  46458. const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  46459. navOffset.value = newOffset;
  46460. };
  46461. const scrollToActiveTab = async () => {
  46462. const nav = nav$.value;
  46463. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  46464. return;
  46465. await vue.nextTick();
  46466. const activeTab = el$.value.querySelector(".is-active");
  46467. if (!activeTab)
  46468. return;
  46469. const navScroll = navScroll$.value;
  46470. const isHorizontal = ["top", "bottom"].includes(rootTabs.props.tabPosition);
  46471. const activeTabBounding = activeTab.getBoundingClientRect();
  46472. const navScrollBounding = navScroll.getBoundingClientRect();
  46473. const maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  46474. const currentOffset = navOffset.value;
  46475. let newOffset = currentOffset;
  46476. if (isHorizontal) {
  46477. if (activeTabBounding.left < navScrollBounding.left) {
  46478. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  46479. }
  46480. if (activeTabBounding.right > navScrollBounding.right) {
  46481. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  46482. }
  46483. } else {
  46484. if (activeTabBounding.top < navScrollBounding.top) {
  46485. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  46486. }
  46487. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  46488. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  46489. }
  46490. }
  46491. newOffset = Math.max(newOffset, 0);
  46492. navOffset.value = Math.min(newOffset, maxOffset);
  46493. };
  46494. const update = () => {
  46495. if (!nav$.value || !navScroll$.value)
  46496. return;
  46497. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  46498. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  46499. const currentOffset = navOffset.value;
  46500. if (containerSize < navSize) {
  46501. const currentOffset2 = navOffset.value;
  46502. scrollable.value = scrollable.value || {};
  46503. scrollable.value.prev = currentOffset2;
  46504. scrollable.value.next = currentOffset2 + containerSize < navSize;
  46505. if (navSize - currentOffset2 < containerSize) {
  46506. navOffset.value = navSize - containerSize;
  46507. }
  46508. } else {
  46509. scrollable.value = false;
  46510. if (currentOffset > 0) {
  46511. navOffset.value = 0;
  46512. }
  46513. }
  46514. };
  46515. const changeTab = (e) => {
  46516. const code = e.code;
  46517. const {
  46518. up,
  46519. down,
  46520. left,
  46521. right
  46522. } = EVENT_CODE;
  46523. if (![up, down, left, right].includes(code))
  46524. return;
  46525. const tabList = Array.from(e.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  46526. const currentIndex = tabList.indexOf(e.target);
  46527. let nextIndex;
  46528. if (code === left || code === up) {
  46529. if (currentIndex === 0) {
  46530. nextIndex = tabList.length - 1;
  46531. } else {
  46532. nextIndex = currentIndex - 1;
  46533. }
  46534. } else {
  46535. if (currentIndex < tabList.length - 1) {
  46536. nextIndex = currentIndex + 1;
  46537. } else {
  46538. nextIndex = 0;
  46539. }
  46540. }
  46541. tabList[nextIndex].focus({
  46542. preventScroll: true
  46543. });
  46544. tabList[nextIndex].click();
  46545. setFocus();
  46546. };
  46547. const setFocus = () => {
  46548. if (focusable.value)
  46549. isFocus.value = true;
  46550. };
  46551. const removeFocus = () => isFocus.value = false;
  46552. vue.watch(visibility, (visibility2) => {
  46553. if (visibility2 === "hidden") {
  46554. focusable.value = false;
  46555. } else if (visibility2 === "visible") {
  46556. setTimeout(() => focusable.value = true, 50);
  46557. }
  46558. });
  46559. vue.watch(focused, (focused2) => {
  46560. if (focused2) {
  46561. setTimeout(() => focusable.value = true, 50);
  46562. } else {
  46563. focusable.value = false;
  46564. }
  46565. });
  46566. useResizeObserver(el$, update);
  46567. vue.onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  46568. vue.onUpdated(() => update());
  46569. expose({
  46570. scrollToActiveTab,
  46571. removeFocus
  46572. });
  46573. vue.watch(() => props.panes, () => vm.update(), {
  46574. flush: "post"
  46575. });
  46576. return () => {
  46577. const scrollBtn = scrollable.value ? [vue.createVNode("span", {
  46578. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  46579. "onClick": scrollPrev
  46580. }, [vue.createVNode(ElIcon, null, {
  46581. default: () => [vue.createVNode(arrow_left_default, null, null)]
  46582. })]), vue.createVNode("span", {
  46583. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  46584. "onClick": scrollNext
  46585. }, [vue.createVNode(ElIcon, null, {
  46586. default: () => [vue.createVNode(arrow_right_default, null, null)]
  46587. })])] : null;
  46588. const tabs = props.panes.map((pane, index) => {
  46589. var _a, _b, _c, _d;
  46590. const uid = pane.uid;
  46591. const disabled = pane.props.disabled;
  46592. const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`;
  46593. const closable = !disabled && (pane.isClosable || props.editable);
  46594. pane.index = `${index}`;
  46595. const btnClose = closable ? vue.createVNode(ElIcon, {
  46596. "class": "is-icon-close",
  46597. "onClick": (ev) => emit("tabRemove", pane, ev)
  46598. }, {
  46599. default: () => [vue.createVNode(close_default, null, null)]
  46600. }) : null;
  46601. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  46602. const tabindex = !disabled && pane.active ? 0 : -1;
  46603. return vue.createVNode("div", {
  46604. "ref": `tab-${uid}`,
  46605. "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)],
  46606. "id": `tab-${tabName}`,
  46607. "key": `tab-${uid}`,
  46608. "aria-controls": `pane-${tabName}`,
  46609. "role": "tab",
  46610. "aria-selected": pane.active,
  46611. "tabindex": tabindex,
  46612. "onFocus": () => setFocus(),
  46613. "onBlur": () => removeFocus(),
  46614. "onClick": (ev) => {
  46615. removeFocus();
  46616. emit("tabClick", pane, tabName, ev);
  46617. },
  46618. "onKeydown": (ev) => {
  46619. if (closable && (ev.code === EVENT_CODE.delete || ev.code === EVENT_CODE.backspace)) {
  46620. emit("tabRemove", pane, ev);
  46621. }
  46622. }
  46623. }, [...[tabLabelContent, btnClose]]);
  46624. });
  46625. return vue.createVNode("div", {
  46626. "ref": el$,
  46627. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  46628. }, [scrollBtn, vue.createVNode("div", {
  46629. "class": ns.e("nav-scroll"),
  46630. "ref": navScroll$
  46631. }, [vue.createVNode("div", {
  46632. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  46633. "ref": nav$,
  46634. "style": navStyle.value,
  46635. "role": "tablist",
  46636. "onKeydown": changeTab
  46637. }, [...[!props.type ? vue.createVNode(TabBar, {
  46638. "tabs": [...props.panes]
  46639. }, null) : null, tabs]])])]);
  46640. };
  46641. }
  46642. });
  46643. const tabsProps = buildProps({
  46644. type: {
  46645. type: String,
  46646. values: ["card", "border-card", ""],
  46647. default: ""
  46648. },
  46649. activeName: {
  46650. type: [String, Number]
  46651. },
  46652. closable: Boolean,
  46653. addable: Boolean,
  46654. modelValue: {
  46655. type: [String, Number]
  46656. },
  46657. editable: Boolean,
  46658. tabPosition: {
  46659. type: String,
  46660. values: ["top", "right", "bottom", "left"],
  46661. default: "top"
  46662. },
  46663. beforeLeave: {
  46664. type: definePropType(Function),
  46665. default: () => true
  46666. },
  46667. stretch: Boolean
  46668. });
  46669. const isPaneName = (value) => isString(value) || isNumber(value);
  46670. const tabsEmits = {
  46671. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  46672. tabClick: (pane, ev) => ev instanceof Event,
  46673. tabChange: (name) => isPaneName(name),
  46674. edit: (paneName, action) => ["remove", "add"].includes(action),
  46675. tabRemove: (name) => isPaneName(name),
  46676. tabAdd: () => true
  46677. };
  46678. var Tabs = vue.defineComponent({
  46679. name: "ElTabs",
  46680. props: tabsProps,
  46681. emits: tabsEmits,
  46682. setup(props, {
  46683. emit,
  46684. slots,
  46685. expose
  46686. }) {
  46687. var _a, _b;
  46688. const ns = useNamespace("tabs");
  46689. const {
  46690. children: panes,
  46691. addChild: registerPane,
  46692. removeChild: unregisterPane
  46693. } = useOrderedChildren(vue.getCurrentInstance(), "ElTabPane");
  46694. const nav$ = vue.ref();
  46695. const currentName = vue.ref((_b = (_a = props.modelValue) != null ? _a : props.activeName) != null ? _b : "0");
  46696. const changeCurrentName = (value) => {
  46697. currentName.value = value;
  46698. emit(UPDATE_MODEL_EVENT, value);
  46699. emit("tabChange", value);
  46700. };
  46701. const setCurrentName = async (value) => {
  46702. var _a2, _b2, _c;
  46703. if (currentName.value === value || isUndefined(value))
  46704. return;
  46705. try {
  46706. const canLeave = await ((_a2 = props.beforeLeave) == null ? void 0 : _a2.call(props, value, currentName.value));
  46707. if (canLeave !== false) {
  46708. changeCurrentName(value);
  46709. (_c = (_b2 = nav$.value) == null ? void 0 : _b2.removeFocus) == null ? void 0 : _c.call(_b2);
  46710. }
  46711. } catch (e) {
  46712. }
  46713. };
  46714. const handleTabClick = (tab, tabName, event) => {
  46715. if (tab.props.disabled)
  46716. return;
  46717. setCurrentName(tabName);
  46718. emit("tabClick", tab, event);
  46719. };
  46720. const handleTabRemove = (pane, ev) => {
  46721. if (pane.props.disabled || isUndefined(pane.props.name))
  46722. return;
  46723. ev.stopPropagation();
  46724. emit("edit", pane.props.name, "remove");
  46725. emit("tabRemove", pane.props.name);
  46726. };
  46727. const handleTabAdd = () => {
  46728. emit("edit", void 0, "add");
  46729. emit("tabAdd");
  46730. };
  46731. useDeprecated({
  46732. from: '"activeName"',
  46733. replacement: '"model-value" or "v-model"',
  46734. scope: "ElTabs",
  46735. version: "2.3.0",
  46736. ref: "https://element-plus.org/en-US/component/tabs.html#attributes",
  46737. type: "Attribute"
  46738. }, vue.computed(() => !!props.activeName));
  46739. vue.watch(() => props.activeName, (modelValue) => setCurrentName(modelValue));
  46740. vue.watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  46741. vue.watch(currentName, async () => {
  46742. var _a2;
  46743. await vue.nextTick();
  46744. (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab();
  46745. });
  46746. vue.provide(tabsRootContextKey, {
  46747. props,
  46748. currentName,
  46749. registerPane,
  46750. unregisterPane
  46751. });
  46752. expose({
  46753. currentName
  46754. });
  46755. return () => {
  46756. const newButton = props.editable || props.addable ? vue.createVNode("span", {
  46757. "class": ns.e("new-tab"),
  46758. "tabindex": "0",
  46759. "onClick": handleTabAdd,
  46760. "onKeydown": (ev) => {
  46761. if (ev.code === EVENT_CODE.enter)
  46762. handleTabAdd();
  46763. }
  46764. }, [vue.createVNode(ElIcon, {
  46765. "class": ns.is("icon-plus")
  46766. }, {
  46767. default: () => [vue.createVNode(plus_default, null, null)]
  46768. })]) : null;
  46769. const header = vue.createVNode("div", {
  46770. "class": [ns.e("header"), ns.is(props.tabPosition)]
  46771. }, [newButton, vue.createVNode(TabNav, {
  46772. "ref": nav$,
  46773. "currentName": currentName.value,
  46774. "editable": props.editable,
  46775. "type": props.type,
  46776. "panes": panes.value,
  46777. "stretch": props.stretch,
  46778. "onTabClick": handleTabClick,
  46779. "onTabRemove": handleTabRemove
  46780. }, null)]);
  46781. const panels = vue.createVNode("div", {
  46782. "class": ns.e("content")
  46783. }, [vue.renderSlot(slots, "default")]);
  46784. return vue.createVNode("div", {
  46785. "class": [ns.b(), ns.m(props.tabPosition), {
  46786. [ns.m("card")]: props.type === "card",
  46787. [ns.m("border-card")]: props.type === "border-card"
  46788. }]
  46789. }, [...props.tabPosition !== "bottom" ? [header, panels] : [panels, header]]);
  46790. };
  46791. }
  46792. });
  46793. const tabPaneProps = buildProps({
  46794. label: {
  46795. type: String,
  46796. default: ""
  46797. },
  46798. name: {
  46799. type: [String, Number]
  46800. },
  46801. closable: Boolean,
  46802. disabled: Boolean,
  46803. lazy: Boolean
  46804. });
  46805. const _hoisted_1$a = ["id", "aria-hidden", "aria-labelledby"];
  46806. const COMPONENT_NAME$1 = "ElTabPane";
  46807. const __default__$i = vue.defineComponent({
  46808. name: COMPONENT_NAME$1
  46809. });
  46810. const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
  46811. ...__default__$i,
  46812. props: tabPaneProps,
  46813. setup(__props) {
  46814. const props = __props;
  46815. const instance = vue.getCurrentInstance();
  46816. const slots = vue.useSlots();
  46817. const tabsRoot = vue.inject(tabsRootContextKey);
  46818. if (!tabsRoot)
  46819. throwError(COMPONENT_NAME$1, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  46820. const ns = useNamespace("tab-pane");
  46821. const index = vue.ref();
  46822. const isClosable = vue.computed(() => props.closable || tabsRoot.props.closable);
  46823. const active = computedEager(() => {
  46824. var _a;
  46825. return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
  46826. });
  46827. const loaded = vue.ref(active.value);
  46828. const paneName = vue.computed(() => {
  46829. var _a;
  46830. return (_a = props.name) != null ? _a : index.value;
  46831. });
  46832. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  46833. vue.watch(active, (val) => {
  46834. if (val)
  46835. loaded.value = true;
  46836. });
  46837. const pane = vue.reactive({
  46838. uid: instance.uid,
  46839. slots,
  46840. props,
  46841. paneName,
  46842. active,
  46843. index,
  46844. isClosable
  46845. });
  46846. vue.onMounted(() => {
  46847. tabsRoot.registerPane(pane);
  46848. });
  46849. vue.onUnmounted(() => {
  46850. tabsRoot.unregisterPane(pane.uid);
  46851. });
  46852. return (_ctx, _cache) => {
  46853. return vue.unref(shouldBeRender) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  46854. key: 0,
  46855. id: `pane-${vue.unref(paneName)}`,
  46856. class: vue.normalizeClass(vue.unref(ns).b()),
  46857. role: "tabpanel",
  46858. "aria-hidden": !vue.unref(active),
  46859. "aria-labelledby": `tab-${vue.unref(paneName)}`
  46860. }, [
  46861. vue.renderSlot(_ctx.$slots, "default")
  46862. ], 10, _hoisted_1$a)), [
  46863. [vue.vShow, vue.unref(active)]
  46864. ]) : vue.createCommentVNode("v-if", true);
  46865. };
  46866. }
  46867. });
  46868. var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__file", "tab-pane.vue"]]);
  46869. const ElTabs = withInstall(Tabs, {
  46870. TabPane
  46871. });
  46872. const ElTabPane = withNoopInstall(TabPane);
  46873. const timeSelectProps = buildProps({
  46874. format: {
  46875. type: String,
  46876. default: "HH:mm"
  46877. },
  46878. modelValue: String,
  46879. disabled: Boolean,
  46880. editable: {
  46881. type: Boolean,
  46882. default: true
  46883. },
  46884. effect: {
  46885. type: String,
  46886. default: "light"
  46887. },
  46888. clearable: {
  46889. type: Boolean,
  46890. default: true
  46891. },
  46892. size: useSizeProp,
  46893. placeholder: String,
  46894. start: {
  46895. type: String,
  46896. default: "09:00"
  46897. },
  46898. end: {
  46899. type: String,
  46900. default: "18:00"
  46901. },
  46902. step: {
  46903. type: String,
  46904. default: "00:30"
  46905. },
  46906. minTime: String,
  46907. maxTime: String,
  46908. name: String,
  46909. prefixIcon: {
  46910. type: definePropType([String, Object]),
  46911. default: () => clock_default
  46912. },
  46913. clearIcon: {
  46914. type: definePropType([String, Object]),
  46915. default: () => circle_close_default
  46916. }
  46917. });
  46918. const parseTime = (time) => {
  46919. const values = (time || "").split(":");
  46920. if (values.length >= 2) {
  46921. let hours = Number.parseInt(values[0], 10);
  46922. const minutes = Number.parseInt(values[1], 10);
  46923. const timeUpper = time.toUpperCase();
  46924. if (timeUpper.includes("AM") && hours === 12) {
  46925. hours = 0;
  46926. } else if (timeUpper.includes("PM") && hours !== 12) {
  46927. hours += 12;
  46928. }
  46929. return {
  46930. hours,
  46931. minutes
  46932. };
  46933. }
  46934. return null;
  46935. };
  46936. const compareTime = (time1, time2) => {
  46937. const value1 = parseTime(time1);
  46938. if (!value1)
  46939. return -1;
  46940. const value2 = parseTime(time2);
  46941. if (!value2)
  46942. return -1;
  46943. const minutes1 = value1.minutes + value1.hours * 60;
  46944. const minutes2 = value2.minutes + value2.hours * 60;
  46945. if (minutes1 === minutes2) {
  46946. return 0;
  46947. }
  46948. return minutes1 > minutes2 ? 1 : -1;
  46949. };
  46950. const padTime = (time) => {
  46951. return `${time}`.padStart(2, "0");
  46952. };
  46953. const formatTime = (time) => {
  46954. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  46955. };
  46956. const nextTime = (time, step) => {
  46957. const timeValue = parseTime(time);
  46958. if (!timeValue)
  46959. return "";
  46960. const stepValue = parseTime(step);
  46961. if (!stepValue)
  46962. return "";
  46963. const next = {
  46964. hours: timeValue.hours,
  46965. minutes: timeValue.minutes
  46966. };
  46967. next.minutes += stepValue.minutes;
  46968. next.hours += stepValue.hours;
  46969. next.hours += Math.floor(next.minutes / 60);
  46970. next.minutes = next.minutes % 60;
  46971. return formatTime(next);
  46972. };
  46973. const __default__$h = vue.defineComponent({
  46974. name: "ElTimeSelect"
  46975. });
  46976. const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
  46977. ...__default__$h,
  46978. props: timeSelectProps,
  46979. emits: ["change", "blur", "focus", "update:modelValue"],
  46980. setup(__props, { expose }) {
  46981. const props = __props;
  46982. dayjs.extend(customParseFormat);
  46983. const { Option: ElOption } = ElSelect;
  46984. const nsInput = useNamespace("input");
  46985. const select = vue.ref();
  46986. const _disabled = useDisabled();
  46987. const value = vue.computed(() => props.modelValue);
  46988. const start = vue.computed(() => {
  46989. const time = parseTime(props.start);
  46990. return time ? formatTime(time) : null;
  46991. });
  46992. const end = vue.computed(() => {
  46993. const time = parseTime(props.end);
  46994. return time ? formatTime(time) : null;
  46995. });
  46996. const step = vue.computed(() => {
  46997. const time = parseTime(props.step);
  46998. return time ? formatTime(time) : null;
  46999. });
  47000. const minTime = vue.computed(() => {
  47001. const time = parseTime(props.minTime || "");
  47002. return time ? formatTime(time) : null;
  47003. });
  47004. const maxTime = vue.computed(() => {
  47005. const time = parseTime(props.maxTime || "");
  47006. return time ? formatTime(time) : null;
  47007. });
  47008. const items = vue.computed(() => {
  47009. const result = [];
  47010. if (props.start && props.end && props.step) {
  47011. let current = start.value;
  47012. let currentTime;
  47013. while (current && end.value && compareTime(current, end.value) <= 0) {
  47014. currentTime = dayjs(current, "HH:mm").format(props.format);
  47015. result.push({
  47016. value: currentTime,
  47017. disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0
  47018. });
  47019. current = nextTime(current, step.value);
  47020. }
  47021. }
  47022. return result;
  47023. });
  47024. const blur = () => {
  47025. var _a, _b;
  47026. (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  47027. };
  47028. const focus = () => {
  47029. var _a, _b;
  47030. (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  47031. };
  47032. expose({
  47033. blur,
  47034. focus
  47035. });
  47036. return (_ctx, _cache) => {
  47037. return vue.openBlock(), vue.createBlock(vue.unref(ElSelect), {
  47038. ref_key: "select",
  47039. ref: select,
  47040. "model-value": vue.unref(value),
  47041. disabled: vue.unref(_disabled),
  47042. clearable: _ctx.clearable,
  47043. "clear-icon": _ctx.clearIcon,
  47044. size: _ctx.size,
  47045. effect: _ctx.effect,
  47046. placeholder: _ctx.placeholder,
  47047. "default-first-option": "",
  47048. filterable: _ctx.editable,
  47049. "onUpdate:modelValue": _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event)),
  47050. onChange: _cache[1] || (_cache[1] = (event) => _ctx.$emit("change", event)),
  47051. onBlur: _cache[2] || (_cache[2] = (event) => _ctx.$emit("blur", event)),
  47052. onFocus: _cache[3] || (_cache[3] = (event) => _ctx.$emit("focus", event))
  47053. }, {
  47054. prefix: vue.withCtx(() => [
  47055. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  47056. key: 0,
  47057. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-icon"))
  47058. }, {
  47059. default: vue.withCtx(() => [
  47060. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  47061. ]),
  47062. _: 1
  47063. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  47064. ]),
  47065. default: vue.withCtx(() => [
  47066. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item) => {
  47067. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  47068. key: item.value,
  47069. label: item.value,
  47070. value: item.value,
  47071. disabled: item.disabled
  47072. }, null, 8, ["label", "value", "disabled"]);
  47073. }), 128))
  47074. ]),
  47075. _: 1
  47076. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable"]);
  47077. };
  47078. }
  47079. });
  47080. var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "time-select.vue"]]);
  47081. TimeSelect.install = (app) => {
  47082. app.component(TimeSelect.name, TimeSelect);
  47083. };
  47084. const _TimeSelect = TimeSelect;
  47085. const ElTimeSelect = _TimeSelect;
  47086. const Timeline = vue.defineComponent({
  47087. name: "ElTimeline",
  47088. setup(_, { slots }) {
  47089. const ns = useNamespace("timeline");
  47090. vue.provide("timeline", slots);
  47091. return () => {
  47092. return vue.h("ul", { class: [ns.b()] }, [vue.renderSlot(slots, "default")]);
  47093. };
  47094. }
  47095. });
  47096. var Timeline$1 = Timeline;
  47097. const timelineItemProps = buildProps({
  47098. timestamp: {
  47099. type: String,
  47100. default: ""
  47101. },
  47102. hideTimestamp: {
  47103. type: Boolean,
  47104. default: false
  47105. },
  47106. center: {
  47107. type: Boolean,
  47108. default: false
  47109. },
  47110. placement: {
  47111. type: String,
  47112. values: ["top", "bottom"],
  47113. default: "bottom"
  47114. },
  47115. type: {
  47116. type: String,
  47117. values: ["primary", "success", "warning", "danger", "info"],
  47118. default: ""
  47119. },
  47120. color: {
  47121. type: String,
  47122. default: ""
  47123. },
  47124. size: {
  47125. type: String,
  47126. values: ["normal", "large"],
  47127. default: "normal"
  47128. },
  47129. icon: {
  47130. type: iconPropType
  47131. },
  47132. hollow: {
  47133. type: Boolean,
  47134. default: false
  47135. }
  47136. });
  47137. const __default__$g = vue.defineComponent({
  47138. name: "ElTimelineItem"
  47139. });
  47140. const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
  47141. ...__default__$g,
  47142. props: timelineItemProps,
  47143. setup(__props) {
  47144. const ns = useNamespace("timeline-item");
  47145. return (_ctx, _cache) => {
  47146. return vue.openBlock(), vue.createElementBlock("li", {
  47147. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).e("center")]: _ctx.center }])
  47148. }, [
  47149. vue.createElementVNode("div", {
  47150. class: vue.normalizeClass(vue.unref(ns).e("tail"))
  47151. }, null, 2),
  47152. !_ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  47153. key: 0,
  47154. class: vue.normalizeClass([
  47155. vue.unref(ns).e("node"),
  47156. vue.unref(ns).em("node", _ctx.size || ""),
  47157. vue.unref(ns).em("node", _ctx.type || ""),
  47158. vue.unref(ns).is("hollow", _ctx.hollow)
  47159. ]),
  47160. style: vue.normalizeStyle({
  47161. backgroundColor: _ctx.color
  47162. })
  47163. }, [
  47164. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  47165. key: 0,
  47166. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  47167. }, {
  47168. default: vue.withCtx(() => [
  47169. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  47170. ]),
  47171. _: 1
  47172. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  47173. ], 6)) : vue.createCommentVNode("v-if", true),
  47174. _ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  47175. key: 1,
  47176. class: vue.normalizeClass(vue.unref(ns).e("dot"))
  47177. }, [
  47178. vue.renderSlot(_ctx.$slots, "dot")
  47179. ], 2)) : vue.createCommentVNode("v-if", true),
  47180. vue.createElementVNode("div", {
  47181. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  47182. }, [
  47183. !_ctx.hideTimestamp && _ctx.placement === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  47184. key: 0,
  47185. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("top")])
  47186. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true),
  47187. vue.createElementVNode("div", {
  47188. class: vue.normalizeClass(vue.unref(ns).e("content"))
  47189. }, [
  47190. vue.renderSlot(_ctx.$slots, "default")
  47191. ], 2),
  47192. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (vue.openBlock(), vue.createElementBlock("div", {
  47193. key: 1,
  47194. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("bottom")])
  47195. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true)
  47196. ], 2)
  47197. ], 2);
  47198. };
  47199. }
  47200. });
  47201. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__file", "timeline-item.vue"]]);
  47202. const ElTimeline = withInstall(Timeline$1, {
  47203. TimelineItem
  47204. });
  47205. const ElTimelineItem = withNoopInstall(TimelineItem);
  47206. const tooltipV2CommonProps = buildProps({
  47207. nowrap: Boolean
  47208. });
  47209. var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => {
  47210. TooltipV2Sides2["top"] = "top";
  47211. TooltipV2Sides2["bottom"] = "bottom";
  47212. TooltipV2Sides2["left"] = "left";
  47213. TooltipV2Sides2["right"] = "right";
  47214. return TooltipV2Sides2;
  47215. })(TooltipV2Sides || {});
  47216. const tooltipV2Sides = Object.values(TooltipV2Sides);
  47217. const tooltipV2ArrowProps = buildProps({
  47218. width: {
  47219. type: Number,
  47220. default: 10
  47221. },
  47222. height: {
  47223. type: Number,
  47224. default: 10
  47225. },
  47226. style: {
  47227. type: definePropType(Object),
  47228. default: null
  47229. }
  47230. });
  47231. const tooltipV2ArrowSpecialProps = buildProps({
  47232. side: {
  47233. type: definePropType(String),
  47234. values: tooltipV2Sides,
  47235. required: true
  47236. }
  47237. });
  47238. const tooltipV2Strategies = ["absolute", "fixed"];
  47239. const tooltipV2Placements = [
  47240. "top-start",
  47241. "top-end",
  47242. "top",
  47243. "bottom-start",
  47244. "bottom-end",
  47245. "bottom",
  47246. "left-start",
  47247. "left-end",
  47248. "left",
  47249. "right-start",
  47250. "right-end",
  47251. "right"
  47252. ];
  47253. const tooltipV2ContentProps = buildProps({
  47254. ariaLabel: String,
  47255. arrowPadding: {
  47256. type: definePropType(Number),
  47257. default: 5
  47258. },
  47259. effect: {
  47260. type: String,
  47261. default: ""
  47262. },
  47263. contentClass: String,
  47264. placement: {
  47265. type: definePropType(String),
  47266. values: tooltipV2Placements,
  47267. default: "bottom"
  47268. },
  47269. reference: {
  47270. type: definePropType(Object),
  47271. default: null
  47272. },
  47273. offset: {
  47274. type: Number,
  47275. default: 8
  47276. },
  47277. strategy: {
  47278. type: definePropType(String),
  47279. values: tooltipV2Strategies,
  47280. default: "absolute"
  47281. },
  47282. showArrow: {
  47283. type: Boolean,
  47284. default: false
  47285. }
  47286. });
  47287. const tooltipV2RootProps = buildProps({
  47288. delayDuration: {
  47289. type: Number,
  47290. default: 300
  47291. },
  47292. defaultOpen: Boolean,
  47293. open: {
  47294. type: Boolean,
  47295. default: void 0
  47296. },
  47297. onOpenChange: {
  47298. type: definePropType(Function)
  47299. },
  47300. "onUpdate:open": {
  47301. type: definePropType(Function)
  47302. }
  47303. });
  47304. const EventHandler = {
  47305. type: definePropType(Function)
  47306. };
  47307. const tooltipV2TriggerProps = buildProps({
  47308. onBlur: EventHandler,
  47309. onClick: EventHandler,
  47310. onFocus: EventHandler,
  47311. onMouseDown: EventHandler,
  47312. onMouseEnter: EventHandler,
  47313. onMouseLeave: EventHandler
  47314. });
  47315. const tooltipV2Props = buildProps({
  47316. ...tooltipV2RootProps,
  47317. ...tooltipV2ArrowProps,
  47318. ...tooltipV2TriggerProps,
  47319. ...tooltipV2ContentProps,
  47320. alwaysOn: Boolean,
  47321. fullTransition: Boolean,
  47322. transitionProps: {
  47323. type: definePropType(Object),
  47324. default: null
  47325. },
  47326. teleported: Boolean,
  47327. to: {
  47328. type: definePropType(String),
  47329. default: "body"
  47330. }
  47331. });
  47332. const __default__$f = vue.defineComponent({
  47333. name: "ElTooltipV2Root"
  47334. });
  47335. const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
  47336. ...__default__$f,
  47337. props: tooltipV2RootProps,
  47338. setup(__props, { expose }) {
  47339. const props = __props;
  47340. const _open = vue.ref(props.defaultOpen);
  47341. const triggerRef = vue.ref(null);
  47342. const open = vue.computed({
  47343. get: () => isPropAbsent(props.open) ? _open.value : props.open,
  47344. set: (open2) => {
  47345. var _a;
  47346. _open.value = open2;
  47347. (_a = props["onUpdate:open"]) == null ? void 0 : _a.call(props, open2);
  47348. }
  47349. });
  47350. const isOpenDelayed = vue.computed(() => isNumber(props.delayDuration) && props.delayDuration > 0);
  47351. const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => {
  47352. open.value = true;
  47353. }, vue.computed(() => props.delayDuration), {
  47354. immediate: false
  47355. });
  47356. const ns = useNamespace("tooltip-v2");
  47357. const contentId = useId();
  47358. const onNormalOpen = () => {
  47359. clearTimer();
  47360. open.value = true;
  47361. };
  47362. const onDelayOpen = () => {
  47363. vue.unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen();
  47364. };
  47365. const onOpen = onNormalOpen;
  47366. const onClose = () => {
  47367. clearTimer();
  47368. open.value = false;
  47369. };
  47370. const onChange = (open2) => {
  47371. var _a;
  47372. if (open2) {
  47373. document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN));
  47374. onOpen();
  47375. }
  47376. (_a = props.onOpenChange) == null ? void 0 : _a.call(props, open2);
  47377. };
  47378. vue.watch(open, onChange);
  47379. vue.onMounted(() => {
  47380. document.addEventListener(TOOLTIP_V2_OPEN, onClose);
  47381. });
  47382. vue.onBeforeUnmount(() => {
  47383. clearTimer();
  47384. document.removeEventListener(TOOLTIP_V2_OPEN, onClose);
  47385. });
  47386. vue.provide(tooltipV2RootKey, {
  47387. contentId,
  47388. triggerRef,
  47389. ns,
  47390. onClose,
  47391. onDelayOpen,
  47392. onOpen
  47393. });
  47394. expose({
  47395. onOpen,
  47396. onClose
  47397. });
  47398. return (_ctx, _cache) => {
  47399. return vue.renderSlot(_ctx.$slots, "default", { open: vue.unref(open) });
  47400. };
  47401. }
  47402. });
  47403. var TooltipV2Root = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__file", "root.vue"]]);
  47404. const __default__$e = vue.defineComponent({
  47405. name: "ElTooltipV2Arrow"
  47406. });
  47407. const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
  47408. ...__default__$e,
  47409. props: {
  47410. ...tooltipV2ArrowProps,
  47411. ...tooltipV2ArrowSpecialProps
  47412. },
  47413. setup(__props) {
  47414. const props = __props;
  47415. const { ns } = vue.inject(tooltipV2RootKey);
  47416. const { arrowRef } = vue.inject(tooltipV2ContentKey);
  47417. const arrowStyle = vue.computed(() => {
  47418. const { style, width, height } = props;
  47419. const namespace = ns.namespace.value;
  47420. return {
  47421. [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
  47422. [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
  47423. [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
  47424. [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
  47425. ...style || {}
  47426. };
  47427. });
  47428. return (_ctx, _cache) => {
  47429. return vue.openBlock(), vue.createElementBlock("span", {
  47430. ref_key: "arrowRef",
  47431. ref: arrowRef,
  47432. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  47433. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  47434. }, null, 6);
  47435. };
  47436. }
  47437. });
  47438. var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "arrow.vue"]]);
  47439. const visualHiddenProps = buildProps({
  47440. style: {
  47441. type: definePropType([String, Object, Array]),
  47442. default: () => ({})
  47443. }
  47444. });
  47445. const __default__$d = vue.defineComponent({
  47446. name: "ElVisuallyHidden"
  47447. });
  47448. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  47449. ...__default__$d,
  47450. props: visualHiddenProps,
  47451. setup(__props) {
  47452. const props = __props;
  47453. const computedStyle = vue.computed(() => {
  47454. return [
  47455. props.style,
  47456. {
  47457. position: "absolute",
  47458. border: 0,
  47459. width: 1,
  47460. height: 1,
  47461. padding: 0,
  47462. margin: -1,
  47463. overflow: "hidden",
  47464. clip: "rect(0, 0, 0, 0)",
  47465. whiteSpace: "nowrap",
  47466. wordWrap: "normal"
  47467. }
  47468. ];
  47469. });
  47470. return (_ctx, _cache) => {
  47471. return vue.openBlock(), vue.createElementBlock("span", vue.mergeProps(_ctx.$attrs, { style: vue.unref(computedStyle) }), [
  47472. vue.renderSlot(_ctx.$slots, "default")
  47473. ], 16);
  47474. };
  47475. }
  47476. });
  47477. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "visual-hidden.vue"]]);
  47478. const _hoisted_1$9 = ["data-side"];
  47479. const __default__$c = vue.defineComponent({
  47480. name: "ElTooltipV2Content"
  47481. });
  47482. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  47483. ...__default__$c,
  47484. props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps },
  47485. setup(__props) {
  47486. const props = __props;
  47487. const { triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  47488. const placement = vue.ref(props.placement);
  47489. const strategy = vue.ref(props.strategy);
  47490. const arrowRef = vue.ref(null);
  47491. const { referenceRef, contentRef, middlewareData, x, y, update } = useFloating({
  47492. placement,
  47493. strategy,
  47494. middleware: vue.computed(() => {
  47495. const middleware = [offset(props.offset)];
  47496. if (props.showArrow) {
  47497. middleware.push(arrowMiddleware({
  47498. arrowRef
  47499. }));
  47500. }
  47501. return middleware;
  47502. })
  47503. });
  47504. const zIndex = useZIndex().nextZIndex();
  47505. const ns = useNamespace("tooltip-v2");
  47506. const side = vue.computed(() => {
  47507. return placement.value.split("-")[0];
  47508. });
  47509. const contentStyle = vue.computed(() => {
  47510. return {
  47511. position: vue.unref(strategy),
  47512. top: `${vue.unref(y) || 0}px`,
  47513. left: `${vue.unref(x) || 0}px`,
  47514. zIndex
  47515. };
  47516. });
  47517. const arrowStyle = vue.computed(() => {
  47518. if (!props.showArrow)
  47519. return {};
  47520. const { arrow } = vue.unref(middlewareData);
  47521. return {
  47522. [`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow == null ? void 0 : arrow.x}px` || "",
  47523. [`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow == null ? void 0 : arrow.y}px` || ""
  47524. };
  47525. });
  47526. const contentClass = vue.computed(() => [
  47527. ns.e("content"),
  47528. ns.is("dark", props.effect === "dark"),
  47529. ns.is(vue.unref(strategy)),
  47530. props.contentClass
  47531. ]);
  47532. vue.watch(arrowRef, () => update());
  47533. vue.watch(() => props.placement, (val) => placement.value = val);
  47534. vue.onMounted(() => {
  47535. vue.watch(() => props.reference || triggerRef.value, (el) => {
  47536. referenceRef.value = el || void 0;
  47537. }, {
  47538. immediate: true
  47539. });
  47540. });
  47541. vue.provide(tooltipV2ContentKey, { arrowRef });
  47542. return (_ctx, _cache) => {
  47543. return vue.openBlock(), vue.createElementBlock("div", {
  47544. ref_key: "contentRef",
  47545. ref: contentRef,
  47546. style: vue.normalizeStyle(vue.unref(contentStyle)),
  47547. "data-tooltip-v2-root": ""
  47548. }, [
  47549. !_ctx.nowrap ? (vue.openBlock(), vue.createElementBlock("div", {
  47550. key: 0,
  47551. "data-side": vue.unref(side),
  47552. class: vue.normalizeClass(vue.unref(contentClass))
  47553. }, [
  47554. vue.renderSlot(_ctx.$slots, "default", {
  47555. contentStyle: vue.unref(contentStyle),
  47556. contentClass: vue.unref(contentClass)
  47557. }),
  47558. vue.createVNode(vue.unref(ElVisuallyHidden), {
  47559. id: vue.unref(contentId),
  47560. role: "tooltip"
  47561. }, {
  47562. default: vue.withCtx(() => [
  47563. _ctx.ariaLabel ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  47564. vue.createTextVNode(vue.toDisplayString(_ctx.ariaLabel), 1)
  47565. ], 64)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 })
  47566. ]),
  47567. _: 3
  47568. }, 8, ["id"]),
  47569. vue.renderSlot(_ctx.$slots, "arrow", {
  47570. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  47571. side: vue.unref(side)
  47572. })
  47573. ], 10, _hoisted_1$9)) : vue.createCommentVNode("v-if", true)
  47574. ], 4);
  47575. };
  47576. }
  47577. });
  47578. var TooltipV2Content = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "content.vue"]]);
  47579. const forwardRefProps = buildProps({
  47580. setRef: {
  47581. type: definePropType(Function),
  47582. required: true
  47583. },
  47584. onlyChild: Boolean
  47585. });
  47586. var ForwardRef = vue.defineComponent({
  47587. props: forwardRefProps,
  47588. setup(props, {
  47589. slots
  47590. }) {
  47591. const fragmentRef = vue.ref();
  47592. const setRef = composeRefs(fragmentRef, (el) => {
  47593. if (el) {
  47594. props.setRef(el.nextElementSibling);
  47595. } else {
  47596. props.setRef(null);
  47597. }
  47598. });
  47599. return () => {
  47600. var _a;
  47601. const [firstChild] = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
  47602. const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children;
  47603. return vue.createVNode(vue.Fragment, {
  47604. "ref": setRef
  47605. }, [child]);
  47606. };
  47607. }
  47608. });
  47609. const __default__$b = vue.defineComponent({
  47610. name: "ElTooltipV2Trigger"
  47611. });
  47612. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  47613. ...__default__$b,
  47614. props: {
  47615. ...tooltipV2CommonProps,
  47616. ...tooltipV2TriggerProps
  47617. },
  47618. setup(__props) {
  47619. const props = __props;
  47620. const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  47621. let isMousedown = false;
  47622. const setTriggerRef = (el) => {
  47623. triggerRef.value = el;
  47624. };
  47625. const onMouseup = () => {
  47626. isMousedown = false;
  47627. };
  47628. const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
  47629. const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
  47630. const onMousedown = composeEventHandlers(props.onMouseDown, () => {
  47631. onClose();
  47632. isMousedown = true;
  47633. document.addEventListener("mouseup", onMouseup, { once: true });
  47634. });
  47635. const onFocus = composeEventHandlers(props.onFocus, () => {
  47636. if (!isMousedown)
  47637. onOpen();
  47638. });
  47639. const onBlur = composeEventHandlers(props.onBlur, onClose);
  47640. const onClick = composeEventHandlers(props.onClick, (e) => {
  47641. if (e.detail === 0)
  47642. onClose();
  47643. });
  47644. const events = {
  47645. blur: onBlur,
  47646. click: onClick,
  47647. focus: onFocus,
  47648. mousedown: onMousedown,
  47649. mouseenter: onMouseenter,
  47650. mouseleave: onMouseleave
  47651. };
  47652. const setEvents = (el, events2, type) => {
  47653. if (el) {
  47654. Object.entries(events2).forEach(([name, handler]) => {
  47655. el[type](name, handler);
  47656. });
  47657. }
  47658. };
  47659. vue.watch(triggerRef, (triggerEl, previousTriggerEl) => {
  47660. setEvents(triggerEl, events, "addEventListener");
  47661. setEvents(previousTriggerEl, events, "removeEventListener");
  47662. if (triggerEl) {
  47663. triggerEl.setAttribute("aria-describedby", contentId.value);
  47664. }
  47665. });
  47666. vue.onBeforeUnmount(() => {
  47667. setEvents(triggerRef.value, events, "removeEventListener");
  47668. document.removeEventListener("mouseup", onMouseup);
  47669. });
  47670. return (_ctx, _cache) => {
  47671. return _ctx.nowrap ? (vue.openBlock(), vue.createBlock(vue.unref(ForwardRef), {
  47672. key: 0,
  47673. "set-ref": setTriggerRef,
  47674. "only-child": ""
  47675. }, {
  47676. default: vue.withCtx(() => [
  47677. vue.renderSlot(_ctx.$slots, "default")
  47678. ]),
  47679. _: 3
  47680. })) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
  47681. key: 1,
  47682. ref_key: "triggerRef",
  47683. ref: triggerRef
  47684. }, _ctx.$attrs), [
  47685. vue.renderSlot(_ctx.$slots, "default")
  47686. ], 16));
  47687. };
  47688. }
  47689. });
  47690. var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "trigger.vue"]]);
  47691. const __default__$a = vue.defineComponent({
  47692. name: "ElTooltipV2"
  47693. });
  47694. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  47695. ...__default__$a,
  47696. props: tooltipV2Props,
  47697. setup(__props) {
  47698. const props = __props;
  47699. const refedProps = vue.toRefs(props);
  47700. const arrowProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps)));
  47701. const contentProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ContentProps)));
  47702. const rootProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2RootProps)));
  47703. const triggerProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2TriggerProps)));
  47704. return (_ctx, _cache) => {
  47705. return vue.openBlock(), vue.createBlock(TooltipV2Root, vue.normalizeProps(vue.guardReactiveProps(rootProps)), {
  47706. default: vue.withCtx(({ open }) => [
  47707. vue.createVNode(TooltipV2Trigger, vue.mergeProps(triggerProps, { nowrap: "" }), {
  47708. default: vue.withCtx(() => [
  47709. vue.renderSlot(_ctx.$slots, "trigger")
  47710. ]),
  47711. _: 3
  47712. }, 16),
  47713. (vue.openBlock(), vue.createBlock(vue.Teleport, {
  47714. to: _ctx.to,
  47715. disabled: !_ctx.teleported
  47716. }, [
  47717. _ctx.fullTransition ? (vue.openBlock(), vue.createBlock(vue.Transition, vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.transitionProps)), {
  47718. default: vue.withCtx(() => [
  47719. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  47720. arrow: vue.withCtx(({ style, side }) => [
  47721. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  47722. style,
  47723. side
  47724. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  47725. ]),
  47726. default: vue.withCtx(() => [
  47727. vue.renderSlot(_ctx.$slots, "default")
  47728. ]),
  47729. _: 3
  47730. }, 16)) : vue.createCommentVNode("v-if", true)
  47731. ]),
  47732. _: 2
  47733. }, 1040)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  47734. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  47735. arrow: vue.withCtx(({ style, side }) => [
  47736. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  47737. style,
  47738. side
  47739. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  47740. ]),
  47741. default: vue.withCtx(() => [
  47742. vue.renderSlot(_ctx.$slots, "default")
  47743. ]),
  47744. _: 3
  47745. }, 16)) : vue.createCommentVNode("v-if", true)
  47746. ], 64))
  47747. ], 8, ["to", "disabled"]))
  47748. ]),
  47749. _: 3
  47750. }, 16);
  47751. };
  47752. }
  47753. });
  47754. var TooltipV2 = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "tooltip.vue"]]);
  47755. const ElTooltipV2 = withInstall(TooltipV2);
  47756. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  47757. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  47758. const transferProps = buildProps({
  47759. data: {
  47760. type: definePropType(Array),
  47761. default: () => []
  47762. },
  47763. titles: {
  47764. type: definePropType(Array),
  47765. default: () => []
  47766. },
  47767. buttonTexts: {
  47768. type: definePropType(Array),
  47769. default: () => []
  47770. },
  47771. filterPlaceholder: String,
  47772. filterMethod: {
  47773. type: definePropType(Function)
  47774. },
  47775. leftDefaultChecked: {
  47776. type: definePropType(Array),
  47777. default: () => []
  47778. },
  47779. rightDefaultChecked: {
  47780. type: definePropType(Array),
  47781. default: () => []
  47782. },
  47783. renderContent: {
  47784. type: definePropType(Function)
  47785. },
  47786. modelValue: {
  47787. type: definePropType(Array),
  47788. default: () => []
  47789. },
  47790. format: {
  47791. type: definePropType(Object),
  47792. default: () => ({})
  47793. },
  47794. filterable: Boolean,
  47795. props: {
  47796. type: definePropType(Object),
  47797. default: () => mutable({
  47798. label: "label",
  47799. key: "key",
  47800. disabled: "disabled"
  47801. })
  47802. },
  47803. targetOrder: {
  47804. type: String,
  47805. values: ["original", "push", "unshift"],
  47806. default: "original"
  47807. },
  47808. validateEvent: {
  47809. type: Boolean,
  47810. default: true
  47811. }
  47812. });
  47813. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray) || isArray(value) && isNil(movedKeys);
  47814. const transferEmits = {
  47815. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray) && ["left", "right"].includes(direction),
  47816. [UPDATE_MODEL_EVENT]: (value) => isArray(value),
  47817. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  47818. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  47819. };
  47820. const CHECKED_CHANGE_EVENT = "checked-change";
  47821. const transferPanelProps = buildProps({
  47822. data: transferProps.data,
  47823. optionRender: {
  47824. type: definePropType(Function)
  47825. },
  47826. placeholder: String,
  47827. title: String,
  47828. filterable: Boolean,
  47829. format: transferProps.format,
  47830. filterMethod: transferProps.filterMethod,
  47831. defaultChecked: transferProps.leftDefaultChecked,
  47832. props: transferProps.props
  47833. });
  47834. const transferPanelEmits = {
  47835. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  47836. };
  47837. const usePropsAlias = (props) => {
  47838. const initProps = {
  47839. label: "label",
  47840. key: "key",
  47841. disabled: "disabled"
  47842. };
  47843. return vue.computed(() => ({
  47844. ...initProps,
  47845. ...props.props
  47846. }));
  47847. };
  47848. const useCheck$1 = (props, panelState, emit) => {
  47849. const propsAlias = usePropsAlias(props);
  47850. const filteredData = vue.computed(() => {
  47851. return props.data.filter((item) => {
  47852. if (isFunction(props.filterMethod)) {
  47853. return props.filterMethod(panelState.query, item);
  47854. } else {
  47855. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  47856. return label.toLowerCase().includes(panelState.query.toLowerCase());
  47857. }
  47858. });
  47859. });
  47860. const checkableData = vue.computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  47861. const checkedSummary = vue.computed(() => {
  47862. const checkedLength = panelState.checked.length;
  47863. const dataLength = props.data.length;
  47864. const { noChecked, hasChecked } = props.format;
  47865. if (noChecked && hasChecked) {
  47866. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  47867. } else {
  47868. return `${checkedLength}/${dataLength}`;
  47869. }
  47870. });
  47871. const isIndeterminate = vue.computed(() => {
  47872. const checkedLength = panelState.checked.length;
  47873. return checkedLength > 0 && checkedLength < checkableData.value.length;
  47874. });
  47875. const updateAllChecked = () => {
  47876. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  47877. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  47878. };
  47879. const handleAllCheckedChange = (value) => {
  47880. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  47881. };
  47882. vue.watch(() => panelState.checked, (val, oldVal) => {
  47883. updateAllChecked();
  47884. if (panelState.checkChangeByUser) {
  47885. const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v));
  47886. emit(CHECKED_CHANGE_EVENT, val, movedKeys);
  47887. } else {
  47888. emit(CHECKED_CHANGE_EVENT, val);
  47889. panelState.checkChangeByUser = true;
  47890. }
  47891. });
  47892. vue.watch(checkableData, () => {
  47893. updateAllChecked();
  47894. });
  47895. vue.watch(() => props.data, () => {
  47896. const checked = [];
  47897. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  47898. panelState.checked.forEach((item) => {
  47899. if (filteredDataKeys.includes(item)) {
  47900. checked.push(item);
  47901. }
  47902. });
  47903. panelState.checkChangeByUser = false;
  47904. panelState.checked = checked;
  47905. });
  47906. vue.watch(() => props.defaultChecked, (val, oldVal) => {
  47907. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  47908. return;
  47909. const checked = [];
  47910. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  47911. val.forEach((item) => {
  47912. if (checkableDataKeys.includes(item)) {
  47913. checked.push(item);
  47914. }
  47915. });
  47916. panelState.checkChangeByUser = false;
  47917. panelState.checked = checked;
  47918. }, {
  47919. immediate: true
  47920. });
  47921. return {
  47922. filteredData,
  47923. checkableData,
  47924. checkedSummary,
  47925. isIndeterminate,
  47926. updateAllChecked,
  47927. handleAllCheckedChange
  47928. };
  47929. };
  47930. const useCheckedChange = (checkedState, emit) => {
  47931. const onSourceCheckedChange = (val, movedKeys) => {
  47932. checkedState.leftChecked = val;
  47933. if (!movedKeys)
  47934. return;
  47935. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  47936. };
  47937. const onTargetCheckedChange = (val, movedKeys) => {
  47938. checkedState.rightChecked = val;
  47939. if (!movedKeys)
  47940. return;
  47941. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  47942. };
  47943. return {
  47944. onSourceCheckedChange,
  47945. onTargetCheckedChange
  47946. };
  47947. };
  47948. const useComputedData = (props) => {
  47949. const propsAlias = usePropsAlias(props);
  47950. const dataObj = vue.computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  47951. const sourceData = vue.computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  47952. const targetData = vue.computed(() => {
  47953. if (props.targetOrder === "original") {
  47954. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  47955. } else {
  47956. return props.modelValue.reduce((arr, cur) => {
  47957. const val = dataObj.value[cur];
  47958. if (val) {
  47959. arr.push(val);
  47960. }
  47961. return arr;
  47962. }, []);
  47963. }
  47964. });
  47965. return {
  47966. sourceData,
  47967. targetData
  47968. };
  47969. };
  47970. const useMove = (props, checkedState, emit) => {
  47971. const propsAlias = usePropsAlias(props);
  47972. const _emit = (value, direction, movedKeys) => {
  47973. emit(UPDATE_MODEL_EVENT, value);
  47974. emit(CHANGE_EVENT, value, direction, movedKeys);
  47975. };
  47976. const addToLeft = () => {
  47977. const currentValue = props.modelValue.slice();
  47978. checkedState.rightChecked.forEach((item) => {
  47979. const index = currentValue.indexOf(item);
  47980. if (index > -1) {
  47981. currentValue.splice(index, 1);
  47982. }
  47983. });
  47984. _emit(currentValue, "left", checkedState.rightChecked);
  47985. };
  47986. const addToRight = () => {
  47987. let currentValue = props.modelValue.slice();
  47988. const itemsToBeMoved = props.data.filter((item) => {
  47989. const itemKey = item[propsAlias.value.key];
  47990. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  47991. }).map((item) => item[propsAlias.value.key]);
  47992. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  47993. if (props.targetOrder === "original") {
  47994. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  47995. }
  47996. _emit(currentValue, "right", checkedState.leftChecked);
  47997. };
  47998. return {
  47999. addToLeft,
  48000. addToRight
  48001. };
  48002. };
  48003. const __default__$9 = vue.defineComponent({
  48004. name: "ElTransferPanel"
  48005. });
  48006. const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
  48007. ...__default__$9,
  48008. props: transferPanelProps,
  48009. emits: transferPanelEmits,
  48010. setup(__props, { expose, emit }) {
  48011. const props = __props;
  48012. const slots = vue.useSlots();
  48013. const OptionContent = ({ option }) => option;
  48014. const { t } = useLocale();
  48015. const ns = useNamespace("transfer");
  48016. const panelState = vue.reactive({
  48017. checked: [],
  48018. allChecked: false,
  48019. query: "",
  48020. inputHover: false,
  48021. checkChangeByUser: true
  48022. });
  48023. const propsAlias = usePropsAlias(props);
  48024. const {
  48025. filteredData,
  48026. checkedSummary,
  48027. isIndeterminate,
  48028. handleAllCheckedChange
  48029. } = useCheck$1(props, panelState, emit);
  48030. const hasNoMatch = vue.computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  48031. const hasFooter = vue.computed(() => !isEmpty(slots.default()[0].children));
  48032. const { checked, allChecked, query, inputHover } = vue.toRefs(panelState);
  48033. expose({
  48034. query
  48035. });
  48036. return (_ctx, _cache) => {
  48037. return vue.openBlock(), vue.createElementBlock("div", {
  48038. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  48039. }, [
  48040. vue.createElementVNode("p", {
  48041. class: vue.normalizeClass(vue.unref(ns).be("panel", "header"))
  48042. }, [
  48043. vue.createVNode(vue.unref(ElCheckbox), {
  48044. modelValue: vue.unref(allChecked),
  48045. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(allChecked) ? allChecked.value = $event : null),
  48046. indeterminate: vue.unref(isIndeterminate),
  48047. "validate-event": false,
  48048. onChange: vue.unref(handleAllCheckedChange)
  48049. }, {
  48050. default: vue.withCtx(() => [
  48051. vue.createTextVNode(vue.toDisplayString(_ctx.title) + " ", 1),
  48052. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(checkedSummary)), 1)
  48053. ]),
  48054. _: 1
  48055. }, 8, ["modelValue", "indeterminate", "onChange"])
  48056. ], 2),
  48057. vue.createElementVNode("div", {
  48058. class: vue.normalizeClass([vue.unref(ns).be("panel", "body"), vue.unref(ns).is("with-footer", vue.unref(hasFooter))])
  48059. }, [
  48060. _ctx.filterable ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  48061. key: 0,
  48062. modelValue: vue.unref(query),
  48063. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(query) ? query.value = $event : null),
  48064. class: vue.normalizeClass(vue.unref(ns).be("panel", "filter")),
  48065. size: "default",
  48066. placeholder: _ctx.placeholder,
  48067. "prefix-icon": vue.unref(search_default),
  48068. clearable: "",
  48069. "validate-event": false,
  48070. onMouseenter: _cache[2] || (_cache[2] = ($event) => inputHover.value = true),
  48071. onMouseleave: _cache[3] || (_cache[3] = ($event) => inputHover.value = false)
  48072. }, null, 8, ["modelValue", "class", "placeholder", "prefix-icon"])) : vue.createCommentVNode("v-if", true),
  48073. vue.withDirectives(vue.createVNode(vue.unref(ElCheckboxGroup$1), {
  48074. modelValue: vue.unref(checked),
  48075. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(checked) ? checked.value = $event : null),
  48076. "validate-event": false,
  48077. class: vue.normalizeClass([vue.unref(ns).is("filterable", _ctx.filterable), vue.unref(ns).be("panel", "list")])
  48078. }, {
  48079. default: vue.withCtx(() => [
  48080. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(filteredData), (item) => {
  48081. return vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  48082. key: item[vue.unref(propsAlias).key],
  48083. class: vue.normalizeClass(vue.unref(ns).be("panel", "item")),
  48084. label: item[vue.unref(propsAlias).key],
  48085. disabled: item[vue.unref(propsAlias).disabled],
  48086. "validate-event": false
  48087. }, {
  48088. default: vue.withCtx(() => {
  48089. var _a;
  48090. return [
  48091. vue.createVNode(OptionContent, {
  48092. option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item)
  48093. }, null, 8, ["option"])
  48094. ];
  48095. }),
  48096. _: 2
  48097. }, 1032, ["class", "label", "disabled"]);
  48098. }), 128))
  48099. ]),
  48100. _: 1
  48101. }, 8, ["modelValue", "class"]), [
  48102. [vue.vShow, !vue.unref(hasNoMatch) && !vue.unref(isEmpty)(_ctx.data)]
  48103. ]),
  48104. vue.withDirectives(vue.createElementVNode("p", {
  48105. class: vue.normalizeClass(vue.unref(ns).be("panel", "empty"))
  48106. }, vue.toDisplayString(vue.unref(hasNoMatch) ? vue.unref(t)("el.transfer.noMatch") : vue.unref(t)("el.transfer.noData")), 3), [
  48107. [vue.vShow, vue.unref(hasNoMatch) || vue.unref(isEmpty)(_ctx.data)]
  48108. ])
  48109. ], 2),
  48110. vue.unref(hasFooter) ? (vue.openBlock(), vue.createElementBlock("p", {
  48111. key: 0,
  48112. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  48113. }, [
  48114. vue.renderSlot(_ctx.$slots, "default")
  48115. ], 2)) : vue.createCommentVNode("v-if", true)
  48116. ], 2);
  48117. };
  48118. }
  48119. });
  48120. var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "transfer-panel.vue"]]);
  48121. const _hoisted_1$8 = { key: 0 };
  48122. const _hoisted_2$6 = { key: 0 };
  48123. const __default__$8 = vue.defineComponent({
  48124. name: "ElTransfer"
  48125. });
  48126. const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
  48127. ...__default__$8,
  48128. props: transferProps,
  48129. emits: transferEmits,
  48130. setup(__props, { expose, emit }) {
  48131. const props = __props;
  48132. const slots = vue.useSlots();
  48133. const { t } = useLocale();
  48134. const ns = useNamespace("transfer");
  48135. const { formItem } = useFormItem();
  48136. const checkedState = vue.reactive({
  48137. leftChecked: [],
  48138. rightChecked: []
  48139. });
  48140. const propsAlias = usePropsAlias(props);
  48141. const { sourceData, targetData } = useComputedData(props);
  48142. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  48143. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  48144. const leftPanel = vue.ref();
  48145. const rightPanel = vue.ref();
  48146. const clearQuery = (which) => {
  48147. switch (which) {
  48148. case "left":
  48149. leftPanel.value.query = "";
  48150. break;
  48151. case "right":
  48152. rightPanel.value.query = "";
  48153. break;
  48154. }
  48155. };
  48156. const hasButtonTexts = vue.computed(() => props.buttonTexts.length === 2);
  48157. const leftPanelTitle = vue.computed(() => props.titles[0] || t("el.transfer.titles.0"));
  48158. const rightPanelTitle = vue.computed(() => props.titles[1] || t("el.transfer.titles.1"));
  48159. const panelFilterPlaceholder = vue.computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  48160. vue.watch(() => props.modelValue, () => {
  48161. var _a;
  48162. if (props.validateEvent) {
  48163. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  48164. }
  48165. });
  48166. const optionRender = vue.computed(() => (option) => {
  48167. if (props.renderContent)
  48168. return props.renderContent(vue.h, option);
  48169. if (slots.default)
  48170. return slots.default({ option });
  48171. return vue.h("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  48172. });
  48173. expose({
  48174. clearQuery,
  48175. leftPanel,
  48176. rightPanel
  48177. });
  48178. return (_ctx, _cache) => {
  48179. return vue.openBlock(), vue.createElementBlock("div", {
  48180. class: vue.normalizeClass(vue.unref(ns).b())
  48181. }, [
  48182. vue.createVNode(TransferPanel, {
  48183. ref_key: "leftPanel",
  48184. ref: leftPanel,
  48185. data: vue.unref(sourceData),
  48186. "option-render": vue.unref(optionRender),
  48187. placeholder: vue.unref(panelFilterPlaceholder),
  48188. title: vue.unref(leftPanelTitle),
  48189. filterable: _ctx.filterable,
  48190. format: _ctx.format,
  48191. "filter-method": _ctx.filterMethod,
  48192. "default-checked": _ctx.leftDefaultChecked,
  48193. props: props.props,
  48194. onCheckedChange: vue.unref(onSourceCheckedChange)
  48195. }, {
  48196. default: vue.withCtx(() => [
  48197. vue.renderSlot(_ctx.$slots, "left-footer")
  48198. ]),
  48199. _: 3
  48200. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  48201. vue.createElementVNode("div", {
  48202. class: vue.normalizeClass(vue.unref(ns).e("buttons"))
  48203. }, [
  48204. vue.createVNode(vue.unref(ElButton), {
  48205. type: "primary",
  48206. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  48207. disabled: vue.unref(isEmpty)(checkedState.rightChecked),
  48208. onClick: vue.unref(addToLeft)
  48209. }, {
  48210. default: vue.withCtx(() => [
  48211. vue.createVNode(vue.unref(ElIcon), null, {
  48212. default: vue.withCtx(() => [
  48213. vue.createVNode(vue.unref(arrow_left_default))
  48214. ]),
  48215. _: 1
  48216. }),
  48217. !vue.unref(isUndefined)(_ctx.buttonTexts[0]) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$8, vue.toDisplayString(_ctx.buttonTexts[0]), 1)) : vue.createCommentVNode("v-if", true)
  48218. ]),
  48219. _: 1
  48220. }, 8, ["class", "disabled", "onClick"]),
  48221. vue.createVNode(vue.unref(ElButton), {
  48222. type: "primary",
  48223. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  48224. disabled: vue.unref(isEmpty)(checkedState.leftChecked),
  48225. onClick: vue.unref(addToRight)
  48226. }, {
  48227. default: vue.withCtx(() => [
  48228. !vue.unref(isUndefined)(_ctx.buttonTexts[1]) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$6, vue.toDisplayString(_ctx.buttonTexts[1]), 1)) : vue.createCommentVNode("v-if", true),
  48229. vue.createVNode(vue.unref(ElIcon), null, {
  48230. default: vue.withCtx(() => [
  48231. vue.createVNode(vue.unref(arrow_right_default))
  48232. ]),
  48233. _: 1
  48234. })
  48235. ]),
  48236. _: 1
  48237. }, 8, ["class", "disabled", "onClick"])
  48238. ], 2),
  48239. vue.createVNode(TransferPanel, {
  48240. ref_key: "rightPanel",
  48241. ref: rightPanel,
  48242. data: vue.unref(targetData),
  48243. "option-render": vue.unref(optionRender),
  48244. placeholder: vue.unref(panelFilterPlaceholder),
  48245. filterable: _ctx.filterable,
  48246. format: _ctx.format,
  48247. "filter-method": _ctx.filterMethod,
  48248. title: vue.unref(rightPanelTitle),
  48249. "default-checked": _ctx.rightDefaultChecked,
  48250. props: props.props,
  48251. onCheckedChange: vue.unref(onTargetCheckedChange)
  48252. }, {
  48253. default: vue.withCtx(() => [
  48254. vue.renderSlot(_ctx.$slots, "right-footer")
  48255. ]),
  48256. _: 3
  48257. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  48258. ], 2);
  48259. };
  48260. }
  48261. });
  48262. var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "transfer.vue"]]);
  48263. const ElTransfer = withInstall(Transfer);
  48264. const NODE_KEY = "$treeNodeId";
  48265. const markNodeData = function(node, data) {
  48266. if (!data || data[NODE_KEY])
  48267. return;
  48268. Object.defineProperty(data, NODE_KEY, {
  48269. value: node.id,
  48270. enumerable: false,
  48271. configurable: false,
  48272. writable: false
  48273. });
  48274. };
  48275. const getNodeKey = function(key, data) {
  48276. if (!key)
  48277. return data[NODE_KEY];
  48278. return data[key];
  48279. };
  48280. const handleCurrentChange = (store, emit, setCurrent) => {
  48281. const preCurrentNode = store.value.currentNode;
  48282. setCurrent();
  48283. const currentNode = store.value.currentNode;
  48284. if (preCurrentNode === currentNode)
  48285. return;
  48286. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  48287. };
  48288. const getChildState = (node) => {
  48289. let all = true;
  48290. let none = true;
  48291. let allWithoutDisable = true;
  48292. for (let i = 0, j = node.length; i < j; i++) {
  48293. const n = node[i];
  48294. if (n.checked !== true || n.indeterminate) {
  48295. all = false;
  48296. if (!n.disabled) {
  48297. allWithoutDisable = false;
  48298. }
  48299. }
  48300. if (n.checked !== false || n.indeterminate) {
  48301. none = false;
  48302. }
  48303. }
  48304. return { all, none, allWithoutDisable, half: !all && !none };
  48305. };
  48306. const reInitChecked = function(node) {
  48307. if (node.childNodes.length === 0 || node.loading)
  48308. return;
  48309. const { all, none, half } = getChildState(node.childNodes);
  48310. if (all) {
  48311. node.checked = true;
  48312. node.indeterminate = false;
  48313. } else if (half) {
  48314. node.checked = false;
  48315. node.indeterminate = true;
  48316. } else if (none) {
  48317. node.checked = false;
  48318. node.indeterminate = false;
  48319. }
  48320. const parent = node.parent;
  48321. if (!parent || parent.level === 0)
  48322. return;
  48323. if (!node.store.checkStrictly) {
  48324. reInitChecked(parent);
  48325. }
  48326. };
  48327. const getPropertyFromData = function(node, prop) {
  48328. const props = node.store.props;
  48329. const data = node.data || {};
  48330. const config = props[prop];
  48331. if (typeof config === "function") {
  48332. return config(data, node);
  48333. } else if (typeof config === "string") {
  48334. return data[config];
  48335. } else if (typeof config === "undefined") {
  48336. const dataProp = data[prop];
  48337. return dataProp === void 0 ? "" : dataProp;
  48338. }
  48339. };
  48340. let nodeIdSeed = 0;
  48341. class Node {
  48342. constructor(options) {
  48343. this.id = nodeIdSeed++;
  48344. this.text = null;
  48345. this.checked = false;
  48346. this.indeterminate = false;
  48347. this.data = null;
  48348. this.expanded = false;
  48349. this.parent = null;
  48350. this.visible = true;
  48351. this.isCurrent = false;
  48352. this.canFocus = false;
  48353. for (const name in options) {
  48354. if (hasOwn(options, name)) {
  48355. this[name] = options[name];
  48356. }
  48357. }
  48358. this.level = 0;
  48359. this.loaded = false;
  48360. this.childNodes = [];
  48361. this.loading = false;
  48362. if (this.parent) {
  48363. this.level = this.parent.level + 1;
  48364. }
  48365. }
  48366. initialize() {
  48367. const store = this.store;
  48368. if (!store) {
  48369. throw new Error("[Node]store is required!");
  48370. }
  48371. store.registerNode(this);
  48372. const props = store.props;
  48373. if (props && typeof props.isLeaf !== "undefined") {
  48374. const isLeaf = getPropertyFromData(this, "isLeaf");
  48375. if (typeof isLeaf === "boolean") {
  48376. this.isLeafByUser = isLeaf;
  48377. }
  48378. }
  48379. if (store.lazy !== true && this.data) {
  48380. this.setData(this.data);
  48381. if (store.defaultExpandAll) {
  48382. this.expanded = true;
  48383. this.canFocus = true;
  48384. }
  48385. } else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
  48386. this.expand();
  48387. }
  48388. if (!Array.isArray(this.data)) {
  48389. markNodeData(this, this.data);
  48390. }
  48391. if (!this.data)
  48392. return;
  48393. const defaultExpandedKeys = store.defaultExpandedKeys;
  48394. const key = store.key;
  48395. if (key && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  48396. this.expand(null, store.autoExpandParent);
  48397. }
  48398. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  48399. store.currentNode = this;
  48400. store.currentNode.isCurrent = true;
  48401. }
  48402. if (store.lazy) {
  48403. store._initDefaultCheckedNode(this);
  48404. }
  48405. this.updateLeafState();
  48406. if (this.parent && (this.level === 1 || this.parent.expanded === true))
  48407. this.canFocus = true;
  48408. }
  48409. setData(data) {
  48410. if (!Array.isArray(data)) {
  48411. markNodeData(this, data);
  48412. }
  48413. this.data = data;
  48414. this.childNodes = [];
  48415. let children;
  48416. if (this.level === 0 && Array.isArray(this.data)) {
  48417. children = this.data;
  48418. } else {
  48419. children = getPropertyFromData(this, "children") || [];
  48420. }
  48421. for (let i = 0, j = children.length; i < j; i++) {
  48422. this.insertChild({ data: children[i] });
  48423. }
  48424. }
  48425. get label() {
  48426. return getPropertyFromData(this, "label");
  48427. }
  48428. get key() {
  48429. const nodeKey = this.store.key;
  48430. if (this.data)
  48431. return this.data[nodeKey];
  48432. return null;
  48433. }
  48434. get disabled() {
  48435. return getPropertyFromData(this, "disabled");
  48436. }
  48437. get nextSibling() {
  48438. const parent = this.parent;
  48439. if (parent) {
  48440. const index = parent.childNodes.indexOf(this);
  48441. if (index > -1) {
  48442. return parent.childNodes[index + 1];
  48443. }
  48444. }
  48445. return null;
  48446. }
  48447. get previousSibling() {
  48448. const parent = this.parent;
  48449. if (parent) {
  48450. const index = parent.childNodes.indexOf(this);
  48451. if (index > -1) {
  48452. return index > 0 ? parent.childNodes[index - 1] : null;
  48453. }
  48454. }
  48455. return null;
  48456. }
  48457. contains(target, deep = true) {
  48458. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  48459. }
  48460. remove() {
  48461. const parent = this.parent;
  48462. if (parent) {
  48463. parent.removeChild(this);
  48464. }
  48465. }
  48466. insertChild(child, index, batch) {
  48467. if (!child)
  48468. throw new Error("InsertChild error: child is required.");
  48469. if (!(child instanceof Node)) {
  48470. if (!batch) {
  48471. const children = this.getChildren(true);
  48472. if (!children.includes(child.data)) {
  48473. if (typeof index === "undefined" || index < 0) {
  48474. children.push(child.data);
  48475. } else {
  48476. children.splice(index, 0, child.data);
  48477. }
  48478. }
  48479. }
  48480. Object.assign(child, {
  48481. parent: this,
  48482. store: this.store
  48483. });
  48484. child = vue.reactive(new Node(child));
  48485. if (child instanceof Node) {
  48486. child.initialize();
  48487. }
  48488. }
  48489. child.level = this.level + 1;
  48490. if (typeof index === "undefined" || index < 0) {
  48491. this.childNodes.push(child);
  48492. } else {
  48493. this.childNodes.splice(index, 0, child);
  48494. }
  48495. this.updateLeafState();
  48496. }
  48497. insertBefore(child, ref) {
  48498. let index;
  48499. if (ref) {
  48500. index = this.childNodes.indexOf(ref);
  48501. }
  48502. this.insertChild(child, index);
  48503. }
  48504. insertAfter(child, ref) {
  48505. let index;
  48506. if (ref) {
  48507. index = this.childNodes.indexOf(ref);
  48508. if (index !== -1)
  48509. index += 1;
  48510. }
  48511. this.insertChild(child, index);
  48512. }
  48513. removeChild(child) {
  48514. const children = this.getChildren() || [];
  48515. const dataIndex = children.indexOf(child.data);
  48516. if (dataIndex > -1) {
  48517. children.splice(dataIndex, 1);
  48518. }
  48519. const index = this.childNodes.indexOf(child);
  48520. if (index > -1) {
  48521. this.store && this.store.deregisterNode(child);
  48522. child.parent = null;
  48523. this.childNodes.splice(index, 1);
  48524. }
  48525. this.updateLeafState();
  48526. }
  48527. removeChildByData(data) {
  48528. let targetNode = null;
  48529. for (let i = 0; i < this.childNodes.length; i++) {
  48530. if (this.childNodes[i].data === data) {
  48531. targetNode = this.childNodes[i];
  48532. break;
  48533. }
  48534. }
  48535. if (targetNode) {
  48536. this.removeChild(targetNode);
  48537. }
  48538. }
  48539. expand(callback, expandParent) {
  48540. const done = () => {
  48541. if (expandParent) {
  48542. let parent = this.parent;
  48543. while (parent.level > 0) {
  48544. parent.expanded = true;
  48545. parent = parent.parent;
  48546. }
  48547. }
  48548. this.expanded = true;
  48549. if (callback)
  48550. callback();
  48551. this.childNodes.forEach((item) => {
  48552. item.canFocus = true;
  48553. });
  48554. };
  48555. if (this.shouldLoadData()) {
  48556. this.loadData((data) => {
  48557. if (Array.isArray(data)) {
  48558. if (this.checked) {
  48559. this.setChecked(true, true);
  48560. } else if (!this.store.checkStrictly) {
  48561. reInitChecked(this);
  48562. }
  48563. done();
  48564. }
  48565. });
  48566. } else {
  48567. done();
  48568. }
  48569. }
  48570. doCreateChildren(array, defaultProps = {}) {
  48571. array.forEach((item) => {
  48572. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  48573. });
  48574. }
  48575. collapse() {
  48576. this.expanded = false;
  48577. this.childNodes.forEach((item) => {
  48578. item.canFocus = false;
  48579. });
  48580. }
  48581. shouldLoadData() {
  48582. return this.store.lazy === true && this.store.load && !this.loaded;
  48583. }
  48584. updateLeafState() {
  48585. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  48586. this.isLeaf = this.isLeafByUser;
  48587. return;
  48588. }
  48589. const childNodes = this.childNodes;
  48590. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  48591. this.isLeaf = !childNodes || childNodes.length === 0;
  48592. return;
  48593. }
  48594. this.isLeaf = false;
  48595. }
  48596. setChecked(value, deep, recursion, passValue) {
  48597. this.indeterminate = value === "half";
  48598. this.checked = value === true;
  48599. if (this.store.checkStrictly)
  48600. return;
  48601. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  48602. const { all, allWithoutDisable } = getChildState(this.childNodes);
  48603. if (!this.isLeaf && !all && allWithoutDisable) {
  48604. this.checked = false;
  48605. value = false;
  48606. }
  48607. const handleDescendants = () => {
  48608. if (deep) {
  48609. const childNodes = this.childNodes;
  48610. for (let i = 0, j = childNodes.length; i < j; i++) {
  48611. const child = childNodes[i];
  48612. passValue = passValue || value !== false;
  48613. const isCheck = child.disabled ? child.checked : passValue;
  48614. child.setChecked(isCheck, deep, true, passValue);
  48615. }
  48616. const { half, all: all2 } = getChildState(childNodes);
  48617. if (!all2) {
  48618. this.checked = all2;
  48619. this.indeterminate = half;
  48620. }
  48621. }
  48622. };
  48623. if (this.shouldLoadData()) {
  48624. this.loadData(() => {
  48625. handleDescendants();
  48626. reInitChecked(this);
  48627. }, {
  48628. checked: value !== false
  48629. });
  48630. return;
  48631. } else {
  48632. handleDescendants();
  48633. }
  48634. }
  48635. const parent = this.parent;
  48636. if (!parent || parent.level === 0)
  48637. return;
  48638. if (!recursion) {
  48639. reInitChecked(parent);
  48640. }
  48641. }
  48642. getChildren(forceInit = false) {
  48643. if (this.level === 0)
  48644. return this.data;
  48645. const data = this.data;
  48646. if (!data)
  48647. return null;
  48648. const props = this.store.props;
  48649. let children = "children";
  48650. if (props) {
  48651. children = props.children || "children";
  48652. }
  48653. if (data[children] === void 0) {
  48654. data[children] = null;
  48655. }
  48656. if (forceInit && !data[children]) {
  48657. data[children] = [];
  48658. }
  48659. return data[children];
  48660. }
  48661. updateChildren() {
  48662. const newData = this.getChildren() || [];
  48663. const oldData = this.childNodes.map((node) => node.data);
  48664. const newDataMap = {};
  48665. const newNodes = [];
  48666. newData.forEach((item, index) => {
  48667. const key = item[NODE_KEY];
  48668. const isNodeExists = !!key && oldData.findIndex((data) => data[NODE_KEY] === key) >= 0;
  48669. if (isNodeExists) {
  48670. newDataMap[key] = { index, data: item };
  48671. } else {
  48672. newNodes.push({ index, data: item });
  48673. }
  48674. });
  48675. if (!this.store.lazy) {
  48676. oldData.forEach((item) => {
  48677. if (!newDataMap[item[NODE_KEY]])
  48678. this.removeChildByData(item);
  48679. });
  48680. }
  48681. newNodes.forEach(({ index, data }) => {
  48682. this.insertChild({ data }, index);
  48683. });
  48684. this.updateLeafState();
  48685. }
  48686. loadData(callback, defaultProps = {}) {
  48687. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  48688. this.loading = true;
  48689. const resolve = (children) => {
  48690. this.childNodes = [];
  48691. this.doCreateChildren(children, defaultProps);
  48692. this.loaded = true;
  48693. this.loading = false;
  48694. this.updateLeafState();
  48695. if (callback) {
  48696. callback.call(this, children);
  48697. }
  48698. };
  48699. this.store.load(this, resolve);
  48700. } else {
  48701. if (callback) {
  48702. callback.call(this);
  48703. }
  48704. }
  48705. }
  48706. }
  48707. var Node$1 = Node;
  48708. class TreeStore {
  48709. constructor(options) {
  48710. this.currentNode = null;
  48711. this.currentNodeKey = null;
  48712. for (const option in options) {
  48713. if (hasOwn(options, option)) {
  48714. this[option] = options[option];
  48715. }
  48716. }
  48717. this.nodesMap = {};
  48718. }
  48719. initialize() {
  48720. this.root = new Node$1({
  48721. data: this.data,
  48722. store: this
  48723. });
  48724. this.root.initialize();
  48725. if (this.lazy && this.load) {
  48726. const loadFn = this.load;
  48727. loadFn(this.root, (data) => {
  48728. this.root.doCreateChildren(data);
  48729. this._initDefaultCheckedNodes();
  48730. });
  48731. } else {
  48732. this._initDefaultCheckedNodes();
  48733. }
  48734. }
  48735. filter(value) {
  48736. const filterNodeMethod = this.filterNodeMethod;
  48737. const lazy = this.lazy;
  48738. const traverse = function(node) {
  48739. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  48740. childNodes.forEach((child) => {
  48741. child.visible = filterNodeMethod.call(child, value, child.data, child);
  48742. traverse(child);
  48743. });
  48744. if (!node.visible && childNodes.length) {
  48745. let allHidden = true;
  48746. allHidden = !childNodes.some((child) => child.visible);
  48747. if (node.root) {
  48748. node.root.visible = allHidden === false;
  48749. } else {
  48750. node.visible = allHidden === false;
  48751. }
  48752. }
  48753. if (!value)
  48754. return;
  48755. if (node.visible && !node.isLeaf && !lazy)
  48756. node.expand();
  48757. };
  48758. traverse(this);
  48759. }
  48760. setData(newVal) {
  48761. const instanceChanged = newVal !== this.root.data;
  48762. if (instanceChanged) {
  48763. this.root.setData(newVal);
  48764. this._initDefaultCheckedNodes();
  48765. } else {
  48766. this.root.updateChildren();
  48767. }
  48768. }
  48769. getNode(data) {
  48770. if (data instanceof Node$1)
  48771. return data;
  48772. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  48773. return this.nodesMap[key] || null;
  48774. }
  48775. insertBefore(data, refData) {
  48776. const refNode = this.getNode(refData);
  48777. refNode.parent.insertBefore({ data }, refNode);
  48778. }
  48779. insertAfter(data, refData) {
  48780. const refNode = this.getNode(refData);
  48781. refNode.parent.insertAfter({ data }, refNode);
  48782. }
  48783. remove(data) {
  48784. const node = this.getNode(data);
  48785. if (node && node.parent) {
  48786. if (node === this.currentNode) {
  48787. this.currentNode = null;
  48788. }
  48789. node.parent.removeChild(node);
  48790. }
  48791. }
  48792. append(data, parentData) {
  48793. const parentNode = parentData ? this.getNode(parentData) : this.root;
  48794. if (parentNode) {
  48795. parentNode.insertChild({ data });
  48796. }
  48797. }
  48798. _initDefaultCheckedNodes() {
  48799. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  48800. const nodesMap = this.nodesMap;
  48801. defaultCheckedKeys.forEach((checkedKey) => {
  48802. const node = nodesMap[checkedKey];
  48803. if (node) {
  48804. node.setChecked(true, !this.checkStrictly);
  48805. }
  48806. });
  48807. }
  48808. _initDefaultCheckedNode(node) {
  48809. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  48810. if (defaultCheckedKeys.includes(node.key)) {
  48811. node.setChecked(true, !this.checkStrictly);
  48812. }
  48813. }
  48814. setDefaultCheckedKey(newVal) {
  48815. if (newVal !== this.defaultCheckedKeys) {
  48816. this.defaultCheckedKeys = newVal;
  48817. this._initDefaultCheckedNodes();
  48818. }
  48819. }
  48820. registerNode(node) {
  48821. const key = this.key;
  48822. if (!node || !node.data)
  48823. return;
  48824. if (!key) {
  48825. this.nodesMap[node.id] = node;
  48826. } else {
  48827. const nodeKey = node.key;
  48828. if (nodeKey !== void 0)
  48829. this.nodesMap[node.key] = node;
  48830. }
  48831. }
  48832. deregisterNode(node) {
  48833. const key = this.key;
  48834. if (!key || !node || !node.data)
  48835. return;
  48836. node.childNodes.forEach((child) => {
  48837. this.deregisterNode(child);
  48838. });
  48839. delete this.nodesMap[node.key];
  48840. }
  48841. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  48842. const checkedNodes = [];
  48843. const traverse = function(node) {
  48844. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  48845. childNodes.forEach((child) => {
  48846. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  48847. checkedNodes.push(child.data);
  48848. }
  48849. traverse(child);
  48850. });
  48851. };
  48852. traverse(this);
  48853. return checkedNodes;
  48854. }
  48855. getCheckedKeys(leafOnly = false) {
  48856. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  48857. }
  48858. getHalfCheckedNodes() {
  48859. const nodes = [];
  48860. const traverse = function(node) {
  48861. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  48862. childNodes.forEach((child) => {
  48863. if (child.indeterminate) {
  48864. nodes.push(child.data);
  48865. }
  48866. traverse(child);
  48867. });
  48868. };
  48869. traverse(this);
  48870. return nodes;
  48871. }
  48872. getHalfCheckedKeys() {
  48873. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  48874. }
  48875. _getAllNodes() {
  48876. const allNodes = [];
  48877. const nodesMap = this.nodesMap;
  48878. for (const nodeKey in nodesMap) {
  48879. if (hasOwn(nodesMap, nodeKey)) {
  48880. allNodes.push(nodesMap[nodeKey]);
  48881. }
  48882. }
  48883. return allNodes;
  48884. }
  48885. updateChildren(key, data) {
  48886. const node = this.nodesMap[key];
  48887. if (!node)
  48888. return;
  48889. const childNodes = node.childNodes;
  48890. for (let i = childNodes.length - 1; i >= 0; i--) {
  48891. const child = childNodes[i];
  48892. this.remove(child.data);
  48893. }
  48894. for (let i = 0, j = data.length; i < j; i++) {
  48895. const child = data[i];
  48896. this.append(child, node.data);
  48897. }
  48898. }
  48899. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  48900. const allNodes = this._getAllNodes().sort((a, b) => b.level - a.level);
  48901. const cache = /* @__PURE__ */ Object.create(null);
  48902. const keys = Object.keys(checkedKeys);
  48903. allNodes.forEach((node) => node.setChecked(false, false));
  48904. for (let i = 0, j = allNodes.length; i < j; i++) {
  48905. const node = allNodes[i];
  48906. const nodeKey = node.data[key].toString();
  48907. const checked = keys.includes(nodeKey);
  48908. if (!checked) {
  48909. if (node.checked && !cache[nodeKey]) {
  48910. node.setChecked(false, false);
  48911. }
  48912. continue;
  48913. }
  48914. let parent = node.parent;
  48915. while (parent && parent.level > 0) {
  48916. cache[parent.data[key]] = true;
  48917. parent = parent.parent;
  48918. }
  48919. if (node.isLeaf || this.checkStrictly) {
  48920. node.setChecked(true, false);
  48921. continue;
  48922. }
  48923. node.setChecked(true, true);
  48924. if (leafOnly) {
  48925. node.setChecked(false, false);
  48926. const traverse = function(node2) {
  48927. const childNodes = node2.childNodes;
  48928. childNodes.forEach((child) => {
  48929. if (!child.isLeaf) {
  48930. child.setChecked(false, false);
  48931. }
  48932. traverse(child);
  48933. });
  48934. };
  48935. traverse(node);
  48936. }
  48937. }
  48938. }
  48939. setCheckedNodes(array, leafOnly = false) {
  48940. const key = this.key;
  48941. const checkedKeys = {};
  48942. array.forEach((item) => {
  48943. checkedKeys[(item || {})[key]] = true;
  48944. });
  48945. this._setCheckedKeys(key, leafOnly, checkedKeys);
  48946. }
  48947. setCheckedKeys(keys, leafOnly = false) {
  48948. this.defaultCheckedKeys = keys;
  48949. const key = this.key;
  48950. const checkedKeys = {};
  48951. keys.forEach((key2) => {
  48952. checkedKeys[key2] = true;
  48953. });
  48954. this._setCheckedKeys(key, leafOnly, checkedKeys);
  48955. }
  48956. setDefaultExpandedKeys(keys) {
  48957. keys = keys || [];
  48958. this.defaultExpandedKeys = keys;
  48959. keys.forEach((key) => {
  48960. const node = this.getNode(key);
  48961. if (node)
  48962. node.expand(null, this.autoExpandParent);
  48963. });
  48964. }
  48965. setChecked(data, checked, deep) {
  48966. const node = this.getNode(data);
  48967. if (node) {
  48968. node.setChecked(!!checked, deep);
  48969. }
  48970. }
  48971. getCurrentNode() {
  48972. return this.currentNode;
  48973. }
  48974. setCurrentNode(currentNode) {
  48975. const prevCurrentNode = this.currentNode;
  48976. if (prevCurrentNode) {
  48977. prevCurrentNode.isCurrent = false;
  48978. }
  48979. this.currentNode = currentNode;
  48980. this.currentNode.isCurrent = true;
  48981. }
  48982. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  48983. const key = node[this.key];
  48984. const currNode = this.nodesMap[key];
  48985. this.setCurrentNode(currNode);
  48986. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  48987. this.currentNode.parent.expand(null, true);
  48988. }
  48989. }
  48990. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  48991. if (key === null || key === void 0) {
  48992. this.currentNode && (this.currentNode.isCurrent = false);
  48993. this.currentNode = null;
  48994. return;
  48995. }
  48996. const node = this.getNode(key);
  48997. if (node) {
  48998. this.setCurrentNode(node);
  48999. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  49000. this.currentNode.parent.expand(null, true);
  49001. }
  49002. }
  49003. }
  49004. }
  49005. const _sfc_main$c = vue.defineComponent({
  49006. name: "ElTreeNodeContent",
  49007. props: {
  49008. node: {
  49009. type: Object,
  49010. required: true
  49011. },
  49012. renderContent: Function
  49013. },
  49014. setup(props) {
  49015. const ns = useNamespace("tree");
  49016. const nodeInstance = vue.inject("NodeInstance");
  49017. const tree = vue.inject("RootTree");
  49018. return () => {
  49019. const node = props.node;
  49020. const { data, store } = node;
  49021. return props.renderContent ? props.renderContent(vue.h, { _self: nodeInstance, node, data, store }) : vue.h("span", { class: ns.be("node", "label") }, [
  49022. tree.ctx.slots.default ? tree.ctx.slots.default({ node, data }) : node.label
  49023. ]);
  49024. };
  49025. }
  49026. });
  49027. var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "tree-node-content.vue"]]);
  49028. function useNodeExpandEventBroadcast(props) {
  49029. const parentNodeMap = vue.inject("TreeNodeMap", null);
  49030. const currentNodeMap = {
  49031. treeNodeExpand: (node) => {
  49032. if (props.node !== node) {
  49033. props.node.collapse();
  49034. }
  49035. },
  49036. children: []
  49037. };
  49038. if (parentNodeMap) {
  49039. parentNodeMap.children.push(currentNodeMap);
  49040. }
  49041. vue.provide("TreeNodeMap", currentNodeMap);
  49042. return {
  49043. broadcastExpanded: (node) => {
  49044. if (!props.accordion)
  49045. return;
  49046. for (const childNode of currentNodeMap.children) {
  49047. childNode.treeNodeExpand(node);
  49048. }
  49049. }
  49050. };
  49051. }
  49052. const dragEventsKey = Symbol("dragEvents");
  49053. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  49054. const ns = useNamespace("tree");
  49055. const dragState = vue.ref({
  49056. showDropIndicator: false,
  49057. draggingNode: null,
  49058. dropNode: null,
  49059. allowDrop: true,
  49060. dropType: null
  49061. });
  49062. const treeNodeDragStart = ({ event, treeNode }) => {
  49063. if (typeof props.allowDrag === "function" && !props.allowDrag(treeNode.node)) {
  49064. event.preventDefault();
  49065. return false;
  49066. }
  49067. event.dataTransfer.effectAllowed = "move";
  49068. try {
  49069. event.dataTransfer.setData("text/plain", "");
  49070. } catch (e) {
  49071. }
  49072. dragState.value.draggingNode = treeNode;
  49073. ctx.emit("node-drag-start", treeNode.node, event);
  49074. };
  49075. const treeNodeDragOver = ({ event, treeNode }) => {
  49076. const dropNode = treeNode;
  49077. const oldDropNode = dragState.value.dropNode;
  49078. if (oldDropNode && oldDropNode !== dropNode) {
  49079. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  49080. }
  49081. const draggingNode = dragState.value.draggingNode;
  49082. if (!draggingNode || !dropNode)
  49083. return;
  49084. let dropPrev = true;
  49085. let dropInner = true;
  49086. let dropNext = true;
  49087. let userAllowDropInner = true;
  49088. if (typeof props.allowDrop === "function") {
  49089. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  49090. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  49091. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  49092. }
  49093. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  49094. if ((dropPrev || dropInner || dropNext) && oldDropNode !== dropNode) {
  49095. if (oldDropNode) {
  49096. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  49097. }
  49098. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  49099. }
  49100. if (dropPrev || dropInner || dropNext) {
  49101. dragState.value.dropNode = dropNode;
  49102. }
  49103. if (dropNode.node.nextSibling === draggingNode.node) {
  49104. dropNext = false;
  49105. }
  49106. if (dropNode.node.previousSibling === draggingNode.node) {
  49107. dropPrev = false;
  49108. }
  49109. if (dropNode.node.contains(draggingNode.node, false)) {
  49110. dropInner = false;
  49111. }
  49112. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  49113. dropPrev = false;
  49114. dropInner = false;
  49115. dropNext = false;
  49116. }
  49117. const targetPosition = dropNode.$el.getBoundingClientRect();
  49118. const treePosition = el$.value.getBoundingClientRect();
  49119. let dropType;
  49120. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
  49121. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
  49122. let indicatorTop = -9999;
  49123. const distance = event.clientY - targetPosition.top;
  49124. if (distance < targetPosition.height * prevPercent) {
  49125. dropType = "before";
  49126. } else if (distance > targetPosition.height * nextPercent) {
  49127. dropType = "after";
  49128. } else if (dropInner) {
  49129. dropType = "inner";
  49130. } else {
  49131. dropType = "none";
  49132. }
  49133. const iconPosition = dropNode.$el.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  49134. const dropIndicator = dropIndicator$.value;
  49135. if (dropType === "before") {
  49136. indicatorTop = iconPosition.top - treePosition.top;
  49137. } else if (dropType === "after") {
  49138. indicatorTop = iconPosition.bottom - treePosition.top;
  49139. }
  49140. dropIndicator.style.top = `${indicatorTop}px`;
  49141. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  49142. if (dropType === "inner") {
  49143. addClass(dropNode.$el, ns.is("drop-inner"));
  49144. } else {
  49145. removeClass(dropNode.$el, ns.is("drop-inner"));
  49146. }
  49147. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  49148. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  49149. dragState.value.dropType = dropType;
  49150. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  49151. };
  49152. const treeNodeDragEnd = (event) => {
  49153. const { draggingNode, dropType, dropNode } = dragState.value;
  49154. event.preventDefault();
  49155. event.dataTransfer.dropEffect = "move";
  49156. if (draggingNode && dropNode) {
  49157. const draggingNodeCopy = { data: draggingNode.node.data };
  49158. if (dropType !== "none") {
  49159. draggingNode.node.remove();
  49160. }
  49161. if (dropType === "before") {
  49162. dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
  49163. } else if (dropType === "after") {
  49164. dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
  49165. } else if (dropType === "inner") {
  49166. dropNode.node.insertChild(draggingNodeCopy);
  49167. }
  49168. if (dropType !== "none") {
  49169. store.value.registerNode(draggingNodeCopy);
  49170. }
  49171. removeClass(dropNode.$el, ns.is("drop-inner"));
  49172. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  49173. if (dropType !== "none") {
  49174. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  49175. }
  49176. }
  49177. if (draggingNode && !dropNode) {
  49178. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  49179. }
  49180. dragState.value.showDropIndicator = false;
  49181. dragState.value.draggingNode = null;
  49182. dragState.value.dropNode = null;
  49183. dragState.value.allowDrop = true;
  49184. };
  49185. vue.provide(dragEventsKey, {
  49186. treeNodeDragStart,
  49187. treeNodeDragOver,
  49188. treeNodeDragEnd
  49189. });
  49190. return {
  49191. dragState
  49192. };
  49193. }
  49194. const _sfc_main$b = vue.defineComponent({
  49195. name: "ElTreeNode",
  49196. components: {
  49197. ElCollapseTransition: _CollapseTransition,
  49198. ElCheckbox,
  49199. NodeContent,
  49200. ElIcon,
  49201. Loading: loading_default
  49202. },
  49203. props: {
  49204. node: {
  49205. type: Node$1,
  49206. default: () => ({})
  49207. },
  49208. props: {
  49209. type: Object,
  49210. default: () => ({})
  49211. },
  49212. accordion: Boolean,
  49213. renderContent: Function,
  49214. renderAfterExpand: Boolean,
  49215. showCheckbox: {
  49216. type: Boolean,
  49217. default: false
  49218. }
  49219. },
  49220. emits: ["node-expand"],
  49221. setup(props, ctx) {
  49222. const ns = useNamespace("tree");
  49223. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  49224. const tree = vue.inject("RootTree");
  49225. const expanded = vue.ref(false);
  49226. const childNodeRendered = vue.ref(false);
  49227. const oldChecked = vue.ref(null);
  49228. const oldIndeterminate = vue.ref(null);
  49229. const node$ = vue.ref(null);
  49230. const dragEvents = vue.inject(dragEventsKey);
  49231. const instance = vue.getCurrentInstance();
  49232. vue.provide("NodeInstance", instance);
  49233. if (props.node.expanded) {
  49234. expanded.value = true;
  49235. childNodeRendered.value = true;
  49236. }
  49237. const childrenKey = tree.props["children"] || "children";
  49238. vue.watch(() => {
  49239. const children = props.node.data[childrenKey];
  49240. return children && [...children];
  49241. }, () => {
  49242. props.node.updateChildren();
  49243. });
  49244. vue.watch(() => props.node.indeterminate, (val) => {
  49245. handleSelectChange(props.node.checked, val);
  49246. });
  49247. vue.watch(() => props.node.checked, (val) => {
  49248. handleSelectChange(val, props.node.indeterminate);
  49249. });
  49250. vue.watch(() => props.node.expanded, (val) => {
  49251. vue.nextTick(() => expanded.value = val);
  49252. if (val) {
  49253. childNodeRendered.value = true;
  49254. }
  49255. });
  49256. const getNodeKey$1 = (node) => {
  49257. return getNodeKey(tree.props.nodeKey, node.data);
  49258. };
  49259. const getNodeClass = (node) => {
  49260. const nodeClassFunc = props.props.class;
  49261. if (!nodeClassFunc) {
  49262. return {};
  49263. }
  49264. let className;
  49265. if (isFunction(nodeClassFunc)) {
  49266. const { data } = node;
  49267. className = nodeClassFunc(data, node);
  49268. } else {
  49269. className = nodeClassFunc;
  49270. }
  49271. if (isString(className)) {
  49272. return { [className]: true };
  49273. } else {
  49274. return className;
  49275. }
  49276. };
  49277. const handleSelectChange = (checked, indeterminate) => {
  49278. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  49279. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  49280. }
  49281. oldChecked.value = checked;
  49282. oldIndeterminate.value = indeterminate;
  49283. };
  49284. const handleClick = (e) => {
  49285. handleCurrentChange(tree.store, tree.ctx.emit, () => tree.store.value.setCurrentNode(props.node));
  49286. tree.currentNode.value = props.node;
  49287. if (tree.props.expandOnClickNode) {
  49288. handleExpandIconClick();
  49289. }
  49290. if (tree.props.checkOnClickNode && !props.node.disabled) {
  49291. handleCheckChange(null, {
  49292. target: { checked: !props.node.checked }
  49293. });
  49294. }
  49295. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  49296. };
  49297. const handleContextMenu = (event) => {
  49298. if (tree.instance.vnode.props["onNodeContextmenu"]) {
  49299. event.stopPropagation();
  49300. event.preventDefault();
  49301. }
  49302. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  49303. };
  49304. const handleExpandIconClick = () => {
  49305. if (props.node.isLeaf)
  49306. return;
  49307. if (expanded.value) {
  49308. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  49309. props.node.collapse();
  49310. } else {
  49311. props.node.expand();
  49312. ctx.emit("node-expand", props.node.data, props.node, instance);
  49313. }
  49314. };
  49315. const handleCheckChange = (value, ev) => {
  49316. props.node.setChecked(ev.target.checked, !tree.props.checkStrictly);
  49317. vue.nextTick(() => {
  49318. const store = tree.store.value;
  49319. tree.ctx.emit("check", props.node.data, {
  49320. checkedNodes: store.getCheckedNodes(),
  49321. checkedKeys: store.getCheckedKeys(),
  49322. halfCheckedNodes: store.getHalfCheckedNodes(),
  49323. halfCheckedKeys: store.getHalfCheckedKeys()
  49324. });
  49325. });
  49326. };
  49327. const handleChildNodeExpand = (nodeData, node, instance2) => {
  49328. broadcastExpanded(node);
  49329. tree.ctx.emit("node-expand", nodeData, node, instance2);
  49330. };
  49331. const handleDragStart = (event) => {
  49332. if (!tree.props.draggable)
  49333. return;
  49334. dragEvents.treeNodeDragStart({ event, treeNode: props });
  49335. };
  49336. const handleDragOver = (event) => {
  49337. event.preventDefault();
  49338. if (!tree.props.draggable)
  49339. return;
  49340. dragEvents.treeNodeDragOver({
  49341. event,
  49342. treeNode: { $el: node$.value, node: props.node }
  49343. });
  49344. };
  49345. const handleDrop = (event) => {
  49346. event.preventDefault();
  49347. };
  49348. const handleDragEnd = (event) => {
  49349. if (!tree.props.draggable)
  49350. return;
  49351. dragEvents.treeNodeDragEnd(event);
  49352. };
  49353. return {
  49354. ns,
  49355. node$,
  49356. tree,
  49357. expanded,
  49358. childNodeRendered,
  49359. oldChecked,
  49360. oldIndeterminate,
  49361. getNodeKey: getNodeKey$1,
  49362. getNodeClass,
  49363. handleSelectChange,
  49364. handleClick,
  49365. handleContextMenu,
  49366. handleExpandIconClick,
  49367. handleCheckChange,
  49368. handleChildNodeExpand,
  49369. handleDragStart,
  49370. handleDragOver,
  49371. handleDrop,
  49372. handleDragEnd,
  49373. CaretRight: caret_right_default
  49374. };
  49375. }
  49376. });
  49377. const _hoisted_1$7 = ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key"];
  49378. const _hoisted_2$5 = ["aria-expanded"];
  49379. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  49380. const _component_el_icon = vue.resolveComponent("el-icon");
  49381. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  49382. const _component_loading = vue.resolveComponent("loading");
  49383. const _component_node_content = vue.resolveComponent("node-content");
  49384. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  49385. const _component_el_collapse_transition = vue.resolveComponent("el-collapse-transition");
  49386. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  49387. ref: "node$",
  49388. class: vue.normalizeClass([
  49389. _ctx.ns.b("node"),
  49390. _ctx.ns.is("expanded", _ctx.expanded),
  49391. _ctx.ns.is("current", _ctx.node.isCurrent),
  49392. _ctx.ns.is("hidden", !_ctx.node.visible),
  49393. _ctx.ns.is("focusable", !_ctx.node.disabled),
  49394. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  49395. _ctx.getNodeClass(_ctx.node)
  49396. ]),
  49397. role: "treeitem",
  49398. tabindex: "-1",
  49399. "aria-expanded": _ctx.expanded,
  49400. "aria-disabled": _ctx.node.disabled,
  49401. "aria-checked": _ctx.node.checked,
  49402. draggable: _ctx.tree.props.draggable,
  49403. "data-key": _ctx.getNodeKey(_ctx.node),
  49404. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"])),
  49405. onContextmenu: _cache[2] || (_cache[2] = (...args) => _ctx.handleContextMenu && _ctx.handleContextMenu(...args)),
  49406. onDragstart: _cache[3] || (_cache[3] = vue.withModifiers((...args) => _ctx.handleDragStart && _ctx.handleDragStart(...args), ["stop"])),
  49407. onDragover: _cache[4] || (_cache[4] = vue.withModifiers((...args) => _ctx.handleDragOver && _ctx.handleDragOver(...args), ["stop"])),
  49408. onDragend: _cache[5] || (_cache[5] = vue.withModifiers((...args) => _ctx.handleDragEnd && _ctx.handleDragEnd(...args), ["stop"])),
  49409. onDrop: _cache[6] || (_cache[6] = vue.withModifiers((...args) => _ctx.handleDrop && _ctx.handleDrop(...args), ["stop"]))
  49410. }, [
  49411. vue.createElementVNode("div", {
  49412. class: vue.normalizeClass(_ctx.ns.be("node", "content")),
  49413. style: vue.normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  49414. }, [
  49415. _ctx.tree.props.icon || _ctx.CaretRight ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  49416. key: 0,
  49417. class: vue.normalizeClass([
  49418. _ctx.ns.be("node", "expand-icon"),
  49419. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  49420. {
  49421. expanded: !_ctx.node.isLeaf && _ctx.expanded
  49422. }
  49423. ]),
  49424. onClick: vue.withModifiers(_ctx.handleExpandIconClick, ["stop"])
  49425. }, {
  49426. default: vue.withCtx(() => [
  49427. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  49428. ]),
  49429. _: 1
  49430. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  49431. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  49432. key: 1,
  49433. "model-value": _ctx.node.checked,
  49434. indeterminate: _ctx.node.indeterminate,
  49435. disabled: !!_ctx.node.disabled,
  49436. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  49437. }, ["stop"])),
  49438. onChange: _ctx.handleCheckChange
  49439. }, null, 8, ["model-value", "indeterminate", "disabled", "onChange"])) : vue.createCommentVNode("v-if", true),
  49440. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  49441. key: 2,
  49442. class: vue.normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  49443. }, {
  49444. default: vue.withCtx(() => [
  49445. vue.createVNode(_component_loading)
  49446. ]),
  49447. _: 1
  49448. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  49449. vue.createVNode(_component_node_content, {
  49450. node: _ctx.node,
  49451. "render-content": _ctx.renderContent
  49452. }, null, 8, ["node", "render-content"])
  49453. ], 6),
  49454. vue.createVNode(_component_el_collapse_transition, null, {
  49455. default: vue.withCtx(() => [
  49456. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  49457. key: 0,
  49458. class: vue.normalizeClass(_ctx.ns.be("node", "children")),
  49459. role: "group",
  49460. "aria-expanded": _ctx.expanded
  49461. }, [
  49462. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.node.childNodes, (child) => {
  49463. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  49464. key: _ctx.getNodeKey(child),
  49465. "render-content": _ctx.renderContent,
  49466. "render-after-expand": _ctx.renderAfterExpand,
  49467. "show-checkbox": _ctx.showCheckbox,
  49468. node: child,
  49469. accordion: _ctx.accordion,
  49470. props: _ctx.props,
  49471. onNodeExpand: _ctx.handleChildNodeExpand
  49472. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  49473. }), 128))
  49474. ], 10, _hoisted_2$5)), [
  49475. [vue.vShow, _ctx.expanded]
  49476. ]) : vue.createCommentVNode("v-if", true)
  49477. ]),
  49478. _: 1
  49479. })
  49480. ], 42, _hoisted_1$7)), [
  49481. [vue.vShow, _ctx.node.visible]
  49482. ]);
  49483. }
  49484. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]);
  49485. function useKeydown({ el$ }, store) {
  49486. const ns = useNamespace("tree");
  49487. const treeItems = vue.shallowRef([]);
  49488. const checkboxItems = vue.shallowRef([]);
  49489. vue.onMounted(() => {
  49490. initTabIndex();
  49491. });
  49492. vue.onUpdated(() => {
  49493. treeItems.value = Array.from(el$.value.querySelectorAll("[role=treeitem]"));
  49494. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  49495. });
  49496. vue.watch(checkboxItems, (val) => {
  49497. val.forEach((checkbox) => {
  49498. checkbox.setAttribute("tabindex", "-1");
  49499. });
  49500. });
  49501. const handleKeydown = (ev) => {
  49502. const currentItem = ev.target;
  49503. if (!currentItem.className.includes(ns.b("node")))
  49504. return;
  49505. const code = ev.code;
  49506. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  49507. const currentIndex = treeItems.value.indexOf(currentItem);
  49508. let nextIndex;
  49509. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  49510. ev.preventDefault();
  49511. if (code === EVENT_CODE.up) {
  49512. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.value.length - 1;
  49513. const startIndex = nextIndex;
  49514. while (true) {
  49515. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  49516. break;
  49517. nextIndex--;
  49518. if (nextIndex === startIndex) {
  49519. nextIndex = -1;
  49520. break;
  49521. }
  49522. if (nextIndex < 0) {
  49523. nextIndex = treeItems.value.length - 1;
  49524. }
  49525. }
  49526. } else {
  49527. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.value.length - 1 ? currentIndex + 1 : 0;
  49528. const startIndex = nextIndex;
  49529. while (true) {
  49530. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  49531. break;
  49532. nextIndex++;
  49533. if (nextIndex === startIndex) {
  49534. nextIndex = -1;
  49535. break;
  49536. }
  49537. if (nextIndex >= treeItems.value.length) {
  49538. nextIndex = 0;
  49539. }
  49540. }
  49541. }
  49542. nextIndex !== -1 && treeItems.value[nextIndex].focus();
  49543. }
  49544. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  49545. ev.preventDefault();
  49546. currentItem.click();
  49547. }
  49548. const hasInput = currentItem.querySelector('[type="checkbox"]');
  49549. if ([EVENT_CODE.enter, EVENT_CODE.space].includes(code) && hasInput) {
  49550. ev.preventDefault();
  49551. hasInput.click();
  49552. }
  49553. };
  49554. useEventListener(el$, "keydown", handleKeydown);
  49555. const initTabIndex = () => {
  49556. var _a;
  49557. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  49558. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  49559. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  49560. if (checkedItem.length) {
  49561. checkedItem[0].setAttribute("tabindex", "0");
  49562. return;
  49563. }
  49564. (_a = treeItems.value[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
  49565. };
  49566. }
  49567. const _sfc_main$a = vue.defineComponent({
  49568. name: "ElTree",
  49569. components: { ElTreeNode: ElTreeNode$1 },
  49570. props: {
  49571. data: {
  49572. type: Array,
  49573. default: () => []
  49574. },
  49575. emptyText: {
  49576. type: String
  49577. },
  49578. renderAfterExpand: {
  49579. type: Boolean,
  49580. default: true
  49581. },
  49582. nodeKey: String,
  49583. checkStrictly: Boolean,
  49584. defaultExpandAll: Boolean,
  49585. expandOnClickNode: {
  49586. type: Boolean,
  49587. default: true
  49588. },
  49589. checkOnClickNode: Boolean,
  49590. checkDescendants: {
  49591. type: Boolean,
  49592. default: false
  49593. },
  49594. autoExpandParent: {
  49595. type: Boolean,
  49596. default: true
  49597. },
  49598. defaultCheckedKeys: Array,
  49599. defaultExpandedKeys: Array,
  49600. currentNodeKey: [String, Number],
  49601. renderContent: Function,
  49602. showCheckbox: {
  49603. type: Boolean,
  49604. default: false
  49605. },
  49606. draggable: {
  49607. type: Boolean,
  49608. default: false
  49609. },
  49610. allowDrag: Function,
  49611. allowDrop: Function,
  49612. props: {
  49613. type: Object,
  49614. default: () => ({
  49615. children: "children",
  49616. label: "label",
  49617. disabled: "disabled"
  49618. })
  49619. },
  49620. lazy: {
  49621. type: Boolean,
  49622. default: false
  49623. },
  49624. highlightCurrent: Boolean,
  49625. load: Function,
  49626. filterNodeMethod: Function,
  49627. accordion: Boolean,
  49628. indent: {
  49629. type: Number,
  49630. default: 18
  49631. },
  49632. icon: {
  49633. type: iconPropType
  49634. }
  49635. },
  49636. emits: [
  49637. "check-change",
  49638. "current-change",
  49639. "node-click",
  49640. "node-contextmenu",
  49641. "node-collapse",
  49642. "node-expand",
  49643. "check",
  49644. "node-drag-start",
  49645. "node-drag-end",
  49646. "node-drop",
  49647. "node-drag-leave",
  49648. "node-drag-enter",
  49649. "node-drag-over"
  49650. ],
  49651. setup(props, ctx) {
  49652. const { t } = useLocale();
  49653. const ns = useNamespace("tree");
  49654. const store = vue.ref(new TreeStore({
  49655. key: props.nodeKey,
  49656. data: props.data,
  49657. lazy: props.lazy,
  49658. props: props.props,
  49659. load: props.load,
  49660. currentNodeKey: props.currentNodeKey,
  49661. checkStrictly: props.checkStrictly,
  49662. checkDescendants: props.checkDescendants,
  49663. defaultCheckedKeys: props.defaultCheckedKeys,
  49664. defaultExpandedKeys: props.defaultExpandedKeys,
  49665. autoExpandParent: props.autoExpandParent,
  49666. defaultExpandAll: props.defaultExpandAll,
  49667. filterNodeMethod: props.filterNodeMethod
  49668. }));
  49669. store.value.initialize();
  49670. const root = vue.ref(store.value.root);
  49671. const currentNode = vue.ref(null);
  49672. const el$ = vue.ref(null);
  49673. const dropIndicator$ = vue.ref(null);
  49674. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  49675. const { dragState } = useDragNodeHandler({
  49676. props,
  49677. ctx,
  49678. el$,
  49679. dropIndicator$,
  49680. store
  49681. });
  49682. useKeydown({ el$ }, store);
  49683. const isEmpty = vue.computed(() => {
  49684. const { childNodes } = root.value;
  49685. return !childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible);
  49686. });
  49687. vue.watch(() => props.currentNodeKey, (newVal) => {
  49688. store.value.setCurrentNodeKey(newVal);
  49689. });
  49690. vue.watch(() => props.defaultCheckedKeys, (newVal) => {
  49691. store.value.setDefaultCheckedKey(newVal);
  49692. });
  49693. vue.watch(() => props.defaultExpandedKeys, (newVal) => {
  49694. store.value.setDefaultExpandedKeys(newVal);
  49695. });
  49696. vue.watch(() => props.data, (newVal) => {
  49697. store.value.setData(newVal);
  49698. }, { deep: true });
  49699. vue.watch(() => props.checkStrictly, (newVal) => {
  49700. store.value.checkStrictly = newVal;
  49701. });
  49702. const filter = (value) => {
  49703. if (!props.filterNodeMethod)
  49704. throw new Error("[Tree] filterNodeMethod is required when filter");
  49705. store.value.filter(value);
  49706. };
  49707. const getNodeKey$1 = (node) => {
  49708. return getNodeKey(props.nodeKey, node.data);
  49709. };
  49710. const getNodePath = (data) => {
  49711. if (!props.nodeKey)
  49712. throw new Error("[Tree] nodeKey is required in getNodePath");
  49713. const node = store.value.getNode(data);
  49714. if (!node)
  49715. return [];
  49716. const path = [node.data];
  49717. let parent = node.parent;
  49718. while (parent && parent !== root.value) {
  49719. path.push(parent.data);
  49720. parent = parent.parent;
  49721. }
  49722. return path.reverse();
  49723. };
  49724. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  49725. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  49726. };
  49727. const getCheckedKeys = (leafOnly) => {
  49728. return store.value.getCheckedKeys(leafOnly);
  49729. };
  49730. const getCurrentNode = () => {
  49731. const currentNode2 = store.value.getCurrentNode();
  49732. return currentNode2 ? currentNode2.data : null;
  49733. };
  49734. const getCurrentKey = () => {
  49735. if (!props.nodeKey)
  49736. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  49737. const currentNode2 = getCurrentNode();
  49738. return currentNode2 ? currentNode2[props.nodeKey] : null;
  49739. };
  49740. const setCheckedNodes = (nodes, leafOnly) => {
  49741. if (!props.nodeKey)
  49742. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  49743. store.value.setCheckedNodes(nodes, leafOnly);
  49744. };
  49745. const setCheckedKeys = (keys, leafOnly) => {
  49746. if (!props.nodeKey)
  49747. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  49748. store.value.setCheckedKeys(keys, leafOnly);
  49749. };
  49750. const setChecked = (data, checked, deep) => {
  49751. store.value.setChecked(data, checked, deep);
  49752. };
  49753. const getHalfCheckedNodes = () => {
  49754. return store.value.getHalfCheckedNodes();
  49755. };
  49756. const getHalfCheckedKeys = () => {
  49757. return store.value.getHalfCheckedKeys();
  49758. };
  49759. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  49760. if (!props.nodeKey)
  49761. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  49762. handleCurrentChange(store, ctx.emit, () => store.value.setUserCurrentNode(node, shouldAutoExpandParent));
  49763. };
  49764. const setCurrentKey = (key, shouldAutoExpandParent = true) => {
  49765. if (!props.nodeKey)
  49766. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  49767. handleCurrentChange(store, ctx.emit, () => store.value.setCurrentNodeKey(key, shouldAutoExpandParent));
  49768. };
  49769. const getNode = (data) => {
  49770. return store.value.getNode(data);
  49771. };
  49772. const remove = (data) => {
  49773. store.value.remove(data);
  49774. };
  49775. const append = (data, parentNode) => {
  49776. store.value.append(data, parentNode);
  49777. };
  49778. const insertBefore = (data, refNode) => {
  49779. store.value.insertBefore(data, refNode);
  49780. };
  49781. const insertAfter = (data, refNode) => {
  49782. store.value.insertAfter(data, refNode);
  49783. };
  49784. const handleNodeExpand = (nodeData, node, instance) => {
  49785. broadcastExpanded(node);
  49786. ctx.emit("node-expand", nodeData, node, instance);
  49787. };
  49788. const updateKeyChildren = (key, data) => {
  49789. if (!props.nodeKey)
  49790. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  49791. store.value.updateChildren(key, data);
  49792. };
  49793. vue.provide("RootTree", {
  49794. ctx,
  49795. props,
  49796. store,
  49797. root,
  49798. currentNode,
  49799. instance: vue.getCurrentInstance()
  49800. });
  49801. vue.provide(formItemContextKey, void 0);
  49802. return {
  49803. ns,
  49804. store,
  49805. root,
  49806. currentNode,
  49807. dragState,
  49808. el$,
  49809. dropIndicator$,
  49810. isEmpty,
  49811. filter,
  49812. getNodeKey: getNodeKey$1,
  49813. getNodePath,
  49814. getCheckedNodes,
  49815. getCheckedKeys,
  49816. getCurrentNode,
  49817. getCurrentKey,
  49818. setCheckedNodes,
  49819. setCheckedKeys,
  49820. setChecked,
  49821. getHalfCheckedNodes,
  49822. getHalfCheckedKeys,
  49823. setCurrentNode,
  49824. setCurrentKey,
  49825. t,
  49826. getNode,
  49827. remove,
  49828. append,
  49829. insertBefore,
  49830. insertAfter,
  49831. handleNodeExpand,
  49832. updateKeyChildren
  49833. };
  49834. }
  49835. });
  49836. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  49837. var _a;
  49838. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  49839. return vue.openBlock(), vue.createElementBlock("div", {
  49840. ref: "el$",
  49841. class: vue.normalizeClass([
  49842. _ctx.ns.b(),
  49843. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  49844. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  49845. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  49846. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  49847. ]),
  49848. role: "tree"
  49849. }, [
  49850. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.root.childNodes, (child) => {
  49851. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  49852. key: _ctx.getNodeKey(child),
  49853. node: child,
  49854. props: _ctx.props,
  49855. accordion: _ctx.accordion,
  49856. "render-after-expand": _ctx.renderAfterExpand,
  49857. "show-checkbox": _ctx.showCheckbox,
  49858. "render-content": _ctx.renderContent,
  49859. onNodeExpand: _ctx.handleNodeExpand
  49860. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  49861. }), 128)),
  49862. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  49863. key: 0,
  49864. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  49865. }, [
  49866. vue.createElementVNode("span", {
  49867. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  49868. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
  49869. ], 2)) : vue.createCommentVNode("v-if", true),
  49870. vue.withDirectives(vue.createElementVNode("div", {
  49871. ref: "dropIndicator$",
  49872. class: vue.normalizeClass(_ctx.ns.e("drop-indicator"))
  49873. }, null, 2), [
  49874. [vue.vShow, _ctx.dragState.showDropIndicator]
  49875. ])
  49876. ], 2);
  49877. }
  49878. var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$1], ["__file", "tree.vue"]]);
  49879. Tree.install = (app) => {
  49880. app.component(Tree.name, Tree);
  49881. };
  49882. const _Tree = Tree;
  49883. const ElTree = _Tree;
  49884. const useSelect = (props, { attrs }, {
  49885. tree,
  49886. key
  49887. }) => {
  49888. const ns = useNamespace("tree-select");
  49889. const result = {
  49890. ...pick(vue.toRefs(props), Object.keys(ElSelect.props)),
  49891. ...attrs,
  49892. valueKey: key,
  49893. popperClass: vue.computed(() => {
  49894. const classes = [ns.e("popper")];
  49895. if (props.popperClass)
  49896. classes.push(props.popperClass);
  49897. return classes.join(" ");
  49898. }),
  49899. filterMethod: (keyword = "") => {
  49900. if (props.filterMethod)
  49901. props.filterMethod(keyword);
  49902. vue.nextTick(() => {
  49903. var _a;
  49904. (_a = tree.value) == null ? void 0 : _a.filter(keyword);
  49905. });
  49906. },
  49907. onVisibleChange: (visible) => {
  49908. var _a;
  49909. (_a = attrs.onVisibleChange) == null ? void 0 : _a.call(attrs, visible);
  49910. if (props.filterable && visible) {
  49911. result.filterMethod();
  49912. }
  49913. }
  49914. };
  49915. return result;
  49916. };
  49917. const component = vue.defineComponent({
  49918. extends: ElOption,
  49919. setup(props, ctx) {
  49920. const result = ElOption.setup(props, ctx);
  49921. delete result.selectOptionClick;
  49922. const vm = vue.getCurrentInstance().proxy;
  49923. vue.nextTick(() => {
  49924. if (!result.select.cachedOptions.get(vm.value)) {
  49925. result.select.onOptionCreate(vm);
  49926. }
  49927. });
  49928. return result;
  49929. },
  49930. methods: {
  49931. selectOptionClick() {
  49932. this.$el.parentElement.click();
  49933. }
  49934. }
  49935. });
  49936. var TreeSelectOption = component;
  49937. function isValidValue(val) {
  49938. return val || val === 0;
  49939. }
  49940. function isValidArray(val) {
  49941. return Array.isArray(val) && val.length;
  49942. }
  49943. function toValidArray(val) {
  49944. return Array.isArray(val) ? val : isValidValue(val) ? [val] : [];
  49945. }
  49946. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  49947. for (let i = 0; i < treeData.length; i++) {
  49948. const data = treeData[i];
  49949. if (findCallback(data, i, treeData, parent)) {
  49950. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  49951. } else {
  49952. const children = getChildren(data);
  49953. if (isValidArray(children)) {
  49954. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  49955. if (find)
  49956. return find;
  49957. }
  49958. }
  49959. }
  49960. }
  49961. const useTree$1 = (props, { attrs, slots, emit }, {
  49962. select,
  49963. tree,
  49964. key
  49965. }) => {
  49966. vue.watch(() => props.modelValue, () => {
  49967. if (props.showCheckbox) {
  49968. vue.nextTick(() => {
  49969. const treeInstance = tree.value;
  49970. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  49971. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  49972. }
  49973. });
  49974. }
  49975. }, {
  49976. immediate: true,
  49977. deep: true
  49978. });
  49979. const propsMap = vue.computed(() => ({
  49980. value: key.value,
  49981. ...props.props
  49982. }));
  49983. const getNodeValByProp = (prop, data) => {
  49984. var _a;
  49985. const propVal = propsMap.value[prop];
  49986. if (isFunction(propVal)) {
  49987. return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
  49988. } else {
  49989. return data[propVal];
  49990. }
  49991. };
  49992. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  49993. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  49994. }).filter((item) => isValidValue(item));
  49995. return {
  49996. ...pick(vue.toRefs(props), Object.keys(_Tree.props)),
  49997. ...attrs,
  49998. nodeKey: key,
  49999. expandOnClickNode: vue.computed(() => {
  50000. return !props.checkStrictly && props.expandOnClickNode;
  50001. }),
  50002. defaultExpandedKeys: vue.computed(() => {
  50003. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  50004. }),
  50005. renderContent: (h, { node, data, store }) => {
  50006. return h(TreeSelectOption, {
  50007. value: getNodeValByProp("value", data),
  50008. label: getNodeValByProp("label", data),
  50009. disabled: getNodeValByProp("disabled", data)
  50010. }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  50011. },
  50012. filterNodeMethod: (value, data, node) => {
  50013. var _a;
  50014. if (props.filterNodeMethod)
  50015. return props.filterNodeMethod(value, data, node);
  50016. if (!value)
  50017. return true;
  50018. return (_a = getNodeValByProp("label", data)) == null ? void 0 : _a.includes(value);
  50019. },
  50020. onNodeClick: (data, node, e) => {
  50021. var _a, _b, _c;
  50022. (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
  50023. if (props.showCheckbox && props.checkOnClickNode)
  50024. return;
  50025. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  50026. if (!getNodeValByProp("disabled", data)) {
  50027. const option = (_b = select.value) == null ? void 0 : _b.options.get(getNodeValByProp("value", data));
  50028. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option, true);
  50029. }
  50030. } else if (props.expandOnClickNode) {
  50031. e.proxy.handleExpandIconClick();
  50032. }
  50033. },
  50034. onCheck: (data, params) => {
  50035. var _a;
  50036. (_a = attrs.onCheck) == null ? void 0 : _a.call(attrs, data, params);
  50037. const dataValue = getNodeValByProp("value", data);
  50038. if (props.checkStrictly) {
  50039. emit(UPDATE_MODEL_EVENT, props.multiple ? params.checkedKeys : params.checkedKeys.includes(dataValue) ? dataValue : void 0);
  50040. } else {
  50041. if (props.multiple) {
  50042. emit(UPDATE_MODEL_EVENT, tree.value.getCheckedKeys(true));
  50043. } else {
  50044. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  50045. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  50046. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  50047. emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  50048. }
  50049. }
  50050. }
  50051. };
  50052. };
  50053. const _sfc_main$9 = vue.defineComponent({
  50054. name: "ElTreeSelect",
  50055. inheritAttrs: false,
  50056. props: {
  50057. ...ElSelect.props,
  50058. ..._Tree.props
  50059. },
  50060. setup(props, context) {
  50061. const { slots, expose } = context;
  50062. const select = vue.ref();
  50063. const tree = vue.ref();
  50064. const key = vue.computed(() => props.nodeKey || props.valueKey || "value");
  50065. const selectProps = useSelect(props, context, { select, tree, key });
  50066. const treeProps = useTree$1(props, context, { select, tree, key });
  50067. const methods = vue.reactive({});
  50068. expose(methods);
  50069. vue.onMounted(() => {
  50070. Object.assign(methods, {
  50071. ...pick(tree.value, [
  50072. "filter",
  50073. "updateKeyChildren",
  50074. "getCheckedNodes",
  50075. "setCheckedNodes",
  50076. "getCheckedKeys",
  50077. "setCheckedKeys",
  50078. "setChecked",
  50079. "getHalfCheckedNodes",
  50080. "getHalfCheckedKeys",
  50081. "getCurrentKey",
  50082. "getCurrentNode",
  50083. "setCurrentKey",
  50084. "setCurrentNode",
  50085. "getNode",
  50086. "remove",
  50087. "append",
  50088. "insertBefore",
  50089. "insertAfter"
  50090. ]),
  50091. ...pick(select.value, ["focus", "blur"])
  50092. });
  50093. });
  50094. return () => vue.h(ElSelect, vue.reactive({
  50095. ...selectProps,
  50096. ref: (ref2) => select.value = ref2
  50097. }), {
  50098. ...slots,
  50099. default: () => vue.h(_Tree, vue.reactive({
  50100. ...treeProps,
  50101. ref: (ref2) => tree.value = ref2
  50102. }))
  50103. });
  50104. }
  50105. });
  50106. var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "tree-select.vue"]]);
  50107. TreeSelect.install = (app) => {
  50108. app.component(TreeSelect.name, TreeSelect);
  50109. };
  50110. const _TreeSelect = TreeSelect;
  50111. const ElTreeSelect = _TreeSelect;
  50112. const ROOT_TREE_INJECTION_KEY = Symbol();
  50113. const EMPTY_NODE = {
  50114. key: -1,
  50115. level: -1,
  50116. data: {}
  50117. };
  50118. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  50119. TreeOptionsEnum2["KEY"] = "id";
  50120. TreeOptionsEnum2["LABEL"] = "label";
  50121. TreeOptionsEnum2["CHILDREN"] = "children";
  50122. TreeOptionsEnum2["DISABLED"] = "disabled";
  50123. return TreeOptionsEnum2;
  50124. })(TreeOptionsEnum || {});
  50125. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  50126. SetOperationEnum2["ADD"] = "add";
  50127. SetOperationEnum2["DELETE"] = "delete";
  50128. return SetOperationEnum2;
  50129. })(SetOperationEnum || {});
  50130. const treeProps = buildProps({
  50131. data: {
  50132. type: definePropType(Array),
  50133. default: () => mutable([])
  50134. },
  50135. emptyText: {
  50136. type: String
  50137. },
  50138. height: {
  50139. type: Number,
  50140. default: 200
  50141. },
  50142. props: {
  50143. type: definePropType(Object),
  50144. default: () => mutable({
  50145. children: "children" /* CHILDREN */,
  50146. label: "label" /* LABEL */,
  50147. disabled: "disabled" /* DISABLED */,
  50148. value: "id" /* KEY */
  50149. })
  50150. },
  50151. highlightCurrent: {
  50152. type: Boolean,
  50153. default: false
  50154. },
  50155. showCheckbox: {
  50156. type: Boolean,
  50157. default: false
  50158. },
  50159. defaultCheckedKeys: {
  50160. type: definePropType(Array),
  50161. default: () => mutable([])
  50162. },
  50163. checkStrictly: {
  50164. type: Boolean,
  50165. default: false
  50166. },
  50167. defaultExpandedKeys: {
  50168. type: definePropType(Array),
  50169. default: () => mutable([])
  50170. },
  50171. indent: {
  50172. type: Number,
  50173. default: 16
  50174. },
  50175. icon: {
  50176. type: iconPropType
  50177. },
  50178. expandOnClickNode: {
  50179. type: Boolean,
  50180. default: true
  50181. },
  50182. checkOnClickNode: {
  50183. type: Boolean,
  50184. default: false
  50185. },
  50186. currentNodeKey: {
  50187. type: definePropType([String, Number])
  50188. },
  50189. accordion: {
  50190. type: Boolean,
  50191. default: false
  50192. },
  50193. filterMethod: {
  50194. type: definePropType(Function)
  50195. },
  50196. perfMode: {
  50197. type: Boolean,
  50198. default: true
  50199. }
  50200. });
  50201. const treeNodeProps = buildProps({
  50202. node: {
  50203. type: definePropType(Object),
  50204. default: () => mutable(EMPTY_NODE)
  50205. },
  50206. expanded: {
  50207. type: Boolean,
  50208. default: false
  50209. },
  50210. checked: {
  50211. type: Boolean,
  50212. default: false
  50213. },
  50214. indeterminate: {
  50215. type: Boolean,
  50216. default: false
  50217. },
  50218. showCheckbox: {
  50219. type: Boolean,
  50220. default: false
  50221. },
  50222. disabled: {
  50223. type: Boolean,
  50224. default: false
  50225. },
  50226. current: {
  50227. type: Boolean,
  50228. default: false
  50229. },
  50230. hiddenExpandIcon: {
  50231. type: Boolean,
  50232. default: false
  50233. }
  50234. });
  50235. const treeNodeContentProps = buildProps({
  50236. node: {
  50237. type: definePropType(Object),
  50238. required: true
  50239. }
  50240. });
  50241. const NODE_CLICK = "node-click";
  50242. const NODE_EXPAND = "node-expand";
  50243. const NODE_COLLAPSE = "node-collapse";
  50244. const CURRENT_CHANGE = "current-change";
  50245. const NODE_CHECK = "check";
  50246. const NODE_CHECK_CHANGE = "check-change";
  50247. const NODE_CONTEXTMENU = "node-contextmenu";
  50248. const treeEmits = {
  50249. [NODE_CLICK]: (data, node, e) => data && node && e,
  50250. [NODE_EXPAND]: (data, node) => data && node,
  50251. [NODE_COLLAPSE]: (data, node) => data && node,
  50252. [CURRENT_CHANGE]: (data, node) => data && node,
  50253. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  50254. [NODE_CHECK_CHANGE]: (data, checked) => data && typeof checked === "boolean",
  50255. [NODE_CONTEXTMENU]: (event, data, node) => event && data && node
  50256. };
  50257. const treeNodeEmits = {
  50258. click: (node, e) => !!(node && e),
  50259. toggle: (node) => !!node,
  50260. check: (node, checked) => node && typeof checked === "boolean"
  50261. };
  50262. function useCheck(props, tree) {
  50263. const checkedKeys = vue.ref(/* @__PURE__ */ new Set());
  50264. const indeterminateKeys = vue.ref(/* @__PURE__ */ new Set());
  50265. const { emit } = vue.getCurrentInstance();
  50266. vue.watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  50267. return vue.nextTick(() => {
  50268. _setCheckedKeys(props.defaultCheckedKeys);
  50269. });
  50270. }, {
  50271. immediate: true
  50272. });
  50273. const updateCheckedKeys = () => {
  50274. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  50275. return;
  50276. }
  50277. const { levelTreeNodeMap, maxLevel } = tree.value;
  50278. const checkedKeySet = checkedKeys.value;
  50279. const indeterminateKeySet = /* @__PURE__ */ new Set();
  50280. for (let level = maxLevel - 1; level >= 1; --level) {
  50281. const nodes = levelTreeNodeMap.get(level);
  50282. if (!nodes)
  50283. continue;
  50284. nodes.forEach((node) => {
  50285. const children = node.children;
  50286. if (children) {
  50287. let allChecked = true;
  50288. let hasChecked = false;
  50289. for (const childNode of children) {
  50290. const key = childNode.key;
  50291. if (checkedKeySet.has(key)) {
  50292. hasChecked = true;
  50293. } else if (indeterminateKeySet.has(key)) {
  50294. allChecked = false;
  50295. hasChecked = true;
  50296. break;
  50297. } else {
  50298. allChecked = false;
  50299. }
  50300. }
  50301. if (allChecked) {
  50302. checkedKeySet.add(node.key);
  50303. } else if (hasChecked) {
  50304. indeterminateKeySet.add(node.key);
  50305. checkedKeySet.delete(node.key);
  50306. } else {
  50307. checkedKeySet.delete(node.key);
  50308. indeterminateKeySet.delete(node.key);
  50309. }
  50310. }
  50311. });
  50312. }
  50313. indeterminateKeys.value = indeterminateKeySet;
  50314. };
  50315. const isChecked = (node) => checkedKeys.value.has(node.key);
  50316. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  50317. const toggleCheckbox = (node, isChecked2, nodeClick = true) => {
  50318. const checkedKeySet = checkedKeys.value;
  50319. const toggle = (node2, checked) => {
  50320. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  50321. const children = node2.children;
  50322. if (!props.checkStrictly && children) {
  50323. children.forEach((childNode) => {
  50324. if (!childNode.disabled) {
  50325. toggle(childNode, checked);
  50326. }
  50327. });
  50328. }
  50329. };
  50330. toggle(node, isChecked2);
  50331. updateCheckedKeys();
  50332. if (nodeClick) {
  50333. afterNodeCheck(node, isChecked2);
  50334. }
  50335. };
  50336. const afterNodeCheck = (node, checked) => {
  50337. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  50338. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  50339. emit(NODE_CHECK, node.data, {
  50340. checkedKeys: checkedKeys2,
  50341. checkedNodes,
  50342. halfCheckedKeys,
  50343. halfCheckedNodes
  50344. });
  50345. emit(NODE_CHECK_CHANGE, node.data, checked);
  50346. };
  50347. function getCheckedKeys(leafOnly = false) {
  50348. return getChecked(leafOnly).checkedKeys;
  50349. }
  50350. function getCheckedNodes(leafOnly = false) {
  50351. return getChecked(leafOnly).checkedNodes;
  50352. }
  50353. function getHalfCheckedKeys() {
  50354. return getHalfChecked().halfCheckedKeys;
  50355. }
  50356. function getHalfCheckedNodes() {
  50357. return getHalfChecked().halfCheckedNodes;
  50358. }
  50359. function getChecked(leafOnly = false) {
  50360. const checkedNodes = [];
  50361. const keys = [];
  50362. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  50363. const { treeNodeMap } = tree.value;
  50364. checkedKeys.value.forEach((key) => {
  50365. const node = treeNodeMap.get(key);
  50366. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  50367. keys.push(key);
  50368. checkedNodes.push(node.data);
  50369. }
  50370. });
  50371. }
  50372. return {
  50373. checkedKeys: keys,
  50374. checkedNodes
  50375. };
  50376. }
  50377. function getHalfChecked() {
  50378. const halfCheckedNodes = [];
  50379. const halfCheckedKeys = [];
  50380. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  50381. const { treeNodeMap } = tree.value;
  50382. indeterminateKeys.value.forEach((key) => {
  50383. const node = treeNodeMap.get(key);
  50384. if (node) {
  50385. halfCheckedKeys.push(key);
  50386. halfCheckedNodes.push(node.data);
  50387. }
  50388. });
  50389. }
  50390. return {
  50391. halfCheckedNodes,
  50392. halfCheckedKeys
  50393. };
  50394. }
  50395. function setCheckedKeys(keys) {
  50396. checkedKeys.value.clear();
  50397. indeterminateKeys.value.clear();
  50398. _setCheckedKeys(keys);
  50399. }
  50400. function setChecked(key, isChecked2) {
  50401. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  50402. const node = tree.value.treeNodeMap.get(key);
  50403. if (node) {
  50404. toggleCheckbox(node, isChecked2, false);
  50405. }
  50406. }
  50407. }
  50408. function _setCheckedKeys(keys) {
  50409. if (tree == null ? void 0 : tree.value) {
  50410. const { treeNodeMap } = tree.value;
  50411. if (props.showCheckbox && treeNodeMap && keys) {
  50412. for (const key of keys) {
  50413. const node = treeNodeMap.get(key);
  50414. if (node && !isChecked(node)) {
  50415. toggleCheckbox(node, true, false);
  50416. }
  50417. }
  50418. }
  50419. }
  50420. }
  50421. return {
  50422. updateCheckedKeys,
  50423. toggleCheckbox,
  50424. isChecked,
  50425. isIndeterminate,
  50426. getCheckedKeys,
  50427. getCheckedNodes,
  50428. getHalfCheckedKeys,
  50429. getHalfCheckedNodes,
  50430. setChecked,
  50431. setCheckedKeys
  50432. };
  50433. }
  50434. function useFilter(props, tree) {
  50435. const hiddenNodeKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  50436. const hiddenExpandIconKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  50437. const filterable = vue.computed(() => {
  50438. return isFunction(props.filterMethod);
  50439. });
  50440. function doFilter(query) {
  50441. var _a;
  50442. if (!filterable.value) {
  50443. return;
  50444. }
  50445. const expandKeySet = /* @__PURE__ */ new Set();
  50446. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  50447. const hiddenKeys = hiddenNodeKeySet.value;
  50448. const family = [];
  50449. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  50450. const filter = props.filterMethod;
  50451. hiddenKeys.clear();
  50452. function traverse(nodes2) {
  50453. nodes2.forEach((node) => {
  50454. family.push(node);
  50455. if (filter == null ? void 0 : filter(query, node.data)) {
  50456. family.forEach((member) => {
  50457. expandKeySet.add(member.key);
  50458. });
  50459. } else if (node.isLeaf) {
  50460. hiddenKeys.add(node.key);
  50461. }
  50462. const children = node.children;
  50463. if (children) {
  50464. traverse(children);
  50465. }
  50466. if (!node.isLeaf) {
  50467. if (!expandKeySet.has(node.key)) {
  50468. hiddenKeys.add(node.key);
  50469. } else if (children) {
  50470. let allHidden = true;
  50471. for (const childNode of children) {
  50472. if (!hiddenKeys.has(childNode.key)) {
  50473. allHidden = false;
  50474. break;
  50475. }
  50476. }
  50477. if (allHidden) {
  50478. hiddenExpandIconKeys.add(node.key);
  50479. } else {
  50480. hiddenExpandIconKeys.delete(node.key);
  50481. }
  50482. }
  50483. }
  50484. family.pop();
  50485. });
  50486. }
  50487. traverse(nodes);
  50488. return expandKeySet;
  50489. }
  50490. function isForceHiddenExpandIcon(node) {
  50491. return hiddenExpandIconKeySet.value.has(node.key);
  50492. }
  50493. return {
  50494. hiddenExpandIconKeySet,
  50495. hiddenNodeKeySet,
  50496. doFilter,
  50497. isForceHiddenExpandIcon
  50498. };
  50499. }
  50500. function useTree(props, emit) {
  50501. const expandedKeySet = vue.ref(new Set(props.defaultExpandedKeys));
  50502. const currentKey = vue.ref();
  50503. const tree = vue.shallowRef();
  50504. vue.watch(() => props.currentNodeKey, (key) => {
  50505. currentKey.value = key;
  50506. }, {
  50507. immediate: true
  50508. });
  50509. vue.watch(() => props.data, (data) => {
  50510. setData(data);
  50511. }, {
  50512. immediate: true
  50513. });
  50514. const {
  50515. isIndeterminate,
  50516. isChecked,
  50517. toggleCheckbox,
  50518. getCheckedKeys,
  50519. getCheckedNodes,
  50520. getHalfCheckedKeys,
  50521. getHalfCheckedNodes,
  50522. setChecked,
  50523. setCheckedKeys
  50524. } = useCheck(props, tree);
  50525. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  50526. const valueKey = vue.computed(() => {
  50527. var _a;
  50528. return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY;
  50529. });
  50530. const childrenKey = vue.computed(() => {
  50531. var _a;
  50532. return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN;
  50533. });
  50534. const disabledKey = vue.computed(() => {
  50535. var _a;
  50536. return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED;
  50537. });
  50538. const labelKey = vue.computed(() => {
  50539. var _a;
  50540. return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL;
  50541. });
  50542. const flattenTree = vue.computed(() => {
  50543. const expandedKeys = expandedKeySet.value;
  50544. const hiddenKeys = hiddenNodeKeySet.value;
  50545. const flattenNodes = [];
  50546. const nodes = tree.value && tree.value.treeNodes || [];
  50547. function traverse() {
  50548. const stack = [];
  50549. for (let i = nodes.length - 1; i >= 0; --i) {
  50550. stack.push(nodes[i]);
  50551. }
  50552. while (stack.length) {
  50553. const node = stack.pop();
  50554. if (!node)
  50555. continue;
  50556. if (!hiddenKeys.has(node.key)) {
  50557. flattenNodes.push(node);
  50558. }
  50559. if (expandedKeys.has(node.key)) {
  50560. const children = node.children;
  50561. if (children) {
  50562. const length = children.length;
  50563. for (let i = length - 1; i >= 0; --i) {
  50564. stack.push(children[i]);
  50565. }
  50566. }
  50567. }
  50568. }
  50569. }
  50570. traverse();
  50571. return flattenNodes;
  50572. });
  50573. const isNotEmpty = vue.computed(() => {
  50574. return flattenTree.value.length > 0;
  50575. });
  50576. function createTree(data) {
  50577. const treeNodeMap = /* @__PURE__ */ new Map();
  50578. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  50579. let maxLevel = 1;
  50580. function traverse(nodes, level = 1, parent = void 0) {
  50581. var _a;
  50582. const siblings = [];
  50583. for (const rawNode of nodes) {
  50584. const value = getKey(rawNode);
  50585. const node = {
  50586. level,
  50587. key: value,
  50588. data: rawNode
  50589. };
  50590. node.label = getLabel(rawNode);
  50591. node.parent = parent;
  50592. const children = getChildren(rawNode);
  50593. node.disabled = getDisabled(rawNode);
  50594. node.isLeaf = !children || children.length === 0;
  50595. if (children && children.length) {
  50596. node.children = traverse(children, level + 1, node);
  50597. }
  50598. siblings.push(node);
  50599. treeNodeMap.set(value, node);
  50600. if (!levelTreeNodeMap.has(level)) {
  50601. levelTreeNodeMap.set(level, []);
  50602. }
  50603. (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node);
  50604. }
  50605. if (level > maxLevel) {
  50606. maxLevel = level;
  50607. }
  50608. return siblings;
  50609. }
  50610. const treeNodes = traverse(data);
  50611. return {
  50612. treeNodeMap,
  50613. levelTreeNodeMap,
  50614. maxLevel,
  50615. treeNodes
  50616. };
  50617. }
  50618. function filter(query) {
  50619. const keys = doFilter(query);
  50620. if (keys) {
  50621. expandedKeySet.value = keys;
  50622. }
  50623. }
  50624. function getChildren(node) {
  50625. return node[childrenKey.value];
  50626. }
  50627. function getKey(node) {
  50628. if (!node) {
  50629. return "";
  50630. }
  50631. return node[valueKey.value];
  50632. }
  50633. function getDisabled(node) {
  50634. return node[disabledKey.value];
  50635. }
  50636. function getLabel(node) {
  50637. return node[labelKey.value];
  50638. }
  50639. function toggleExpand(node) {
  50640. const expandedKeys = expandedKeySet.value;
  50641. if (expandedKeys.has(node.key)) {
  50642. collapseNode(node);
  50643. } else {
  50644. expandNode(node);
  50645. }
  50646. }
  50647. function setExpandedKeys(keys) {
  50648. expandedKeySet.value = new Set(keys);
  50649. }
  50650. function handleNodeClick(node, e) {
  50651. emit(NODE_CLICK, node.data, node, e);
  50652. handleCurrentChange(node);
  50653. if (props.expandOnClickNode) {
  50654. toggleExpand(node);
  50655. }
  50656. if (props.showCheckbox && props.checkOnClickNode && !node.disabled) {
  50657. toggleCheckbox(node, !isChecked(node), true);
  50658. }
  50659. }
  50660. function handleCurrentChange(node) {
  50661. if (!isCurrent(node)) {
  50662. currentKey.value = node.key;
  50663. emit(CURRENT_CHANGE, node.data, node);
  50664. }
  50665. }
  50666. function handleNodeCheck(node, checked) {
  50667. toggleCheckbox(node, checked);
  50668. }
  50669. function expandNode(node) {
  50670. const keySet = expandedKeySet.value;
  50671. if (tree.value && props.accordion) {
  50672. const { treeNodeMap } = tree.value;
  50673. keySet.forEach((key) => {
  50674. const treeNode = treeNodeMap.get(key);
  50675. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  50676. keySet.delete(key);
  50677. }
  50678. });
  50679. }
  50680. keySet.add(node.key);
  50681. emit(NODE_EXPAND, node.data, node);
  50682. }
  50683. function collapseNode(node) {
  50684. expandedKeySet.value.delete(node.key);
  50685. emit(NODE_COLLAPSE, node.data, node);
  50686. }
  50687. function isExpanded(node) {
  50688. return expandedKeySet.value.has(node.key);
  50689. }
  50690. function isDisabled(node) {
  50691. return !!node.disabled;
  50692. }
  50693. function isCurrent(node) {
  50694. const current = currentKey.value;
  50695. return !!current && current === node.key;
  50696. }
  50697. function getCurrentNode() {
  50698. var _a, _b;
  50699. if (!currentKey.value)
  50700. return void 0;
  50701. return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  50702. }
  50703. function getCurrentKey() {
  50704. return currentKey.value;
  50705. }
  50706. function setCurrentKey(key) {
  50707. currentKey.value = key;
  50708. }
  50709. function setData(data) {
  50710. vue.nextTick(() => tree.value = createTree(data));
  50711. }
  50712. function getNode(data) {
  50713. var _a;
  50714. const key = isObject$1(data) ? getKey(data) : data;
  50715. return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key);
  50716. }
  50717. return {
  50718. tree,
  50719. flattenTree,
  50720. isNotEmpty,
  50721. getKey,
  50722. getChildren,
  50723. toggleExpand,
  50724. toggleCheckbox,
  50725. isExpanded,
  50726. isChecked,
  50727. isIndeterminate,
  50728. isDisabled,
  50729. isCurrent,
  50730. isForceHiddenExpandIcon,
  50731. handleNodeClick,
  50732. handleNodeCheck,
  50733. getCurrentNode,
  50734. getCurrentKey,
  50735. setCurrentKey,
  50736. getCheckedKeys,
  50737. getCheckedNodes,
  50738. getHalfCheckedKeys,
  50739. getHalfCheckedNodes,
  50740. setChecked,
  50741. setCheckedKeys,
  50742. filter,
  50743. setData,
  50744. getNode,
  50745. expandNode,
  50746. collapseNode,
  50747. setExpandedKeys
  50748. };
  50749. }
  50750. var ElNodeContent = vue.defineComponent({
  50751. name: "ElTreeNodeContent",
  50752. props: treeNodeContentProps,
  50753. setup(props) {
  50754. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  50755. const ns = useNamespace("tree");
  50756. return () => {
  50757. const node = props.node;
  50758. const { data } = node;
  50759. 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]);
  50760. };
  50761. }
  50762. });
  50763. const _hoisted_1$6 = ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick"];
  50764. const __default__$7 = vue.defineComponent({
  50765. name: "ElTreeNode"
  50766. });
  50767. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  50768. ...__default__$7,
  50769. props: treeNodeProps,
  50770. emits: treeNodeEmits,
  50771. setup(__props, { emit }) {
  50772. const props = __props;
  50773. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  50774. const ns = useNamespace("tree");
  50775. const indent = vue.computed(() => {
  50776. var _a;
  50777. return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16;
  50778. });
  50779. const icon = vue.computed(() => {
  50780. var _a;
  50781. return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default;
  50782. });
  50783. const handleClick = (e) => {
  50784. emit("click", props.node, e);
  50785. };
  50786. const handleExpandIconClick = () => {
  50787. emit("toggle", props.node);
  50788. };
  50789. const handleCheckChange = (value) => {
  50790. emit("check", props.node, value);
  50791. };
  50792. const handleContextMenu = (event) => {
  50793. var _a, _b, _c, _d;
  50794. 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"]) {
  50795. event.stopPropagation();
  50796. event.preventDefault();
  50797. }
  50798. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  50799. };
  50800. return (_ctx, _cache) => {
  50801. var _a, _b, _c;
  50802. return vue.openBlock(), vue.createElementBlock("div", {
  50803. ref: "node$",
  50804. class: vue.normalizeClass([
  50805. vue.unref(ns).b("node"),
  50806. vue.unref(ns).is("expanded", _ctx.expanded),
  50807. vue.unref(ns).is("current", _ctx.current),
  50808. vue.unref(ns).is("focusable", !_ctx.disabled),
  50809. vue.unref(ns).is("checked", !_ctx.disabled && _ctx.checked)
  50810. ]),
  50811. role: "treeitem",
  50812. tabindex: "-1",
  50813. "aria-expanded": _ctx.expanded,
  50814. "aria-disabled": _ctx.disabled,
  50815. "aria-checked": _ctx.checked,
  50816. "data-key": (_a = _ctx.node) == null ? void 0 : _a.key,
  50817. onClick: vue.withModifiers(handleClick, ["stop"]),
  50818. onContextmenu: handleContextMenu
  50819. }, [
  50820. vue.createElementVNode("div", {
  50821. class: vue.normalizeClass(vue.unref(ns).be("node", "content")),
  50822. style: vue.normalizeStyle({ paddingLeft: `${(_ctx.node.level - 1) * vue.unref(indent)}px` })
  50823. }, [
  50824. vue.unref(icon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  50825. key: 0,
  50826. class: vue.normalizeClass([
  50827. vue.unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  50828. vue.unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  50829. {
  50830. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  50831. },
  50832. vue.unref(ns).be("node", "expand-icon")
  50833. ]),
  50834. onClick: vue.withModifiers(handleExpandIconClick, ["stop"])
  50835. }, {
  50836. default: vue.withCtx(() => [
  50837. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(icon))))
  50838. ]),
  50839. _: 1
  50840. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  50841. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  50842. key: 1,
  50843. "model-value": _ctx.checked,
  50844. indeterminate: _ctx.indeterminate,
  50845. disabled: _ctx.disabled,
  50846. onChange: handleCheckChange,
  50847. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  50848. }, ["stop"]))
  50849. }, null, 8, ["model-value", "indeterminate", "disabled"])) : vue.createCommentVNode("v-if", true),
  50850. vue.createVNode(vue.unref(ElNodeContent), { node: _ctx.node }, null, 8, ["node"])
  50851. ], 6)
  50852. ], 42, _hoisted_1$6);
  50853. };
  50854. }
  50855. });
  50856. var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "tree-node.vue"]]);
  50857. const itemSize = 26;
  50858. const __default__$6 = vue.defineComponent({
  50859. name: "ElTreeV2"
  50860. });
  50861. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  50862. ...__default__$6,
  50863. props: treeProps,
  50864. emits: treeEmits,
  50865. setup(__props, { expose, emit }) {
  50866. const props = __props;
  50867. const slots = vue.useSlots();
  50868. vue.provide(ROOT_TREE_INJECTION_KEY, {
  50869. ctx: {
  50870. emit,
  50871. slots
  50872. },
  50873. props,
  50874. instance: vue.getCurrentInstance()
  50875. });
  50876. vue.provide(formItemContextKey, void 0);
  50877. const { t } = useLocale();
  50878. const ns = useNamespace("tree");
  50879. const {
  50880. flattenTree,
  50881. isNotEmpty,
  50882. toggleExpand,
  50883. isExpanded,
  50884. isIndeterminate,
  50885. isChecked,
  50886. isDisabled,
  50887. isCurrent,
  50888. isForceHiddenExpandIcon,
  50889. handleNodeClick,
  50890. handleNodeCheck,
  50891. toggleCheckbox,
  50892. getCurrentNode,
  50893. getCurrentKey,
  50894. setCurrentKey,
  50895. getCheckedKeys,
  50896. getCheckedNodes,
  50897. getHalfCheckedKeys,
  50898. getHalfCheckedNodes,
  50899. setChecked,
  50900. setCheckedKeys,
  50901. filter,
  50902. setData,
  50903. getNode,
  50904. expandNode,
  50905. collapseNode,
  50906. setExpandedKeys
  50907. } = useTree(props, emit);
  50908. expose({
  50909. toggleCheckbox,
  50910. getCurrentNode,
  50911. getCurrentKey,
  50912. setCurrentKey,
  50913. getCheckedKeys,
  50914. getCheckedNodes,
  50915. getHalfCheckedKeys,
  50916. getHalfCheckedNodes,
  50917. setChecked,
  50918. setCheckedKeys,
  50919. filter,
  50920. setData,
  50921. getNode,
  50922. expandNode,
  50923. collapseNode,
  50924. setExpandedKeys
  50925. });
  50926. return (_ctx, _cache) => {
  50927. var _a;
  50928. return vue.openBlock(), vue.createElementBlock("div", {
  50929. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  50930. role: "tree"
  50931. }, [
  50932. vue.unref(isNotEmpty) ? (vue.openBlock(), vue.createBlock(vue.unref(FixedSizeList$1), {
  50933. key: 0,
  50934. "class-name": vue.unref(ns).b("virtual-list"),
  50935. data: vue.unref(flattenTree),
  50936. total: vue.unref(flattenTree).length,
  50937. height: _ctx.height,
  50938. "item-size": itemSize,
  50939. "perf-mode": _ctx.perfMode
  50940. }, {
  50941. default: vue.withCtx(({ data, index, style }) => [
  50942. (vue.openBlock(), vue.createBlock(ElTreeNode, {
  50943. key: data[index].key,
  50944. style: vue.normalizeStyle(style),
  50945. node: data[index],
  50946. expanded: vue.unref(isExpanded)(data[index]),
  50947. "show-checkbox": _ctx.showCheckbox,
  50948. checked: vue.unref(isChecked)(data[index]),
  50949. indeterminate: vue.unref(isIndeterminate)(data[index]),
  50950. disabled: vue.unref(isDisabled)(data[index]),
  50951. current: vue.unref(isCurrent)(data[index]),
  50952. "hidden-expand-icon": vue.unref(isForceHiddenExpandIcon)(data[index]),
  50953. onClick: vue.unref(handleNodeClick),
  50954. onToggle: vue.unref(toggleExpand),
  50955. onCheck: vue.unref(handleNodeCheck)
  50956. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck"]))
  50957. ]),
  50958. _: 1
  50959. }, 8, ["class-name", "data", "total", "height", "perf-mode"])) : (vue.openBlock(), vue.createElementBlock("div", {
  50960. key: 1,
  50961. class: vue.normalizeClass(vue.unref(ns).e("empty-block"))
  50962. }, [
  50963. vue.createElementVNode("span", {
  50964. class: vue.normalizeClass(vue.unref(ns).e("empty-text"))
  50965. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : vue.unref(t)("el.tree.emptyText")), 3)
  50966. ], 2))
  50967. ], 2);
  50968. };
  50969. }
  50970. });
  50971. var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "tree.vue"]]);
  50972. const ElTreeV2 = withInstall(TreeV2);
  50973. const SCOPE$2 = "ElUpload";
  50974. class UploadAjaxError extends Error {
  50975. constructor(message, status, method, url) {
  50976. super(message);
  50977. this.name = "UploadAjaxError";
  50978. this.status = status;
  50979. this.method = method;
  50980. this.url = url;
  50981. }
  50982. }
  50983. function getError(action, option, xhr) {
  50984. let msg;
  50985. if (xhr.response) {
  50986. msg = `${xhr.response.error || xhr.response}`;
  50987. } else if (xhr.responseText) {
  50988. msg = `${xhr.responseText}`;
  50989. } else {
  50990. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  50991. }
  50992. return new UploadAjaxError(msg, xhr.status, option.method, action);
  50993. }
  50994. function getBody(xhr) {
  50995. const text = xhr.responseText || xhr.response;
  50996. if (!text) {
  50997. return text;
  50998. }
  50999. try {
  51000. return JSON.parse(text);
  51001. } catch (e) {
  51002. return text;
  51003. }
  51004. }
  51005. const ajaxUpload = (option) => {
  51006. if (typeof XMLHttpRequest === "undefined")
  51007. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  51008. const xhr = new XMLHttpRequest();
  51009. const action = option.action;
  51010. if (xhr.upload) {
  51011. xhr.upload.addEventListener("progress", (evt) => {
  51012. const progressEvt = evt;
  51013. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  51014. option.onProgress(progressEvt);
  51015. });
  51016. }
  51017. const formData = new FormData();
  51018. if (option.data) {
  51019. for (const [key, value] of Object.entries(option.data)) {
  51020. if (Array.isArray(value))
  51021. formData.append(key, ...value);
  51022. else
  51023. formData.append(key, value);
  51024. }
  51025. }
  51026. formData.append(option.filename, option.file, option.file.name);
  51027. xhr.addEventListener("error", () => {
  51028. option.onError(getError(action, option, xhr));
  51029. });
  51030. xhr.addEventListener("load", () => {
  51031. if (xhr.status < 200 || xhr.status >= 300) {
  51032. return option.onError(getError(action, option, xhr));
  51033. }
  51034. option.onSuccess(getBody(xhr));
  51035. });
  51036. xhr.open(option.method, action, true);
  51037. if (option.withCredentials && "withCredentials" in xhr) {
  51038. xhr.withCredentials = true;
  51039. }
  51040. const headers = option.headers || {};
  51041. if (headers instanceof Headers) {
  51042. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  51043. } else {
  51044. for (const [key, value] of Object.entries(headers)) {
  51045. if (isNil(value))
  51046. continue;
  51047. xhr.setRequestHeader(key, String(value));
  51048. }
  51049. }
  51050. xhr.send(formData);
  51051. return xhr;
  51052. };
  51053. const uploadListTypes = ["text", "picture", "picture-card"];
  51054. let fileId = 1;
  51055. const genFileId = () => Date.now() + fileId++;
  51056. const uploadBaseProps = buildProps({
  51057. action: {
  51058. type: String,
  51059. default: "#"
  51060. },
  51061. headers: {
  51062. type: definePropType(Object)
  51063. },
  51064. method: {
  51065. type: String,
  51066. default: "post"
  51067. },
  51068. data: {
  51069. type: Object,
  51070. default: () => mutable({})
  51071. },
  51072. multiple: {
  51073. type: Boolean,
  51074. default: false
  51075. },
  51076. name: {
  51077. type: String,
  51078. default: "file"
  51079. },
  51080. drag: {
  51081. type: Boolean,
  51082. default: false
  51083. },
  51084. withCredentials: Boolean,
  51085. showFileList: {
  51086. type: Boolean,
  51087. default: true
  51088. },
  51089. accept: {
  51090. type: String,
  51091. default: ""
  51092. },
  51093. type: {
  51094. type: String,
  51095. default: "select"
  51096. },
  51097. fileList: {
  51098. type: definePropType(Array),
  51099. default: () => mutable([])
  51100. },
  51101. autoUpload: {
  51102. type: Boolean,
  51103. default: true
  51104. },
  51105. listType: {
  51106. type: String,
  51107. values: uploadListTypes,
  51108. default: "text"
  51109. },
  51110. httpRequest: {
  51111. type: definePropType(Function),
  51112. default: ajaxUpload
  51113. },
  51114. disabled: Boolean,
  51115. limit: Number
  51116. });
  51117. const uploadProps = buildProps({
  51118. ...uploadBaseProps,
  51119. beforeUpload: {
  51120. type: definePropType(Function),
  51121. default: NOOP
  51122. },
  51123. beforeRemove: {
  51124. type: definePropType(Function)
  51125. },
  51126. onRemove: {
  51127. type: definePropType(Function),
  51128. default: NOOP
  51129. },
  51130. onChange: {
  51131. type: definePropType(Function),
  51132. default: NOOP
  51133. },
  51134. onPreview: {
  51135. type: definePropType(Function),
  51136. default: NOOP
  51137. },
  51138. onSuccess: {
  51139. type: definePropType(Function),
  51140. default: NOOP
  51141. },
  51142. onProgress: {
  51143. type: definePropType(Function),
  51144. default: NOOP
  51145. },
  51146. onError: {
  51147. type: definePropType(Function),
  51148. default: NOOP
  51149. },
  51150. onExceed: {
  51151. type: definePropType(Function),
  51152. default: NOOP
  51153. }
  51154. });
  51155. const uploadListProps = buildProps({
  51156. files: {
  51157. type: definePropType(Array),
  51158. default: () => mutable([])
  51159. },
  51160. disabled: {
  51161. type: Boolean,
  51162. default: false
  51163. },
  51164. handlePreview: {
  51165. type: definePropType(Function),
  51166. default: NOOP
  51167. },
  51168. listType: {
  51169. type: String,
  51170. values: uploadListTypes,
  51171. default: "text"
  51172. }
  51173. });
  51174. const uploadListEmits = {
  51175. remove: (file) => !!file
  51176. };
  51177. const _hoisted_1$5 = ["onKeydown"];
  51178. const _hoisted_2$4 = ["src"];
  51179. const _hoisted_3$2 = ["onClick"];
  51180. const _hoisted_4$1 = ["onClick"];
  51181. const _hoisted_5 = ["onClick"];
  51182. const __default__$5 = vue.defineComponent({
  51183. name: "ElUploadList"
  51184. });
  51185. const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
  51186. ...__default__$5,
  51187. props: uploadListProps,
  51188. emits: uploadListEmits,
  51189. setup(__props, { emit }) {
  51190. const { t } = useLocale();
  51191. const nsUpload = useNamespace("upload");
  51192. const nsIcon = useNamespace("icon");
  51193. const nsList = useNamespace("list");
  51194. const disabled = useDisabled();
  51195. const focusing = vue.ref(false);
  51196. const handleRemove = (file) => {
  51197. emit("remove", file);
  51198. };
  51199. return (_ctx, _cache) => {
  51200. return vue.openBlock(), vue.createBlock(vue.TransitionGroup, {
  51201. tag: "ul",
  51202. class: vue.normalizeClass([
  51203. vue.unref(nsUpload).b("list"),
  51204. vue.unref(nsUpload).bm("list", _ctx.listType),
  51205. vue.unref(nsUpload).is("disabled", vue.unref(disabled))
  51206. ]),
  51207. name: vue.unref(nsList).b()
  51208. }, {
  51209. default: vue.withCtx(() => [
  51210. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.files, (file) => {
  51211. return vue.openBlock(), vue.createElementBlock("li", {
  51212. key: file.uid || file.name,
  51213. class: vue.normalizeClass([
  51214. vue.unref(nsUpload).be("list", "item"),
  51215. vue.unref(nsUpload).is(file.status),
  51216. { focusing: focusing.value }
  51217. ]),
  51218. tabindex: "0",
  51219. onKeydown: vue.withKeys(($event) => !vue.unref(disabled) && handleRemove(file), ["delete"]),
  51220. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  51221. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  51222. onClick: _cache[2] || (_cache[2] = ($event) => focusing.value = false)
  51223. }, [
  51224. vue.renderSlot(_ctx.$slots, "default", { file }, () => [
  51225. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("img", {
  51226. key: 0,
  51227. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-thumbnail")),
  51228. src: file.url,
  51229. alt: ""
  51230. }, null, 10, _hoisted_2$4)) : vue.createCommentVNode("v-if", true),
  51231. file.status === "uploading" || _ctx.listType !== "picture-card" ? (vue.openBlock(), vue.createElementBlock("div", {
  51232. key: 1,
  51233. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-info"))
  51234. }, [
  51235. vue.createElementVNode("a", {
  51236. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-name")),
  51237. onClick: vue.withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  51238. }, [
  51239. vue.createVNode(vue.unref(ElIcon), {
  51240. class: vue.normalizeClass(vue.unref(nsIcon).m("document"))
  51241. }, {
  51242. default: vue.withCtx(() => [
  51243. vue.createVNode(vue.unref(document_default))
  51244. ]),
  51245. _: 1
  51246. }, 8, ["class"]),
  51247. vue.createElementVNode("span", {
  51248. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-file-name"))
  51249. }, vue.toDisplayString(file.name), 3)
  51250. ], 10, _hoisted_3$2),
  51251. file.status === "uploading" ? (vue.openBlock(), vue.createBlock(vue.unref(ElProgress), {
  51252. key: 0,
  51253. type: _ctx.listType === "picture-card" ? "circle" : "line",
  51254. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  51255. percentage: Number(file.percentage),
  51256. style: vue.normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  51257. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : vue.createCommentVNode("v-if", true)
  51258. ], 2)) : vue.createCommentVNode("v-if", true),
  51259. vue.createElementVNode("label", {
  51260. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-status-label"))
  51261. }, [
  51262. _ctx.listType === "text" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  51263. key: 0,
  51264. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("circle-check")])
  51265. }, {
  51266. default: vue.withCtx(() => [
  51267. vue.createVNode(vue.unref(circle_check_default))
  51268. ]),
  51269. _: 1
  51270. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  51271. key: 1,
  51272. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("check")])
  51273. }, {
  51274. default: vue.withCtx(() => [
  51275. vue.createVNode(vue.unref(check_default))
  51276. ]),
  51277. _: 1
  51278. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  51279. ], 2),
  51280. !vue.unref(disabled) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  51281. key: 2,
  51282. class: vue.normalizeClass(vue.unref(nsIcon).m("close")),
  51283. onClick: ($event) => handleRemove(file)
  51284. }, {
  51285. default: vue.withCtx(() => [
  51286. vue.createVNode(vue.unref(close_default))
  51287. ]),
  51288. _: 2
  51289. }, 1032, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  51290. 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"),
  51291. vue.createCommentVNode(" This is a bug which needs to be fixed "),
  51292. vue.createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  51293. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("i", {
  51294. key: 3,
  51295. class: vue.normalizeClass(vue.unref(nsIcon).m("close-tip"))
  51296. }, vue.toDisplayString(vue.unref(t)("el.upload.deleteTip")), 3)) : vue.createCommentVNode("v-if", true),
  51297. _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("span", {
  51298. key: 4,
  51299. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-actions"))
  51300. }, [
  51301. vue.createElementVNode("span", {
  51302. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-preview")),
  51303. onClick: ($event) => _ctx.handlePreview(file)
  51304. }, [
  51305. vue.createVNode(vue.unref(ElIcon), {
  51306. class: vue.normalizeClass(vue.unref(nsIcon).m("zoom-in"))
  51307. }, {
  51308. default: vue.withCtx(() => [
  51309. vue.createVNode(vue.unref(zoom_in_default))
  51310. ]),
  51311. _: 1
  51312. }, 8, ["class"])
  51313. ], 10, _hoisted_4$1),
  51314. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("span", {
  51315. key: 0,
  51316. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-delete")),
  51317. onClick: ($event) => handleRemove(file)
  51318. }, [
  51319. vue.createVNode(vue.unref(ElIcon), {
  51320. class: vue.normalizeClass(vue.unref(nsIcon).m("delete"))
  51321. }, {
  51322. default: vue.withCtx(() => [
  51323. vue.createVNode(vue.unref(delete_default))
  51324. ]),
  51325. _: 1
  51326. }, 8, ["class"])
  51327. ], 10, _hoisted_5)) : vue.createCommentVNode("v-if", true)
  51328. ], 2)) : vue.createCommentVNode("v-if", true)
  51329. ])
  51330. ], 42, _hoisted_1$5);
  51331. }), 128)),
  51332. vue.renderSlot(_ctx.$slots, "append")
  51333. ]),
  51334. _: 3
  51335. }, 8, ["class", "name"]);
  51336. };
  51337. }
  51338. });
  51339. var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "upload-list.vue"]]);
  51340. const uploadDraggerProps = buildProps({
  51341. disabled: {
  51342. type: Boolean,
  51343. default: false
  51344. }
  51345. });
  51346. const uploadDraggerEmits = {
  51347. file: (file) => isArray(file)
  51348. };
  51349. const _hoisted_1$4 = ["onDrop", "onDragover"];
  51350. const COMPONENT_NAME = "ElUploadDrag";
  51351. const __default__$4 = vue.defineComponent({
  51352. name: COMPONENT_NAME
  51353. });
  51354. const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
  51355. ...__default__$4,
  51356. props: uploadDraggerProps,
  51357. emits: uploadDraggerEmits,
  51358. setup(__props, { emit }) {
  51359. const uploaderContext = vue.inject(uploadContextKey);
  51360. if (!uploaderContext) {
  51361. throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>");
  51362. }
  51363. const ns = useNamespace("upload");
  51364. const dragover = vue.ref(false);
  51365. const disabled = useDisabled();
  51366. const onDrop = (e) => {
  51367. if (disabled.value)
  51368. return;
  51369. dragover.value = false;
  51370. const files = Array.from(e.dataTransfer.files);
  51371. const accept = uploaderContext.accept.value;
  51372. if (!accept) {
  51373. emit("file", files);
  51374. return;
  51375. }
  51376. const filesFiltered = files.filter((file) => {
  51377. const { type, name } = file;
  51378. const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
  51379. const baseType = type.replace(/\/.*$/, "");
  51380. return accept.split(",").map((type2) => type2.trim()).filter((type2) => type2).some((acceptedType) => {
  51381. if (acceptedType.startsWith(".")) {
  51382. return extension === acceptedType;
  51383. }
  51384. if (/\/\*$/.test(acceptedType)) {
  51385. return baseType === acceptedType.replace(/\/\*$/, "");
  51386. }
  51387. if (/^[^/]+\/[^/]+$/.test(acceptedType)) {
  51388. return type === acceptedType;
  51389. }
  51390. return false;
  51391. });
  51392. });
  51393. emit("file", filesFiltered);
  51394. };
  51395. const onDragover = () => {
  51396. if (!disabled.value)
  51397. dragover.value = true;
  51398. };
  51399. return (_ctx, _cache) => {
  51400. return vue.openBlock(), vue.createElementBlock("div", {
  51401. class: vue.normalizeClass([vue.unref(ns).b("dragger"), vue.unref(ns).is("dragover", dragover.value)]),
  51402. onDrop: vue.withModifiers(onDrop, ["prevent"]),
  51403. onDragover: vue.withModifiers(onDragover, ["prevent"]),
  51404. onDragleave: _cache[0] || (_cache[0] = vue.withModifiers(($event) => dragover.value = false, ["prevent"]))
  51405. }, [
  51406. vue.renderSlot(_ctx.$slots, "default")
  51407. ], 42, _hoisted_1$4);
  51408. };
  51409. }
  51410. });
  51411. var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "upload-dragger.vue"]]);
  51412. const uploadContentProps = buildProps({
  51413. ...uploadBaseProps,
  51414. beforeUpload: {
  51415. type: definePropType(Function),
  51416. default: NOOP
  51417. },
  51418. onRemove: {
  51419. type: definePropType(Function),
  51420. default: NOOP
  51421. },
  51422. onStart: {
  51423. type: definePropType(Function),
  51424. default: NOOP
  51425. },
  51426. onSuccess: {
  51427. type: definePropType(Function),
  51428. default: NOOP
  51429. },
  51430. onProgress: {
  51431. type: definePropType(Function),
  51432. default: NOOP
  51433. },
  51434. onError: {
  51435. type: definePropType(Function),
  51436. default: NOOP
  51437. },
  51438. onExceed: {
  51439. type: definePropType(Function),
  51440. default: NOOP
  51441. }
  51442. });
  51443. const _hoisted_1$3 = ["onKeydown"];
  51444. const _hoisted_2$3 = ["name", "multiple", "accept"];
  51445. const __default__$3 = vue.defineComponent({
  51446. name: "ElUploadContent",
  51447. inheritAttrs: false
  51448. });
  51449. const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
  51450. ...__default__$3,
  51451. props: uploadContentProps,
  51452. setup(__props, { expose }) {
  51453. const props = __props;
  51454. const ns = useNamespace("upload");
  51455. const disabled = useDisabled();
  51456. const requests = vue.shallowRef({});
  51457. const inputRef = vue.shallowRef();
  51458. const uploadFiles = (files) => {
  51459. if (files.length === 0)
  51460. return;
  51461. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  51462. if (limit && fileList.length + files.length > limit) {
  51463. onExceed(files, fileList);
  51464. return;
  51465. }
  51466. if (!multiple) {
  51467. files = files.slice(0, 1);
  51468. }
  51469. for (const file of files) {
  51470. const rawFile = file;
  51471. rawFile.uid = genFileId();
  51472. onStart(rawFile);
  51473. if (autoUpload)
  51474. upload(rawFile);
  51475. }
  51476. };
  51477. const upload = async (rawFile) => {
  51478. inputRef.value.value = "";
  51479. if (!props.beforeUpload) {
  51480. return doUpload(rawFile);
  51481. }
  51482. let hookResult;
  51483. try {
  51484. hookResult = await props.beforeUpload(rawFile);
  51485. } catch (e) {
  51486. hookResult = false;
  51487. }
  51488. if (hookResult === false) {
  51489. props.onRemove(rawFile);
  51490. return;
  51491. }
  51492. let file = rawFile;
  51493. if (hookResult instanceof Blob) {
  51494. if (hookResult instanceof File) {
  51495. file = hookResult;
  51496. } else {
  51497. file = new File([hookResult], rawFile.name, {
  51498. type: rawFile.type
  51499. });
  51500. }
  51501. }
  51502. doUpload(Object.assign(file, {
  51503. uid: rawFile.uid
  51504. }));
  51505. };
  51506. const doUpload = (rawFile) => {
  51507. const {
  51508. headers,
  51509. data,
  51510. method,
  51511. withCredentials,
  51512. name: filename,
  51513. action,
  51514. onProgress,
  51515. onSuccess,
  51516. onError,
  51517. httpRequest
  51518. } = props;
  51519. const { uid } = rawFile;
  51520. const options = {
  51521. headers: headers || {},
  51522. withCredentials,
  51523. file: rawFile,
  51524. data,
  51525. method,
  51526. filename,
  51527. action,
  51528. onProgress: (evt) => {
  51529. onProgress(evt, rawFile);
  51530. },
  51531. onSuccess: (res) => {
  51532. onSuccess(res, rawFile);
  51533. delete requests.value[uid];
  51534. },
  51535. onError: (err) => {
  51536. onError(err, rawFile);
  51537. delete requests.value[uid];
  51538. }
  51539. };
  51540. const request = httpRequest(options);
  51541. requests.value[uid] = request;
  51542. if (request instanceof Promise) {
  51543. request.then(options.onSuccess, options.onError);
  51544. }
  51545. };
  51546. const handleChange = (e) => {
  51547. const files = e.target.files;
  51548. if (!files)
  51549. return;
  51550. uploadFiles(Array.from(files));
  51551. };
  51552. const handleClick = () => {
  51553. if (!disabled.value) {
  51554. inputRef.value.value = "";
  51555. inputRef.value.click();
  51556. }
  51557. };
  51558. const handleKeydown = () => {
  51559. handleClick();
  51560. };
  51561. const abort = (file) => {
  51562. const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
  51563. _reqs.forEach(([uid, req]) => {
  51564. if (req instanceof XMLHttpRequest)
  51565. req.abort();
  51566. delete requests.value[uid];
  51567. });
  51568. };
  51569. expose({
  51570. abort,
  51571. upload
  51572. });
  51573. return (_ctx, _cache) => {
  51574. return vue.openBlock(), vue.createElementBlock("div", {
  51575. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.listType), vue.unref(ns).is("drag", _ctx.drag)]),
  51576. tabindex: "0",
  51577. onClick: handleClick,
  51578. onKeydown: vue.withKeys(vue.withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  51579. }, [
  51580. _ctx.drag ? (vue.openBlock(), vue.createBlock(UploadDragger, {
  51581. key: 0,
  51582. disabled: vue.unref(disabled),
  51583. onFile: uploadFiles
  51584. }, {
  51585. default: vue.withCtx(() => [
  51586. vue.renderSlot(_ctx.$slots, "default")
  51587. ]),
  51588. _: 3
  51589. }, 8, ["disabled"])) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }),
  51590. vue.createElementVNode("input", {
  51591. ref_key: "inputRef",
  51592. ref: inputRef,
  51593. class: vue.normalizeClass(vue.unref(ns).e("input")),
  51594. name: _ctx.name,
  51595. multiple: _ctx.multiple,
  51596. accept: _ctx.accept,
  51597. type: "file",
  51598. onChange: handleChange,
  51599. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  51600. }, ["stop"]))
  51601. }, null, 42, _hoisted_2$3)
  51602. ], 42, _hoisted_1$3);
  51603. };
  51604. }
  51605. });
  51606. var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "upload-content.vue"]]);
  51607. const SCOPE$1 = "ElUpload";
  51608. const revokeObjectURL = (file) => {
  51609. var _a;
  51610. if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
  51611. URL.revokeObjectURL(file.url);
  51612. }
  51613. };
  51614. const useHandlers = (props, uploadRef) => {
  51615. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  51616. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  51617. function abort(file) {
  51618. var _a;
  51619. (_a = uploadRef.value) == null ? void 0 : _a.abort(file);
  51620. }
  51621. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  51622. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  51623. }
  51624. const handleError = (err, rawFile) => {
  51625. const file = getFile(rawFile);
  51626. if (!file)
  51627. return;
  51628. console.error(err);
  51629. file.status = "fail";
  51630. uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
  51631. props.onError(err, file, uploadFiles.value);
  51632. props.onChange(file, uploadFiles.value);
  51633. };
  51634. const handleProgress = (evt, rawFile) => {
  51635. const file = getFile(rawFile);
  51636. if (!file)
  51637. return;
  51638. props.onProgress(evt, file, uploadFiles.value);
  51639. file.status = "uploading";
  51640. file.percentage = Math.round(evt.percent);
  51641. };
  51642. const handleSuccess = (response, rawFile) => {
  51643. const file = getFile(rawFile);
  51644. if (!file)
  51645. return;
  51646. file.status = "success";
  51647. file.response = response;
  51648. props.onSuccess(response, file, uploadFiles.value);
  51649. props.onChange(file, uploadFiles.value);
  51650. };
  51651. const handleStart = (file) => {
  51652. if (isNil(file.uid))
  51653. file.uid = genFileId();
  51654. const uploadFile = {
  51655. name: file.name,
  51656. percentage: 0,
  51657. status: "ready",
  51658. size: file.size,
  51659. raw: file,
  51660. uid: file.uid
  51661. };
  51662. if (props.listType === "picture-card" || props.listType === "picture") {
  51663. try {
  51664. uploadFile.url = URL.createObjectURL(file);
  51665. } catch (err) {
  51666. debugWarn(SCOPE$1, err.message);
  51667. props.onError(err, uploadFile, uploadFiles.value);
  51668. }
  51669. }
  51670. uploadFiles.value = [...uploadFiles.value, uploadFile];
  51671. props.onChange(uploadFile, uploadFiles.value);
  51672. };
  51673. const handleRemove = async (file) => {
  51674. const uploadFile = file instanceof File ? getFile(file) : file;
  51675. if (!uploadFile)
  51676. throwError(SCOPE$1, "file to be removed not found");
  51677. const doRemove = (file2) => {
  51678. abort(file2);
  51679. const fileList = uploadFiles.value;
  51680. fileList.splice(fileList.indexOf(file2), 1);
  51681. props.onRemove(file2, fileList);
  51682. revokeObjectURL(file2);
  51683. };
  51684. if (props.beforeRemove) {
  51685. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  51686. if (before !== false)
  51687. doRemove(uploadFile);
  51688. } else {
  51689. doRemove(uploadFile);
  51690. }
  51691. };
  51692. function submit() {
  51693. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  51694. var _a;
  51695. return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
  51696. });
  51697. }
  51698. vue.watch(() => props.listType, (val) => {
  51699. if (val !== "picture-card" && val !== "picture") {
  51700. return;
  51701. }
  51702. uploadFiles.value = uploadFiles.value.map((file) => {
  51703. const { raw, url } = file;
  51704. if (!url && raw) {
  51705. try {
  51706. file.url = URL.createObjectURL(raw);
  51707. } catch (err) {
  51708. props.onError(err, file, uploadFiles.value);
  51709. }
  51710. }
  51711. return file;
  51712. });
  51713. });
  51714. vue.watch(uploadFiles, (files) => {
  51715. for (const file of files) {
  51716. file.uid || (file.uid = genFileId());
  51717. file.status || (file.status = "success");
  51718. }
  51719. }, { immediate: true, deep: true });
  51720. return {
  51721. uploadFiles,
  51722. abort,
  51723. clearFiles,
  51724. handleError,
  51725. handleProgress,
  51726. handleStart,
  51727. handleSuccess,
  51728. handleRemove,
  51729. submit
  51730. };
  51731. };
  51732. const __default__$2 = vue.defineComponent({
  51733. name: "ElUpload"
  51734. });
  51735. const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
  51736. ...__default__$2,
  51737. props: uploadProps,
  51738. setup(__props, { expose }) {
  51739. const props = __props;
  51740. const slots = vue.useSlots();
  51741. const disabled = useDisabled();
  51742. const uploadRef = vue.shallowRef();
  51743. const {
  51744. abort,
  51745. submit,
  51746. clearFiles,
  51747. uploadFiles,
  51748. handleStart,
  51749. handleError,
  51750. handleRemove,
  51751. handleSuccess,
  51752. handleProgress
  51753. } = useHandlers(props, uploadRef);
  51754. const isPictureCard = vue.computed(() => props.listType === "picture-card");
  51755. const uploadContentProps = vue.computed(() => ({
  51756. ...props,
  51757. fileList: uploadFiles.value,
  51758. onStart: handleStart,
  51759. onProgress: handleProgress,
  51760. onSuccess: handleSuccess,
  51761. onError: handleError,
  51762. onRemove: handleRemove
  51763. }));
  51764. vue.onBeforeUnmount(() => {
  51765. uploadFiles.value.forEach(({ url }) => {
  51766. if (url == null ? void 0 : url.startsWith("blob:"))
  51767. URL.revokeObjectURL(url);
  51768. });
  51769. });
  51770. vue.provide(uploadContextKey, {
  51771. accept: vue.toRef(props, "accept")
  51772. });
  51773. expose({
  51774. abort,
  51775. submit,
  51776. clearFiles,
  51777. handleStart,
  51778. handleRemove
  51779. });
  51780. return (_ctx, _cache) => {
  51781. return vue.openBlock(), vue.createElementBlock("div", null, [
  51782. vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  51783. key: 0,
  51784. disabled: vue.unref(disabled),
  51785. "list-type": _ctx.listType,
  51786. files: vue.unref(uploadFiles),
  51787. "handle-preview": _ctx.onPreview,
  51788. onRemove: vue.unref(handleRemove)
  51789. }, vue.createSlots({
  51790. append: vue.withCtx(() => [
  51791. vue.createVNode(UploadContent, vue.mergeProps({
  51792. ref_key: "uploadRef",
  51793. ref: uploadRef
  51794. }, vue.unref(uploadContentProps)), {
  51795. default: vue.withCtx(() => [
  51796. vue.unref(slots).trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  51797. !vue.unref(slots).trigger && vue.unref(slots).default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  51798. ]),
  51799. _: 3
  51800. }, 16)
  51801. ]),
  51802. _: 2
  51803. }, [
  51804. _ctx.$slots.file ? {
  51805. name: "default",
  51806. fn: vue.withCtx(({ file }) => [
  51807. vue.renderSlot(_ctx.$slots, "file", { file })
  51808. ])
  51809. } : void 0
  51810. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true),
  51811. !vue.unref(isPictureCard) || vue.unref(isPictureCard) && !_ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadContent, vue.mergeProps({
  51812. key: 1,
  51813. ref_key: "uploadRef",
  51814. ref: uploadRef
  51815. }, vue.unref(uploadContentProps)), {
  51816. default: vue.withCtx(() => [
  51817. vue.unref(slots).trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  51818. !vue.unref(slots).trigger && vue.unref(slots).default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  51819. ]),
  51820. _: 3
  51821. }, 16)) : vue.createCommentVNode("v-if", true),
  51822. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "default", { key: 2 }) : vue.createCommentVNode("v-if", true),
  51823. vue.renderSlot(_ctx.$slots, "tip"),
  51824. !vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  51825. key: 3,
  51826. disabled: vue.unref(disabled),
  51827. "list-type": _ctx.listType,
  51828. files: vue.unref(uploadFiles),
  51829. "handle-preview": _ctx.onPreview,
  51830. onRemove: vue.unref(handleRemove)
  51831. }, vue.createSlots({ _: 2 }, [
  51832. _ctx.$slots.file ? {
  51833. name: "default",
  51834. fn: vue.withCtx(({ file }) => [
  51835. vue.renderSlot(_ctx.$slots, "file", { file })
  51836. ])
  51837. } : void 0
  51838. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true)
  51839. ]);
  51840. };
  51841. }
  51842. });
  51843. var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "upload.vue"]]);
  51844. const ElUpload = withInstall(Upload);
  51845. var Components = [
  51846. ElAffix,
  51847. ElAlert,
  51848. ElAutocomplete,
  51849. ElAutoResizer,
  51850. ElAvatar,
  51851. ElBacktop,
  51852. ElBadge,
  51853. ElBreadcrumb,
  51854. ElBreadcrumbItem,
  51855. ElButton,
  51856. ElButtonGroup$1,
  51857. ElCalendar,
  51858. ElCard,
  51859. ElCarousel,
  51860. ElCarouselItem,
  51861. ElCascader,
  51862. ElCascaderPanel,
  51863. ElCheckTag,
  51864. ElCheckbox,
  51865. ElCheckboxButton,
  51866. ElCheckboxGroup$1,
  51867. ElCol,
  51868. ElCollapse,
  51869. ElCollapseItem,
  51870. ElCollapseTransition,
  51871. ElColorPicker,
  51872. ElConfigProvider,
  51873. ElContainer,
  51874. ElAside,
  51875. ElFooter,
  51876. ElHeader,
  51877. ElMain,
  51878. ElDatePicker,
  51879. ElDescriptions,
  51880. ElDescriptionsItem,
  51881. ElDialog,
  51882. ElDivider,
  51883. ElDrawer,
  51884. ElDropdown,
  51885. ElDropdownItem,
  51886. ElDropdownMenu,
  51887. ElEmpty,
  51888. ElForm,
  51889. ElFormItem,
  51890. ElIcon,
  51891. ElImage,
  51892. ElImageViewer,
  51893. ElInput,
  51894. ElInputNumber,
  51895. ElLink,
  51896. ElMenu,
  51897. ElMenuItem,
  51898. ElMenuItemGroup,
  51899. ElPageHeader,
  51900. ElPagination,
  51901. ElPopconfirm,
  51902. ElPopover,
  51903. ElPopper,
  51904. ElProgress,
  51905. ElRadio,
  51906. ElRadioButton,
  51907. ElRadioGroup,
  51908. ElRate,
  51909. ElResult,
  51910. ElRow,
  51911. ElScrollbar,
  51912. ElSelect,
  51913. ElOption,
  51914. ElOptionGroup,
  51915. ElSelectV2,
  51916. ElSkeleton,
  51917. ElSkeletonItem,
  51918. ElSlider,
  51919. ElSpace,
  51920. ElSteps,
  51921. ElStep,
  51922. ElSwitch,
  51923. ElTable,
  51924. ElTableColumn,
  51925. ElTableV2,
  51926. ElTabs,
  51927. ElTabPane,
  51928. ElTag,
  51929. ElTimePicker,
  51930. ElTimeSelect,
  51931. ElTimeline,
  51932. ElTimelineItem,
  51933. ElTooltip,
  51934. ElTooltipV2,
  51935. ElTransfer,
  51936. ElTree,
  51937. ElTreeSelect,
  51938. ElTreeV2,
  51939. ElUpload
  51940. ];
  51941. const SCOPE = "ElInfiniteScroll";
  51942. const CHECK_INTERVAL = 50;
  51943. const DEFAULT_DELAY = 200;
  51944. const DEFAULT_DISTANCE = 0;
  51945. const attributes = {
  51946. delay: {
  51947. type: Number,
  51948. default: DEFAULT_DELAY
  51949. },
  51950. distance: {
  51951. type: Number,
  51952. default: DEFAULT_DISTANCE
  51953. },
  51954. disabled: {
  51955. type: Boolean,
  51956. default: false
  51957. },
  51958. immediate: {
  51959. type: Boolean,
  51960. default: true
  51961. }
  51962. };
  51963. const getScrollOptions = (el, instance) => {
  51964. return Object.entries(attributes).reduce((acm, [name, option]) => {
  51965. var _a, _b;
  51966. const { type, default: defaultValue } = option;
  51967. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  51968. let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
  51969. value = value === "false" ? false : value;
  51970. value = type(value);
  51971. acm[name] = Number.isNaN(value) ? defaultValue : value;
  51972. return acm;
  51973. }, {});
  51974. };
  51975. const destroyObserver = (el) => {
  51976. const { observer } = el[SCOPE];
  51977. if (observer) {
  51978. observer.disconnect();
  51979. delete el[SCOPE].observer;
  51980. }
  51981. };
  51982. const handleScroll = (el, cb) => {
  51983. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  51984. const { disabled, distance } = getScrollOptions(el, instance);
  51985. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  51986. const delta = scrollTop - lastScrollTop;
  51987. el[SCOPE].lastScrollTop = scrollTop;
  51988. if (observer || disabled || delta < 0)
  51989. return;
  51990. let shouldTrigger = false;
  51991. if (container === el) {
  51992. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  51993. } else {
  51994. const { clientTop, scrollHeight: height } = el;
  51995. const offsetTop = getOffsetTopDistance(el, containerEl);
  51996. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  51997. }
  51998. if (shouldTrigger) {
  51999. cb.call(instance);
  52000. }
  52001. };
  52002. function checkFull(el, cb) {
  52003. const { containerEl, instance } = el[SCOPE];
  52004. const { disabled } = getScrollOptions(el, instance);
  52005. if (disabled || containerEl.clientHeight === 0)
  52006. return;
  52007. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  52008. cb.call(instance);
  52009. } else {
  52010. destroyObserver(el);
  52011. }
  52012. }
  52013. const InfiniteScroll = {
  52014. async mounted(el, binding) {
  52015. const { instance, value: cb } = binding;
  52016. if (!isFunction(cb)) {
  52017. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  52018. }
  52019. await vue.nextTick();
  52020. const { delay, immediate } = getScrollOptions(el, instance);
  52021. const container = getScrollContainer(el, true);
  52022. const containerEl = container === window ? document.documentElement : container;
  52023. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  52024. if (!container)
  52025. return;
  52026. el[SCOPE] = {
  52027. instance,
  52028. container,
  52029. containerEl,
  52030. delay,
  52031. cb,
  52032. onScroll,
  52033. lastScrollTop: containerEl.scrollTop
  52034. };
  52035. if (immediate) {
  52036. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  52037. el[SCOPE].observer = observer;
  52038. observer.observe(el, { childList: true, subtree: true });
  52039. checkFull(el, cb);
  52040. }
  52041. container.addEventListener("scroll", onScroll);
  52042. },
  52043. unmounted(el) {
  52044. const { container, onScroll } = el[SCOPE];
  52045. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  52046. destroyObserver(el);
  52047. },
  52048. async updated(el) {
  52049. if (!el[SCOPE]) {
  52050. await vue.nextTick();
  52051. }
  52052. const { containerEl, cb, observer } = el[SCOPE];
  52053. if (containerEl.clientHeight && observer) {
  52054. checkFull(el, cb);
  52055. }
  52056. }
  52057. };
  52058. var InfiniteScroll$1 = InfiniteScroll;
  52059. const _InfiniteScroll = InfiniteScroll$1;
  52060. _InfiniteScroll.install = (app) => {
  52061. app.directive("InfiniteScroll", _InfiniteScroll);
  52062. };
  52063. const ElInfiniteScroll = _InfiniteScroll;
  52064. function createLoadingComponent(options) {
  52065. let afterLeaveTimer;
  52066. const ns = useNamespace("loading");
  52067. const afterLeaveFlag = vue.ref(false);
  52068. const data = vue.reactive({
  52069. ...options,
  52070. originalPosition: "",
  52071. originalOverflow: "",
  52072. visible: false
  52073. });
  52074. function setText(text) {
  52075. data.text = text;
  52076. }
  52077. function destroySelf() {
  52078. const target = data.parent;
  52079. if (!target.vLoadingAddClassList) {
  52080. let loadingNumber = target.getAttribute("loading-number");
  52081. loadingNumber = Number.parseInt(loadingNumber) - 1;
  52082. if (!loadingNumber) {
  52083. removeClass(target, ns.bm("parent", "relative"));
  52084. target.removeAttribute("loading-number");
  52085. } else {
  52086. target.setAttribute("loading-number", loadingNumber.toString());
  52087. }
  52088. removeClass(target, ns.bm("parent", "hidden"));
  52089. }
  52090. removeElLoadingChild();
  52091. loadingInstance.unmount();
  52092. }
  52093. function removeElLoadingChild() {
  52094. var _a, _b;
  52095. (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  52096. }
  52097. function close() {
  52098. var _a;
  52099. if (options.beforeClose && !options.beforeClose())
  52100. return;
  52101. afterLeaveFlag.value = true;
  52102. clearTimeout(afterLeaveTimer);
  52103. afterLeaveTimer = window.setTimeout(handleAfterLeave, 400);
  52104. data.visible = false;
  52105. (_a = options.closed) == null ? void 0 : _a.call(options);
  52106. }
  52107. function handleAfterLeave() {
  52108. if (!afterLeaveFlag.value)
  52109. return;
  52110. const target = data.parent;
  52111. afterLeaveFlag.value = false;
  52112. target.vLoadingAddClassList = void 0;
  52113. destroySelf();
  52114. }
  52115. const elLoadingComponent = {
  52116. name: "ElLoading",
  52117. setup() {
  52118. return () => {
  52119. const svg = data.spinner || data.svg;
  52120. const spinner = vue.h("svg", {
  52121. class: "circular",
  52122. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  52123. ...svg ? { innerHTML: svg } : {}
  52124. }, [
  52125. vue.h("circle", {
  52126. class: "path",
  52127. cx: "25",
  52128. cy: "25",
  52129. r: "20",
  52130. fill: "none"
  52131. })
  52132. ]);
  52133. const spinnerText = data.text ? vue.h("p", { class: ns.b("text") }, [data.text]) : void 0;
  52134. return vue.h(vue.Transition, {
  52135. name: ns.b("fade"),
  52136. onAfterLeave: handleAfterLeave
  52137. }, {
  52138. default: vue.withCtx(() => [
  52139. vue.withDirectives(vue.createVNode("div", {
  52140. style: {
  52141. backgroundColor: data.background || ""
  52142. },
  52143. class: [
  52144. ns.b("mask"),
  52145. data.customClass,
  52146. data.fullscreen ? "is-fullscreen" : ""
  52147. ]
  52148. }, [
  52149. vue.h("div", {
  52150. class: ns.b("spinner")
  52151. }, [spinner, spinnerText])
  52152. ]), [[vue.vShow, data.visible]])
  52153. ])
  52154. });
  52155. };
  52156. }
  52157. };
  52158. const loadingInstance = vue.createApp(elLoadingComponent);
  52159. const vm = loadingInstance.mount(document.createElement("div"));
  52160. return {
  52161. ...vue.toRefs(data),
  52162. setText,
  52163. removeElLoadingChild,
  52164. close,
  52165. handleAfterLeave,
  52166. vm,
  52167. get $el() {
  52168. return vm.$el;
  52169. }
  52170. };
  52171. }
  52172. let fullscreenInstance = void 0;
  52173. const Loading = function(options = {}) {
  52174. if (!isClient)
  52175. return void 0;
  52176. const resolved = resolveOptions(options);
  52177. if (resolved.fullscreen && fullscreenInstance) {
  52178. return fullscreenInstance;
  52179. }
  52180. const instance = createLoadingComponent({
  52181. ...resolved,
  52182. closed: () => {
  52183. var _a;
  52184. (_a = resolved.closed) == null ? void 0 : _a.call(resolved);
  52185. if (resolved.fullscreen)
  52186. fullscreenInstance = void 0;
  52187. }
  52188. });
  52189. addStyle(resolved, resolved.parent, instance);
  52190. addClassList(resolved, resolved.parent, instance);
  52191. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  52192. let loadingNumber = resolved.parent.getAttribute("loading-number");
  52193. if (!loadingNumber) {
  52194. loadingNumber = "1";
  52195. } else {
  52196. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  52197. }
  52198. resolved.parent.setAttribute("loading-number", loadingNumber);
  52199. resolved.parent.appendChild(instance.$el);
  52200. vue.nextTick(() => instance.visible.value = resolved.visible);
  52201. if (resolved.fullscreen) {
  52202. fullscreenInstance = instance;
  52203. }
  52204. return instance;
  52205. };
  52206. const resolveOptions = (options) => {
  52207. var _a, _b, _c, _d;
  52208. let target;
  52209. if (isString(options.target)) {
  52210. target = (_a = document.querySelector(options.target)) != null ? _a : document.body;
  52211. } else {
  52212. target = options.target || document.body;
  52213. }
  52214. return {
  52215. parent: target === document.body || options.body ? document.body : target,
  52216. background: options.background || "",
  52217. svg: options.svg || "",
  52218. svgViewBox: options.svgViewBox || "",
  52219. spinner: options.spinner || false,
  52220. text: options.text || "",
  52221. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  52222. lock: (_c = options.lock) != null ? _c : false,
  52223. customClass: options.customClass || "",
  52224. visible: (_d = options.visible) != null ? _d : true,
  52225. target
  52226. };
  52227. };
  52228. const addStyle = async (options, parent, instance) => {
  52229. const { nextZIndex } = useZIndex();
  52230. const maskStyle = {};
  52231. if (options.fullscreen) {
  52232. instance.originalPosition.value = getStyle(document.body, "position");
  52233. instance.originalOverflow.value = getStyle(document.body, "overflow");
  52234. maskStyle.zIndex = nextZIndex();
  52235. } else if (options.parent === document.body) {
  52236. instance.originalPosition.value = getStyle(document.body, "position");
  52237. await vue.nextTick();
  52238. for (const property of ["top", "left"]) {
  52239. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  52240. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  52241. }
  52242. for (const property of ["height", "width"]) {
  52243. maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  52244. }
  52245. } else {
  52246. instance.originalPosition.value = getStyle(parent, "position");
  52247. }
  52248. for (const [key, value] of Object.entries(maskStyle)) {
  52249. instance.$el.style[key] = value;
  52250. }
  52251. };
  52252. const addClassList = (options, parent, instance) => {
  52253. const ns = useNamespace("loading");
  52254. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  52255. addClass(parent, ns.bm("parent", "relative"));
  52256. } else {
  52257. removeClass(parent, ns.bm("parent", "relative"));
  52258. }
  52259. if (options.fullscreen && options.lock) {
  52260. addClass(parent, ns.bm("parent", "hidden"));
  52261. } else {
  52262. removeClass(parent, ns.bm("parent", "hidden"));
  52263. }
  52264. };
  52265. const INSTANCE_KEY = Symbol("ElLoading");
  52266. const createInstance = (el, binding) => {
  52267. var _a, _b, _c, _d;
  52268. const vm = binding.instance;
  52269. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  52270. const resolveExpression = (key) => {
  52271. const data = isString(key) && (vm == null ? void 0 : vm[key]) || key;
  52272. if (data)
  52273. return vue.ref(data);
  52274. else
  52275. return data;
  52276. };
  52277. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`));
  52278. const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen;
  52279. const options = {
  52280. text: getProp("text"),
  52281. svg: getProp("svg"),
  52282. svgViewBox: getProp("svgViewBox"),
  52283. spinner: getProp("spinner"),
  52284. background: getProp("background"),
  52285. customClass: getProp("customClass"),
  52286. fullscreen,
  52287. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  52288. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  52289. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  52290. };
  52291. el[INSTANCE_KEY] = {
  52292. options,
  52293. instance: Loading(options)
  52294. };
  52295. };
  52296. const updateOptions = (newOptions, originalOptions) => {
  52297. for (const key of Object.keys(originalOptions)) {
  52298. if (vue.isRef(originalOptions[key]))
  52299. originalOptions[key].value = newOptions[key];
  52300. }
  52301. };
  52302. const vLoading = {
  52303. mounted(el, binding) {
  52304. if (binding.value) {
  52305. createInstance(el, binding);
  52306. }
  52307. },
  52308. updated(el, binding) {
  52309. const instance = el[INSTANCE_KEY];
  52310. if (binding.oldValue !== binding.value) {
  52311. if (binding.value && !binding.oldValue) {
  52312. createInstance(el, binding);
  52313. } else if (binding.value && binding.oldValue) {
  52314. if (isObject$1(binding.value))
  52315. updateOptions(binding.value, instance.options);
  52316. } else {
  52317. instance == null ? void 0 : instance.instance.close();
  52318. }
  52319. }
  52320. },
  52321. unmounted(el) {
  52322. var _a;
  52323. (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close();
  52324. }
  52325. };
  52326. const ElLoading = {
  52327. install(app) {
  52328. app.directive("loading", vLoading);
  52329. app.config.globalProperties.$loading = Loading;
  52330. },
  52331. directive: vLoading,
  52332. service: Loading
  52333. };
  52334. const messageTypes = ["success", "info", "warning", "error"];
  52335. const messageDefaults = mutable({
  52336. customClass: "",
  52337. center: false,
  52338. dangerouslyUseHTMLString: false,
  52339. duration: 3e3,
  52340. icon: void 0,
  52341. id: "",
  52342. message: "",
  52343. onClose: void 0,
  52344. showClose: false,
  52345. type: "info",
  52346. offset: 16,
  52347. zIndex: 0,
  52348. grouping: false,
  52349. repeatNum: 1,
  52350. appendTo: isClient ? document.body : void 0
  52351. });
  52352. const messageProps = buildProps({
  52353. customClass: {
  52354. type: String,
  52355. default: messageDefaults.customClass
  52356. },
  52357. center: {
  52358. type: Boolean,
  52359. default: messageDefaults.center
  52360. },
  52361. dangerouslyUseHTMLString: {
  52362. type: Boolean,
  52363. default: messageDefaults.dangerouslyUseHTMLString
  52364. },
  52365. duration: {
  52366. type: Number,
  52367. default: messageDefaults.duration
  52368. },
  52369. icon: {
  52370. type: iconPropType,
  52371. default: messageDefaults.icon
  52372. },
  52373. id: {
  52374. type: String,
  52375. default: messageDefaults.id
  52376. },
  52377. message: {
  52378. type: definePropType([
  52379. String,
  52380. Object,
  52381. Function
  52382. ]),
  52383. default: messageDefaults.message
  52384. },
  52385. onClose: {
  52386. type: definePropType(Function),
  52387. required: false
  52388. },
  52389. showClose: {
  52390. type: Boolean,
  52391. default: messageDefaults.showClose
  52392. },
  52393. type: {
  52394. type: String,
  52395. values: messageTypes,
  52396. default: messageDefaults.type
  52397. },
  52398. offset: {
  52399. type: Number,
  52400. default: messageDefaults.offset
  52401. },
  52402. zIndex: {
  52403. type: Number,
  52404. default: messageDefaults.zIndex
  52405. },
  52406. grouping: {
  52407. type: Boolean,
  52408. default: messageDefaults.grouping
  52409. },
  52410. repeatNum: {
  52411. type: Number,
  52412. default: messageDefaults.repeatNum
  52413. }
  52414. });
  52415. const messageEmits = {
  52416. destroy: () => true
  52417. };
  52418. const instances = vue.shallowReactive([]);
  52419. const getInstance = (id) => {
  52420. const idx = instances.findIndex((instance) => instance.id === id);
  52421. const current = instances[idx];
  52422. let prev;
  52423. if (idx > 0) {
  52424. prev = instances[idx - 1];
  52425. }
  52426. return { current, prev };
  52427. };
  52428. const getLastOffset = (id) => {
  52429. const { prev } = getInstance(id);
  52430. if (!prev)
  52431. return 0;
  52432. return prev.vm.exposed.bottom.value;
  52433. };
  52434. const _hoisted_1$2 = ["id"];
  52435. const _hoisted_2$2 = ["innerHTML"];
  52436. const __default__$1 = vue.defineComponent({
  52437. name: "ElMessage"
  52438. });
  52439. const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
  52440. ...__default__$1,
  52441. props: messageProps,
  52442. emits: messageEmits,
  52443. setup(__props, { expose }) {
  52444. const props = __props;
  52445. const { Close } = TypeComponents;
  52446. const ns = useNamespace("message");
  52447. const messageRef = vue.ref();
  52448. const visible = vue.ref(false);
  52449. const height = vue.ref(0);
  52450. let stopTimer = void 0;
  52451. const badgeType = vue.computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  52452. const typeClass = vue.computed(() => {
  52453. const type = props.type;
  52454. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  52455. });
  52456. const iconComponent = vue.computed(() => props.icon || TypeComponentsMap[props.type] || "");
  52457. const lastOffset = vue.computed(() => getLastOffset(props.id));
  52458. const offset = vue.computed(() => props.offset + lastOffset.value);
  52459. const bottom = vue.computed(() => height.value + offset.value);
  52460. const customStyle = vue.computed(() => ({
  52461. top: `${offset.value}px`,
  52462. zIndex: props.zIndex
  52463. }));
  52464. function startTimer() {
  52465. if (props.duration === 0)
  52466. return;
  52467. ({ stop: stopTimer } = useTimeoutFn(() => {
  52468. close();
  52469. }, props.duration));
  52470. }
  52471. function clearTimer() {
  52472. stopTimer == null ? void 0 : stopTimer();
  52473. }
  52474. function close() {
  52475. visible.value = false;
  52476. }
  52477. function keydown({ code }) {
  52478. if (code === EVENT_CODE.esc) {
  52479. close();
  52480. }
  52481. }
  52482. vue.onMounted(() => {
  52483. startTimer();
  52484. visible.value = true;
  52485. });
  52486. vue.watch(() => props.repeatNum, () => {
  52487. clearTimer();
  52488. startTimer();
  52489. });
  52490. useEventListener(document, "keydown", keydown);
  52491. useResizeObserver(messageRef, () => {
  52492. height.value = messageRef.value.getBoundingClientRect().height;
  52493. });
  52494. expose({
  52495. visible,
  52496. bottom,
  52497. close
  52498. });
  52499. return (_ctx, _cache) => {
  52500. return vue.openBlock(), vue.createBlock(vue.Transition, {
  52501. name: vue.unref(ns).b("fade"),
  52502. onBeforeLeave: _ctx.onClose,
  52503. onAfterLeave: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("destroy")),
  52504. persisted: ""
  52505. }, {
  52506. default: vue.withCtx(() => [
  52507. vue.withDirectives(vue.createElementVNode("div", {
  52508. id: _ctx.id,
  52509. ref_key: "messageRef",
  52510. ref: messageRef,
  52511. class: vue.normalizeClass([
  52512. vue.unref(ns).b(),
  52513. { [vue.unref(ns).m(_ctx.type)]: _ctx.type && !_ctx.icon },
  52514. vue.unref(ns).is("center", _ctx.center),
  52515. vue.unref(ns).is("closable", _ctx.showClose),
  52516. _ctx.customClass
  52517. ]),
  52518. style: vue.normalizeStyle(vue.unref(customStyle)),
  52519. role: "alert",
  52520. onMouseenter: clearTimer,
  52521. onMouseleave: startTimer
  52522. }, [
  52523. _ctx.repeatNum > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElBadge), {
  52524. key: 0,
  52525. value: _ctx.repeatNum,
  52526. type: vue.unref(badgeType),
  52527. class: vue.normalizeClass(vue.unref(ns).e("badge"))
  52528. }, null, 8, ["value", "type", "class"])) : vue.createCommentVNode("v-if", true),
  52529. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  52530. key: 1,
  52531. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  52532. }, {
  52533. default: vue.withCtx(() => [
  52534. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  52535. ]),
  52536. _: 1
  52537. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  52538. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  52539. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", {
  52540. key: 0,
  52541. class: vue.normalizeClass(vue.unref(ns).e("content"))
  52542. }, vue.toDisplayString(_ctx.message), 3)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  52543. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  52544. vue.createElementVNode("p", {
  52545. class: vue.normalizeClass(vue.unref(ns).e("content")),
  52546. innerHTML: _ctx.message
  52547. }, null, 10, _hoisted_2$2)
  52548. ], 2112))
  52549. ]),
  52550. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  52551. key: 2,
  52552. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  52553. onClick: vue.withModifiers(close, ["stop"])
  52554. }, {
  52555. default: vue.withCtx(() => [
  52556. vue.createVNode(vue.unref(Close))
  52557. ]),
  52558. _: 1
  52559. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  52560. ], 46, _hoisted_1$2), [
  52561. [vue.vShow, visible.value]
  52562. ])
  52563. ]),
  52564. _: 3
  52565. }, 8, ["name", "onBeforeLeave"]);
  52566. };
  52567. }
  52568. });
  52569. var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
  52570. let seed$1 = 1;
  52571. const normalizeOptions = (params) => {
  52572. const options = !params || isString(params) || vue.isVNode(params) || isFunction(params) ? { message: params } : params;
  52573. const normalized = {
  52574. ...messageDefaults,
  52575. ...options
  52576. };
  52577. if (!normalized.appendTo) {
  52578. normalized.appendTo = document.body;
  52579. } else if (isString(normalized.appendTo)) {
  52580. let appendTo = document.querySelector(normalized.appendTo);
  52581. if (!isElement$1(appendTo)) {
  52582. appendTo = document.body;
  52583. }
  52584. normalized.appendTo = appendTo;
  52585. }
  52586. return normalized;
  52587. };
  52588. const closeMessage = (instance) => {
  52589. const idx = instances.indexOf(instance);
  52590. if (idx === -1)
  52591. return;
  52592. instances.splice(idx, 1);
  52593. const { handler } = instance;
  52594. handler.close();
  52595. };
  52596. const createMessage = ({ appendTo, ...options }, context) => {
  52597. const { nextZIndex } = useZIndex();
  52598. const id = `message_${seed$1++}`;
  52599. const userOnClose = options.onClose;
  52600. const container = document.createElement("div");
  52601. const props = {
  52602. ...options,
  52603. zIndex: nextZIndex() + options.zIndex,
  52604. id,
  52605. onClose: () => {
  52606. userOnClose == null ? void 0 : userOnClose();
  52607. closeMessage(instance);
  52608. },
  52609. onDestroy: () => {
  52610. vue.render(null, container);
  52611. }
  52612. };
  52613. const vnode = vue.createVNode(MessageConstructor, props, isFunction(props.message) || vue.isVNode(props.message) ? {
  52614. default: isFunction(props.message) ? props.message : () => props.message
  52615. } : null);
  52616. vnode.appContext = context || message._context;
  52617. vue.render(vnode, container);
  52618. appendTo.appendChild(container.firstElementChild);
  52619. const vm = vnode.component;
  52620. const handler = {
  52621. close: () => {
  52622. vm.exposed.visible.value = false;
  52623. }
  52624. };
  52625. const instance = {
  52626. id,
  52627. vnode,
  52628. vm,
  52629. handler,
  52630. props: vnode.component.props
  52631. };
  52632. return instance;
  52633. };
  52634. const message = (options = {}, context) => {
  52635. if (!isClient)
  52636. return { close: () => void 0 };
  52637. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  52638. return { close: () => void 0 };
  52639. }
  52640. const normalized = normalizeOptions(options);
  52641. if (normalized.grouping && instances.length) {
  52642. const instance2 = instances.find(({ vnode: vm }) => {
  52643. var _a;
  52644. return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message;
  52645. });
  52646. if (instance2) {
  52647. instance2.props.repeatNum += 1;
  52648. instance2.props.type = normalized.type;
  52649. return instance2.handler;
  52650. }
  52651. }
  52652. const instance = createMessage(normalized, context);
  52653. instances.push(instance);
  52654. return instance.handler;
  52655. };
  52656. messageTypes.forEach((type) => {
  52657. message[type] = (options = {}, appContext) => {
  52658. const normalized = normalizeOptions(options);
  52659. return message({ ...normalized, type }, appContext);
  52660. };
  52661. });
  52662. function closeAll$1(type) {
  52663. for (const instance of instances) {
  52664. if (!type || type === instance.props.type) {
  52665. instance.handler.close();
  52666. }
  52667. }
  52668. }
  52669. message.closeAll = closeAll$1;
  52670. message._context = null;
  52671. var Message = message;
  52672. const ElMessage = withInstallFunction(Message, "$message");
  52673. const _sfc_main$1 = vue.defineComponent({
  52674. name: "ElMessageBox",
  52675. directives: {
  52676. TrapFocus
  52677. },
  52678. components: {
  52679. ElButton,
  52680. ElFocusTrap,
  52681. ElInput,
  52682. ElOverlay,
  52683. ElIcon,
  52684. ...TypeComponents
  52685. },
  52686. inheritAttrs: false,
  52687. props: {
  52688. buttonSize: {
  52689. type: String,
  52690. validator: isValidComponentSize
  52691. },
  52692. modal: {
  52693. type: Boolean,
  52694. default: true
  52695. },
  52696. lockScroll: {
  52697. type: Boolean,
  52698. default: true
  52699. },
  52700. showClose: {
  52701. type: Boolean,
  52702. default: true
  52703. },
  52704. closeOnClickModal: {
  52705. type: Boolean,
  52706. default: true
  52707. },
  52708. closeOnPressEscape: {
  52709. type: Boolean,
  52710. default: true
  52711. },
  52712. closeOnHashChange: {
  52713. type: Boolean,
  52714. default: true
  52715. },
  52716. center: Boolean,
  52717. draggable: Boolean,
  52718. roundButton: {
  52719. default: false,
  52720. type: Boolean
  52721. },
  52722. container: {
  52723. type: String,
  52724. default: "body"
  52725. },
  52726. boxType: {
  52727. type: String,
  52728. default: ""
  52729. }
  52730. },
  52731. emits: ["vanish", "action"],
  52732. setup(props, { emit }) {
  52733. const { t } = useLocale();
  52734. const ns = useNamespace("message-box");
  52735. const visible = vue.ref(false);
  52736. const { nextZIndex } = useZIndex();
  52737. const state = vue.reactive({
  52738. autofocus: true,
  52739. beforeClose: null,
  52740. callback: null,
  52741. cancelButtonText: "",
  52742. cancelButtonClass: "",
  52743. confirmButtonText: "",
  52744. confirmButtonClass: "",
  52745. customClass: "",
  52746. customStyle: {},
  52747. dangerouslyUseHTMLString: false,
  52748. distinguishCancelAndClose: false,
  52749. icon: "",
  52750. inputPattern: null,
  52751. inputPlaceholder: "",
  52752. inputType: "text",
  52753. inputValue: null,
  52754. inputValidator: null,
  52755. inputErrorMessage: "",
  52756. message: null,
  52757. modalFade: true,
  52758. modalClass: "",
  52759. showCancelButton: false,
  52760. showConfirmButton: true,
  52761. type: "",
  52762. title: void 0,
  52763. showInput: false,
  52764. action: "",
  52765. confirmButtonLoading: false,
  52766. cancelButtonLoading: false,
  52767. confirmButtonDisabled: false,
  52768. editorErrorMessage: "",
  52769. validateError: false,
  52770. zIndex: nextZIndex()
  52771. });
  52772. const typeClass = vue.computed(() => {
  52773. const type = state.type;
  52774. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  52775. });
  52776. const contentId = useId();
  52777. const inputId = useId();
  52778. const btnSize = useSize(vue.computed(() => props.buttonSize), { prop: true, form: true, formItem: true });
  52779. const iconComponent = vue.computed(() => state.icon || TypeComponentsMap[state.type] || "");
  52780. const hasMessage = vue.computed(() => !!state.message);
  52781. const rootRef = vue.ref();
  52782. const headerRef = vue.ref();
  52783. const focusStartRef = vue.ref();
  52784. const inputRef = vue.ref();
  52785. const confirmRef = vue.ref();
  52786. const confirmButtonClasses = vue.computed(() => state.confirmButtonClass);
  52787. vue.watch(() => state.inputValue, async (val) => {
  52788. await vue.nextTick();
  52789. if (props.boxType === "prompt" && val !== null) {
  52790. validate();
  52791. }
  52792. }, { immediate: true });
  52793. vue.watch(() => visible.value, (val) => {
  52794. var _a, _b;
  52795. if (val) {
  52796. if (props.boxType !== "prompt") {
  52797. if (state.autofocus) {
  52798. focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
  52799. } else {
  52800. focusStartRef.value = rootRef.value;
  52801. }
  52802. }
  52803. state.zIndex = nextZIndex();
  52804. }
  52805. if (props.boxType !== "prompt")
  52806. return;
  52807. if (val) {
  52808. vue.nextTick().then(() => {
  52809. var _a2;
  52810. if (inputRef.value && inputRef.value.$el) {
  52811. if (state.autofocus) {
  52812. focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
  52813. } else {
  52814. focusStartRef.value = rootRef.value;
  52815. }
  52816. }
  52817. });
  52818. } else {
  52819. state.editorErrorMessage = "";
  52820. state.validateError = false;
  52821. }
  52822. });
  52823. const draggable = vue.computed(() => props.draggable);
  52824. useDraggable(rootRef, headerRef, draggable);
  52825. vue.onMounted(async () => {
  52826. await vue.nextTick();
  52827. if (props.closeOnHashChange) {
  52828. window.addEventListener("hashchange", doClose);
  52829. }
  52830. });
  52831. vue.onBeforeUnmount(() => {
  52832. if (props.closeOnHashChange) {
  52833. window.removeEventListener("hashchange", doClose);
  52834. }
  52835. });
  52836. function doClose() {
  52837. if (!visible.value)
  52838. return;
  52839. visible.value = false;
  52840. vue.nextTick(() => {
  52841. if (state.action)
  52842. emit("action", state.action);
  52843. });
  52844. }
  52845. const handleWrapperClick = () => {
  52846. if (props.closeOnClickModal) {
  52847. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  52848. }
  52849. };
  52850. const overlayEvent = useSameTarget(handleWrapperClick);
  52851. const handleInputEnter = (e) => {
  52852. if (state.inputType !== "textarea") {
  52853. e.preventDefault();
  52854. return handleAction("confirm");
  52855. }
  52856. };
  52857. const handleAction = (action) => {
  52858. var _a;
  52859. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  52860. return;
  52861. }
  52862. state.action = action;
  52863. if (state.beforeClose) {
  52864. (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose);
  52865. } else {
  52866. doClose();
  52867. }
  52868. };
  52869. const validate = () => {
  52870. if (props.boxType === "prompt") {
  52871. const inputPattern = state.inputPattern;
  52872. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  52873. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  52874. state.validateError = true;
  52875. return false;
  52876. }
  52877. const inputValidator = state.inputValidator;
  52878. if (typeof inputValidator === "function") {
  52879. const validateResult = inputValidator(state.inputValue);
  52880. if (validateResult === false) {
  52881. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  52882. state.validateError = true;
  52883. return false;
  52884. }
  52885. if (typeof validateResult === "string") {
  52886. state.editorErrorMessage = validateResult;
  52887. state.validateError = true;
  52888. return false;
  52889. }
  52890. }
  52891. }
  52892. state.editorErrorMessage = "";
  52893. state.validateError = false;
  52894. return true;
  52895. };
  52896. const getInputElement = () => {
  52897. const inputRefs = inputRef.value.$refs;
  52898. return inputRefs.input || inputRefs.textarea;
  52899. };
  52900. const handleClose = () => {
  52901. handleAction("close");
  52902. };
  52903. const onCloseRequested = () => {
  52904. if (props.closeOnPressEscape) {
  52905. handleClose();
  52906. }
  52907. };
  52908. if (props.lockScroll) {
  52909. useLockscreen(visible);
  52910. }
  52911. useRestoreActive(visible);
  52912. return {
  52913. ...vue.toRefs(state),
  52914. ns,
  52915. overlayEvent,
  52916. visible,
  52917. hasMessage,
  52918. typeClass,
  52919. contentId,
  52920. inputId,
  52921. btnSize,
  52922. iconComponent,
  52923. confirmButtonClasses,
  52924. rootRef,
  52925. focusStartRef,
  52926. headerRef,
  52927. inputRef,
  52928. confirmRef,
  52929. doClose,
  52930. handleClose,
  52931. onCloseRequested,
  52932. handleWrapperClick,
  52933. handleInputEnter,
  52934. handleAction,
  52935. t
  52936. };
  52937. }
  52938. });
  52939. const _hoisted_1$1 = ["aria-label", "aria-describedby"];
  52940. const _hoisted_2$1 = ["aria-label"];
  52941. const _hoisted_3$1 = ["id"];
  52942. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  52943. const _component_el_icon = vue.resolveComponent("el-icon");
  52944. const _component_close = vue.resolveComponent("close");
  52945. const _component_el_input = vue.resolveComponent("el-input");
  52946. const _component_el_button = vue.resolveComponent("el-button");
  52947. const _component_el_focus_trap = vue.resolveComponent("el-focus-trap");
  52948. const _component_el_overlay = vue.resolveComponent("el-overlay");
  52949. return vue.openBlock(), vue.createBlock(vue.Transition, {
  52950. name: "fade-in-linear",
  52951. onAfterLeave: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("vanish")),
  52952. persisted: ""
  52953. }, {
  52954. default: vue.withCtx(() => [
  52955. vue.withDirectives(vue.createVNode(_component_el_overlay, {
  52956. "z-index": _ctx.zIndex,
  52957. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  52958. mask: _ctx.modal
  52959. }, {
  52960. default: vue.withCtx(() => [
  52961. vue.createElementVNode("div", {
  52962. role: "dialog",
  52963. "aria-label": _ctx.title,
  52964. "aria-modal": "true",
  52965. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  52966. class: vue.normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  52967. onClick: _cache[8] || (_cache[8] = (...args) => _ctx.overlayEvent.onClick && _ctx.overlayEvent.onClick(...args)),
  52968. onMousedown: _cache[9] || (_cache[9] = (...args) => _ctx.overlayEvent.onMousedown && _ctx.overlayEvent.onMousedown(...args)),
  52969. onMouseup: _cache[10] || (_cache[10] = (...args) => _ctx.overlayEvent.onMouseup && _ctx.overlayEvent.onMouseup(...args))
  52970. }, [
  52971. vue.createVNode(_component_el_focus_trap, {
  52972. loop: "",
  52973. trapped: _ctx.visible,
  52974. "focus-trap-el": _ctx.rootRef,
  52975. "focus-start-el": _ctx.focusStartRef,
  52976. onReleaseRequested: _ctx.onCloseRequested
  52977. }, {
  52978. default: vue.withCtx(() => [
  52979. vue.createElementVNode("div", {
  52980. ref: "rootRef",
  52981. class: vue.normalizeClass([
  52982. _ctx.ns.b(),
  52983. _ctx.customClass,
  52984. _ctx.ns.is("draggable", _ctx.draggable),
  52985. { [_ctx.ns.m("center")]: _ctx.center }
  52986. ]),
  52987. style: vue.normalizeStyle(_ctx.customStyle),
  52988. tabindex: "-1",
  52989. onClick: _cache[7] || (_cache[7] = vue.withModifiers(() => {
  52990. }, ["stop"]))
  52991. }, [
  52992. _ctx.title !== null && _ctx.title !== void 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  52993. key: 0,
  52994. ref: "headerRef",
  52995. class: vue.normalizeClass(_ctx.ns.e("header"))
  52996. }, [
  52997. vue.createElementVNode("div", {
  52998. class: vue.normalizeClass(_ctx.ns.e("title"))
  52999. }, [
  53000. _ctx.iconComponent && _ctx.center ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  53001. key: 0,
  53002. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  53003. }, {
  53004. default: vue.withCtx(() => [
  53005. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  53006. ]),
  53007. _: 1
  53008. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  53009. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
  53010. ], 2),
  53011. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  53012. key: 0,
  53013. type: "button",
  53014. class: vue.normalizeClass(_ctx.ns.e("headerbtn")),
  53015. "aria-label": _ctx.t("el.messagebox.close"),
  53016. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel")),
  53017. onKeydown: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"]))
  53018. }, [
  53019. vue.createVNode(_component_el_icon, {
  53020. class: vue.normalizeClass(_ctx.ns.e("close"))
  53021. }, {
  53022. default: vue.withCtx(() => [
  53023. vue.createVNode(_component_close)
  53024. ]),
  53025. _: 1
  53026. }, 8, ["class"])
  53027. ], 42, _hoisted_2$1)) : vue.createCommentVNode("v-if", true)
  53028. ], 2)) : vue.createCommentVNode("v-if", true),
  53029. vue.createElementVNode("div", {
  53030. id: _ctx.contentId,
  53031. class: vue.normalizeClass(_ctx.ns.e("content"))
  53032. }, [
  53033. vue.createElementVNode("div", {
  53034. class: vue.normalizeClass(_ctx.ns.e("container"))
  53035. }, [
  53036. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  53037. key: 0,
  53038. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  53039. }, {
  53040. default: vue.withCtx(() => [
  53041. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  53042. ]),
  53043. _: 1
  53044. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  53045. _ctx.hasMessage ? (vue.openBlock(), vue.createElementBlock("div", {
  53046. key: 1,
  53047. class: vue.normalizeClass(_ctx.ns.e("message"))
  53048. }, [
  53049. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  53050. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  53051. key: 0,
  53052. for: _ctx.showInput ? _ctx.inputId : void 0
  53053. }, {
  53054. default: vue.withCtx(() => [
  53055. vue.createTextVNode(vue.toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
  53056. ]),
  53057. _: 1
  53058. }, 8, ["for"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  53059. key: 1,
  53060. for: _ctx.showInput ? _ctx.inputId : void 0,
  53061. innerHTML: _ctx.message
  53062. }, null, 8, ["for", "innerHTML"]))
  53063. ])
  53064. ], 2)) : vue.createCommentVNode("v-if", true)
  53065. ], 2),
  53066. vue.withDirectives(vue.createElementVNode("div", {
  53067. class: vue.normalizeClass(_ctx.ns.e("input"))
  53068. }, [
  53069. vue.createVNode(_component_el_input, {
  53070. id: _ctx.inputId,
  53071. ref: "inputRef",
  53072. modelValue: _ctx.inputValue,
  53073. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event),
  53074. type: _ctx.inputType,
  53075. placeholder: _ctx.inputPlaceholder,
  53076. "aria-invalid": _ctx.validateError,
  53077. class: vue.normalizeClass({ invalid: _ctx.validateError }),
  53078. onKeydown: vue.withKeys(_ctx.handleInputEnter, ["enter"])
  53079. }, null, 8, ["id", "modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  53080. vue.createElementVNode("div", {
  53081. class: vue.normalizeClass(_ctx.ns.e("errormsg")),
  53082. style: vue.normalizeStyle({
  53083. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  53084. })
  53085. }, vue.toDisplayString(_ctx.editorErrorMessage), 7)
  53086. ], 2), [
  53087. [vue.vShow, _ctx.showInput]
  53088. ])
  53089. ], 10, _hoisted_3$1),
  53090. vue.createElementVNode("div", {
  53091. class: vue.normalizeClass(_ctx.ns.e("btns"))
  53092. }, [
  53093. _ctx.showCancelButton ? (vue.openBlock(), vue.createBlock(_component_el_button, {
  53094. key: 0,
  53095. loading: _ctx.cancelButtonLoading,
  53096. class: vue.normalizeClass([_ctx.cancelButtonClass]),
  53097. round: _ctx.roundButton,
  53098. size: _ctx.btnSize,
  53099. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")),
  53100. onKeydown: _cache[4] || (_cache[4] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"]))
  53101. }, {
  53102. default: vue.withCtx(() => [
  53103. vue.createTextVNode(vue.toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  53104. ]),
  53105. _: 1
  53106. }, 8, ["loading", "class", "round", "size"])) : vue.createCommentVNode("v-if", true),
  53107. vue.withDirectives(vue.createVNode(_component_el_button, {
  53108. ref: "confirmRef",
  53109. type: "primary",
  53110. loading: _ctx.confirmButtonLoading,
  53111. class: vue.normalizeClass([_ctx.confirmButtonClasses]),
  53112. round: _ctx.roundButton,
  53113. disabled: _ctx.confirmButtonDisabled,
  53114. size: _ctx.btnSize,
  53115. onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")),
  53116. onKeydown: _cache[6] || (_cache[6] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"]))
  53117. }, {
  53118. default: vue.withCtx(() => [
  53119. vue.createTextVNode(vue.toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  53120. ]),
  53121. _: 1
  53122. }, 8, ["loading", "class", "round", "disabled", "size"]), [
  53123. [vue.vShow, _ctx.showConfirmButton]
  53124. ])
  53125. ], 2)
  53126. ], 6)
  53127. ]),
  53128. _: 3
  53129. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  53130. ], 42, _hoisted_1$1)
  53131. ]),
  53132. _: 3
  53133. }, 8, ["z-index", "overlay-class", "mask"]), [
  53134. [vue.vShow, _ctx.visible]
  53135. ])
  53136. ]),
  53137. _: 3
  53138. });
  53139. }
  53140. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]);
  53141. const messageInstance = /* @__PURE__ */ new Map();
  53142. const getAppendToElement = (props) => {
  53143. let appendTo = document.body;
  53144. if (props.appendTo) {
  53145. if (isString(props.appendTo)) {
  53146. appendTo = document.querySelector(props.appendTo);
  53147. }
  53148. if (isElement$1(props.appendTo)) {
  53149. appendTo = props.appendTo;
  53150. }
  53151. if (!isElement$1(appendTo)) {
  53152. appendTo = document.body;
  53153. }
  53154. }
  53155. return appendTo;
  53156. };
  53157. const initInstance = (props, container, appContext = null) => {
  53158. const vnode = vue.createVNode(MessageBoxConstructor, props, isFunction(props.message) || vue.isVNode(props.message) ? {
  53159. default: isFunction(props.message) ? props.message : () => props.message
  53160. } : null);
  53161. vnode.appContext = appContext;
  53162. vue.render(vnode, container);
  53163. getAppendToElement(props).appendChild(container.firstElementChild);
  53164. return vnode.component;
  53165. };
  53166. const genContainer = () => {
  53167. return document.createElement("div");
  53168. };
  53169. const showMessage = (options, appContext) => {
  53170. const container = genContainer();
  53171. options.onVanish = () => {
  53172. vue.render(null, container);
  53173. messageInstance.delete(vm);
  53174. };
  53175. options.onAction = (action) => {
  53176. const currentMsg = messageInstance.get(vm);
  53177. let resolve;
  53178. if (options.showInput) {
  53179. resolve = { value: vm.inputValue, action };
  53180. } else {
  53181. resolve = action;
  53182. }
  53183. if (options.callback) {
  53184. options.callback(resolve, instance.proxy);
  53185. } else {
  53186. if (action === "cancel" || action === "close") {
  53187. if (options.distinguishCancelAndClose && action !== "cancel") {
  53188. currentMsg.reject("close");
  53189. } else {
  53190. currentMsg.reject("cancel");
  53191. }
  53192. } else {
  53193. currentMsg.resolve(resolve);
  53194. }
  53195. }
  53196. };
  53197. const instance = initInstance(options, container, appContext);
  53198. const vm = instance.proxy;
  53199. for (const prop in options) {
  53200. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  53201. vm[prop] = options[prop];
  53202. }
  53203. }
  53204. vm.visible = true;
  53205. return vm;
  53206. };
  53207. function MessageBox(options, appContext = null) {
  53208. if (!isClient)
  53209. return Promise.reject();
  53210. let callback;
  53211. if (isString(options) || vue.isVNode(options)) {
  53212. options = {
  53213. message: options
  53214. };
  53215. } else {
  53216. callback = options.callback;
  53217. }
  53218. return new Promise((resolve, reject) => {
  53219. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  53220. messageInstance.set(vm, {
  53221. options,
  53222. callback,
  53223. resolve,
  53224. reject
  53225. });
  53226. });
  53227. }
  53228. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  53229. const MESSAGE_BOX_DEFAULT_OPTS = {
  53230. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  53231. confirm: { showCancelButton: true },
  53232. prompt: { showCancelButton: true, showInput: true }
  53233. };
  53234. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  53235. MessageBox[boxType] = messageBoxFactory(boxType);
  53236. });
  53237. function messageBoxFactory(boxType) {
  53238. return (message, title, options, appContext) => {
  53239. let titleOrOpts = "";
  53240. if (isObject$1(title)) {
  53241. options = title;
  53242. titleOrOpts = "";
  53243. } else if (isUndefined(title)) {
  53244. titleOrOpts = "";
  53245. } else {
  53246. titleOrOpts = title;
  53247. }
  53248. return MessageBox(Object.assign({
  53249. title: titleOrOpts,
  53250. message,
  53251. type: "",
  53252. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  53253. }, options, {
  53254. boxType
  53255. }), appContext);
  53256. };
  53257. }
  53258. MessageBox.close = () => {
  53259. messageInstance.forEach((_, vm) => {
  53260. vm.doClose();
  53261. });
  53262. messageInstance.clear();
  53263. };
  53264. MessageBox._context = null;
  53265. const _MessageBox = MessageBox;
  53266. _MessageBox.install = (app) => {
  53267. _MessageBox._context = app._context;
  53268. app.config.globalProperties.$msgbox = _MessageBox;
  53269. app.config.globalProperties.$messageBox = _MessageBox;
  53270. app.config.globalProperties.$alert = _MessageBox.alert;
  53271. app.config.globalProperties.$confirm = _MessageBox.confirm;
  53272. app.config.globalProperties.$prompt = _MessageBox.prompt;
  53273. };
  53274. const ElMessageBox = _MessageBox;
  53275. const notificationTypes = [
  53276. "success",
  53277. "info",
  53278. "warning",
  53279. "error"
  53280. ];
  53281. const notificationProps = buildProps({
  53282. customClass: {
  53283. type: String,
  53284. default: ""
  53285. },
  53286. dangerouslyUseHTMLString: {
  53287. type: Boolean,
  53288. default: false
  53289. },
  53290. duration: {
  53291. type: Number,
  53292. default: 4500
  53293. },
  53294. icon: {
  53295. type: iconPropType
  53296. },
  53297. id: {
  53298. type: String,
  53299. default: ""
  53300. },
  53301. message: {
  53302. type: definePropType([String, Object]),
  53303. default: ""
  53304. },
  53305. offset: {
  53306. type: Number,
  53307. default: 0
  53308. },
  53309. onClick: {
  53310. type: definePropType(Function),
  53311. default: () => void 0
  53312. },
  53313. onClose: {
  53314. type: definePropType(Function),
  53315. required: true
  53316. },
  53317. position: {
  53318. type: String,
  53319. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  53320. default: "top-right"
  53321. },
  53322. showClose: {
  53323. type: Boolean,
  53324. default: true
  53325. },
  53326. title: {
  53327. type: String,
  53328. default: ""
  53329. },
  53330. type: {
  53331. type: String,
  53332. values: [...notificationTypes, ""],
  53333. default: ""
  53334. },
  53335. zIndex: {
  53336. type: Number,
  53337. default: 0
  53338. }
  53339. });
  53340. const notificationEmits = {
  53341. destroy: () => true
  53342. };
  53343. const _hoisted_1 = ["id"];
  53344. const _hoisted_2 = ["textContent"];
  53345. const _hoisted_3 = { key: 0 };
  53346. const _hoisted_4 = ["innerHTML"];
  53347. const __default__ = vue.defineComponent({
  53348. name: "ElNotification"
  53349. });
  53350. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  53351. ...__default__,
  53352. props: notificationProps,
  53353. emits: notificationEmits,
  53354. setup(__props, { expose }) {
  53355. const props = __props;
  53356. const ns = useNamespace("notification");
  53357. const { Close } = CloseComponents;
  53358. const visible = vue.ref(false);
  53359. let timer = void 0;
  53360. const typeClass = vue.computed(() => {
  53361. const type = props.type;
  53362. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  53363. });
  53364. const iconComponent = vue.computed(() => {
  53365. if (!props.type)
  53366. return props.icon;
  53367. return TypeComponentsMap[props.type] || props.icon;
  53368. });
  53369. const horizontalClass = vue.computed(() => props.position.endsWith("right") ? "right" : "left");
  53370. const verticalProperty = vue.computed(() => props.position.startsWith("top") ? "top" : "bottom");
  53371. const positionStyle = vue.computed(() => {
  53372. return {
  53373. [verticalProperty.value]: `${props.offset}px`,
  53374. zIndex: props.zIndex
  53375. };
  53376. });
  53377. function startTimer() {
  53378. if (props.duration > 0) {
  53379. ({ stop: timer } = useTimeoutFn(() => {
  53380. if (visible.value)
  53381. close();
  53382. }, props.duration));
  53383. }
  53384. }
  53385. function clearTimer() {
  53386. timer == null ? void 0 : timer();
  53387. }
  53388. function close() {
  53389. visible.value = false;
  53390. }
  53391. function onKeydown({ code }) {
  53392. if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
  53393. clearTimer();
  53394. } else if (code === EVENT_CODE.esc) {
  53395. if (visible.value) {
  53396. close();
  53397. }
  53398. } else {
  53399. startTimer();
  53400. }
  53401. }
  53402. vue.onMounted(() => {
  53403. startTimer();
  53404. visible.value = true;
  53405. });
  53406. useEventListener(document, "keydown", onKeydown);
  53407. expose({
  53408. visible,
  53409. close
  53410. });
  53411. return (_ctx, _cache) => {
  53412. return vue.openBlock(), vue.createBlock(vue.Transition, {
  53413. name: vue.unref(ns).b("fade"),
  53414. onBeforeLeave: _ctx.onClose,
  53415. onAfterLeave: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("destroy")),
  53416. persisted: ""
  53417. }, {
  53418. default: vue.withCtx(() => [
  53419. vue.withDirectives(vue.createElementVNode("div", {
  53420. id: _ctx.id,
  53421. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.customClass, vue.unref(horizontalClass)]),
  53422. style: vue.normalizeStyle(vue.unref(positionStyle)),
  53423. role: "alert",
  53424. onMouseenter: clearTimer,
  53425. onMouseleave: startTimer,
  53426. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
  53427. }, [
  53428. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53429. key: 0,
  53430. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  53431. }, {
  53432. default: vue.withCtx(() => [
  53433. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  53434. ]),
  53435. _: 1
  53436. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  53437. vue.createElementVNode("div", {
  53438. class: vue.normalizeClass(vue.unref(ns).e("group"))
  53439. }, [
  53440. vue.createElementVNode("h2", {
  53441. class: vue.normalizeClass(vue.unref(ns).e("title")),
  53442. textContent: vue.toDisplayString(_ctx.title)
  53443. }, null, 10, _hoisted_2),
  53444. vue.withDirectives(vue.createElementVNode("div", {
  53445. class: vue.normalizeClass(vue.unref(ns).e("content")),
  53446. style: vue.normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  53447. }, [
  53448. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  53449. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_3, vue.toDisplayString(_ctx.message), 1)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  53450. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  53451. vue.createElementVNode("p", { innerHTML: _ctx.message }, null, 8, _hoisted_4)
  53452. ], 2112))
  53453. ])
  53454. ], 6), [
  53455. [vue.vShow, _ctx.message]
  53456. ]),
  53457. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53458. key: 0,
  53459. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  53460. onClick: vue.withModifiers(close, ["stop"])
  53461. }, {
  53462. default: vue.withCtx(() => [
  53463. vue.createVNode(vue.unref(Close))
  53464. ]),
  53465. _: 1
  53466. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  53467. ], 2)
  53468. ], 46, _hoisted_1), [
  53469. [vue.vShow, visible.value]
  53470. ])
  53471. ]),
  53472. _: 3
  53473. }, 8, ["name", "onBeforeLeave"]);
  53474. };
  53475. }
  53476. });
  53477. var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]);
  53478. const notifications = {
  53479. "top-left": [],
  53480. "top-right": [],
  53481. "bottom-left": [],
  53482. "bottom-right": []
  53483. };
  53484. const GAP_SIZE = 16;
  53485. let seed = 1;
  53486. const notify = function(options = {}, context = null) {
  53487. if (!isClient)
  53488. return { close: () => void 0 };
  53489. if (typeof options === "string" || vue.isVNode(options)) {
  53490. options = { message: options };
  53491. }
  53492. const position = options.position || "top-right";
  53493. let verticalOffset = options.offset || 0;
  53494. notifications[position].forEach(({ vm: vm2 }) => {
  53495. var _a;
  53496. verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
  53497. });
  53498. verticalOffset += GAP_SIZE;
  53499. const { nextZIndex } = useZIndex();
  53500. const id = `notification_${seed++}`;
  53501. const userOnClose = options.onClose;
  53502. const props = {
  53503. ...options,
  53504. zIndex: nextZIndex(),
  53505. offset: verticalOffset,
  53506. id,
  53507. onClose: () => {
  53508. close(id, position, userOnClose);
  53509. }
  53510. };
  53511. let appendTo = document.body;
  53512. if (isElement$1(options.appendTo)) {
  53513. appendTo = options.appendTo;
  53514. } else if (isString(options.appendTo)) {
  53515. appendTo = document.querySelector(options.appendTo);
  53516. }
  53517. if (!isElement$1(appendTo)) {
  53518. appendTo = document.body;
  53519. }
  53520. const container = document.createElement("div");
  53521. const vm = vue.createVNode(NotificationConstructor, props, vue.isVNode(props.message) ? {
  53522. default: () => props.message
  53523. } : null);
  53524. vm.appContext = context != null ? context : notify._context;
  53525. vm.props.onDestroy = () => {
  53526. vue.render(null, container);
  53527. };
  53528. vue.render(vm, container);
  53529. notifications[position].push({ vm });
  53530. appendTo.appendChild(container.firstElementChild);
  53531. return {
  53532. close: () => {
  53533. vm.component.exposed.visible.value = false;
  53534. }
  53535. };
  53536. };
  53537. notificationTypes.forEach((type) => {
  53538. notify[type] = (options = {}) => {
  53539. if (typeof options === "string" || vue.isVNode(options)) {
  53540. options = {
  53541. message: options
  53542. };
  53543. }
  53544. return notify({
  53545. ...options,
  53546. type
  53547. });
  53548. };
  53549. });
  53550. function close(id, position, userOnClose) {
  53551. const orientedNotifications = notifications[position];
  53552. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  53553. var _a;
  53554. return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
  53555. });
  53556. if (idx === -1)
  53557. return;
  53558. const { vm } = orientedNotifications[idx];
  53559. if (!vm)
  53560. return;
  53561. userOnClose == null ? void 0 : userOnClose(vm);
  53562. const removedHeight = vm.el.offsetHeight;
  53563. const verticalPos = position.split("-")[0];
  53564. orientedNotifications.splice(idx, 1);
  53565. const len = orientedNotifications.length;
  53566. if (len < 1)
  53567. return;
  53568. for (let i = idx; i < len; i++) {
  53569. const { el, component } = orientedNotifications[i].vm;
  53570. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  53571. component.props.offset = pos;
  53572. }
  53573. }
  53574. function closeAll() {
  53575. for (const orientedNotifications of Object.values(notifications)) {
  53576. orientedNotifications.forEach(({ vm }) => {
  53577. vm.component.exposed.visible.value = false;
  53578. });
  53579. }
  53580. }
  53581. notify.closeAll = closeAll;
  53582. notify._context = null;
  53583. var Notify = notify;
  53584. const ElNotification = withInstallFunction(Notify, "$notify");
  53585. var Plugins = [
  53586. ElInfiniteScroll,
  53587. ElLoading,
  53588. ElMessage,
  53589. ElMessageBox,
  53590. ElNotification,
  53591. ElPopoverDirective
  53592. ];
  53593. var installer = makeInstaller([...Components, ...Plugins]);
  53594. const install = installer.install;
  53595. const version = installer.version;
  53596. exports.BAR_MAP = BAR_MAP;
  53597. exports.CASCADER_PANEL_INJECTION_KEY = CASCADER_PANEL_INJECTION_KEY;
  53598. exports.CHANGE_EVENT = CHANGE_EVENT;
  53599. exports.ClickOutside = ClickOutside;
  53600. exports.CommonPicker = CommonPicker;
  53601. exports.CommonProps = CommonProps;
  53602. exports.DEFAULT_FORMATS_DATE = DEFAULT_FORMATS_DATE;
  53603. exports.DEFAULT_FORMATS_DATEPICKER = DEFAULT_FORMATS_DATEPICKER;
  53604. exports.DEFAULT_FORMATS_TIME = DEFAULT_FORMATS_TIME;
  53605. exports.DROPDOWN_COLLECTION_INJECTION_KEY = COLLECTION_INJECTION_KEY;
  53606. exports.DROPDOWN_COLLECTION_ITEM_INJECTION_KEY = COLLECTION_ITEM_INJECTION_KEY;
  53607. exports.DROPDOWN_INJECTION_KEY = DROPDOWN_INJECTION_KEY;
  53608. exports.DefaultProps = DefaultProps;
  53609. exports.DynamicSizeGrid = DynamicSizeGrid$1;
  53610. exports.DynamicSizeList = DynamicSizeList$1;
  53611. exports.EVENT_CODE = EVENT_CODE;
  53612. exports.Effect = Effect;
  53613. exports.ElAffix = ElAffix;
  53614. exports.ElAlert = ElAlert;
  53615. exports.ElAside = ElAside;
  53616. exports.ElAutoResizer = ElAutoResizer;
  53617. exports.ElAutocomplete = ElAutocomplete;
  53618. exports.ElAvatar = ElAvatar;
  53619. exports.ElBacktop = ElBacktop;
  53620. exports.ElBadge = ElBadge;
  53621. exports.ElBreadcrumb = ElBreadcrumb;
  53622. exports.ElBreadcrumbItem = ElBreadcrumbItem;
  53623. exports.ElButton = ElButton;
  53624. exports.ElButtonGroup = ElButtonGroup$1;
  53625. exports.ElCalendar = ElCalendar;
  53626. exports.ElCard = ElCard;
  53627. exports.ElCarousel = ElCarousel;
  53628. exports.ElCarouselItem = ElCarouselItem;
  53629. exports.ElCascader = ElCascader;
  53630. exports.ElCascaderPanel = ElCascaderPanel;
  53631. exports.ElCheckTag = ElCheckTag;
  53632. exports.ElCheckbox = ElCheckbox;
  53633. exports.ElCheckboxButton = ElCheckboxButton;
  53634. exports.ElCheckboxGroup = ElCheckboxGroup$1;
  53635. exports.ElCol = ElCol;
  53636. exports.ElCollapse = ElCollapse;
  53637. exports.ElCollapseItem = ElCollapseItem;
  53638. exports.ElCollapseTransition = ElCollapseTransition;
  53639. exports.ElCollection = ElCollection;
  53640. exports.ElCollectionItem = ElCollectionItem;
  53641. exports.ElColorPicker = ElColorPicker;
  53642. exports.ElConfigProvider = ElConfigProvider;
  53643. exports.ElContainer = ElContainer;
  53644. exports.ElDatePicker = ElDatePicker;
  53645. exports.ElDescriptions = ElDescriptions;
  53646. exports.ElDescriptionsItem = ElDescriptionsItem;
  53647. exports.ElDialog = ElDialog;
  53648. exports.ElDivider = ElDivider;
  53649. exports.ElDrawer = ElDrawer;
  53650. exports.ElDropdown = ElDropdown;
  53651. exports.ElDropdownItem = ElDropdownItem;
  53652. exports.ElDropdownMenu = ElDropdownMenu;
  53653. exports.ElEmpty = ElEmpty;
  53654. exports.ElFooter = ElFooter;
  53655. exports.ElForm = ElForm;
  53656. exports.ElFormItem = ElFormItem;
  53657. exports.ElHeader = ElHeader;
  53658. exports.ElIcon = ElIcon;
  53659. exports.ElImage = ElImage;
  53660. exports.ElImageViewer = ElImageViewer;
  53661. exports.ElInfiniteScroll = ElInfiniteScroll;
  53662. exports.ElInput = ElInput;
  53663. exports.ElInputNumber = ElInputNumber;
  53664. exports.ElLink = ElLink;
  53665. exports.ElLoading = ElLoading;
  53666. exports.ElLoadingDirective = vLoading;
  53667. exports.ElLoadingService = Loading;
  53668. exports.ElMain = ElMain;
  53669. exports.ElMenu = ElMenu;
  53670. exports.ElMenuItem = ElMenuItem;
  53671. exports.ElMenuItemGroup = ElMenuItemGroup;
  53672. exports.ElMessage = ElMessage;
  53673. exports.ElMessageBox = ElMessageBox;
  53674. exports.ElNotification = ElNotification;
  53675. exports.ElOption = ElOption;
  53676. exports.ElOptionGroup = ElOptionGroup;
  53677. exports.ElOverlay = ElOverlay;
  53678. exports.ElPageHeader = ElPageHeader;
  53679. exports.ElPagination = ElPagination;
  53680. exports.ElPopconfirm = ElPopconfirm;
  53681. exports.ElPopover = ElPopover;
  53682. exports.ElPopoverDirective = ElPopoverDirective;
  53683. exports.ElPopper = ElPopper;
  53684. exports.ElPopperArrow = ElPopperArrow;
  53685. exports.ElPopperContent = ElPopperContent;
  53686. exports.ElPopperTrigger = ElPopperTrigger;
  53687. exports.ElProgress = ElProgress;
  53688. exports.ElRadio = ElRadio;
  53689. exports.ElRadioButton = ElRadioButton;
  53690. exports.ElRadioGroup = ElRadioGroup;
  53691. exports.ElRate = ElRate;
  53692. exports.ElResult = ElResult;
  53693. exports.ElRow = ElRow;
  53694. exports.ElScrollbar = ElScrollbar;
  53695. exports.ElSelect = ElSelect;
  53696. exports.ElSelectV2 = ElSelectV2;
  53697. exports.ElSkeleton = ElSkeleton;
  53698. exports.ElSkeletonItem = ElSkeletonItem;
  53699. exports.ElSlider = ElSlider;
  53700. exports.ElSpace = ElSpace;
  53701. exports.ElStep = ElStep;
  53702. exports.ElSteps = ElSteps;
  53703. exports.ElSubMenu = ElSubMenu;
  53704. exports.ElSwitch = ElSwitch;
  53705. exports.ElTabPane = ElTabPane;
  53706. exports.ElTable = ElTable;
  53707. exports.ElTableColumn = ElTableColumn;
  53708. exports.ElTableV2 = ElTableV2;
  53709. exports.ElTabs = ElTabs;
  53710. exports.ElTag = ElTag;
  53711. exports.ElTimePicker = ElTimePicker;
  53712. exports.ElTimeSelect = ElTimeSelect;
  53713. exports.ElTimeline = ElTimeline;
  53714. exports.ElTimelineItem = ElTimelineItem;
  53715. exports.ElTooltip = ElTooltip;
  53716. exports.ElTransfer = ElTransfer;
  53717. exports.ElTree = ElTree;
  53718. exports.ElTreeSelect = ElTreeSelect;
  53719. exports.ElTreeV2 = ElTreeV2;
  53720. exports.ElUpload = ElUpload;
  53721. exports.FIRST_KEYS = FIRST_KEYS;
  53722. exports.FIRST_LAST_KEYS = FIRST_LAST_KEYS;
  53723. exports.FORWARD_REF_INJECTION_KEY = FORWARD_REF_INJECTION_KEY;
  53724. exports.FixedSizeGrid = FixedSizeGrid$1;
  53725. exports.FixedSizeList = FixedSizeList$1;
  53726. exports.GAP = GAP;
  53727. exports.ID_INJECTION_KEY = ID_INJECTION_KEY;
  53728. exports.INPUT_EVENT = INPUT_EVENT;
  53729. exports.INSTALLED_KEY = INSTALLED_KEY;
  53730. exports.IconComponentMap = IconComponentMap;
  53731. exports.IconMap = IconMap;
  53732. exports.LAST_KEYS = LAST_KEYS;
  53733. exports.LEFT_CHECK_CHANGE_EVENT = LEFT_CHECK_CHANGE_EVENT;
  53734. exports.Mousewheel = Mousewheel;
  53735. exports.POPPER_CONTENT_INJECTION_KEY = POPPER_CONTENT_INJECTION_KEY;
  53736. exports.POPPER_INJECTION_KEY = POPPER_INJECTION_KEY;
  53737. exports.RIGHT_CHECK_CHANGE_EVENT = RIGHT_CHECK_CHANGE_EVENT;
  53738. exports.ROOT_PICKER_INJECTION_KEY = ROOT_PICKER_INJECTION_KEY;
  53739. exports.RowAlign = RowAlign;
  53740. exports.RowJustify = RowJustify;
  53741. exports.TOOLTIP_INJECTION_KEY = TOOLTIP_INJECTION_KEY;
  53742. exports.TOOLTIP_V2_OPEN = TOOLTIP_V2_OPEN;
  53743. exports.TableV2 = TableV2$1;
  53744. exports.TableV2Alignment = Alignment;
  53745. exports.TableV2FixedDir = FixedDir;
  53746. exports.TableV2Placeholder = placeholderSign;
  53747. exports.TableV2SortOrder = SortOrder;
  53748. exports.TimePickPanel = TimePickPanel;
  53749. exports.TrapFocus = TrapFocus;
  53750. exports.UPDATE_MODEL_EVENT = UPDATE_MODEL_EVENT;
  53751. exports.WEEK_DAYS = WEEK_DAYS;
  53752. exports.affixEmits = affixEmits;
  53753. exports.affixProps = affixProps;
  53754. exports.alertEffects = alertEffects;
  53755. exports.alertEmits = alertEmits;
  53756. exports.alertProps = alertProps;
  53757. exports.arrowMiddleware = arrowMiddleware;
  53758. exports.autoResizerProps = autoResizerProps;
  53759. exports.autocompleteEmits = autocompleteEmits;
  53760. exports.autocompleteProps = autocompleteProps;
  53761. exports.avatarEmits = avatarEmits;
  53762. exports.avatarProps = avatarProps;
  53763. exports.backtopEmits = backtopEmits;
  53764. exports.backtopProps = backtopProps;
  53765. exports.badgeProps = badgeProps;
  53766. exports.breadcrumbItemProps = breadcrumbItemProps;
  53767. exports.breadcrumbKey = breadcrumbKey;
  53768. exports.breadcrumbProps = breadcrumbProps;
  53769. exports.buildLocaleContext = buildLocaleContext;
  53770. exports.buildTimeList = buildTimeList;
  53771. exports.buildTranslator = buildTranslator;
  53772. exports.buttonEmits = buttonEmits;
  53773. exports.buttonGroupContextKey = buttonGroupContextKey;
  53774. exports.buttonNativeTypes = buttonNativeTypes;
  53775. exports.buttonProps = buttonProps;
  53776. exports.buttonTypes = buttonTypes;
  53777. exports.calendarEmits = calendarEmits;
  53778. exports.calendarProps = calendarProps;
  53779. exports.cardProps = cardProps;
  53780. exports.carouselContextKey = carouselContextKey;
  53781. exports.carouselEmits = carouselEmits;
  53782. exports.carouselItemProps = carouselItemProps;
  53783. exports.carouselProps = carouselProps;
  53784. exports.checkTagEmits = checkTagEmits;
  53785. exports.checkTagProps = checkTagProps;
  53786. exports.checkboxEmits = checkboxEmits;
  53787. exports.checkboxGroupContextKey = checkboxGroupContextKey;
  53788. exports.checkboxGroupEmits = checkboxGroupEmits;
  53789. exports.checkboxGroupProps = checkboxGroupProps;
  53790. exports.checkboxProps = checkboxProps;
  53791. exports.colProps = colProps;
  53792. exports.collapseContextKey = collapseContextKey;
  53793. exports.collapseEmits = collapseEmits;
  53794. exports.collapseItemProps = collapseItemProps;
  53795. exports.collapseProps = collapseProps;
  53796. exports.colorPickerContextKey = colorPickerContextKey;
  53797. exports.colorPickerEmits = colorPickerEmits;
  53798. exports.colorPickerProps = colorPickerProps;
  53799. exports.componentSizeMap = componentSizeMap;
  53800. exports.componentSizes = componentSizes;
  53801. exports.configProviderContextKey = configProviderContextKey;
  53802. exports.configProviderProps = configProviderProps;
  53803. exports.createModelToggleComposable = createModelToggleComposable;
  53804. exports.dateEquals = dateEquals;
  53805. exports.datePickTypes = datePickTypes;
  53806. exports.dayjs = dayjs;
  53807. exports["default"] = installer;
  53808. exports.defaultNamespace = defaultNamespace;
  53809. exports.descriptionProps = descriptionProps;
  53810. exports.dialogEmits = dialogEmits;
  53811. exports.dialogInjectionKey = dialogInjectionKey;
  53812. exports.dialogProps = dialogProps;
  53813. exports.dividerProps = dividerProps;
  53814. exports.drawerEmits = drawerEmits;
  53815. exports.drawerProps = drawerProps;
  53816. exports.dropdownItemProps = dropdownItemProps;
  53817. exports.dropdownMenuProps = dropdownMenuProps;
  53818. exports.dropdownProps = dropdownProps;
  53819. exports.elPaginationKey = elPaginationKey;
  53820. exports.emitChangeFn = emitChangeFn;
  53821. exports.emptyProps = emptyProps;
  53822. exports.extractDateFormat = extractDateFormat;
  53823. exports.extractTimeFormat = extractTimeFormat;
  53824. exports.formContextKey = formContextKey;
  53825. exports.formEmits = formEmits;
  53826. exports.formItemContextKey = formItemContextKey;
  53827. exports.formItemProps = formItemProps;
  53828. exports.formItemValidateStates = formItemValidateStates;
  53829. exports.formProps = formProps;
  53830. exports.formatter = formatter;
  53831. exports.genFileId = genFileId;
  53832. exports.getPositionDataWithUnit = getPositionDataWithUnit;
  53833. exports.iconProps = iconProps;
  53834. exports.imageEmits = imageEmits;
  53835. exports.imageProps = imageProps;
  53836. exports.imageViewerEmits = imageViewerEmits;
  53837. exports.imageViewerProps = imageViewerProps;
  53838. exports.inputEmits = inputEmits;
  53839. exports.inputNumberEmits = inputNumberEmits;
  53840. exports.inputNumberProps = inputNumberProps;
  53841. exports.inputProps = inputProps;
  53842. exports.install = install;
  53843. exports.linkEmits = linkEmits;
  53844. exports.linkProps = linkProps;
  53845. exports.makeInstaller = makeInstaller;
  53846. exports.makeList = makeList;
  53847. exports.menuEmits = menuEmits;
  53848. exports.menuItemEmits = menuItemEmits;
  53849. exports.menuItemGroupProps = menuItemGroupProps;
  53850. exports.menuItemProps = menuItemProps;
  53851. exports.menuProps = menuProps;
  53852. exports.messageConfig = messageConfig;
  53853. exports.messageDefaults = messageDefaults;
  53854. exports.messageEmits = messageEmits;
  53855. exports.messageProps = messageProps;
  53856. exports.messageTypes = messageTypes;
  53857. exports.notificationEmits = notificationEmits;
  53858. exports.notificationProps = notificationProps;
  53859. exports.notificationTypes = notificationTypes;
  53860. exports.overlayEmits = overlayEmits;
  53861. exports.overlayProps = overlayProps;
  53862. exports.pageHeaderEmits = pageHeaderEmits;
  53863. exports.pageHeaderProps = pageHeaderProps;
  53864. exports.paginationEmits = paginationEmits;
  53865. exports.paginationProps = paginationProps;
  53866. exports.parseDate = parseDate;
  53867. exports.popconfirmProps = popconfirmProps;
  53868. exports.popoverEmits = popoverEmits;
  53869. exports.popoverProps = popoverProps;
  53870. exports.popperArrowProps = popperArrowProps;
  53871. exports.popperContentEmits = popperContentEmits;
  53872. exports.popperContentProps = popperContentProps;
  53873. exports.popperCoreConfigProps = popperCoreConfigProps;
  53874. exports.popperProps = popperProps;
  53875. exports.popperTriggerProps = popperTriggerProps;
  53876. exports.progressProps = progressProps;
  53877. exports.provideGlobalConfig = provideGlobalConfig;
  53878. exports.radioButtonProps = radioButtonProps;
  53879. exports.radioEmits = radioEmits;
  53880. exports.radioGroupEmits = radioGroupEmits;
  53881. exports.radioGroupKey = radioGroupKey;
  53882. exports.radioGroupProps = radioGroupProps;
  53883. exports.radioProps = radioProps;
  53884. exports.radioPropsBase = radioPropsBase;
  53885. exports.rangeArr = rangeArr;
  53886. exports.rateEmits = rateEmits;
  53887. exports.rateProps = rateProps;
  53888. exports.renderThumbStyle = renderThumbStyle$1;
  53889. exports.resultProps = resultProps;
  53890. exports.roleTypes = roleTypes;
  53891. exports.rowContextKey = rowContextKey;
  53892. exports.rowProps = rowProps;
  53893. exports.scrollbarContextKey = scrollbarContextKey;
  53894. exports.scrollbarEmits = scrollbarEmits;
  53895. exports.scrollbarProps = scrollbarProps;
  53896. exports.selectGroupKey = selectGroupKey;
  53897. exports.selectKey = selectKey;
  53898. exports.selectV2InjectionKey = selectV2InjectionKey;
  53899. exports.skeletonItemProps = skeletonItemProps;
  53900. exports.skeletonProps = skeletonProps;
  53901. exports.sliderContextKey = sliderContextKey;
  53902. exports.sliderEmits = sliderEmits;
  53903. exports.sliderProps = sliderProps;
  53904. exports.spaceProps = spaceProps;
  53905. exports.stepProps = stepProps;
  53906. exports.stepsEmits = stepsEmits;
  53907. exports.stepsProps = stepsProps;
  53908. exports.subMenuProps = subMenuProps;
  53909. exports.switchEmits = switchEmits;
  53910. exports.switchProps = switchProps;
  53911. exports.tabBarProps = tabBarProps;
  53912. exports.tabNavEmits = tabNavEmits;
  53913. exports.tabNavProps = tabNavProps;
  53914. exports.tabPaneProps = tabPaneProps;
  53915. exports.tableV2Props = tableV2Props;
  53916. exports.tableV2RowProps = tableV2RowProps;
  53917. exports.tabsEmits = tabsEmits;
  53918. exports.tabsProps = tabsProps;
  53919. exports.tabsRootContextKey = tabsRootContextKey;
  53920. exports.tagEmits = tagEmits;
  53921. exports.tagProps = tagProps;
  53922. exports.thumbProps = thumbProps;
  53923. exports.timePickerDefaultProps = timePickerDefaultProps;
  53924. exports.timeUnits = timeUnits;
  53925. exports.timelineItemProps = timelineItemProps;
  53926. exports.tooltipEmits = tooltipEmits;
  53927. exports.tooltipV2ContentKey = tooltipV2ContentKey;
  53928. exports.tooltipV2RootKey = tooltipV2RootKey;
  53929. exports.transferCheckedChangeFn = transferCheckedChangeFn;
  53930. exports.transferEmits = transferEmits;
  53931. exports.transferProps = transferProps;
  53932. exports.translate = translate;
  53933. exports.uploadBaseProps = uploadBaseProps;
  53934. exports.uploadContentProps = uploadContentProps;
  53935. exports.uploadContextKey = uploadContextKey;
  53936. exports.uploadDraggerEmits = uploadDraggerEmits;
  53937. exports.uploadDraggerProps = uploadDraggerProps;
  53938. exports.uploadListEmits = uploadListEmits;
  53939. exports.uploadListProps = uploadListProps;
  53940. exports.uploadListTypes = uploadListTypes;
  53941. exports.uploadProps = uploadProps;
  53942. exports.useAttrs = useAttrs;
  53943. exports.useCascaderConfig = useCascaderConfig;
  53944. exports.useCursor = useCursor;
  53945. exports.useDelayedRender = useDelayedRender;
  53946. exports.useDelayedToggle = useDelayedToggle;
  53947. exports.useDelayedToggleProps = useDelayedToggleProps;
  53948. exports.useDeprecated = useDeprecated;
  53949. exports.useDialog = useDialog;
  53950. exports.useDisabled = useDisabled;
  53951. exports.useDraggable = useDraggable;
  53952. exports.useEscapeKeydown = useEscapeKeydown;
  53953. exports.useFloating = useFloating;
  53954. exports.useFloatingProps = useFloatingProps;
  53955. exports.useFocus = useFocus;
  53956. exports.useFormItem = useFormItem;
  53957. exports.useFormItemInputId = useFormItemInputId;
  53958. exports.useForwardRef = useForwardRef;
  53959. exports.useForwardRefDirective = useForwardRefDirective;
  53960. exports.useGlobalConfig = useGlobalConfig;
  53961. exports.useId = useId;
  53962. exports.useIdInjection = useIdInjection;
  53963. exports.useLocale = useLocale;
  53964. exports.useLockscreen = useLockscreen;
  53965. exports.useModal = useModal;
  53966. exports.useModelToggle = useModelToggle;
  53967. exports.useModelToggleEmits = useModelToggleEmits;
  53968. exports.useModelToggleProps = useModelToggleProps;
  53969. exports.useNamespace = useNamespace;
  53970. exports.useOrderedChildren = useOrderedChildren;
  53971. exports.usePopperArrowProps = usePopperArrowProps;
  53972. exports.usePopperContainer = usePopperContainer;
  53973. exports.usePopperContainerId = usePopperContainerId;
  53974. exports.usePopperContentEmits = usePopperContentEmits;
  53975. exports.usePopperContentProps = usePopperContentProps;
  53976. exports.usePopperCoreConfigProps = usePopperCoreConfigProps;
  53977. exports.usePopperProps = usePopperProps;
  53978. exports.usePopperTriggerProps = usePopperTriggerProps;
  53979. exports.usePreventGlobal = usePreventGlobal;
  53980. exports.useProp = useProp;
  53981. exports.useRestoreActive = useRestoreActive;
  53982. exports.useSameTarget = useSameTarget;
  53983. exports.useSize = useSize;
  53984. exports.useSizeProp = useSizeProp;
  53985. exports.useSpace = useSpace;
  53986. exports.useTeleport = useTeleport;
  53987. exports.useThrottleRender = useThrottleRender;
  53988. exports.useTimeout = useTimeout;
  53989. exports.useTooltipContentProps = useTooltipContentProps;
  53990. exports.useTooltipModelToggle = useTooltipModelToggle;
  53991. exports.useTooltipModelToggleEmits = useTooltipModelToggleEmits;
  53992. exports.useTooltipModelToggleProps = useTooltipModelToggleProps;
  53993. exports.useTooltipProps = useTooltipProps;
  53994. exports.useTooltipTriggerProps = useTooltipTriggerProps;
  53995. exports.useTransitionFallthrough = useTransitionFallthrough;
  53996. exports.useTransitionFallthroughEmits = useTransitionFallthroughEmits;
  53997. exports.useZIndex = useZIndex;
  53998. exports.vLoading = vLoading;
  53999. exports.vRepeatClick = vRepeatClick;
  54000. exports.valueEquals = valueEquals;
  54001. exports.version = version;
  54002. exports.virtualizedGridProps = virtualizedGridProps;
  54003. exports.virtualizedListProps = virtualizedListProps;
  54004. exports.virtualizedProps = virtualizedProps;
  54005. exports.virtualizedScrollbarProps = virtualizedScrollbarProps;
  54006. Object.defineProperty(exports, '__esModule', { value: true });
  54007. }));