index.full.mjs 1.9 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928
  1. /*! Element Plus v2.13.6 */
  2. import { Comment, Fragment, Teleport, Text, Transition, TransitionGroup, cloneVNode, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, effectScope, getCurrentInstance, getCurrentScope, guardReactiveProps, h, inject, isRef, isVNode, markRaw, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onMounted, onScopeDispose, onUnmounted, onUpdated, openBlock, provide, reactive, readonly, ref, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, shallowReactive, shallowRef, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, triggerRef, unref, useAttrs as useAttrs$1, useSlots, vModelCheckbox, vModelRadio, vModelText, vShow, warn, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
  3. //#region \0rolldown/runtime.js
  4. var __create = Object.create;
  5. var __defProp = Object.defineProperty;
  6. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  7. var __getOwnPropNames = Object.getOwnPropertyNames;
  8. var __getProtoOf = Object.getPrototypeOf;
  9. var __hasOwnProp = Object.prototype.hasOwnProperty;
  10. var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
  11. var __copyProps = (to, from, except, desc) => {
  12. if (from && typeof from === "object" || typeof from === "function") {
  13. for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
  14. key = keys[i];
  15. if (!__hasOwnProp.call(to, key) && key !== except) {
  16. __defProp(to, key, {
  17. get: ((k) => from[k]).bind(null, key),
  18. enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
  19. });
  20. }
  21. }
  22. }
  23. return to;
  24. };
  25. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
  26. value: mod,
  27. enumerable: true
  28. }) : target, mod));
  29. //#endregion
  30. //#region ../../packages/utils/dom/aria.ts
  31. 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])`;
  32. const isShadowRoot$1 = (e) => {
  33. if (typeof ShadowRoot === "undefined") return false;
  34. return e instanceof ShadowRoot;
  35. };
  36. const isHTMLElement$1 = (e) => {
  37. if (typeof Element === "undefined") return false;
  38. return e instanceof Element;
  39. };
  40. /**
  41. * Determine if the testing element is visible on screen no matter if its on the viewport or not
  42. */
  43. const isVisible = (element) => {
  44. return getComputedStyle(element).position === "fixed" ? false : element.offsetParent !== null;
  45. };
  46. const obtainAllFocusableElements$1 = (element) => {
  47. return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item));
  48. };
  49. /**
  50. * @desc Determine if target element is focusable
  51. * @param element {HTMLElement}
  52. * @returns {Boolean} true if it is focusable
  53. */
  54. const isFocusable = (element) => {
  55. if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) return true;
  56. if (element.tabIndex < 0 || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true") return false;
  57. switch (element.nodeName) {
  58. case "A": return !!element.href && element.rel !== "ignore";
  59. case "INPUT": return !(element.type === "hidden" || element.type === "file");
  60. case "BUTTON":
  61. case "SELECT":
  62. case "TEXTAREA": return true;
  63. default: return false;
  64. }
  65. };
  66. /**
  67. * Trigger an event
  68. * mouseenter, mouseleave, mouseover, keyup, change, click, etc.
  69. * @param {HTMLElement} elm
  70. * @param {String} name
  71. * @param {*} opts
  72. */
  73. const triggerEvent = function(elm, name, ...opts) {
  74. let eventName;
  75. if (name.includes("mouse") || name.includes("click")) eventName = "MouseEvents";
  76. else if (name.includes("key")) eventName = "KeyboardEvent";
  77. else eventName = "HTMLEvents";
  78. const evt = document.createEvent(eventName);
  79. evt.initEvent(name, ...opts);
  80. elm.dispatchEvent(evt);
  81. return elm;
  82. };
  83. const isLeaf = (el) => !el.getAttribute("aria-owns");
  84. const getSibling = (el, distance, elClass) => {
  85. const { parentNode } = el;
  86. if (!parentNode) return null;
  87. const siblings = parentNode.querySelectorAll(elClass);
  88. return siblings[Array.prototype.indexOf.call(siblings, el) + distance] || null;
  89. };
  90. const focusElement = (el, options) => {
  91. if (!el || !el.focus) return;
  92. let cleanup = false;
  93. if (isHTMLElement$1(el) && !isFocusable(el) && !el.getAttribute("tabindex")) {
  94. el.setAttribute("tabindex", "-1");
  95. cleanup = true;
  96. }
  97. el.focus(options);
  98. if (isHTMLElement$1(el) && cleanup) el.removeAttribute("tabindex");
  99. };
  100. const focusNode = (el) => {
  101. if (!el) return;
  102. focusElement(el);
  103. !isLeaf(el) && el.click();
  104. };
  105. //#endregion
  106. //#region ../../packages/constants/aria.ts
  107. const EVENT_CODE = {
  108. tab: "Tab",
  109. enter: "Enter",
  110. space: "Space",
  111. left: "ArrowLeft",
  112. up: "ArrowUp",
  113. right: "ArrowRight",
  114. down: "ArrowDown",
  115. esc: "Escape",
  116. delete: "Delete",
  117. backspace: "Backspace",
  118. numpadEnter: "NumpadEnter",
  119. pageUp: "PageUp",
  120. pageDown: "PageDown",
  121. home: "Home",
  122. end: "End"
  123. };
  124. //#endregion
  125. //#region ../../packages/constants/date.ts
  126. const datePickTypes = [
  127. "year",
  128. "years",
  129. "month",
  130. "months",
  131. "date",
  132. "dates",
  133. "week",
  134. "datetime",
  135. "datetimerange",
  136. "daterange",
  137. "monthrange",
  138. "yearrange"
  139. ];
  140. const WEEK_DAYS = [
  141. "sun",
  142. "mon",
  143. "tue",
  144. "wed",
  145. "thu",
  146. "fri",
  147. "sat"
  148. ];
  149. //#endregion
  150. //#region ../../packages/constants/event.ts
  151. const UPDATE_MODEL_EVENT = "update:modelValue";
  152. const CHANGE_EVENT = "change";
  153. const INPUT_EVENT = "input";
  154. //#endregion
  155. //#region ../../packages/constants/key.ts
  156. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  157. //#endregion
  158. //#region ../../packages/constants/size.ts
  159. const componentSizes = [
  160. "",
  161. "default",
  162. "small",
  163. "large"
  164. ];
  165. const componentSizeMap = {
  166. large: 40,
  167. default: 32,
  168. small: 24
  169. };
  170. //#endregion
  171. //#region ../../packages/constants/column-alignment.ts
  172. const columnAlignment = [
  173. "left",
  174. "center",
  175. "right"
  176. ];
  177. //#endregion
  178. //#region ../../packages/constants/form.ts
  179. const MINIMUM_INPUT_WIDTH = 11;
  180. const BORDER_HORIZONTAL_WIDTH = 2;
  181. //#endregion
  182. //#region ../../node_modules/.pnpm/@vueuse+shared@12.0.0_typescript@5.5.4/node_modules/@vueuse/shared/index.mjs
  183. function computedEager(fn, options) {
  184. var _a;
  185. const result = shallowRef();
  186. watchEffect(() => {
  187. result.value = fn();
  188. }, {
  189. ...options,
  190. flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
  191. });
  192. return readonly(result);
  193. }
  194. function tryOnScopeDispose(fn) {
  195. if (getCurrentScope()) {
  196. onScopeDispose(fn);
  197. return true;
  198. }
  199. return false;
  200. }
  201. function toValue$1(r) {
  202. return typeof r === "function" ? r() : unref(r);
  203. }
  204. function toReactive(objectRef) {
  205. if (!isRef(objectRef)) return reactive(objectRef);
  206. return reactive(new Proxy({}, {
  207. get(_, p, receiver) {
  208. return unref(Reflect.get(objectRef.value, p, receiver));
  209. },
  210. set(_, p, value) {
  211. if (isRef(objectRef.value[p]) && !isRef(value)) objectRef.value[p].value = value;
  212. else objectRef.value[p] = value;
  213. return true;
  214. },
  215. deleteProperty(_, p) {
  216. return Reflect.deleteProperty(objectRef.value, p);
  217. },
  218. has(_, p) {
  219. return Reflect.has(objectRef.value, p);
  220. },
  221. ownKeys() {
  222. return Object.keys(objectRef.value);
  223. },
  224. getOwnPropertyDescriptor() {
  225. return {
  226. enumerable: true,
  227. configurable: true
  228. };
  229. }
  230. }));
  231. }
  232. function reactiveComputed(fn) {
  233. return toReactive(computed(fn));
  234. }
  235. const isClient = typeof window !== "undefined" && typeof document !== "undefined";
  236. const isWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
  237. const isDef = (val) => typeof val !== "undefined";
  238. const notNullish = (val) => val != null;
  239. const toString$1 = Object.prototype.toString;
  240. const isObject$2 = (val) => toString$1.call(val) === "[object Object]";
  241. const clamp$2 = (n, min, max) => Math.min(max, Math.max(min, n));
  242. const noop$1 = () => {};
  243. const isIOS = /* @__PURE__ */ getIsIOS();
  244. function getIsIOS() {
  245. var _a, _b;
  246. return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
  247. }
  248. function createFilterWrapper(filter, fn) {
  249. function wrapper(...args) {
  250. return new Promise((resolve, reject) => {
  251. Promise.resolve(filter(() => fn.apply(this, args), {
  252. fn,
  253. thisArg: this,
  254. args
  255. })).then(resolve).catch(reject);
  256. });
  257. }
  258. return wrapper;
  259. }
  260. function debounceFilter(ms, options = {}) {
  261. let timer;
  262. let maxTimer;
  263. let lastRejector = noop$1;
  264. const _clearTimeout = (timer2) => {
  265. clearTimeout(timer2);
  266. lastRejector();
  267. lastRejector = noop$1;
  268. };
  269. const filter = (invoke) => {
  270. const duration = toValue$1(ms);
  271. const maxDuration = toValue$1(options.maxWait);
  272. if (timer) _clearTimeout(timer);
  273. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  274. if (maxTimer) {
  275. _clearTimeout(maxTimer);
  276. maxTimer = null;
  277. }
  278. return Promise.resolve(invoke());
  279. }
  280. return new Promise((resolve, reject) => {
  281. lastRejector = options.rejectOnCancel ? reject : resolve;
  282. if (maxDuration && !maxTimer) maxTimer = setTimeout(() => {
  283. if (timer) _clearTimeout(timer);
  284. maxTimer = null;
  285. resolve(invoke());
  286. }, maxDuration);
  287. timer = setTimeout(() => {
  288. if (maxTimer) _clearTimeout(maxTimer);
  289. maxTimer = null;
  290. resolve(invoke());
  291. }, duration);
  292. });
  293. };
  294. return filter;
  295. }
  296. function throttleFilter(...args) {
  297. let lastExec = 0;
  298. let timer;
  299. let isLeading = true;
  300. let lastRejector = noop$1;
  301. let lastValue;
  302. let ms;
  303. let trailing;
  304. let leading;
  305. let rejectOnCancel;
  306. if (!isRef(args[0]) && typeof args[0] === "object") ({delay: ms, trailing = true, leading = true, rejectOnCancel = false} = args[0]);
  307. else [ms, trailing = true, leading = true, rejectOnCancel = false] = args;
  308. const clear = () => {
  309. if (timer) {
  310. clearTimeout(timer);
  311. timer = void 0;
  312. lastRejector();
  313. lastRejector = noop$1;
  314. }
  315. };
  316. const filter = (_invoke) => {
  317. const duration = toValue$1(ms);
  318. const elapsed = Date.now() - lastExec;
  319. const invoke = () => {
  320. return lastValue = _invoke();
  321. };
  322. clear();
  323. if (duration <= 0) {
  324. lastExec = Date.now();
  325. return invoke();
  326. }
  327. if (elapsed > duration && (leading || !isLeading)) {
  328. lastExec = Date.now();
  329. invoke();
  330. } else if (trailing) lastValue = new Promise((resolve, reject) => {
  331. lastRejector = rejectOnCancel ? reject : resolve;
  332. timer = setTimeout(() => {
  333. lastExec = Date.now();
  334. isLeading = true;
  335. resolve(invoke());
  336. clear();
  337. }, Math.max(0, duration - elapsed));
  338. });
  339. if (!leading && !timer) timer = setTimeout(() => isLeading = true, duration);
  340. isLeading = false;
  341. return lastValue;
  342. };
  343. return filter;
  344. }
  345. function cacheStringFunction$1(fn) {
  346. const cache = /* @__PURE__ */ Object.create(null);
  347. return (str) => {
  348. return cache[str] || (cache[str] = fn(str));
  349. };
  350. }
  351. const hyphenateRE$1 = /\B([A-Z])/g;
  352. const hyphenate$1 = cacheStringFunction$1((str) => str.replace(hyphenateRE$1, "-$1").toLowerCase());
  353. const camelizeRE$1 = /-(\w)/g;
  354. const camelize$1 = cacheStringFunction$1((str) => {
  355. return str.replace(camelizeRE$1, (_, c) => c ? c.toUpperCase() : "");
  356. });
  357. function getLifeCycleTarget(target) {
  358. return target || getCurrentInstance();
  359. }
  360. function useDebounceFn(fn, ms = 200, options = {}) {
  361. return createFilterWrapper(debounceFilter(ms, options), fn);
  362. }
  363. function refDebounced(value, ms = 200, options = {}) {
  364. const debounced = ref(value.value);
  365. const updater = useDebounceFn(() => {
  366. debounced.value = value.value;
  367. }, ms, options);
  368. watch(value, () => updater());
  369. return debounced;
  370. }
  371. function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {
  372. return createFilterWrapper(throttleFilter(ms, trailing, leading, rejectOnCancel), fn);
  373. }
  374. function tryOnMounted(fn, sync = true, target) {
  375. if (getLifeCycleTarget()) onMounted(fn, target);
  376. else if (sync) fn();
  377. else nextTick(fn);
  378. }
  379. function useTimeoutFn(cb, interval, options = {}) {
  380. const { immediate = true } = options;
  381. const isPending = ref(false);
  382. let timer = null;
  383. function clear() {
  384. if (timer) {
  385. clearTimeout(timer);
  386. timer = null;
  387. }
  388. }
  389. function stop() {
  390. isPending.value = false;
  391. clear();
  392. }
  393. function start(...args) {
  394. clear();
  395. isPending.value = true;
  396. timer = setTimeout(() => {
  397. isPending.value = false;
  398. timer = null;
  399. cb(...args);
  400. }, toValue$1(interval));
  401. }
  402. if (immediate) {
  403. isPending.value = true;
  404. if (isClient) start();
  405. }
  406. tryOnScopeDispose(stop);
  407. return {
  408. isPending: readonly(isPending),
  409. start,
  410. stop
  411. };
  412. }
  413. //#endregion
  414. //#region ../../node_modules/.pnpm/@vueuse+core@12.0.0_typescript@5.5.4/node_modules/@vueuse/core/index.mjs
  415. const defaultWindow = isClient ? window : void 0;
  416. const defaultDocument = isClient ? window.document : void 0;
  417. const defaultNavigator = isClient ? window.navigator : void 0;
  418. const defaultLocation = isClient ? window.location : void 0;
  419. function unrefElement(elRef) {
  420. var _a;
  421. const plain = toValue$1(elRef);
  422. return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
  423. }
  424. function useEventListener(...args) {
  425. let target;
  426. let events;
  427. let listeners;
  428. let options;
  429. if (typeof args[0] === "string" || Array.isArray(args[0])) {
  430. [events, listeners, options] = args;
  431. target = defaultWindow;
  432. } else [target, events, listeners, options] = args;
  433. if (!target) return noop$1;
  434. if (!Array.isArray(events)) events = [events];
  435. if (!Array.isArray(listeners)) listeners = [listeners];
  436. const cleanups = [];
  437. const cleanup = () => {
  438. cleanups.forEach((fn) => fn());
  439. cleanups.length = 0;
  440. };
  441. const register = (el, event, listener, options2) => {
  442. el.addEventListener(event, listener, options2);
  443. return () => el.removeEventListener(event, listener, options2);
  444. };
  445. const stopWatch = watch(() => [unrefElement(target), toValue$1(options)], ([el, options2]) => {
  446. cleanup();
  447. if (!el) return;
  448. const optionsClone = isObject$2(options2) ? { ...options2 } : options2;
  449. cleanups.push(...events.flatMap((event) => {
  450. return listeners.map((listener) => register(el, event, listener, optionsClone));
  451. }));
  452. }, {
  453. immediate: true,
  454. flush: "post"
  455. });
  456. const stop = () => {
  457. stopWatch();
  458. cleanup();
  459. };
  460. tryOnScopeDispose(stop);
  461. return stop;
  462. }
  463. let _iOSWorkaround = false;
  464. function onClickOutside(target, handler, options = {}) {
  465. const { window = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;
  466. if (!window) return noop$1;
  467. if (isIOS && !_iOSWorkaround) {
  468. _iOSWorkaround = true;
  469. Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", noop$1));
  470. window.document.documentElement.addEventListener("click", noop$1);
  471. }
  472. let shouldListen = true;
  473. const shouldIgnore = (event) => {
  474. return toValue$1(ignore).some((target2) => {
  475. if (typeof target2 === "string") return Array.from(window.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el));
  476. else {
  477. const el = unrefElement(target2);
  478. return el && (event.target === el || event.composedPath().includes(el));
  479. }
  480. });
  481. };
  482. function hasMultipleRoots(target2) {
  483. const vm = toValue$1(target2);
  484. return vm && vm.$.subTree.shapeFlag === 16;
  485. }
  486. function checkMultipleRoots(target2, event) {
  487. const vm = toValue$1(target2);
  488. const children = vm.$.subTree && vm.$.subTree.children;
  489. if (children == null || !Array.isArray(children)) return false;
  490. return children.some((child) => child.el === event.target || event.composedPath().includes(child.el));
  491. }
  492. const listener = (event) => {
  493. const el = unrefElement(target);
  494. if (event.target == null) return;
  495. if (!(el instanceof Element) && hasMultipleRoots(target) && checkMultipleRoots(target, event)) return;
  496. if (!el || el === event.target || event.composedPath().includes(el)) return;
  497. if (event.detail === 0) shouldListen = !shouldIgnore(event);
  498. if (!shouldListen) {
  499. shouldListen = true;
  500. return;
  501. }
  502. handler(event);
  503. };
  504. let isProcessingClick = false;
  505. const cleanup = [
  506. useEventListener(window, "click", (event) => {
  507. if (!isProcessingClick) {
  508. isProcessingClick = true;
  509. setTimeout(() => {
  510. isProcessingClick = false;
  511. }, 0);
  512. listener(event);
  513. }
  514. }, {
  515. passive: true,
  516. capture
  517. }),
  518. useEventListener(window, "pointerdown", (e) => {
  519. const el = unrefElement(target);
  520. shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));
  521. }, { passive: true }),
  522. detectIframe && useEventListener(window, "blur", (event) => {
  523. setTimeout(() => {
  524. var _a;
  525. const el = unrefElement(target);
  526. if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement))) handler(event);
  527. }, 0);
  528. })
  529. ].filter(Boolean);
  530. const stop = () => cleanup.forEach((fn) => fn());
  531. return stop;
  532. }
  533. function useMounted() {
  534. const isMounted = ref(false);
  535. const instance = getCurrentInstance();
  536. if (instance) onMounted(() => {
  537. isMounted.value = true;
  538. }, instance);
  539. return isMounted;
  540. }
  541. function useSupported(callback) {
  542. const isMounted = useMounted();
  543. return computed(() => {
  544. isMounted.value;
  545. return Boolean(callback());
  546. });
  547. }
  548. function useMutationObserver(target, callback, options = {}) {
  549. const { window = defaultWindow, ...mutationOptions } = options;
  550. let observer;
  551. const isSupported = useSupported(() => window && "MutationObserver" in window);
  552. const cleanup = () => {
  553. if (observer) {
  554. observer.disconnect();
  555. observer = void 0;
  556. }
  557. };
  558. const targets = computed(() => {
  559. const value = toValue$1(target);
  560. const items = (Array.isArray(value) ? value : [value]).map(unrefElement).filter(notNullish);
  561. return new Set(items);
  562. });
  563. const stopWatch = watch(() => targets.value, (targets2) => {
  564. cleanup();
  565. if (isSupported.value && targets2.size) {
  566. observer = new MutationObserver(callback);
  567. targets2.forEach((el) => observer.observe(el, mutationOptions));
  568. }
  569. }, {
  570. immediate: true,
  571. flush: "post"
  572. });
  573. const takeRecords = () => {
  574. return observer == null ? void 0 : observer.takeRecords();
  575. };
  576. const stop = () => {
  577. stopWatch();
  578. cleanup();
  579. };
  580. tryOnScopeDispose(stop);
  581. return {
  582. isSupported,
  583. stop,
  584. takeRecords
  585. };
  586. }
  587. function useActiveElement(options = {}) {
  588. var _a;
  589. const { window = defaultWindow, deep = true, triggerOnRemoval = false } = options;
  590. const document = (_a = options.document) != null ? _a : window == null ? void 0 : window.document;
  591. const getDeepActiveElement = () => {
  592. var _a2;
  593. let element = document == null ? void 0 : document.activeElement;
  594. if (deep) while (element == null ? void 0 : element.shadowRoot) element = (_a2 = element == null ? void 0 : element.shadowRoot) == null ? void 0 : _a2.activeElement;
  595. return element;
  596. };
  597. const activeElement = ref();
  598. const trigger = () => {
  599. activeElement.value = getDeepActiveElement();
  600. };
  601. if (window) {
  602. useEventListener(window, "blur", (event) => {
  603. if (event.relatedTarget !== null) return;
  604. trigger();
  605. }, true);
  606. useEventListener(window, "focus", trigger, true);
  607. }
  608. if (triggerOnRemoval) useMutationObserver(document, (mutations) => {
  609. mutations.filter((m) => m.removedNodes.length).map((n) => Array.from(n.removedNodes)).flat().forEach((node) => {
  610. if (node === activeElement.value) trigger();
  611. });
  612. }, {
  613. childList: true,
  614. subtree: true
  615. });
  616. trigger();
  617. return activeElement;
  618. }
  619. function useMediaQuery(query, options = {}) {
  620. const { window = defaultWindow } = options;
  621. const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
  622. let mediaQuery;
  623. const matches = ref(false);
  624. const handler = (event) => {
  625. matches.value = event.matches;
  626. };
  627. const cleanup = () => {
  628. if (!mediaQuery) return;
  629. if ("removeEventListener" in mediaQuery) mediaQuery.removeEventListener("change", handler);
  630. else mediaQuery.removeListener(handler);
  631. };
  632. const stopWatch = watchEffect(() => {
  633. if (!isSupported.value) return;
  634. cleanup();
  635. mediaQuery = window.matchMedia(toValue$1(query));
  636. if ("addEventListener" in mediaQuery) mediaQuery.addEventListener("change", handler);
  637. else mediaQuery.addListener(handler);
  638. matches.value = mediaQuery.matches;
  639. });
  640. tryOnScopeDispose(() => {
  641. stopWatch();
  642. cleanup();
  643. mediaQuery = void 0;
  644. });
  645. return matches;
  646. }
  647. function cloneFnJSON(source) {
  648. return JSON.parse(JSON.stringify(source));
  649. }
  650. function useCssVar(prop, target, options = {}) {
  651. const { window = defaultWindow, initialValue, observe = false } = options;
  652. const variable = ref(initialValue);
  653. const elRef = computed(() => {
  654. var _a;
  655. return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
  656. });
  657. function updateCssVar() {
  658. var _a;
  659. const key = toValue$1(prop);
  660. const el = toValue$1(elRef);
  661. if (el && window && key) variable.value = ((_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim()) || initialValue;
  662. }
  663. if (observe) useMutationObserver(elRef, updateCssVar, {
  664. attributeFilter: ["style", "class"],
  665. window
  666. });
  667. watch([elRef, () => toValue$1(prop)], (_, old) => {
  668. if (old[0] && old[1]) old[0].style.removeProperty(old[1]);
  669. updateCssVar();
  670. }, { immediate: true });
  671. watch(variable, (val) => {
  672. var _a;
  673. const raw_prop = toValue$1(prop);
  674. if (((_a = elRef.value) == null ? void 0 : _a.style) && raw_prop) if (val == null) elRef.value.style.removeProperty(raw_prop);
  675. else elRef.value.style.setProperty(raw_prop, val);
  676. });
  677. return variable;
  678. }
  679. function useDocumentVisibility(options = {}) {
  680. const { document = defaultDocument } = options;
  681. if (!document) return ref("visible");
  682. const visibility = ref(document.visibilityState);
  683. useEventListener(document, "visibilitychange", () => {
  684. visibility.value = document.visibilityState;
  685. });
  686. return visibility;
  687. }
  688. function useResizeObserver(target, callback, options = {}) {
  689. const { window = defaultWindow, ...observerOptions } = options;
  690. let observer;
  691. const isSupported = useSupported(() => window && "ResizeObserver" in window);
  692. const cleanup = () => {
  693. if (observer) {
  694. observer.disconnect();
  695. observer = void 0;
  696. }
  697. };
  698. const stopWatch = watch(computed(() => {
  699. const _targets = toValue$1(target);
  700. return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
  701. }), (els) => {
  702. cleanup();
  703. if (isSupported.value && window) {
  704. observer = new ResizeObserver(callback);
  705. for (const _el of els) if (_el) observer.observe(_el, observerOptions);
  706. }
  707. }, {
  708. immediate: true,
  709. flush: "post"
  710. });
  711. const stop = () => {
  712. cleanup();
  713. stopWatch();
  714. };
  715. tryOnScopeDispose(stop);
  716. return {
  717. isSupported,
  718. stop
  719. };
  720. }
  721. function useElementBounding(target, options = {}) {
  722. const { reset = true, windowResize = true, windowScroll = true, immediate = true, updateTiming = "sync" } = options;
  723. const height = ref(0);
  724. const bottom = ref(0);
  725. const left = ref(0);
  726. const right = ref(0);
  727. const top = ref(0);
  728. const width = ref(0);
  729. const x = ref(0);
  730. const y = ref(0);
  731. function recalculate() {
  732. const el = unrefElement(target);
  733. if (!el) {
  734. if (reset) {
  735. height.value = 0;
  736. bottom.value = 0;
  737. left.value = 0;
  738. right.value = 0;
  739. top.value = 0;
  740. width.value = 0;
  741. x.value = 0;
  742. y.value = 0;
  743. }
  744. return;
  745. }
  746. const rect = el.getBoundingClientRect();
  747. height.value = rect.height;
  748. bottom.value = rect.bottom;
  749. left.value = rect.left;
  750. right.value = rect.right;
  751. top.value = rect.top;
  752. width.value = rect.width;
  753. x.value = rect.x;
  754. y.value = rect.y;
  755. }
  756. function update() {
  757. if (updateTiming === "sync") recalculate();
  758. else if (updateTiming === "next-frame") requestAnimationFrame(() => recalculate());
  759. }
  760. useResizeObserver(target, update);
  761. watch(() => unrefElement(target), (ele) => !ele && update());
  762. useMutationObserver(target, update, { attributeFilter: ["style", "class"] });
  763. if (windowScroll) useEventListener("scroll", update, {
  764. capture: true,
  765. passive: true
  766. });
  767. if (windowResize) useEventListener("resize", update, { passive: true });
  768. tryOnMounted(() => {
  769. if (immediate) update();
  770. });
  771. return {
  772. height,
  773. bottom,
  774. left,
  775. right,
  776. top,
  777. width,
  778. x,
  779. y,
  780. update
  781. };
  782. }
  783. function useElementSize(target, initialSize = {
  784. width: 0,
  785. height: 0
  786. }, options = {}) {
  787. const { window = defaultWindow, box = "content-box" } = options;
  788. const isSVG = computed(() => {
  789. var _a, _b;
  790. return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
  791. });
  792. const width = ref(initialSize.width);
  793. const height = ref(initialSize.height);
  794. const { stop: stop1 } = useResizeObserver(target, ([entry]) => {
  795. const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
  796. if (window && isSVG.value) {
  797. const $elem = unrefElement(target);
  798. if ($elem) {
  799. const rect = $elem.getBoundingClientRect();
  800. width.value = rect.width;
  801. height.value = rect.height;
  802. }
  803. } else if (boxSize) {
  804. const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
  805. width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
  806. height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
  807. } else {
  808. width.value = entry.contentRect.width;
  809. height.value = entry.contentRect.height;
  810. }
  811. }, options);
  812. tryOnMounted(() => {
  813. const ele = unrefElement(target);
  814. if (ele) {
  815. width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
  816. height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
  817. }
  818. });
  819. const stop2 = watch(() => unrefElement(target), (ele) => {
  820. width.value = ele ? initialSize.width : 0;
  821. height.value = ele ? initialSize.height : 0;
  822. });
  823. function stop() {
  824. stop1();
  825. stop2();
  826. }
  827. return {
  828. width,
  829. height,
  830. stop
  831. };
  832. }
  833. function useIntersectionObserver(target, callback, options = {}) {
  834. const { root, rootMargin = "0px", threshold = 0, window = defaultWindow, immediate = true } = options;
  835. const isSupported = useSupported(() => window && "IntersectionObserver" in window);
  836. const targets = computed(() => {
  837. const _target = toValue$1(target);
  838. return (Array.isArray(_target) ? _target : [_target]).map(unrefElement).filter(notNullish);
  839. });
  840. let cleanup = noop$1;
  841. const isActive = ref(immediate);
  842. const stopWatch = isSupported.value ? watch(() => [
  843. targets.value,
  844. unrefElement(root),
  845. isActive.value
  846. ], ([targets2, root2]) => {
  847. cleanup();
  848. if (!isActive.value) return;
  849. if (!targets2.length) return;
  850. const observer = new IntersectionObserver(callback, {
  851. root: unrefElement(root2),
  852. rootMargin,
  853. threshold
  854. });
  855. targets2.forEach((el) => el && observer.observe(el));
  856. cleanup = () => {
  857. observer.disconnect();
  858. cleanup = noop$1;
  859. };
  860. }, {
  861. immediate,
  862. flush: "post"
  863. }) : noop$1;
  864. const stop = () => {
  865. cleanup();
  866. stopWatch();
  867. isActive.value = false;
  868. };
  869. tryOnScopeDispose(stop);
  870. return {
  871. isSupported,
  872. isActive,
  873. pause() {
  874. cleanup();
  875. isActive.value = false;
  876. },
  877. resume() {
  878. isActive.value = true;
  879. },
  880. stop
  881. };
  882. }
  883. const DEFAULT_UNITS = [
  884. {
  885. max: 6e4,
  886. value: 1e3,
  887. name: "second"
  888. },
  889. {
  890. max: 276e4,
  891. value: 6e4,
  892. name: "minute"
  893. },
  894. {
  895. max: 72e6,
  896. value: 36e5,
  897. name: "hour"
  898. },
  899. {
  900. max: 5184e5,
  901. value: 864e5,
  902. name: "day"
  903. },
  904. {
  905. max: 24192e5,
  906. value: 6048e5,
  907. name: "week"
  908. },
  909. {
  910. max: 28512e6,
  911. value: 2592e6,
  912. name: "month"
  913. },
  914. {
  915. max: Number.POSITIVE_INFINITY,
  916. value: 31536e6,
  917. name: "year"
  918. }
  919. ];
  920. function useVModel(props, key, emit, options = {}) {
  921. var _a, _b, _c;
  922. const { clone = false, passive = false, eventName, deep = false, defaultValue, shouldEmit } = options;
  923. const vm = getCurrentInstance();
  924. 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));
  925. let event = eventName;
  926. if (!key) key = "modelValue";
  927. event = event || `update:${key.toString()}`;
  928. const cloneFn = (val) => !clone ? val : typeof clone === "function" ? clone(val) : cloneFnJSON(val);
  929. const getValue = () => isDef(props[key]) ? cloneFn(props[key]) : defaultValue;
  930. const triggerEmit = (value) => {
  931. if (shouldEmit) {
  932. if (shouldEmit(value)) _emit(event, value);
  933. } else _emit(event, value);
  934. };
  935. if (passive) {
  936. const proxy = ref(getValue());
  937. let isUpdating = false;
  938. watch(() => props[key], (v) => {
  939. if (!isUpdating) {
  940. isUpdating = true;
  941. proxy.value = cloneFn(v);
  942. nextTick(() => isUpdating = false);
  943. }
  944. });
  945. watch(proxy, (v) => {
  946. if (!isUpdating && (v !== props[key] || deep)) triggerEmit(v);
  947. }, { deep });
  948. return proxy;
  949. } else return computed({
  950. get() {
  951. return getValue();
  952. },
  953. set(value) {
  954. triggerEmit(value);
  955. }
  956. });
  957. }
  958. function useWindowFocus(options = {}) {
  959. const { window = defaultWindow } = options;
  960. if (!window) return ref(false);
  961. const focused = ref(window.document.hasFocus());
  962. useEventListener(window, "blur", () => {
  963. focused.value = false;
  964. });
  965. useEventListener(window, "focus", () => {
  966. focused.value = true;
  967. });
  968. return focused;
  969. }
  970. function useWindowSize(options = {}) {
  971. const { window = defaultWindow, initialWidth = Number.POSITIVE_INFINITY, initialHeight = Number.POSITIVE_INFINITY, listenOrientation = true, includeScrollbar = true, type = "inner" } = options;
  972. const width = ref(initialWidth);
  973. const height = ref(initialHeight);
  974. const update = () => {
  975. if (window) if (type === "outer") {
  976. width.value = window.outerWidth;
  977. height.value = window.outerHeight;
  978. } else if (includeScrollbar) {
  979. width.value = window.innerWidth;
  980. height.value = window.innerHeight;
  981. } else {
  982. width.value = window.document.documentElement.clientWidth;
  983. height.value = window.document.documentElement.clientHeight;
  984. }
  985. };
  986. update();
  987. tryOnMounted(update);
  988. useEventListener("resize", update, { passive: true });
  989. if (listenOrientation) watch(useMediaQuery("(orientation: portrait)"), () => update());
  990. return {
  991. width,
  992. height
  993. };
  994. }
  995. //#endregion
  996. //#region ../../packages/utils/browser.ts
  997. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  998. const isAndroid = () => isClient && /android/i.test(window.navigator.userAgent);
  999. //#endregion
  1000. //#region ../../packages/utils/dom/event.ts
  1001. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  1002. const handleEvent = (event) => {
  1003. const shouldPrevent = theirsHandler?.(event);
  1004. if (checkForDefaultPrevented === false || !shouldPrevent) return oursHandler?.(event);
  1005. };
  1006. return handleEvent;
  1007. };
  1008. const whenMouse = (handler) => {
  1009. return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
  1010. };
  1011. const getEventCode = (event) => {
  1012. if (event.code && event.code !== "Unidentified") return event.code;
  1013. const key = getEventKey(event);
  1014. if (key) {
  1015. if (Object.values(EVENT_CODE).includes(key)) return key;
  1016. switch (key) {
  1017. case " ": return EVENT_CODE.space;
  1018. default: return "";
  1019. }
  1020. }
  1021. return "";
  1022. };
  1023. const getEventKey = (event) => {
  1024. let key = event.key && event.key !== "Unidentified" ? event.key : "";
  1025. if (!key && event.type === "keyup" && isAndroid()) {
  1026. const target = event.target;
  1027. key = target.value.charAt(target.selectionStart - 1);
  1028. }
  1029. return key;
  1030. };
  1031. //#endregion
  1032. //#region ../../packages/utils/dom/position.ts
  1033. const getOffsetTop = (el) => {
  1034. let offset = 0;
  1035. let parent = el;
  1036. while (parent) {
  1037. offset += parent.offsetTop;
  1038. parent = parent.offsetParent;
  1039. }
  1040. return offset;
  1041. };
  1042. const getOffsetTopDistance = (el, containerEl) => {
  1043. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  1044. };
  1045. const getClientXY = (event) => {
  1046. let clientX;
  1047. let clientY;
  1048. if (event.type === "touchend") {
  1049. clientY = event.changedTouches[0].clientY;
  1050. clientX = event.changedTouches[0].clientX;
  1051. } else if (event.type.startsWith("touch")) {
  1052. clientY = event.touches[0].clientY;
  1053. clientX = event.touches[0].clientX;
  1054. } else {
  1055. clientY = event.clientY;
  1056. clientX = event.clientX;
  1057. }
  1058. return {
  1059. clientX,
  1060. clientY
  1061. };
  1062. };
  1063. //#endregion
  1064. //#region ../../packages/utils/easings.ts
  1065. function easeInOutCubic(t, b, c, d) {
  1066. const cc = c - b;
  1067. t /= d / 2;
  1068. if (t < 1) return cc / 2 * t * t * t + b;
  1069. return cc / 2 * ((t -= 2) * t * t + 2) + b;
  1070. }
  1071. //#endregion
  1072. //#region ../../node_modules/.pnpm/@vue+shared@3.5.25/node_modules/@vue/shared/dist/shared.esm-bundler.js
  1073. /**
  1074. * @vue/shared v3.5.25
  1075. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  1076. * @license MIT
  1077. **/
  1078. /* @__NO_SIDE_EFFECTS__ */
  1079. function makeMap(str) {
  1080. const map = /* @__PURE__ */ Object.create(null);
  1081. for (const key of str.split(",")) map[key] = 1;
  1082. return (val) => val in map;
  1083. }
  1084. const NOOP = () => {};
  1085. const hasOwnProperty$14 = Object.prototype.hasOwnProperty;
  1086. const hasOwn = (val, key) => hasOwnProperty$14.call(val, key);
  1087. const isArray$1 = Array.isArray;
  1088. const isDate = (val) => toTypeString(val) === "[object Date]";
  1089. const isFunction$1 = (val) => typeof val === "function";
  1090. const isString = (val) => typeof val === "string";
  1091. const isObject$1 = (val) => val !== null && typeof val === "object";
  1092. const isPromise = (val) => {
  1093. return (isObject$1(val) || isFunction$1(val)) && isFunction$1(val.then) && isFunction$1(val.catch);
  1094. };
  1095. const objectToString$1 = Object.prototype.toString;
  1096. const toTypeString = (value) => objectToString$1.call(value);
  1097. const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
  1098. const cacheStringFunction = (fn) => {
  1099. const cache = /* @__PURE__ */ Object.create(null);
  1100. return ((str) => {
  1101. return cache[str] || (cache[str] = fn(str));
  1102. });
  1103. };
  1104. const camelizeRE = /-\w/g;
  1105. const camelize = cacheStringFunction((str) => {
  1106. return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
  1107. });
  1108. const hyphenateRE = /\B([A-Z])/g;
  1109. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  1110. const capitalize$1 = cacheStringFunction((str) => {
  1111. return str.charAt(0).toUpperCase() + str.slice(1);
  1112. });
  1113. const toHandlerKey$1 = cacheStringFunction((str) => {
  1114. return str ? `on${capitalize$1(str)}` : ``;
  1115. });
  1116. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  1117. const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
  1118. //#endregion
  1119. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js
  1120. /** Detect free variable `global` from Node.js. */
  1121. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  1122. //#endregion
  1123. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_root.js
  1124. /** Detect free variable `self`. */
  1125. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  1126. /** Used as a reference to the global object. */
  1127. var root = freeGlobal || freeSelf || Function("return this")();
  1128. //#endregion
  1129. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js
  1130. /** Built-in value references. */
  1131. var Symbol$1 = root.Symbol;
  1132. //#endregion
  1133. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js
  1134. /** Used for built-in method references. */
  1135. var objectProto$4 = Object.prototype;
  1136. /** Used to check objects for own properties. */
  1137. var hasOwnProperty$13 = objectProto$4.hasOwnProperty;
  1138. /**
  1139. * Used to resolve the
  1140. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  1141. * of values.
  1142. */
  1143. var nativeObjectToString$1 = objectProto$4.toString;
  1144. /** Built-in value references. */
  1145. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
  1146. /**
  1147. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  1148. *
  1149. * @private
  1150. * @param {*} value The value to query.
  1151. * @returns {string} Returns the raw `toStringTag`.
  1152. */
  1153. function getRawTag(value) {
  1154. var isOwn = hasOwnProperty$13.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  1155. try {
  1156. value[symToStringTag$1] = void 0;
  1157. var unmasked = true;
  1158. } catch (e) {}
  1159. var result = nativeObjectToString$1.call(value);
  1160. if (unmasked) if (isOwn) value[symToStringTag$1] = tag;
  1161. else delete value[symToStringTag$1];
  1162. return result;
  1163. }
  1164. //#endregion
  1165. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js
  1166. /**
  1167. * Used to resolve the
  1168. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  1169. * of values.
  1170. */
  1171. var nativeObjectToString = Object.prototype.toString;
  1172. /**
  1173. * Converts `value` to a string using `Object.prototype.toString`.
  1174. *
  1175. * @private
  1176. * @param {*} value The value to convert.
  1177. * @returns {string} Returns the converted string.
  1178. */
  1179. function objectToString(value) {
  1180. return nativeObjectToString.call(value);
  1181. }
  1182. //#endregion
  1183. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js
  1184. /** `Object#toString` result references. */
  1185. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  1186. /** Built-in value references. */
  1187. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
  1188. /**
  1189. * The base implementation of `getTag` without fallbacks for buggy environments.
  1190. *
  1191. * @private
  1192. * @param {*} value The value to query.
  1193. * @returns {string} Returns the `toStringTag`.
  1194. */
  1195. function baseGetTag(value) {
  1196. if (value == null) return value === void 0 ? undefinedTag : nullTag;
  1197. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  1198. }
  1199. //#endregion
  1200. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js
  1201. /**
  1202. * Checks if `value` is object-like. A value is object-like if it's not `null`
  1203. * and has a `typeof` result of "object".
  1204. *
  1205. * @static
  1206. * @memberOf _
  1207. * @since 4.0.0
  1208. * @category Lang
  1209. * @param {*} value The value to check.
  1210. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  1211. * @example
  1212. *
  1213. * _.isObjectLike({});
  1214. * // => true
  1215. *
  1216. * _.isObjectLike([1, 2, 3]);
  1217. * // => true
  1218. *
  1219. * _.isObjectLike(_.noop);
  1220. * // => false
  1221. *
  1222. * _.isObjectLike(null);
  1223. * // => false
  1224. */
  1225. function isObjectLike(value) {
  1226. return value != null && typeof value == "object";
  1227. }
  1228. //#endregion
  1229. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js
  1230. /** `Object#toString` result references. */
  1231. var symbolTag$3 = "[object Symbol]";
  1232. /**
  1233. * Checks if `value` is classified as a `Symbol` primitive or object.
  1234. *
  1235. * @static
  1236. * @memberOf _
  1237. * @since 4.0.0
  1238. * @category Lang
  1239. * @param {*} value The value to check.
  1240. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  1241. * @example
  1242. *
  1243. * _.isSymbol(Symbol.iterator);
  1244. * // => true
  1245. *
  1246. * _.isSymbol('abc');
  1247. * // => false
  1248. */
  1249. function isSymbol(value) {
  1250. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  1251. }
  1252. //#endregion
  1253. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js
  1254. /**
  1255. * A specialized version of `_.map` for arrays without support for iteratee
  1256. * shorthands.
  1257. *
  1258. * @private
  1259. * @param {Array} [array] The array to iterate over.
  1260. * @param {Function} iteratee The function invoked per iteration.
  1261. * @returns {Array} Returns the new mapped array.
  1262. */
  1263. function arrayMap(array, iteratee) {
  1264. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  1265. while (++index < length) result[index] = iteratee(array[index], index, array);
  1266. return result;
  1267. }
  1268. //#endregion
  1269. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArray.js
  1270. /**
  1271. * Checks if `value` is classified as an `Array` object.
  1272. *
  1273. * @static
  1274. * @memberOf _
  1275. * @since 0.1.0
  1276. * @category Lang
  1277. * @param {*} value The value to check.
  1278. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  1279. * @example
  1280. *
  1281. * _.isArray([1, 2, 3]);
  1282. * // => true
  1283. *
  1284. * _.isArray(document.body.children);
  1285. * // => false
  1286. *
  1287. * _.isArray('abc');
  1288. * // => false
  1289. *
  1290. * _.isArray(_.noop);
  1291. * // => false
  1292. */
  1293. var isArray = Array.isArray;
  1294. //#endregion
  1295. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js
  1296. /** Used as references for various `Number` constants. */
  1297. var INFINITY$3 = Infinity;
  1298. /** Used to convert symbols to primitives and strings. */
  1299. var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  1300. /**
  1301. * The base implementation of `_.toString` which doesn't convert nullish
  1302. * values to empty strings.
  1303. *
  1304. * @private
  1305. * @param {*} value The value to process.
  1306. * @returns {string} Returns the string.
  1307. */
  1308. function baseToString(value) {
  1309. if (typeof value == "string") return value;
  1310. if (isArray(value)) return arrayMap(value, baseToString) + "";
  1311. if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : "";
  1312. var result = value + "";
  1313. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  1314. }
  1315. //#endregion
  1316. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js
  1317. /** Used to match a single whitespace character. */
  1318. var reWhitespace = /\s/;
  1319. /**
  1320. * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
  1321. * character of `string`.
  1322. *
  1323. * @private
  1324. * @param {string} string The string to inspect.
  1325. * @returns {number} Returns the index of the last non-whitespace character.
  1326. */
  1327. function trimmedEndIndex(string) {
  1328. var index = string.length;
  1329. while (index-- && reWhitespace.test(string.charAt(index)));
  1330. return index;
  1331. }
  1332. //#endregion
  1333. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js
  1334. /** Used to match leading whitespace. */
  1335. var reTrimStart = /^\s+/;
  1336. /**
  1337. * The base implementation of `_.trim`.
  1338. *
  1339. * @private
  1340. * @param {string} string The string to trim.
  1341. * @returns {string} Returns the trimmed string.
  1342. */
  1343. function baseTrim(string) {
  1344. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
  1345. }
  1346. //#endregion
  1347. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObject.js
  1348. /**
  1349. * Checks if `value` is the
  1350. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  1351. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  1352. *
  1353. * @static
  1354. * @memberOf _
  1355. * @since 0.1.0
  1356. * @category Lang
  1357. * @param {*} value The value to check.
  1358. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  1359. * @example
  1360. *
  1361. * _.isObject({});
  1362. * // => true
  1363. *
  1364. * _.isObject([1, 2, 3]);
  1365. * // => true
  1366. *
  1367. * _.isObject(_.noop);
  1368. * // => true
  1369. *
  1370. * _.isObject(null);
  1371. * // => false
  1372. */
  1373. function isObject(value) {
  1374. var type = typeof value;
  1375. return value != null && (type == "object" || type == "function");
  1376. }
  1377. //#endregion
  1378. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js
  1379. /** Used as references for various `Number` constants. */
  1380. var NAN = NaN;
  1381. /** Used to detect bad signed hexadecimal string values. */
  1382. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1383. /** Used to detect binary string values. */
  1384. var reIsBinary = /^0b[01]+$/i;
  1385. /** Used to detect octal string values. */
  1386. var reIsOctal = /^0o[0-7]+$/i;
  1387. /** Built-in method references without a dependency on `root`. */
  1388. var freeParseInt = parseInt;
  1389. /**
  1390. * Converts `value` to a number.
  1391. *
  1392. * @static
  1393. * @memberOf _
  1394. * @since 4.0.0
  1395. * @category Lang
  1396. * @param {*} value The value to process.
  1397. * @returns {number} Returns the number.
  1398. * @example
  1399. *
  1400. * _.toNumber(3.2);
  1401. * // => 3.2
  1402. *
  1403. * _.toNumber(Number.MIN_VALUE);
  1404. * // => 5e-324
  1405. *
  1406. * _.toNumber(Infinity);
  1407. * // => Infinity
  1408. *
  1409. * _.toNumber('3.2');
  1410. * // => 3.2
  1411. */
  1412. function toNumber(value) {
  1413. if (typeof value == "number") return value;
  1414. if (isSymbol(value)) return NAN;
  1415. if (isObject(value)) {
  1416. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  1417. value = isObject(other) ? other + "" : other;
  1418. }
  1419. if (typeof value != "string") return value === 0 ? value : +value;
  1420. value = baseTrim(value);
  1421. var isBinary = reIsBinary.test(value);
  1422. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  1423. }
  1424. //#endregion
  1425. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toFinite.js
  1426. /** Used as references for various `Number` constants. */
  1427. var INFINITY$2 = Infinity, MAX_INTEGER = 17976931348623157e292;
  1428. /**
  1429. * Converts `value` to a finite number.
  1430. *
  1431. * @static
  1432. * @memberOf _
  1433. * @since 4.12.0
  1434. * @category Lang
  1435. * @param {*} value The value to convert.
  1436. * @returns {number} Returns the converted number.
  1437. * @example
  1438. *
  1439. * _.toFinite(3.2);
  1440. * // => 3.2
  1441. *
  1442. * _.toFinite(Number.MIN_VALUE);
  1443. * // => 5e-324
  1444. *
  1445. * _.toFinite(Infinity);
  1446. * // => 1.7976931348623157e+308
  1447. *
  1448. * _.toFinite('3.2');
  1449. * // => 3.2
  1450. */
  1451. function toFinite(value) {
  1452. if (!value) return value === 0 ? value : 0;
  1453. value = toNumber(value);
  1454. if (value === INFINITY$2 || value === -INFINITY$2) return (value < 0 ? -1 : 1) * MAX_INTEGER;
  1455. return value === value ? value : 0;
  1456. }
  1457. //#endregion
  1458. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toInteger.js
  1459. /**
  1460. * Converts `value` to an integer.
  1461. *
  1462. * **Note:** This method is loosely based on
  1463. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  1464. *
  1465. * @static
  1466. * @memberOf _
  1467. * @since 4.0.0
  1468. * @category Lang
  1469. * @param {*} value The value to convert.
  1470. * @returns {number} Returns the converted integer.
  1471. * @example
  1472. *
  1473. * _.toInteger(3.2);
  1474. * // => 3
  1475. *
  1476. * _.toInteger(Number.MIN_VALUE);
  1477. * // => 0
  1478. *
  1479. * _.toInteger(Infinity);
  1480. * // => 1.7976931348623157e+308
  1481. *
  1482. * _.toInteger('3.2');
  1483. * // => 3
  1484. */
  1485. function toInteger(value) {
  1486. var result = toFinite(value), remainder = result % 1;
  1487. return result === result ? remainder ? result - remainder : result : 0;
  1488. }
  1489. //#endregion
  1490. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/identity.js
  1491. /**
  1492. * This method returns the first argument it receives.
  1493. *
  1494. * @static
  1495. * @since 0.1.0
  1496. * @memberOf _
  1497. * @category Util
  1498. * @param {*} value Any value.
  1499. * @returns {*} Returns `value`.
  1500. * @example
  1501. *
  1502. * var object = { 'a': 1 };
  1503. *
  1504. * console.log(_.identity(object) === object);
  1505. * // => true
  1506. */
  1507. function identity(value) {
  1508. return value;
  1509. }
  1510. //#endregion
  1511. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js
  1512. /** `Object#toString` result references. */
  1513. var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  1514. /**
  1515. * Checks if `value` is classified as a `Function` object.
  1516. *
  1517. * @static
  1518. * @memberOf _
  1519. * @since 0.1.0
  1520. * @category Lang
  1521. * @param {*} value The value to check.
  1522. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  1523. * @example
  1524. *
  1525. * _.isFunction(_);
  1526. * // => true
  1527. *
  1528. * _.isFunction(/abc/);
  1529. * // => false
  1530. */
  1531. function isFunction(value) {
  1532. if (!isObject(value)) return false;
  1533. var tag = baseGetTag(value);
  1534. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  1535. }
  1536. //#endregion
  1537. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js
  1538. /** Used to detect overreaching core-js shims. */
  1539. var coreJsData = root["__core-js_shared__"];
  1540. //#endregion
  1541. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js
  1542. /** Used to detect methods masquerading as native. */
  1543. var maskSrcKey = function() {
  1544. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  1545. return uid ? "Symbol(src)_1." + uid : "";
  1546. }();
  1547. /**
  1548. * Checks if `func` has its source masked.
  1549. *
  1550. * @private
  1551. * @param {Function} func The function to check.
  1552. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  1553. */
  1554. function isMasked(func) {
  1555. return !!maskSrcKey && maskSrcKey in func;
  1556. }
  1557. //#endregion
  1558. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js
  1559. /** Used to resolve the decompiled source of functions. */
  1560. var funcToString$2 = Function.prototype.toString;
  1561. /**
  1562. * Converts `func` to its source code.
  1563. *
  1564. * @private
  1565. * @param {Function} func The function to convert.
  1566. * @returns {string} Returns the source code.
  1567. */
  1568. function toSource(func) {
  1569. if (func != null) {
  1570. try {
  1571. return funcToString$2.call(func);
  1572. } catch (e) {}
  1573. try {
  1574. return func + "";
  1575. } catch (e) {}
  1576. }
  1577. return "";
  1578. }
  1579. //#endregion
  1580. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js
  1581. /**
  1582. * Used to match `RegExp`
  1583. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1584. */
  1585. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  1586. /** Used to detect host constructors (Safari). */
  1587. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1588. /** Used for built-in method references. */
  1589. var funcProto$1 = Function.prototype, objectProto$3 = Object.prototype;
  1590. /** Used to resolve the decompiled source of functions. */
  1591. var funcToString$1 = funcProto$1.toString;
  1592. /** Used to check objects for own properties. */
  1593. var hasOwnProperty$12 = objectProto$3.hasOwnProperty;
  1594. /** Used to detect if a method is native. */
  1595. var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$12).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  1596. /**
  1597. * The base implementation of `_.isNative` without bad shim checks.
  1598. *
  1599. * @private
  1600. * @param {*} value The value to check.
  1601. * @returns {boolean} Returns `true` if `value` is a native function,
  1602. * else `false`.
  1603. */
  1604. function baseIsNative(value) {
  1605. if (!isObject(value) || isMasked(value)) return false;
  1606. return (isFunction(value) ? reIsNative : reIsHostCtor).test(toSource(value));
  1607. }
  1608. //#endregion
  1609. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js
  1610. /**
  1611. * Gets the value at `key` of `object`.
  1612. *
  1613. * @private
  1614. * @param {Object} [object] The object to query.
  1615. * @param {string} key The key of the property to get.
  1616. * @returns {*} Returns the property value.
  1617. */
  1618. function getValue$1(object, key) {
  1619. return object == null ? void 0 : object[key];
  1620. }
  1621. //#endregion
  1622. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js
  1623. /**
  1624. * Gets the native function at `key` of `object`.
  1625. *
  1626. * @private
  1627. * @param {Object} object The object to query.
  1628. * @param {string} key The key of the method to get.
  1629. * @returns {*} Returns the function if it's native, else `undefined`.
  1630. */
  1631. function getNative(object, key) {
  1632. var value = getValue$1(object, key);
  1633. return baseIsNative(value) ? value : void 0;
  1634. }
  1635. //#endregion
  1636. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js
  1637. var WeakMap$1 = getNative(root, "WeakMap");
  1638. //#endregion
  1639. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js
  1640. /** Built-in value references. */
  1641. var objectCreate = Object.create;
  1642. /**
  1643. * The base implementation of `_.create` without support for assigning
  1644. * properties to the created object.
  1645. *
  1646. * @private
  1647. * @param {Object} proto The object to inherit from.
  1648. * @returns {Object} Returns the new object.
  1649. */
  1650. var baseCreate = function() {
  1651. function object() {}
  1652. return function(proto) {
  1653. if (!isObject(proto)) return {};
  1654. if (objectCreate) return objectCreate(proto);
  1655. object.prototype = proto;
  1656. var result = new object();
  1657. object.prototype = void 0;
  1658. return result;
  1659. };
  1660. }();
  1661. //#endregion
  1662. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_apply.js
  1663. /**
  1664. * A faster alternative to `Function#apply`, this function invokes `func`
  1665. * with the `this` binding of `thisArg` and the arguments of `args`.
  1666. *
  1667. * @private
  1668. * @param {Function} func The function to invoke.
  1669. * @param {*} thisArg The `this` binding of `func`.
  1670. * @param {Array} args The arguments to invoke `func` with.
  1671. * @returns {*} Returns the result of `func`.
  1672. */
  1673. function apply(func, thisArg, args) {
  1674. switch (args.length) {
  1675. case 0: return func.call(thisArg);
  1676. case 1: return func.call(thisArg, args[0]);
  1677. case 2: return func.call(thisArg, args[0], args[1]);
  1678. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  1679. }
  1680. return func.apply(thisArg, args);
  1681. }
  1682. //#endregion
  1683. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/noop.js
  1684. /**
  1685. * This method returns `undefined`.
  1686. *
  1687. * @static
  1688. * @memberOf _
  1689. * @since 2.3.0
  1690. * @category Util
  1691. * @example
  1692. *
  1693. * _.times(2, _.noop);
  1694. * // => [undefined, undefined]
  1695. */
  1696. function noop() {}
  1697. //#endregion
  1698. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js
  1699. /**
  1700. * Copies the values of `source` to `array`.
  1701. *
  1702. * @private
  1703. * @param {Array} source The array to copy values from.
  1704. * @param {Array} [array=[]] The array to copy values to.
  1705. * @returns {Array} Returns `array`.
  1706. */
  1707. function copyArray(source, array) {
  1708. var index = -1, length = source.length;
  1709. array || (array = Array(length));
  1710. while (++index < length) array[index] = source[index];
  1711. return array;
  1712. }
  1713. //#endregion
  1714. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js
  1715. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  1716. var HOT_COUNT = 800, HOT_SPAN = 16;
  1717. var nativeNow = Date.now;
  1718. /**
  1719. * Creates a function that'll short out and invoke `identity` instead
  1720. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  1721. * milliseconds.
  1722. *
  1723. * @private
  1724. * @param {Function} func The function to restrict.
  1725. * @returns {Function} Returns the new shortable function.
  1726. */
  1727. function shortOut(func) {
  1728. var count = 0, lastCalled = 0;
  1729. return function() {
  1730. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  1731. lastCalled = stamp;
  1732. if (remaining > 0) {
  1733. if (++count >= HOT_COUNT) return arguments[0];
  1734. } else count = 0;
  1735. return func.apply(void 0, arguments);
  1736. };
  1737. }
  1738. //#endregion
  1739. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/constant.js
  1740. /**
  1741. * Creates a function that returns `value`.
  1742. *
  1743. * @static
  1744. * @memberOf _
  1745. * @since 2.4.0
  1746. * @category Util
  1747. * @param {*} value The value to return from the new function.
  1748. * @returns {Function} Returns the new constant function.
  1749. * @example
  1750. *
  1751. * var objects = _.times(2, _.constant({ 'a': 1 }));
  1752. *
  1753. * console.log(objects);
  1754. * // => [{ 'a': 1 }, { 'a': 1 }]
  1755. *
  1756. * console.log(objects[0] === objects[1]);
  1757. * // => true
  1758. */
  1759. function constant(value) {
  1760. return function() {
  1761. return value;
  1762. };
  1763. }
  1764. //#endregion
  1765. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js
  1766. var defineProperty = function() {
  1767. try {
  1768. var func = getNative(Object, "defineProperty");
  1769. func({}, "", {});
  1770. return func;
  1771. } catch (e) {}
  1772. }();
  1773. //#endregion
  1774. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js
  1775. /**
  1776. * The base implementation of `setToString` without support for hot loop shorting.
  1777. *
  1778. * @private
  1779. * @param {Function} func The function to modify.
  1780. * @param {Function} string The `toString` result.
  1781. * @returns {Function} Returns `func`.
  1782. */
  1783. var baseSetToString = !defineProperty ? identity : function(func, string) {
  1784. return defineProperty(func, "toString", {
  1785. "configurable": true,
  1786. "enumerable": false,
  1787. "value": constant(string),
  1788. "writable": true
  1789. });
  1790. };
  1791. //#endregion
  1792. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js
  1793. /**
  1794. * Sets the `toString` method of `func` to return `string`.
  1795. *
  1796. * @private
  1797. * @param {Function} func The function to modify.
  1798. * @param {Function} string The `toString` result.
  1799. * @returns {Function} Returns `func`.
  1800. */
  1801. var setToString = shortOut(baseSetToString);
  1802. //#endregion
  1803. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js
  1804. /**
  1805. * A specialized version of `_.forEach` for arrays without support for
  1806. * iteratee shorthands.
  1807. *
  1808. * @private
  1809. * @param {Array} [array] The array to iterate over.
  1810. * @param {Function} iteratee The function invoked per iteration.
  1811. * @returns {Array} Returns `array`.
  1812. */
  1813. function arrayEach(array, iteratee) {
  1814. var index = -1, length = array == null ? 0 : array.length;
  1815. while (++index < length) if (iteratee(array[index], index, array) === false) break;
  1816. return array;
  1817. }
  1818. //#endregion
  1819. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFindIndex.js
  1820. /**
  1821. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  1822. * support for iteratee shorthands.
  1823. *
  1824. * @private
  1825. * @param {Array} array The array to inspect.
  1826. * @param {Function} predicate The function invoked per iteration.
  1827. * @param {number} fromIndex The index to search from.
  1828. * @param {boolean} [fromRight] Specify iterating from right to left.
  1829. * @returns {number} Returns the index of the matched value, else `-1`.
  1830. */
  1831. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1832. var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  1833. while (fromRight ? index-- : ++index < length) if (predicate(array[index], index, array)) return index;
  1834. return -1;
  1835. }
  1836. //#endregion
  1837. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNaN.js
  1838. /**
  1839. * The base implementation of `_.isNaN` without support for number objects.
  1840. *
  1841. * @private
  1842. * @param {*} value The value to check.
  1843. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  1844. */
  1845. function baseIsNaN(value) {
  1846. return value !== value;
  1847. }
  1848. //#endregion
  1849. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_strictIndexOf.js
  1850. /**
  1851. * A specialized version of `_.indexOf` which performs strict equality
  1852. * comparisons of values, i.e. `===`.
  1853. *
  1854. * @private
  1855. * @param {Array} array The array to inspect.
  1856. * @param {*} value The value to search for.
  1857. * @param {number} fromIndex The index to search from.
  1858. * @returns {number} Returns the index of the matched value, else `-1`.
  1859. */
  1860. function strictIndexOf(array, value, fromIndex) {
  1861. var index = fromIndex - 1, length = array.length;
  1862. while (++index < length) if (array[index] === value) return index;
  1863. return -1;
  1864. }
  1865. //#endregion
  1866. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIndexOf.js
  1867. /**
  1868. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  1869. *
  1870. * @private
  1871. * @param {Array} array The array to inspect.
  1872. * @param {*} value The value to search for.
  1873. * @param {number} fromIndex The index to search from.
  1874. * @returns {number} Returns the index of the matched value, else `-1`.
  1875. */
  1876. function baseIndexOf(array, value, fromIndex) {
  1877. return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
  1878. }
  1879. //#endregion
  1880. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludes.js
  1881. /**
  1882. * A specialized version of `_.includes` for arrays without support for
  1883. * specifying an index to search from.
  1884. *
  1885. * @private
  1886. * @param {Array} [array] The array to inspect.
  1887. * @param {*} target The value to search for.
  1888. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1889. */
  1890. function arrayIncludes(array, value) {
  1891. return !!(array == null ? 0 : array.length) && baseIndexOf(array, value, 0) > -1;
  1892. }
  1893. //#endregion
  1894. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js
  1895. /** Used as references for various `Number` constants. */
  1896. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  1897. /** Used to detect unsigned integer values. */
  1898. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1899. /**
  1900. * Checks if `value` is a valid array-like index.
  1901. *
  1902. * @private
  1903. * @param {*} value The value to check.
  1904. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  1905. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  1906. */
  1907. function isIndex(value, length) {
  1908. var type = typeof value;
  1909. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  1910. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
  1911. }
  1912. //#endregion
  1913. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js
  1914. /**
  1915. * The base implementation of `assignValue` and `assignMergeValue` without
  1916. * value checks.
  1917. *
  1918. * @private
  1919. * @param {Object} object The object to modify.
  1920. * @param {string} key The key of the property to assign.
  1921. * @param {*} value The value to assign.
  1922. */
  1923. function baseAssignValue(object, key, value) {
  1924. if (key == "__proto__" && defineProperty) defineProperty(object, key, {
  1925. "configurable": true,
  1926. "enumerable": true,
  1927. "value": value,
  1928. "writable": true
  1929. });
  1930. else object[key] = value;
  1931. }
  1932. //#endregion
  1933. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/eq.js
  1934. /**
  1935. * Performs a
  1936. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  1937. * comparison between two values to determine if they are equivalent.
  1938. *
  1939. * @static
  1940. * @memberOf _
  1941. * @since 4.0.0
  1942. * @category Lang
  1943. * @param {*} value The value to compare.
  1944. * @param {*} other The other value to compare.
  1945. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  1946. * @example
  1947. *
  1948. * var object = { 'a': 1 };
  1949. * var other = { 'a': 1 };
  1950. *
  1951. * _.eq(object, object);
  1952. * // => true
  1953. *
  1954. * _.eq(object, other);
  1955. * // => false
  1956. *
  1957. * _.eq('a', 'a');
  1958. * // => true
  1959. *
  1960. * _.eq('a', Object('a'));
  1961. * // => false
  1962. *
  1963. * _.eq(NaN, NaN);
  1964. * // => true
  1965. */
  1966. function eq(value, other) {
  1967. return value === other || value !== value && other !== other;
  1968. }
  1969. //#endregion
  1970. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js
  1971. /** Used to check objects for own properties. */
  1972. var hasOwnProperty$11 = Object.prototype.hasOwnProperty;
  1973. /**
  1974. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  1975. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  1976. * for equality comparisons.
  1977. *
  1978. * @private
  1979. * @param {Object} object The object to modify.
  1980. * @param {string} key The key of the property to assign.
  1981. * @param {*} value The value to assign.
  1982. */
  1983. function assignValue(object, key, value) {
  1984. var objValue = object[key];
  1985. if (!(hasOwnProperty$11.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) baseAssignValue(object, key, value);
  1986. }
  1987. //#endregion
  1988. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js
  1989. /**
  1990. * Copies properties of `source` to `object`.
  1991. *
  1992. * @private
  1993. * @param {Object} source The object to copy properties from.
  1994. * @param {Array} props The property identifiers to copy.
  1995. * @param {Object} [object={}] The object to copy properties to.
  1996. * @param {Function} [customizer] The function to customize copied values.
  1997. * @returns {Object} Returns `object`.
  1998. */
  1999. function copyObject(source, props, object, customizer) {
  2000. var isNew = !object;
  2001. object || (object = {});
  2002. var index = -1, length = props.length;
  2003. while (++index < length) {
  2004. var key = props[index];
  2005. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  2006. if (newValue === void 0) newValue = source[key];
  2007. if (isNew) baseAssignValue(object, key, newValue);
  2008. else assignValue(object, key, newValue);
  2009. }
  2010. return object;
  2011. }
  2012. //#endregion
  2013. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js
  2014. var nativeMax$2 = Math.max;
  2015. /**
  2016. * A specialized version of `baseRest` which transforms the rest array.
  2017. *
  2018. * @private
  2019. * @param {Function} func The function to apply a rest parameter to.
  2020. * @param {number} [start=func.length-1] The start position of the rest parameter.
  2021. * @param {Function} transform The rest array transform.
  2022. * @returns {Function} Returns the new function.
  2023. */
  2024. function overRest(func, start, transform) {
  2025. start = nativeMax$2(start === void 0 ? func.length - 1 : start, 0);
  2026. return function() {
  2027. var args = arguments, index = -1, length = nativeMax$2(args.length - start, 0), array = Array(length);
  2028. while (++index < length) array[index] = args[start + index];
  2029. index = -1;
  2030. var otherArgs = Array(start + 1);
  2031. while (++index < start) otherArgs[index] = args[index];
  2032. otherArgs[start] = transform(array);
  2033. return apply(func, this, otherArgs);
  2034. };
  2035. }
  2036. //#endregion
  2037. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js
  2038. /**
  2039. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  2040. *
  2041. * @private
  2042. * @param {Function} func The function to apply a rest parameter to.
  2043. * @param {number} [start=func.length-1] The start position of the rest parameter.
  2044. * @returns {Function} Returns the new function.
  2045. */
  2046. function baseRest(func, start) {
  2047. return setToString(overRest(func, start, identity), func + "");
  2048. }
  2049. //#endregion
  2050. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isLength.js
  2051. /** Used as references for various `Number` constants. */
  2052. var MAX_SAFE_INTEGER = 9007199254740991;
  2053. /**
  2054. * Checks if `value` is a valid array-like length.
  2055. *
  2056. * **Note:** This method is loosely based on
  2057. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  2058. *
  2059. * @static
  2060. * @memberOf _
  2061. * @since 4.0.0
  2062. * @category Lang
  2063. * @param {*} value The value to check.
  2064. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  2065. * @example
  2066. *
  2067. * _.isLength(3);
  2068. * // => true
  2069. *
  2070. * _.isLength(Number.MIN_VALUE);
  2071. * // => false
  2072. *
  2073. * _.isLength(Infinity);
  2074. * // => false
  2075. *
  2076. * _.isLength('3');
  2077. * // => false
  2078. */
  2079. function isLength(value) {
  2080. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  2081. }
  2082. //#endregion
  2083. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js
  2084. /**
  2085. * Checks if `value` is array-like. A value is considered array-like if it's
  2086. * not a function and has a `value.length` that's an integer greater than or
  2087. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  2088. *
  2089. * @static
  2090. * @memberOf _
  2091. * @since 4.0.0
  2092. * @category Lang
  2093. * @param {*} value The value to check.
  2094. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  2095. * @example
  2096. *
  2097. * _.isArrayLike([1, 2, 3]);
  2098. * // => true
  2099. *
  2100. * _.isArrayLike(document.body.children);
  2101. * // => true
  2102. *
  2103. * _.isArrayLike('abc');
  2104. * // => true
  2105. *
  2106. * _.isArrayLike(_.noop);
  2107. * // => false
  2108. */
  2109. function isArrayLike(value) {
  2110. return value != null && isLength(value.length) && !isFunction(value);
  2111. }
  2112. //#endregion
  2113. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js
  2114. /**
  2115. * Checks if the given arguments are from an iteratee call.
  2116. *
  2117. * @private
  2118. * @param {*} value The potential iteratee value argument.
  2119. * @param {*} index The potential iteratee index or key argument.
  2120. * @param {*} object The potential iteratee object argument.
  2121. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  2122. * else `false`.
  2123. */
  2124. function isIterateeCall(value, index, object) {
  2125. if (!isObject(object)) return false;
  2126. var type = typeof index;
  2127. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) return eq(object[index], value);
  2128. return false;
  2129. }
  2130. //#endregion
  2131. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createAssigner.js
  2132. /**
  2133. * Creates a function like `_.assign`.
  2134. *
  2135. * @private
  2136. * @param {Function} assigner The function to assign values.
  2137. * @returns {Function} Returns the new assigner function.
  2138. */
  2139. function createAssigner(assigner) {
  2140. return baseRest(function(object, sources) {
  2141. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  2142. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  2143. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  2144. customizer = length < 3 ? void 0 : customizer;
  2145. length = 1;
  2146. }
  2147. object = Object(object);
  2148. while (++index < length) {
  2149. var source = sources[index];
  2150. if (source) assigner(object, source, index, customizer);
  2151. }
  2152. return object;
  2153. });
  2154. }
  2155. //#endregion
  2156. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js
  2157. /** Used for built-in method references. */
  2158. var objectProto$2 = Object.prototype;
  2159. /**
  2160. * Checks if `value` is likely a prototype object.
  2161. *
  2162. * @private
  2163. * @param {*} value The value to check.
  2164. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  2165. */
  2166. function isPrototype(value) {
  2167. var Ctor = value && value.constructor;
  2168. return value === (typeof Ctor == "function" && Ctor.prototype || objectProto$2);
  2169. }
  2170. //#endregion
  2171. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js
  2172. /**
  2173. * The base implementation of `_.times` without support for iteratee shorthands
  2174. * or max array length checks.
  2175. *
  2176. * @private
  2177. * @param {number} n The number of times to invoke `iteratee`.
  2178. * @param {Function} iteratee The function invoked per iteration.
  2179. * @returns {Array} Returns the array of results.
  2180. */
  2181. function baseTimes(n, iteratee) {
  2182. var index = -1, result = Array(n);
  2183. while (++index < n) result[index] = iteratee(index);
  2184. return result;
  2185. }
  2186. //#endregion
  2187. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js
  2188. /** `Object#toString` result references. */
  2189. var argsTag$3 = "[object Arguments]";
  2190. /**
  2191. * The base implementation of `_.isArguments`.
  2192. *
  2193. * @private
  2194. * @param {*} value The value to check.
  2195. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  2196. */
  2197. function baseIsArguments(value) {
  2198. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  2199. }
  2200. //#endregion
  2201. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js
  2202. /** Used for built-in method references. */
  2203. var objectProto$1 = Object.prototype;
  2204. /** Used to check objects for own properties. */
  2205. var hasOwnProperty$10 = objectProto$1.hasOwnProperty;
  2206. /** Built-in value references. */
  2207. var propertyIsEnumerable$1 = objectProto$1.propertyIsEnumerable;
  2208. /**
  2209. * Checks if `value` is likely an `arguments` object.
  2210. *
  2211. * @static
  2212. * @memberOf _
  2213. * @since 0.1.0
  2214. * @category Lang
  2215. * @param {*} value The value to check.
  2216. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  2217. * else `false`.
  2218. * @example
  2219. *
  2220. * _.isArguments(function() { return arguments; }());
  2221. * // => true
  2222. *
  2223. * _.isArguments([1, 2, 3]);
  2224. * // => false
  2225. */
  2226. var isArguments = baseIsArguments(function() {
  2227. return arguments;
  2228. }()) ? baseIsArguments : function(value) {
  2229. return isObjectLike(value) && hasOwnProperty$10.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  2230. };
  2231. //#endregion
  2232. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js
  2233. /**
  2234. * This method returns `false`.
  2235. *
  2236. * @static
  2237. * @memberOf _
  2238. * @since 4.13.0
  2239. * @category Util
  2240. * @returns {boolean} Returns `false`.
  2241. * @example
  2242. *
  2243. * _.times(2, _.stubFalse);
  2244. * // => [false, false]
  2245. */
  2246. function stubFalse() {
  2247. return false;
  2248. }
  2249. //#endregion
  2250. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js
  2251. /** Detect free variable `exports`. */
  2252. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  2253. /** Detect free variable `module`. */
  2254. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  2255. /** Built-in value references. */
  2256. var Buffer$2 = freeModule$2 && freeModule$2.exports === freeExports$2 ? root.Buffer : void 0;
  2257. /**
  2258. * Checks if `value` is a buffer.
  2259. *
  2260. * @static
  2261. * @memberOf _
  2262. * @since 4.3.0
  2263. * @category Lang
  2264. * @param {*} value The value to check.
  2265. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  2266. * @example
  2267. *
  2268. * _.isBuffer(new Buffer(2));
  2269. * // => true
  2270. *
  2271. * _.isBuffer(new Uint8Array(2));
  2272. * // => false
  2273. */
  2274. var isBuffer = (Buffer$2 ? Buffer$2.isBuffer : void 0) || stubFalse;
  2275. //#endregion
  2276. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js
  2277. /** `Object#toString` result references. */
  2278. var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$4 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
  2279. var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
  2280. /** Used to identify `toStringTag` values of typed arrays. */
  2281. var typedArrayTags = {};
  2282. 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;
  2283. typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false;
  2284. /**
  2285. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  2286. *
  2287. * @private
  2288. * @param {*} value The value to check.
  2289. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  2290. */
  2291. function baseIsTypedArray(value) {
  2292. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  2293. }
  2294. //#endregion
  2295. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js
  2296. /**
  2297. * The base implementation of `_.unary` without support for storing metadata.
  2298. *
  2299. * @private
  2300. * @param {Function} func The function to cap arguments for.
  2301. * @returns {Function} Returns the new capped function.
  2302. */
  2303. function baseUnary(func) {
  2304. return function(value) {
  2305. return func(value);
  2306. };
  2307. }
  2308. //#endregion
  2309. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js
  2310. /** Detect free variable `exports`. */
  2311. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  2312. /** Detect free variable `module`. */
  2313. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  2314. /** Detect free variable `process` from Node.js. */
  2315. var freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && freeGlobal.process;
  2316. /** Used to access faster Node.js helpers. */
  2317. var nodeUtil = function() {
  2318. try {
  2319. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  2320. if (types) return types;
  2321. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  2322. } catch (e) {}
  2323. }();
  2324. //#endregion
  2325. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js
  2326. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  2327. /**
  2328. * Checks if `value` is classified as a typed array.
  2329. *
  2330. * @static
  2331. * @memberOf _
  2332. * @since 3.0.0
  2333. * @category Lang
  2334. * @param {*} value The value to check.
  2335. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  2336. * @example
  2337. *
  2338. * _.isTypedArray(new Uint8Array);
  2339. * // => true
  2340. *
  2341. * _.isTypedArray([]);
  2342. * // => false
  2343. */
  2344. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  2345. //#endregion
  2346. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js
  2347. /** Used to check objects for own properties. */
  2348. var hasOwnProperty$9 = Object.prototype.hasOwnProperty;
  2349. /**
  2350. * Creates an array of the enumerable property names of the array-like `value`.
  2351. *
  2352. * @private
  2353. * @param {*} value The value to query.
  2354. * @param {boolean} inherited Specify returning inherited property names.
  2355. * @returns {Array} Returns the array of property names.
  2356. */
  2357. function arrayLikeKeys(value, inherited) {
  2358. var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  2359. for (var key in value) if ((inherited || hasOwnProperty$9.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) result.push(key);
  2360. return result;
  2361. }
  2362. //#endregion
  2363. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js
  2364. /**
  2365. * Creates a unary function that invokes `func` with its argument transformed.
  2366. *
  2367. * @private
  2368. * @param {Function} func The function to wrap.
  2369. * @param {Function} transform The argument transform.
  2370. * @returns {Function} Returns the new function.
  2371. */
  2372. function overArg(func, transform) {
  2373. return function(arg) {
  2374. return func(transform(arg));
  2375. };
  2376. }
  2377. //#endregion
  2378. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js
  2379. var nativeKeys = overArg(Object.keys, Object);
  2380. //#endregion
  2381. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js
  2382. /** Used to check objects for own properties. */
  2383. var hasOwnProperty$8 = Object.prototype.hasOwnProperty;
  2384. /**
  2385. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  2386. *
  2387. * @private
  2388. * @param {Object} object The object to query.
  2389. * @returns {Array} Returns the array of property names.
  2390. */
  2391. function baseKeys(object) {
  2392. if (!isPrototype(object)) return nativeKeys(object);
  2393. var result = [];
  2394. for (var key in Object(object)) if (hasOwnProperty$8.call(object, key) && key != "constructor") result.push(key);
  2395. return result;
  2396. }
  2397. //#endregion
  2398. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/keys.js
  2399. /**
  2400. * Creates an array of the own enumerable property names of `object`.
  2401. *
  2402. * **Note:** Non-object values are coerced to objects. See the
  2403. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  2404. * for more details.
  2405. *
  2406. * @static
  2407. * @since 0.1.0
  2408. * @memberOf _
  2409. * @category Object
  2410. * @param {Object} object The object to query.
  2411. * @returns {Array} Returns the array of property names.
  2412. * @example
  2413. *
  2414. * function Foo() {
  2415. * this.a = 1;
  2416. * this.b = 2;
  2417. * }
  2418. *
  2419. * Foo.prototype.c = 3;
  2420. *
  2421. * _.keys(new Foo);
  2422. * // => ['a', 'b'] (iteration order is not guaranteed)
  2423. *
  2424. * _.keys('hi');
  2425. * // => ['0', '1']
  2426. */
  2427. function keys(object) {
  2428. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  2429. }
  2430. //#endregion
  2431. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js
  2432. /**
  2433. * This function is like
  2434. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  2435. * except that it includes inherited enumerable properties.
  2436. *
  2437. * @private
  2438. * @param {Object} object The object to query.
  2439. * @returns {Array} Returns the array of property names.
  2440. */
  2441. function nativeKeysIn(object) {
  2442. var result = [];
  2443. if (object != null) for (var key in Object(object)) result.push(key);
  2444. return result;
  2445. }
  2446. //#endregion
  2447. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js
  2448. /** Used to check objects for own properties. */
  2449. var hasOwnProperty$7 = Object.prototype.hasOwnProperty;
  2450. /**
  2451. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  2452. *
  2453. * @private
  2454. * @param {Object} object The object to query.
  2455. * @returns {Array} Returns the array of property names.
  2456. */
  2457. function baseKeysIn(object) {
  2458. if (!isObject(object)) return nativeKeysIn(object);
  2459. var isProto = isPrototype(object), result = [];
  2460. for (var key in object) if (!(key == "constructor" && (isProto || !hasOwnProperty$7.call(object, key)))) result.push(key);
  2461. return result;
  2462. }
  2463. //#endregion
  2464. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js
  2465. /**
  2466. * Creates an array of the own and inherited enumerable property names of `object`.
  2467. *
  2468. * **Note:** Non-object values are coerced to objects.
  2469. *
  2470. * @static
  2471. * @memberOf _
  2472. * @since 3.0.0
  2473. * @category Object
  2474. * @param {Object} object The object to query.
  2475. * @returns {Array} Returns the array of property names.
  2476. * @example
  2477. *
  2478. * function Foo() {
  2479. * this.a = 1;
  2480. * this.b = 2;
  2481. * }
  2482. *
  2483. * Foo.prototype.c = 3;
  2484. *
  2485. * _.keysIn(new Foo);
  2486. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  2487. */
  2488. function keysIn(object) {
  2489. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  2490. }
  2491. //#endregion
  2492. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js
  2493. /** Used to match property names within property paths. */
  2494. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  2495. /**
  2496. * Checks if `value` is a property name and not a property path.
  2497. *
  2498. * @private
  2499. * @param {*} value The value to check.
  2500. * @param {Object} [object] The object to query keys on.
  2501. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  2502. */
  2503. function isKey(value, object) {
  2504. if (isArray(value)) return false;
  2505. var type = typeof value;
  2506. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) return true;
  2507. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  2508. }
  2509. //#endregion
  2510. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js
  2511. var nativeCreate = getNative(Object, "create");
  2512. //#endregion
  2513. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js
  2514. /**
  2515. * Removes all key-value entries from the hash.
  2516. *
  2517. * @private
  2518. * @name clear
  2519. * @memberOf Hash
  2520. */
  2521. function hashClear() {
  2522. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  2523. this.size = 0;
  2524. }
  2525. //#endregion
  2526. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js
  2527. /**
  2528. * Removes `key` and its value from the hash.
  2529. *
  2530. * @private
  2531. * @name delete
  2532. * @memberOf Hash
  2533. * @param {Object} hash The hash to modify.
  2534. * @param {string} key The key of the value to remove.
  2535. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2536. */
  2537. function hashDelete(key) {
  2538. var result = this.has(key) && delete this.__data__[key];
  2539. this.size -= result ? 1 : 0;
  2540. return result;
  2541. }
  2542. //#endregion
  2543. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js
  2544. /** Used to stand-in for `undefined` hash values. */
  2545. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  2546. /** Used to check objects for own properties. */
  2547. var hasOwnProperty$6 = Object.prototype.hasOwnProperty;
  2548. /**
  2549. * Gets the hash value for `key`.
  2550. *
  2551. * @private
  2552. * @name get
  2553. * @memberOf Hash
  2554. * @param {string} key The key of the value to get.
  2555. * @returns {*} Returns the entry value.
  2556. */
  2557. function hashGet(key) {
  2558. var data = this.__data__;
  2559. if (nativeCreate) {
  2560. var result = data[key];
  2561. return result === HASH_UNDEFINED$2 ? void 0 : result;
  2562. }
  2563. return hasOwnProperty$6.call(data, key) ? data[key] : void 0;
  2564. }
  2565. //#endregion
  2566. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js
  2567. /** Used to check objects for own properties. */
  2568. var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
  2569. /**
  2570. * Checks if a hash value for `key` exists.
  2571. *
  2572. * @private
  2573. * @name has
  2574. * @memberOf Hash
  2575. * @param {string} key The key of the entry to check.
  2576. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2577. */
  2578. function hashHas(key) {
  2579. var data = this.__data__;
  2580. return nativeCreate ? data[key] !== void 0 : hasOwnProperty$5.call(data, key);
  2581. }
  2582. //#endregion
  2583. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js
  2584. /** Used to stand-in for `undefined` hash values. */
  2585. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  2586. /**
  2587. * Sets the hash `key` to `value`.
  2588. *
  2589. * @private
  2590. * @name set
  2591. * @memberOf Hash
  2592. * @param {string} key The key of the value to set.
  2593. * @param {*} value The value to set.
  2594. * @returns {Object} Returns the hash instance.
  2595. */
  2596. function hashSet(key, value) {
  2597. var data = this.__data__;
  2598. this.size += this.has(key) ? 0 : 1;
  2599. data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
  2600. return this;
  2601. }
  2602. //#endregion
  2603. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js
  2604. /**
  2605. * Creates a hash object.
  2606. *
  2607. * @private
  2608. * @constructor
  2609. * @param {Array} [entries] The key-value pairs to cache.
  2610. */
  2611. function Hash(entries) {
  2612. var index = -1, length = entries == null ? 0 : entries.length;
  2613. this.clear();
  2614. while (++index < length) {
  2615. var entry = entries[index];
  2616. this.set(entry[0], entry[1]);
  2617. }
  2618. }
  2619. Hash.prototype.clear = hashClear;
  2620. Hash.prototype["delete"] = hashDelete;
  2621. Hash.prototype.get = hashGet;
  2622. Hash.prototype.has = hashHas;
  2623. Hash.prototype.set = hashSet;
  2624. //#endregion
  2625. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js
  2626. /**
  2627. * Removes all key-value entries from the list cache.
  2628. *
  2629. * @private
  2630. * @name clear
  2631. * @memberOf ListCache
  2632. */
  2633. function listCacheClear() {
  2634. this.__data__ = [];
  2635. this.size = 0;
  2636. }
  2637. //#endregion
  2638. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js
  2639. /**
  2640. * Gets the index at which the `key` is found in `array` of key-value pairs.
  2641. *
  2642. * @private
  2643. * @param {Array} array The array to inspect.
  2644. * @param {*} key The key to search for.
  2645. * @returns {number} Returns the index of the matched value, else `-1`.
  2646. */
  2647. function assocIndexOf(array, key) {
  2648. var length = array.length;
  2649. while (length--) if (eq(array[length][0], key)) return length;
  2650. return -1;
  2651. }
  2652. //#endregion
  2653. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js
  2654. /** Built-in value references. */
  2655. var splice = Array.prototype.splice;
  2656. /**
  2657. * Removes `key` and its value from the list cache.
  2658. *
  2659. * @private
  2660. * @name delete
  2661. * @memberOf ListCache
  2662. * @param {string} key The key of the value to remove.
  2663. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2664. */
  2665. function listCacheDelete(key) {
  2666. var data = this.__data__, index = assocIndexOf(data, key);
  2667. if (index < 0) return false;
  2668. if (index == data.length - 1) data.pop();
  2669. else splice.call(data, index, 1);
  2670. --this.size;
  2671. return true;
  2672. }
  2673. //#endregion
  2674. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js
  2675. /**
  2676. * Gets the list cache value for `key`.
  2677. *
  2678. * @private
  2679. * @name get
  2680. * @memberOf ListCache
  2681. * @param {string} key The key of the value to get.
  2682. * @returns {*} Returns the entry value.
  2683. */
  2684. function listCacheGet(key) {
  2685. var data = this.__data__, index = assocIndexOf(data, key);
  2686. return index < 0 ? void 0 : data[index][1];
  2687. }
  2688. //#endregion
  2689. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js
  2690. /**
  2691. * Checks if a list cache value for `key` exists.
  2692. *
  2693. * @private
  2694. * @name has
  2695. * @memberOf ListCache
  2696. * @param {string} key The key of the entry to check.
  2697. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2698. */
  2699. function listCacheHas(key) {
  2700. return assocIndexOf(this.__data__, key) > -1;
  2701. }
  2702. //#endregion
  2703. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js
  2704. /**
  2705. * Sets the list cache `key` to `value`.
  2706. *
  2707. * @private
  2708. * @name set
  2709. * @memberOf ListCache
  2710. * @param {string} key The key of the value to set.
  2711. * @param {*} value The value to set.
  2712. * @returns {Object} Returns the list cache instance.
  2713. */
  2714. function listCacheSet(key, value) {
  2715. var data = this.__data__, index = assocIndexOf(data, key);
  2716. if (index < 0) {
  2717. ++this.size;
  2718. data.push([key, value]);
  2719. } else data[index][1] = value;
  2720. return this;
  2721. }
  2722. //#endregion
  2723. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js
  2724. /**
  2725. * Creates an list cache object.
  2726. *
  2727. * @private
  2728. * @constructor
  2729. * @param {Array} [entries] The key-value pairs to cache.
  2730. */
  2731. function ListCache(entries) {
  2732. var index = -1, length = entries == null ? 0 : entries.length;
  2733. this.clear();
  2734. while (++index < length) {
  2735. var entry = entries[index];
  2736. this.set(entry[0], entry[1]);
  2737. }
  2738. }
  2739. ListCache.prototype.clear = listCacheClear;
  2740. ListCache.prototype["delete"] = listCacheDelete;
  2741. ListCache.prototype.get = listCacheGet;
  2742. ListCache.prototype.has = listCacheHas;
  2743. ListCache.prototype.set = listCacheSet;
  2744. //#endregion
  2745. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Map.js
  2746. var Map$1 = getNative(root, "Map");
  2747. //#endregion
  2748. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js
  2749. /**
  2750. * Removes all key-value entries from the map.
  2751. *
  2752. * @private
  2753. * @name clear
  2754. * @memberOf MapCache
  2755. */
  2756. function mapCacheClear() {
  2757. this.size = 0;
  2758. this.__data__ = {
  2759. "hash": new Hash(),
  2760. "map": new (Map$1 || ListCache)(),
  2761. "string": new Hash()
  2762. };
  2763. }
  2764. //#endregion
  2765. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js
  2766. /**
  2767. * Checks if `value` is suitable for use as unique object key.
  2768. *
  2769. * @private
  2770. * @param {*} value The value to check.
  2771. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  2772. */
  2773. function isKeyable(value) {
  2774. var type = typeof value;
  2775. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  2776. }
  2777. //#endregion
  2778. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js
  2779. /**
  2780. * Gets the data for `map`.
  2781. *
  2782. * @private
  2783. * @param {Object} map The map to query.
  2784. * @param {string} key The reference key.
  2785. * @returns {*} Returns the map data.
  2786. */
  2787. function getMapData(map, key) {
  2788. var data = map.__data__;
  2789. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  2790. }
  2791. //#endregion
  2792. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js
  2793. /**
  2794. * Removes `key` and its value from the map.
  2795. *
  2796. * @private
  2797. * @name delete
  2798. * @memberOf MapCache
  2799. * @param {string} key The key of the value to remove.
  2800. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2801. */
  2802. function mapCacheDelete(key) {
  2803. var result = getMapData(this, key)["delete"](key);
  2804. this.size -= result ? 1 : 0;
  2805. return result;
  2806. }
  2807. //#endregion
  2808. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js
  2809. /**
  2810. * Gets the map value for `key`.
  2811. *
  2812. * @private
  2813. * @name get
  2814. * @memberOf MapCache
  2815. * @param {string} key The key of the value to get.
  2816. * @returns {*} Returns the entry value.
  2817. */
  2818. function mapCacheGet(key) {
  2819. return getMapData(this, key).get(key);
  2820. }
  2821. //#endregion
  2822. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js
  2823. /**
  2824. * Checks if a map value for `key` exists.
  2825. *
  2826. * @private
  2827. * @name has
  2828. * @memberOf MapCache
  2829. * @param {string} key The key of the entry to check.
  2830. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2831. */
  2832. function mapCacheHas(key) {
  2833. return getMapData(this, key).has(key);
  2834. }
  2835. //#endregion
  2836. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js
  2837. /**
  2838. * Sets the map `key` to `value`.
  2839. *
  2840. * @private
  2841. * @name set
  2842. * @memberOf MapCache
  2843. * @param {string} key The key of the value to set.
  2844. * @param {*} value The value to set.
  2845. * @returns {Object} Returns the map cache instance.
  2846. */
  2847. function mapCacheSet(key, value) {
  2848. var data = getMapData(this, key), size = data.size;
  2849. data.set(key, value);
  2850. this.size += data.size == size ? 0 : 1;
  2851. return this;
  2852. }
  2853. //#endregion
  2854. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js
  2855. /**
  2856. * Creates a map cache object to store key-value pairs.
  2857. *
  2858. * @private
  2859. * @constructor
  2860. * @param {Array} [entries] The key-value pairs to cache.
  2861. */
  2862. function MapCache(entries) {
  2863. var index = -1, length = entries == null ? 0 : entries.length;
  2864. this.clear();
  2865. while (++index < length) {
  2866. var entry = entries[index];
  2867. this.set(entry[0], entry[1]);
  2868. }
  2869. }
  2870. MapCache.prototype.clear = mapCacheClear;
  2871. MapCache.prototype["delete"] = mapCacheDelete;
  2872. MapCache.prototype.get = mapCacheGet;
  2873. MapCache.prototype.has = mapCacheHas;
  2874. MapCache.prototype.set = mapCacheSet;
  2875. //#endregion
  2876. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/memoize.js
  2877. /** Error message constants. */
  2878. var FUNC_ERROR_TEXT$2 = "Expected a function";
  2879. /**
  2880. * Creates a function that memoizes the result of `func`. If `resolver` is
  2881. * provided, it determines the cache key for storing the result based on the
  2882. * arguments provided to the memoized function. By default, the first argument
  2883. * provided to the memoized function is used as the map cache key. The `func`
  2884. * is invoked with the `this` binding of the memoized function.
  2885. *
  2886. * **Note:** The cache is exposed as the `cache` property on the memoized
  2887. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  2888. * constructor with one whose instances implement the
  2889. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  2890. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  2891. *
  2892. * @static
  2893. * @memberOf _
  2894. * @since 0.1.0
  2895. * @category Function
  2896. * @param {Function} func The function to have its output memoized.
  2897. * @param {Function} [resolver] The function to resolve the cache key.
  2898. * @returns {Function} Returns the new memoized function.
  2899. * @example
  2900. *
  2901. * var object = { 'a': 1, 'b': 2 };
  2902. * var other = { 'c': 3, 'd': 4 };
  2903. *
  2904. * var values = _.memoize(_.values);
  2905. * values(object);
  2906. * // => [1, 2]
  2907. *
  2908. * values(other);
  2909. * // => [3, 4]
  2910. *
  2911. * object.a = 2;
  2912. * values(object);
  2913. * // => [1, 2]
  2914. *
  2915. * // Modify the result cache.
  2916. * values.cache.set(object, ['a', 'b']);
  2917. * values(object);
  2918. * // => ['a', 'b']
  2919. *
  2920. * // Replace `_.memoize.Cache`.
  2921. * _.memoize.Cache = WeakMap;
  2922. */
  2923. function memoize(func, resolver) {
  2924. if (typeof func != "function" || resolver != null && typeof resolver != "function") throw new TypeError(FUNC_ERROR_TEXT$2);
  2925. var memoized = function() {
  2926. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  2927. if (cache.has(key)) return cache.get(key);
  2928. var result = func.apply(this, args);
  2929. memoized.cache = cache.set(key, result) || cache;
  2930. return result;
  2931. };
  2932. memoized.cache = new (memoize.Cache || MapCache)();
  2933. return memoized;
  2934. }
  2935. memoize.Cache = MapCache;
  2936. //#endregion
  2937. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js
  2938. /** Used as the maximum memoize cache size. */
  2939. var MAX_MEMOIZE_SIZE = 500;
  2940. /**
  2941. * A specialized version of `_.memoize` which clears the memoized function's
  2942. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  2943. *
  2944. * @private
  2945. * @param {Function} func The function to have its output memoized.
  2946. * @returns {Function} Returns the new memoized function.
  2947. */
  2948. function memoizeCapped(func) {
  2949. var result = memoize(func, function(key) {
  2950. if (cache.size === MAX_MEMOIZE_SIZE) cache.clear();
  2951. return key;
  2952. });
  2953. var cache = result.cache;
  2954. return result;
  2955. }
  2956. //#endregion
  2957. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js
  2958. /** Used to match property names within property paths. */
  2959. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  2960. /** Used to match backslashes in property paths. */
  2961. var reEscapeChar = /\\(\\)?/g;
  2962. /**
  2963. * Converts `string` to a property path array.
  2964. *
  2965. * @private
  2966. * @param {string} string The string to convert.
  2967. * @returns {Array} Returns the property path array.
  2968. */
  2969. var stringToPath = memoizeCapped(function(string) {
  2970. var result = [];
  2971. if (string.charCodeAt(0) === 46) result.push("");
  2972. string.replace(rePropName, function(match, number, quote, subString) {
  2973. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  2974. });
  2975. return result;
  2976. });
  2977. //#endregion
  2978. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toString.js
  2979. /**
  2980. * Converts `value` to a string. An empty string is returned for `null`
  2981. * and `undefined` values. The sign of `-0` is preserved.
  2982. *
  2983. * @static
  2984. * @memberOf _
  2985. * @since 4.0.0
  2986. * @category Lang
  2987. * @param {*} value The value to convert.
  2988. * @returns {string} Returns the converted string.
  2989. * @example
  2990. *
  2991. * _.toString(null);
  2992. * // => ''
  2993. *
  2994. * _.toString(-0);
  2995. * // => '-0'
  2996. *
  2997. * _.toString([1, 2, 3]);
  2998. * // => '1,2,3'
  2999. */
  3000. function toString(value) {
  3001. return value == null ? "" : baseToString(value);
  3002. }
  3003. //#endregion
  3004. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js
  3005. /**
  3006. * Casts `value` to a path array if it's not one.
  3007. *
  3008. * @private
  3009. * @param {*} value The value to inspect.
  3010. * @param {Object} [object] The object to query keys on.
  3011. * @returns {Array} Returns the cast property path array.
  3012. */
  3013. function castPath(value, object) {
  3014. if (isArray(value)) return value;
  3015. return isKey(value, object) ? [value] : stringToPath(toString(value));
  3016. }
  3017. //#endregion
  3018. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js
  3019. /** Used as references for various `Number` constants. */
  3020. var INFINITY$1 = Infinity;
  3021. /**
  3022. * Converts `value` to a string key if it's not a string or symbol.
  3023. *
  3024. * @private
  3025. * @param {*} value The value to inspect.
  3026. * @returns {string|symbol} Returns the key.
  3027. */
  3028. function toKey(value) {
  3029. if (typeof value == "string" || isSymbol(value)) return value;
  3030. var result = value + "";
  3031. return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
  3032. }
  3033. //#endregion
  3034. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js
  3035. /**
  3036. * The base implementation of `_.get` without support for default values.
  3037. *
  3038. * @private
  3039. * @param {Object} object The object to query.
  3040. * @param {Array|string} path The path of the property to get.
  3041. * @returns {*} Returns the resolved value.
  3042. */
  3043. function baseGet(object, path) {
  3044. path = castPath(path, object);
  3045. var index = 0, length = path.length;
  3046. while (object != null && index < length) object = object[toKey(path[index++])];
  3047. return index && index == length ? object : void 0;
  3048. }
  3049. //#endregion
  3050. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/get.js
  3051. /**
  3052. * Gets the value at `path` of `object`. If the resolved value is
  3053. * `undefined`, the `defaultValue` is returned in its place.
  3054. *
  3055. * @static
  3056. * @memberOf _
  3057. * @since 3.7.0
  3058. * @category Object
  3059. * @param {Object} object The object to query.
  3060. * @param {Array|string} path The path of the property to get.
  3061. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  3062. * @returns {*} Returns the resolved value.
  3063. * @example
  3064. *
  3065. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  3066. *
  3067. * _.get(object, 'a[0].b.c');
  3068. * // => 3
  3069. *
  3070. * _.get(object, ['a', '0', 'b', 'c']);
  3071. * // => 3
  3072. *
  3073. * _.get(object, 'a.b.c', 'default');
  3074. * // => 'default'
  3075. */
  3076. function get(object, path, defaultValue) {
  3077. var result = object == null ? void 0 : baseGet(object, path);
  3078. return result === void 0 ? defaultValue : result;
  3079. }
  3080. //#endregion
  3081. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js
  3082. /**
  3083. * Appends the elements of `values` to `array`.
  3084. *
  3085. * @private
  3086. * @param {Array} array The array to modify.
  3087. * @param {Array} values The values to append.
  3088. * @returns {Array} Returns `array`.
  3089. */
  3090. function arrayPush(array, values) {
  3091. var index = -1, length = values.length, offset = array.length;
  3092. while (++index < length) array[offset + index] = values[index];
  3093. return array;
  3094. }
  3095. //#endregion
  3096. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isFlattenable.js
  3097. /** Built-in value references. */
  3098. var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
  3099. /**
  3100. * Checks if `value` is a flattenable `arguments` object or array.
  3101. *
  3102. * @private
  3103. * @param {*} value The value to check.
  3104. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  3105. */
  3106. function isFlattenable(value) {
  3107. return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  3108. }
  3109. //#endregion
  3110. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFlatten.js
  3111. /**
  3112. * The base implementation of `_.flatten` with support for restricting flattening.
  3113. *
  3114. * @private
  3115. * @param {Array} array The array to flatten.
  3116. * @param {number} depth The maximum recursion depth.
  3117. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  3118. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  3119. * @param {Array} [result=[]] The initial result value.
  3120. * @returns {Array} Returns the new flattened array.
  3121. */
  3122. function baseFlatten(array, depth, predicate, isStrict, result) {
  3123. var index = -1, length = array.length;
  3124. predicate || (predicate = isFlattenable);
  3125. result || (result = []);
  3126. while (++index < length) {
  3127. var value = array[index];
  3128. if (depth > 0 && predicate(value)) if (depth > 1) baseFlatten(value, depth - 1, predicate, isStrict, result);
  3129. else arrayPush(result, value);
  3130. else if (!isStrict) result[result.length] = value;
  3131. }
  3132. return result;
  3133. }
  3134. //#endregion
  3135. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/flatten.js
  3136. /**
  3137. * Flattens `array` a single level deep.
  3138. *
  3139. * @static
  3140. * @memberOf _
  3141. * @since 0.1.0
  3142. * @category Array
  3143. * @param {Array} array The array to flatten.
  3144. * @returns {Array} Returns the new flattened array.
  3145. * @example
  3146. *
  3147. * _.flatten([1, [2, [3, [4]], 5]]);
  3148. * // => [1, 2, [3, [4]], 5]
  3149. */
  3150. function flatten(array) {
  3151. return (array == null ? 0 : array.length) ? baseFlatten(array, 1) : [];
  3152. }
  3153. //#endregion
  3154. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_flatRest.js
  3155. /**
  3156. * A specialized version of `baseRest` which flattens the rest array.
  3157. *
  3158. * @private
  3159. * @param {Function} func The function to apply a rest parameter to.
  3160. * @returns {Function} Returns the new function.
  3161. */
  3162. function flatRest(func) {
  3163. return setToString(overRest(func, void 0, flatten), func + "");
  3164. }
  3165. //#endregion
  3166. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js
  3167. /** Built-in value references. */
  3168. var getPrototype = overArg(Object.getPrototypeOf, Object);
  3169. //#endregion
  3170. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isPlainObject.js
  3171. /** `Object#toString` result references. */
  3172. var objectTag$3 = "[object Object]";
  3173. /** Used for built-in method references. */
  3174. var funcProto = Function.prototype, objectProto = Object.prototype;
  3175. /** Used to resolve the decompiled source of functions. */
  3176. var funcToString = funcProto.toString;
  3177. /** Used to check objects for own properties. */
  3178. var hasOwnProperty$4 = objectProto.hasOwnProperty;
  3179. /** Used to infer the `Object` constructor. */
  3180. var objectCtorString = funcToString.call(Object);
  3181. /**
  3182. * Checks if `value` is a plain object, that is, an object created by the
  3183. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  3184. *
  3185. * @static
  3186. * @memberOf _
  3187. * @since 0.8.0
  3188. * @category Lang
  3189. * @param {*} value The value to check.
  3190. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  3191. * @example
  3192. *
  3193. * function Foo() {
  3194. * this.a = 1;
  3195. * }
  3196. *
  3197. * _.isPlainObject(new Foo);
  3198. * // => false
  3199. *
  3200. * _.isPlainObject([1, 2, 3]);
  3201. * // => false
  3202. *
  3203. * _.isPlainObject({ 'x': 0, 'y': 0 });
  3204. * // => true
  3205. *
  3206. * _.isPlainObject(Object.create(null));
  3207. * // => true
  3208. */
  3209. function isPlainObject(value) {
  3210. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) return false;
  3211. var proto = getPrototype(value);
  3212. if (proto === null) return true;
  3213. var Ctor = hasOwnProperty$4.call(proto, "constructor") && proto.constructor;
  3214. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  3215. }
  3216. //#endregion
  3217. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSlice.js
  3218. /**
  3219. * The base implementation of `_.slice` without an iteratee call guard.
  3220. *
  3221. * @private
  3222. * @param {Array} array The array to slice.
  3223. * @param {number} [start=0] The start position.
  3224. * @param {number} [end=array.length] The end position.
  3225. * @returns {Array} Returns the slice of `array`.
  3226. */
  3227. function baseSlice(array, start, end) {
  3228. var index = -1, length = array.length;
  3229. if (start < 0) start = -start > length ? 0 : length + start;
  3230. end = end > length ? length : end;
  3231. if (end < 0) end += length;
  3232. length = start > end ? 0 : end - start >>> 0;
  3233. start >>>= 0;
  3234. var result = Array(length);
  3235. while (++index < length) result[index] = array[index + start];
  3236. return result;
  3237. }
  3238. //#endregion
  3239. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/castArray.js
  3240. /**
  3241. * Casts `value` as an array if it's not one.
  3242. *
  3243. * @static
  3244. * @memberOf _
  3245. * @since 4.4.0
  3246. * @category Lang
  3247. * @param {*} value The value to inspect.
  3248. * @returns {Array} Returns the cast array.
  3249. * @example
  3250. *
  3251. * _.castArray(1);
  3252. * // => [1]
  3253. *
  3254. * _.castArray({ 'a': 1 });
  3255. * // => [{ 'a': 1 }]
  3256. *
  3257. * _.castArray('abc');
  3258. * // => ['abc']
  3259. *
  3260. * _.castArray(null);
  3261. * // => [null]
  3262. *
  3263. * _.castArray(undefined);
  3264. * // => [undefined]
  3265. *
  3266. * _.castArray();
  3267. * // => []
  3268. *
  3269. * var array = [1, 2, 3];
  3270. * console.log(_.castArray(array) === array);
  3271. * // => true
  3272. */
  3273. function castArray$1() {
  3274. if (!arguments.length) return [];
  3275. var value = arguments[0];
  3276. return isArray(value) ? value : [value];
  3277. }
  3278. //#endregion
  3279. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseClamp.js
  3280. /**
  3281. * The base implementation of `_.clamp` which doesn't coerce arguments.
  3282. *
  3283. * @private
  3284. * @param {number} number The number to clamp.
  3285. * @param {number} [lower] The lower bound.
  3286. * @param {number} upper The upper bound.
  3287. * @returns {number} Returns the clamped number.
  3288. */
  3289. function baseClamp(number, lower, upper) {
  3290. if (number === number) {
  3291. if (upper !== void 0) number = number <= upper ? number : upper;
  3292. if (lower !== void 0) number = number >= lower ? number : lower;
  3293. }
  3294. return number;
  3295. }
  3296. //#endregion
  3297. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/clamp.js
  3298. /**
  3299. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  3300. *
  3301. * @static
  3302. * @memberOf _
  3303. * @since 4.0.0
  3304. * @category Number
  3305. * @param {number} number The number to clamp.
  3306. * @param {number} [lower] The lower bound.
  3307. * @param {number} upper The upper bound.
  3308. * @returns {number} Returns the clamped number.
  3309. * @example
  3310. *
  3311. * _.clamp(-10, -5, 5);
  3312. * // => -5
  3313. *
  3314. * _.clamp(10, -5, 5);
  3315. * // => 5
  3316. */
  3317. function clamp$1(number, lower, upper) {
  3318. if (upper === void 0) {
  3319. upper = lower;
  3320. lower = void 0;
  3321. }
  3322. if (upper !== void 0) {
  3323. upper = toNumber(upper);
  3324. upper = upper === upper ? upper : 0;
  3325. }
  3326. if (lower !== void 0) {
  3327. lower = toNumber(lower);
  3328. lower = lower === lower ? lower : 0;
  3329. }
  3330. return baseClamp(toNumber(number), lower, upper);
  3331. }
  3332. //#endregion
  3333. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js
  3334. /**
  3335. * Removes all key-value entries from the stack.
  3336. *
  3337. * @private
  3338. * @name clear
  3339. * @memberOf Stack
  3340. */
  3341. function stackClear() {
  3342. this.__data__ = new ListCache();
  3343. this.size = 0;
  3344. }
  3345. //#endregion
  3346. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js
  3347. /**
  3348. * Removes `key` and its value from the stack.
  3349. *
  3350. * @private
  3351. * @name delete
  3352. * @memberOf Stack
  3353. * @param {string} key The key of the value to remove.
  3354. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3355. */
  3356. function stackDelete(key) {
  3357. var data = this.__data__, result = data["delete"](key);
  3358. this.size = data.size;
  3359. return result;
  3360. }
  3361. //#endregion
  3362. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js
  3363. /**
  3364. * Gets the stack value for `key`.
  3365. *
  3366. * @private
  3367. * @name get
  3368. * @memberOf Stack
  3369. * @param {string} key The key of the value to get.
  3370. * @returns {*} Returns the entry value.
  3371. */
  3372. function stackGet(key) {
  3373. return this.__data__.get(key);
  3374. }
  3375. //#endregion
  3376. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js
  3377. /**
  3378. * Checks if a stack value for `key` exists.
  3379. *
  3380. * @private
  3381. * @name has
  3382. * @memberOf Stack
  3383. * @param {string} key The key of the entry to check.
  3384. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3385. */
  3386. function stackHas(key) {
  3387. return this.__data__.has(key);
  3388. }
  3389. //#endregion
  3390. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js
  3391. /** Used as the size to enable large array optimizations. */
  3392. var LARGE_ARRAY_SIZE$1 = 200;
  3393. /**
  3394. * Sets the stack `key` to `value`.
  3395. *
  3396. * @private
  3397. * @name set
  3398. * @memberOf Stack
  3399. * @param {string} key The key of the value to set.
  3400. * @param {*} value The value to set.
  3401. * @returns {Object} Returns the stack cache instance.
  3402. */
  3403. function stackSet(key, value) {
  3404. var data = this.__data__;
  3405. if (data instanceof ListCache) {
  3406. var pairs = data.__data__;
  3407. if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
  3408. pairs.push([key, value]);
  3409. this.size = ++data.size;
  3410. return this;
  3411. }
  3412. data = this.__data__ = new MapCache(pairs);
  3413. }
  3414. data.set(key, value);
  3415. this.size = data.size;
  3416. return this;
  3417. }
  3418. //#endregion
  3419. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js
  3420. /**
  3421. * Creates a stack cache object to store key-value pairs.
  3422. *
  3423. * @private
  3424. * @constructor
  3425. * @param {Array} [entries] The key-value pairs to cache.
  3426. */
  3427. function Stack(entries) {
  3428. this.size = (this.__data__ = new ListCache(entries)).size;
  3429. }
  3430. Stack.prototype.clear = stackClear;
  3431. Stack.prototype["delete"] = stackDelete;
  3432. Stack.prototype.get = stackGet;
  3433. Stack.prototype.has = stackHas;
  3434. Stack.prototype.set = stackSet;
  3435. //#endregion
  3436. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js
  3437. /**
  3438. * The base implementation of `_.assign` without support for multiple sources
  3439. * or `customizer` functions.
  3440. *
  3441. * @private
  3442. * @param {Object} object The destination object.
  3443. * @param {Object} source The source object.
  3444. * @returns {Object} Returns `object`.
  3445. */
  3446. function baseAssign(object, source) {
  3447. return object && copyObject(source, keys(source), object);
  3448. }
  3449. //#endregion
  3450. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js
  3451. /**
  3452. * The base implementation of `_.assignIn` without support for multiple sources
  3453. * or `customizer` functions.
  3454. *
  3455. * @private
  3456. * @param {Object} object The destination object.
  3457. * @param {Object} source The source object.
  3458. * @returns {Object} Returns `object`.
  3459. */
  3460. function baseAssignIn(object, source) {
  3461. return object && copyObject(source, keysIn(source), object);
  3462. }
  3463. //#endregion
  3464. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js
  3465. /** Detect free variable `exports`. */
  3466. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  3467. /** Detect free variable `module`. */
  3468. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  3469. /** Built-in value references. */
  3470. var Buffer$1 = freeModule && freeModule.exports === freeExports ? root.Buffer : void 0, allocUnsafe = Buffer$1 ? Buffer$1.allocUnsafe : void 0;
  3471. /**
  3472. * Creates a clone of `buffer`.
  3473. *
  3474. * @private
  3475. * @param {Buffer} buffer The buffer to clone.
  3476. * @param {boolean} [isDeep] Specify a deep clone.
  3477. * @returns {Buffer} Returns the cloned buffer.
  3478. */
  3479. function cloneBuffer(buffer, isDeep) {
  3480. if (isDeep) return buffer.slice();
  3481. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  3482. buffer.copy(result);
  3483. return result;
  3484. }
  3485. //#endregion
  3486. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js
  3487. /**
  3488. * A specialized version of `_.filter` for arrays without support for
  3489. * iteratee shorthands.
  3490. *
  3491. * @private
  3492. * @param {Array} [array] The array to iterate over.
  3493. * @param {Function} predicate The function invoked per iteration.
  3494. * @returns {Array} Returns the new filtered array.
  3495. */
  3496. function arrayFilter(array, predicate) {
  3497. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  3498. while (++index < length) {
  3499. var value = array[index];
  3500. if (predicate(value, index, array)) result[resIndex++] = value;
  3501. }
  3502. return result;
  3503. }
  3504. //#endregion
  3505. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js
  3506. /**
  3507. * This method returns a new empty array.
  3508. *
  3509. * @static
  3510. * @memberOf _
  3511. * @since 4.13.0
  3512. * @category Util
  3513. * @returns {Array} Returns the new empty array.
  3514. * @example
  3515. *
  3516. * var arrays = _.times(2, _.stubArray);
  3517. *
  3518. * console.log(arrays);
  3519. * // => [[], []]
  3520. *
  3521. * console.log(arrays[0] === arrays[1]);
  3522. * // => false
  3523. */
  3524. function stubArray() {
  3525. return [];
  3526. }
  3527. //#endregion
  3528. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js
  3529. /** Built-in value references. */
  3530. var propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
  3531. var nativeGetSymbols = Object.getOwnPropertySymbols;
  3532. /**
  3533. * Creates an array of the own enumerable symbols of `object`.
  3534. *
  3535. * @private
  3536. * @param {Object} object The object to query.
  3537. * @returns {Array} Returns the array of symbols.
  3538. */
  3539. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  3540. if (object == null) return [];
  3541. object = Object(object);
  3542. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  3543. return propertyIsEnumerable.call(object, symbol);
  3544. });
  3545. };
  3546. //#endregion
  3547. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js
  3548. /**
  3549. * Copies own symbols of `source` to `object`.
  3550. *
  3551. * @private
  3552. * @param {Object} source The object to copy symbols from.
  3553. * @param {Object} [object={}] The object to copy symbols to.
  3554. * @returns {Object} Returns `object`.
  3555. */
  3556. function copySymbols(source, object) {
  3557. return copyObject(source, getSymbols(source), object);
  3558. }
  3559. //#endregion
  3560. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js
  3561. /**
  3562. * Creates an array of the own and inherited enumerable symbols of `object`.
  3563. *
  3564. * @private
  3565. * @param {Object} object The object to query.
  3566. * @returns {Array} Returns the array of symbols.
  3567. */
  3568. var getSymbolsIn = !Object.getOwnPropertySymbols ? stubArray : function(object) {
  3569. var result = [];
  3570. while (object) {
  3571. arrayPush(result, getSymbols(object));
  3572. object = getPrototype(object);
  3573. }
  3574. return result;
  3575. };
  3576. //#endregion
  3577. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js
  3578. /**
  3579. * Copies own and inherited symbols of `source` to `object`.
  3580. *
  3581. * @private
  3582. * @param {Object} source The object to copy symbols from.
  3583. * @param {Object} [object={}] The object to copy symbols to.
  3584. * @returns {Object} Returns `object`.
  3585. */
  3586. function copySymbolsIn(source, object) {
  3587. return copyObject(source, getSymbolsIn(source), object);
  3588. }
  3589. //#endregion
  3590. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js
  3591. /**
  3592. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  3593. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  3594. * symbols of `object`.
  3595. *
  3596. * @private
  3597. * @param {Object} object The object to query.
  3598. * @param {Function} keysFunc The function to get the keys of `object`.
  3599. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  3600. * @returns {Array} Returns the array of property names and symbols.
  3601. */
  3602. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  3603. var result = keysFunc(object);
  3604. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  3605. }
  3606. //#endregion
  3607. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js
  3608. /**
  3609. * Creates an array of own enumerable property names and symbols of `object`.
  3610. *
  3611. * @private
  3612. * @param {Object} object The object to query.
  3613. * @returns {Array} Returns the array of property names and symbols.
  3614. */
  3615. function getAllKeys(object) {
  3616. return baseGetAllKeys(object, keys, getSymbols);
  3617. }
  3618. //#endregion
  3619. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js
  3620. /**
  3621. * Creates an array of own and inherited enumerable property names and
  3622. * symbols of `object`.
  3623. *
  3624. * @private
  3625. * @param {Object} object The object to query.
  3626. * @returns {Array} Returns the array of property names and symbols.
  3627. */
  3628. function getAllKeysIn(object) {
  3629. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  3630. }
  3631. //#endregion
  3632. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js
  3633. var DataView = getNative(root, "DataView");
  3634. //#endregion
  3635. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js
  3636. var Promise$1 = getNative(root, "Promise");
  3637. //#endregion
  3638. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Set.js
  3639. var Set$1 = getNative(root, "Set");
  3640. //#endregion
  3641. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js
  3642. /** `Object#toString` result references. */
  3643. var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
  3644. var dataViewTag$3 = "[object DataView]";
  3645. /** Used to detect maps, sets, and weakmaps. */
  3646. var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$1);
  3647. /**
  3648. * Gets the `toStringTag` of `value`.
  3649. *
  3650. * @private
  3651. * @param {*} value The value to query.
  3652. * @returns {string} Returns the `toStringTag`.
  3653. */
  3654. var getTag = baseGetTag;
  3655. if (DataView && getTag(new DataView(/* @__PURE__ */ new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$4 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$4 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) getTag = function(value) {
  3656. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  3657. if (ctorString) switch (ctorString) {
  3658. case dataViewCtorString: return dataViewTag$3;
  3659. case mapCtorString: return mapTag$4;
  3660. case promiseCtorString: return promiseTag;
  3661. case setCtorString: return setTag$4;
  3662. case weakMapCtorString: return weakMapTag$1;
  3663. }
  3664. return result;
  3665. };
  3666. var _getTag_default = getTag;
  3667. //#endregion
  3668. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js
  3669. /** Used to check objects for own properties. */
  3670. var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
  3671. /**
  3672. * Initializes an array clone.
  3673. *
  3674. * @private
  3675. * @param {Array} array The array to clone.
  3676. * @returns {Array} Returns the initialized clone.
  3677. */
  3678. function initCloneArray(array) {
  3679. var length = array.length, result = new array.constructor(length);
  3680. if (length && typeof array[0] == "string" && hasOwnProperty$3.call(array, "index")) {
  3681. result.index = array.index;
  3682. result.input = array.input;
  3683. }
  3684. return result;
  3685. }
  3686. //#endregion
  3687. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js
  3688. /** Built-in value references. */
  3689. var Uint8Array$1 = root.Uint8Array;
  3690. //#endregion
  3691. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js
  3692. /**
  3693. * Creates a clone of `arrayBuffer`.
  3694. *
  3695. * @private
  3696. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  3697. * @returns {ArrayBuffer} Returns the cloned array buffer.
  3698. */
  3699. function cloneArrayBuffer(arrayBuffer) {
  3700. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  3701. new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
  3702. return result;
  3703. }
  3704. //#endregion
  3705. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js
  3706. /**
  3707. * Creates a clone of `dataView`.
  3708. *
  3709. * @private
  3710. * @param {Object} dataView The data view to clone.
  3711. * @param {boolean} [isDeep] Specify a deep clone.
  3712. * @returns {Object} Returns the cloned data view.
  3713. */
  3714. function cloneDataView(dataView, isDeep) {
  3715. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  3716. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  3717. }
  3718. //#endregion
  3719. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js
  3720. /** Used to match `RegExp` flags from their coerced string values. */
  3721. var reFlags = /\w*$/;
  3722. /**
  3723. * Creates a clone of `regexp`.
  3724. *
  3725. * @private
  3726. * @param {Object} regexp The regexp to clone.
  3727. * @returns {Object} Returns the cloned regexp.
  3728. */
  3729. function cloneRegExp(regexp) {
  3730. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  3731. result.lastIndex = regexp.lastIndex;
  3732. return result;
  3733. }
  3734. //#endregion
  3735. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js
  3736. /** Used to convert symbols to primitives and strings. */
  3737. var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  3738. /**
  3739. * Creates a clone of the `symbol` object.
  3740. *
  3741. * @private
  3742. * @param {Object} symbol The symbol object to clone.
  3743. * @returns {Object} Returns the cloned symbol object.
  3744. */
  3745. function cloneSymbol(symbol) {
  3746. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  3747. }
  3748. //#endregion
  3749. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js
  3750. /**
  3751. * Creates a clone of `typedArray`.
  3752. *
  3753. * @private
  3754. * @param {Object} typedArray The typed array to clone.
  3755. * @param {boolean} [isDeep] Specify a deep clone.
  3756. * @returns {Object} Returns the cloned typed array.
  3757. */
  3758. function cloneTypedArray(typedArray, isDeep) {
  3759. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  3760. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  3761. }
  3762. //#endregion
  3763. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js
  3764. /** `Object#toString` result references. */
  3765. var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]";
  3766. var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
  3767. /**
  3768. * Initializes an object clone based on its `toStringTag`.
  3769. *
  3770. * **Note:** This function only supports cloning values with tags of
  3771. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  3772. *
  3773. * @private
  3774. * @param {Object} object The object to clone.
  3775. * @param {string} tag The `toStringTag` of the object to clone.
  3776. * @param {boolean} [isDeep] Specify a deep clone.
  3777. * @returns {Object} Returns the initialized clone.
  3778. */
  3779. function initCloneByTag(object, tag, isDeep) {
  3780. var Ctor = object.constructor;
  3781. switch (tag) {
  3782. case arrayBufferTag$2: return cloneArrayBuffer(object);
  3783. case boolTag$2:
  3784. case dateTag$2: return new Ctor(+object);
  3785. case dataViewTag$2: return cloneDataView(object, isDeep);
  3786. case float32Tag$1:
  3787. case float64Tag$1:
  3788. case int8Tag$1:
  3789. case int16Tag$1:
  3790. case int32Tag$1:
  3791. case uint8Tag$1:
  3792. case uint8ClampedTag$1:
  3793. case uint16Tag$1:
  3794. case uint32Tag$1: return cloneTypedArray(object, isDeep);
  3795. case mapTag$3: return new Ctor();
  3796. case numberTag$2:
  3797. case stringTag$2: return new Ctor(object);
  3798. case regexpTag$2: return cloneRegExp(object);
  3799. case setTag$3: return new Ctor();
  3800. case symbolTag$2: return cloneSymbol(object);
  3801. }
  3802. }
  3803. //#endregion
  3804. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js
  3805. /**
  3806. * Initializes an object clone.
  3807. *
  3808. * @private
  3809. * @param {Object} object The object to clone.
  3810. * @returns {Object} Returns the initialized clone.
  3811. */
  3812. function initCloneObject(object) {
  3813. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
  3814. }
  3815. //#endregion
  3816. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js
  3817. /** `Object#toString` result references. */
  3818. var mapTag$2 = "[object Map]";
  3819. /**
  3820. * The base implementation of `_.isMap` without Node.js optimizations.
  3821. *
  3822. * @private
  3823. * @param {*} value The value to check.
  3824. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  3825. */
  3826. function baseIsMap(value) {
  3827. return isObjectLike(value) && _getTag_default(value) == mapTag$2;
  3828. }
  3829. //#endregion
  3830. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isMap.js
  3831. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  3832. /**
  3833. * Checks if `value` is classified as a `Map` object.
  3834. *
  3835. * @static
  3836. * @memberOf _
  3837. * @since 4.3.0
  3838. * @category Lang
  3839. * @param {*} value The value to check.
  3840. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  3841. * @example
  3842. *
  3843. * _.isMap(new Map);
  3844. * // => true
  3845. *
  3846. * _.isMap(new WeakMap);
  3847. * // => false
  3848. */
  3849. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  3850. //#endregion
  3851. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js
  3852. /** `Object#toString` result references. */
  3853. var setTag$2 = "[object Set]";
  3854. /**
  3855. * The base implementation of `_.isSet` without Node.js optimizations.
  3856. *
  3857. * @private
  3858. * @param {*} value The value to check.
  3859. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  3860. */
  3861. function baseIsSet(value) {
  3862. return isObjectLike(value) && _getTag_default(value) == setTag$2;
  3863. }
  3864. //#endregion
  3865. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSet.js
  3866. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  3867. /**
  3868. * Checks if `value` is classified as a `Set` object.
  3869. *
  3870. * @static
  3871. * @memberOf _
  3872. * @since 4.3.0
  3873. * @category Lang
  3874. * @param {*} value The value to check.
  3875. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  3876. * @example
  3877. *
  3878. * _.isSet(new Set);
  3879. * // => true
  3880. *
  3881. * _.isSet(new WeakSet);
  3882. * // => false
  3883. */
  3884. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  3885. //#endregion
  3886. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js
  3887. /** Used to compose bitmasks for cloning. */
  3888. var CLONE_DEEP_FLAG$2 = 1, CLONE_FLAT_FLAG$1 = 2, CLONE_SYMBOLS_FLAG$2 = 4;
  3889. /** `Object#toString` result references. */
  3890. var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
  3891. var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
  3892. /** Used to identify `toStringTag` values supported by `_.clone`. */
  3893. var cloneableTags = {};
  3894. cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  3895. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
  3896. /**
  3897. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  3898. * traversed objects.
  3899. *
  3900. * @private
  3901. * @param {*} value The value to clone.
  3902. * @param {boolean} bitmask The bitmask flags.
  3903. * 1 - Deep clone
  3904. * 2 - Flatten inherited properties
  3905. * 4 - Clone symbols
  3906. * @param {Function} [customizer] The function to customize cloning.
  3907. * @param {string} [key] The key of `value`.
  3908. * @param {Object} [object] The parent object of `value`.
  3909. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  3910. * @returns {*} Returns the cloned value.
  3911. */
  3912. function baseClone(value, bitmask, customizer, key, object, stack) {
  3913. var result, isDeep = bitmask & CLONE_DEEP_FLAG$2, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
  3914. if (customizer) result = object ? customizer(value, key, object, stack) : customizer(value);
  3915. if (result !== void 0) return result;
  3916. if (!isObject(value)) return value;
  3917. var isArr = isArray(value);
  3918. if (isArr) {
  3919. result = initCloneArray(value);
  3920. if (!isDeep) return copyArray(value, result);
  3921. } else {
  3922. var tag = _getTag_default(value), isFunc = tag == funcTag || tag == genTag;
  3923. if (isBuffer(value)) return cloneBuffer(value, isDeep);
  3924. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
  3925. result = isFlat || isFunc ? {} : initCloneObject(value);
  3926. if (!isDeep) return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  3927. } else {
  3928. if (!cloneableTags[tag]) return object ? value : {};
  3929. result = initCloneByTag(value, tag, isDeep);
  3930. }
  3931. }
  3932. stack || (stack = new Stack());
  3933. var stacked = stack.get(value);
  3934. if (stacked) return stacked;
  3935. stack.set(value, result);
  3936. if (isSet(value)) value.forEach(function(subValue) {
  3937. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  3938. });
  3939. else if (isMap(value)) value.forEach(function(subValue, key) {
  3940. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3941. });
  3942. var props = isArr ? void 0 : (isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys)(value);
  3943. arrayEach(props || value, function(subValue, key) {
  3944. if (props) {
  3945. key = subValue;
  3946. subValue = value[key];
  3947. }
  3948. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3949. });
  3950. return result;
  3951. }
  3952. //#endregion
  3953. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js
  3954. /** Used to compose bitmasks for cloning. */
  3955. var CLONE_DEEP_FLAG$1 = 1, CLONE_SYMBOLS_FLAG$1 = 4;
  3956. /**
  3957. * This method is like `_.clone` except that it recursively clones `value`.
  3958. *
  3959. * @static
  3960. * @memberOf _
  3961. * @since 1.0.0
  3962. * @category Lang
  3963. * @param {*} value The value to recursively clone.
  3964. * @returns {*} Returns the deep cloned value.
  3965. * @see _.clone
  3966. * @example
  3967. *
  3968. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  3969. *
  3970. * var deep = _.cloneDeep(objects);
  3971. * console.log(deep[0] === objects[0]);
  3972. * // => false
  3973. */
  3974. function cloneDeep(value) {
  3975. return baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1);
  3976. }
  3977. //#endregion
  3978. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js
  3979. /** Used to stand-in for `undefined` hash values. */
  3980. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  3981. /**
  3982. * Adds `value` to the array cache.
  3983. *
  3984. * @private
  3985. * @name add
  3986. * @memberOf SetCache
  3987. * @alias push
  3988. * @param {*} value The value to cache.
  3989. * @returns {Object} Returns the cache instance.
  3990. */
  3991. function setCacheAdd(value) {
  3992. this.__data__.set(value, HASH_UNDEFINED);
  3993. return this;
  3994. }
  3995. //#endregion
  3996. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js
  3997. /**
  3998. * Checks if `value` is in the array cache.
  3999. *
  4000. * @private
  4001. * @name has
  4002. * @memberOf SetCache
  4003. * @param {*} value The value to search for.
  4004. * @returns {number} Returns `true` if `value` is found, else `false`.
  4005. */
  4006. function setCacheHas(value) {
  4007. return this.__data__.has(value);
  4008. }
  4009. //#endregion
  4010. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js
  4011. /**
  4012. *
  4013. * Creates an array cache object to store unique values.
  4014. *
  4015. * @private
  4016. * @constructor
  4017. * @param {Array} [values] The values to cache.
  4018. */
  4019. function SetCache(values) {
  4020. var index = -1, length = values == null ? 0 : values.length;
  4021. this.__data__ = new MapCache();
  4022. while (++index < length) this.add(values[index]);
  4023. }
  4024. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  4025. SetCache.prototype.has = setCacheHas;
  4026. //#endregion
  4027. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js
  4028. /**
  4029. * A specialized version of `_.some` for arrays without support for iteratee
  4030. * shorthands.
  4031. *
  4032. * @private
  4033. * @param {Array} [array] The array to iterate over.
  4034. * @param {Function} predicate The function invoked per iteration.
  4035. * @returns {boolean} Returns `true` if any element passes the predicate check,
  4036. * else `false`.
  4037. */
  4038. function arraySome(array, predicate) {
  4039. var index = -1, length = array == null ? 0 : array.length;
  4040. while (++index < length) if (predicate(array[index], index, array)) return true;
  4041. return false;
  4042. }
  4043. //#endregion
  4044. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js
  4045. /**
  4046. * Checks if a `cache` value for `key` exists.
  4047. *
  4048. * @private
  4049. * @param {Object} cache The cache to query.
  4050. * @param {string} key The key of the entry to check.
  4051. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4052. */
  4053. function cacheHas(cache, key) {
  4054. return cache.has(key);
  4055. }
  4056. //#endregion
  4057. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js
  4058. /** Used to compose bitmasks for value comparisons. */
  4059. var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2;
  4060. /**
  4061. * A specialized version of `baseIsEqualDeep` for arrays with support for
  4062. * partial deep comparisons.
  4063. *
  4064. * @private
  4065. * @param {Array} array The array to compare.
  4066. * @param {Array} other The other array to compare.
  4067. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  4068. * @param {Function} customizer The function to customize comparisons.
  4069. * @param {Function} equalFunc The function to determine equivalents of values.
  4070. * @param {Object} stack Tracks traversed `array` and `other` objects.
  4071. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  4072. */
  4073. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  4074. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  4075. if (arrLength != othLength && !(isPartial && othLength > arrLength)) return false;
  4076. var arrStacked = stack.get(array);
  4077. var othStacked = stack.get(other);
  4078. if (arrStacked && othStacked) return arrStacked == other && othStacked == array;
  4079. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  4080. stack.set(array, other);
  4081. stack.set(other, array);
  4082. while (++index < arrLength) {
  4083. var arrValue = array[index], othValue = other[index];
  4084. if (customizer) var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  4085. if (compared !== void 0) {
  4086. if (compared) continue;
  4087. result = false;
  4088. break;
  4089. }
  4090. if (seen) {
  4091. if (!arraySome(other, function(othValue, othIndex) {
  4092. if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) return seen.push(othIndex);
  4093. })) {
  4094. result = false;
  4095. break;
  4096. }
  4097. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  4098. result = false;
  4099. break;
  4100. }
  4101. }
  4102. stack["delete"](array);
  4103. stack["delete"](other);
  4104. return result;
  4105. }
  4106. //#endregion
  4107. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js
  4108. /**
  4109. * Converts `map` to its key-value pairs.
  4110. *
  4111. * @private
  4112. * @param {Object} map The map to convert.
  4113. * @returns {Array} Returns the key-value pairs.
  4114. */
  4115. function mapToArray(map) {
  4116. var index = -1, result = Array(map.size);
  4117. map.forEach(function(value, key) {
  4118. result[++index] = [key, value];
  4119. });
  4120. return result;
  4121. }
  4122. //#endregion
  4123. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js
  4124. /**
  4125. * Converts `set` to an array of its values.
  4126. *
  4127. * @private
  4128. * @param {Object} set The set to convert.
  4129. * @returns {Array} Returns the values.
  4130. */
  4131. function setToArray(set) {
  4132. var index = -1, result = Array(set.size);
  4133. set.forEach(function(value) {
  4134. result[++index] = value;
  4135. });
  4136. return result;
  4137. }
  4138. //#endregion
  4139. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js
  4140. /** Used to compose bitmasks for value comparisons. */
  4141. var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2;
  4142. /** `Object#toString` result references. */
  4143. var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
  4144. var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
  4145. /** Used to convert symbols to primitives and strings. */
  4146. var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  4147. /**
  4148. * A specialized version of `baseIsEqualDeep` for comparing objects of
  4149. * the same `toStringTag`.
  4150. *
  4151. * **Note:** This function only supports comparing values with tags of
  4152. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  4153. *
  4154. * @private
  4155. * @param {Object} object The object to compare.
  4156. * @param {Object} other The other object to compare.
  4157. * @param {string} tag The `toStringTag` of the objects to compare.
  4158. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  4159. * @param {Function} customizer The function to customize comparisons.
  4160. * @param {Function} equalFunc The function to determine equivalents of values.
  4161. * @param {Object} stack Tracks traversed `object` and `other` objects.
  4162. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4163. */
  4164. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  4165. switch (tag) {
  4166. case dataViewTag:
  4167. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) return false;
  4168. object = object.buffer;
  4169. other = other.buffer;
  4170. case arrayBufferTag:
  4171. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) return false;
  4172. return true;
  4173. case boolTag:
  4174. case dateTag:
  4175. case numberTag: return eq(+object, +other);
  4176. case errorTag: return object.name == other.name && object.message == other.message;
  4177. case regexpTag:
  4178. case stringTag: return object == other + "";
  4179. case mapTag: var convert = mapToArray;
  4180. case setTag:
  4181. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  4182. convert || (convert = setToArray);
  4183. if (object.size != other.size && !isPartial) return false;
  4184. var stacked = stack.get(object);
  4185. if (stacked) return stacked == other;
  4186. bitmask |= COMPARE_UNORDERED_FLAG$2;
  4187. stack.set(object, other);
  4188. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  4189. stack["delete"](object);
  4190. return result;
  4191. case symbolTag: if (symbolValueOf) return symbolValueOf.call(object) == symbolValueOf.call(other);
  4192. }
  4193. return false;
  4194. }
  4195. //#endregion
  4196. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js
  4197. /** Used to compose bitmasks for value comparisons. */
  4198. var COMPARE_PARTIAL_FLAG$3 = 1;
  4199. /** Used to check objects for own properties. */
  4200. var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
  4201. /**
  4202. * A specialized version of `baseIsEqualDeep` for objects with support for
  4203. * partial deep comparisons.
  4204. *
  4205. * @private
  4206. * @param {Object} object The object to compare.
  4207. * @param {Object} other The other object to compare.
  4208. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  4209. * @param {Function} customizer The function to customize comparisons.
  4210. * @param {Function} equalFunc The function to determine equivalents of values.
  4211. * @param {Object} stack Tracks traversed `object` and `other` objects.
  4212. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4213. */
  4214. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  4215. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length;
  4216. if (objLength != getAllKeys(other).length && !isPartial) return false;
  4217. var index = objLength;
  4218. while (index--) {
  4219. var key = objProps[index];
  4220. if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) return false;
  4221. }
  4222. var objStacked = stack.get(object);
  4223. var othStacked = stack.get(other);
  4224. if (objStacked && othStacked) return objStacked == other && othStacked == object;
  4225. var result = true;
  4226. stack.set(object, other);
  4227. stack.set(other, object);
  4228. var skipCtor = isPartial;
  4229. while (++index < objLength) {
  4230. key = objProps[index];
  4231. var objValue = object[key], othValue = other[key];
  4232. if (customizer) var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  4233. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  4234. result = false;
  4235. break;
  4236. }
  4237. skipCtor || (skipCtor = key == "constructor");
  4238. }
  4239. if (result && !skipCtor) {
  4240. var objCtor = object.constructor, othCtor = other.constructor;
  4241. if (objCtor != othCtor && "constructor" in object && "constructor" in other && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) result = false;
  4242. }
  4243. stack["delete"](object);
  4244. stack["delete"](other);
  4245. return result;
  4246. }
  4247. //#endregion
  4248. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js
  4249. /** Used to compose bitmasks for value comparisons. */
  4250. var COMPARE_PARTIAL_FLAG$2 = 1;
  4251. /** `Object#toString` result references. */
  4252. var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
  4253. /** Used to check objects for own properties. */
  4254. var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  4255. /**
  4256. * A specialized version of `baseIsEqual` for arrays and objects which performs
  4257. * deep comparisons and tracks traversed objects enabling objects with circular
  4258. * references to be compared.
  4259. *
  4260. * @private
  4261. * @param {Object} object The object to compare.
  4262. * @param {Object} other The other object to compare.
  4263. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  4264. * @param {Function} customizer The function to customize comparisons.
  4265. * @param {Function} equalFunc The function to determine equivalents of values.
  4266. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  4267. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4268. */
  4269. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  4270. var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : _getTag_default(object), othTag = othIsArr ? arrayTag : _getTag_default(other);
  4271. objTag = objTag == argsTag ? objectTag : objTag;
  4272. othTag = othTag == argsTag ? objectTag : othTag;
  4273. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  4274. if (isSameTag && isBuffer(object)) {
  4275. if (!isBuffer(other)) return false;
  4276. objIsArr = true;
  4277. objIsObj = false;
  4278. }
  4279. if (isSameTag && !objIsObj) {
  4280. stack || (stack = new Stack());
  4281. return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  4282. }
  4283. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  4284. var objIsWrapped = objIsObj && hasOwnProperty$1.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__");
  4285. if (objIsWrapped || othIsWrapped) {
  4286. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  4287. stack || (stack = new Stack());
  4288. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  4289. }
  4290. }
  4291. if (!isSameTag) return false;
  4292. stack || (stack = new Stack());
  4293. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  4294. }
  4295. //#endregion
  4296. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js
  4297. /**
  4298. * The base implementation of `_.isEqual` which supports partial comparisons
  4299. * and tracks traversed objects.
  4300. *
  4301. * @private
  4302. * @param {*} value The value to compare.
  4303. * @param {*} other The other value to compare.
  4304. * @param {boolean} bitmask The bitmask flags.
  4305. * 1 - Unordered comparison
  4306. * 2 - Partial comparison
  4307. * @param {Function} [customizer] The function to customize comparisons.
  4308. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  4309. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  4310. */
  4311. function baseIsEqual(value, other, bitmask, customizer, stack) {
  4312. if (value === other) return true;
  4313. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) return value !== value && other !== other;
  4314. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  4315. }
  4316. //#endregion
  4317. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMatch.js
  4318. /** Used to compose bitmasks for value comparisons. */
  4319. var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
  4320. /**
  4321. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  4322. *
  4323. * @private
  4324. * @param {Object} object The object to inspect.
  4325. * @param {Object} source The object of property values to match.
  4326. * @param {Array} matchData The property names, values, and compare flags to match.
  4327. * @param {Function} [customizer] The function to customize comparisons.
  4328. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  4329. */
  4330. function baseIsMatch(object, source, matchData, customizer) {
  4331. var index = matchData.length, length = index, noCustomizer = !customizer;
  4332. if (object == null) return !length;
  4333. object = Object(object);
  4334. while (index--) {
  4335. var data = matchData[index];
  4336. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) return false;
  4337. }
  4338. while (++index < length) {
  4339. data = matchData[index];
  4340. var key = data[0], objValue = object[key], srcValue = data[1];
  4341. if (noCustomizer && data[2]) {
  4342. if (objValue === void 0 && !(key in object)) return false;
  4343. } else {
  4344. var stack = new Stack();
  4345. if (customizer) var result = customizer(objValue, srcValue, key, object, source, stack);
  4346. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) return false;
  4347. }
  4348. }
  4349. return true;
  4350. }
  4351. //#endregion
  4352. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isStrictComparable.js
  4353. /**
  4354. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  4355. *
  4356. * @private
  4357. * @param {*} value The value to check.
  4358. * @returns {boolean} Returns `true` if `value` if suitable for strict
  4359. * equality comparisons, else `false`.
  4360. */
  4361. function isStrictComparable(value) {
  4362. return value === value && !isObject(value);
  4363. }
  4364. //#endregion
  4365. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getMatchData.js
  4366. /**
  4367. * Gets the property names, values, and compare flags of `object`.
  4368. *
  4369. * @private
  4370. * @param {Object} object The object to query.
  4371. * @returns {Array} Returns the match data of `object`.
  4372. */
  4373. function getMatchData(object) {
  4374. var result = keys(object), length = result.length;
  4375. while (length--) {
  4376. var key = result[length], value = object[key];
  4377. result[length] = [
  4378. key,
  4379. value,
  4380. isStrictComparable(value)
  4381. ];
  4382. }
  4383. return result;
  4384. }
  4385. //#endregion
  4386. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_matchesStrictComparable.js
  4387. /**
  4388. * A specialized version of `matchesProperty` for source values suitable
  4389. * for strict equality comparisons, i.e. `===`.
  4390. *
  4391. * @private
  4392. * @param {string} key The key of the property to get.
  4393. * @param {*} srcValue The value to match.
  4394. * @returns {Function} Returns the new spec function.
  4395. */
  4396. function matchesStrictComparable(key, srcValue) {
  4397. return function(object) {
  4398. if (object == null) return false;
  4399. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  4400. };
  4401. }
  4402. //#endregion
  4403. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMatches.js
  4404. /**
  4405. * The base implementation of `_.matches` which doesn't clone `source`.
  4406. *
  4407. * @private
  4408. * @param {Object} source The object of property values to match.
  4409. * @returns {Function} Returns the new spec function.
  4410. */
  4411. function baseMatches(source) {
  4412. var matchData = getMatchData(source);
  4413. if (matchData.length == 1 && matchData[0][2]) return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  4414. return function(object) {
  4415. return object === source || baseIsMatch(object, source, matchData);
  4416. };
  4417. }
  4418. //#endregion
  4419. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseHasIn.js
  4420. /**
  4421. * The base implementation of `_.hasIn` without support for deep paths.
  4422. *
  4423. * @private
  4424. * @param {Object} [object] The object to query.
  4425. * @param {Array|string} key The key to check.
  4426. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4427. */
  4428. function baseHasIn(object, key) {
  4429. return object != null && key in Object(object);
  4430. }
  4431. //#endregion
  4432. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_hasPath.js
  4433. /**
  4434. * Checks if `path` exists on `object`.
  4435. *
  4436. * @private
  4437. * @param {Object} object The object to query.
  4438. * @param {Array|string} path The path to check.
  4439. * @param {Function} hasFunc The function to check properties.
  4440. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  4441. */
  4442. function hasPath(object, path, hasFunc) {
  4443. path = castPath(path, object);
  4444. var index = -1, length = path.length, result = false;
  4445. while (++index < length) {
  4446. var key = toKey(path[index]);
  4447. if (!(result = object != null && hasFunc(object, key))) break;
  4448. object = object[key];
  4449. }
  4450. if (result || ++index != length) return result;
  4451. length = object == null ? 0 : object.length;
  4452. return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
  4453. }
  4454. //#endregion
  4455. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/hasIn.js
  4456. /**
  4457. * Checks if `path` is a direct or inherited property of `object`.
  4458. *
  4459. * @static
  4460. * @memberOf _
  4461. * @since 4.0.0
  4462. * @category Object
  4463. * @param {Object} object The object to query.
  4464. * @param {Array|string} path The path to check.
  4465. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  4466. * @example
  4467. *
  4468. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  4469. *
  4470. * _.hasIn(object, 'a');
  4471. * // => true
  4472. *
  4473. * _.hasIn(object, 'a.b');
  4474. * // => true
  4475. *
  4476. * _.hasIn(object, ['a', 'b']);
  4477. * // => true
  4478. *
  4479. * _.hasIn(object, 'b');
  4480. * // => false
  4481. */
  4482. function hasIn(object, path) {
  4483. return object != null && hasPath(object, path, baseHasIn);
  4484. }
  4485. //#endregion
  4486. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMatchesProperty.js
  4487. /** Used to compose bitmasks for value comparisons. */
  4488. var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
  4489. /**
  4490. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  4491. *
  4492. * @private
  4493. * @param {string} path The path of the property to get.
  4494. * @param {*} srcValue The value to match.
  4495. * @returns {Function} Returns the new spec function.
  4496. */
  4497. function baseMatchesProperty(path, srcValue) {
  4498. if (isKey(path) && isStrictComparable(srcValue)) return matchesStrictComparable(toKey(path), srcValue);
  4499. return function(object) {
  4500. var objValue = get(object, path);
  4501. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  4502. };
  4503. }
  4504. //#endregion
  4505. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseProperty.js
  4506. /**
  4507. * The base implementation of `_.property` without support for deep paths.
  4508. *
  4509. * @private
  4510. * @param {string} key The key of the property to get.
  4511. * @returns {Function} Returns the new accessor function.
  4512. */
  4513. function baseProperty(key) {
  4514. return function(object) {
  4515. return object == null ? void 0 : object[key];
  4516. };
  4517. }
  4518. //#endregion
  4519. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_basePropertyDeep.js
  4520. /**
  4521. * A specialized version of `baseProperty` which supports deep paths.
  4522. *
  4523. * @private
  4524. * @param {Array|string} path The path of the property to get.
  4525. * @returns {Function} Returns the new accessor function.
  4526. */
  4527. function basePropertyDeep(path) {
  4528. return function(object) {
  4529. return baseGet(object, path);
  4530. };
  4531. }
  4532. //#endregion
  4533. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/property.js
  4534. /**
  4535. * Creates a function that returns the value at `path` of a given object.
  4536. *
  4537. * @static
  4538. * @memberOf _
  4539. * @since 2.4.0
  4540. * @category Util
  4541. * @param {Array|string} path The path of the property to get.
  4542. * @returns {Function} Returns the new accessor function.
  4543. * @example
  4544. *
  4545. * var objects = [
  4546. * { 'a': { 'b': 2 } },
  4547. * { 'a': { 'b': 1 } }
  4548. * ];
  4549. *
  4550. * _.map(objects, _.property('a.b'));
  4551. * // => [2, 1]
  4552. *
  4553. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  4554. * // => [1, 2]
  4555. */
  4556. function property(path) {
  4557. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  4558. }
  4559. //#endregion
  4560. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIteratee.js
  4561. /**
  4562. * The base implementation of `_.iteratee`.
  4563. *
  4564. * @private
  4565. * @param {*} [value=_.identity] The value to convert to an iteratee.
  4566. * @returns {Function} Returns the iteratee.
  4567. */
  4568. function baseIteratee(value) {
  4569. if (typeof value == "function") return value;
  4570. if (value == null) return identity;
  4571. if (typeof value == "object") return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  4572. return property(value);
  4573. }
  4574. //#endregion
  4575. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createBaseFor.js
  4576. /**
  4577. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  4578. *
  4579. * @private
  4580. * @param {boolean} [fromRight] Specify iterating from right to left.
  4581. * @returns {Function} Returns the new base function.
  4582. */
  4583. function createBaseFor(fromRight) {
  4584. return function(object, iteratee, keysFunc) {
  4585. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  4586. while (length--) {
  4587. var key = props[fromRight ? length : ++index];
  4588. if (iteratee(iterable[key], key, iterable) === false) break;
  4589. }
  4590. return object;
  4591. };
  4592. }
  4593. //#endregion
  4594. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseFor.js
  4595. /**
  4596. * The base implementation of `baseForOwn` which iterates over `object`
  4597. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  4598. * Iteratee functions may exit iteration early by explicitly returning `false`.
  4599. *
  4600. * @private
  4601. * @param {Object} object The object to iterate over.
  4602. * @param {Function} iteratee The function invoked per iteration.
  4603. * @param {Function} keysFunc The function to get the keys of `object`.
  4604. * @returns {Object} Returns `object`.
  4605. */
  4606. var baseFor = createBaseFor();
  4607. //#endregion
  4608. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseForOwn.js
  4609. /**
  4610. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  4611. *
  4612. * @private
  4613. * @param {Object} object The object to iterate over.
  4614. * @param {Function} iteratee The function invoked per iteration.
  4615. * @returns {Object} Returns `object`.
  4616. */
  4617. function baseForOwn(object, iteratee) {
  4618. return object && baseFor(object, iteratee, keys);
  4619. }
  4620. //#endregion
  4621. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createBaseEach.js
  4622. /**
  4623. * Creates a `baseEach` or `baseEachRight` function.
  4624. *
  4625. * @private
  4626. * @param {Function} eachFunc The function to iterate over a collection.
  4627. * @param {boolean} [fromRight] Specify iterating from right to left.
  4628. * @returns {Function} Returns the new base function.
  4629. */
  4630. function createBaseEach(eachFunc, fromRight) {
  4631. return function(collection, iteratee) {
  4632. if (collection == null) return collection;
  4633. if (!isArrayLike(collection)) return eachFunc(collection, iteratee);
  4634. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  4635. while (fromRight ? index-- : ++index < length) if (iteratee(iterable[index], index, iterable) === false) break;
  4636. return collection;
  4637. };
  4638. }
  4639. //#endregion
  4640. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseEach.js
  4641. /**
  4642. * The base implementation of `_.forEach` without support for iteratee shorthands.
  4643. *
  4644. * @private
  4645. * @param {Array|Object} collection The collection to iterate over.
  4646. * @param {Function} iteratee The function invoked per iteration.
  4647. * @returns {Array|Object} Returns `collection`.
  4648. */
  4649. var baseEach = createBaseEach(baseForOwn);
  4650. //#endregion
  4651. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/now.js
  4652. /**
  4653. * Gets the timestamp of the number of milliseconds that have elapsed since
  4654. * the Unix epoch (1 January 1970 00:00:00 UTC).
  4655. *
  4656. * @static
  4657. * @memberOf _
  4658. * @since 2.4.0
  4659. * @category Date
  4660. * @returns {number} Returns the timestamp.
  4661. * @example
  4662. *
  4663. * _.defer(function(stamp) {
  4664. * console.log(_.now() - stamp);
  4665. * }, _.now());
  4666. * // => Logs the number of milliseconds it took for the deferred invocation.
  4667. */
  4668. var now = function() {
  4669. return root.Date.now();
  4670. };
  4671. //#endregion
  4672. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/debounce.js
  4673. /** Error message constants. */
  4674. var FUNC_ERROR_TEXT$1 = "Expected a function";
  4675. var nativeMax$1 = Math.max, nativeMin$1 = Math.min;
  4676. /**
  4677. * Creates a debounced function that delays invoking `func` until after `wait`
  4678. * milliseconds have elapsed since the last time the debounced function was
  4679. * invoked. The debounced function comes with a `cancel` method to cancel
  4680. * delayed `func` invocations and a `flush` method to immediately invoke them.
  4681. * Provide `options` to indicate whether `func` should be invoked on the
  4682. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  4683. * with the last arguments provided to the debounced function. Subsequent
  4684. * calls to the debounced function return the result of the last `func`
  4685. * invocation.
  4686. *
  4687. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  4688. * invoked on the trailing edge of the timeout only if the debounced function
  4689. * is invoked more than once during the `wait` timeout.
  4690. *
  4691. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  4692. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  4693. *
  4694. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  4695. * for details over the differences between `_.debounce` and `_.throttle`.
  4696. *
  4697. * @static
  4698. * @memberOf _
  4699. * @since 0.1.0
  4700. * @category Function
  4701. * @param {Function} func The function to debounce.
  4702. * @param {number} [wait=0] The number of milliseconds to delay.
  4703. * @param {Object} [options={}] The options object.
  4704. * @param {boolean} [options.leading=false]
  4705. * Specify invoking on the leading edge of the timeout.
  4706. * @param {number} [options.maxWait]
  4707. * The maximum time `func` is allowed to be delayed before it's invoked.
  4708. * @param {boolean} [options.trailing=true]
  4709. * Specify invoking on the trailing edge of the timeout.
  4710. * @returns {Function} Returns the new debounced function.
  4711. * @example
  4712. *
  4713. * // Avoid costly calculations while the window size is in flux.
  4714. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  4715. *
  4716. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  4717. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  4718. * 'leading': true,
  4719. * 'trailing': false
  4720. * }));
  4721. *
  4722. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  4723. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  4724. * var source = new EventSource('/stream');
  4725. * jQuery(source).on('message', debounced);
  4726. *
  4727. * // Cancel the trailing debounced invocation.
  4728. * jQuery(window).on('popstate', debounced.cancel);
  4729. */
  4730. function debounce(func, wait, options) {
  4731. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  4732. if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT$1);
  4733. wait = toNumber(wait) || 0;
  4734. if (isObject(options)) {
  4735. leading = !!options.leading;
  4736. maxing = "maxWait" in options;
  4737. maxWait = maxing ? nativeMax$1(toNumber(options.maxWait) || 0, wait) : maxWait;
  4738. trailing = "trailing" in options ? !!options.trailing : trailing;
  4739. }
  4740. function invokeFunc(time) {
  4741. var args = lastArgs, thisArg = lastThis;
  4742. lastArgs = lastThis = void 0;
  4743. lastInvokeTime = time;
  4744. result = func.apply(thisArg, args);
  4745. return result;
  4746. }
  4747. function leadingEdge(time) {
  4748. lastInvokeTime = time;
  4749. timerId = setTimeout(timerExpired, wait);
  4750. return leading ? invokeFunc(time) : result;
  4751. }
  4752. function remainingWait(time) {
  4753. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  4754. return maxing ? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  4755. }
  4756. function shouldInvoke(time) {
  4757. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  4758. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  4759. }
  4760. function timerExpired() {
  4761. var time = now();
  4762. if (shouldInvoke(time)) return trailingEdge(time);
  4763. timerId = setTimeout(timerExpired, remainingWait(time));
  4764. }
  4765. function trailingEdge(time) {
  4766. timerId = void 0;
  4767. if (trailing && lastArgs) return invokeFunc(time);
  4768. lastArgs = lastThis = void 0;
  4769. return result;
  4770. }
  4771. function cancel() {
  4772. if (timerId !== void 0) clearTimeout(timerId);
  4773. lastInvokeTime = 0;
  4774. lastArgs = lastCallTime = lastThis = timerId = void 0;
  4775. }
  4776. function flush() {
  4777. return timerId === void 0 ? result : trailingEdge(now());
  4778. }
  4779. function debounced() {
  4780. var time = now(), isInvoking = shouldInvoke(time);
  4781. lastArgs = arguments;
  4782. lastThis = this;
  4783. lastCallTime = time;
  4784. if (isInvoking) {
  4785. if (timerId === void 0) return leadingEdge(lastCallTime);
  4786. if (maxing) {
  4787. clearTimeout(timerId);
  4788. timerId = setTimeout(timerExpired, wait);
  4789. return invokeFunc(lastCallTime);
  4790. }
  4791. }
  4792. if (timerId === void 0) timerId = setTimeout(timerExpired, wait);
  4793. return result;
  4794. }
  4795. debounced.cancel = cancel;
  4796. debounced.flush = flush;
  4797. return debounced;
  4798. }
  4799. //#endregion
  4800. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_assignMergeValue.js
  4801. /**
  4802. * This function is like `assignValue` except that it doesn't assign
  4803. * `undefined` values.
  4804. *
  4805. * @private
  4806. * @param {Object} object The object to modify.
  4807. * @param {string} key The key of the property to assign.
  4808. * @param {*} value The value to assign.
  4809. */
  4810. function assignMergeValue(object, key, value) {
  4811. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) baseAssignValue(object, key, value);
  4812. }
  4813. //#endregion
  4814. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArrayLikeObject.js
  4815. /**
  4816. * This method is like `_.isArrayLike` except that it also checks if `value`
  4817. * is an object.
  4818. *
  4819. * @static
  4820. * @memberOf _
  4821. * @since 4.0.0
  4822. * @category Lang
  4823. * @param {*} value The value to check.
  4824. * @returns {boolean} Returns `true` if `value` is an array-like object,
  4825. * else `false`.
  4826. * @example
  4827. *
  4828. * _.isArrayLikeObject([1, 2, 3]);
  4829. * // => true
  4830. *
  4831. * _.isArrayLikeObject(document.body.children);
  4832. * // => true
  4833. *
  4834. * _.isArrayLikeObject('abc');
  4835. * // => false
  4836. *
  4837. * _.isArrayLikeObject(_.noop);
  4838. * // => false
  4839. */
  4840. function isArrayLikeObject(value) {
  4841. return isObjectLike(value) && isArrayLike(value);
  4842. }
  4843. //#endregion
  4844. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_safeGet.js
  4845. /**
  4846. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  4847. *
  4848. * @private
  4849. * @param {Object} object The object to query.
  4850. * @param {string} key The key of the property to get.
  4851. * @returns {*} Returns the property value.
  4852. */
  4853. function safeGet(object, key) {
  4854. if (key === "constructor" && typeof object[key] === "function") return;
  4855. if (key == "__proto__") return;
  4856. return object[key];
  4857. }
  4858. //#endregion
  4859. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toPlainObject.js
  4860. /**
  4861. * Converts `value` to a plain object flattening inherited enumerable string
  4862. * keyed properties of `value` to own properties of the plain object.
  4863. *
  4864. * @static
  4865. * @memberOf _
  4866. * @since 3.0.0
  4867. * @category Lang
  4868. * @param {*} value The value to convert.
  4869. * @returns {Object} Returns the converted plain object.
  4870. * @example
  4871. *
  4872. * function Foo() {
  4873. * this.b = 2;
  4874. * }
  4875. *
  4876. * Foo.prototype.c = 3;
  4877. *
  4878. * _.assign({ 'a': 1 }, new Foo);
  4879. * // => { 'a': 1, 'b': 2 }
  4880. *
  4881. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  4882. * // => { 'a': 1, 'b': 2, 'c': 3 }
  4883. */
  4884. function toPlainObject(value) {
  4885. return copyObject(value, keysIn(value));
  4886. }
  4887. //#endregion
  4888. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMergeDeep.js
  4889. /**
  4890. * A specialized version of `baseMerge` for arrays and objects which performs
  4891. * deep merges and tracks traversed objects enabling objects with circular
  4892. * references to be merged.
  4893. *
  4894. * @private
  4895. * @param {Object} object The destination object.
  4896. * @param {Object} source The source object.
  4897. * @param {string} key The key of the value to merge.
  4898. * @param {number} srcIndex The index of `source`.
  4899. * @param {Function} mergeFunc The function to merge values.
  4900. * @param {Function} [customizer] The function to customize assigned values.
  4901. * @param {Object} [stack] Tracks traversed source values and their merged
  4902. * counterparts.
  4903. */
  4904. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  4905. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  4906. if (stacked) {
  4907. assignMergeValue(object, key, stacked);
  4908. return;
  4909. }
  4910. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  4911. var isCommon = newValue === void 0;
  4912. if (isCommon) {
  4913. var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  4914. newValue = srcValue;
  4915. if (isArr || isBuff || isTyped) if (isArray(objValue)) newValue = objValue;
  4916. else if (isArrayLikeObject(objValue)) newValue = copyArray(objValue);
  4917. else if (isBuff) {
  4918. isCommon = false;
  4919. newValue = cloneBuffer(srcValue, true);
  4920. } else if (isTyped) {
  4921. isCommon = false;
  4922. newValue = cloneTypedArray(srcValue, true);
  4923. } else newValue = [];
  4924. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  4925. newValue = objValue;
  4926. if (isArguments(objValue)) newValue = toPlainObject(objValue);
  4927. else if (!isObject(objValue) || isFunction(objValue)) newValue = initCloneObject(srcValue);
  4928. } else isCommon = false;
  4929. }
  4930. if (isCommon) {
  4931. stack.set(srcValue, newValue);
  4932. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  4933. stack["delete"](srcValue);
  4934. }
  4935. assignMergeValue(object, key, newValue);
  4936. }
  4937. //#endregion
  4938. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMerge.js
  4939. /**
  4940. * The base implementation of `_.merge` without support for multiple sources.
  4941. *
  4942. * @private
  4943. * @param {Object} object The destination object.
  4944. * @param {Object} source The source object.
  4945. * @param {number} srcIndex The index of `source`.
  4946. * @param {Function} [customizer] The function to customize merged values.
  4947. * @param {Object} [stack] Tracks traversed source values and their merged
  4948. * counterparts.
  4949. */
  4950. function baseMerge(object, source, srcIndex, customizer, stack) {
  4951. if (object === source) return;
  4952. baseFor(source, function(srcValue, key) {
  4953. stack || (stack = new Stack());
  4954. if (isObject(srcValue)) baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4955. else {
  4956. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  4957. if (newValue === void 0) newValue = srcValue;
  4958. assignMergeValue(object, key, newValue);
  4959. }
  4960. }, keysIn);
  4961. }
  4962. //#endregion
  4963. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludesWith.js
  4964. /**
  4965. * This function is like `arrayIncludes` except that it accepts a comparator.
  4966. *
  4967. * @private
  4968. * @param {Array} [array] The array to inspect.
  4969. * @param {*} target The value to search for.
  4970. * @param {Function} comparator The comparator invoked per element.
  4971. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  4972. */
  4973. function arrayIncludesWith(array, value, comparator) {
  4974. var index = -1, length = array == null ? 0 : array.length;
  4975. while (++index < length) if (comparator(value, array[index])) return true;
  4976. return false;
  4977. }
  4978. //#endregion
  4979. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/last.js
  4980. /**
  4981. * Gets the last element of `array`.
  4982. *
  4983. * @static
  4984. * @memberOf _
  4985. * @since 0.1.0
  4986. * @category Array
  4987. * @param {Array} array The array to query.
  4988. * @returns {*} Returns the last element of `array`.
  4989. * @example
  4990. *
  4991. * _.last([1, 2, 3]);
  4992. * // => 3
  4993. */
  4994. function last(array) {
  4995. var length = array == null ? 0 : array.length;
  4996. return length ? array[length - 1] : void 0;
  4997. }
  4998. //#endregion
  4999. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/findLastIndex.js
  5000. var nativeMax = Math.max, nativeMin = Math.min;
  5001. /**
  5002. * This method is like `_.findIndex` except that it iterates over elements
  5003. * of `collection` from right to left.
  5004. *
  5005. * @static
  5006. * @memberOf _
  5007. * @since 2.0.0
  5008. * @category Array
  5009. * @param {Array} array The array to inspect.
  5010. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  5011. * @param {number} [fromIndex=array.length-1] The index to search from.
  5012. * @returns {number} Returns the index of the found element, else `-1`.
  5013. * @example
  5014. *
  5015. * var users = [
  5016. * { 'user': 'barney', 'active': true },
  5017. * { 'user': 'fred', 'active': false },
  5018. * { 'user': 'pebbles', 'active': false }
  5019. * ];
  5020. *
  5021. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  5022. * // => 2
  5023. *
  5024. * // The `_.matches` iteratee shorthand.
  5025. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  5026. * // => 0
  5027. *
  5028. * // The `_.matchesProperty` iteratee shorthand.
  5029. * _.findLastIndex(users, ['active', false]);
  5030. * // => 2
  5031. *
  5032. * // The `_.property` iteratee shorthand.
  5033. * _.findLastIndex(users, 'active');
  5034. * // => 0
  5035. */
  5036. function findLastIndex(array, predicate, fromIndex) {
  5037. var length = array == null ? 0 : array.length;
  5038. if (!length) return -1;
  5039. var index = length - 1;
  5040. if (fromIndex !== void 0) {
  5041. index = toInteger(fromIndex);
  5042. index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  5043. }
  5044. return baseFindIndex(array, baseIteratee(predicate, 3), index, true);
  5045. }
  5046. //#endregion
  5047. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMap.js
  5048. /**
  5049. * The base implementation of `_.map` without support for iteratee shorthands.
  5050. *
  5051. * @private
  5052. * @param {Array|Object} collection The collection to iterate over.
  5053. * @param {Function} iteratee The function invoked per iteration.
  5054. * @returns {Array} Returns the new mapped array.
  5055. */
  5056. function baseMap(collection, iteratee) {
  5057. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  5058. baseEach(collection, function(value, key, collection) {
  5059. result[++index] = iteratee(value, key, collection);
  5060. });
  5061. return result;
  5062. }
  5063. //#endregion
  5064. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/map.js
  5065. /**
  5066. * Creates an array of values by running each element in `collection` thru
  5067. * `iteratee`. The iteratee is invoked with three arguments:
  5068. * (value, index|key, collection).
  5069. *
  5070. * Many lodash methods are guarded to work as iteratees for methods like
  5071. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  5072. *
  5073. * The guarded methods are:
  5074. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  5075. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  5076. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  5077. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  5078. *
  5079. * @static
  5080. * @memberOf _
  5081. * @since 0.1.0
  5082. * @category Collection
  5083. * @param {Array|Object} collection The collection to iterate over.
  5084. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  5085. * @returns {Array} Returns the new mapped array.
  5086. * @example
  5087. *
  5088. * function square(n) {
  5089. * return n * n;
  5090. * }
  5091. *
  5092. * _.map([4, 8], square);
  5093. * // => [16, 64]
  5094. *
  5095. * _.map({ 'a': 4, 'b': 8 }, square);
  5096. * // => [16, 64] (iteration order is not guaranteed)
  5097. *
  5098. * var users = [
  5099. * { 'user': 'barney' },
  5100. * { 'user': 'fred' }
  5101. * ];
  5102. *
  5103. * // The `_.property` iteratee shorthand.
  5104. * _.map(users, 'user');
  5105. * // => ['barney', 'fred']
  5106. */
  5107. function map(collection, iteratee) {
  5108. return (isArray(collection) ? arrayMap : baseMap)(collection, baseIteratee(iteratee, 3));
  5109. }
  5110. //#endregion
  5111. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/flatMap.js
  5112. /**
  5113. * Creates a flattened array of values by running each element in `collection`
  5114. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  5115. * with three arguments: (value, index|key, collection).
  5116. *
  5117. * @static
  5118. * @memberOf _
  5119. * @since 4.0.0
  5120. * @category Collection
  5121. * @param {Array|Object} collection The collection to iterate over.
  5122. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  5123. * @returns {Array} Returns the new flattened array.
  5124. * @example
  5125. *
  5126. * function duplicate(n) {
  5127. * return [n, n];
  5128. * }
  5129. *
  5130. * _.flatMap([1, 2], duplicate);
  5131. * // => [1, 1, 2, 2]
  5132. */
  5133. function flatMap(collection, iteratee) {
  5134. return baseFlatten(map(collection, iteratee), 1);
  5135. }
  5136. //#endregion
  5137. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/flattenDeep.js
  5138. /** Used as references for various `Number` constants. */
  5139. var INFINITY = Infinity;
  5140. /**
  5141. * Recursively flattens `array`.
  5142. *
  5143. * @static
  5144. * @memberOf _
  5145. * @since 3.0.0
  5146. * @category Array
  5147. * @param {Array} array The array to flatten.
  5148. * @returns {Array} Returns the new flattened array.
  5149. * @example
  5150. *
  5151. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  5152. * // => [1, 2, 3, 4, 5]
  5153. */
  5154. function flattenDeep(array) {
  5155. return (array == null ? 0 : array.length) ? baseFlatten(array, INFINITY) : [];
  5156. }
  5157. //#endregion
  5158. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/fromPairs.js
  5159. /**
  5160. * The inverse of `_.toPairs`; this method returns an object composed
  5161. * from key-value `pairs`.
  5162. *
  5163. * @static
  5164. * @memberOf _
  5165. * @since 4.0.0
  5166. * @category Array
  5167. * @param {Array} pairs The key-value pairs.
  5168. * @returns {Object} Returns the new object.
  5169. * @example
  5170. *
  5171. * _.fromPairs([['a', 1], ['b', 2]]);
  5172. * // => { 'a': 1, 'b': 2 }
  5173. */
  5174. function fromPairs(pairs) {
  5175. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  5176. while (++index < length) {
  5177. var pair = pairs[index];
  5178. result[pair[0]] = pair[1];
  5179. }
  5180. return result;
  5181. }
  5182. //#endregion
  5183. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_parent.js
  5184. /**
  5185. * Gets the parent value at `path` of `object`.
  5186. *
  5187. * @private
  5188. * @param {Object} object The object to query.
  5189. * @param {Array} path The path to get the parent value of.
  5190. * @returns {*} Returns the parent value.
  5191. */
  5192. function parent(object, path) {
  5193. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  5194. }
  5195. //#endregion
  5196. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js
  5197. /**
  5198. * Performs a deep comparison between two values to determine if they are
  5199. * equivalent.
  5200. *
  5201. * **Note:** This method supports comparing arrays, array buffers, booleans,
  5202. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  5203. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  5204. * by their own, not inherited, enumerable properties. Functions and DOM
  5205. * nodes are compared by strict equality, i.e. `===`.
  5206. *
  5207. * @static
  5208. * @memberOf _
  5209. * @since 0.1.0
  5210. * @category Lang
  5211. * @param {*} value The value to compare.
  5212. * @param {*} other The other value to compare.
  5213. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  5214. * @example
  5215. *
  5216. * var object = { 'a': 1 };
  5217. * var other = { 'a': 1 };
  5218. *
  5219. * _.isEqual(object, other);
  5220. * // => true
  5221. *
  5222. * object === other;
  5223. * // => false
  5224. */
  5225. function isEqual$1(value, other) {
  5226. return baseIsEqual(value, other);
  5227. }
  5228. //#endregion
  5229. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isNil.js
  5230. /**
  5231. * Checks if `value` is `null` or `undefined`.
  5232. *
  5233. * @static
  5234. * @memberOf _
  5235. * @since 4.0.0
  5236. * @category Lang
  5237. * @param {*} value The value to check.
  5238. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  5239. * @example
  5240. *
  5241. * _.isNil(null);
  5242. * // => true
  5243. *
  5244. * _.isNil(void 0);
  5245. * // => true
  5246. *
  5247. * _.isNil(NaN);
  5248. * // => false
  5249. */
  5250. function isNil(value) {
  5251. return value == null;
  5252. }
  5253. //#endregion
  5254. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isNull.js
  5255. /**
  5256. * Checks if `value` is `null`.
  5257. *
  5258. * @static
  5259. * @memberOf _
  5260. * @since 0.1.0
  5261. * @category Lang
  5262. * @param {*} value The value to check.
  5263. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  5264. * @example
  5265. *
  5266. * _.isNull(null);
  5267. * // => true
  5268. *
  5269. * _.isNull(void 0);
  5270. * // => false
  5271. */
  5272. function isNull(value) {
  5273. return value === null;
  5274. }
  5275. //#endregion
  5276. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isUndefined.js
  5277. /**
  5278. * Checks if `value` is `undefined`.
  5279. *
  5280. * @static
  5281. * @since 0.1.0
  5282. * @memberOf _
  5283. * @category Lang
  5284. * @param {*} value The value to check.
  5285. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  5286. * @example
  5287. *
  5288. * _.isUndefined(void 0);
  5289. * // => true
  5290. *
  5291. * _.isUndefined(null);
  5292. * // => false
  5293. */
  5294. function isUndefined$1(value) {
  5295. return value === void 0;
  5296. }
  5297. //#endregion
  5298. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/merge.js
  5299. /**
  5300. * This method is like `_.assign` except that it recursively merges own and
  5301. * inherited enumerable string keyed properties of source objects into the
  5302. * destination object. Source properties that resolve to `undefined` are
  5303. * skipped if a destination value exists. Array and plain object properties
  5304. * are merged recursively. Other objects and value types are overridden by
  5305. * assignment. Source objects are applied from left to right. Subsequent
  5306. * sources overwrite property assignments of previous sources.
  5307. *
  5308. * **Note:** This method mutates `object`.
  5309. *
  5310. * @static
  5311. * @memberOf _
  5312. * @since 0.5.0
  5313. * @category Object
  5314. * @param {Object} object The destination object.
  5315. * @param {...Object} [sources] The source objects.
  5316. * @returns {Object} Returns `object`.
  5317. * @example
  5318. *
  5319. * var object = {
  5320. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  5321. * };
  5322. *
  5323. * var other = {
  5324. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  5325. * };
  5326. *
  5327. * _.merge(object, other);
  5328. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  5329. */
  5330. var merge = createAssigner(function(object, source, srcIndex) {
  5331. baseMerge(object, source, srcIndex);
  5332. });
  5333. //#endregion
  5334. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseUnset.js
  5335. /** Used to check objects for own properties. */
  5336. var hasOwnProperty = Object.prototype.hasOwnProperty;
  5337. /**
  5338. * The base implementation of `_.unset`.
  5339. *
  5340. * @private
  5341. * @param {Object} object The object to modify.
  5342. * @param {Array|string} path The property path to unset.
  5343. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  5344. */
  5345. function baseUnset(object, path) {
  5346. path = castPath(path, object);
  5347. var index = -1, length = path.length;
  5348. if (!length) return true;
  5349. var isRootPrimitive = object == null || typeof object !== "object" && typeof object !== "function";
  5350. while (++index < length) {
  5351. var key = path[index];
  5352. if (typeof key !== "string") continue;
  5353. if (key === "__proto__" && !hasOwnProperty.call(object, "__proto__")) return false;
  5354. if (key === "constructor" && index + 1 < length && typeof path[index + 1] === "string" && path[index + 1] === "prototype") {
  5355. if (isRootPrimitive && index === 0) continue;
  5356. return false;
  5357. }
  5358. }
  5359. var obj = parent(object, path);
  5360. return obj == null || delete obj[toKey(last(path))];
  5361. }
  5362. //#endregion
  5363. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_customOmitClone.js
  5364. /**
  5365. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  5366. * objects.
  5367. *
  5368. * @private
  5369. * @param {*} value The value to inspect.
  5370. * @param {string} key The key of the property to inspect.
  5371. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  5372. */
  5373. function customOmitClone(value) {
  5374. return isPlainObject(value) ? void 0 : value;
  5375. }
  5376. //#endregion
  5377. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/omit.js
  5378. /** Used to compose bitmasks for cloning. */
  5379. var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
  5380. /**
  5381. * The opposite of `_.pick`; this method creates an object composed of the
  5382. * own and inherited enumerable property paths of `object` that are not omitted.
  5383. *
  5384. * **Note:** This method is considerably slower than `_.pick`.
  5385. *
  5386. * @static
  5387. * @since 0.1.0
  5388. * @memberOf _
  5389. * @category Object
  5390. * @param {Object} object The source object.
  5391. * @param {...(string|string[])} [paths] The property paths to omit.
  5392. * @returns {Object} Returns the new object.
  5393. * @example
  5394. *
  5395. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  5396. *
  5397. * _.omit(object, ['a', 'c']);
  5398. * // => { 'b': '2' }
  5399. */
  5400. var omit = flatRest(function(object, paths) {
  5401. var result = {};
  5402. if (object == null) return result;
  5403. var isDeep = false;
  5404. paths = arrayMap(paths, function(path) {
  5405. path = castPath(path, object);
  5406. isDeep || (isDeep = path.length > 1);
  5407. return path;
  5408. });
  5409. copyObject(object, getAllKeysIn(object), result);
  5410. if (isDeep) result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  5411. var length = paths.length;
  5412. while (length--) baseUnset(result, paths[length]);
  5413. return result;
  5414. });
  5415. //#endregion
  5416. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSet.js
  5417. /**
  5418. * The base implementation of `_.set`.
  5419. *
  5420. * @private
  5421. * @param {Object} object The object to modify.
  5422. * @param {Array|string} path The path of the property to set.
  5423. * @param {*} value The value to set.
  5424. * @param {Function} [customizer] The function to customize path creation.
  5425. * @returns {Object} Returns `object`.
  5426. */
  5427. function baseSet(object, path, value, customizer) {
  5428. if (!isObject(object)) return object;
  5429. path = castPath(path, object);
  5430. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  5431. while (nested != null && ++index < length) {
  5432. var key = toKey(path[index]), newValue = value;
  5433. if (key === "__proto__" || key === "constructor" || key === "prototype") return object;
  5434. if (index != lastIndex) {
  5435. var objValue = nested[key];
  5436. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  5437. if (newValue === void 0) newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  5438. }
  5439. assignValue(nested, key, newValue);
  5440. nested = nested[key];
  5441. }
  5442. return object;
  5443. }
  5444. //#endregion
  5445. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_basePickBy.js
  5446. /**
  5447. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  5448. *
  5449. * @private
  5450. * @param {Object} object The source object.
  5451. * @param {string[]} paths The property paths to pick.
  5452. * @param {Function} predicate The function invoked per property.
  5453. * @returns {Object} Returns the new object.
  5454. */
  5455. function basePickBy(object, paths, predicate) {
  5456. var index = -1, length = paths.length, result = {};
  5457. while (++index < length) {
  5458. var path = paths[index], value = baseGet(object, path);
  5459. if (predicate(value, path)) baseSet(result, castPath(path, object), value);
  5460. }
  5461. return result;
  5462. }
  5463. //#endregion
  5464. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_basePick.js
  5465. /**
  5466. * The base implementation of `_.pick` without support for individual
  5467. * property identifiers.
  5468. *
  5469. * @private
  5470. * @param {Object} object The source object.
  5471. * @param {string[]} paths The property paths to pick.
  5472. * @returns {Object} Returns the new object.
  5473. */
  5474. function basePick(object, paths) {
  5475. return basePickBy(object, paths, function(value, path) {
  5476. return hasIn(object, path);
  5477. });
  5478. }
  5479. //#endregion
  5480. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/pick.js
  5481. /**
  5482. * Creates an object composed of the picked `object` properties.
  5483. *
  5484. * @static
  5485. * @since 0.1.0
  5486. * @memberOf _
  5487. * @category Object
  5488. * @param {Object} object The source object.
  5489. * @param {...(string|string[])} [paths] The property paths to pick.
  5490. * @returns {Object} Returns the new object.
  5491. * @example
  5492. *
  5493. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  5494. *
  5495. * _.pick(object, ['a', 'c']);
  5496. * // => { 'a': 1, 'c': 3 }
  5497. */
  5498. var pick = flatRest(function(object, paths) {
  5499. return object == null ? {} : basePick(object, paths);
  5500. });
  5501. //#endregion
  5502. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/set.js
  5503. /**
  5504. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  5505. * it's created. Arrays are created for missing index properties while objects
  5506. * are created for all other missing properties. Use `_.setWith` to customize
  5507. * `path` creation.
  5508. *
  5509. * **Note:** This method mutates `object`.
  5510. *
  5511. * @static
  5512. * @memberOf _
  5513. * @since 3.7.0
  5514. * @category Object
  5515. * @param {Object} object The object to modify.
  5516. * @param {Array|string} path The path of the property to set.
  5517. * @param {*} value The value to set.
  5518. * @returns {Object} Returns `object`.
  5519. * @example
  5520. *
  5521. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  5522. *
  5523. * _.set(object, 'a[0].b.c', 4);
  5524. * console.log(object.a[0].b.c);
  5525. * // => 4
  5526. *
  5527. * _.set(object, ['x', '0', 'y', 'z'], 5);
  5528. * console.log(object.x[0].y.z);
  5529. * // => 5
  5530. */
  5531. function set(object, path, value) {
  5532. return object == null ? object : baseSet(object, path, value);
  5533. }
  5534. //#endregion
  5535. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/throttle.js
  5536. /** Error message constants. */
  5537. var FUNC_ERROR_TEXT = "Expected a function";
  5538. /**
  5539. * Creates a throttled function that only invokes `func` at most once per
  5540. * every `wait` milliseconds. The throttled function comes with a `cancel`
  5541. * method to cancel delayed `func` invocations and a `flush` method to
  5542. * immediately invoke them. Provide `options` to indicate whether `func`
  5543. * should be invoked on the leading and/or trailing edge of the `wait`
  5544. * timeout. The `func` is invoked with the last arguments provided to the
  5545. * throttled function. Subsequent calls to the throttled function return the
  5546. * result of the last `func` invocation.
  5547. *
  5548. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  5549. * invoked on the trailing edge of the timeout only if the throttled function
  5550. * is invoked more than once during the `wait` timeout.
  5551. *
  5552. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  5553. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  5554. *
  5555. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  5556. * for details over the differences between `_.throttle` and `_.debounce`.
  5557. *
  5558. * @static
  5559. * @memberOf _
  5560. * @since 0.1.0
  5561. * @category Function
  5562. * @param {Function} func The function to throttle.
  5563. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  5564. * @param {Object} [options={}] The options object.
  5565. * @param {boolean} [options.leading=true]
  5566. * Specify invoking on the leading edge of the timeout.
  5567. * @param {boolean} [options.trailing=true]
  5568. * Specify invoking on the trailing edge of the timeout.
  5569. * @returns {Function} Returns the new throttled function.
  5570. * @example
  5571. *
  5572. * // Avoid excessively updating the position while scrolling.
  5573. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  5574. *
  5575. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  5576. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  5577. * jQuery(element).on('click', throttled);
  5578. *
  5579. * // Cancel the trailing throttled invocation.
  5580. * jQuery(window).on('popstate', throttled.cancel);
  5581. */
  5582. function throttle(func, wait, options) {
  5583. var leading = true, trailing = true;
  5584. if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
  5585. if (isObject(options)) {
  5586. leading = "leading" in options ? !!options.leading : leading;
  5587. trailing = "trailing" in options ? !!options.trailing : trailing;
  5588. }
  5589. return debounce(func, wait, {
  5590. "leading": leading,
  5591. "maxWait": wait,
  5592. "trailing": trailing
  5593. });
  5594. }
  5595. //#endregion
  5596. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createSet.js
  5597. /**
  5598. * Creates a set object of `values`.
  5599. *
  5600. * @private
  5601. * @param {Array} values The values to add to the set.
  5602. * @returns {Object} Returns the new set.
  5603. */
  5604. var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == Infinity) ? noop : function(values) {
  5605. return new Set$1(values);
  5606. };
  5607. //#endregion
  5608. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseUniq.js
  5609. /** Used as the size to enable large array optimizations. */
  5610. var LARGE_ARRAY_SIZE = 200;
  5611. /**
  5612. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  5613. *
  5614. * @private
  5615. * @param {Array} array The array to inspect.
  5616. * @param {Function} [iteratee] The iteratee invoked per element.
  5617. * @param {Function} [comparator] The comparator invoked per element.
  5618. * @returns {Array} Returns the new duplicate free array.
  5619. */
  5620. function baseUniq(array, iteratee, comparator) {
  5621. var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
  5622. if (comparator) {
  5623. isCommon = false;
  5624. includes = arrayIncludesWith;
  5625. } else if (length >= LARGE_ARRAY_SIZE) {
  5626. var set = iteratee ? null : createSet(array);
  5627. if (set) return setToArray(set);
  5628. isCommon = false;
  5629. includes = cacheHas;
  5630. seen = new SetCache();
  5631. } else seen = iteratee ? [] : result;
  5632. outer: while (++index < length) {
  5633. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5634. value = comparator || value !== 0 ? value : 0;
  5635. if (isCommon && computed === computed) {
  5636. var seenIndex = seen.length;
  5637. while (seenIndex--) if (seen[seenIndex] === computed) continue outer;
  5638. if (iteratee) seen.push(computed);
  5639. result.push(value);
  5640. } else if (!includes(seen, computed, comparator)) {
  5641. if (seen !== result) seen.push(computed);
  5642. result.push(value);
  5643. }
  5644. }
  5645. return result;
  5646. }
  5647. //#endregion
  5648. //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/union.js
  5649. /**
  5650. * Creates an array of unique values, in order, from all given arrays using
  5651. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  5652. * for equality comparisons.
  5653. *
  5654. * @static
  5655. * @memberOf _
  5656. * @since 0.1.0
  5657. * @category Array
  5658. * @param {...Array} [arrays] The arrays to inspect.
  5659. * @returns {Array} Returns the new array of combined values.
  5660. * @example
  5661. *
  5662. * _.union([2], [1, 2]);
  5663. * // => [2, 1]
  5664. */
  5665. var union = baseRest(function(arrays) {
  5666. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  5667. });
  5668. //#endregion
  5669. //#region ../../packages/utils/types.ts
  5670. const isUndefined = (val) => val === void 0;
  5671. const isBoolean = (val) => typeof val === "boolean";
  5672. const isNumber = (val) => typeof val === "number";
  5673. const isEmpty = (val) => !val && val !== 0 || isArray$1(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  5674. const isElement$1 = (e) => {
  5675. if (typeof Element === "undefined") return false;
  5676. return e instanceof Element;
  5677. };
  5678. const isPropAbsent = (prop) => isNil(prop);
  5679. const isStringNumber = (val) => {
  5680. if (!isString(val)) return false;
  5681. return !Number.isNaN(Number(val));
  5682. };
  5683. const isWindow = (val) => val === window;
  5684. //#endregion
  5685. //#region ../../packages/utils/raf.ts
  5686. const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
  5687. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  5688. //#endregion
  5689. //#region ../../packages/utils/strings.ts
  5690. /**
  5691. * fork from {@link https://github.com/sindresorhus/escape-string-regexp}
  5692. */
  5693. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  5694. const capitalize = (str) => capitalize$1(str);
  5695. //#endregion
  5696. //#region ../../packages/utils/objects.ts
  5697. const keysOf = (arr) => Object.keys(arr);
  5698. const entriesOf = (arr) => Object.entries(arr);
  5699. const getProp = (obj, path, defaultValue) => {
  5700. return {
  5701. get value() {
  5702. return get(obj, path, defaultValue);
  5703. },
  5704. set value(val) {
  5705. set(obj, path, val);
  5706. }
  5707. };
  5708. };
  5709. //#endregion
  5710. //#region ../../packages/utils/error.ts
  5711. var ElementPlusError = class extends Error {
  5712. constructor(m) {
  5713. super(m);
  5714. this.name = "ElementPlusError";
  5715. }
  5716. };
  5717. function throwError(scope, m) {
  5718. throw new ElementPlusError(`[${scope}] ${m}`);
  5719. }
  5720. function debugWarn(scope, message) {}
  5721. //#endregion
  5722. //#region ../../packages/utils/dom/style.ts
  5723. const SCOPE$9 = "utils/dom/style";
  5724. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  5725. const hasClass = (el, cls) => {
  5726. if (!el || !cls) return false;
  5727. if (cls.includes(" ")) throw new Error("className should not contain space.");
  5728. return el.classList.contains(cls);
  5729. };
  5730. const addClass = (el, cls) => {
  5731. if (!el || !cls.trim()) return;
  5732. el.classList.add(...classNameToArray(cls));
  5733. };
  5734. const removeClass = (el, cls) => {
  5735. if (!el || !cls.trim()) return;
  5736. el.classList.remove(...classNameToArray(cls));
  5737. };
  5738. const getStyle = (element, styleName) => {
  5739. if (!isClient || !element || !styleName || isShadowRoot$1(element)) return "";
  5740. let key = camelize(styleName);
  5741. if (key === "float") key = "cssFloat";
  5742. try {
  5743. const style = element.style[key];
  5744. if (style) return style;
  5745. const computed = document.defaultView?.getComputedStyle(element, "");
  5746. return computed ? computed[key] : "";
  5747. } catch {
  5748. return element.style[key];
  5749. }
  5750. };
  5751. const setStyle = (element, styleName, value) => {
  5752. if (!element || !styleName) return;
  5753. if (isObject$1(styleName)) entriesOf(styleName).forEach(([prop, value]) => setStyle(element, prop, value));
  5754. else {
  5755. const key = camelize(styleName);
  5756. element.style[key] = value;
  5757. }
  5758. };
  5759. function addUnit(value, defaultUnit = "px") {
  5760. if (!value && value !== 0) return "";
  5761. if (isNumber(value) || isStringNumber(value)) return `${value}${defaultUnit}`;
  5762. else if (isString(value)) return value;
  5763. /* @__PURE__ */ debugWarn(SCOPE$9, "binding value must be a string or number");
  5764. }
  5765. //#endregion
  5766. //#region ../../packages/utils/dom/scroll.ts
  5767. const isScroll = (el, isVertical) => {
  5768. if (!isClient) return false;
  5769. const key = {
  5770. undefined: "overflow",
  5771. true: "overflow-y",
  5772. false: "overflow-x"
  5773. }[String(isVertical)];
  5774. const overflow = getStyle(el, key);
  5775. return [
  5776. "scroll",
  5777. "auto",
  5778. "overlay"
  5779. ].some((s) => overflow.includes(s));
  5780. };
  5781. const getScrollContainer = (el, isVertical) => {
  5782. if (!isClient) return;
  5783. let parent = el;
  5784. while (parent) {
  5785. if ([
  5786. window,
  5787. document,
  5788. document.documentElement
  5789. ].includes(parent)) return window;
  5790. if (isScroll(parent, isVertical)) return parent;
  5791. if (isShadowRoot$1(parent)) parent = parent.host;
  5792. else parent = parent.parentNode;
  5793. }
  5794. return parent;
  5795. };
  5796. let scrollBarWidth;
  5797. const getScrollBarWidth = (namespace) => {
  5798. if (!isClient) return 0;
  5799. if (scrollBarWidth !== void 0) return scrollBarWidth;
  5800. const outer = document.createElement("div");
  5801. outer.className = `${namespace}-scrollbar__wrap`;
  5802. outer.style.visibility = "hidden";
  5803. outer.style.width = "100px";
  5804. outer.style.position = "absolute";
  5805. outer.style.top = "-9999px";
  5806. document.body.appendChild(outer);
  5807. const widthNoScroll = outer.offsetWidth;
  5808. outer.style.overflow = "scroll";
  5809. const inner = document.createElement("div");
  5810. inner.style.width = "100%";
  5811. outer.appendChild(inner);
  5812. const widthWithScroll = inner.offsetWidth;
  5813. outer.parentNode?.removeChild(outer);
  5814. scrollBarWidth = widthNoScroll - widthWithScroll;
  5815. return scrollBarWidth;
  5816. };
  5817. /**
  5818. * Scroll with in the container element, positioning the **selected** element at the top
  5819. * of the container
  5820. */
  5821. function scrollIntoView(container, selected) {
  5822. if (!isClient) return;
  5823. if (!selected) {
  5824. container.scrollTop = 0;
  5825. return;
  5826. }
  5827. const offsetParents = [];
  5828. let pointer = selected.offsetParent;
  5829. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  5830. offsetParents.push(pointer);
  5831. pointer = pointer.offsetParent;
  5832. }
  5833. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  5834. const bottom = top + selected.offsetHeight;
  5835. const viewRectTop = container.scrollTop;
  5836. const viewRectBottom = viewRectTop + container.clientHeight;
  5837. if (top < viewRectTop) container.scrollTop = top;
  5838. else if (bottom > viewRectBottom) container.scrollTop = bottom - container.clientHeight;
  5839. }
  5840. function animateScrollTo(container, from, to, duration, callback) {
  5841. const startTime = Date.now();
  5842. let handle;
  5843. const scroll = () => {
  5844. const time = Date.now() - startTime;
  5845. const nextScrollTop = easeInOutCubic(time > duration ? duration : time, from, to, duration);
  5846. if (isWindow(container)) container.scrollTo(window.pageXOffset, nextScrollTop);
  5847. else container.scrollTop = nextScrollTop;
  5848. if (time < duration) handle = rAF(scroll);
  5849. else if (isFunction$1(callback)) callback();
  5850. };
  5851. scroll();
  5852. return () => {
  5853. handle && cAF(handle);
  5854. };
  5855. }
  5856. const getScrollElement = (target, container) => {
  5857. if (isWindow(container)) return target.ownerDocument.documentElement;
  5858. return container;
  5859. };
  5860. const getScrollTop = (container) => {
  5861. if (isWindow(container)) return window.scrollY;
  5862. return container.scrollTop;
  5863. };
  5864. //#endregion
  5865. //#region ../../packages/utils/dom/element.ts
  5866. const getElement = ((target) => {
  5867. if (!isClient || target === "") return null;
  5868. if (isString(target)) try {
  5869. return document.querySelector(target);
  5870. } catch {
  5871. return null;
  5872. }
  5873. return target;
  5874. });
  5875. //#endregion
  5876. //#region ../../packages/utils/vue/global-node.ts
  5877. const globalNodes = [];
  5878. let target = !isClient ? void 0 : document.body;
  5879. function createGlobalNode(id) {
  5880. const el = document.createElement("div");
  5881. if (id !== void 0) el.setAttribute("id", id);
  5882. if (target) {
  5883. target.appendChild(el);
  5884. globalNodes.push(el);
  5885. }
  5886. return el;
  5887. }
  5888. function removeGlobalNode(el) {
  5889. globalNodes.splice(globalNodes.indexOf(el), 1);
  5890. el.remove();
  5891. }
  5892. //#endregion
  5893. //#region ../../node_modules/.pnpm/@element-plus+icons-vue@2.3.2_vue@3.5.25_typescript@5.5.4_/node_modules/@element-plus/icons-vue/dist/index.js
  5894. var arrow_down_default = /* @__PURE__ */ defineComponent({
  5895. name: "ArrowDown",
  5896. __name: "arrow-down",
  5897. setup(__props) {
  5898. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  5899. xmlns: "http://www.w3.org/2000/svg",
  5900. viewBox: "0 0 1024 1024"
  5901. }, [createElementVNode("path", {
  5902. fill: "currentColor",
  5903. d: "M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 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.59 30.59 0 0 0-42.752 0z"
  5904. })]));
  5905. }
  5906. });
  5907. var arrow_left_default = /* @__PURE__ */ defineComponent({
  5908. name: "ArrowLeft",
  5909. __name: "arrow-left",
  5910. setup(__props) {
  5911. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  5912. xmlns: "http://www.w3.org/2000/svg",
  5913. viewBox: "0 0 1024 1024"
  5914. }, [createElementVNode("path", {
  5915. fill: "currentColor",
  5916. 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.59 30.59 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.59 30.59 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0"
  5917. })]));
  5918. }
  5919. });
  5920. var arrow_right_default = /* @__PURE__ */ defineComponent({
  5921. name: "ArrowRight",
  5922. __name: "arrow-right",
  5923. setup(__props) {
  5924. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  5925. xmlns: "http://www.w3.org/2000/svg",
  5926. viewBox: "0 0 1024 1024"
  5927. }, [createElementVNode("path", {
  5928. fill: "currentColor",
  5929. d: "M340.864 149.312a30.59 30.59 0 0 0 0 42.752L652.736 512 340.864 831.872a30.59 30.59 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"
  5930. })]));
  5931. }
  5932. });
  5933. var arrow_up_default = /* @__PURE__ */ defineComponent({
  5934. name: "ArrowUp",
  5935. __name: "arrow-up",
  5936. setup(__props) {
  5937. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  5938. xmlns: "http://www.w3.org/2000/svg",
  5939. viewBox: "0 0 1024 1024"
  5940. }, [createElementVNode("path", {
  5941. fill: "currentColor",
  5942. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"
  5943. })]));
  5944. }
  5945. });
  5946. var back_default = /* @__PURE__ */ defineComponent({
  5947. name: "Back",
  5948. __name: "back",
  5949. setup(__props) {
  5950. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  5951. xmlns: "http://www.w3.org/2000/svg",
  5952. viewBox: "0 0 1024 1024"
  5953. }, [createElementVNode("path", {
  5954. fill: "currentColor",
  5955. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64"
  5956. }), createElementVNode("path", {
  5957. fill: "currentColor",
  5958. d: "m237.248 512 265.408 265.344a32 32 0 0 1-45.312 45.312l-288-288a32 32 0 0 1 0-45.312l288-288a32 32 0 1 1 45.312 45.312z"
  5959. })]));
  5960. }
  5961. });
  5962. var calendar_default$1 = /* @__PURE__ */ defineComponent({
  5963. name: "Calendar",
  5964. __name: "calendar",
  5965. setup(__props) {
  5966. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  5967. xmlns: "http://www.w3.org/2000/svg",
  5968. viewBox: "0 0 1024 1024"
  5969. }, [createElementVNode("path", {
  5970. fill: "currentColor",
  5971. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64zm192-256h384V96a32 32 0 1 1 64 0v32h160a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h160V96a32 32 0 0 1 64 0zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64"
  5972. })]));
  5973. }
  5974. });
  5975. var caret_right_default = /* @__PURE__ */ defineComponent({
  5976. name: "CaretRight",
  5977. __name: "caret-right",
  5978. setup(__props) {
  5979. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  5980. xmlns: "http://www.w3.org/2000/svg",
  5981. viewBox: "0 0 1024 1024"
  5982. }, [createElementVNode("path", {
  5983. fill: "currentColor",
  5984. d: "M384 192v640l384-320.064z"
  5985. })]));
  5986. }
  5987. });
  5988. var caret_top_default = /* @__PURE__ */ defineComponent({
  5989. name: "CaretTop",
  5990. __name: "caret-top",
  5991. setup(__props) {
  5992. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  5993. xmlns: "http://www.w3.org/2000/svg",
  5994. viewBox: "0 0 1024 1024"
  5995. }, [createElementVNode("path", {
  5996. fill: "currentColor",
  5997. d: "M512 320 192 704h639.936z"
  5998. })]));
  5999. }
  6000. });
  6001. var check_default = /* @__PURE__ */ defineComponent({
  6002. name: "Check",
  6003. __name: "check",
  6004. setup(__props) {
  6005. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6006. xmlns: "http://www.w3.org/2000/svg",
  6007. viewBox: "0 0 1024 1024"
  6008. }, [createElementVNode("path", {
  6009. fill: "currentColor",
  6010. 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"
  6011. })]));
  6012. }
  6013. });
  6014. var circle_check_filled_default = /* @__PURE__ */ defineComponent({
  6015. name: "CircleCheckFilled",
  6016. __name: "circle-check-filled",
  6017. setup(__props) {
  6018. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6019. xmlns: "http://www.w3.org/2000/svg",
  6020. viewBox: "0 0 1024 1024"
  6021. }, [createElementVNode("path", {
  6022. fill: "currentColor",
  6023. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  6024. })]));
  6025. }
  6026. });
  6027. var circle_check_default = /* @__PURE__ */ defineComponent({
  6028. name: "CircleCheck",
  6029. __name: "circle-check",
  6030. setup(__props) {
  6031. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6032. xmlns: "http://www.w3.org/2000/svg",
  6033. viewBox: "0 0 1024 1024"
  6034. }, [createElementVNode("path", {
  6035. fill: "currentColor",
  6036. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  6037. }), createElementVNode("path", {
  6038. fill: "currentColor",
  6039. 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.752z"
  6040. })]));
  6041. }
  6042. });
  6043. var circle_close_filled_default = /* @__PURE__ */ defineComponent({
  6044. name: "CircleCloseFilled",
  6045. __name: "circle-close-filled",
  6046. setup(__props) {
  6047. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6048. xmlns: "http://www.w3.org/2000/svg",
  6049. viewBox: "0 0 1024 1024"
  6050. }, [createElementVNode("path", {
  6051. fill: "currentColor",
  6052. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"
  6053. })]));
  6054. }
  6055. });
  6056. var circle_close_default = /* @__PURE__ */ defineComponent({
  6057. name: "CircleClose",
  6058. __name: "circle-close",
  6059. setup(__props) {
  6060. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6061. xmlns: "http://www.w3.org/2000/svg",
  6062. viewBox: "0 0 1024 1024"
  6063. }, [createElementVNode("path", {
  6064. fill: "currentColor",
  6065. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"
  6066. }), createElementVNode("path", {
  6067. fill: "currentColor",
  6068. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  6069. })]));
  6070. }
  6071. });
  6072. var clock_default = /* @__PURE__ */ defineComponent({
  6073. name: "Clock",
  6074. __name: "clock",
  6075. setup(__props) {
  6076. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6077. xmlns: "http://www.w3.org/2000/svg",
  6078. viewBox: "0 0 1024 1024"
  6079. }, [
  6080. createElementVNode("path", {
  6081. fill: "currentColor",
  6082. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  6083. }),
  6084. createElementVNode("path", {
  6085. fill: "currentColor",
  6086. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
  6087. }),
  6088. createElementVNode("path", {
  6089. fill: "currentColor",
  6090. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32"
  6091. })
  6092. ]));
  6093. }
  6094. });
  6095. var close_default = /* @__PURE__ */ defineComponent({
  6096. name: "Close",
  6097. __name: "close",
  6098. setup(__props) {
  6099. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6100. xmlns: "http://www.w3.org/2000/svg",
  6101. viewBox: "0 0 1024 1024"
  6102. }, [createElementVNode("path", {
  6103. fill: "currentColor",
  6104. 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"
  6105. })]));
  6106. }
  6107. });
  6108. var d_arrow_left_default = /* @__PURE__ */ defineComponent({
  6109. name: "DArrowLeft",
  6110. __name: "d-arrow-left",
  6111. setup(__props) {
  6112. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6113. xmlns: "http://www.w3.org/2000/svg",
  6114. viewBox: "0 0 1024 1024"
  6115. }, [createElementVNode("path", {
  6116. fill: "currentColor",
  6117. d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.59 30.59 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.59 30.59 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.672zm256 0a29.12 29.12 0 0 1 41.728 0 30.59 30.59 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.59 30.59 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.672z"
  6118. })]));
  6119. }
  6120. });
  6121. var d_arrow_right_default = /* @__PURE__ */ defineComponent({
  6122. name: "DArrowRight",
  6123. __name: "d-arrow-right",
  6124. setup(__props) {
  6125. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6126. xmlns: "http://www.w3.org/2000/svg",
  6127. viewBox: "0 0 1024 1024"
  6128. }, [createElementVNode("path", {
  6129. fill: "currentColor",
  6130. 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.59 30.59 0 0 1 0-42.752L764.736 512 452.864 192a30.59 30.59 0 0 1 0-42.688m-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.59 30.59 0 0 1 0-42.752L508.736 512 196.864 192a30.59 30.59 0 0 1 0-42.688"
  6131. })]));
  6132. }
  6133. });
  6134. var delete_default = /* @__PURE__ */ defineComponent({
  6135. name: "Delete",
  6136. __name: "delete",
  6137. setup(__props) {
  6138. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6139. xmlns: "http://www.w3.org/2000/svg",
  6140. viewBox: "0 0 1024 1024"
  6141. }, [createElementVNode("path", {
  6142. fill: "currentColor",
  6143. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
  6144. })]));
  6145. }
  6146. });
  6147. var document_default = /* @__PURE__ */ defineComponent({
  6148. name: "Document",
  6149. __name: "document",
  6150. setup(__props) {
  6151. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6152. xmlns: "http://www.w3.org/2000/svg",
  6153. viewBox: "0 0 1024 1024"
  6154. }, [createElementVNode("path", {
  6155. fill: "currentColor",
  6156. d: "M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"
  6157. })]));
  6158. }
  6159. });
  6160. var full_screen_default = /* @__PURE__ */ defineComponent({
  6161. name: "FullScreen",
  6162. __name: "full-screen",
  6163. setup(__props) {
  6164. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6165. xmlns: "http://www.w3.org/2000/svg",
  6166. viewBox: "0 0 1024 1024"
  6167. }, [createElementVNode("path", {
  6168. fill: "currentColor",
  6169. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"
  6170. })]));
  6171. }
  6172. });
  6173. var hide_default = /* @__PURE__ */ defineComponent({
  6174. name: "Hide",
  6175. __name: "hide",
  6176. setup(__props) {
  6177. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6178. xmlns: "http://www.w3.org/2000/svg",
  6179. viewBox: "0 0 1024 1024"
  6180. }, [createElementVNode("path", {
  6181. fill: "currentColor",
  6182. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4s-12.8-9.6-22.4-9.6-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 176S0 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.4s3.2 16 9.6 22.4 12.8 9.6 22.4 9.6 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4m-646.4 528Q115.2 579.2 76.8 512q43.2-72 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.4m140.8-96Q352 555.2 352 512c0-44.8 16-83.2 48-112s67.2-48 112-48c28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6q-43.2 72-153.6 172.8c-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-176S1024 528 1024 512s-48.001-73.6-134.401-176"
  6183. }), createElementVNode("path", {
  6184. fill: "currentColor",
  6185. 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 112s-67.2 48-112 48"
  6186. })]));
  6187. }
  6188. });
  6189. var info_filled_default = /* @__PURE__ */ defineComponent({
  6190. name: "InfoFilled",
  6191. __name: "info-filled",
  6192. setup(__props) {
  6193. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6194. xmlns: "http://www.w3.org/2000/svg",
  6195. viewBox: "0 0 1024 1024"
  6196. }, [createElementVNode("path", {
  6197. fill: "currentColor",
  6198. d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.99 12.99 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"
  6199. })]));
  6200. }
  6201. });
  6202. var loading_default = /* @__PURE__ */ defineComponent({
  6203. name: "Loading",
  6204. __name: "loading",
  6205. setup(__props) {
  6206. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6207. xmlns: "http://www.w3.org/2000/svg",
  6208. viewBox: "0 0 1024 1024"
  6209. }, [createElementVNode("path", {
  6210. fill: "currentColor",
  6211. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.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.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"
  6212. })]));
  6213. }
  6214. });
  6215. var minus_default = /* @__PURE__ */ defineComponent({
  6216. name: "Minus",
  6217. __name: "minus",
  6218. setup(__props) {
  6219. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6220. xmlns: "http://www.w3.org/2000/svg",
  6221. viewBox: "0 0 1024 1024"
  6222. }, [createElementVNode("path", {
  6223. fill: "currentColor",
  6224. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
  6225. })]));
  6226. }
  6227. });
  6228. var more_filled_default = /* @__PURE__ */ defineComponent({
  6229. name: "MoreFilled",
  6230. __name: "more-filled",
  6231. setup(__props) {
  6232. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6233. xmlns: "http://www.w3.org/2000/svg",
  6234. viewBox: "0 0 1024 1024"
  6235. }, [createElementVNode("path", {
  6236. fill: "currentColor",
  6237. d: "M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224"
  6238. })]));
  6239. }
  6240. });
  6241. var more_default = /* @__PURE__ */ defineComponent({
  6242. name: "More",
  6243. __name: "more",
  6244. setup(__props) {
  6245. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6246. xmlns: "http://www.w3.org/2000/svg",
  6247. viewBox: "0 0 1024 1024"
  6248. }, [createElementVNode("path", {
  6249. fill: "currentColor",
  6250. d: "M176 416a112 112 0 1 0 0 224 112 112 0 0 0 0-224m0 64a48 48 0 1 1 0 96 48 48 0 0 1 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96"
  6251. })]));
  6252. }
  6253. });
  6254. var picture_filled_default = /* @__PURE__ */ defineComponent({
  6255. name: "PictureFilled",
  6256. __name: "picture-filled",
  6257. setup(__props) {
  6258. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6259. xmlns: "http://www.w3.org/2000/svg",
  6260. viewBox: "0 0 1024 1024"
  6261. }, [createElementVNode("path", {
  6262. fill: "currentColor",
  6263. d: "M96 896a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h832a32 32 0 0 1 32 32v704a32 32 0 0 1-32 32zm315.52-228.48-68.928-68.928a32 32 0 0 0-45.248 0L128 768.064h778.688l-242.112-290.56a32 32 0 0 0-49.216 0L458.752 665.408a32 32 0 0 1-47.232 2.112M256 384a96 96 0 1 0 192.064-.064A96 96 0 0 0 256 384"
  6264. })]));
  6265. }
  6266. });
  6267. var plus_default = /* @__PURE__ */ defineComponent({
  6268. name: "Plus",
  6269. __name: "plus",
  6270. setup(__props) {
  6271. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6272. xmlns: "http://www.w3.org/2000/svg",
  6273. viewBox: "0 0 1024 1024"
  6274. }, [createElementVNode("path", {
  6275. fill: "currentColor",
  6276. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
  6277. })]));
  6278. }
  6279. });
  6280. var question_filled_default = /* @__PURE__ */ defineComponent({
  6281. name: "QuestionFilled",
  6282. __name: "question-filled",
  6283. setup(__props) {
  6284. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6285. xmlns: "http://www.w3.org/2000/svg",
  6286. viewBox: "0 0 1024 1024"
  6287. }, [createElementVNode("path", {
  6288. fill: "currentColor",
  6289. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 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.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"
  6290. })]));
  6291. }
  6292. });
  6293. var refresh_left_default = /* @__PURE__ */ defineComponent({
  6294. name: "RefreshLeft",
  6295. __name: "refresh-left",
  6296. setup(__props) {
  6297. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6298. xmlns: "http://www.w3.org/2000/svg",
  6299. viewBox: "0 0 1024 1024"
  6300. }, [createElementVNode("path", {
  6301. fill: "currentColor",
  6302. 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"
  6303. })]));
  6304. }
  6305. });
  6306. var refresh_right_default = /* @__PURE__ */ defineComponent({
  6307. name: "RefreshRight",
  6308. __name: "refresh-right",
  6309. setup(__props) {
  6310. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6311. xmlns: "http://www.w3.org/2000/svg",
  6312. viewBox: "0 0 1024 1024"
  6313. }, [createElementVNode("path", {
  6314. fill: "currentColor",
  6315. 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.88"
  6316. })]));
  6317. }
  6318. });
  6319. var scale_to_original_default = /* @__PURE__ */ defineComponent({
  6320. name: "ScaleToOriginal",
  6321. __name: "scale-to-original",
  6322. setup(__props) {
  6323. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6324. xmlns: "http://www.w3.org/2000/svg",
  6325. viewBox: "0 0 1024 1024"
  6326. }, [createElementVNode("path", {
  6327. fill: "currentColor",
  6328. 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.12 30.12 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.12 30.12 0 0 0-30.118-30.118m-361.412 0a30.12 30.12 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.12 30.12 0 0 0-30.118-30.118M512 361.412a30.12 30.12 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.12 30.12 0 0 0 512 361.412M512 512a30.12 30.12 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.12 30.12 0 0 0 512 512"
  6329. })]));
  6330. }
  6331. });
  6332. var search_default = /* @__PURE__ */ defineComponent({
  6333. name: "Search",
  6334. __name: "search",
  6335. setup(__props) {
  6336. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6337. xmlns: "http://www.w3.org/2000/svg",
  6338. viewBox: "0 0 1024 1024"
  6339. }, [createElementVNode("path", {
  6340. fill: "currentColor",
  6341. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"
  6342. })]));
  6343. }
  6344. });
  6345. var sort_down_default = /* @__PURE__ */ defineComponent({
  6346. name: "SortDown",
  6347. __name: "sort-down",
  6348. setup(__props) {
  6349. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6350. xmlns: "http://www.w3.org/2000/svg",
  6351. viewBox: "0 0 1024 1024"
  6352. }, [createElementVNode("path", {
  6353. fill: "currentColor",
  6354. d: "M576 96v709.568L333.312 562.816A32 32 0 1 0 288 608l297.408 297.344A32 32 0 0 0 640 882.688V96a32 32 0 0 0-64 0"
  6355. })]));
  6356. }
  6357. });
  6358. var sort_up_default = /* @__PURE__ */ defineComponent({
  6359. name: "SortUp",
  6360. __name: "sort-up",
  6361. setup(__props) {
  6362. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6363. xmlns: "http://www.w3.org/2000/svg",
  6364. viewBox: "0 0 1024 1024"
  6365. }, [createElementVNode("path", {
  6366. fill: "currentColor",
  6367. d: "M384 141.248V928a32 32 0 1 0 64 0V218.56l242.688 242.688A32 32 0 1 0 736 416L438.592 118.656A32 32 0 0 0 384 141.248"
  6368. })]));
  6369. }
  6370. });
  6371. var star_filled_default = /* @__PURE__ */ defineComponent({
  6372. name: "StarFilled",
  6373. __name: "star-filled",
  6374. setup(__props) {
  6375. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6376. xmlns: "http://www.w3.org/2000/svg",
  6377. viewBox: "0 0 1024 1024"
  6378. }, [createElementVNode("path", {
  6379. fill: "currentColor",
  6380. d: "M313.6 924.48a70.4 70.4 0 0 1-74.152-5.365 70.4 70.4 0 0 1-27.992-68.875l37.888-220.928L88.96 472.96a70.4 70.4 0 0 1 3.788-104.225A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 100.246-28.595 70.4 70.4 0 0 1 25.962 28.595l99.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"
  6381. })]));
  6382. }
  6383. });
  6384. var star_default = /* @__PURE__ */ defineComponent({
  6385. name: "Star",
  6386. __name: "star",
  6387. setup(__props) {
  6388. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6389. xmlns: "http://www.w3.org/2000/svg",
  6390. viewBox: "0 0 1024 1024"
  6391. }, [createElementVNode("path", {
  6392. fill: "currentColor",
  6393. d: "m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"
  6394. })]));
  6395. }
  6396. });
  6397. var success_filled_default = /* @__PURE__ */ defineComponent({
  6398. name: "SuccessFilled",
  6399. __name: "success-filled",
  6400. setup(__props) {
  6401. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6402. xmlns: "http://www.w3.org/2000/svg",
  6403. viewBox: "0 0 1024 1024"
  6404. }, [createElementVNode("path", {
  6405. fill: "currentColor",
  6406. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  6407. })]));
  6408. }
  6409. });
  6410. var view_default = /* @__PURE__ */ defineComponent({
  6411. name: "View",
  6412. __name: "view",
  6413. setup(__props) {
  6414. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6415. xmlns: "http://www.w3.org/2000/svg",
  6416. viewBox: "0 0 1024 1024"
  6417. }, [createElementVNode("path", {
  6418. fill: "currentColor",
  6419. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"
  6420. })]));
  6421. }
  6422. });
  6423. var warning_filled_default = /* @__PURE__ */ defineComponent({
  6424. name: "WarningFilled",
  6425. __name: "warning-filled",
  6426. setup(__props) {
  6427. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6428. xmlns: "http://www.w3.org/2000/svg",
  6429. viewBox: "0 0 1024 1024"
  6430. }, [createElementVNode("path", {
  6431. fill: "currentColor",
  6432. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.43 58.43 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.43 58.43 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
  6433. })]));
  6434. }
  6435. });
  6436. var zoom_in_default = /* @__PURE__ */ defineComponent({
  6437. name: "ZoomIn",
  6438. __name: "zoom-in",
  6439. setup(__props) {
  6440. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6441. xmlns: "http://www.w3.org/2000/svg",
  6442. viewBox: "0 0 1024 1024"
  6443. }, [createElementVNode("path", {
  6444. fill: "currentColor",
  6445. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"
  6446. })]));
  6447. }
  6448. });
  6449. var zoom_out_default = /* @__PURE__ */ defineComponent({
  6450. name: "ZoomOut",
  6451. __name: "zoom-out",
  6452. setup(__props) {
  6453. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  6454. xmlns: "http://www.w3.org/2000/svg",
  6455. viewBox: "0 0 1024 1024"
  6456. }, [createElementVNode("path", {
  6457. fill: "currentColor",
  6458. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"
  6459. })]));
  6460. }
  6461. });
  6462. //#endregion
  6463. //#region ../../packages/utils/vue/props/runtime.ts
  6464. const epPropKey = "__epPropKey";
  6465. const definePropType = (val) => val;
  6466. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  6467. /**
  6468. * @description Build prop. It can better optimize prop types
  6469. * @description 生成 prop,能更好地优化类型
  6470. * @example
  6471. // limited options
  6472. // the type will be PropType<'light' | 'dark'>
  6473. buildProp({
  6474. type: String,
  6475. values: ['light', 'dark'],
  6476. } as const)
  6477. * @example
  6478. // limited options and other types
  6479. // the type will be PropType<'small' | 'large' | number>
  6480. buildProp({
  6481. type: [String, Number],
  6482. values: ['small', 'large'],
  6483. validator: (val: unknown): val is number => typeof val === 'number',
  6484. } as const)
  6485. @link see more: https://github.com/element-plus/element-plus/pull/3341
  6486. */
  6487. const buildProp = (prop, key) => {
  6488. if (!isObject$1(prop) || isEpProp(prop)) return prop;
  6489. const { values, required, default: defaultValue, type, validator } = prop;
  6490. const epProp = {
  6491. type,
  6492. required: !!required,
  6493. validator: values || validator ? (val) => {
  6494. let valid = false;
  6495. let allowedValues = [];
  6496. if (values) {
  6497. allowedValues = Array.from(values);
  6498. if (hasOwn(prop, "default")) allowedValues.push(defaultValue);
  6499. valid ||= allowedValues.includes(val);
  6500. }
  6501. if (validator) valid ||= validator(val);
  6502. if (!valid && allowedValues.length > 0) {
  6503. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  6504. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  6505. }
  6506. return valid;
  6507. } : void 0,
  6508. [epPropKey]: true
  6509. };
  6510. if (hasOwn(prop, "default")) epProp.default = defaultValue;
  6511. return epProp;
  6512. };
  6513. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [key, buildProp(option, key)]));
  6514. //#endregion
  6515. //#region ../../packages/utils/vue/icon.ts
  6516. const iconPropType = definePropType([
  6517. String,
  6518. Object,
  6519. Function
  6520. ]);
  6521. const CloseComponents = { Close: close_default };
  6522. const TypeComponents = {
  6523. Close: close_default,
  6524. SuccessFilled: success_filled_default,
  6525. InfoFilled: info_filled_default,
  6526. WarningFilled: warning_filled_default,
  6527. CircleCloseFilled: circle_close_filled_default
  6528. };
  6529. const TypeComponentsMap = {
  6530. primary: info_filled_default,
  6531. success: success_filled_default,
  6532. warning: warning_filled_default,
  6533. error: circle_close_filled_default,
  6534. info: info_filled_default
  6535. };
  6536. const ValidateComponentsMap = {
  6537. validating: loading_default,
  6538. success: circle_check_default,
  6539. error: circle_close_default
  6540. };
  6541. //#endregion
  6542. //#region ../../packages/utils/vue/install.ts
  6543. const withPropsDefaultsSetter = (target) => {
  6544. const _p = target.props;
  6545. const props = isArray$1(_p) ? fromPairs(_p.map((key) => [key, {}])) : _p;
  6546. target.setPropsDefaults = (defaults) => {
  6547. if (!props) return;
  6548. for (const [key, value] of Object.entries(defaults)) {
  6549. const prop = props[key];
  6550. if (!hasOwn(props, key)) continue;
  6551. if (isPlainObject(prop)) {
  6552. props[key] = {
  6553. ...prop,
  6554. default: value
  6555. };
  6556. continue;
  6557. }
  6558. props[key] = {
  6559. type: prop,
  6560. default: value
  6561. };
  6562. }
  6563. target.props = props;
  6564. };
  6565. };
  6566. const withInstall = (main, extra) => {
  6567. main.install = (app) => {
  6568. for (const comp of [main, ...Object.values(extra ?? {})]) app.component(comp.name, comp);
  6569. };
  6570. if (extra) for (const [key, comp] of Object.entries(extra)) main[key] = comp;
  6571. withPropsDefaultsSetter(main);
  6572. return main;
  6573. };
  6574. const withInstallFunction = (fn, name) => {
  6575. fn.install = (app) => {
  6576. fn._context = app._context;
  6577. app.config.globalProperties[name] = fn;
  6578. };
  6579. return fn;
  6580. };
  6581. const withInstallDirective = (directive, name) => {
  6582. directive.install = (app) => {
  6583. app.directive(name, directive);
  6584. };
  6585. return directive;
  6586. };
  6587. const withNoopInstall = (component) => {
  6588. component.install = NOOP;
  6589. withPropsDefaultsSetter(component);
  6590. return component;
  6591. };
  6592. //#endregion
  6593. //#region ../../packages/utils/vue/refs.ts
  6594. const composeRefs = (...refs) => {
  6595. return (el) => {
  6596. refs.forEach((ref) => {
  6597. ref.value = el;
  6598. });
  6599. };
  6600. };
  6601. //#endregion
  6602. //#region ../../packages/utils/vue/validator.ts
  6603. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  6604. //#endregion
  6605. //#region ../../packages/utils/vue/vnode.ts
  6606. const SCOPE$8 = "utils/vue/vnode";
  6607. let PatchFlags = /* @__PURE__ */ function(PatchFlags) {
  6608. PatchFlags[PatchFlags["TEXT"] = 1] = "TEXT";
  6609. PatchFlags[PatchFlags["CLASS"] = 2] = "CLASS";
  6610. PatchFlags[PatchFlags["STYLE"] = 4] = "STYLE";
  6611. PatchFlags[PatchFlags["PROPS"] = 8] = "PROPS";
  6612. PatchFlags[PatchFlags["FULL_PROPS"] = 16] = "FULL_PROPS";
  6613. PatchFlags[PatchFlags["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  6614. PatchFlags[PatchFlags["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  6615. PatchFlags[PatchFlags["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  6616. PatchFlags[PatchFlags["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  6617. PatchFlags[PatchFlags["NEED_PATCH"] = 512] = "NEED_PATCH";
  6618. PatchFlags[PatchFlags["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  6619. PatchFlags[PatchFlags["HOISTED"] = -1] = "HOISTED";
  6620. PatchFlags[PatchFlags["BAIL"] = -2] = "BAIL";
  6621. return PatchFlags;
  6622. }({});
  6623. function isFragment(node) {
  6624. return isVNode(node) && node.type === Fragment;
  6625. }
  6626. function isComment(node) {
  6627. return isVNode(node) && node.type === Comment;
  6628. }
  6629. function isValidElementNode(node) {
  6630. return isVNode(node) && !isFragment(node) && !isComment(node);
  6631. }
  6632. const getNormalizedProps = (node) => {
  6633. if (!isVNode(node)) {
  6634. /* @__PURE__ */ debugWarn(SCOPE$8, "[getNormalizedProps] must be a VNode");
  6635. return {};
  6636. }
  6637. const raw = node.props || {};
  6638. const type = (isVNode(node.type) ? node.type.props : void 0) || {};
  6639. const props = {};
  6640. Object.keys(type).forEach((key) => {
  6641. if (hasOwn(type[key], "default")) props[key] = type[key].default;
  6642. });
  6643. Object.keys(raw).forEach((key) => {
  6644. props[camelize(key)] = raw[key];
  6645. });
  6646. return props;
  6647. };
  6648. const flattedChildren = (children) => {
  6649. const vNodes = isArray$1(children) ? children : [children];
  6650. const result = [];
  6651. vNodes.forEach((child) => {
  6652. if (isArray$1(child)) result.push(...flattedChildren(child));
  6653. else if (isVNode(child) && child.component?.subTree) result.push(child, ...flattedChildren(child.component.subTree));
  6654. else if (isVNode(child) && isArray$1(child.children)) result.push(...flattedChildren(child.children));
  6655. else if (isVNode(child) && child.shapeFlag === 2) result.push(...flattedChildren(child.type()));
  6656. else result.push(child);
  6657. });
  6658. return result;
  6659. };
  6660. //#endregion
  6661. //#region ../../packages/utils/arrays.ts
  6662. const unique = (arr) => [...new Set(arr)];
  6663. const extractFirst = (arr) => {
  6664. return isArray$1(arr) ? arr[0] : arr;
  6665. };
  6666. /** like `_.castArray`, except falsy value returns empty array. */
  6667. const castArray = (arr) => {
  6668. if (!arr && arr !== 0) return [];
  6669. return isArray$1(arr) ? arr : [arr];
  6670. };
  6671. //#endregion
  6672. //#region ../../packages/utils/typescript.ts
  6673. const mutable = (val) => val;
  6674. //#endregion
  6675. //#region ../../packages/utils/throttleByRaf.ts
  6676. function throttleByRaf(cb) {
  6677. let timer = 0;
  6678. const throttle = (...args) => {
  6679. if (timer) cAF(timer);
  6680. timer = rAF(() => {
  6681. cb(...args);
  6682. timer = 0;
  6683. });
  6684. };
  6685. throttle.cancel = () => {
  6686. cAF(timer);
  6687. timer = 0;
  6688. };
  6689. return throttle;
  6690. }
  6691. //#endregion
  6692. //#region ../../packages/utils/numbers.ts
  6693. /**
  6694. * Due to browser rendering and calculation precision loss issues,
  6695. * boundary checks cannot be based solely on value equality;
  6696. * a certain range of fluctuation is permissible.
  6697. */
  6698. function isGreaterThan(a, b, epsilon = .03) {
  6699. return a - b > epsilon;
  6700. }
  6701. //#endregion
  6702. //#region ../../packages/hooks/use-attrs/index.ts
  6703. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  6704. const LISTENER_PREFIX = /^on[A-Z]/;
  6705. const useAttrs = (params = {}) => {
  6706. const { excludeListeners = false, excludeKeys } = params;
  6707. const allExcludeKeys = computed(() => {
  6708. return (excludeKeys?.value || []).concat(DEFAULT_EXCLUDE_KEYS);
  6709. });
  6710. const instance = getCurrentInstance();
  6711. if (!instance) {
  6712. /* @__PURE__ */ debugWarn("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function");
  6713. return computed(() => ({}));
  6714. }
  6715. return computed(() => fromPairs(Object.entries(instance.proxy?.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key)))));
  6716. };
  6717. //#endregion
  6718. //#region ../../packages/hooks/use-calc-input-width/index.ts
  6719. function useCalcInputWidth() {
  6720. const calculatorRef = shallowRef();
  6721. const calculatorWidth = ref(0);
  6722. const inputStyle = computed(() => ({ minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px` }));
  6723. const resetCalculatorWidth = () => {
  6724. calculatorWidth.value = calculatorRef.value?.getBoundingClientRect().width ?? 0;
  6725. };
  6726. useResizeObserver(calculatorRef, resetCalculatorWidth);
  6727. return {
  6728. calculatorRef,
  6729. calculatorWidth,
  6730. inputStyle
  6731. };
  6732. }
  6733. //#endregion
  6734. //#region ../../packages/hooks/use-deprecated/index.ts
  6735. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  6736. watch(() => unref(condition), (val) => {
  6737. if (val) /* @__PURE__ */ debugWarn(scope, `[${type}] ${from} is about to be deprecated in version ${version}, please use ${replacement} instead.
  6738. For more detail, please visit: ${ref}
  6739. `);
  6740. }, { immediate: true });
  6741. };
  6742. //#endregion
  6743. //#region ../../packages/hooks/use-draggable/index.ts
  6744. const useDraggable = (targetRef, dragRef, draggable, overflow) => {
  6745. const transform = {
  6746. offsetX: 0,
  6747. offsetY: 0
  6748. };
  6749. const isDragging = ref(false);
  6750. const adjustPosition = (moveX, moveY) => {
  6751. if (targetRef.value) {
  6752. const { offsetX, offsetY } = transform;
  6753. const targetRect = targetRef.value.getBoundingClientRect();
  6754. const targetLeft = targetRect.left;
  6755. const targetTop = targetRect.top;
  6756. const targetWidth = targetRect.width;
  6757. const targetHeight = targetRect.height;
  6758. const clientWidth = document.documentElement.clientWidth;
  6759. const clientHeight = document.documentElement.clientHeight;
  6760. const minLeft = -targetLeft + offsetX;
  6761. const minTop = -targetTop + offsetY;
  6762. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  6763. const maxTop = clientHeight - targetTop - (targetHeight < clientHeight ? targetHeight : 0) + offsetY;
  6764. if (!overflow?.value) {
  6765. moveX = Math.min(Math.max(moveX, minLeft), maxLeft);
  6766. moveY = Math.min(Math.max(moveY, minTop), maxTop);
  6767. }
  6768. transform.offsetX = moveX;
  6769. transform.offsetY = moveY;
  6770. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  6771. }
  6772. };
  6773. const onMousedown = (e) => {
  6774. const downX = e.clientX;
  6775. const downY = e.clientY;
  6776. const { offsetX, offsetY } = transform;
  6777. const onMousemove = (e) => {
  6778. if (!isDragging.value) isDragging.value = true;
  6779. adjustPosition(offsetX + e.clientX - downX, offsetY + e.clientY - downY);
  6780. };
  6781. const onMouseup = () => {
  6782. isDragging.value = false;
  6783. document.removeEventListener("mousemove", onMousemove);
  6784. document.removeEventListener("mouseup", onMouseup);
  6785. };
  6786. document.addEventListener("mousemove", onMousemove);
  6787. document.addEventListener("mouseup", onMouseup);
  6788. };
  6789. const onDraggable = () => {
  6790. if (dragRef.value && targetRef.value) {
  6791. dragRef.value.addEventListener("mousedown", onMousedown);
  6792. window.addEventListener("resize", updatePosition);
  6793. }
  6794. };
  6795. const offDraggable = () => {
  6796. if (dragRef.value && targetRef.value) {
  6797. dragRef.value.removeEventListener("mousedown", onMousedown);
  6798. window.removeEventListener("resize", updatePosition);
  6799. }
  6800. };
  6801. const resetPosition = () => {
  6802. transform.offsetX = 0;
  6803. transform.offsetY = 0;
  6804. if (targetRef.value) targetRef.value.style.transform = "";
  6805. };
  6806. const updatePosition = () => {
  6807. const { offsetX, offsetY } = transform;
  6808. adjustPosition(offsetX, offsetY);
  6809. };
  6810. onMounted(() => {
  6811. watchEffect(() => {
  6812. if (draggable.value) onDraggable();
  6813. else offDraggable();
  6814. });
  6815. });
  6816. onBeforeUnmount(() => {
  6817. offDraggable();
  6818. });
  6819. return {
  6820. isDragging,
  6821. resetPosition,
  6822. updatePosition
  6823. };
  6824. };
  6825. //#endregion
  6826. //#region ../../packages/hooks/use-focus/index.ts
  6827. const useFocus = (el) => {
  6828. return { focus: () => {
  6829. el.value?.focus?.();
  6830. } };
  6831. };
  6832. //#endregion
  6833. //#region ../../packages/locale/lang/en.ts
  6834. var en_default = {
  6835. name: "en",
  6836. el: {
  6837. breadcrumb: { label: "Breadcrumb" },
  6838. colorpicker: {
  6839. confirm: "OK",
  6840. clear: "Clear",
  6841. defaultLabel: "color picker",
  6842. description: "current color is {color}. press enter to select a new color.",
  6843. alphaLabel: "pick alpha value",
  6844. alphaDescription: "alpha {alpha}, current color is {color}",
  6845. hueLabel: "pick hue value",
  6846. hueDescription: "hue {hue}, current color is {color}",
  6847. svLabel: "pick saturation and brightness value",
  6848. svDescription: "saturation {saturation}, brightness {brightness}, current color is {color}",
  6849. predefineDescription: "select {value} as the color"
  6850. },
  6851. datepicker: {
  6852. now: "Now",
  6853. today: "Today",
  6854. cancel: "Cancel",
  6855. clear: "Clear",
  6856. confirm: "OK",
  6857. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  6858. monthTablePrompt: "Use the arrow keys and enter to select the month",
  6859. yearTablePrompt: "Use the arrow keys and enter to select the year",
  6860. selectedDate: "Selected date",
  6861. selectDate: "Select date",
  6862. selectTime: "Select time",
  6863. startDate: "Start Date",
  6864. startTime: "Start Time",
  6865. endDate: "End Date",
  6866. endTime: "End Time",
  6867. prevYear: "Previous Year",
  6868. nextYear: "Next Year",
  6869. prevMonth: "Previous Month",
  6870. nextMonth: "Next Month",
  6871. year: "",
  6872. month1: "January",
  6873. month2: "February",
  6874. month3: "March",
  6875. month4: "April",
  6876. month5: "May",
  6877. month6: "June",
  6878. month7: "July",
  6879. month8: "August",
  6880. month9: "September",
  6881. month10: "October",
  6882. month11: "November",
  6883. month12: "December",
  6884. weeks: {
  6885. sun: "Sun",
  6886. mon: "Mon",
  6887. tue: "Tue",
  6888. wed: "Wed",
  6889. thu: "Thu",
  6890. fri: "Fri",
  6891. sat: "Sat"
  6892. },
  6893. weeksFull: {
  6894. sun: "Sunday",
  6895. mon: "Monday",
  6896. tue: "Tuesday",
  6897. wed: "Wednesday",
  6898. thu: "Thursday",
  6899. fri: "Friday",
  6900. sat: "Saturday"
  6901. },
  6902. months: {
  6903. jan: "Jan",
  6904. feb: "Feb",
  6905. mar: "Mar",
  6906. apr: "Apr",
  6907. may: "May",
  6908. jun: "Jun",
  6909. jul: "Jul",
  6910. aug: "Aug",
  6911. sep: "Sep",
  6912. oct: "Oct",
  6913. nov: "Nov",
  6914. dec: "Dec"
  6915. }
  6916. },
  6917. inputNumber: {
  6918. decrease: "decrease number",
  6919. increase: "increase number"
  6920. },
  6921. select: {
  6922. loading: "Loading",
  6923. noMatch: "No matching data",
  6924. noData: "No data",
  6925. placeholder: "Select"
  6926. },
  6927. mention: { loading: "Loading" },
  6928. dropdown: { toggleDropdown: "Toggle Dropdown" },
  6929. cascader: {
  6930. noMatch: "No matching data",
  6931. loading: "Loading",
  6932. placeholder: "Select",
  6933. noData: "No data"
  6934. },
  6935. pagination: {
  6936. goto: "Go to",
  6937. pagesize: "/page",
  6938. total: "Total {total}",
  6939. pageClassifier: "",
  6940. page: "Page",
  6941. prev: "Go to previous page",
  6942. next: "Go to next page",
  6943. currentPage: "page {pager}",
  6944. prevPages: "Previous {pager} pages",
  6945. nextPages: "Next {pager} pages",
  6946. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  6947. },
  6948. dialog: { close: "Close this dialog" },
  6949. drawer: { close: "Close this dialog" },
  6950. messagebox: {
  6951. title: "Message",
  6952. confirm: "OK",
  6953. cancel: "Cancel",
  6954. error: "Illegal input",
  6955. close: "Close this dialog"
  6956. },
  6957. upload: {
  6958. deleteTip: "press delete to remove",
  6959. delete: "Delete",
  6960. preview: "Preview",
  6961. continue: "Continue"
  6962. },
  6963. slider: {
  6964. defaultLabel: "slider between {min} and {max}",
  6965. defaultRangeStartLabel: "pick start value",
  6966. defaultRangeEndLabel: "pick end value"
  6967. },
  6968. table: {
  6969. emptyText: "No Data",
  6970. confirmFilter: "Confirm",
  6971. resetFilter: "Reset",
  6972. clearFilter: "All",
  6973. sumText: "Sum",
  6974. selectAllLabel: "Select all rows",
  6975. selectRowLabel: "Select this row",
  6976. expandRowLabel: "Expand this row",
  6977. collapseRowLabel: "Collapse this row",
  6978. sortLabel: "Sort by {column}",
  6979. filterLabel: "Filter by {column}"
  6980. },
  6981. tag: { close: "Close this tag" },
  6982. tour: {
  6983. next: "Next",
  6984. previous: "Previous",
  6985. finish: "Finish",
  6986. close: "Close this dialog"
  6987. },
  6988. tree: { emptyText: "No Data" },
  6989. transfer: {
  6990. noMatch: "No matching data",
  6991. noData: "No data",
  6992. titles: ["List 1", "List 2"],
  6993. filterPlaceholder: "Enter keyword",
  6994. noCheckedFormat: "{total} items",
  6995. hasCheckedFormat: "{checked}/{total} checked"
  6996. },
  6997. image: { error: "FAILED" },
  6998. pageHeader: { title: "Back" },
  6999. popconfirm: {
  7000. confirmButtonText: "Yes",
  7001. cancelButtonText: "No"
  7002. },
  7003. carousel: {
  7004. leftArrow: "Carousel arrow left",
  7005. rightArrow: "Carousel arrow right",
  7006. indicator: "Carousel switch to index {index}"
  7007. }
  7008. }
  7009. };
  7010. //#endregion
  7011. //#region ../../packages/hooks/use-locale/index.ts
  7012. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  7013. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => `${option?.[key] ?? `{${key}}`}`);
  7014. const buildLocaleContext = (locale) => {
  7015. return {
  7016. lang: computed(() => unref(locale).name),
  7017. locale: isRef(locale) ? locale : ref(locale),
  7018. t: buildTranslator(locale)
  7019. };
  7020. };
  7021. const localeContextKey = Symbol("localeContextKey");
  7022. const useLocale = (localeOverrides) => {
  7023. const locale = localeOverrides || inject(localeContextKey, ref());
  7024. return buildLocaleContext(computed(() => locale.value || en_default));
  7025. };
  7026. //#endregion
  7027. //#region ../../packages/hooks/use-namespace/index.ts
  7028. const defaultNamespace = "el";
  7029. const statePrefix = "is-";
  7030. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  7031. let cls = `${namespace}-${block}`;
  7032. if (blockSuffix) cls += `-${blockSuffix}`;
  7033. if (element) cls += `__${element}`;
  7034. if (modifier) cls += `--${modifier}`;
  7035. return cls;
  7036. };
  7037. const namespaceContextKey = Symbol("namespaceContextKey");
  7038. const useGetDerivedNamespace = (namespaceOverrides) => {
  7039. const derivedNamespace = namespaceOverrides || (getCurrentInstance() ? inject(namespaceContextKey, ref(defaultNamespace)) : ref(defaultNamespace));
  7040. return computed(() => {
  7041. return unref(derivedNamespace) || defaultNamespace;
  7042. });
  7043. };
  7044. const useNamespace = (block, namespaceOverrides) => {
  7045. const namespace = useGetDerivedNamespace(namespaceOverrides);
  7046. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  7047. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  7048. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  7049. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  7050. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  7051. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  7052. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  7053. const is = (name, ...args) => {
  7054. const state = args.length >= 1 ? args[0] : true;
  7055. return name && state ? `${statePrefix}${name}` : "";
  7056. };
  7057. const cssVar = (object) => {
  7058. const styles = {};
  7059. for (const key in object) if (object[key]) styles[`--${namespace.value}-${key}`] = object[key];
  7060. return styles;
  7061. };
  7062. const cssVarBlock = (object) => {
  7063. const styles = {};
  7064. for (const key in object) if (object[key]) styles[`--${namespace.value}-${block}-${key}`] = object[key];
  7065. return styles;
  7066. };
  7067. const cssVarName = (name) => `--${namespace.value}-${name}`;
  7068. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  7069. return {
  7070. namespace,
  7071. b,
  7072. e,
  7073. m,
  7074. be,
  7075. em,
  7076. bm,
  7077. bem,
  7078. is,
  7079. cssVar,
  7080. cssVarName,
  7081. cssVarBlock,
  7082. cssVarBlockName
  7083. };
  7084. };
  7085. //#endregion
  7086. //#region ../../packages/hooks/use-lockscreen/index.ts
  7087. /**
  7088. * Hook that monitoring the ref value to lock or unlock the screen.
  7089. * When the trigger became true, it assumes modal is now opened and vice versa.
  7090. * @param trigger {Ref<boolean>}
  7091. */
  7092. const useLockscreen = (trigger, options = {}) => {
  7093. if (!isRef(trigger)) throwError("[useLockscreen]", "You need to pass a ref param to this function");
  7094. const ns = options.ns || useNamespace("popup");
  7095. const hiddenCls = computed(() => ns.bm("parent", "hidden"));
  7096. let scrollBarWidth = 0;
  7097. let withoutHiddenClass = false;
  7098. let bodyWidth = "0";
  7099. let cleaned = false;
  7100. const cleanup = () => {
  7101. if (cleaned) return;
  7102. cleaned = true;
  7103. setTimeout(() => {
  7104. if (typeof document === "undefined") return;
  7105. if (withoutHiddenClass && document) {
  7106. document.body.style.width = bodyWidth;
  7107. removeClass(document.body, hiddenCls.value);
  7108. }
  7109. }, 200);
  7110. };
  7111. watch(trigger, (val) => {
  7112. if (!val) {
  7113. cleanup();
  7114. return;
  7115. }
  7116. cleaned = false;
  7117. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  7118. if (withoutHiddenClass) {
  7119. bodyWidth = document.body.style.width;
  7120. addClass(document.body, hiddenCls.value);
  7121. }
  7122. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  7123. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  7124. const bodyOverflowY = getStyle(document.body, "overflowY");
  7125. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  7126. });
  7127. onScopeDispose(() => cleanup());
  7128. };
  7129. //#endregion
  7130. //#region ../../packages/hooks/use-modal/index.ts
  7131. const modalStack = [];
  7132. const closeModal = (e) => {
  7133. if (modalStack.length === 0) return;
  7134. if (getEventCode(e) === EVENT_CODE.esc) {
  7135. e.stopPropagation();
  7136. modalStack[modalStack.length - 1].handleClose();
  7137. }
  7138. };
  7139. const useModal = (instance, visibleRef) => {
  7140. watch(visibleRef, (val) => {
  7141. if (val) modalStack.push(instance);
  7142. else modalStack.splice(modalStack.indexOf(instance), 1);
  7143. });
  7144. };
  7145. if (isClient) useEventListener(document, "keydown", closeModal);
  7146. //#endregion
  7147. //#region ../../packages/hooks/use-model-toggle/index.ts
  7148. const _prop = buildProp({
  7149. type: definePropType(Boolean),
  7150. default: null
  7151. });
  7152. const _event = buildProp({ type: definePropType(Function) });
  7153. const createModelToggleComposable = (name) => {
  7154. const updateEventKey = `update:${name}`;
  7155. const updateEventKeyRaw = `onUpdate:${name}`;
  7156. const useModelToggleEmits = [updateEventKey];
  7157. const useModelToggleProps = {
  7158. [name]: _prop,
  7159. [updateEventKeyRaw]: _event
  7160. };
  7161. const useModelToggle = ({ indicator, toggleReason, shouldHideWhenRouteChanges, shouldProceed, onShow, onHide }) => {
  7162. const instance = getCurrentInstance();
  7163. const { emit } = instance;
  7164. const props = instance.props;
  7165. const hasUpdateHandler = computed(() => isFunction$1(props[updateEventKeyRaw]));
  7166. const isModelBindingAbsent = computed(() => props[name] === null);
  7167. const doShow = (event) => {
  7168. if (indicator.value === true) return;
  7169. indicator.value = true;
  7170. if (toggleReason) toggleReason.value = event;
  7171. if (isFunction$1(onShow)) onShow(event);
  7172. };
  7173. const doHide = (event) => {
  7174. if (indicator.value === false) return;
  7175. indicator.value = false;
  7176. if (toggleReason) toggleReason.value = event;
  7177. if (isFunction$1(onHide)) onHide(event);
  7178. };
  7179. const show = (event) => {
  7180. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed()) return;
  7181. const shouldEmit = hasUpdateHandler.value && isClient;
  7182. if (shouldEmit) emit(updateEventKey, true);
  7183. if (isModelBindingAbsent.value || !shouldEmit) doShow(event);
  7184. };
  7185. const hide = (event) => {
  7186. if (props.disabled === true || !isClient) return;
  7187. const shouldEmit = hasUpdateHandler.value && isClient;
  7188. if (shouldEmit) emit(updateEventKey, false);
  7189. if (isModelBindingAbsent.value || !shouldEmit) doHide(event);
  7190. };
  7191. const onChange = (val) => {
  7192. if (!isBoolean(val)) return;
  7193. if (props.disabled && val) {
  7194. if (hasUpdateHandler.value) emit(updateEventKey, false);
  7195. } else if (indicator.value !== val) if (val) doShow();
  7196. else doHide();
  7197. };
  7198. const toggle = () => {
  7199. if (indicator.value) hide();
  7200. else show();
  7201. };
  7202. watch(() => props[name], onChange);
  7203. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) watch(() => ({ ...instance.proxy.$route }), () => {
  7204. if (shouldHideWhenRouteChanges.value && indicator.value) hide();
  7205. });
  7206. onMounted(() => {
  7207. onChange(props[name]);
  7208. });
  7209. return {
  7210. hide,
  7211. show,
  7212. toggle,
  7213. hasUpdateHandler
  7214. };
  7215. };
  7216. return {
  7217. useModelToggle,
  7218. useModelToggleProps,
  7219. useModelToggleEmits
  7220. };
  7221. };
  7222. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  7223. //#endregion
  7224. //#region ../../packages/hooks/use-prevent-global/index.ts
  7225. const usePreventGlobal = (indicator, evt, cb) => {
  7226. const prevent = (e) => {
  7227. if (cb(e)) e.stopImmediatePropagation();
  7228. };
  7229. let stop = void 0;
  7230. watch(() => indicator.value, (val) => {
  7231. if (val) stop = useEventListener(document, evt, prevent, true);
  7232. else stop?.();
  7233. }, { immediate: true });
  7234. };
  7235. //#endregion
  7236. //#region ../../packages/hooks/use-prop/index.ts
  7237. const useProp = (name) => {
  7238. const vm = getCurrentInstance();
  7239. return computed(() => (vm?.proxy?.$props)?.[name]);
  7240. };
  7241. //#endregion
  7242. //#region ../../node_modules/.pnpm/@sxzz+popperjs-es@2.11.8/node_modules/@sxzz/popperjs-es/dist/index.mjs
  7243. var L = "top", W = "bottom", T$1 = "right", P$1 = "left", me = "auto", Q = [
  7244. L,
  7245. W,
  7246. T$1,
  7247. P$1
  7248. ], Y$1 = "start", Z = "end", Ye = "clippingParents", je = "viewport", ee = "popper", Ge = "reference", De = Q.reduce(function(e, t) {
  7249. return e.concat([t + "-" + Y$1, t + "-" + Z]);
  7250. }, []), Ee = [].concat(Q, [me]).reduce(function(e, t) {
  7251. return e.concat([
  7252. t,
  7253. t + "-" + Y$1,
  7254. t + "-" + Z
  7255. ]);
  7256. }, []), Je = "beforeRead", Ke = "read", Qe = "afterRead", Ze = "beforeMain", et = "main", tt = "afterMain", nt = "beforeWrite", rt = "write", ot = "afterWrite", it = [
  7257. Je,
  7258. Ke,
  7259. Qe,
  7260. Ze,
  7261. et,
  7262. tt,
  7263. nt,
  7264. rt,
  7265. ot
  7266. ];
  7267. function V(e) {
  7268. return e ? (e.nodeName || "").toLowerCase() : null;
  7269. }
  7270. function B(e) {
  7271. if (e == null) return window;
  7272. if (e.toString() !== "[object Window]") {
  7273. var t = e.ownerDocument;
  7274. return t && t.defaultView || window;
  7275. }
  7276. return e;
  7277. }
  7278. function G(e) {
  7279. return e instanceof B(e).Element || e instanceof Element;
  7280. }
  7281. function R(e) {
  7282. return e instanceof B(e).HTMLElement || e instanceof HTMLElement;
  7283. }
  7284. function Ae(e) {
  7285. if (typeof ShadowRoot == "undefined") return !1;
  7286. return e instanceof B(e).ShadowRoot || e instanceof ShadowRoot;
  7287. }
  7288. function Tt(e) {
  7289. var t = e.state;
  7290. Object.keys(t.elements).forEach(function(n) {
  7291. var r = t.styles[n] || {}, o = t.attributes[n] || {}, a = t.elements[n];
  7292. !R(a) || !V(a) || (Object.assign(a.style, r), Object.keys(o).forEach(function(c) {
  7293. var s = o[c];
  7294. s === !1 ? a.removeAttribute(c) : a.setAttribute(c, s === !0 ? "" : s);
  7295. }));
  7296. });
  7297. }
  7298. function Bt(e) {
  7299. var t = e.state, n = {
  7300. popper: {
  7301. position: t.options.strategy,
  7302. left: "0",
  7303. top: "0",
  7304. margin: "0"
  7305. },
  7306. arrow: { position: "absolute" },
  7307. reference: {}
  7308. };
  7309. return Object.assign(t.elements.popper.style, n.popper), t.styles = n, t.elements.arrow && Object.assign(t.elements.arrow.style, n.arrow), function() {
  7310. Object.keys(t.elements).forEach(function(r) {
  7311. var o = t.elements[r], a = t.attributes[r] || {}, s = Object.keys(t.styles.hasOwnProperty(r) ? t.styles[r] : n[r]).reduce(function(i, f) {
  7312. return i[f] = "", i;
  7313. }, {});
  7314. !R(o) || !V(o) || (Object.assign(o.style, s), Object.keys(a).forEach(function(i) {
  7315. o.removeAttribute(i);
  7316. }));
  7317. });
  7318. };
  7319. }
  7320. var ke = {
  7321. name: "applyStyles",
  7322. enabled: !0,
  7323. phase: "write",
  7324. fn: Tt,
  7325. effect: Bt,
  7326. requires: ["computeStyles"]
  7327. };
  7328. function C(e) {
  7329. return e.split("-")[0];
  7330. }
  7331. var J = Math.max, ve = Math.min, te = Math.round;
  7332. function Le() {
  7333. var e = navigator.userAgentData;
  7334. return e != null && e.brands && Array.isArray(e.brands) ? e.brands.map(function(t) {
  7335. return t.brand + "/" + t.version;
  7336. }).join(" ") : navigator.userAgent;
  7337. }
  7338. function at() {
  7339. return !/^((?!chrome|android).)*safari/i.test(Le());
  7340. }
  7341. function ne(e, t, n) {
  7342. t === void 0 && (t = !1), n === void 0 && (n = !1);
  7343. var r = e.getBoundingClientRect(), o = 1, a = 1;
  7344. t && R(e) && (o = e.offsetWidth > 0 && te(r.width) / e.offsetWidth || 1, a = e.offsetHeight > 0 && te(r.height) / e.offsetHeight || 1);
  7345. var s = (G(e) ? B(e) : window).visualViewport, i = !at() && n, f = (r.left + (i && s ? s.offsetLeft : 0)) / o, u = (r.top + (i && s ? s.offsetTop : 0)) / a, m = r.width / o, h = r.height / a;
  7346. return {
  7347. width: m,
  7348. height: h,
  7349. top: u,
  7350. right: f + m,
  7351. bottom: u + h,
  7352. left: f,
  7353. x: f,
  7354. y: u
  7355. };
  7356. }
  7357. function Pe(e) {
  7358. var t = ne(e), n = e.offsetWidth, r = e.offsetHeight;
  7359. return Math.abs(t.width - n) <= 1 && (n = t.width), Math.abs(t.height - r) <= 1 && (r = t.height), {
  7360. x: e.offsetLeft,
  7361. y: e.offsetTop,
  7362. width: n,
  7363. height: r
  7364. };
  7365. }
  7366. function st(e, t) {
  7367. var n = t.getRootNode && t.getRootNode();
  7368. if (e.contains(t)) return !0;
  7369. if (n && Ae(n)) {
  7370. var r = t;
  7371. do {
  7372. if (r && e.isSameNode(r)) return !0;
  7373. r = r.parentNode || r.host;
  7374. } while (r);
  7375. }
  7376. return !1;
  7377. }
  7378. function I$1(e) {
  7379. return B(e).getComputedStyle(e);
  7380. }
  7381. function Rt(e) {
  7382. return [
  7383. "table",
  7384. "td",
  7385. "th"
  7386. ].indexOf(V(e)) >= 0;
  7387. }
  7388. function N$1(e) {
  7389. return ((G(e) ? e.ownerDocument : e.document) || window.document).documentElement;
  7390. }
  7391. function ye(e) {
  7392. return V(e) === "html" ? e : e.assignedSlot || e.parentNode || (Ae(e) ? e.host : null) || N$1(e);
  7393. }
  7394. function ft(e) {
  7395. return !R(e) || I$1(e).position === "fixed" ? null : e.offsetParent;
  7396. }
  7397. function Ht(e) {
  7398. var t = /firefox/i.test(Le());
  7399. if (/Trident/i.test(Le()) && R(e)) {
  7400. if (I$1(e).position === "fixed") return null;
  7401. }
  7402. var o = ye(e);
  7403. for (Ae(o) && (o = o.host); R(o) && ["html", "body"].indexOf(V(o)) < 0;) {
  7404. var a = I$1(o);
  7405. if (a.transform !== "none" || a.perspective !== "none" || a.contain === "paint" || ["transform", "perspective"].indexOf(a.willChange) !== -1 || t && a.willChange === "filter" || t && a.filter && a.filter !== "none") return o;
  7406. o = o.parentNode;
  7407. }
  7408. return null;
  7409. }
  7410. function se(e) {
  7411. for (var t = B(e), n = ft(e); n && Rt(n) && I$1(n).position === "static";) n = ft(n);
  7412. return n && (V(n) === "html" || V(n) === "body" && I$1(n).position === "static") ? t : n || Ht(e) || t;
  7413. }
  7414. function Me(e) {
  7415. return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y";
  7416. }
  7417. function fe(e, t, n) {
  7418. return J(e, ve(t, n));
  7419. }
  7420. function St(e, t, n) {
  7421. var r = fe(e, t, n);
  7422. return r > n ? n : r;
  7423. }
  7424. function ct() {
  7425. return {
  7426. top: 0,
  7427. right: 0,
  7428. bottom: 0,
  7429. left: 0
  7430. };
  7431. }
  7432. function ut(e) {
  7433. return Object.assign({}, ct(), e);
  7434. }
  7435. function pt(e, t) {
  7436. return t.reduce(function(n, r) {
  7437. return n[r] = e, n;
  7438. }, {});
  7439. }
  7440. var Vt = function(e, t) {
  7441. return e = typeof e == "function" ? e(Object.assign({}, t.rects, { placement: t.placement })) : e, ut(typeof e != "number" ? e : pt(e, Q));
  7442. };
  7443. function Ct(e) {
  7444. var t, n = e.state, r = e.name, o = e.options, a = n.elements.arrow, c = n.modifiersData.popperOffsets, s = C(n.placement), i = Me(s), u = [P$1, T$1].indexOf(s) >= 0 ? "height" : "width";
  7445. if (!(!a || !c)) {
  7446. var m = Vt(o.padding, n), h = Pe(a), l = i === "y" ? L : P$1, g = i === "y" ? W : T$1, p = n.rects.reference[u] + n.rects.reference[i] - c[i] - n.rects.popper[u], y = c[i] - n.rects.reference[i], b = se(a), x = b ? i === "y" ? b.clientHeight || 0 : b.clientWidth || 0 : 0, O = p / 2 - y / 2, d = m[l], v = x - h[u] - m[g], w = x / 2 - h[u] / 2 + O, $ = fe(d, w, v), j = i;
  7447. n.modifiersData[r] = (t = {}, t[j] = $, t.centerOffset = $ - w, t);
  7448. }
  7449. }
  7450. function qt(e) {
  7451. var t = e.state, r = e.options.element, o = r === void 0 ? "[data-popper-arrow]" : r;
  7452. o != null && (typeof o == "string" && (o = t.elements.popper.querySelector(o), !o) || st(t.elements.popper, o) && (t.elements.arrow = o));
  7453. }
  7454. var lt = {
  7455. name: "arrow",
  7456. enabled: !0,
  7457. phase: "main",
  7458. fn: Ct,
  7459. effect: qt,
  7460. requires: ["popperOffsets"],
  7461. requiresIfExists: ["preventOverflow"]
  7462. };
  7463. function re(e) {
  7464. return e.split("-")[1];
  7465. }
  7466. var It = {
  7467. top: "auto",
  7468. right: "auto",
  7469. bottom: "auto",
  7470. left: "auto"
  7471. };
  7472. function Nt(e, t) {
  7473. var n = e.x, r = e.y, o = t.devicePixelRatio || 1;
  7474. return {
  7475. x: te(n * o) / o || 0,
  7476. y: te(r * o) / o || 0
  7477. };
  7478. }
  7479. function dt(e) {
  7480. var t, n = e.popper, r = e.popperRect, o = e.placement, a = e.variation, c = e.offsets, s = e.position, i = e.gpuAcceleration, f = e.adaptive, u = e.roundOffsets, m = e.isFixed, h = c.x, l = h === void 0 ? 0 : h, g = c.y, p = g === void 0 ? 0 : g, y = typeof u == "function" ? u({
  7481. x: l,
  7482. y: p
  7483. }) : {
  7484. x: l,
  7485. y: p
  7486. };
  7487. l = y.x, p = y.y;
  7488. var b = c.hasOwnProperty("x"), x = c.hasOwnProperty("y"), O = P$1, d = L, v = window;
  7489. if (f) {
  7490. var w = se(n), $ = "clientHeight", j = "clientWidth";
  7491. if (w === B(n) && (w = N$1(n), I$1(w).position !== "static" && s === "absolute" && ($ = "scrollHeight", j = "scrollWidth")), w = w, o === L || (o === P$1 || o === T$1) && a === Z) {
  7492. d = W;
  7493. var D = m && w === v && v.visualViewport ? v.visualViewport.height : w[$];
  7494. p -= D - r.height, p *= i ? 1 : -1;
  7495. }
  7496. if (o === P$1 || (o === L || o === W) && a === Z) {
  7497. O = T$1;
  7498. var E = m && w === v && v.visualViewport ? v.visualViewport.width : w[j];
  7499. l -= E - r.width, l *= i ? 1 : -1;
  7500. }
  7501. }
  7502. var A = Object.assign({ position: s }, f && It), H = u === !0 ? Nt({
  7503. x: l,
  7504. y: p
  7505. }, B(n)) : {
  7506. x: l,
  7507. y: p
  7508. };
  7509. if (l = H.x, p = H.y, i) {
  7510. var k;
  7511. return Object.assign({}, A, (k = {}, k[d] = x ? "0" : "", k[O] = b ? "0" : "", k.transform = (v.devicePixelRatio || 1) <= 1 ? "translate(" + l + "px, " + p + "px)" : "translate3d(" + l + "px, " + p + "px, 0)", k));
  7512. }
  7513. return Object.assign({}, A, (t = {}, t[d] = x ? p + "px" : "", t[O] = b ? l + "px" : "", t.transform = "", t));
  7514. }
  7515. function Ft(e) {
  7516. var t = e.state, n = e.options, r = n.gpuAcceleration, o = r === void 0 ? !0 : r, a = n.adaptive, c = a === void 0 ? !0 : a, s = n.roundOffsets, i = s === void 0 ? !0 : s, f = {
  7517. placement: C(t.placement),
  7518. variation: re(t.placement),
  7519. popper: t.elements.popper,
  7520. popperRect: t.rects.popper,
  7521. gpuAcceleration: o,
  7522. isFixed: t.options.strategy === "fixed"
  7523. };
  7524. t.modifiersData.popperOffsets != null && (t.styles.popper = Object.assign({}, t.styles.popper, dt(Object.assign({}, f, {
  7525. offsets: t.modifiersData.popperOffsets,
  7526. position: t.options.strategy,
  7527. adaptive: c,
  7528. roundOffsets: i
  7529. })))), t.modifiersData.arrow != null && (t.styles.arrow = Object.assign({}, t.styles.arrow, dt(Object.assign({}, f, {
  7530. offsets: t.modifiersData.arrow,
  7531. position: "absolute",
  7532. adaptive: !1,
  7533. roundOffsets: i
  7534. })))), t.attributes.popper = Object.assign({}, t.attributes.popper, { "data-popper-placement": t.placement });
  7535. }
  7536. var We = {
  7537. name: "computeStyles",
  7538. enabled: !0,
  7539. phase: "beforeWrite",
  7540. fn: Ft,
  7541. data: {}
  7542. }, ge = { passive: !0 };
  7543. function Ut(e) {
  7544. var t = e.state, n = e.instance, r = e.options, o = r.scroll, a = o === void 0 ? !0 : o, c = r.resize, s = c === void 0 ? !0 : c, i = B(t.elements.popper), f = [].concat(t.scrollParents.reference, t.scrollParents.popper);
  7545. return a && f.forEach(function(u) {
  7546. u.addEventListener("scroll", n.update, ge);
  7547. }), s && i.addEventListener("resize", n.update, ge), function() {
  7548. a && f.forEach(function(u) {
  7549. u.removeEventListener("scroll", n.update, ge);
  7550. }), s && i.removeEventListener("resize", n.update, ge);
  7551. };
  7552. }
  7553. var Te = {
  7554. name: "eventListeners",
  7555. enabled: !0,
  7556. phase: "write",
  7557. fn: function() {},
  7558. effect: Ut,
  7559. data: {}
  7560. }, _t = {
  7561. left: "right",
  7562. right: "left",
  7563. bottom: "top",
  7564. top: "bottom"
  7565. };
  7566. function be(e) {
  7567. return e.replace(/left|right|bottom|top/g, function(t) {
  7568. return _t[t];
  7569. });
  7570. }
  7571. var zt = {
  7572. start: "end",
  7573. end: "start"
  7574. };
  7575. function ht(e) {
  7576. return e.replace(/start|end/g, function(t) {
  7577. return zt[t];
  7578. });
  7579. }
  7580. function Be(e) {
  7581. var t = B(e);
  7582. return {
  7583. scrollLeft: t.pageXOffset,
  7584. scrollTop: t.pageYOffset
  7585. };
  7586. }
  7587. function Re(e) {
  7588. return ne(N$1(e)).left + Be(e).scrollLeft;
  7589. }
  7590. function Xt(e, t) {
  7591. var n = B(e), r = N$1(e), o = n.visualViewport, a = r.clientWidth, c = r.clientHeight, s = 0, i = 0;
  7592. if (o) {
  7593. a = o.width, c = o.height;
  7594. var f = at();
  7595. (f || !f && t === "fixed") && (s = o.offsetLeft, i = o.offsetTop);
  7596. }
  7597. return {
  7598. width: a,
  7599. height: c,
  7600. x: s + Re(e),
  7601. y: i
  7602. };
  7603. }
  7604. function Yt(e) {
  7605. var t, n = N$1(e), r = Be(e), o = (t = e.ownerDocument) == null ? void 0 : t.body, a = J(n.scrollWidth, n.clientWidth, o ? o.scrollWidth : 0, o ? o.clientWidth : 0), c = J(n.scrollHeight, n.clientHeight, o ? o.scrollHeight : 0, o ? o.clientHeight : 0), s = -r.scrollLeft + Re(e), i = -r.scrollTop;
  7606. return I$1(o || n).direction === "rtl" && (s += J(n.clientWidth, o ? o.clientWidth : 0) - a), {
  7607. width: a,
  7608. height: c,
  7609. x: s,
  7610. y: i
  7611. };
  7612. }
  7613. function He(e) {
  7614. var t = I$1(e), n = t.overflow, r = t.overflowX, o = t.overflowY;
  7615. return /auto|scroll|overlay|hidden/.test(n + o + r);
  7616. }
  7617. function mt(e) {
  7618. return [
  7619. "html",
  7620. "body",
  7621. "#document"
  7622. ].indexOf(V(e)) >= 0 ? e.ownerDocument.body : R(e) && He(e) ? e : mt(ye(e));
  7623. }
  7624. function ce(e, t) {
  7625. var n;
  7626. t === void 0 && (t = []);
  7627. var r = mt(e), o = r === ((n = e.ownerDocument) == null ? void 0 : n.body), a = B(r), c = o ? [a].concat(a.visualViewport || [], He(r) ? r : []) : r, s = t.concat(c);
  7628. return o ? s : s.concat(ce(ye(c)));
  7629. }
  7630. function Se(e) {
  7631. return Object.assign({}, e, {
  7632. left: e.x,
  7633. top: e.y,
  7634. right: e.x + e.width,
  7635. bottom: e.y + e.height
  7636. });
  7637. }
  7638. function Gt(e, t) {
  7639. var n = ne(e, !1, t === "fixed");
  7640. return n.top = n.top + e.clientTop, n.left = n.left + e.clientLeft, n.bottom = n.top + e.clientHeight, n.right = n.left + e.clientWidth, n.width = e.clientWidth, n.height = e.clientHeight, n.x = n.left, n.y = n.top, n;
  7641. }
  7642. function vt(e, t, n) {
  7643. return t === je ? Se(Xt(e, n)) : G(t) ? Gt(t, n) : Se(Yt(N$1(e)));
  7644. }
  7645. function Jt(e) {
  7646. var t = ce(ye(e)), r = ["absolute", "fixed"].indexOf(I$1(e).position) >= 0 && R(e) ? se(e) : e;
  7647. return G(r) ? t.filter(function(o) {
  7648. return G(o) && st(o, r) && V(o) !== "body";
  7649. }) : [];
  7650. }
  7651. function Kt(e, t, n, r) {
  7652. var o = t === "clippingParents" ? Jt(e) : [].concat(t), a = [].concat(o, [n]), c = a[0], s = a.reduce(function(i, f) {
  7653. var u = vt(e, f, r);
  7654. return i.top = J(u.top, i.top), i.right = ve(u.right, i.right), i.bottom = ve(u.bottom, i.bottom), i.left = J(u.left, i.left), i;
  7655. }, vt(e, c, r));
  7656. return s.width = s.right - s.left, s.height = s.bottom - s.top, s.x = s.left, s.y = s.top, s;
  7657. }
  7658. function yt(e) {
  7659. var t = e.reference, n = e.element, r = e.placement, o = r ? C(r) : null, a = r ? re(r) : null, c = t.x + t.width / 2 - n.width / 2, s = t.y + t.height / 2 - n.height / 2, i;
  7660. switch (o) {
  7661. case L:
  7662. i = {
  7663. x: c,
  7664. y: t.y - n.height
  7665. };
  7666. break;
  7667. case W:
  7668. i = {
  7669. x: c,
  7670. y: t.y + t.height
  7671. };
  7672. break;
  7673. case T$1:
  7674. i = {
  7675. x: t.x + t.width,
  7676. y: s
  7677. };
  7678. break;
  7679. case P$1:
  7680. i = {
  7681. x: t.x - n.width,
  7682. y: s
  7683. };
  7684. break;
  7685. default: i = {
  7686. x: t.x,
  7687. y: t.y
  7688. };
  7689. }
  7690. var f = o ? Me(o) : null;
  7691. if (f != null) {
  7692. var u = f === "y" ? "height" : "width";
  7693. switch (a) {
  7694. case Y$1:
  7695. i[f] = i[f] - (t[u] / 2 - n[u] / 2);
  7696. break;
  7697. case Z:
  7698. i[f] = i[f] + (t[u] / 2 - n[u] / 2);
  7699. break;
  7700. }
  7701. }
  7702. return i;
  7703. }
  7704. function oe(e, t) {
  7705. t === void 0 && (t = {});
  7706. var n = t, r = n.placement, o = r === void 0 ? e.placement : r, a = n.strategy, c = a === void 0 ? e.strategy : a, s = n.boundary, i = s === void 0 ? Ye : s, f = n.rootBoundary, u = f === void 0 ? je : f, m = n.elementContext, h = m === void 0 ? ee : m, l = n.altBoundary, g = l === void 0 ? !1 : l, p = n.padding, y = p === void 0 ? 0 : p, b = ut(typeof y != "number" ? y : pt(y, Q)), x = h === ee ? Ge : ee, O = e.rects.popper, d = e.elements[g ? x : h], v = Kt(G(d) ? d : d.contextElement || N$1(e.elements.popper), i, u, c), w = ne(e.elements.reference), $ = yt({
  7707. reference: w,
  7708. element: O,
  7709. placement: o
  7710. }), j = Se(Object.assign({}, O, $)), D = h === ee ? j : w, E = {
  7711. top: v.top - D.top + b.top,
  7712. bottom: D.bottom - v.bottom + b.bottom,
  7713. left: v.left - D.left + b.left,
  7714. right: D.right - v.right + b.right
  7715. }, A = e.modifiersData.offset;
  7716. if (h === ee && A) {
  7717. var H = A[o];
  7718. Object.keys(E).forEach(function(k) {
  7719. var F = [T$1, W].indexOf(k) >= 0 ? 1 : -1, U = [L, W].indexOf(k) >= 0 ? "y" : "x";
  7720. E[k] += H[U] * F;
  7721. });
  7722. }
  7723. return E;
  7724. }
  7725. function Qt(e, t) {
  7726. t === void 0 && (t = {});
  7727. var n = t, r = n.placement, o = n.boundary, a = n.rootBoundary, c = n.padding, s = n.flipVariations, i = n.allowedAutoPlacements, f = i === void 0 ? Ee : i, u = re(r), m = u ? s ? De : De.filter(function(g) {
  7728. return re(g) === u;
  7729. }) : Q, h = m.filter(function(g) {
  7730. return f.indexOf(g) >= 0;
  7731. });
  7732. h.length === 0 && (h = m);
  7733. var l = h.reduce(function(g, p) {
  7734. return g[p] = oe(e, {
  7735. placement: p,
  7736. boundary: o,
  7737. rootBoundary: a,
  7738. padding: c
  7739. })[C(p)], g;
  7740. }, {});
  7741. return Object.keys(l).sort(function(g, p) {
  7742. return l[g] - l[p];
  7743. });
  7744. }
  7745. function Zt(e) {
  7746. if (C(e) === me) return [];
  7747. var t = be(e);
  7748. return [
  7749. ht(e),
  7750. t,
  7751. ht(t)
  7752. ];
  7753. }
  7754. function en(e) {
  7755. var t = e.state, n = e.options, r = e.name;
  7756. if (!t.modifiersData[r]._skip) {
  7757. for (var o = n.mainAxis, a = o === void 0 ? !0 : o, c = n.altAxis, s = c === void 0 ? !0 : c, i = n.fallbackPlacements, f = n.padding, u = n.boundary, m = n.rootBoundary, h = n.altBoundary, l = n.flipVariations, g = l === void 0 ? !0 : l, p = n.allowedAutoPlacements, y = t.options.placement, x = C(y) === y, O = i || (x || !g ? [be(y)] : Zt(y)), d = [y].concat(O).reduce(function(z, q) {
  7758. return z.concat(C(q) === me ? Qt(t, {
  7759. placement: q,
  7760. boundary: u,
  7761. rootBoundary: m,
  7762. padding: f,
  7763. flipVariations: g,
  7764. allowedAutoPlacements: p
  7765. }) : q);
  7766. }, []), v = t.rects.reference, w = t.rects.popper, $ = /* @__PURE__ */ new Map(), j = !0, D = d[0], E = 0; E < d.length; E++) {
  7767. var A = d[E], H = C(A), k = re(A) === Y$1, F = [L, W].indexOf(H) >= 0, U = F ? "width" : "height", M = oe(t, {
  7768. placement: A,
  7769. boundary: u,
  7770. rootBoundary: m,
  7771. altBoundary: h,
  7772. padding: f
  7773. }), S = F ? k ? T$1 : P$1 : k ? W : L;
  7774. v[U] > w[U] && (S = be(S));
  7775. var ue = be(S), _ = [];
  7776. if (a && _.push(M[H] <= 0), s && _.push(M[S] <= 0, M[ue] <= 0), _.every(function(z) {
  7777. return z;
  7778. })) {
  7779. D = A, j = !1;
  7780. break;
  7781. }
  7782. $.set(A, _);
  7783. }
  7784. if (j) {
  7785. for (var pe = g ? 3 : 1, xe = function(z) {
  7786. var q = d.find(function(de) {
  7787. var ae = $.get(de);
  7788. if (ae) return ae.slice(0, z).every(function(K) {
  7789. return K;
  7790. });
  7791. });
  7792. if (q) return D = q, "break";
  7793. }, ie = pe; ie > 0; ie--) if (xe(ie) === "break") break;
  7794. }
  7795. t.placement !== D && (t.modifiersData[r]._skip = !0, t.placement = D, t.reset = !0);
  7796. }
  7797. }
  7798. var gt = {
  7799. name: "flip",
  7800. enabled: !0,
  7801. phase: "main",
  7802. fn: en,
  7803. requiresIfExists: ["offset"],
  7804. data: { _skip: !1 }
  7805. };
  7806. function bt(e, t, n) {
  7807. return n === void 0 && (n = {
  7808. x: 0,
  7809. y: 0
  7810. }), {
  7811. top: e.top - t.height - n.y,
  7812. right: e.right - t.width + n.x,
  7813. bottom: e.bottom - t.height + n.y,
  7814. left: e.left - t.width - n.x
  7815. };
  7816. }
  7817. function wt(e) {
  7818. return [
  7819. L,
  7820. T$1,
  7821. W,
  7822. P$1
  7823. ].some(function(t) {
  7824. return e[t] >= 0;
  7825. });
  7826. }
  7827. function tn(e) {
  7828. var t = e.state, n = e.name, r = t.rects.reference, o = t.rects.popper, a = t.modifiersData.preventOverflow, c = oe(t, { elementContext: "reference" }), s = oe(t, { altBoundary: !0 }), i = bt(c, r), f = bt(s, o, a), u = wt(i), m = wt(f);
  7829. t.modifiersData[n] = {
  7830. referenceClippingOffsets: i,
  7831. popperEscapeOffsets: f,
  7832. isReferenceHidden: u,
  7833. hasPopperEscaped: m
  7834. }, t.attributes.popper = Object.assign({}, t.attributes.popper, {
  7835. "data-popper-reference-hidden": u,
  7836. "data-popper-escaped": m
  7837. });
  7838. }
  7839. var xt = {
  7840. name: "hide",
  7841. enabled: !0,
  7842. phase: "main",
  7843. requiresIfExists: ["preventOverflow"],
  7844. fn: tn
  7845. };
  7846. function nn(e, t, n) {
  7847. var r = C(e), o = [P$1, L].indexOf(r) >= 0 ? -1 : 1, a = typeof n == "function" ? n(Object.assign({}, t, { placement: e })) : n, c = a[0], s = a[1];
  7848. return c = c || 0, s = (s || 0) * o, [P$1, T$1].indexOf(r) >= 0 ? {
  7849. x: s,
  7850. y: c
  7851. } : {
  7852. x: c,
  7853. y: s
  7854. };
  7855. }
  7856. function rn(e) {
  7857. var t = e.state, n = e.options, r = e.name, o = n.offset, a = o === void 0 ? [0, 0] : o, c = Ee.reduce(function(u, m) {
  7858. return u[m] = nn(m, t.rects, a), u;
  7859. }, {}), s = c[t.placement], i = s.x, f = s.y;
  7860. t.modifiersData.popperOffsets != null && (t.modifiersData.popperOffsets.x += i, t.modifiersData.popperOffsets.y += f), t.modifiersData[r] = c;
  7861. }
  7862. var Ot = {
  7863. name: "offset",
  7864. enabled: !0,
  7865. phase: "main",
  7866. requires: ["popperOffsets"],
  7867. fn: rn
  7868. };
  7869. function on(e) {
  7870. var t = e.state, n = e.name;
  7871. t.modifiersData[n] = yt({
  7872. reference: t.rects.reference,
  7873. element: t.rects.popper,
  7874. placement: t.placement
  7875. });
  7876. }
  7877. var Ve = {
  7878. name: "popperOffsets",
  7879. enabled: !0,
  7880. phase: "read",
  7881. fn: on,
  7882. data: {}
  7883. };
  7884. function an(e) {
  7885. return e === "x" ? "y" : "x";
  7886. }
  7887. function sn(e) {
  7888. var t = e.state, n = e.options, r = e.name, o = n.mainAxis, a = o === void 0 ? !0 : o, c = n.altAxis, s = c === void 0 ? !1 : c, i = n.boundary, f = n.rootBoundary, u = n.altBoundary, m = n.padding, h = n.tether, l = h === void 0 ? !0 : h, g = n.tetherOffset, p = g === void 0 ? 0 : g, y = oe(t, {
  7889. boundary: i,
  7890. rootBoundary: f,
  7891. padding: m,
  7892. altBoundary: u
  7893. }), b = C(t.placement), x = re(t.placement), O = !x, d = Me(b), v = an(d), w = t.modifiersData.popperOffsets, $ = t.rects.reference, j = t.rects.popper, D = typeof p == "function" ? p(Object.assign({}, t.rects, { placement: t.placement })) : p, E = typeof D == "number" ? {
  7894. mainAxis: D,
  7895. altAxis: D
  7896. } : Object.assign({
  7897. mainAxis: 0,
  7898. altAxis: 0
  7899. }, D), A = t.modifiersData.offset ? t.modifiersData.offset[t.placement] : null, H = {
  7900. x: 0,
  7901. y: 0
  7902. };
  7903. if (w) {
  7904. if (a) {
  7905. var k, F = d === "y" ? L : P$1, U = d === "y" ? W : T$1, M = d === "y" ? "height" : "width", S = w[d], ue = S + y[F], _ = S - y[U], pe = l ? -j[M] / 2 : 0, xe = x === Y$1 ? $[M] : j[M], ie = x === Y$1 ? -j[M] : -$[M], le = t.elements.arrow, z = l && le ? Pe(le) : {
  7906. width: 0,
  7907. height: 0
  7908. }, q = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : ct(), de = q[F], ae = q[U], K = fe(0, $[M], z[M]), Et = O ? $[M] / 2 - pe - K - de - E.mainAxis : xe - K - de - E.mainAxis, At = O ? -$[M] / 2 + pe + K + ae + E.mainAxis : ie + K + ae + E.mainAxis, Oe = t.elements.arrow && se(t.elements.arrow), kt = Oe ? d === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Ce = (k = A == null ? void 0 : A[d]) != null ? k : 0, Lt = S + Et - Ce - kt, Pt = S + At - Ce, qe = fe(l ? ve(ue, Lt) : ue, S, l ? J(_, Pt) : _);
  7909. w[d] = qe, H[d] = qe - S;
  7910. }
  7911. if (s) {
  7912. var Ie, Mt = d === "x" ? L : P$1, Wt = d === "x" ? W : T$1, X = w[v], he = v === "y" ? "height" : "width", Ne = X + y[Mt], Fe = X - y[Wt], $e = [L, P$1].indexOf(b) !== -1, Ue = (Ie = A == null ? void 0 : A[v]) != null ? Ie : 0, _e = $e ? Ne : X - $[he] - j[he] - Ue + E.altAxis, ze = $e ? X + $[he] + j[he] - Ue - E.altAxis : Fe, Xe = l && $e ? St(_e, X, ze) : fe(l ? _e : Ne, X, l ? ze : Fe);
  7913. w[v] = Xe, H[v] = Xe - X;
  7914. }
  7915. t.modifiersData[r] = H;
  7916. }
  7917. }
  7918. var $t = {
  7919. name: "preventOverflow",
  7920. enabled: !0,
  7921. phase: "main",
  7922. fn: sn,
  7923. requiresIfExists: ["offset"]
  7924. };
  7925. function fn(e) {
  7926. return {
  7927. scrollLeft: e.scrollLeft,
  7928. scrollTop: e.scrollTop
  7929. };
  7930. }
  7931. function cn(e) {
  7932. return e === B(e) || !R(e) ? Be(e) : fn(e);
  7933. }
  7934. function un(e) {
  7935. var t = e.getBoundingClientRect(), n = te(t.width) / e.offsetWidth || 1, r = te(t.height) / e.offsetHeight || 1;
  7936. return n !== 1 || r !== 1;
  7937. }
  7938. function pn(e, t, n) {
  7939. n === void 0 && (n = !1);
  7940. var r = R(t), o = R(t) && un(t), a = N$1(t), c = ne(e, o, n), s = {
  7941. scrollLeft: 0,
  7942. scrollTop: 0
  7943. }, i = {
  7944. x: 0,
  7945. y: 0
  7946. };
  7947. return (r || !r && !n) && ((V(t) !== "body" || He(a)) && (s = cn(t)), R(t) ? (i = ne(t, !0), i.x += t.clientLeft, i.y += t.clientTop) : a && (i.x = Re(a))), {
  7948. x: c.left + s.scrollLeft - i.x,
  7949. y: c.top + s.scrollTop - i.y,
  7950. width: c.width,
  7951. height: c.height
  7952. };
  7953. }
  7954. function ln(e) {
  7955. var t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [];
  7956. e.forEach(function(a) {
  7957. t.set(a.name, a);
  7958. });
  7959. function o(a) {
  7960. n.add(a.name);
  7961. [].concat(a.requires || [], a.requiresIfExists || []).forEach(function(s) {
  7962. if (!n.has(s)) {
  7963. var i = t.get(s);
  7964. i && o(i);
  7965. }
  7966. }), r.push(a);
  7967. }
  7968. return e.forEach(function(a) {
  7969. n.has(a.name) || o(a);
  7970. }), r;
  7971. }
  7972. function dn(e) {
  7973. var t = ln(e);
  7974. return it.reduce(function(n, r) {
  7975. return n.concat(t.filter(function(o) {
  7976. return o.phase === r;
  7977. }));
  7978. }, []);
  7979. }
  7980. function hn(e) {
  7981. var t;
  7982. return function() {
  7983. return t || (t = new Promise(function(n) {
  7984. Promise.resolve().then(function() {
  7985. t = void 0, n(e());
  7986. });
  7987. })), t;
  7988. };
  7989. }
  7990. function mn(e) {
  7991. var t = e.reduce(function(n, r) {
  7992. var o = n[r.name];
  7993. return n[r.name] = o ? Object.assign({}, o, r, {
  7994. options: Object.assign({}, o.options, r.options),
  7995. data: Object.assign({}, o.data, r.data)
  7996. }) : r, n;
  7997. }, {});
  7998. return Object.keys(t).map(function(n) {
  7999. return t[n];
  8000. });
  8001. }
  8002. var jt = {
  8003. placement: "bottom",
  8004. modifiers: [],
  8005. strategy: "absolute"
  8006. };
  8007. function Dt() {
  8008. for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];
  8009. return !t.some(function(r) {
  8010. return !(r && typeof r.getBoundingClientRect == "function");
  8011. });
  8012. }
  8013. function we(e) {
  8014. e === void 0 && (e = {});
  8015. var t = e, n = t.defaultModifiers, r = n === void 0 ? [] : n, o = t.defaultOptions, a = o === void 0 ? jt : o;
  8016. return function(c, s, i) {
  8017. i === void 0 && (i = a);
  8018. var f = {
  8019. placement: "bottom",
  8020. orderedModifiers: [],
  8021. options: Object.assign({}, jt, a),
  8022. modifiersData: {},
  8023. elements: {
  8024. reference: c,
  8025. popper: s
  8026. },
  8027. attributes: {},
  8028. styles: {}
  8029. }, u = [], m = !1, h = {
  8030. state: f,
  8031. setOptions: function(p) {
  8032. var y = typeof p == "function" ? p(f.options) : p;
  8033. g(), f.options = Object.assign({}, a, f.options, y), f.scrollParents = {
  8034. reference: G(c) ? ce(c) : c.contextElement ? ce(c.contextElement) : [],
  8035. popper: ce(s)
  8036. };
  8037. var b = dn(mn([].concat(r, f.options.modifiers)));
  8038. return f.orderedModifiers = b.filter(function(x) {
  8039. return x.enabled;
  8040. }), l(), h.update();
  8041. },
  8042. forceUpdate: function() {
  8043. if (!m) {
  8044. var p = f.elements, y = p.reference, b = p.popper;
  8045. if (Dt(y, b)) {
  8046. f.rects = {
  8047. reference: pn(y, se(b), f.options.strategy === "fixed"),
  8048. popper: Pe(b)
  8049. }, f.reset = !1, f.placement = f.options.placement, f.orderedModifiers.forEach(function(j) {
  8050. return f.modifiersData[j.name] = Object.assign({}, j.data);
  8051. });
  8052. for (var x = 0; x < f.orderedModifiers.length; x++) {
  8053. if (f.reset === !0) {
  8054. f.reset = !1, x = -1;
  8055. continue;
  8056. }
  8057. var O = f.orderedModifiers[x], d = O.fn, v = O.options, w = v === void 0 ? {} : v, $ = O.name;
  8058. typeof d == "function" && (f = d({
  8059. state: f,
  8060. options: w,
  8061. name: $,
  8062. instance: h
  8063. }) || f);
  8064. }
  8065. }
  8066. }
  8067. },
  8068. update: hn(function() {
  8069. return new Promise(function(p) {
  8070. h.forceUpdate(), p(f);
  8071. });
  8072. }),
  8073. destroy: function() {
  8074. g(), m = !0;
  8075. }
  8076. };
  8077. if (!Dt(c, s)) return h;
  8078. h.setOptions(i).then(function(p) {
  8079. !m && i.onFirstUpdate && i.onFirstUpdate(p);
  8080. });
  8081. function l() {
  8082. f.orderedModifiers.forEach(function(p) {
  8083. var y = p.name, b = p.options, x = b === void 0 ? {} : b, O = p.effect;
  8084. if (typeof O == "function") {
  8085. var d = O({
  8086. state: f,
  8087. name: y,
  8088. instance: h,
  8089. options: x
  8090. }), v = function() {};
  8091. u.push(d || v);
  8092. }
  8093. });
  8094. }
  8095. function g() {
  8096. u.forEach(function(p) {
  8097. return p();
  8098. }), u = [];
  8099. }
  8100. return h;
  8101. };
  8102. }
  8103. var vn = we(), gn = we({ defaultModifiers: [
  8104. Te,
  8105. Ve,
  8106. We,
  8107. ke
  8108. ] }), wn = we({ defaultModifiers: [
  8109. Te,
  8110. Ve,
  8111. We,
  8112. ke,
  8113. Ot,
  8114. gt,
  8115. $t,
  8116. lt,
  8117. xt
  8118. ] });
  8119. //#endregion
  8120. //#region ../../packages/hooks/use-popper/index.ts
  8121. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  8122. const stateUpdater = {
  8123. name: "updateState",
  8124. enabled: true,
  8125. phase: "write",
  8126. fn: ({ state }) => {
  8127. const derivedState = deriveState(state);
  8128. Object.assign(states.value, derivedState);
  8129. },
  8130. requires: ["computeStyles"]
  8131. };
  8132. const options = computed(() => {
  8133. const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
  8134. return {
  8135. onFirstUpdate,
  8136. placement: placement || "bottom",
  8137. strategy: strategy || "absolute",
  8138. modifiers: [
  8139. ...modifiers || [],
  8140. stateUpdater,
  8141. {
  8142. name: "applyStyles",
  8143. enabled: false
  8144. }
  8145. ]
  8146. };
  8147. });
  8148. const instanceRef = shallowRef();
  8149. const states = ref({
  8150. styles: {
  8151. popper: {
  8152. position: unref(options).strategy,
  8153. left: "0",
  8154. top: "0"
  8155. },
  8156. arrow: { position: "absolute" }
  8157. },
  8158. attributes: {}
  8159. });
  8160. const destroy = () => {
  8161. if (!instanceRef.value) return;
  8162. instanceRef.value.destroy();
  8163. instanceRef.value = void 0;
  8164. };
  8165. watch(options, (newOptions) => {
  8166. const instance = unref(instanceRef);
  8167. if (instance) instance.setOptions(newOptions);
  8168. }, { deep: true });
  8169. watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  8170. destroy();
  8171. if (!referenceElement || !popperElement) return;
  8172. instanceRef.value = wn(referenceElement, popperElement, unref(options));
  8173. });
  8174. onBeforeUnmount(() => {
  8175. destroy();
  8176. });
  8177. return {
  8178. state: computed(() => ({ ...unref(instanceRef)?.state || {} })),
  8179. styles: computed(() => unref(states).styles),
  8180. attributes: computed(() => unref(states).attributes),
  8181. update: () => unref(instanceRef)?.update(),
  8182. forceUpdate: () => unref(instanceRef)?.forceUpdate(),
  8183. instanceRef: computed(() => unref(instanceRef))
  8184. };
  8185. };
  8186. function deriveState(state) {
  8187. const elements = Object.keys(state.elements);
  8188. return {
  8189. styles: fromPairs(elements.map((element) => [element, state.styles[element] || {}])),
  8190. attributes: fromPairs(elements.map((element) => [element, state.attributes[element]]))
  8191. };
  8192. }
  8193. //#endregion
  8194. //#region ../../packages/hooks/use-same-target/index.ts
  8195. const useSameTarget = (handleClick) => {
  8196. if (!handleClick) return {
  8197. onClick: NOOP,
  8198. onMousedown: NOOP,
  8199. onMouseup: NOOP
  8200. };
  8201. let mousedownTarget = false;
  8202. let mouseupTarget = false;
  8203. const onClick = (e) => {
  8204. if (mousedownTarget && mouseupTarget) handleClick(e);
  8205. mousedownTarget = mouseupTarget = false;
  8206. };
  8207. const onMousedown = (e) => {
  8208. mousedownTarget = e.target === e.currentTarget;
  8209. };
  8210. const onMouseup = (e) => {
  8211. mouseupTarget = e.target === e.currentTarget;
  8212. };
  8213. return {
  8214. onClick,
  8215. onMousedown,
  8216. onMouseup
  8217. };
  8218. };
  8219. //#endregion
  8220. //#region ../../packages/hooks/use-teleport/index.ts
  8221. const useTeleport = (contentRenderer, appendToBody) => {
  8222. const isTeleportVisible = ref(false);
  8223. if (!isClient) return {
  8224. isTeleportVisible,
  8225. showTeleport: NOOP,
  8226. hideTeleport: NOOP,
  8227. renderTeleport: NOOP
  8228. };
  8229. let $el = null;
  8230. const showTeleport = () => {
  8231. isTeleportVisible.value = true;
  8232. if ($el !== null) return;
  8233. $el = createGlobalNode();
  8234. };
  8235. const hideTeleport = () => {
  8236. isTeleportVisible.value = false;
  8237. if ($el !== null) {
  8238. removeGlobalNode($el);
  8239. $el = null;
  8240. }
  8241. };
  8242. const renderTeleport = () => {
  8243. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [h(Teleport, { to: $el }, contentRenderer())] : void 0;
  8244. };
  8245. onUnmounted(hideTeleport);
  8246. return {
  8247. isTeleportVisible,
  8248. showTeleport,
  8249. hideTeleport,
  8250. renderTeleport
  8251. };
  8252. };
  8253. //#endregion
  8254. //#region ../../packages/hooks/use-throttle-render/index.ts
  8255. const useThrottleRender = (loading, throttle = 0) => {
  8256. if (throttle === 0) return loading;
  8257. const throttled = ref(isObject$1(throttle) && Boolean(throttle.initVal));
  8258. let timeoutHandle = null;
  8259. const dispatchThrottling = (timer) => {
  8260. if (isUndefined(timer)) {
  8261. throttled.value = loading.value;
  8262. return;
  8263. }
  8264. if (timeoutHandle) clearTimeout(timeoutHandle);
  8265. timeoutHandle = setTimeout(() => {
  8266. throttled.value = loading.value;
  8267. }, timer);
  8268. };
  8269. const dispatcher = (type) => {
  8270. if (type === "leading") if (isNumber(throttle)) dispatchThrottling(throttle);
  8271. else dispatchThrottling(throttle.leading);
  8272. else if (isObject$1(throttle)) dispatchThrottling(throttle.trailing);
  8273. else throttled.value = false;
  8274. };
  8275. onMounted(() => dispatcher("leading"));
  8276. watch(() => loading.value, (val) => {
  8277. dispatcher(val ? "leading" : "trailing");
  8278. });
  8279. return throttled;
  8280. };
  8281. //#endregion
  8282. //#region ../../packages/hooks/use-timeout/index.ts
  8283. function useTimeout() {
  8284. let timeoutHandle;
  8285. const registerTimeout = (fn, delay) => {
  8286. cancelTimeout();
  8287. timeoutHandle = window.setTimeout(fn, delay);
  8288. };
  8289. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  8290. tryOnScopeDispose(() => cancelTimeout());
  8291. return {
  8292. registerTimeout,
  8293. cancelTimeout
  8294. };
  8295. }
  8296. //#endregion
  8297. //#region ../../packages/hooks/use-transition-fallthrough/index.ts
  8298. /* istanbul ignore file */
  8299. const AFTER_APPEAR = "after-appear";
  8300. const AFTER_ENTER = "after-enter";
  8301. const AFTER_LEAVE = "after-leave";
  8302. const APPEAR = "appear";
  8303. const APPEAR_CANCELLED = "appear-cancelled";
  8304. const BEFORE_ENTER = "before-enter";
  8305. const BEFORE_LEAVE = "before-leave";
  8306. const ENTER = "enter";
  8307. const ENTER_CANCELLED = "enter-cancelled";
  8308. const LEAVE = "leave";
  8309. const LEAVE_CANCELLED = "leave-cancelled";
  8310. const useTransitionFallthroughEmits = [
  8311. AFTER_APPEAR,
  8312. AFTER_ENTER,
  8313. AFTER_LEAVE,
  8314. APPEAR,
  8315. APPEAR_CANCELLED,
  8316. BEFORE_ENTER,
  8317. BEFORE_LEAVE,
  8318. ENTER,
  8319. ENTER_CANCELLED,
  8320. LEAVE,
  8321. LEAVE_CANCELLED
  8322. ];
  8323. /**
  8324. * NOTE:
  8325. * This is only a delegator for delegating transition callbacks.
  8326. * Use this at your need.
  8327. */
  8328. /**
  8329. * Simple usage
  8330. *
  8331. * In your setups:
  8332. *
  8333. * setup() {
  8334. * const fallthroughMethods = useTransitionFallthrough()
  8335. * return fallthrough
  8336. * }
  8337. *
  8338. * In your template:
  8339. *
  8340. * <template>
  8341. * <transition name="whatever" v-bind="fallthrough">
  8342. * <slot />
  8343. * </transition>
  8344. * </template>
  8345. *
  8346. */
  8347. const useTransitionFallthrough = () => {
  8348. const { emit } = getCurrentInstance();
  8349. return {
  8350. onAfterAppear: () => {
  8351. emit(AFTER_APPEAR);
  8352. },
  8353. onAfterEnter: () => {
  8354. emit(AFTER_ENTER);
  8355. },
  8356. onAfterLeave: () => {
  8357. emit(AFTER_LEAVE);
  8358. },
  8359. onAppearCancelled: () => {
  8360. emit(APPEAR_CANCELLED);
  8361. },
  8362. onBeforeEnter: () => {
  8363. emit(BEFORE_ENTER);
  8364. },
  8365. onBeforeLeave: () => {
  8366. emit(BEFORE_LEAVE);
  8367. },
  8368. onEnter: () => {
  8369. emit(ENTER);
  8370. },
  8371. onEnterCancelled: () => {
  8372. emit(ENTER_CANCELLED);
  8373. },
  8374. onLeave: () => {
  8375. emit(LEAVE);
  8376. },
  8377. onLeaveCancelled: () => {
  8378. emit(LEAVE_CANCELLED);
  8379. }
  8380. };
  8381. };
  8382. //#endregion
  8383. //#region ../../packages/hooks/use-id/index.ts
  8384. const defaultIdInjection = {
  8385. prefix: Math.floor(Math.random() * 1e4),
  8386. current: 0
  8387. };
  8388. const ID_INJECTION_KEY = Symbol("elIdInjection");
  8389. const useIdInjection = () => {
  8390. return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  8391. };
  8392. const useId = (deterministicId) => {
  8393. const idInjection = useIdInjection();
  8394. if (!isClient && idInjection === defaultIdInjection) /* @__PURE__ */ debugWarn("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
  8395. usage: app.provide(ID_INJECTION_KEY, {
  8396. prefix: number,
  8397. current: number,
  8398. })`);
  8399. const namespace = useGetDerivedNamespace();
  8400. return computedEager(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  8401. };
  8402. //#endregion
  8403. //#region ../../packages/hooks/use-escape-keydown/index.ts
  8404. let registeredEscapeHandlers = [];
  8405. const cachedHandler = (event) => {
  8406. if (getEventCode(event) === EVENT_CODE.esc) registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  8407. };
  8408. const useEscapeKeydown = (handler) => {
  8409. onMounted(() => {
  8410. if (registeredEscapeHandlers.length === 0) document.addEventListener("keydown", cachedHandler);
  8411. if (isClient) registeredEscapeHandlers.push(handler);
  8412. });
  8413. onBeforeUnmount(() => {
  8414. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  8415. if (registeredEscapeHandlers.length === 0) {
  8416. if (isClient) document.removeEventListener("keydown", cachedHandler);
  8417. }
  8418. });
  8419. };
  8420. //#endregion
  8421. //#region ../../packages/hooks/use-popper-container/index.ts
  8422. const usePopperContainerId = () => {
  8423. const namespace = useGetDerivedNamespace();
  8424. const idInjection = useIdInjection();
  8425. const id = computed(() => {
  8426. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  8427. });
  8428. return {
  8429. id,
  8430. selector: computed(() => `#${id.value}`)
  8431. };
  8432. };
  8433. const createContainer = (id) => {
  8434. const container = document.createElement("div");
  8435. container.id = id;
  8436. document.body.appendChild(container);
  8437. return container;
  8438. };
  8439. const usePopperContainer = () => {
  8440. const { id, selector } = usePopperContainerId();
  8441. onBeforeMount(() => {
  8442. if (!isClient) return;
  8443. if (!document.body.querySelector(selector.value)) createContainer(id.value);
  8444. });
  8445. return {
  8446. id,
  8447. selector
  8448. };
  8449. };
  8450. //#endregion
  8451. //#region ../../packages/hooks/use-intermediate-render/index.ts
  8452. const useDelayedRender = ({ indicator, intermediateIndicator, shouldSetIntermediate = () => true, beforeShow, afterShow, afterHide, beforeHide }) => {
  8453. watch(() => unref(indicator), (val) => {
  8454. if (val) {
  8455. beforeShow?.();
  8456. nextTick(() => {
  8457. if (!unref(indicator)) return;
  8458. if (shouldSetIntermediate("show")) intermediateIndicator.value = true;
  8459. });
  8460. } else {
  8461. beforeHide?.();
  8462. nextTick(() => {
  8463. if (unref(indicator)) return;
  8464. if (shouldSetIntermediate("hide")) intermediateIndicator.value = false;
  8465. });
  8466. }
  8467. });
  8468. watch(() => intermediateIndicator.value, (val) => {
  8469. if (val) afterShow?.();
  8470. else afterHide?.();
  8471. });
  8472. };
  8473. //#endregion
  8474. //#region ../../packages/hooks/use-delayed-toggle/index.ts
  8475. /**
  8476. * @deprecated Removed after 3.0.0, Use `UseDelayedToggleProps` instead.
  8477. */
  8478. const useDelayedToggleProps = buildProps({
  8479. showAfter: {
  8480. type: Number,
  8481. default: 0
  8482. },
  8483. hideAfter: {
  8484. type: Number,
  8485. default: 200
  8486. },
  8487. autoClose: {
  8488. type: Number,
  8489. default: 0
  8490. }
  8491. });
  8492. const useDelayedTogglePropsDefaults = {
  8493. showAfter: 0,
  8494. hideAfter: 200,
  8495. autoClose: 0
  8496. };
  8497. const useDelayedToggle = ({ showAfter, hideAfter, autoClose, open, close }) => {
  8498. const { registerTimeout } = useTimeout();
  8499. const { registerTimeout: registerTimeoutForAutoClose, cancelTimeout: cancelTimeoutForAutoClose } = useTimeout();
  8500. const onOpen = (event, delay = unref(showAfter)) => {
  8501. registerTimeout(() => {
  8502. open(event);
  8503. const _autoClose = unref(autoClose);
  8504. if (isNumber(_autoClose) && _autoClose > 0) registerTimeoutForAutoClose(() => {
  8505. close(event);
  8506. }, _autoClose);
  8507. }, delay);
  8508. };
  8509. const onClose = (event, delay = unref(hideAfter)) => {
  8510. cancelTimeoutForAutoClose();
  8511. registerTimeout(() => {
  8512. close(event);
  8513. }, delay);
  8514. };
  8515. return {
  8516. onOpen,
  8517. onClose
  8518. };
  8519. };
  8520. //#endregion
  8521. //#region ../../packages/hooks/use-forward-ref/index.ts
  8522. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  8523. const useForwardRef = (forwardRef) => {
  8524. const setForwardRef = ((el) => {
  8525. forwardRef.value = el;
  8526. });
  8527. provide(FORWARD_REF_INJECTION_KEY, { setForwardRef });
  8528. };
  8529. const useForwardRefDirective = (setForwardRef) => {
  8530. return {
  8531. mounted(el) {
  8532. setForwardRef(el);
  8533. },
  8534. updated(el) {
  8535. setForwardRef(el);
  8536. },
  8537. unmounted() {
  8538. setForwardRef(null);
  8539. }
  8540. };
  8541. };
  8542. //#endregion
  8543. //#region ../../packages/hooks/use-z-index/index.ts
  8544. const initial = { current: 0 };
  8545. const zIndex = ref(0);
  8546. const defaultInitialZIndex = 2e3;
  8547. const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
  8548. const zIndexContextKey = Symbol("zIndexContextKey");
  8549. const useZIndex = (zIndexOverrides) => {
  8550. const increasingInjection = getCurrentInstance() ? inject(ZINDEX_INJECTION_KEY, initial) : initial;
  8551. const zIndexInjection = zIndexOverrides || (getCurrentInstance() ? inject(zIndexContextKey, void 0) : void 0);
  8552. const initialZIndex = computed(() => {
  8553. const zIndexFromInjection = unref(zIndexInjection);
  8554. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  8555. });
  8556. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  8557. const nextZIndex = () => {
  8558. increasingInjection.current++;
  8559. zIndex.value = increasingInjection.current;
  8560. return currentZIndex.value;
  8561. };
  8562. if (!isClient && !inject(ZINDEX_INJECTION_KEY)) /* @__PURE__ */ debugWarn("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
  8563. usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`);
  8564. return {
  8565. initialZIndex,
  8566. currentZIndex,
  8567. nextZIndex
  8568. };
  8569. };
  8570. //#endregion
  8571. //#region ../../node_modules/.pnpm/@floating-ui+utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
  8572. const min$1 = Math.min;
  8573. const max$1 = Math.max;
  8574. const round = Math.round;
  8575. const floor$1 = Math.floor;
  8576. const createCoords = (v) => ({
  8577. x: v,
  8578. y: v
  8579. });
  8580. const oppositeSideMap = {
  8581. left: "right",
  8582. right: "left",
  8583. bottom: "top",
  8584. top: "bottom"
  8585. };
  8586. const oppositeAlignmentMap = {
  8587. start: "end",
  8588. end: "start"
  8589. };
  8590. function clamp(start, value, end) {
  8591. return max$1(start, min$1(value, end));
  8592. }
  8593. function evaluate(value, param) {
  8594. return typeof value === "function" ? value(param) : value;
  8595. }
  8596. function getSide(placement) {
  8597. return placement.split("-")[0];
  8598. }
  8599. function getAlignment(placement) {
  8600. return placement.split("-")[1];
  8601. }
  8602. function getOppositeAxis(axis) {
  8603. return axis === "x" ? "y" : "x";
  8604. }
  8605. function getAxisLength(axis) {
  8606. return axis === "y" ? "height" : "width";
  8607. }
  8608. const yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
  8609. function getSideAxis(placement) {
  8610. return yAxisSides.has(getSide(placement)) ? "y" : "x";
  8611. }
  8612. function getAlignmentAxis(placement) {
  8613. return getOppositeAxis(getSideAxis(placement));
  8614. }
  8615. function getAlignmentSides(placement, rects, rtl) {
  8616. if (rtl === void 0) rtl = false;
  8617. const alignment = getAlignment(placement);
  8618. const alignmentAxis = getAlignmentAxis(placement);
  8619. const length = getAxisLength(alignmentAxis);
  8620. let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
  8621. if (rects.reference[length] > rects.floating[length]) mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  8622. return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
  8623. }
  8624. function getExpandedPlacements(placement) {
  8625. const oppositePlacement = getOppositePlacement(placement);
  8626. return [
  8627. getOppositeAlignmentPlacement(placement),
  8628. oppositePlacement,
  8629. getOppositeAlignmentPlacement(oppositePlacement)
  8630. ];
  8631. }
  8632. function getOppositeAlignmentPlacement(placement) {
  8633. return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
  8634. }
  8635. const lrPlacement = ["left", "right"];
  8636. const rlPlacement = ["right", "left"];
  8637. const tbPlacement = ["top", "bottom"];
  8638. const btPlacement = ["bottom", "top"];
  8639. function getSideList(side, isStart, rtl) {
  8640. switch (side) {
  8641. case "top":
  8642. case "bottom":
  8643. if (rtl) return isStart ? rlPlacement : lrPlacement;
  8644. return isStart ? lrPlacement : rlPlacement;
  8645. case "left":
  8646. case "right": return isStart ? tbPlacement : btPlacement;
  8647. default: return [];
  8648. }
  8649. }
  8650. function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
  8651. const alignment = getAlignment(placement);
  8652. let list = getSideList(getSide(placement), direction === "start", rtl);
  8653. if (alignment) {
  8654. list = list.map((side) => side + "-" + alignment);
  8655. if (flipAlignment) list = list.concat(list.map(getOppositeAlignmentPlacement));
  8656. }
  8657. return list;
  8658. }
  8659. function getOppositePlacement(placement) {
  8660. return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
  8661. }
  8662. function expandPaddingObject(padding) {
  8663. return {
  8664. top: 0,
  8665. right: 0,
  8666. bottom: 0,
  8667. left: 0,
  8668. ...padding
  8669. };
  8670. }
  8671. function getPaddingObject(padding) {
  8672. return typeof padding !== "number" ? expandPaddingObject(padding) : {
  8673. top: padding,
  8674. right: padding,
  8675. bottom: padding,
  8676. left: padding
  8677. };
  8678. }
  8679. function rectToClientRect(rect) {
  8680. const { x, y, width, height } = rect;
  8681. return {
  8682. width,
  8683. height,
  8684. top: y,
  8685. left: x,
  8686. right: x + width,
  8687. bottom: y + height,
  8688. x,
  8689. y
  8690. };
  8691. }
  8692. //#endregion
  8693. //#region ../../node_modules/.pnpm/@floating-ui+core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
  8694. function computeCoordsFromPlacement(_ref, placement, rtl) {
  8695. let { reference, floating } = _ref;
  8696. const sideAxis = getSideAxis(placement);
  8697. const alignmentAxis = getAlignmentAxis(placement);
  8698. const alignLength = getAxisLength(alignmentAxis);
  8699. const side = getSide(placement);
  8700. const isVertical = sideAxis === "y";
  8701. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  8702. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  8703. const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
  8704. let coords;
  8705. switch (side) {
  8706. case "top":
  8707. coords = {
  8708. x: commonX,
  8709. y: reference.y - floating.height
  8710. };
  8711. break;
  8712. case "bottom":
  8713. coords = {
  8714. x: commonX,
  8715. y: reference.y + reference.height
  8716. };
  8717. break;
  8718. case "right":
  8719. coords = {
  8720. x: reference.x + reference.width,
  8721. y: commonY
  8722. };
  8723. break;
  8724. case "left":
  8725. coords = {
  8726. x: reference.x - floating.width,
  8727. y: commonY
  8728. };
  8729. break;
  8730. default: coords = {
  8731. x: reference.x,
  8732. y: reference.y
  8733. };
  8734. }
  8735. switch (getAlignment(placement)) {
  8736. case "start":
  8737. coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  8738. break;
  8739. case "end":
  8740. coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  8741. break;
  8742. }
  8743. return coords;
  8744. }
  8745. /**
  8746. * Computes the `x` and `y` coordinates that will place the floating element
  8747. * next to a given reference element.
  8748. *
  8749. * This export does not have any `platform` interface logic. You will need to
  8750. * write one for the platform you are using Floating UI with.
  8751. */
  8752. const computePosition$1 = async (reference, floating, config) => {
  8753. const { placement = "bottom", strategy = "absolute", middleware = [], platform } = config;
  8754. const validMiddleware = middleware.filter(Boolean);
  8755. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  8756. let rects = await platform.getElementRects({
  8757. reference,
  8758. floating,
  8759. strategy
  8760. });
  8761. let { x, y } = computeCoordsFromPlacement(rects, placement, rtl);
  8762. let statefulPlacement = placement;
  8763. let middlewareData = {};
  8764. let resetCount = 0;
  8765. for (let i = 0; i < validMiddleware.length; i++) {
  8766. const { name, fn } = validMiddleware[i];
  8767. const { x: nextX, y: nextY, data, reset } = await fn({
  8768. x,
  8769. y,
  8770. initialPlacement: placement,
  8771. placement: statefulPlacement,
  8772. strategy,
  8773. middlewareData,
  8774. rects,
  8775. platform,
  8776. elements: {
  8777. reference,
  8778. floating
  8779. }
  8780. });
  8781. x = nextX != null ? nextX : x;
  8782. y = nextY != null ? nextY : y;
  8783. middlewareData = {
  8784. ...middlewareData,
  8785. [name]: {
  8786. ...middlewareData[name],
  8787. ...data
  8788. }
  8789. };
  8790. if (reset && resetCount <= 50) {
  8791. resetCount++;
  8792. if (typeof reset === "object") {
  8793. if (reset.placement) statefulPlacement = reset.placement;
  8794. if (reset.rects) rects = reset.rects === true ? await platform.getElementRects({
  8795. reference,
  8796. floating,
  8797. strategy
  8798. }) : reset.rects;
  8799. ({x, y} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  8800. }
  8801. i = -1;
  8802. }
  8803. }
  8804. return {
  8805. x,
  8806. y,
  8807. placement: statefulPlacement,
  8808. strategy,
  8809. middlewareData
  8810. };
  8811. };
  8812. /**
  8813. * Resolves with an object of overflow side offsets that determine how much the
  8814. * element is overflowing a given clipping boundary on each side.
  8815. * - positive = overflowing the boundary by that number of pixels
  8816. * - negative = how many pixels left before it will overflow
  8817. * - 0 = lies flush with the boundary
  8818. * @see https://floating-ui.com/docs/detectOverflow
  8819. */
  8820. async function detectOverflow$1(state, options) {
  8821. var _await$platform$isEle;
  8822. if (options === void 0) options = {};
  8823. const { x, y, platform, rects, elements, strategy } = state;
  8824. const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate(options, state);
  8825. const paddingObject = getPaddingObject(padding);
  8826. const element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext];
  8827. const clippingClientRect = rectToClientRect(await platform.getClippingRect({
  8828. element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)),
  8829. boundary,
  8830. rootBoundary,
  8831. strategy
  8832. }));
  8833. const rect = elementContext === "floating" ? {
  8834. x,
  8835. y,
  8836. width: rects.floating.width,
  8837. height: rects.floating.height
  8838. } : rects.reference;
  8839. const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
  8840. const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
  8841. x: 1,
  8842. y: 1
  8843. } : {
  8844. x: 1,
  8845. y: 1
  8846. };
  8847. const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  8848. elements,
  8849. rect,
  8850. offsetParent,
  8851. strategy
  8852. }) : rect);
  8853. return {
  8854. top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
  8855. bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
  8856. left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
  8857. right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
  8858. };
  8859. }
  8860. /**
  8861. * Provides data to position an inner element of the floating element so that it
  8862. * appears centered to the reference element.
  8863. * @see https://floating-ui.com/docs/arrow
  8864. */
  8865. const arrow$1 = (options) => ({
  8866. name: "arrow",
  8867. options,
  8868. async fn(state) {
  8869. const { x, y, placement, rects, platform, elements, middlewareData } = state;
  8870. const { element, padding = 0 } = evaluate(options, state) || {};
  8871. if (element == null) return {};
  8872. const paddingObject = getPaddingObject(padding);
  8873. const coords = {
  8874. x,
  8875. y
  8876. };
  8877. const axis = getAlignmentAxis(placement);
  8878. const length = getAxisLength(axis);
  8879. const arrowDimensions = await platform.getDimensions(element);
  8880. const isYAxis = axis === "y";
  8881. const minProp = isYAxis ? "top" : "left";
  8882. const maxProp = isYAxis ? "bottom" : "right";
  8883. const clientProp = isYAxis ? "clientHeight" : "clientWidth";
  8884. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  8885. const startDiff = coords[axis] - rects.reference[axis];
  8886. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  8887. let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
  8888. if (!clientSize || !await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent))) clientSize = elements.floating[clientProp] || rects.floating[length];
  8889. const centerToReference = endDiff / 2 - startDiff / 2;
  8890. const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
  8891. const minPadding = min$1(paddingObject[minProp], largestPossiblePadding);
  8892. const maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding);
  8893. const min$1$1 = minPadding;
  8894. const max = clientSize - arrowDimensions[length] - maxPadding;
  8895. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  8896. const offset = clamp(min$1$1, center, max);
  8897. const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
  8898. const alignmentOffset = shouldAddOffset ? center < min$1$1 ? center - min$1$1 : center - max : 0;
  8899. return {
  8900. [axis]: coords[axis] + alignmentOffset,
  8901. data: {
  8902. [axis]: offset,
  8903. centerOffset: center - offset - alignmentOffset,
  8904. ...shouldAddOffset && { alignmentOffset }
  8905. },
  8906. reset: shouldAddOffset
  8907. };
  8908. }
  8909. });
  8910. /**
  8911. * Optimizes the visibility of the floating element by flipping the `placement`
  8912. * in order to keep it in view when the preferred placement(s) will overflow the
  8913. * clipping boundary. Alternative to `autoPlacement`.
  8914. * @see https://floating-ui.com/docs/flip
  8915. */
  8916. const flip$1 = function(options) {
  8917. if (options === void 0) options = {};
  8918. return {
  8919. name: "flip",
  8920. options,
  8921. async fn(state) {
  8922. var _middlewareData$arrow, _middlewareData$flip;
  8923. const { placement, middlewareData, rects, initialPlacement, platform, elements } = state;
  8924. const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = evaluate(options, state);
  8925. if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
  8926. const side = getSide(placement);
  8927. const initialSideAxis = getSideAxis(initialPlacement);
  8928. const isBasePlacement = getSide(initialPlacement) === initialPlacement;
  8929. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  8930. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  8931. const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
  8932. if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
  8933. const placements = [initialPlacement, ...fallbackPlacements];
  8934. const overflow = await detectOverflow$1(state, detectOverflowOptions);
  8935. const overflows = [];
  8936. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  8937. if (checkMainAxis) overflows.push(overflow[side]);
  8938. if (checkCrossAxis) {
  8939. const sides = getAlignmentSides(placement, rects, rtl);
  8940. overflows.push(overflow[sides[0]], overflow[sides[1]]);
  8941. }
  8942. overflowsData = [...overflowsData, {
  8943. placement,
  8944. overflows
  8945. }];
  8946. if (!overflows.every((side) => side <= 0)) {
  8947. var _middlewareData$flip2, _overflowsData$filter;
  8948. const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
  8949. const nextPlacement = placements[nextIndex];
  8950. if (nextPlacement) {
  8951. if (!(checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false) || overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) return {
  8952. data: {
  8953. index: nextIndex,
  8954. overflows: overflowsData
  8955. },
  8956. reset: { placement: nextPlacement }
  8957. };
  8958. }
  8959. let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
  8960. if (!resetPlacement) switch (fallbackStrategy) {
  8961. case "bestFit": {
  8962. var _overflowsData$filter2;
  8963. const placement = (_overflowsData$filter2 = overflowsData.filter((d) => {
  8964. if (hasFallbackAxisSideDirection) {
  8965. const currentSideAxis = getSideAxis(d.placement);
  8966. return currentSideAxis === initialSideAxis || currentSideAxis === "y";
  8967. }
  8968. return true;
  8969. }).map((d) => [d.placement, d.overflows.filter((overflow) => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
  8970. if (placement) resetPlacement = placement;
  8971. break;
  8972. }
  8973. case "initialPlacement":
  8974. resetPlacement = initialPlacement;
  8975. break;
  8976. }
  8977. if (placement !== resetPlacement) return { reset: { placement: resetPlacement } };
  8978. }
  8979. return {};
  8980. }
  8981. };
  8982. };
  8983. const originSides = /* @__PURE__ */ new Set(["left", "top"]);
  8984. async function convertValueToCoords(state, options) {
  8985. const { placement, platform, elements } = state;
  8986. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  8987. const side = getSide(placement);
  8988. const alignment = getAlignment(placement);
  8989. const isVertical = getSideAxis(placement) === "y";
  8990. const mainAxisMulti = originSides.has(side) ? -1 : 1;
  8991. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  8992. const rawValue = evaluate(options, state);
  8993. let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === "number" ? {
  8994. mainAxis: rawValue,
  8995. crossAxis: 0,
  8996. alignmentAxis: null
  8997. } : {
  8998. mainAxis: rawValue.mainAxis || 0,
  8999. crossAxis: rawValue.crossAxis || 0,
  9000. alignmentAxis: rawValue.alignmentAxis
  9001. };
  9002. if (alignment && typeof alignmentAxis === "number") crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
  9003. return isVertical ? {
  9004. x: crossAxis * crossAxisMulti,
  9005. y: mainAxis * mainAxisMulti
  9006. } : {
  9007. x: mainAxis * mainAxisMulti,
  9008. y: crossAxis * crossAxisMulti
  9009. };
  9010. }
  9011. /**
  9012. * Modifies the placement by translating the floating element along the
  9013. * specified axes.
  9014. * A number (shorthand for `mainAxis` or distance), or an axes configuration
  9015. * object may be passed.
  9016. * @see https://floating-ui.com/docs/offset
  9017. */
  9018. const offset$1 = function(options) {
  9019. if (options === void 0) options = 0;
  9020. return {
  9021. name: "offset",
  9022. options,
  9023. async fn(state) {
  9024. var _middlewareData$offse, _middlewareData$arrow;
  9025. const { x, y, placement, middlewareData } = state;
  9026. const diffCoords = await convertValueToCoords(state, options);
  9027. if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
  9028. return {
  9029. x: x + diffCoords.x,
  9030. y: y + diffCoords.y,
  9031. data: {
  9032. ...diffCoords,
  9033. placement
  9034. }
  9035. };
  9036. }
  9037. };
  9038. };
  9039. /**
  9040. * Optimizes the visibility of the floating element by shifting it in order to
  9041. * keep it in view when it will overflow the clipping boundary.
  9042. * @see https://floating-ui.com/docs/shift
  9043. */
  9044. const shift$1 = function(options) {
  9045. if (options === void 0) options = {};
  9046. return {
  9047. name: "shift",
  9048. options,
  9049. async fn(state) {
  9050. const { x, y, placement } = state;
  9051. const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => {
  9052. let { x, y } = _ref;
  9053. return {
  9054. x,
  9055. y
  9056. };
  9057. } }, ...detectOverflowOptions } = evaluate(options, state);
  9058. const coords = {
  9059. x,
  9060. y
  9061. };
  9062. const overflow = await detectOverflow$1(state, detectOverflowOptions);
  9063. const crossAxis = getSideAxis(getSide(placement));
  9064. const mainAxis = getOppositeAxis(crossAxis);
  9065. let mainAxisCoord = coords[mainAxis];
  9066. let crossAxisCoord = coords[crossAxis];
  9067. if (checkMainAxis) {
  9068. const minSide = mainAxis === "y" ? "top" : "left";
  9069. const maxSide = mainAxis === "y" ? "bottom" : "right";
  9070. const min = mainAxisCoord + overflow[minSide];
  9071. const max = mainAxisCoord - overflow[maxSide];
  9072. mainAxisCoord = clamp(min, mainAxisCoord, max);
  9073. }
  9074. if (checkCrossAxis) {
  9075. const minSide = crossAxis === "y" ? "top" : "left";
  9076. const maxSide = crossAxis === "y" ? "bottom" : "right";
  9077. const min = crossAxisCoord + overflow[minSide];
  9078. const max = crossAxisCoord - overflow[maxSide];
  9079. crossAxisCoord = clamp(min, crossAxisCoord, max);
  9080. }
  9081. const limitedCoords = limiter.fn({
  9082. ...state,
  9083. [mainAxis]: mainAxisCoord,
  9084. [crossAxis]: crossAxisCoord
  9085. });
  9086. return {
  9087. ...limitedCoords,
  9088. data: {
  9089. x: limitedCoords.x - x,
  9090. y: limitedCoords.y - y,
  9091. enabled: {
  9092. [mainAxis]: checkMainAxis,
  9093. [crossAxis]: checkCrossAxis
  9094. }
  9095. }
  9096. };
  9097. }
  9098. };
  9099. };
  9100. //#endregion
  9101. //#region ../../node_modules/.pnpm/@floating-ui+utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
  9102. function hasWindow() {
  9103. return typeof window !== "undefined";
  9104. }
  9105. function getNodeName(node) {
  9106. if (isNode(node)) return (node.nodeName || "").toLowerCase();
  9107. return "#document";
  9108. }
  9109. function getWindow(node) {
  9110. var _node$ownerDocument;
  9111. return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
  9112. }
  9113. function getDocumentElement(node) {
  9114. var _ref;
  9115. return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
  9116. }
  9117. function isNode(value) {
  9118. if (!hasWindow()) return false;
  9119. return value instanceof Node || value instanceof getWindow(value).Node;
  9120. }
  9121. function isElement(value) {
  9122. if (!hasWindow()) return false;
  9123. return value instanceof Element || value instanceof getWindow(value).Element;
  9124. }
  9125. function isHTMLElement(value) {
  9126. if (!hasWindow()) return false;
  9127. return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
  9128. }
  9129. function isShadowRoot(value) {
  9130. if (!hasWindow() || typeof ShadowRoot === "undefined") return false;
  9131. return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
  9132. }
  9133. const invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
  9134. function isOverflowElement(element) {
  9135. const { overflow, overflowX, overflowY, display } = getComputedStyle$1(element);
  9136. return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
  9137. }
  9138. const tableElements = /* @__PURE__ */ new Set([
  9139. "table",
  9140. "td",
  9141. "th"
  9142. ]);
  9143. function isTableElement(element) {
  9144. return tableElements.has(getNodeName(element));
  9145. }
  9146. const topLayerSelectors = [":popover-open", ":modal"];
  9147. function isTopLayer(element) {
  9148. return topLayerSelectors.some((selector) => {
  9149. try {
  9150. return element.matches(selector);
  9151. } catch (_e) {
  9152. return false;
  9153. }
  9154. });
  9155. }
  9156. const transformProperties = [
  9157. "transform",
  9158. "translate",
  9159. "scale",
  9160. "rotate",
  9161. "perspective"
  9162. ];
  9163. const willChangeValues = [
  9164. "transform",
  9165. "translate",
  9166. "scale",
  9167. "rotate",
  9168. "perspective",
  9169. "filter"
  9170. ];
  9171. const containValues = [
  9172. "paint",
  9173. "layout",
  9174. "strict",
  9175. "content"
  9176. ];
  9177. function isContainingBlock(elementOrCss) {
  9178. const webkit = isWebKit();
  9179. const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
  9180. return transformProperties.some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || willChangeValues.some((value) => (css.willChange || "").includes(value)) || containValues.some((value) => (css.contain || "").includes(value));
  9181. }
  9182. function getContainingBlock(element) {
  9183. let currentNode = getParentNode(element);
  9184. while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
  9185. if (isContainingBlock(currentNode)) return currentNode;
  9186. else if (isTopLayer(currentNode)) return null;
  9187. currentNode = getParentNode(currentNode);
  9188. }
  9189. return null;
  9190. }
  9191. function isWebKit() {
  9192. if (typeof CSS === "undefined" || !CSS.supports) return false;
  9193. return CSS.supports("-webkit-backdrop-filter", "none");
  9194. }
  9195. const lastTraversableNodeNames = /* @__PURE__ */ new Set([
  9196. "html",
  9197. "body",
  9198. "#document"
  9199. ]);
  9200. function isLastTraversableNode(node) {
  9201. return lastTraversableNodeNames.has(getNodeName(node));
  9202. }
  9203. function getComputedStyle$1(element) {
  9204. return getWindow(element).getComputedStyle(element);
  9205. }
  9206. function getNodeScroll(element) {
  9207. if (isElement(element)) return {
  9208. scrollLeft: element.scrollLeft,
  9209. scrollTop: element.scrollTop
  9210. };
  9211. return {
  9212. scrollLeft: element.scrollX,
  9213. scrollTop: element.scrollY
  9214. };
  9215. }
  9216. function getParentNode(node) {
  9217. if (getNodeName(node) === "html") return node;
  9218. const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
  9219. return isShadowRoot(result) ? result.host : result;
  9220. }
  9221. function getNearestOverflowAncestor(node) {
  9222. const parentNode = getParentNode(node);
  9223. if (isLastTraversableNode(parentNode)) return node.ownerDocument ? node.ownerDocument.body : node.body;
  9224. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode;
  9225. return getNearestOverflowAncestor(parentNode);
  9226. }
  9227. function getOverflowAncestors(node, list, traverseIframes) {
  9228. var _node$ownerDocument2;
  9229. if (list === void 0) list = [];
  9230. if (traverseIframes === void 0) traverseIframes = true;
  9231. const scrollableAncestor = getNearestOverflowAncestor(node);
  9232. const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
  9233. const win = getWindow(scrollableAncestor);
  9234. if (isBody) {
  9235. const frameElement = getFrameElement(win);
  9236. return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
  9237. }
  9238. return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
  9239. }
  9240. function getFrameElement(win) {
  9241. return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
  9242. }
  9243. //#endregion
  9244. //#region ../../node_modules/.pnpm/@floating-ui+dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
  9245. function getCssDimensions(element) {
  9246. const css = getComputedStyle$1(element);
  9247. let width = parseFloat(css.width) || 0;
  9248. let height = parseFloat(css.height) || 0;
  9249. const hasOffset = isHTMLElement(element);
  9250. const offsetWidth = hasOffset ? element.offsetWidth : width;
  9251. const offsetHeight = hasOffset ? element.offsetHeight : height;
  9252. const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
  9253. if (shouldFallback) {
  9254. width = offsetWidth;
  9255. height = offsetHeight;
  9256. }
  9257. return {
  9258. width,
  9259. height,
  9260. $: shouldFallback
  9261. };
  9262. }
  9263. function unwrapElement(element) {
  9264. return !isElement(element) ? element.contextElement : element;
  9265. }
  9266. function getScale(element) {
  9267. const domElement = unwrapElement(element);
  9268. if (!isHTMLElement(domElement)) return createCoords(1);
  9269. const rect = domElement.getBoundingClientRect();
  9270. const { width, height, $ } = getCssDimensions(domElement);
  9271. let x = ($ ? round(rect.width) : rect.width) / width;
  9272. let y = ($ ? round(rect.height) : rect.height) / height;
  9273. if (!x || !Number.isFinite(x)) x = 1;
  9274. if (!y || !Number.isFinite(y)) y = 1;
  9275. return {
  9276. x,
  9277. y
  9278. };
  9279. }
  9280. const noOffsets = /* @__PURE__ */ createCoords(0);
  9281. function getVisualOffsets(element) {
  9282. const win = getWindow(element);
  9283. if (!isWebKit() || !win.visualViewport) return noOffsets;
  9284. return {
  9285. x: win.visualViewport.offsetLeft,
  9286. y: win.visualViewport.offsetTop
  9287. };
  9288. }
  9289. function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
  9290. if (isFixed === void 0) isFixed = false;
  9291. if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) return false;
  9292. return isFixed;
  9293. }
  9294. function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
  9295. if (includeScale === void 0) includeScale = false;
  9296. if (isFixedStrategy === void 0) isFixedStrategy = false;
  9297. const clientRect = element.getBoundingClientRect();
  9298. const domElement = unwrapElement(element);
  9299. let scale = createCoords(1);
  9300. if (includeScale) if (offsetParent) {
  9301. if (isElement(offsetParent)) scale = getScale(offsetParent);
  9302. } else scale = getScale(element);
  9303. const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
  9304. let x = (clientRect.left + visualOffsets.x) / scale.x;
  9305. let y = (clientRect.top + visualOffsets.y) / scale.y;
  9306. let width = clientRect.width / scale.x;
  9307. let height = clientRect.height / scale.y;
  9308. if (domElement) {
  9309. const win = getWindow(domElement);
  9310. const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
  9311. let currentWin = win;
  9312. let currentIFrame = getFrameElement(currentWin);
  9313. while (currentIFrame && offsetParent && offsetWin !== currentWin) {
  9314. const iframeScale = getScale(currentIFrame);
  9315. const iframeRect = currentIFrame.getBoundingClientRect();
  9316. const css = getComputedStyle$1(currentIFrame);
  9317. const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
  9318. const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
  9319. x *= iframeScale.x;
  9320. y *= iframeScale.y;
  9321. width *= iframeScale.x;
  9322. height *= iframeScale.y;
  9323. x += left;
  9324. y += top;
  9325. currentWin = getWindow(currentIFrame);
  9326. currentIFrame = getFrameElement(currentWin);
  9327. }
  9328. }
  9329. return rectToClientRect({
  9330. width,
  9331. height,
  9332. x,
  9333. y
  9334. });
  9335. }
  9336. function getWindowScrollBarX(element, rect) {
  9337. const leftScroll = getNodeScroll(element).scrollLeft;
  9338. if (!rect) return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
  9339. return rect.left + leftScroll;
  9340. }
  9341. function getHTMLOffset(documentElement, scroll) {
  9342. const htmlRect = documentElement.getBoundingClientRect();
  9343. return {
  9344. x: htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect),
  9345. y: htmlRect.top + scroll.scrollTop
  9346. };
  9347. }
  9348. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  9349. let { elements, rect, offsetParent, strategy } = _ref;
  9350. const isFixed = strategy === "fixed";
  9351. const documentElement = getDocumentElement(offsetParent);
  9352. const topLayer = elements ? isTopLayer(elements.floating) : false;
  9353. if (offsetParent === documentElement || topLayer && isFixed) return rect;
  9354. let scroll = {
  9355. scrollLeft: 0,
  9356. scrollTop: 0
  9357. };
  9358. let scale = createCoords(1);
  9359. const offsets = createCoords(0);
  9360. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9361. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  9362. if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
  9363. if (isHTMLElement(offsetParent)) {
  9364. const offsetRect = getBoundingClientRect(offsetParent);
  9365. scale = getScale(offsetParent);
  9366. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9367. offsets.y = offsetRect.y + offsetParent.clientTop;
  9368. }
  9369. }
  9370. const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
  9371. return {
  9372. width: rect.width * scale.x,
  9373. height: rect.height * scale.y,
  9374. x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
  9375. y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
  9376. };
  9377. }
  9378. function getClientRects(element) {
  9379. return Array.from(element.getClientRects());
  9380. }
  9381. function getDocumentRect(element) {
  9382. const html = getDocumentElement(element);
  9383. const scroll = getNodeScroll(element);
  9384. const body = element.ownerDocument.body;
  9385. const width = max$1(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
  9386. const height = max$1(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
  9387. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  9388. const y = -scroll.scrollTop;
  9389. if (getComputedStyle$1(body).direction === "rtl") x += max$1(html.clientWidth, body.clientWidth) - width;
  9390. return {
  9391. width,
  9392. height,
  9393. x,
  9394. y
  9395. };
  9396. }
  9397. const SCROLLBAR_MAX = 25;
  9398. function getViewportRect(element, strategy) {
  9399. const win = getWindow(element);
  9400. const html = getDocumentElement(element);
  9401. const visualViewport = win.visualViewport;
  9402. let width = html.clientWidth;
  9403. let height = html.clientHeight;
  9404. let x = 0;
  9405. let y = 0;
  9406. if (visualViewport) {
  9407. width = visualViewport.width;
  9408. height = visualViewport.height;
  9409. const visualViewportBased = isWebKit();
  9410. if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
  9411. x = visualViewport.offsetLeft;
  9412. y = visualViewport.offsetTop;
  9413. }
  9414. }
  9415. const windowScrollbarX = getWindowScrollBarX(html);
  9416. if (windowScrollbarX <= 0) {
  9417. const doc = html.ownerDocument;
  9418. const body = doc.body;
  9419. const bodyStyles = getComputedStyle(body);
  9420. const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
  9421. const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
  9422. if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) width -= clippingStableScrollbarWidth;
  9423. } else if (windowScrollbarX <= SCROLLBAR_MAX) width += windowScrollbarX;
  9424. return {
  9425. width,
  9426. height,
  9427. x,
  9428. y
  9429. };
  9430. }
  9431. const absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
  9432. function getInnerBoundingClientRect(element, strategy) {
  9433. const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
  9434. const top = clientRect.top + element.clientTop;
  9435. const left = clientRect.left + element.clientLeft;
  9436. const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
  9437. return {
  9438. width: element.clientWidth * scale.x,
  9439. height: element.clientHeight * scale.y,
  9440. x: left * scale.x,
  9441. y: top * scale.y
  9442. };
  9443. }
  9444. function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
  9445. let rect;
  9446. if (clippingAncestor === "viewport") rect = getViewportRect(element, strategy);
  9447. else if (clippingAncestor === "document") rect = getDocumentRect(getDocumentElement(element));
  9448. else if (isElement(clippingAncestor)) rect = getInnerBoundingClientRect(clippingAncestor, strategy);
  9449. else {
  9450. const visualOffsets = getVisualOffsets(element);
  9451. rect = {
  9452. x: clippingAncestor.x - visualOffsets.x,
  9453. y: clippingAncestor.y - visualOffsets.y,
  9454. width: clippingAncestor.width,
  9455. height: clippingAncestor.height
  9456. };
  9457. }
  9458. return rectToClientRect(rect);
  9459. }
  9460. function hasFixedPositionAncestor(element, stopNode) {
  9461. const parentNode = getParentNode(element);
  9462. if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) return false;
  9463. return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
  9464. }
  9465. function getClippingElementAncestors(element, cache) {
  9466. const cachedResult = cache.get(element);
  9467. if (cachedResult) return cachedResult;
  9468. let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
  9469. let currentContainingBlockComputedStyle = null;
  9470. const elementIsFixed = getComputedStyle$1(element).position === "fixed";
  9471. let currentNode = elementIsFixed ? getParentNode(element) : element;
  9472. while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
  9473. const computedStyle = getComputedStyle$1(currentNode);
  9474. const currentNodeIsContaining = isContainingBlock(currentNode);
  9475. if (!currentNodeIsContaining && computedStyle.position === "fixed") currentContainingBlockComputedStyle = null;
  9476. if (elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode)) result = result.filter((ancestor) => ancestor !== currentNode);
  9477. else currentContainingBlockComputedStyle = computedStyle;
  9478. currentNode = getParentNode(currentNode);
  9479. }
  9480. cache.set(element, result);
  9481. return result;
  9482. }
  9483. function getClippingRect(_ref) {
  9484. let { element, boundary, rootBoundary, strategy } = _ref;
  9485. const clippingAncestors = [...boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary), rootBoundary];
  9486. const firstClippingAncestor = clippingAncestors[0];
  9487. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  9488. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  9489. accRect.top = max$1(rect.top, accRect.top);
  9490. accRect.right = min$1(rect.right, accRect.right);
  9491. accRect.bottom = min$1(rect.bottom, accRect.bottom);
  9492. accRect.left = max$1(rect.left, accRect.left);
  9493. return accRect;
  9494. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  9495. return {
  9496. width: clippingRect.right - clippingRect.left,
  9497. height: clippingRect.bottom - clippingRect.top,
  9498. x: clippingRect.left,
  9499. y: clippingRect.top
  9500. };
  9501. }
  9502. function getDimensions(element) {
  9503. const { width, height } = getCssDimensions(element);
  9504. return {
  9505. width,
  9506. height
  9507. };
  9508. }
  9509. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  9510. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9511. const documentElement = getDocumentElement(offsetParent);
  9512. const isFixed = strategy === "fixed";
  9513. const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
  9514. let scroll = {
  9515. scrollLeft: 0,
  9516. scrollTop: 0
  9517. };
  9518. const offsets = createCoords(0);
  9519. function setLeftRTLScrollbarOffset() {
  9520. offsets.x = getWindowScrollBarX(documentElement);
  9521. }
  9522. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  9523. if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
  9524. if (isOffsetParentAnElement) {
  9525. const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
  9526. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9527. offsets.y = offsetRect.y + offsetParent.clientTop;
  9528. } else if (documentElement) setLeftRTLScrollbarOffset();
  9529. }
  9530. if (isFixed && !isOffsetParentAnElement && documentElement) setLeftRTLScrollbarOffset();
  9531. const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
  9532. return {
  9533. x: rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x,
  9534. y: rect.top + scroll.scrollTop - offsets.y - htmlOffset.y,
  9535. width: rect.width,
  9536. height: rect.height
  9537. };
  9538. }
  9539. function isStaticPositioned(element) {
  9540. return getComputedStyle$1(element).position === "static";
  9541. }
  9542. function getTrueOffsetParent(element, polyfill) {
  9543. if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") return null;
  9544. if (polyfill) return polyfill(element);
  9545. let rawOffsetParent = element.offsetParent;
  9546. if (getDocumentElement(element) === rawOffsetParent) rawOffsetParent = rawOffsetParent.ownerDocument.body;
  9547. return rawOffsetParent;
  9548. }
  9549. function getOffsetParent(element, polyfill) {
  9550. const win = getWindow(element);
  9551. if (isTopLayer(element)) return win;
  9552. if (!isHTMLElement(element)) {
  9553. let svgOffsetParent = getParentNode(element);
  9554. while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
  9555. if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) return svgOffsetParent;
  9556. svgOffsetParent = getParentNode(svgOffsetParent);
  9557. }
  9558. return win;
  9559. }
  9560. let offsetParent = getTrueOffsetParent(element, polyfill);
  9561. while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) offsetParent = getTrueOffsetParent(offsetParent, polyfill);
  9562. if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) return win;
  9563. return offsetParent || getContainingBlock(element) || win;
  9564. }
  9565. const getElementRects = async function(data) {
  9566. const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
  9567. const getDimensionsFn = this.getDimensions;
  9568. const floatingDimensions = await getDimensionsFn(data.floating);
  9569. return {
  9570. reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
  9571. floating: {
  9572. x: 0,
  9573. y: 0,
  9574. width: floatingDimensions.width,
  9575. height: floatingDimensions.height
  9576. }
  9577. };
  9578. };
  9579. function isRTL$1(element) {
  9580. return getComputedStyle$1(element).direction === "rtl";
  9581. }
  9582. const platform = {
  9583. convertOffsetParentRelativeRectToViewportRelativeRect,
  9584. getDocumentElement,
  9585. getClippingRect,
  9586. getOffsetParent,
  9587. getElementRects,
  9588. getClientRects,
  9589. getDimensions,
  9590. getScale,
  9591. isElement,
  9592. isRTL: isRTL$1
  9593. };
  9594. function rectsAreEqual(a, b) {
  9595. return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
  9596. }
  9597. function observeMove(element, onMove) {
  9598. let io = null;
  9599. let timeoutId;
  9600. const root = getDocumentElement(element);
  9601. function cleanup() {
  9602. var _io;
  9603. clearTimeout(timeoutId);
  9604. (_io = io) == null || _io.disconnect();
  9605. io = null;
  9606. }
  9607. function refresh(skip, threshold) {
  9608. if (skip === void 0) skip = false;
  9609. if (threshold === void 0) threshold = 1;
  9610. cleanup();
  9611. const elementRectForRootMargin = element.getBoundingClientRect();
  9612. const { left, top, width, height } = elementRectForRootMargin;
  9613. if (!skip) onMove();
  9614. if (!width || !height) return;
  9615. const insetTop = floor$1(top);
  9616. const insetRight = floor$1(root.clientWidth - (left + width));
  9617. const insetBottom = floor$1(root.clientHeight - (top + height));
  9618. const insetLeft = floor$1(left);
  9619. const options = {
  9620. rootMargin: -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px",
  9621. threshold: max$1(0, min$1(1, threshold)) || 1
  9622. };
  9623. let isFirstUpdate = true;
  9624. function handleObserve(entries) {
  9625. const ratio = entries[0].intersectionRatio;
  9626. if (ratio !== threshold) {
  9627. if (!isFirstUpdate) return refresh();
  9628. if (!ratio) timeoutId = setTimeout(() => {
  9629. refresh(false, 1e-7);
  9630. }, 1e3);
  9631. else refresh(false, ratio);
  9632. }
  9633. if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) refresh();
  9634. isFirstUpdate = false;
  9635. }
  9636. try {
  9637. io = new IntersectionObserver(handleObserve, {
  9638. ...options,
  9639. root: root.ownerDocument
  9640. });
  9641. } catch (_e) {
  9642. io = new IntersectionObserver(handleObserve, options);
  9643. }
  9644. io.observe(element);
  9645. }
  9646. refresh(true);
  9647. return cleanup;
  9648. }
  9649. /**
  9650. * Automatically updates the position of the floating element when necessary.
  9651. * Should only be called when the floating element is mounted on the DOM or
  9652. * visible on the screen.
  9653. * @returns cleanup function that should be invoked when the floating element is
  9654. * removed from the DOM or hidden from the screen.
  9655. * @see https://floating-ui.com/docs/autoUpdate
  9656. */
  9657. function autoUpdate(reference, floating, update, options) {
  9658. if (options === void 0) options = {};
  9659. const { ancestorScroll = true, ancestorResize = true, elementResize = typeof ResizeObserver === "function", layoutShift = typeof IntersectionObserver === "function", animationFrame = false } = options;
  9660. const referenceEl = unwrapElement(reference);
  9661. const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
  9662. ancestors.forEach((ancestor) => {
  9663. ancestorScroll && ancestor.addEventListener("scroll", update, { passive: true });
  9664. ancestorResize && ancestor.addEventListener("resize", update);
  9665. });
  9666. const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
  9667. let reobserveFrame = -1;
  9668. let resizeObserver = null;
  9669. if (elementResize) {
  9670. resizeObserver = new ResizeObserver((_ref) => {
  9671. let [firstEntry] = _ref;
  9672. if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
  9673. resizeObserver.unobserve(floating);
  9674. cancelAnimationFrame(reobserveFrame);
  9675. reobserveFrame = requestAnimationFrame(() => {
  9676. var _resizeObserver;
  9677. (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
  9678. });
  9679. }
  9680. update();
  9681. });
  9682. if (referenceEl && !animationFrame) resizeObserver.observe(referenceEl);
  9683. resizeObserver.observe(floating);
  9684. }
  9685. let frameId;
  9686. let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  9687. if (animationFrame) frameLoop();
  9688. function frameLoop() {
  9689. const nextRefRect = getBoundingClientRect(reference);
  9690. if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) update();
  9691. prevRefRect = nextRefRect;
  9692. frameId = requestAnimationFrame(frameLoop);
  9693. }
  9694. update();
  9695. return () => {
  9696. var _resizeObserver2;
  9697. ancestors.forEach((ancestor) => {
  9698. ancestorScroll && ancestor.removeEventListener("scroll", update);
  9699. ancestorResize && ancestor.removeEventListener("resize", update);
  9700. });
  9701. cleanupIo?.();
  9702. (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
  9703. resizeObserver = null;
  9704. if (animationFrame) cancelAnimationFrame(frameId);
  9705. };
  9706. }
  9707. /**
  9708. * Resolves with an object of overflow side offsets that determine how much the
  9709. * element is overflowing a given clipping boundary on each side.
  9710. * - positive = overflowing the boundary by that number of pixels
  9711. * - negative = how many pixels left before it will overflow
  9712. * - 0 = lies flush with the boundary
  9713. * @see https://floating-ui.com/docs/detectOverflow
  9714. */
  9715. const detectOverflow = detectOverflow$1;
  9716. /**
  9717. * Modifies the placement by translating the floating element along the
  9718. * specified axes.
  9719. * A number (shorthand for `mainAxis` or distance), or an axes configuration
  9720. * object may be passed.
  9721. * @see https://floating-ui.com/docs/offset
  9722. */
  9723. const offset = offset$1;
  9724. /**
  9725. * Optimizes the visibility of the floating element by shifting it in order to
  9726. * keep it in view when it will overflow the clipping boundary.
  9727. * @see https://floating-ui.com/docs/shift
  9728. */
  9729. const shift = shift$1;
  9730. /**
  9731. * Optimizes the visibility of the floating element by flipping the `placement`
  9732. * in order to keep it in view when the preferred placement(s) will overflow the
  9733. * clipping boundary. Alternative to `autoPlacement`.
  9734. * @see https://floating-ui.com/docs/flip
  9735. */
  9736. const flip = flip$1;
  9737. /**
  9738. * Provides data to position an inner element of the floating element so that it
  9739. * appears centered to the reference element.
  9740. * @see https://floating-ui.com/docs/arrow
  9741. */
  9742. const arrow = arrow$1;
  9743. /**
  9744. * Computes the `x` and `y` coordinates that will place the floating element
  9745. * next to a given reference element.
  9746. */
  9747. const computePosition = (reference, floating, options) => {
  9748. const cache = /* @__PURE__ */ new Map();
  9749. const mergedOptions = {
  9750. platform,
  9751. ...options
  9752. };
  9753. const platformWithCache = {
  9754. ...mergedOptions.platform,
  9755. _c: cache
  9756. };
  9757. return computePosition$1(reference, floating, {
  9758. ...mergedOptions,
  9759. platform: platformWithCache
  9760. });
  9761. };
  9762. //#endregion
  9763. //#region ../../packages/hooks/use-floating/index.ts
  9764. const useFloatingProps = buildProps({});
  9765. const unrefReference = (elRef) => {
  9766. if (!isClient) return;
  9767. if (!elRef) return elRef;
  9768. const unrefEl = unrefElement(elRef);
  9769. if (unrefEl) return unrefEl;
  9770. return isRef(elRef) ? unrefEl : elRef;
  9771. };
  9772. const getPositionDataWithUnit = (record, key) => {
  9773. const value = record?.[key];
  9774. return isNil(value) ? "" : `${value}px`;
  9775. };
  9776. const useFloating = ({ middleware, placement, strategy }) => {
  9777. const referenceRef = ref();
  9778. const contentRef = ref();
  9779. const states = {
  9780. x: ref(),
  9781. y: ref(),
  9782. placement,
  9783. strategy,
  9784. middlewareData: ref({})
  9785. };
  9786. const update = async () => {
  9787. if (!isClient) return;
  9788. const referenceEl = unrefReference(referenceRef);
  9789. const contentEl = unrefElement(contentRef);
  9790. if (!referenceEl || !contentEl) return;
  9791. const data = await computePosition(referenceEl, contentEl, {
  9792. placement: unref(placement),
  9793. strategy: unref(strategy),
  9794. middleware: unref(middleware)
  9795. });
  9796. keysOf(states).forEach((key) => {
  9797. states[key].value = data[key];
  9798. });
  9799. };
  9800. onMounted(() => {
  9801. watchEffect(() => {
  9802. update();
  9803. });
  9804. });
  9805. return {
  9806. ...states,
  9807. update,
  9808. referenceRef,
  9809. contentRef
  9810. };
  9811. };
  9812. const arrowMiddleware = ({ arrowRef, padding }) => {
  9813. return {
  9814. name: "arrow",
  9815. options: {
  9816. element: arrowRef,
  9817. padding
  9818. },
  9819. fn(args) {
  9820. const arrowEl = unref(arrowRef);
  9821. if (!arrowEl) return {};
  9822. return arrow({
  9823. element: arrowEl,
  9824. padding
  9825. }).fn(args);
  9826. }
  9827. };
  9828. };
  9829. //#endregion
  9830. //#region ../../packages/hooks/use-cursor/index.ts
  9831. function useCursor(input) {
  9832. let selectionInfo;
  9833. function recordCursor() {
  9834. if (input.value == void 0) return;
  9835. const { selectionStart, selectionEnd, value } = input.value;
  9836. if (selectionStart == null || selectionEnd == null) return;
  9837. selectionInfo = {
  9838. selectionStart,
  9839. selectionEnd,
  9840. value,
  9841. beforeTxt: value.slice(0, Math.max(0, selectionStart)),
  9842. afterTxt: value.slice(Math.max(0, selectionEnd))
  9843. };
  9844. }
  9845. function setCursor() {
  9846. if (input.value == void 0 || selectionInfo == void 0) return;
  9847. const { value } = input.value;
  9848. const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
  9849. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0) return;
  9850. let startPos = value.length;
  9851. if (value.endsWith(afterTxt)) startPos = value.length - afterTxt.length;
  9852. else if (value.startsWith(beforeTxt)) startPos = beforeTxt.length;
  9853. else {
  9854. const beforeLastChar = beforeTxt[selectionStart - 1];
  9855. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  9856. if (newIndex !== -1) startPos = newIndex + 1;
  9857. }
  9858. input.value.setSelectionRange(startPos, startPos);
  9859. }
  9860. return [recordCursor, setCursor];
  9861. }
  9862. //#endregion
  9863. //#region ../../packages/hooks/use-ordered-children/index.ts
  9864. const getOrderedChildren = (vm, childComponentName, children) => {
  9865. return flattedChildren(vm.subTree).filter((n) => isVNode(n) && n.type?.name === childComponentName && !!n.component).map((n) => n.component.uid).map((uid) => children[uid]).filter((p) => !!p);
  9866. };
  9867. const useOrderedChildren = (vm, childComponentName) => {
  9868. const children = shallowRef({});
  9869. const orderedChildren = shallowRef([]);
  9870. const nodesMap = /* @__PURE__ */ new WeakMap();
  9871. const addChild = (child) => {
  9872. children.value[child.uid] = child;
  9873. triggerRef(children);
  9874. onMounted(() => {
  9875. const childNode = child.getVnode().el;
  9876. const parentNode = childNode.parentNode;
  9877. if (!nodesMap.has(parentNode)) {
  9878. nodesMap.set(parentNode, []);
  9879. const originalFn = parentNode.insertBefore.bind(parentNode);
  9880. parentNode.insertBefore = (node, anchor) => {
  9881. if (nodesMap.get(parentNode).some((el) => node === el || anchor === el)) triggerRef(children);
  9882. return originalFn(node, anchor);
  9883. };
  9884. }
  9885. nodesMap.get(parentNode).push(childNode);
  9886. });
  9887. };
  9888. const removeChild = (child) => {
  9889. delete children.value[child.uid];
  9890. triggerRef(children);
  9891. const childNode = child.getVnode().el;
  9892. const parentNode = childNode.parentNode;
  9893. const childNodes = nodesMap.get(parentNode);
  9894. const index = childNodes.indexOf(childNode);
  9895. childNodes.splice(index, 1);
  9896. };
  9897. const sortChildren = () => {
  9898. orderedChildren.value = getOrderedChildren(vm, childComponentName, children.value);
  9899. };
  9900. const IsolatedRenderer = (props) => {
  9901. return props.render();
  9902. };
  9903. return {
  9904. children: orderedChildren,
  9905. addChild,
  9906. removeChild,
  9907. ChildrenSorter: defineComponent({ setup(_, { slots }) {
  9908. return () => {
  9909. sortChildren();
  9910. return slots.default ? h(IsolatedRenderer, { render: slots.default }) : null;
  9911. };
  9912. } })
  9913. };
  9914. };
  9915. //#endregion
  9916. //#region ../../packages/hooks/use-size/index.ts
  9917. const useSizeProp = buildProp({
  9918. type: String,
  9919. values: componentSizes,
  9920. required: false
  9921. });
  9922. const useSizeProps = { size: useSizeProp };
  9923. const SIZE_INJECTION_KEY = Symbol("size");
  9924. const useGlobalSize = () => {
  9925. const injectedSize = inject(SIZE_INJECTION_KEY, {});
  9926. return computed(() => {
  9927. return unref(injectedSize.size) || "";
  9928. });
  9929. };
  9930. //#endregion
  9931. //#region ../../packages/hooks/use-focus-controller/index.ts
  9932. function useFocusController(target, { disabled, beforeFocus, afterFocus, beforeBlur, afterBlur } = {}) {
  9933. const { emit } = getCurrentInstance();
  9934. const wrapperRef = shallowRef();
  9935. const isFocused = ref(false);
  9936. const handleFocus = (event) => {
  9937. const cancelFocus = isFunction$1(beforeFocus) ? beforeFocus(event) : false;
  9938. if (unref(disabled) || isFocused.value || cancelFocus) return;
  9939. isFocused.value = true;
  9940. emit("focus", event);
  9941. afterFocus?.();
  9942. };
  9943. const handleBlur = (event) => {
  9944. const cancelBlur = isFunction$1(beforeBlur) ? beforeBlur(event) : false;
  9945. if (unref(disabled) || event.relatedTarget && wrapperRef.value?.contains(event.relatedTarget) || cancelBlur) return;
  9946. isFocused.value = false;
  9947. emit("blur", event);
  9948. afterBlur?.();
  9949. };
  9950. const handleClick = (event) => {
  9951. if (unref(disabled) || isFocusable(event.target) || wrapperRef.value?.contains(document.activeElement) && wrapperRef.value !== document.activeElement) return;
  9952. target.value?.focus();
  9953. };
  9954. watch([wrapperRef, () => unref(disabled)], ([el, disabled]) => {
  9955. if (!el) return;
  9956. if (disabled) el.removeAttribute("tabindex");
  9957. else el.setAttribute("tabindex", "-1");
  9958. });
  9959. useEventListener(wrapperRef, "focus", handleFocus, true);
  9960. useEventListener(wrapperRef, "blur", handleBlur, true);
  9961. useEventListener(wrapperRef, "click", handleClick, true);
  9962. return {
  9963. isFocused,
  9964. wrapperRef,
  9965. handleFocus,
  9966. handleBlur
  9967. };
  9968. }
  9969. //#endregion
  9970. //#region ../../packages/hooks/use-composition/index.ts
  9971. function useComposition({ afterComposition, emit }) {
  9972. const isComposing = ref(false);
  9973. const handleCompositionStart = (event) => {
  9974. emit?.("compositionstart", event);
  9975. isComposing.value = true;
  9976. };
  9977. const handleCompositionUpdate = (event) => {
  9978. emit?.("compositionupdate", event);
  9979. isComposing.value = true;
  9980. };
  9981. const handleCompositionEnd = (event) => {
  9982. emit?.("compositionend", event);
  9983. if (isComposing.value) {
  9984. isComposing.value = false;
  9985. nextTick(() => afterComposition(event));
  9986. }
  9987. };
  9988. const handleComposition = (event) => {
  9989. event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
  9990. };
  9991. return {
  9992. isComposing,
  9993. handleComposition,
  9994. handleCompositionStart,
  9995. handleCompositionUpdate,
  9996. handleCompositionEnd
  9997. };
  9998. }
  9999. //#endregion
  10000. //#region ../../packages/hooks/use-empty-values/index.ts
  10001. const emptyValuesContextKey = Symbol("emptyValuesContextKey");
  10002. const SCOPE = "use-empty-values";
  10003. const DEFAULT_EMPTY_VALUES = [
  10004. "",
  10005. void 0,
  10006. null
  10007. ];
  10008. const DEFAULT_VALUE_ON_CLEAR = void 0;
  10009. /**
  10010. * @deprecated Removed after 3.0.0, Use `UseEmptyValuesProps` instead.
  10011. */
  10012. const useEmptyValuesProps = buildProps({
  10013. emptyValues: Array,
  10014. valueOnClear: {
  10015. type: definePropType([
  10016. String,
  10017. Number,
  10018. Boolean,
  10019. Function
  10020. ]),
  10021. default: void 0,
  10022. validator: (val) => {
  10023. val = isFunction$1(val) ? val() : val;
  10024. if (isArray$1(val)) return val.every((item) => !item);
  10025. return !val;
  10026. }
  10027. }
  10028. });
  10029. const useEmptyValues = (props, defaultValue) => {
  10030. const config = getCurrentInstance() ? inject(emptyValuesContextKey, ref({})) : ref({});
  10031. const emptyValues = computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
  10032. const valueOnClear = computed(() => {
  10033. if (isFunction$1(props.valueOnClear)) return props.valueOnClear();
  10034. else if (props.valueOnClear !== void 0) return props.valueOnClear;
  10035. else if (isFunction$1(config.value.valueOnClear)) return config.value.valueOnClear();
  10036. else if (config.value.valueOnClear !== void 0) return config.value.valueOnClear;
  10037. return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
  10038. });
  10039. const isEmptyValue = (value) => {
  10040. let result = true;
  10041. if (isArray$1(value)) result = emptyValues.value.some((emptyValue) => {
  10042. return isEqual$1(value, emptyValue);
  10043. });
  10044. else result = emptyValues.value.includes(value);
  10045. return result;
  10046. };
  10047. if (!isEmptyValue(valueOnClear.value)) /* @__PURE__ */ debugWarn(SCOPE, "value-on-clear should be a value of empty-values");
  10048. return {
  10049. emptyValues,
  10050. valueOnClear,
  10051. isEmptyValue
  10052. };
  10053. };
  10054. //#endregion
  10055. //#region ../../packages/hooks/use-aria/index.ts
  10056. /**
  10057. * @deprecated Removed after 3.0.0, Use `AriaProps` instead.
  10058. */
  10059. const ariaProps = buildProps({
  10060. ariaLabel: String,
  10061. ariaOrientation: {
  10062. type: String,
  10063. values: [
  10064. "horizontal",
  10065. "vertical",
  10066. "undefined"
  10067. ]
  10068. },
  10069. ariaControls: String
  10070. });
  10071. const useAriaProps = (arias) => {
  10072. return pick(ariaProps, arias);
  10073. };
  10074. //#endregion
  10075. //#region ../../packages/components/config-provider/src/constants.ts
  10076. const configProviderContextKey = Symbol();
  10077. //#endregion
  10078. //#region ../../packages/components/config-provider/src/hooks/use-global-config.ts
  10079. const globalConfig = ref();
  10080. function useGlobalConfig(key, defaultValue = void 0) {
  10081. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  10082. if (key) return computed(() => config.value?.[key] ?? defaultValue);
  10083. else return config;
  10084. }
  10085. function useGlobalComponentSettings(block, sizeFallback) {
  10086. const config = useGlobalConfig();
  10087. const ns = useNamespace(block, computed(() => config.value?.namespace || defaultNamespace));
  10088. const locale = useLocale(computed(() => config.value?.locale));
  10089. const zIndex = useZIndex(computed(() => config.value?.zIndex || defaultInitialZIndex));
  10090. const size = computed(() => unref(sizeFallback) || config.value?.size || "");
  10091. provideGlobalConfig(computed(() => unref(config) || {}));
  10092. return {
  10093. ns,
  10094. locale,
  10095. zIndex,
  10096. size
  10097. };
  10098. }
  10099. const provideGlobalConfig = (config, app, global = false) => {
  10100. const inSetup = !!getCurrentInstance();
  10101. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  10102. const provideFn = app?.provide ?? (inSetup ? provide : void 0);
  10103. if (!provideFn) {
  10104. /* @__PURE__ */ debugWarn("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
  10105. return;
  10106. }
  10107. const context = computed(() => {
  10108. const cfg = unref(config);
  10109. if (!oldConfig?.value) return cfg;
  10110. return mergeConfig(oldConfig.value, cfg);
  10111. });
  10112. provideFn(configProviderContextKey, context);
  10113. provideFn(localeContextKey, computed(() => context.value.locale));
  10114. provideFn(namespaceContextKey, computed(() => context.value.namespace));
  10115. provideFn(zIndexContextKey, computed(() => context.value.zIndex));
  10116. provideFn(SIZE_INJECTION_KEY, { size: computed(() => context.value.size || "") });
  10117. provideFn(emptyValuesContextKey, computed(() => ({
  10118. emptyValues: context.value.emptyValues,
  10119. valueOnClear: context.value.valueOnClear
  10120. })));
  10121. if (global || !globalConfig.value) globalConfig.value = context.value;
  10122. return context;
  10123. };
  10124. const mergeConfig = (a, b) => {
  10125. const keys = [...new Set([...keysOf(a), ...keysOf(b)])];
  10126. const obj = {};
  10127. for (const key of keys) obj[key] = b[key] !== void 0 ? b[key] : a[key];
  10128. return obj;
  10129. };
  10130. //#endregion
  10131. //#region ../../packages/components/config-provider/src/config-provider-props.ts
  10132. const configProviderProps = buildProps({
  10133. a11y: {
  10134. type: Boolean,
  10135. default: true
  10136. },
  10137. locale: { type: definePropType(Object) },
  10138. size: useSizeProp,
  10139. button: { type: definePropType(Object) },
  10140. card: { type: definePropType(Object) },
  10141. dialog: { type: definePropType(Object) },
  10142. link: { type: definePropType(Object) },
  10143. experimentalFeatures: { type: definePropType(Object) },
  10144. keyboardNavigation: {
  10145. type: Boolean,
  10146. default: true
  10147. },
  10148. message: { type: definePropType(Object) },
  10149. zIndex: Number,
  10150. namespace: {
  10151. type: String,
  10152. default: "el"
  10153. },
  10154. table: { type: definePropType(Object) },
  10155. ...useEmptyValuesProps
  10156. });
  10157. //#endregion
  10158. //#region ../../packages/components/config-provider/src/config-provider.ts
  10159. const messageConfig = { placement: "top" };
  10160. const ConfigProvider = defineComponent({
  10161. name: "ElConfigProvider",
  10162. props: configProviderProps,
  10163. setup(props, { slots }) {
  10164. const config = provideGlobalConfig(props);
  10165. watch(() => props.message, (val) => {
  10166. Object.assign(messageConfig, config?.value?.message ?? {}, val ?? {});
  10167. }, {
  10168. immediate: true,
  10169. deep: true
  10170. });
  10171. return () => renderSlot(slots, "default", { config: config?.value });
  10172. }
  10173. });
  10174. //#endregion
  10175. //#region ../../packages/components/config-provider/index.ts
  10176. const ElConfigProvider = withInstall(ConfigProvider);
  10177. //#endregion
  10178. //#region ../../packages/element-plus/version.ts
  10179. const version$1 = "2.13.6";
  10180. //#endregion
  10181. //#region ../../packages/element-plus/make-installer.ts
  10182. const makeInstaller = (components = []) => {
  10183. const install = (app, options) => {
  10184. if (app[INSTALLED_KEY]) return;
  10185. app[INSTALLED_KEY] = true;
  10186. components.forEach((c) => app.use(c));
  10187. if (options) provideGlobalConfig(options, app, true);
  10188. };
  10189. return {
  10190. version: version$1,
  10191. install
  10192. };
  10193. };
  10194. //#endregion
  10195. //#region ../../packages/components/teleport/src/teleport.ts
  10196. const teleportProps = buildProps({
  10197. to: {
  10198. type: definePropType([String, Object]),
  10199. required: true
  10200. },
  10201. disabled: Boolean
  10202. });
  10203. //#endregion
  10204. //#region ../../packages/components/teleport/src/teleport.vue?vue&type=script&setup=true&lang.ts
  10205. var teleport_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  10206. __name: "teleport",
  10207. props: teleportProps,
  10208. setup(__props) {
  10209. return (_ctx, _cache) => {
  10210. return _ctx.disabled ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createBlock(Teleport, {
  10211. key: 1,
  10212. to: _ctx.to
  10213. }, [renderSlot(_ctx.$slots, "default")], 8, ["to"]));
  10214. };
  10215. }
  10216. });
  10217. //#endregion
  10218. //#region ../../packages/components/teleport/src/teleport.vue
  10219. var teleport_default = teleport_vue_vue_type_script_setup_true_lang_default;
  10220. //#endregion
  10221. //#region ../../packages/components/teleport/index.ts
  10222. const ElTeleport = withInstall(teleport_default);
  10223. //#endregion
  10224. //#region ../../packages/components/affix/src/affix.ts
  10225. /**
  10226. * @deprecated Removed after 3.0.0, Use `AffixProps` instead.
  10227. */
  10228. const affixProps = buildProps({
  10229. zIndex: {
  10230. type: definePropType([Number, String]),
  10231. default: 100
  10232. },
  10233. target: {
  10234. type: String,
  10235. default: ""
  10236. },
  10237. offset: {
  10238. type: Number,
  10239. default: 0
  10240. },
  10241. position: {
  10242. type: String,
  10243. values: ["top", "bottom"],
  10244. default: "top"
  10245. },
  10246. teleported: Boolean,
  10247. appendTo: {
  10248. type: teleportProps.to.type,
  10249. default: "body"
  10250. }
  10251. });
  10252. const affixEmits = {
  10253. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  10254. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  10255. };
  10256. //#endregion
  10257. //#region ../../packages/components/affix/src/affix.vue?vue&type=script&setup=true&lang.ts
  10258. const COMPONENT_NAME$22 = "ElAffix";
  10259. var affix_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  10260. name: COMPONENT_NAME$22,
  10261. __name: "affix",
  10262. props: affixProps,
  10263. emits: affixEmits,
  10264. setup(__props, { expose: __expose, emit: __emit }) {
  10265. const props = __props;
  10266. const emit = __emit;
  10267. const ns = useNamespace("affix");
  10268. const target = shallowRef();
  10269. const root = shallowRef();
  10270. const scrollContainer = shallowRef();
  10271. const { height: windowHeight } = useWindowSize();
  10272. const { height: rootHeight, width: rootWidth, top: rootTop, bottom: rootBottom, left: rootLeft, update: updateRoot } = useElementBounding(root, { windowScroll: false });
  10273. const targetRect = useElementBounding(target);
  10274. const fixed = ref(false);
  10275. const scrollTop = ref(0);
  10276. const transform = ref(0);
  10277. const teleportDisabled = computed(() => {
  10278. return !props.teleported || !fixed.value;
  10279. });
  10280. const rootStyle = computed(() => {
  10281. return {
  10282. display: "flow-root",
  10283. height: fixed.value ? `${rootHeight.value}px` : "",
  10284. width: fixed.value ? `${rootWidth.value}px` : ""
  10285. };
  10286. });
  10287. const affixStyle = computed(() => {
  10288. if (!fixed.value) return {};
  10289. const offset = addUnit(props.offset);
  10290. return {
  10291. height: `${rootHeight.value}px`,
  10292. width: `${rootWidth.value}px`,
  10293. top: props.position === "top" ? offset : "",
  10294. bottom: props.position === "bottom" ? offset : "",
  10295. left: props.teleported ? `${rootLeft.value}px` : "",
  10296. transform: transform.value ? `translateY(${transform.value}px)` : "",
  10297. zIndex: props.zIndex
  10298. };
  10299. });
  10300. const update = () => {
  10301. if (!scrollContainer.value) return;
  10302. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  10303. const { position, target, offset } = props;
  10304. const rootHeightOffset = offset + rootHeight.value;
  10305. if (position === "top") if (target) {
  10306. const difference = targetRect.bottom.value - rootHeightOffset;
  10307. fixed.value = offset > rootTop.value && targetRect.bottom.value > 0;
  10308. transform.value = difference < 0 ? difference : 0;
  10309. } else fixed.value = offset > rootTop.value;
  10310. else if (target) {
  10311. const difference = windowHeight.value - targetRect.top.value - rootHeightOffset;
  10312. fixed.value = windowHeight.value - offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  10313. transform.value = difference < 0 ? -difference : 0;
  10314. } else fixed.value = windowHeight.value - offset < rootBottom.value;
  10315. };
  10316. const updateRootRect = async () => {
  10317. if (!fixed.value) {
  10318. updateRoot();
  10319. return;
  10320. }
  10321. fixed.value = false;
  10322. await nextTick();
  10323. updateRoot();
  10324. fixed.value = true;
  10325. };
  10326. const handleScroll = async () => {
  10327. updateRoot();
  10328. await nextTick();
  10329. emit("scroll", {
  10330. scrollTop: scrollTop.value,
  10331. fixed: fixed.value
  10332. });
  10333. };
  10334. watch(fixed, (val) => emit(CHANGE_EVENT, val));
  10335. onMounted(() => {
  10336. if (props.target) {
  10337. target.value = document.querySelector(props.target) ?? void 0;
  10338. if (!target.value) throwError(COMPONENT_NAME$22, `Target does not exist: ${props.target}`);
  10339. } else target.value = document.documentElement;
  10340. scrollContainer.value = getScrollContainer(root.value, true);
  10341. updateRoot();
  10342. });
  10343. onActivated(() => {
  10344. nextTick(updateRootRect);
  10345. });
  10346. onDeactivated(() => {
  10347. fixed.value = false;
  10348. });
  10349. useEventListener(scrollContainer, "scroll", handleScroll);
  10350. watchEffect(update);
  10351. __expose({
  10352. update,
  10353. updateRoot: updateRootRect
  10354. });
  10355. return (_ctx, _cache) => {
  10356. return openBlock(), createElementBlock("div", {
  10357. ref_key: "root",
  10358. ref: root,
  10359. class: normalizeClass(unref(ns).b()),
  10360. style: normalizeStyle(rootStyle.value)
  10361. }, [createVNode(unref(ElTeleport), {
  10362. disabled: teleportDisabled.value,
  10363. to: __props.appendTo
  10364. }, {
  10365. default: withCtx(() => [createElementVNode("div", {
  10366. class: normalizeClass({ [unref(ns).m("fixed")]: fixed.value }),
  10367. style: normalizeStyle(affixStyle.value)
  10368. }, [renderSlot(_ctx.$slots, "default")], 6)]),
  10369. _: 3
  10370. }, 8, ["disabled", "to"])], 6);
  10371. };
  10372. }
  10373. });
  10374. //#endregion
  10375. //#region ../../packages/components/affix/src/affix.vue
  10376. var affix_default = affix_vue_vue_type_script_setup_true_lang_default;
  10377. //#endregion
  10378. //#region ../../packages/components/affix/index.ts
  10379. const ElAffix = withInstall(affix_default);
  10380. //#endregion
  10381. //#region ../../packages/components/alert/src/alert.ts
  10382. const alertEffects = ["light", "dark"];
  10383. /**
  10384. * @deprecated Removed after 3.0.0, Use `AlertProps` instead.
  10385. */
  10386. const alertProps = buildProps({
  10387. title: {
  10388. type: String,
  10389. default: ""
  10390. },
  10391. description: {
  10392. type: String,
  10393. default: ""
  10394. },
  10395. type: {
  10396. type: String,
  10397. values: keysOf(TypeComponentsMap),
  10398. default: "info"
  10399. },
  10400. closable: {
  10401. type: Boolean,
  10402. default: true
  10403. },
  10404. closeText: {
  10405. type: String,
  10406. default: ""
  10407. },
  10408. showIcon: Boolean,
  10409. center: Boolean,
  10410. effect: {
  10411. type: String,
  10412. values: alertEffects,
  10413. default: "light"
  10414. }
  10415. });
  10416. const alertEmits = { close: (evt) => evt instanceof MouseEvent };
  10417. //#endregion
  10418. //#region ../../packages/components/icon/src/icon.ts
  10419. /**
  10420. * @deprecated Removed after 3.0.0, Use `IconProps` instead.
  10421. */
  10422. const iconProps = buildProps({
  10423. size: { type: definePropType([Number, String]) },
  10424. color: { type: String }
  10425. });
  10426. //#endregion
  10427. //#region ../../packages/components/icon/src/icon.vue?vue&type=script&setup=true&lang.ts
  10428. var icon_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  10429. name: "ElIcon",
  10430. inheritAttrs: false,
  10431. __name: "icon",
  10432. props: iconProps,
  10433. setup(__props) {
  10434. const props = __props;
  10435. const ns = useNamespace("icon");
  10436. const style = computed(() => {
  10437. const { size, color } = props;
  10438. const fontSize = addUnit(size);
  10439. if (!fontSize && !color) return {};
  10440. return {
  10441. fontSize,
  10442. "--color": color
  10443. };
  10444. });
  10445. return (_ctx, _cache) => {
  10446. return openBlock(), createElementBlock("i", mergeProps({
  10447. class: unref(ns).b(),
  10448. style: style.value
  10449. }, _ctx.$attrs), [renderSlot(_ctx.$slots, "default")], 16);
  10450. };
  10451. }
  10452. });
  10453. //#endregion
  10454. //#region ../../packages/components/icon/src/icon.vue
  10455. var icon_default = icon_vue_vue_type_script_setup_true_lang_default;
  10456. //#endregion
  10457. //#region ../../packages/components/icon/index.ts
  10458. const ElIcon = withInstall(icon_default);
  10459. //#endregion
  10460. //#region ../../packages/components/alert/src/alert.vue?vue&type=script&setup=true&lang.ts
  10461. var alert_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  10462. name: "ElAlert",
  10463. __name: "alert",
  10464. props: alertProps,
  10465. emits: alertEmits,
  10466. setup(__props, { emit: __emit }) {
  10467. const { Close } = TypeComponents;
  10468. const props = __props;
  10469. const emit = __emit;
  10470. const slots = useSlots();
  10471. const ns = useNamespace("alert");
  10472. const visible = ref(true);
  10473. const iconComponent = computed(() => TypeComponentsMap[props.type]);
  10474. const hasDesc = computed(() => {
  10475. if (props.description) return true;
  10476. const slotContent = slots.default?.();
  10477. if (!slotContent) return false;
  10478. return flattedChildren(slotContent).some((child) => !isComment(child));
  10479. });
  10480. const close = (evt) => {
  10481. visible.value = false;
  10482. emit("close", evt);
  10483. };
  10484. return (_ctx, _cache) => {
  10485. return openBlock(), createBlock(Transition, {
  10486. name: unref(ns).b("fade"),
  10487. persisted: ""
  10488. }, {
  10489. default: withCtx(() => [withDirectives(createElementVNode("div", {
  10490. class: normalizeClass([
  10491. unref(ns).b(),
  10492. unref(ns).m(__props.type),
  10493. unref(ns).is("center", __props.center),
  10494. unref(ns).is(__props.effect)
  10495. ]),
  10496. role: "alert"
  10497. }, [__props.showIcon && (_ctx.$slots.icon || iconComponent.value) ? (openBlock(), createBlock(unref(ElIcon), {
  10498. key: 0,
  10499. class: normalizeClass([unref(ns).e("icon"), unref(ns).is("big", hasDesc.value)])
  10500. }, {
  10501. default: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, () => [(openBlock(), createBlock(resolveDynamicComponent(iconComponent.value)))])]),
  10502. _: 3
  10503. }, 8, ["class"])) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("content")) }, [
  10504. __props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", {
  10505. key: 0,
  10506. class: normalizeClass([unref(ns).e("title"), { "with-description": hasDesc.value }])
  10507. }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2)) : createCommentVNode("v-if", true),
  10508. hasDesc.value ? (openBlock(), createElementBlock("p", {
  10509. key: 1,
  10510. class: normalizeClass(unref(ns).e("description"))
  10511. }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])], 2)) : createCommentVNode("v-if", true),
  10512. __props.closable ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [__props.closeText ? (openBlock(), createElementBlock("div", {
  10513. key: 0,
  10514. class: normalizeClass([unref(ns).e("close-btn"), unref(ns).is("customed")]),
  10515. onClick: close
  10516. }, toDisplayString(__props.closeText), 3)) : (openBlock(), createBlock(unref(ElIcon), {
  10517. key: 1,
  10518. class: normalizeClass(unref(ns).e("close-btn")),
  10519. onClick: close
  10520. }, {
  10521. default: withCtx(() => [createVNode(unref(Close))]),
  10522. _: 1
  10523. }, 8, ["class"]))], 64)) : createCommentVNode("v-if", true)
  10524. ], 2)], 2), [[vShow, visible.value]])]),
  10525. _: 3
  10526. }, 8, ["name"]);
  10527. };
  10528. }
  10529. });
  10530. //#endregion
  10531. //#region ../../packages/components/alert/src/alert.vue
  10532. var alert_default = alert_vue_vue_type_script_setup_true_lang_default;
  10533. //#endregion
  10534. //#region ../../packages/components/alert/index.ts
  10535. const ElAlert = withInstall(alert_default);
  10536. //#endregion
  10537. //#region ../../packages/components/popper/src/popper.ts
  10538. const Effect = {
  10539. LIGHT: "light",
  10540. DARK: "dark"
  10541. };
  10542. const roleTypes = [
  10543. "dialog",
  10544. "grid",
  10545. "group",
  10546. "listbox",
  10547. "menu",
  10548. "navigation",
  10549. "tooltip",
  10550. "tree"
  10551. ];
  10552. /**
  10553. * @deprecated Removed after 3.0.0, Use `PopperProps` instead.
  10554. */
  10555. const popperProps = buildProps({ role: {
  10556. type: String,
  10557. values: roleTypes,
  10558. default: "tooltip"
  10559. } });
  10560. /** @deprecated use `popperProps` instead, and it will be deprecated in the next major version */
  10561. const usePopperProps = popperProps;
  10562. //#endregion
  10563. //#region ../../packages/components/popper/src/constants.ts
  10564. const POPPER_INJECTION_KEY = Symbol("popper");
  10565. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  10566. //#endregion
  10567. //#region ../../packages/components/popper/src/popper.vue?vue&type=script&setup=true&lang.ts
  10568. var popper_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  10569. name: "ElPopper",
  10570. inheritAttrs: false,
  10571. __name: "popper",
  10572. props: popperProps,
  10573. setup(__props, { expose: __expose }) {
  10574. const props = __props;
  10575. const popperProvides = {
  10576. triggerRef: ref(),
  10577. popperInstanceRef: ref(),
  10578. contentRef: ref(),
  10579. referenceRef: ref(),
  10580. role: computed(() => props.role)
  10581. };
  10582. __expose(popperProvides);
  10583. provide(POPPER_INJECTION_KEY, popperProvides);
  10584. return (_ctx, _cache) => {
  10585. return renderSlot(_ctx.$slots, "default");
  10586. };
  10587. }
  10588. });
  10589. //#endregion
  10590. //#region ../../packages/components/popper/src/popper.vue
  10591. var popper_default = popper_vue_vue_type_script_setup_true_lang_default;
  10592. //#endregion
  10593. //#region ../../packages/components/popper/src/arrow.vue?vue&type=script&setup=true&lang.ts
  10594. var arrow_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  10595. name: "ElPopperArrow",
  10596. inheritAttrs: false,
  10597. __name: "arrow",
  10598. setup(__props, { expose: __expose }) {
  10599. const ns = useNamespace("popper");
  10600. const { arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  10601. onBeforeUnmount(() => {
  10602. arrowRef.value = void 0;
  10603. });
  10604. __expose({ arrowRef });
  10605. return (_ctx, _cache) => {
  10606. return openBlock(), createElementBlock("span", {
  10607. ref_key: "arrowRef",
  10608. ref: arrowRef,
  10609. class: normalizeClass(unref(ns).e("arrow")),
  10610. style: normalizeStyle(unref(arrowStyle)),
  10611. "data-popper-arrow": ""
  10612. }, null, 6);
  10613. };
  10614. }
  10615. });
  10616. //#endregion
  10617. //#region ../../packages/components/popper/src/arrow.vue
  10618. var arrow_default = arrow_vue_vue_type_script_setup_true_lang_default;
  10619. //#endregion
  10620. //#region ../../packages/components/popper/src/trigger.ts
  10621. /**
  10622. * @deprecated Removed after 3.0.0, Use `PopperTriggerProps` instead.
  10623. */
  10624. const popperTriggerProps = buildProps({
  10625. virtualRef: { type: definePropType(Object) },
  10626. virtualTriggering: Boolean,
  10627. onMouseenter: { type: definePropType(Function) },
  10628. onMouseleave: { type: definePropType(Function) },
  10629. onClick: { type: definePropType(Function) },
  10630. onKeydown: { type: definePropType(Function) },
  10631. onFocus: { type: definePropType(Function) },
  10632. onBlur: { type: definePropType(Function) },
  10633. onContextmenu: { type: definePropType(Function) },
  10634. id: String,
  10635. open: Boolean
  10636. });
  10637. /** @deprecated use `popperTriggerProps` instead, and it will be deprecated in the next major version */
  10638. const usePopperTriggerProps = popperTriggerProps;
  10639. //#endregion
  10640. //#region ../../packages/components/slot/src/only-child.tsx
  10641. const NAME = "ElOnlyChild";
  10642. const OnlyChild = /* @__PURE__ */ defineComponent({
  10643. name: NAME,
  10644. setup(_, { slots, attrs }) {
  10645. const forwardRefDirective = useForwardRefDirective(inject(FORWARD_REF_INJECTION_KEY)?.setForwardRef ?? NOOP);
  10646. return () => {
  10647. const defaultSlot = slots.default?.(attrs);
  10648. if (!defaultSlot) return null;
  10649. const [firstLegitNode, length] = findFirstLegitChild(defaultSlot);
  10650. if (!firstLegitNode) {
  10651. /* @__PURE__ */ debugWarn(NAME, "no valid child node found");
  10652. return null;
  10653. }
  10654. if (length > 1) /* @__PURE__ */ debugWarn(NAME, "requires exact only one valid child.");
  10655. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  10656. };
  10657. }
  10658. });
  10659. function findFirstLegitChild(node) {
  10660. if (!node) return [null, 0];
  10661. const children = node;
  10662. const len = children.filter((c) => c.type !== Comment).length;
  10663. for (const child of children) {
  10664. /**
  10665. * when user uses h(Fragment, [text]) to render plain string,
  10666. * this switch case just cannot handle, when the value is primitives
  10667. * we should just return the wrapped string
  10668. */
  10669. if (isObject$1(child)) switch (child.type) {
  10670. case Comment: continue;
  10671. case Text:
  10672. case "svg": return [wrapTextContent(child), len];
  10673. case Fragment: return findFirstLegitChild(child.children);
  10674. default: return [child, len];
  10675. }
  10676. return [wrapTextContent(child), len];
  10677. }
  10678. return [null, 0];
  10679. }
  10680. function wrapTextContent(s) {
  10681. const ns = useNamespace("only-child");
  10682. return createVNode("span", { "class": ns.e("content") }, [s]);
  10683. }
  10684. //#endregion
  10685. //#region ../../packages/components/popper/src/trigger.vue?vue&type=script&setup=true&lang.ts
  10686. var trigger_vue_vue_type_script_setup_true_lang_default$1 = /* @__PURE__ */ defineComponent({
  10687. name: "ElPopperTrigger",
  10688. inheritAttrs: false,
  10689. __name: "trigger",
  10690. props: popperTriggerProps,
  10691. setup(__props, { expose: __expose }) {
  10692. const props = __props;
  10693. const { role, triggerRef } = inject(POPPER_INJECTION_KEY, void 0);
  10694. useForwardRef(triggerRef);
  10695. const ariaControls = computed(() => {
  10696. return ariaHaspopup.value ? props.id : void 0;
  10697. });
  10698. const ariaDescribedby = computed(() => {
  10699. if (role && role.value === "tooltip") return props.open && props.id ? props.id : void 0;
  10700. });
  10701. const ariaHaspopup = computed(() => {
  10702. if (role && role.value !== "tooltip") return role.value;
  10703. });
  10704. const ariaExpanded = computed(() => {
  10705. return ariaHaspopup.value ? `${props.open}` : void 0;
  10706. });
  10707. let virtualTriggerAriaStopWatch = void 0;
  10708. const TRIGGER_ELE_EVENTS = [
  10709. "onMouseenter",
  10710. "onMouseleave",
  10711. "onClick",
  10712. "onKeydown",
  10713. "onFocus",
  10714. "onBlur",
  10715. "onContextmenu"
  10716. ];
  10717. onMounted(() => {
  10718. watch(() => props.virtualRef, (virtualEl) => {
  10719. if (virtualEl) triggerRef.value = unrefElement(virtualEl);
  10720. }, { immediate: true });
  10721. watch(triggerRef, (el, prevEl) => {
  10722. virtualTriggerAriaStopWatch?.();
  10723. virtualTriggerAriaStopWatch = void 0;
  10724. if (isElement$1(prevEl)) TRIGGER_ELE_EVENTS.forEach((eventName) => {
  10725. const handler = props[eventName];
  10726. if (handler) prevEl.removeEventListener(eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  10727. });
  10728. if (isElement$1(el)) {
  10729. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  10730. const handler = props[eventName];
  10731. if (handler) el.addEventListener(eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  10732. });
  10733. if (isFocusable(el)) virtualTriggerAriaStopWatch = watch([
  10734. ariaControls,
  10735. ariaDescribedby,
  10736. ariaHaspopup,
  10737. ariaExpanded
  10738. ], (watches) => {
  10739. [
  10740. "aria-controls",
  10741. "aria-describedby",
  10742. "aria-haspopup",
  10743. "aria-expanded"
  10744. ].forEach((key, idx) => {
  10745. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  10746. });
  10747. }, { immediate: true });
  10748. }
  10749. if (isElement$1(prevEl) && isFocusable(prevEl)) [
  10750. "aria-controls",
  10751. "aria-describedby",
  10752. "aria-haspopup",
  10753. "aria-expanded"
  10754. ].forEach((key) => prevEl.removeAttribute(key));
  10755. }, { immediate: true });
  10756. });
  10757. onBeforeUnmount(() => {
  10758. virtualTriggerAriaStopWatch?.();
  10759. virtualTriggerAriaStopWatch = void 0;
  10760. if (triggerRef.value && isElement$1(triggerRef.value)) {
  10761. const el = triggerRef.value;
  10762. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  10763. const handler = props[eventName];
  10764. if (handler) el.removeEventListener(eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  10765. });
  10766. triggerRef.value = void 0;
  10767. }
  10768. });
  10769. __expose({ triggerRef });
  10770. return (_ctx, _cache) => {
  10771. return !__props.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  10772. "aria-controls": ariaControls.value,
  10773. "aria-describedby": ariaDescribedby.value,
  10774. "aria-expanded": ariaExpanded.value,
  10775. "aria-haspopup": ariaHaspopup.value
  10776. }), {
  10777. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  10778. _: 3
  10779. }, 16, [
  10780. "aria-controls",
  10781. "aria-describedby",
  10782. "aria-expanded",
  10783. "aria-haspopup"
  10784. ])) : createCommentVNode("v-if", true);
  10785. };
  10786. }
  10787. });
  10788. //#endregion
  10789. //#region ../../packages/components/popper/src/trigger.vue
  10790. var trigger_default = trigger_vue_vue_type_script_setup_true_lang_default$1;
  10791. //#endregion
  10792. //#region ../../packages/components/popper/src/arrow.ts
  10793. /**
  10794. * @deprecated Removed after 3.0.0, Use `PopperArrowProps` instead.
  10795. */
  10796. const popperArrowProps = buildProps({ arrowOffset: {
  10797. type: Number,
  10798. default: 5
  10799. } });
  10800. const popperArrowPropsDefaults = { arrowOffset: 5 };
  10801. /** @deprecated use `popperArrowProps` instead, and it will be deprecated in the next major version */
  10802. const usePopperArrowProps = popperArrowProps;
  10803. //#endregion
  10804. //#region ../../packages/components/popper/src/content.ts
  10805. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  10806. /**
  10807. * @deprecated Removed after 3.0.0, Use `PopperCoreConfigProps` instead.
  10808. */
  10809. const popperCoreConfigProps = buildProps({
  10810. boundariesPadding: {
  10811. type: Number,
  10812. default: 0
  10813. },
  10814. fallbackPlacements: {
  10815. type: definePropType(Array),
  10816. default: void 0
  10817. },
  10818. gpuAcceleration: {
  10819. type: Boolean,
  10820. default: true
  10821. },
  10822. offset: {
  10823. type: Number,
  10824. default: 12
  10825. },
  10826. placement: {
  10827. type: String,
  10828. values: Ee,
  10829. default: "bottom"
  10830. },
  10831. popperOptions: {
  10832. type: definePropType(Object),
  10833. default: () => ({})
  10834. },
  10835. strategy: {
  10836. type: String,
  10837. values: POSITIONING_STRATEGIES,
  10838. default: "absolute"
  10839. }
  10840. });
  10841. /**
  10842. * @deprecated Removed after 3.0.0, Use `PopperContentProps` instead.
  10843. */
  10844. const popperContentProps = buildProps({
  10845. ...popperCoreConfigProps,
  10846. ...popperArrowProps,
  10847. id: String,
  10848. style: { type: definePropType([
  10849. String,
  10850. Array,
  10851. Object
  10852. ]) },
  10853. className: { type: definePropType([
  10854. String,
  10855. Array,
  10856. Object
  10857. ]) },
  10858. effect: {
  10859. type: definePropType(String),
  10860. default: "dark"
  10861. },
  10862. visible: Boolean,
  10863. enterable: {
  10864. type: Boolean,
  10865. default: true
  10866. },
  10867. pure: Boolean,
  10868. focusOnShow: Boolean,
  10869. trapping: Boolean,
  10870. popperClass: { type: definePropType([
  10871. String,
  10872. Array,
  10873. Object
  10874. ]) },
  10875. popperStyle: { type: definePropType([
  10876. String,
  10877. Array,
  10878. Object
  10879. ]) },
  10880. referenceEl: { type: definePropType(Object) },
  10881. triggerTargetEl: { type: definePropType(Object) },
  10882. stopPopperMouseEvent: {
  10883. type: Boolean,
  10884. default: true
  10885. },
  10886. virtualTriggering: Boolean,
  10887. zIndex: Number,
  10888. ...useAriaProps(["ariaLabel"]),
  10889. loop: Boolean
  10890. });
  10891. const popperCoreConfigPropsDefaults = {
  10892. boundariesPadding: 0,
  10893. gpuAcceleration: true,
  10894. offset: 12,
  10895. placement: "bottom",
  10896. popperOptions: () => ({}),
  10897. strategy: "absolute"
  10898. };
  10899. const popperContentPropsDefaults = {
  10900. ...popperCoreConfigPropsDefaults,
  10901. ...popperArrowPropsDefaults,
  10902. effect: "dark",
  10903. enterable: true,
  10904. stopPopperMouseEvent: true,
  10905. visible: false,
  10906. pure: false,
  10907. focusOnShow: false,
  10908. trapping: false,
  10909. virtualTriggering: false,
  10910. loop: false,
  10911. style: void 0,
  10912. popperStyle: void 0
  10913. };
  10914. const popperContentEmits = {
  10915. mouseenter: (evt) => evt instanceof MouseEvent,
  10916. mouseleave: (evt) => evt instanceof MouseEvent,
  10917. focus: () => true,
  10918. blur: () => true,
  10919. close: () => true
  10920. };
  10921. /** @deprecated use `popperCoreConfigProps` instead, and it will be deprecated in the next major version */
  10922. const usePopperCoreConfigProps = popperCoreConfigProps;
  10923. /** @deprecated use `popperContentProps` instead, and it will be deprecated in the next major version */
  10924. const usePopperContentProps = popperContentProps;
  10925. /** @deprecated use `popperContentEmits` instead, and it will be deprecated in the next major version */
  10926. const usePopperContentEmits = popperContentEmits;
  10927. //#endregion
  10928. //#region ../../packages/components/focus-trap/src/tokens.ts
  10929. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  10930. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  10931. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  10932. const FOCUS_AFTER_TRAPPED_OPTS = {
  10933. cancelable: true,
  10934. bubbles: false
  10935. };
  10936. const FOCUSOUT_PREVENTED_OPTS = {
  10937. cancelable: true,
  10938. bubbles: false
  10939. };
  10940. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  10941. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  10942. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  10943. //#endregion
  10944. //#region ../../packages/components/focus-trap/src/utils.ts
  10945. const focusReason = ref();
  10946. const lastUserFocusTimestamp = ref(0);
  10947. const lastAutomatedFocusTimestamp = ref(0);
  10948. let focusReasonUserCount = 0;
  10949. const obtainAllFocusableElements = (element) => {
  10950. const nodes = [];
  10951. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, { acceptNode: (node) => {
  10952. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  10953. if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
  10954. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  10955. } });
  10956. while (walker.nextNode()) nodes.push(walker.currentNode);
  10957. return nodes;
  10958. };
  10959. const getVisibleElement = (elements, container) => {
  10960. for (const element of elements) if (!isHidden(element, container)) return element;
  10961. };
  10962. const isHidden = (element, container) => {
  10963. if (getComputedStyle(element).visibility === "hidden") return true;
  10964. while (element) {
  10965. if (container && element === container) return false;
  10966. if (getComputedStyle(element).display === "none") return true;
  10967. element = element.parentElement;
  10968. }
  10969. return false;
  10970. };
  10971. const getEdges = (container) => {
  10972. const focusable = obtainAllFocusableElements(container);
  10973. return [getVisibleElement(focusable, container), getVisibleElement(focusable.reverse(), container)];
  10974. };
  10975. const isSelectable = (element) => {
  10976. return element instanceof HTMLInputElement && "select" in element;
  10977. };
  10978. const tryFocus = (element, shouldSelect) => {
  10979. if (element) {
  10980. const prevFocusedElement = document.activeElement;
  10981. focusElement(element, { preventScroll: true });
  10982. lastAutomatedFocusTimestamp.value = window.performance.now();
  10983. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) element.select();
  10984. }
  10985. };
  10986. function removeFromStack(list, item) {
  10987. const copy = [...list];
  10988. const idx = list.indexOf(item);
  10989. if (idx !== -1) copy.splice(idx, 1);
  10990. return copy;
  10991. }
  10992. const createFocusableStack = () => {
  10993. let stack = [];
  10994. const push = (layer) => {
  10995. const currentLayer = stack[0];
  10996. if (currentLayer && layer !== currentLayer) currentLayer.pause();
  10997. stack = removeFromStack(stack, layer);
  10998. stack.unshift(layer);
  10999. };
  11000. const remove = (layer) => {
  11001. stack = removeFromStack(stack, layer);
  11002. stack[0]?.resume?.();
  11003. };
  11004. return {
  11005. push,
  11006. remove
  11007. };
  11008. };
  11009. const focusFirstDescendant = (elements, shouldSelect = false) => {
  11010. const prevFocusedElement = document.activeElement;
  11011. for (const element of elements) {
  11012. tryFocus(element, shouldSelect);
  11013. if (document.activeElement !== prevFocusedElement) return;
  11014. }
  11015. };
  11016. const focusableStack = createFocusableStack();
  11017. const isFocusCausedByUserEvent = () => {
  11018. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  11019. };
  11020. const notifyFocusReasonPointer = () => {
  11021. focusReason.value = "pointer";
  11022. lastUserFocusTimestamp.value = window.performance.now();
  11023. };
  11024. const notifyFocusReasonKeydown = () => {
  11025. focusReason.value = "keyboard";
  11026. lastUserFocusTimestamp.value = window.performance.now();
  11027. };
  11028. const useFocusReason = () => {
  11029. onMounted(() => {
  11030. if (focusReasonUserCount === 0) {
  11031. document.addEventListener("mousedown", notifyFocusReasonPointer);
  11032. document.addEventListener("touchstart", notifyFocusReasonPointer);
  11033. document.addEventListener("keydown", notifyFocusReasonKeydown);
  11034. }
  11035. focusReasonUserCount++;
  11036. });
  11037. onBeforeUnmount(() => {
  11038. focusReasonUserCount--;
  11039. if (focusReasonUserCount <= 0) {
  11040. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  11041. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  11042. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  11043. }
  11044. });
  11045. return {
  11046. focusReason,
  11047. lastUserFocusTimestamp,
  11048. lastAutomatedFocusTimestamp
  11049. };
  11050. };
  11051. const createFocusOutPreventedEvent = (detail) => {
  11052. return new CustomEvent(FOCUSOUT_PREVENTED, {
  11053. ...FOCUSOUT_PREVENTED_OPTS,
  11054. detail
  11055. });
  11056. };
  11057. //#endregion
  11058. //#region ../../packages/components/focus-trap/src/focus-trap.vue?vue&type=script&lang.ts
  11059. var focus_trap_vue_vue_type_script_lang_default = defineComponent({
  11060. name: "ElFocusTrap",
  11061. inheritAttrs: false,
  11062. props: {
  11063. loop: Boolean,
  11064. trapped: Boolean,
  11065. focusTrapEl: Object,
  11066. focusStartEl: {
  11067. type: [Object, String],
  11068. default: "first"
  11069. }
  11070. },
  11071. emits: [
  11072. ON_TRAP_FOCUS_EVT,
  11073. ON_RELEASE_FOCUS_EVT,
  11074. "focusin",
  11075. "focusout",
  11076. "focusout-prevented",
  11077. "release-requested"
  11078. ],
  11079. setup(props, { emit }) {
  11080. const forwardRef = ref();
  11081. let lastFocusBeforeTrapped;
  11082. let lastFocusAfterTrapped;
  11083. const { focusReason } = useFocusReason();
  11084. useEscapeKeydown((event) => {
  11085. if (props.trapped && !focusLayer.paused) emit("release-requested", event);
  11086. });
  11087. const focusLayer = {
  11088. paused: false,
  11089. pause() {
  11090. this.paused = true;
  11091. },
  11092. resume() {
  11093. this.paused = false;
  11094. }
  11095. };
  11096. const onKeydown = (e) => {
  11097. if (!props.loop && !props.trapped) return;
  11098. if (focusLayer.paused) return;
  11099. const { altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  11100. const { loop } = props;
  11101. const isTabbing = getEventCode(e) === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  11102. const currentFocusingEl = document.activeElement;
  11103. if (isTabbing && currentFocusingEl) {
  11104. const container = currentTarget;
  11105. const [first, last] = getEdges(container);
  11106. if (!(first && last)) {
  11107. if (currentFocusingEl === container) {
  11108. const focusoutPreventedEvent = createFocusOutPreventedEvent({ focusReason: focusReason.value });
  11109. emit("focusout-prevented", focusoutPreventedEvent);
  11110. if (!focusoutPreventedEvent.defaultPrevented) e.preventDefault();
  11111. }
  11112. } else if (!shiftKey && currentFocusingEl === last) {
  11113. const focusoutPreventedEvent = createFocusOutPreventedEvent({ focusReason: focusReason.value });
  11114. emit("focusout-prevented", focusoutPreventedEvent);
  11115. if (!focusoutPreventedEvent.defaultPrevented) {
  11116. e.preventDefault();
  11117. if (loop) tryFocus(first, true);
  11118. }
  11119. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  11120. const focusoutPreventedEvent = createFocusOutPreventedEvent({ focusReason: focusReason.value });
  11121. emit("focusout-prevented", focusoutPreventedEvent);
  11122. if (!focusoutPreventedEvent.defaultPrevented) {
  11123. e.preventDefault();
  11124. if (loop) tryFocus(last, true);
  11125. }
  11126. }
  11127. }
  11128. };
  11129. provide(FOCUS_TRAP_INJECTION_KEY, {
  11130. focusTrapRef: forwardRef,
  11131. onKeydown
  11132. });
  11133. watch(() => props.focusTrapEl, (focusTrapEl) => {
  11134. if (focusTrapEl) forwardRef.value = focusTrapEl;
  11135. }, { immediate: true });
  11136. watch([forwardRef], ([forwardRef], [oldForwardRef]) => {
  11137. if (forwardRef) {
  11138. forwardRef.addEventListener("keydown", onKeydown);
  11139. forwardRef.addEventListener("focusin", onFocusIn);
  11140. forwardRef.addEventListener("focusout", onFocusOut);
  11141. }
  11142. if (oldForwardRef) {
  11143. oldForwardRef.removeEventListener("keydown", onKeydown);
  11144. oldForwardRef.removeEventListener("focusin", onFocusIn);
  11145. oldForwardRef.removeEventListener("focusout", onFocusOut);
  11146. }
  11147. });
  11148. const trapOnFocus = (e) => {
  11149. emit(ON_TRAP_FOCUS_EVT, e);
  11150. };
  11151. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  11152. const onFocusIn = (e) => {
  11153. const trapContainer = unref(forwardRef);
  11154. if (!trapContainer) return;
  11155. const target = e.target;
  11156. const relatedTarget = e.relatedTarget;
  11157. const isFocusedInTrap = target && trapContainer.contains(target);
  11158. if (!props.trapped) {
  11159. if (!(relatedTarget && trapContainer.contains(relatedTarget))) lastFocusBeforeTrapped = relatedTarget;
  11160. }
  11161. if (isFocusedInTrap) emit("focusin", e);
  11162. if (focusLayer.paused) return;
  11163. if (props.trapped) if (isFocusedInTrap) lastFocusAfterTrapped = target;
  11164. else tryFocus(lastFocusAfterTrapped, true);
  11165. };
  11166. const onFocusOut = (e) => {
  11167. const trapContainer = unref(forwardRef);
  11168. if (focusLayer.paused || !trapContainer) return;
  11169. if (props.trapped) {
  11170. const relatedTarget = e.relatedTarget;
  11171. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) setTimeout(() => {
  11172. if (!focusLayer.paused && props.trapped) {
  11173. const focusoutPreventedEvent = createFocusOutPreventedEvent({ focusReason: focusReason.value });
  11174. emit("focusout-prevented", focusoutPreventedEvent);
  11175. if (!focusoutPreventedEvent.defaultPrevented) tryFocus(lastFocusAfterTrapped, true);
  11176. }
  11177. }, 0);
  11178. } else {
  11179. const target = e.target;
  11180. if (!(target && trapContainer.contains(target))) emit("focusout", e);
  11181. }
  11182. };
  11183. async function startTrap() {
  11184. await nextTick();
  11185. const trapContainer = unref(forwardRef);
  11186. if (trapContainer) {
  11187. focusableStack.push(focusLayer);
  11188. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  11189. lastFocusBeforeTrapped = prevFocusedElement;
  11190. if (!trapContainer.contains(prevFocusedElement)) {
  11191. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  11192. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  11193. trapContainer.dispatchEvent(focusEvent);
  11194. if (!focusEvent.defaultPrevented) nextTick(() => {
  11195. let focusStartEl = props.focusStartEl;
  11196. if (!isString(focusStartEl)) {
  11197. tryFocus(focusStartEl);
  11198. if (document.activeElement !== focusStartEl) focusStartEl = "first";
  11199. }
  11200. if (focusStartEl === "first") focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  11201. if (document.activeElement === prevFocusedElement || focusStartEl === "container") tryFocus(trapContainer);
  11202. });
  11203. }
  11204. }
  11205. }
  11206. function stopTrap() {
  11207. const trapContainer = unref(forwardRef);
  11208. if (trapContainer) {
  11209. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  11210. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  11211. ...FOCUS_AFTER_TRAPPED_OPTS,
  11212. detail: { focusReason: focusReason.value }
  11213. });
  11214. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  11215. trapContainer.dispatchEvent(releasedEvent);
  11216. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) tryFocus(lastFocusBeforeTrapped ?? document.body);
  11217. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  11218. focusableStack.remove(focusLayer);
  11219. lastFocusBeforeTrapped = null;
  11220. lastFocusAfterTrapped = null;
  11221. }
  11222. }
  11223. onMounted(() => {
  11224. if (props.trapped) startTrap();
  11225. watch(() => props.trapped, (trapped) => {
  11226. if (trapped) startTrap();
  11227. else stopTrap();
  11228. });
  11229. });
  11230. onBeforeUnmount(() => {
  11231. if (props.trapped) stopTrap();
  11232. if (forwardRef.value) {
  11233. forwardRef.value.removeEventListener("keydown", onKeydown);
  11234. forwardRef.value.removeEventListener("focusin", onFocusIn);
  11235. forwardRef.value.removeEventListener("focusout", onFocusOut);
  11236. forwardRef.value = void 0;
  11237. }
  11238. lastFocusBeforeTrapped = null;
  11239. lastFocusAfterTrapped = null;
  11240. });
  11241. return { onKeydown };
  11242. }
  11243. });
  11244. //#endregion
  11245. //#region \0plugin-vue:export-helper
  11246. var _plugin_vue_export_helper_default = (sfc, props) => {
  11247. const target = sfc.__vccOpts || sfc;
  11248. for (const [key, val] of props) target[key] = val;
  11249. return target;
  11250. };
  11251. //#endregion
  11252. //#region ../../packages/components/focus-trap/src/focus-trap.vue
  11253. function _sfc_render$21(_ctx, _cache, $props, $setup, $data, $options) {
  11254. return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  11255. }
  11256. var focus_trap_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(focus_trap_vue_vue_type_script_lang_default, [["render", _sfc_render$21]]);
  11257. //#endregion
  11258. //#region ../../packages/components/focus-trap/index.ts
  11259. var focus_trap_default = focus_trap_default$1;
  11260. //#endregion
  11261. //#region ../../packages/components/form/src/form.ts
  11262. /**
  11263. * @deprecated Removed after 3.0.0, Use `FormMetaProps` instead.
  11264. */
  11265. const formMetaProps = buildProps({
  11266. size: {
  11267. type: String,
  11268. values: componentSizes
  11269. },
  11270. disabled: Boolean
  11271. });
  11272. /**
  11273. * @deprecated Removed after 3.0.0, Use `FormProps` instead.
  11274. */
  11275. const formProps = buildProps({
  11276. ...formMetaProps,
  11277. model: Object,
  11278. rules: { type: definePropType(Object) },
  11279. labelPosition: {
  11280. type: String,
  11281. values: [
  11282. "left",
  11283. "right",
  11284. "top"
  11285. ],
  11286. default: "right"
  11287. },
  11288. requireAsteriskPosition: {
  11289. type: String,
  11290. values: ["left", "right"],
  11291. default: "left"
  11292. },
  11293. labelWidth: {
  11294. type: [String, Number],
  11295. default: ""
  11296. },
  11297. labelSuffix: {
  11298. type: String,
  11299. default: ""
  11300. },
  11301. inline: Boolean,
  11302. inlineMessage: Boolean,
  11303. statusIcon: Boolean,
  11304. showMessage: {
  11305. type: Boolean,
  11306. default: true
  11307. },
  11308. validateOnRuleChange: {
  11309. type: Boolean,
  11310. default: true
  11311. },
  11312. hideRequiredAsterisk: Boolean,
  11313. scrollToError: Boolean,
  11314. scrollIntoViewOptions: {
  11315. type: definePropType([Object, Boolean]),
  11316. default: true
  11317. }
  11318. });
  11319. const formEmits = { validate: (prop, isValid, message) => (isArray$1(prop) || isString(prop)) && isBoolean(isValid) && isString(message) };
  11320. //#endregion
  11321. //#region ../../packages/components/form/src/constants.ts
  11322. const formContextKey = Symbol("formContextKey");
  11323. const formItemContextKey = Symbol("formItemContextKey");
  11324. //#endregion
  11325. //#region ../../packages/components/form/src/hooks/use-form-common-props.ts
  11326. const useFormSize = (fallback, ignore = {}) => {
  11327. const emptyRef = ref(void 0);
  11328. const size = ignore.prop ? emptyRef : useProp("size");
  11329. const globalConfig = ignore.global ? emptyRef : useGlobalSize();
  11330. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  11331. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  11332. return computed(() => size.value || unref(fallback) || formItem?.size || form?.size || globalConfig.value || "");
  11333. };
  11334. const useFormDisabled = (fallback) => {
  11335. const disabled = useProp("disabled");
  11336. const form = inject(formContextKey, void 0);
  11337. return computed(() => {
  11338. return disabled.value ?? unref(fallback) ?? form?.disabled ?? false;
  11339. });
  11340. };
  11341. const useSize = useFormSize;
  11342. const useDisabled = useFormDisabled;
  11343. //#endregion
  11344. //#region ../../packages/components/form/src/hooks/use-form-item.ts
  11345. const useFormItem = () => {
  11346. return {
  11347. form: inject(formContextKey, void 0),
  11348. formItem: inject(formItemContextKey, void 0)
  11349. };
  11350. };
  11351. const useFormItemInputId = (props, { formItemContext, disableIdGeneration, disableIdManagement }) => {
  11352. if (!disableIdGeneration) disableIdGeneration = ref(false);
  11353. if (!disableIdManagement) disableIdManagement = ref(false);
  11354. const instance = getCurrentInstance();
  11355. const inLabel = () => {
  11356. let parent = instance?.parent;
  11357. while (parent) {
  11358. if (parent.type.name === "ElFormItem") return false;
  11359. if (parent.type.name === "ElLabelWrap") return true;
  11360. parent = parent.parent;
  11361. }
  11362. return false;
  11363. };
  11364. const inputId = ref();
  11365. let idUnwatch = void 0;
  11366. const isLabeledByFormItem = computed(() => {
  11367. return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && formItemContext.inputIds?.length <= 1);
  11368. });
  11369. onMounted(() => {
  11370. idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration]) => {
  11371. const newId = id ?? (!disableIdGeneration ? useId().value : void 0);
  11372. if (newId !== inputId.value) {
  11373. if (formItemContext?.removeInputId && !inLabel()) {
  11374. inputId.value && formItemContext.removeInputId(inputId.value);
  11375. if (!disableIdManagement?.value && !disableIdGeneration && newId) formItemContext.addInputId(newId);
  11376. }
  11377. inputId.value = newId;
  11378. }
  11379. }, { immediate: true });
  11380. });
  11381. onUnmounted(() => {
  11382. idUnwatch && idUnwatch();
  11383. if (formItemContext?.removeInputId) inputId.value && formItemContext.removeInputId(inputId.value);
  11384. });
  11385. return {
  11386. isLabeledByFormItem,
  11387. inputId
  11388. };
  11389. };
  11390. //#endregion
  11391. //#region ../../packages/components/form/src/utils.ts
  11392. const SCOPE$7 = "ElForm";
  11393. function useFormLabelWidth() {
  11394. const potentialLabelWidthArr = ref([]);
  11395. const autoLabelWidth = computed(() => {
  11396. if (!potentialLabelWidthArr.value.length) return "0";
  11397. const max = Math.max(...potentialLabelWidthArr.value);
  11398. return max ? `${max}px` : "";
  11399. });
  11400. function getLabelWidthIndex(width) {
  11401. const index = potentialLabelWidthArr.value.indexOf(width);
  11402. if (index === -1 && autoLabelWidth.value === "0") /* @__PURE__ */ debugWarn(SCOPE$7, `unexpected width ${width}`);
  11403. return index;
  11404. }
  11405. function registerLabelWidth(val, oldVal) {
  11406. if (val && oldVal) {
  11407. const index = getLabelWidthIndex(oldVal);
  11408. potentialLabelWidthArr.value.splice(index, 1, val);
  11409. } else if (val) potentialLabelWidthArr.value.push(val);
  11410. }
  11411. function deregisterLabelWidth(val) {
  11412. const index = getLabelWidthIndex(val);
  11413. if (index > -1) potentialLabelWidthArr.value.splice(index, 1);
  11414. }
  11415. return {
  11416. autoLabelWidth,
  11417. registerLabelWidth,
  11418. deregisterLabelWidth
  11419. };
  11420. }
  11421. const filterFields = (fields, props) => {
  11422. const normalized = castArray$1(props).map((prop) => isArray$1(prop) ? prop.join(".") : prop);
  11423. return normalized.length > 0 ? fields.filter((field) => field.propString && normalized.includes(field.propString)) : fields;
  11424. };
  11425. //#endregion
  11426. //#region ../../packages/components/form/src/form.vue?vue&type=script&setup=true&lang.ts
  11427. const COMPONENT_NAME$21 = "ElForm";
  11428. var form_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11429. name: COMPONENT_NAME$21,
  11430. __name: "form",
  11431. props: formProps,
  11432. emits: formEmits,
  11433. setup(__props, { expose: __expose, emit: __emit }) {
  11434. const props = __props;
  11435. const emit = __emit;
  11436. const formRef = ref();
  11437. const fields = reactive([]);
  11438. const initialValues = /* @__PURE__ */ new Map();
  11439. const formSize = useFormSize();
  11440. const ns = useNamespace("form");
  11441. const formClasses = computed(() => {
  11442. const { labelPosition, inline } = props;
  11443. return [
  11444. ns.b(),
  11445. ns.m(formSize.value || "default"),
  11446. {
  11447. [ns.m(`label-${labelPosition}`)]: labelPosition,
  11448. [ns.m("inline")]: inline
  11449. }
  11450. ];
  11451. });
  11452. const getField = (prop) => {
  11453. return filterFields(fields, [prop])[0];
  11454. };
  11455. const addField = (field) => {
  11456. fields.push(field);
  11457. if (field.propString) if (initialValues.has(field.propString)) field.setInitialValue(initialValues.get(field.propString));
  11458. else initialValues.set(field.propString, cloneDeep(field.fieldValue));
  11459. };
  11460. const removeField = (field) => {
  11461. if (field.prop) fields.splice(fields.indexOf(field), 1);
  11462. };
  11463. const setInitialValues = (initModel) => {
  11464. if (!props.model) {
  11465. /* @__PURE__ */ debugWarn(COMPONENT_NAME$21, "model is required for setInitialValues to work.");
  11466. return;
  11467. }
  11468. if (!initModel) {
  11469. /* @__PURE__ */ debugWarn(COMPONENT_NAME$21, "initModel is required for setInitialValues to work.");
  11470. return;
  11471. }
  11472. for (const key of initialValues.keys()) initialValues.set(key, cloneDeep(getProp(initModel, key).value));
  11473. fields.forEach((field) => {
  11474. if (field.prop) field.setInitialValue(getProp(initModel, field.prop).value);
  11475. });
  11476. };
  11477. const resetFields = (properties = []) => {
  11478. if (!props.model) {
  11479. /* @__PURE__ */ debugWarn(COMPONENT_NAME$21, "model is required for resetFields to work.");
  11480. return;
  11481. }
  11482. filterFields(fields, properties).forEach((field) => field.resetField());
  11483. const activePropStrings = new Set(fields.map((f) => f.propString).filter(Boolean));
  11484. const propsToCheck = properties.length > 0 ? castArray$1(properties).map((p) => isArray$1(p) ? p.join(".") : p) : [...initialValues.keys()];
  11485. for (const propString of propsToCheck) if (!activePropStrings.has(propString) && initialValues.has(propString)) getProp(props.model, propString).value = cloneDeep(initialValues.get(propString));
  11486. };
  11487. const clearValidate = (props = []) => {
  11488. filterFields(fields, props).forEach((field) => field.clearValidate());
  11489. };
  11490. const isValidatable = computed(() => {
  11491. const hasModel = !!props.model;
  11492. if (!hasModel) /* @__PURE__ */ debugWarn(COMPONENT_NAME$21, "model is required for validate to work.");
  11493. return hasModel;
  11494. });
  11495. const obtainValidateFields = (props) => {
  11496. if (fields.length === 0) return [];
  11497. const filteredFields = filterFields(fields, props);
  11498. if (!filteredFields.length) {
  11499. /* @__PURE__ */ debugWarn(COMPONENT_NAME$21, "please pass correct props!");
  11500. return [];
  11501. }
  11502. return filteredFields;
  11503. };
  11504. const validate = async (callback) => validateField(void 0, callback);
  11505. const doValidateField = async (props = []) => {
  11506. if (!isValidatable.value) return false;
  11507. const fields = obtainValidateFields(props);
  11508. if (fields.length === 0) return true;
  11509. let validationErrors = {};
  11510. for (const field of fields) try {
  11511. await field.validate("");
  11512. if (field.validateState === "error" && !field.error) field.resetField();
  11513. } catch (fields) {
  11514. validationErrors = {
  11515. ...validationErrors,
  11516. ...fields
  11517. };
  11518. }
  11519. if (Object.keys(validationErrors).length === 0) return true;
  11520. return Promise.reject(validationErrors);
  11521. };
  11522. const validateField = async (modelProps = [], callback) => {
  11523. let result = false;
  11524. const shouldThrow = !isFunction$1(callback);
  11525. try {
  11526. result = await doValidateField(modelProps);
  11527. if (result === true) await callback?.(result);
  11528. return result;
  11529. } catch (e) {
  11530. if (e instanceof Error) throw e;
  11531. const invalidFields = e;
  11532. if (props.scrollToError) {
  11533. if (formRef.value) formRef.value.querySelector(`.${ns.b()}-item.is-error`)?.scrollIntoView(props.scrollIntoViewOptions);
  11534. }
  11535. !result && await callback?.(false, invalidFields);
  11536. return shouldThrow && Promise.reject(invalidFields);
  11537. }
  11538. };
  11539. const scrollToField = (prop) => {
  11540. const field = getField(prop);
  11541. if (field) field.$el?.scrollIntoView(props.scrollIntoViewOptions);
  11542. };
  11543. watch(() => props.rules, () => {
  11544. if (props.validateOnRuleChange) validate().catch((err) => /* @__PURE__ */ debugWarn(err));
  11545. }, {
  11546. deep: true,
  11547. flush: "post"
  11548. });
  11549. provide(formContextKey, reactive({
  11550. ...toRefs(props),
  11551. emit,
  11552. resetFields,
  11553. clearValidate,
  11554. validateField,
  11555. getField,
  11556. addField,
  11557. removeField,
  11558. setInitialValues,
  11559. ...useFormLabelWidth()
  11560. }));
  11561. __expose({
  11562. validate,
  11563. validateField,
  11564. resetFields,
  11565. clearValidate,
  11566. scrollToField,
  11567. getField,
  11568. fields,
  11569. setInitialValues
  11570. });
  11571. return (_ctx, _cache) => {
  11572. return openBlock(), createElementBlock("form", {
  11573. ref_key: "formRef",
  11574. ref: formRef,
  11575. class: normalizeClass(formClasses.value)
  11576. }, [renderSlot(_ctx.$slots, "default")], 2);
  11577. };
  11578. }
  11579. });
  11580. //#endregion
  11581. //#region ../../packages/components/form/src/form.vue
  11582. var form_default = form_vue_vue_type_script_setup_true_lang_default;
  11583. //#endregion
  11584. //#region ../../packages/components/form/src/form-item.ts
  11585. const formItemValidateStates = [
  11586. "",
  11587. "error",
  11588. "validating",
  11589. "success"
  11590. ];
  11591. /**
  11592. * @deprecated Removed after 3.0.0, Use `FormItemProps` instead.
  11593. */
  11594. const formItemProps = buildProps({
  11595. label: String,
  11596. labelWidth: { type: [String, Number] },
  11597. labelPosition: {
  11598. type: String,
  11599. values: [
  11600. "left",
  11601. "right",
  11602. "top",
  11603. ""
  11604. ],
  11605. default: ""
  11606. },
  11607. prop: { type: definePropType([String, Array]) },
  11608. required: {
  11609. type: Boolean,
  11610. default: void 0
  11611. },
  11612. rules: { type: definePropType([Object, Array]) },
  11613. error: String,
  11614. validateStatus: {
  11615. type: String,
  11616. values: formItemValidateStates
  11617. },
  11618. for: String,
  11619. inlineMessage: {
  11620. type: Boolean,
  11621. default: void 0
  11622. },
  11623. showMessage: {
  11624. type: Boolean,
  11625. default: true
  11626. },
  11627. size: {
  11628. type: String,
  11629. values: componentSizes
  11630. }
  11631. });
  11632. //#endregion
  11633. //#region ../../node_modules/.pnpm/async-validator@4.2.5_patch_hash=cc6d77b35ed2a1683012935ca9ed998d418912785fcf78c6497d3268ac596d23/node_modules/async-validator/dist-web/index.js
  11634. function _extends() {
  11635. _extends = Object.assign ? Object.assign.bind() : function(target) {
  11636. for (var i = 1; i < arguments.length; i++) {
  11637. var source = arguments[i];
  11638. for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
  11639. }
  11640. return target;
  11641. };
  11642. return _extends.apply(this, arguments);
  11643. }
  11644. function _inheritsLoose(subClass, superClass) {
  11645. subClass.prototype = Object.create(superClass.prototype);
  11646. subClass.prototype.constructor = subClass;
  11647. _setPrototypeOf(subClass, superClass);
  11648. }
  11649. function _getPrototypeOf(o) {
  11650. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
  11651. return o.__proto__ || Object.getPrototypeOf(o);
  11652. };
  11653. return _getPrototypeOf(o);
  11654. }
  11655. function _setPrototypeOf(o, p) {
  11656. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
  11657. o.__proto__ = p;
  11658. return o;
  11659. };
  11660. return _setPrototypeOf(o, p);
  11661. }
  11662. function _isNativeReflectConstruct() {
  11663. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  11664. if (Reflect.construct.sham) return false;
  11665. if (typeof Proxy === "function") return true;
  11666. try {
  11667. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
  11668. return true;
  11669. } catch (e) {
  11670. return false;
  11671. }
  11672. }
  11673. function _construct(Parent, args, Class) {
  11674. if (_isNativeReflectConstruct()) _construct = Reflect.construct.bind();
  11675. else _construct = function _construct(Parent, args, Class) {
  11676. var a = [null];
  11677. a.push.apply(a, args);
  11678. var instance = new (Function.bind.apply(Parent, a))();
  11679. if (Class) _setPrototypeOf(instance, Class.prototype);
  11680. return instance;
  11681. };
  11682. return _construct.apply(null, arguments);
  11683. }
  11684. function _isNativeFunction(fn) {
  11685. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  11686. }
  11687. function _wrapNativeSuper(Class) {
  11688. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  11689. _wrapNativeSuper = function _wrapNativeSuper(Class) {
  11690. if (Class === null || !_isNativeFunction(Class)) return Class;
  11691. if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
  11692. if (typeof _cache !== "undefined") {
  11693. if (_cache.has(Class)) return _cache.get(Class);
  11694. _cache.set(Class, Wrapper);
  11695. }
  11696. function Wrapper() {
  11697. return _construct(Class, arguments, _getPrototypeOf(this).constructor);
  11698. }
  11699. Wrapper.prototype = Object.create(Class.prototype, { constructor: {
  11700. value: Wrapper,
  11701. enumerable: false,
  11702. writable: true,
  11703. configurable: true
  11704. } });
  11705. return _setPrototypeOf(Wrapper, Class);
  11706. };
  11707. return _wrapNativeSuper(Class);
  11708. }
  11709. var formatRegExp = /%[sdj%]/g;
  11710. var warning = function warning() {};
  11711. if (typeof process !== "undefined" && process.env && false);
  11712. function convertFieldsError(errors) {
  11713. if (!errors || !errors.length) return null;
  11714. var fields = {};
  11715. errors.forEach(function(error) {
  11716. var field = error.field;
  11717. fields[field] = fields[field] || [];
  11718. fields[field].push(error);
  11719. });
  11720. return fields;
  11721. }
  11722. function format(template) {
  11723. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
  11724. var i = 0;
  11725. var len = args.length;
  11726. if (typeof template === "function") return template.apply(null, args);
  11727. if (typeof template === "string") return template.replace(formatRegExp, function(x) {
  11728. if (x === "%%") return "%";
  11729. if (i >= len) return x;
  11730. switch (x) {
  11731. case "%s": return String(args[i++]);
  11732. case "%d": return Number(args[i++]);
  11733. case "%j":
  11734. try {
  11735. return JSON.stringify(args[i++]);
  11736. } catch (_) {
  11737. return "[Circular]";
  11738. }
  11739. break;
  11740. default: return x;
  11741. }
  11742. });
  11743. return template;
  11744. }
  11745. function isNativeStringType(type) {
  11746. return type === "string" || type === "url" || type === "hex" || type === "email" || type === "date" || type === "pattern";
  11747. }
  11748. function isEmptyValue(value, type) {
  11749. if (value === void 0 || value === null) return true;
  11750. if (type === "array" && Array.isArray(value) && !value.length) return true;
  11751. if (isNativeStringType(type) && typeof value === "string" && !value) return true;
  11752. return false;
  11753. }
  11754. function asyncParallelArray(arr, func, callback) {
  11755. var results = [];
  11756. var total = 0;
  11757. var arrLength = arr.length;
  11758. function count(errors) {
  11759. results.push.apply(results, errors || []);
  11760. total++;
  11761. if (total === arrLength) callback(results);
  11762. }
  11763. arr.forEach(function(a) {
  11764. func(a, count);
  11765. });
  11766. }
  11767. function asyncSerialArray(arr, func, callback) {
  11768. var index = 0;
  11769. var arrLength = arr.length;
  11770. function next(errors) {
  11771. if (errors && errors.length) {
  11772. callback(errors);
  11773. return;
  11774. }
  11775. var original = index;
  11776. index = index + 1;
  11777. if (original < arrLength) func(arr[original], next);
  11778. else callback([]);
  11779. }
  11780. next([]);
  11781. }
  11782. function flattenObjArr(objArr) {
  11783. var ret = [];
  11784. Object.keys(objArr).forEach(function(k) {
  11785. ret.push.apply(ret, objArr[k] || []);
  11786. });
  11787. return ret;
  11788. }
  11789. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  11790. _inheritsLoose(AsyncValidationError, _Error);
  11791. function AsyncValidationError(errors, fields) {
  11792. var _this = _Error.call(this, "Async Validation Error") || this;
  11793. _this.errors = errors;
  11794. _this.fields = fields;
  11795. return _this;
  11796. }
  11797. return AsyncValidationError;
  11798. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  11799. function asyncMap(objArr, option, func, callback, source) {
  11800. if (option.first) {
  11801. var _pending = new Promise(function(resolve, reject) {
  11802. asyncSerialArray(flattenObjArr(objArr), func, function next(errors) {
  11803. callback(errors);
  11804. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  11805. });
  11806. });
  11807. _pending["catch"](function(e) {
  11808. return e;
  11809. });
  11810. return _pending;
  11811. }
  11812. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  11813. var objArrKeys = Object.keys(objArr);
  11814. var objArrLength = objArrKeys.length;
  11815. var total = 0;
  11816. var results = [];
  11817. var pending = new Promise(function(resolve, reject) {
  11818. var next = function next(errors) {
  11819. results.push.apply(results, errors);
  11820. total++;
  11821. if (total === objArrLength) {
  11822. callback(results);
  11823. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  11824. }
  11825. };
  11826. if (!objArrKeys.length) {
  11827. callback(results);
  11828. resolve(source);
  11829. }
  11830. objArrKeys.forEach(function(key) {
  11831. var arr = objArr[key];
  11832. if (firstFields.indexOf(key) !== -1) asyncSerialArray(arr, func, next);
  11833. else asyncParallelArray(arr, func, next);
  11834. });
  11835. });
  11836. pending["catch"](function(e) {
  11837. return e;
  11838. });
  11839. return pending;
  11840. }
  11841. function isErrorObj(obj) {
  11842. return !!(obj && obj.message !== void 0);
  11843. }
  11844. function getValue(value, path) {
  11845. var v = value;
  11846. for (var i = 0; i < path.length; i++) {
  11847. if (v == void 0) return v;
  11848. v = v[path[i]];
  11849. }
  11850. return v;
  11851. }
  11852. function complementError(rule, source) {
  11853. return function(oe) {
  11854. var fieldValue;
  11855. if (rule.fullFields) fieldValue = getValue(source, rule.fullFields);
  11856. else fieldValue = source[oe.field || rule.fullField];
  11857. if (isErrorObj(oe)) {
  11858. oe.field = oe.field || rule.fullField;
  11859. oe.fieldValue = fieldValue;
  11860. return oe;
  11861. }
  11862. return {
  11863. message: typeof oe === "function" ? oe() : oe,
  11864. fieldValue,
  11865. field: oe.field || rule.fullField
  11866. };
  11867. };
  11868. }
  11869. function deepMerge(target, source) {
  11870. if (source) {
  11871. for (var s in source) if (source.hasOwnProperty(s)) {
  11872. var value = source[s];
  11873. if (typeof value === "object" && typeof target[s] === "object") target[s] = _extends({}, target[s], value);
  11874. else target[s] = value;
  11875. }
  11876. }
  11877. return target;
  11878. }
  11879. var required$1 = function required(rule, value, source, errors, options, type) {
  11880. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type || rule.type))) errors.push(format(options.messages.required, rule.fullField));
  11881. };
  11882. /**
  11883. * Rule for validating whitespace.
  11884. *
  11885. * @param rule The validation rule.
  11886. * @param value The value of the field on the source object.
  11887. * @param source The source object being validated.
  11888. * @param errors An array of errors that this rule may add
  11889. * validation errors to.
  11890. * @param options The validation options.
  11891. * @param options.messages The validation messages.
  11892. */
  11893. var whitespace = function whitespace(rule, value, source, errors, options) {
  11894. if (/^\s+$/.test(value) || value === "") errors.push(format(options.messages.whitespace, rule.fullField));
  11895. };
  11896. var urlReg;
  11897. var getUrlRegex = (function() {
  11898. if (urlReg) return urlReg;
  11899. var word = "[a-fA-F\\d:]";
  11900. var b = function b(options) {
  11901. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  11902. };
  11903. 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}";
  11904. var v6seg = "[a-fA-F\\d]{1,4}";
  11905. 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();
  11906. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  11907. var v4exact = new RegExp("^" + v4 + "$");
  11908. var v6exact = new RegExp("^" + v6 + "$");
  11909. var ip = function ip(options) {
  11910. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  11911. };
  11912. ip.v4 = function(options) {
  11913. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  11914. };
  11915. ip.v6 = function(options) {
  11916. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  11917. };
  11918. var protocol = "(?:(?:[a-z]+:)?//)";
  11919. var auth = "(?:\\S+(?::\\S*)?@)?";
  11920. var ipv4 = ip.v4().source;
  11921. var ipv6 = ip.v6().source;
  11922. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:[/?#][^\\s\"]*)?";
  11923. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  11924. return urlReg;
  11925. });
  11926. var pattern$2 = {
  11927. 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,}))$/,
  11928. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  11929. };
  11930. var types = {
  11931. integer: function integer(value) {
  11932. return types.number(value) && parseInt(value, 10) === value;
  11933. },
  11934. "float": function float(value) {
  11935. return types.number(value) && !types.integer(value);
  11936. },
  11937. array: function array(value) {
  11938. return Array.isArray(value);
  11939. },
  11940. regexp: function regexp(value) {
  11941. if (value instanceof RegExp) return true;
  11942. try {
  11943. return !!new RegExp(value);
  11944. } catch (e) {
  11945. return false;
  11946. }
  11947. },
  11948. date: function date(value) {
  11949. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  11950. },
  11951. number: function number(value) {
  11952. if (isNaN(value)) return false;
  11953. return typeof value === "number";
  11954. },
  11955. object: function object(value) {
  11956. return typeof value === "object" && !types.array(value);
  11957. },
  11958. method: function method(value) {
  11959. return typeof value === "function";
  11960. },
  11961. email: function email(value) {
  11962. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  11963. },
  11964. url: function url(value) {
  11965. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  11966. },
  11967. hex: function hex(value) {
  11968. return typeof value === "string" && !!value.match(pattern$2.hex);
  11969. }
  11970. };
  11971. var type$1 = function type(rule, value, source, errors, options) {
  11972. if (rule.required && value === void 0) {
  11973. required$1(rule, value, source, errors, options);
  11974. return;
  11975. }
  11976. var custom = [
  11977. "integer",
  11978. "float",
  11979. "array",
  11980. "regexp",
  11981. "object",
  11982. "method",
  11983. "email",
  11984. "number",
  11985. "date",
  11986. "url",
  11987. "hex"
  11988. ];
  11989. var ruleType = rule.type;
  11990. if (custom.indexOf(ruleType) > -1) {
  11991. if (!types[ruleType](value)) errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11992. } else if (ruleType && typeof value !== rule.type) errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11993. };
  11994. var range = function range(rule, value, source, errors, options) {
  11995. var len = typeof rule.len === "number";
  11996. var min = typeof rule.min === "number";
  11997. var max = typeof rule.max === "number";
  11998. var val = value;
  11999. var key = null;
  12000. var num = typeof value === "number";
  12001. var str = typeof value === "string";
  12002. var arr = Array.isArray(value);
  12003. if (num) key = "number";
  12004. else if (str) key = "string";
  12005. else if (arr) key = "array";
  12006. if (!key) return false;
  12007. if (arr) val = value.length;
  12008. if (str) val = value.length;
  12009. if (len) {
  12010. if (val !== rule.len) errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  12011. } else if (min && !max && val < rule.min) errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  12012. else if (max && !min && val > rule.max) errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  12013. else if (min && max && (val < rule.min || val > rule.max)) errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  12014. };
  12015. var ENUM$1 = "enum";
  12016. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  12017. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  12018. if (rule[ENUM$1].indexOf(value) === -1) errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  12019. };
  12020. var pattern$1 = function pattern(rule, value, source, errors, options) {
  12021. if (rule.pattern) {
  12022. if (rule.pattern instanceof RegExp) {
  12023. rule.pattern.lastIndex = 0;
  12024. if (!rule.pattern.test(value)) errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  12025. } else if (typeof rule.pattern === "string") {
  12026. if (!new RegExp(rule.pattern).test(value)) errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  12027. }
  12028. }
  12029. };
  12030. var rules = {
  12031. required: required$1,
  12032. whitespace,
  12033. type: type$1,
  12034. range,
  12035. "enum": enumerable$1,
  12036. pattern: pattern$1
  12037. };
  12038. var string = function string(rule, value, callback, source, options) {
  12039. var errors = [];
  12040. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12041. if (isEmptyValue(value, "string") && !rule.required) return callback();
  12042. rules.required(rule, value, source, errors, options, "string");
  12043. if (!isEmptyValue(value, "string")) {
  12044. rules.type(rule, value, source, errors, options);
  12045. rules.range(rule, value, source, errors, options);
  12046. rules.pattern(rule, value, source, errors, options);
  12047. if (rule.whitespace === true) rules.whitespace(rule, value, source, errors, options);
  12048. }
  12049. }
  12050. callback(errors);
  12051. };
  12052. var method = function method(rule, value, callback, source, options) {
  12053. var errors = [];
  12054. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12055. if (isEmptyValue(value) && !rule.required) return callback();
  12056. rules.required(rule, value, source, errors, options);
  12057. if (value !== void 0) rules.type(rule, value, source, errors, options);
  12058. }
  12059. callback(errors);
  12060. };
  12061. var number = function number(rule, value, callback, source, options) {
  12062. var errors = [];
  12063. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12064. if (value === "") value = void 0;
  12065. if (isEmptyValue(value) && !rule.required) return callback();
  12066. rules.required(rule, value, source, errors, options);
  12067. if (value !== void 0) {
  12068. rules.type(rule, value, source, errors, options);
  12069. rules.range(rule, value, source, errors, options);
  12070. }
  12071. }
  12072. callback(errors);
  12073. };
  12074. var _boolean = function _boolean(rule, value, callback, source, options) {
  12075. var errors = [];
  12076. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12077. if (isEmptyValue(value) && !rule.required) return callback();
  12078. rules.required(rule, value, source, errors, options);
  12079. if (value !== void 0) rules.type(rule, value, source, errors, options);
  12080. }
  12081. callback(errors);
  12082. };
  12083. var regexp = function regexp(rule, value, callback, source, options) {
  12084. var errors = [];
  12085. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12086. if (isEmptyValue(value) && !rule.required) return callback();
  12087. rules.required(rule, value, source, errors, options);
  12088. if (!isEmptyValue(value)) rules.type(rule, value, source, errors, options);
  12089. }
  12090. callback(errors);
  12091. };
  12092. var integer = function integer(rule, value, callback, source, options) {
  12093. var errors = [];
  12094. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12095. if (isEmptyValue(value) && !rule.required) return callback();
  12096. rules.required(rule, value, source, errors, options);
  12097. if (value !== void 0) {
  12098. rules.type(rule, value, source, errors, options);
  12099. rules.range(rule, value, source, errors, options);
  12100. }
  12101. }
  12102. callback(errors);
  12103. };
  12104. var floatFn = function floatFn(rule, value, callback, source, options) {
  12105. var errors = [];
  12106. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12107. if (isEmptyValue(value) && !rule.required) return callback();
  12108. rules.required(rule, value, source, errors, options);
  12109. if (value !== void 0) {
  12110. rules.type(rule, value, source, errors, options);
  12111. rules.range(rule, value, source, errors, options);
  12112. }
  12113. }
  12114. callback(errors);
  12115. };
  12116. var array = function array(rule, value, callback, source, options) {
  12117. var errors = [];
  12118. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12119. if ((value === void 0 || value === null) && !rule.required) return callback();
  12120. rules.required(rule, value, source, errors, options, "array");
  12121. if (value !== void 0 && value !== null) {
  12122. rules.type(rule, value, source, errors, options);
  12123. rules.range(rule, value, source, errors, options);
  12124. }
  12125. }
  12126. callback(errors);
  12127. };
  12128. var object = function object(rule, value, callback, source, options) {
  12129. var errors = [];
  12130. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12131. if (isEmptyValue(value) && !rule.required) return callback();
  12132. rules.required(rule, value, source, errors, options);
  12133. if (value !== void 0) rules.type(rule, value, source, errors, options);
  12134. }
  12135. callback(errors);
  12136. };
  12137. var ENUM = "enum";
  12138. var enumerable = function enumerable(rule, value, callback, source, options) {
  12139. var errors = [];
  12140. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12141. if (isEmptyValue(value) && !rule.required) return callback();
  12142. rules.required(rule, value, source, errors, options);
  12143. if (value !== void 0) rules[ENUM](rule, value, source, errors, options);
  12144. }
  12145. callback(errors);
  12146. };
  12147. var pattern = function pattern(rule, value, callback, source, options) {
  12148. var errors = [];
  12149. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12150. if (isEmptyValue(value, "string") && !rule.required) return callback();
  12151. rules.required(rule, value, source, errors, options);
  12152. if (!isEmptyValue(value, "string")) rules.pattern(rule, value, source, errors, options);
  12153. }
  12154. callback(errors);
  12155. };
  12156. var date = function date(rule, value, callback, source, options) {
  12157. var errors = [];
  12158. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12159. if (isEmptyValue(value, "date") && !rule.required) return callback();
  12160. rules.required(rule, value, source, errors, options);
  12161. if (!isEmptyValue(value, "date")) {
  12162. var dateObject;
  12163. if (value instanceof Date) dateObject = value;
  12164. else dateObject = new Date(value);
  12165. rules.type(rule, dateObject, source, errors, options);
  12166. if (dateObject) rules.range(rule, dateObject.getTime(), source, errors, options);
  12167. }
  12168. }
  12169. callback(errors);
  12170. };
  12171. var required = function required(rule, value, callback, source, options) {
  12172. var errors = [];
  12173. var type = Array.isArray(value) ? "array" : typeof value;
  12174. rules.required(rule, value, source, errors, options, type);
  12175. callback(errors);
  12176. };
  12177. var type = function type(rule, value, callback, source, options) {
  12178. var ruleType = rule.type;
  12179. var errors = [];
  12180. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12181. if (isEmptyValue(value, ruleType) && !rule.required) return callback();
  12182. rules.required(rule, value, source, errors, options, ruleType);
  12183. if (!isEmptyValue(value, ruleType)) rules.type(rule, value, source, errors, options);
  12184. }
  12185. callback(errors);
  12186. };
  12187. var any = function any(rule, value, callback, source, options) {
  12188. var errors = [];
  12189. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  12190. if (isEmptyValue(value) && !rule.required) return callback();
  12191. rules.required(rule, value, source, errors, options);
  12192. }
  12193. callback(errors);
  12194. };
  12195. var validators = {
  12196. string,
  12197. method,
  12198. number,
  12199. "boolean": _boolean,
  12200. regexp,
  12201. integer,
  12202. "float": floatFn,
  12203. array,
  12204. object,
  12205. "enum": enumerable,
  12206. pattern,
  12207. date,
  12208. url: type,
  12209. hex: type,
  12210. email: type,
  12211. required,
  12212. any
  12213. };
  12214. function newMessages() {
  12215. return {
  12216. "default": "Validation error on field %s",
  12217. required: "%s is required",
  12218. "enum": "%s must be one of %s",
  12219. whitespace: "%s cannot be empty",
  12220. date: {
  12221. format: "%s date %s is invalid for format %s",
  12222. parse: "%s date could not be parsed, %s is invalid ",
  12223. invalid: "%s date %s is invalid"
  12224. },
  12225. types: {
  12226. string: "%s is not a %s",
  12227. method: "%s is not a %s (function)",
  12228. array: "%s is not an %s",
  12229. object: "%s is not an %s",
  12230. number: "%s is not a %s",
  12231. date: "%s is not a %s",
  12232. "boolean": "%s is not a %s",
  12233. integer: "%s is not an %s",
  12234. "float": "%s is not a %s",
  12235. regexp: "%s is not a valid %s",
  12236. email: "%s is not a valid %s",
  12237. url: "%s is not a valid %s",
  12238. hex: "%s is not a valid %s"
  12239. },
  12240. string: {
  12241. len: "%s must be exactly %s characters",
  12242. min: "%s must be at least %s characters",
  12243. max: "%s cannot be longer than %s characters",
  12244. range: "%s must be between %s and %s characters"
  12245. },
  12246. number: {
  12247. len: "%s must equal %s",
  12248. min: "%s cannot be less than %s",
  12249. max: "%s cannot be greater than %s",
  12250. range: "%s must be between %s and %s"
  12251. },
  12252. array: {
  12253. len: "%s must be exactly %s in length",
  12254. min: "%s cannot be less than %s in length",
  12255. max: "%s cannot be greater than %s in length",
  12256. range: "%s must be between %s and %s in length"
  12257. },
  12258. pattern: { mismatch: "%s value %s does not match pattern %s" },
  12259. clone: function clone() {
  12260. var cloned = JSON.parse(JSON.stringify(this));
  12261. cloned.clone = this.clone;
  12262. return cloned;
  12263. }
  12264. };
  12265. }
  12266. var messages = newMessages();
  12267. /**
  12268. * Encapsulates a validation schema.
  12269. *
  12270. * @param descriptor An object declaring validation rules
  12271. * for this schema.
  12272. */
  12273. var Schema = /* @__PURE__ */ function() {
  12274. function Schema(descriptor) {
  12275. this.rules = null;
  12276. this._messages = messages;
  12277. this.define(descriptor);
  12278. }
  12279. var _proto = Schema.prototype;
  12280. _proto.define = function define(rules) {
  12281. var _this = this;
  12282. if (!rules) throw new Error("Cannot configure a schema with no rules");
  12283. if (typeof rules !== "object" || Array.isArray(rules)) throw new Error("Rules must be an object");
  12284. this.rules = {};
  12285. Object.keys(rules).forEach(function(name) {
  12286. var item = rules[name];
  12287. _this.rules[name] = Array.isArray(item) ? item : [item];
  12288. });
  12289. };
  12290. _proto.messages = function messages(_messages) {
  12291. if (_messages) this._messages = deepMerge(newMessages(), _messages);
  12292. return this._messages;
  12293. };
  12294. _proto.validate = function validate(source_, o, oc) {
  12295. var _this2 = this;
  12296. if (o === void 0) o = {};
  12297. if (oc === void 0) oc = function oc() {};
  12298. var source = source_;
  12299. var options = o;
  12300. var callback = oc;
  12301. if (typeof options === "function") {
  12302. callback = options;
  12303. options = {};
  12304. }
  12305. if (!this.rules || Object.keys(this.rules).length === 0) {
  12306. if (callback) callback(null, source);
  12307. return Promise.resolve(source);
  12308. }
  12309. function complete(results) {
  12310. var errors = [];
  12311. var fields = {};
  12312. function add(e) {
  12313. if (Array.isArray(e)) {
  12314. var _errors;
  12315. errors = (_errors = errors).concat.apply(_errors, e);
  12316. } else errors.push(e);
  12317. }
  12318. for (var i = 0; i < results.length; i++) add(results[i]);
  12319. if (!errors.length) callback(null, source);
  12320. else {
  12321. fields = convertFieldsError(errors);
  12322. callback(errors, fields);
  12323. }
  12324. }
  12325. if (options.messages) {
  12326. var messages$1 = this.messages();
  12327. if (messages$1 === messages) messages$1 = newMessages();
  12328. deepMerge(messages$1, options.messages);
  12329. options.messages = messages$1;
  12330. } else options.messages = this.messages();
  12331. var series = {};
  12332. (options.keys || Object.keys(this.rules)).forEach(function(z) {
  12333. var arr = _this2.rules[z];
  12334. var value = source[z];
  12335. arr.forEach(function(r) {
  12336. var rule = r;
  12337. if (typeof rule.transform === "function") {
  12338. if (source === source_) source = _extends({}, source);
  12339. value = source[z] = rule.transform(value);
  12340. }
  12341. if (typeof rule === "function") rule = { validator: rule };
  12342. else rule = _extends({}, rule);
  12343. rule.validator = _this2.getValidationMethod(rule);
  12344. if (!rule.validator) return;
  12345. rule.field = z;
  12346. rule.fullField = rule.fullField || z;
  12347. rule.type = _this2.getType(rule);
  12348. series[z] = series[z] || [];
  12349. series[z].push({
  12350. rule,
  12351. value,
  12352. source,
  12353. field: z
  12354. });
  12355. });
  12356. });
  12357. var errorFields = {};
  12358. return asyncMap(series, options, function(data, doIt) {
  12359. var rule = data.rule;
  12360. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  12361. deep = deep && (rule.required || !rule.required && data.value);
  12362. rule.field = data.field;
  12363. function addFullField(key, schema) {
  12364. return _extends({}, schema, {
  12365. fullField: rule.fullField + "." + key,
  12366. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  12367. });
  12368. }
  12369. function cb(e) {
  12370. if (e === void 0) e = [];
  12371. var errorList = Array.isArray(e) ? e : [e];
  12372. if (!options.suppressWarning && errorList.length) Schema.warning("async-validator:", errorList);
  12373. if (errorList.length && rule.message !== void 0) errorList = [].concat(rule.message);
  12374. var filledErrors = errorList.map(complementError(rule, source));
  12375. if (options.first && filledErrors.length) {
  12376. errorFields[rule.field] = 1;
  12377. return doIt(filledErrors);
  12378. }
  12379. if (!deep) doIt(filledErrors);
  12380. else {
  12381. if (rule.required && !data.value) {
  12382. if (rule.message !== void 0) filledErrors = [].concat(rule.message).map(complementError(rule, source));
  12383. else if (options.error) filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  12384. return doIt(filledErrors);
  12385. }
  12386. var fieldsSchema = {};
  12387. if (rule.defaultField) Object.keys(data.value).map(function(key) {
  12388. fieldsSchema[key] = rule.defaultField;
  12389. });
  12390. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  12391. var paredFieldsSchema = {};
  12392. Object.keys(fieldsSchema).forEach(function(field) {
  12393. var fieldSchema = fieldsSchema[field];
  12394. paredFieldsSchema[field] = (Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema]).map(addFullField.bind(null, field));
  12395. });
  12396. var schema = new Schema(paredFieldsSchema);
  12397. schema.messages(options.messages);
  12398. if (data.rule.options) {
  12399. data.rule.options.messages = options.messages;
  12400. data.rule.options.error = options.error;
  12401. }
  12402. schema.validate(data.value, data.rule.options || options, function(errs) {
  12403. var finalErrors = [];
  12404. if (filledErrors && filledErrors.length) finalErrors.push.apply(finalErrors, filledErrors);
  12405. if (errs && errs.length) finalErrors.push.apply(finalErrors, errs);
  12406. doIt(finalErrors.length ? finalErrors : null);
  12407. });
  12408. }
  12409. }
  12410. var res;
  12411. if (rule.asyncValidator) res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  12412. else if (rule.validator) {
  12413. try {
  12414. res = rule.validator(rule, data.value, cb, data.source, options);
  12415. } catch (error) {
  12416. console.error == null || console.error(error);
  12417. if (!options.suppressValidatorError) setTimeout(function() {
  12418. throw error;
  12419. }, 0);
  12420. cb(error.message);
  12421. }
  12422. if (res === true) cb();
  12423. else if (res === false) cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  12424. else if (res instanceof Array) cb(res);
  12425. else if (res instanceof Error) cb(res.message);
  12426. }
  12427. if (res && res.then) res.then(function() {
  12428. return cb();
  12429. }, function(e) {
  12430. return cb(e);
  12431. });
  12432. }, function(results) {
  12433. complete(results);
  12434. }, source);
  12435. };
  12436. _proto.getType = function getType(rule) {
  12437. if (rule.type === void 0 && rule.pattern instanceof RegExp) rule.type = "pattern";
  12438. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) throw new Error(format("Unknown rule type %s", rule.type));
  12439. return rule.type || "string";
  12440. };
  12441. _proto.getValidationMethod = function getValidationMethod(rule) {
  12442. if (typeof rule.validator === "function") return rule.validator;
  12443. var keys = Object.keys(rule);
  12444. var messageIndex = keys.indexOf("message");
  12445. if (messageIndex !== -1) keys.splice(messageIndex, 1);
  12446. if (keys.length === 1 && keys[0] === "required") return validators.required;
  12447. return validators[this.getType(rule)] || void 0;
  12448. };
  12449. return Schema;
  12450. }();
  12451. Schema.register = function register(type, validator) {
  12452. if (typeof validator !== "function") throw new Error("Cannot register a validator by type, validator is not a function");
  12453. validators[type] = validator;
  12454. };
  12455. Schema.warning = warning;
  12456. Schema.messages = messages;
  12457. Schema.validators = validators;
  12458. //#endregion
  12459. //#region ../../packages/components/form/src/form-label-wrap.tsx
  12460. const COMPONENT_NAME$20 = "ElLabelWrap";
  12461. var form_label_wrap_default = /* @__PURE__ */ defineComponent({
  12462. name: COMPONENT_NAME$20,
  12463. props: {
  12464. isAutoWidth: Boolean,
  12465. updateAll: Boolean
  12466. },
  12467. setup(props, { slots }) {
  12468. const formContext = inject(formContextKey, void 0);
  12469. const formItemContext = inject(formItemContextKey);
  12470. if (!formItemContext) throwError(COMPONENT_NAME$20, "usage: <el-form-item><label-wrap /></el-form-item>");
  12471. const ns = useNamespace("form");
  12472. const el = ref();
  12473. const computedWidth = ref(0);
  12474. const getLabelWidth = () => {
  12475. if (el.value?.firstElementChild) {
  12476. const width = window.getComputedStyle(el.value.firstElementChild).width;
  12477. return Math.ceil(Number.parseFloat(width));
  12478. } else return 0;
  12479. };
  12480. const updateLabelWidth = (action = "update") => {
  12481. nextTick(() => {
  12482. if (slots.default && props.isAutoWidth) {
  12483. if (action === "update") computedWidth.value = getLabelWidth();
  12484. else if (action === "remove") formContext?.deregisterLabelWidth(computedWidth.value);
  12485. }
  12486. });
  12487. };
  12488. const updateLabelWidthFn = () => updateLabelWidth("update");
  12489. onMounted(() => {
  12490. updateLabelWidthFn();
  12491. });
  12492. onBeforeUnmount(() => {
  12493. updateLabelWidth("remove");
  12494. });
  12495. onUpdated(() => updateLabelWidthFn());
  12496. watch(computedWidth, (val, oldVal) => {
  12497. if (props.updateAll) formContext?.registerLabelWidth(val, oldVal);
  12498. });
  12499. useResizeObserver(computed(() => el.value?.firstElementChild ?? null), updateLabelWidthFn);
  12500. return () => {
  12501. if (!slots) return null;
  12502. const { isAutoWidth } = props;
  12503. if (isAutoWidth) {
  12504. const autoLabelWidth = formContext?.autoLabelWidth;
  12505. const hasLabel = formItemContext?.hasLabel;
  12506. const style = {};
  12507. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  12508. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  12509. const marginPosition = (formItemContext.labelPosition || formContext.labelPosition) === "left" ? "marginRight" : "marginLeft";
  12510. if (marginWidth) style[marginPosition] = `${marginWidth}px`;
  12511. }
  12512. return createVNode("div", {
  12513. "ref": el,
  12514. "class": [ns.be("item", "label-wrap")],
  12515. "style": style
  12516. }, [slots.default?.()]);
  12517. } else return createVNode(Fragment, { "ref": el }, [slots.default?.()]);
  12518. };
  12519. }
  12520. });
  12521. //#endregion
  12522. //#region ../../packages/components/form/src/form-item.vue?vue&type=script&setup=true&lang.ts
  12523. const _hoisted_1$78 = ["role", "aria-labelledby"];
  12524. var form_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12525. name: "ElFormItem",
  12526. __name: "form-item",
  12527. props: formItemProps,
  12528. setup(__props, { expose: __expose }) {
  12529. const props = __props;
  12530. const slots = useSlots();
  12531. const formContext = inject(formContextKey, void 0);
  12532. const parentFormItemContext = inject(formItemContextKey, void 0);
  12533. const _size = useFormSize(void 0, { formItem: false });
  12534. const ns = useNamespace("form-item");
  12535. const labelId = useId().value;
  12536. const inputIds = ref([]);
  12537. const validateState = ref("");
  12538. const validateStateDebounced = refDebounced(validateState, 100);
  12539. const validateMessage = ref("");
  12540. const formItemRef = ref();
  12541. let initialValue = void 0;
  12542. let isResettingField = false;
  12543. const labelPosition = computed(() => props.labelPosition || formContext?.labelPosition);
  12544. const labelStyle = computed(() => {
  12545. if (labelPosition.value === "top") return {};
  12546. return { width: addUnit(props.labelWidth ?? formContext?.labelWidth) };
  12547. });
  12548. const contentStyle = computed(() => {
  12549. if (labelPosition.value === "top" || formContext?.inline) return {};
  12550. if (!props.label && !props.labelWidth && isNested) return {};
  12551. const labelWidth = addUnit(props.labelWidth ?? formContext?.labelWidth);
  12552. if (!props.label && !slots.label) return { marginLeft: labelWidth };
  12553. return {};
  12554. });
  12555. const formItemClasses = computed(() => [
  12556. ns.b(),
  12557. ns.m(_size.value),
  12558. ns.is("error", validateState.value === "error"),
  12559. ns.is("validating", validateState.value === "validating"),
  12560. ns.is("success", validateState.value === "success"),
  12561. ns.is("required", isRequired.value || props.required),
  12562. ns.is("no-asterisk", formContext?.hideRequiredAsterisk),
  12563. formContext?.requireAsteriskPosition === "right" ? "asterisk-right" : "asterisk-left",
  12564. {
  12565. [ns.m("feedback")]: formContext?.statusIcon,
  12566. [ns.m(`label-${labelPosition.value}`)]: labelPosition.value
  12567. }
  12568. ]);
  12569. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : formContext?.inlineMessage || false);
  12570. const validateClasses = computed(() => [ns.e("error"), { [ns.em("error", "inline")]: _inlineMessage.value }]);
  12571. const propString = computed(() => {
  12572. if (!props.prop) return "";
  12573. return isArray$1(props.prop) ? props.prop.join(".") : props.prop;
  12574. });
  12575. const hasLabel = computed(() => {
  12576. return !!(props.label || slots.label);
  12577. });
  12578. const labelFor = computed(() => {
  12579. return props.for ?? (inputIds.value.length === 1 ? inputIds.value[0] : void 0);
  12580. });
  12581. const isGroup = computed(() => {
  12582. return !labelFor.value && hasLabel.value;
  12583. });
  12584. const isNested = !!parentFormItemContext;
  12585. const fieldValue = computed(() => {
  12586. const model = formContext?.model;
  12587. if (!model || !props.prop) return;
  12588. return getProp(model, props.prop).value;
  12589. });
  12590. const normalizedRules = computed(() => {
  12591. const { required } = props;
  12592. const rules = [];
  12593. if (props.rules) rules.push(...castArray$1(props.rules));
  12594. const formRules = formContext?.rules;
  12595. if (formRules && props.prop) {
  12596. const _rules = getProp(formRules, props.prop).value;
  12597. if (_rules) rules.push(...castArray$1(_rules));
  12598. }
  12599. if (required !== void 0) {
  12600. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => "required" in rule);
  12601. if (requiredRules.length > 0) for (const [rule, i] of requiredRules) {
  12602. if (rule.required === required) continue;
  12603. rules[i] = {
  12604. ...rule,
  12605. required
  12606. };
  12607. }
  12608. else rules.push({ required });
  12609. }
  12610. return rules;
  12611. });
  12612. const validateEnabled = computed(() => normalizedRules.value.length > 0);
  12613. const getFilteredRule = (trigger) => {
  12614. return normalizedRules.value.filter((rule) => {
  12615. if (!rule.trigger || !trigger) return true;
  12616. if (isArray$1(rule.trigger)) return rule.trigger.includes(trigger);
  12617. else return rule.trigger === trigger;
  12618. }).map(({ trigger, ...rule }) => rule);
  12619. };
  12620. const isRequired = computed(() => normalizedRules.value.some((rule) => rule.required));
  12621. const shouldShowError = computed(() => validateStateDebounced.value === "error" && props.showMessage && (formContext?.showMessage ?? true));
  12622. const currentLabel = computed(() => `${props.label || ""}${formContext?.labelSuffix || ""}`);
  12623. const setValidationState = (state) => {
  12624. validateState.value = state;
  12625. };
  12626. const onValidationFailed = (error) => {
  12627. const { errors, fields } = error;
  12628. if (!errors || !fields) console.error(error);
  12629. setValidationState("error");
  12630. validateMessage.value = errors ? errors?.[0]?.message ?? `${props.prop} is required` : "";
  12631. formContext?.emit("validate", props.prop, false, validateMessage.value);
  12632. };
  12633. const onValidationSucceeded = () => {
  12634. setValidationState("success");
  12635. formContext?.emit("validate", props.prop, true, "");
  12636. };
  12637. const doValidate = async (rules) => {
  12638. const modelName = propString.value;
  12639. return new Schema({ [modelName]: rules }).validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  12640. onValidationSucceeded();
  12641. return true;
  12642. }).catch((err) => {
  12643. onValidationFailed(err);
  12644. return Promise.reject(err);
  12645. });
  12646. };
  12647. const validate = async (trigger, callback) => {
  12648. if (isResettingField || !props.prop) return false;
  12649. const hasCallback = isFunction$1(callback);
  12650. if (!validateEnabled.value) {
  12651. callback?.(false);
  12652. return false;
  12653. }
  12654. const rules = getFilteredRule(trigger);
  12655. if (rules.length === 0) {
  12656. callback?.(true);
  12657. return true;
  12658. }
  12659. setValidationState("validating");
  12660. return doValidate(rules).then(() => {
  12661. callback?.(true);
  12662. return true;
  12663. }).catch((err) => {
  12664. const { fields } = err;
  12665. callback?.(false, fields);
  12666. return hasCallback ? false : Promise.reject(fields);
  12667. });
  12668. };
  12669. const clearValidate = () => {
  12670. setValidationState("");
  12671. validateMessage.value = "";
  12672. isResettingField = false;
  12673. };
  12674. const resetField = async () => {
  12675. const model = formContext?.model;
  12676. if (!model || !props.prop) return;
  12677. const computedValue = getProp(model, props.prop);
  12678. isResettingField = true;
  12679. computedValue.value = cloneDeep(initialValue);
  12680. await nextTick();
  12681. clearValidate();
  12682. isResettingField = false;
  12683. };
  12684. const addInputId = (id) => {
  12685. if (!inputIds.value.includes(id)) inputIds.value.push(id);
  12686. };
  12687. const removeInputId = (id) => {
  12688. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  12689. };
  12690. const setInitialValue = (value) => {
  12691. initialValue = cloneDeep(value);
  12692. };
  12693. watch(() => props.error, (val) => {
  12694. validateMessage.value = val || "";
  12695. setValidationState(val ? "error" : "");
  12696. }, { immediate: true });
  12697. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  12698. const context = reactive({
  12699. ...toRefs(props),
  12700. $el: formItemRef,
  12701. size: _size,
  12702. validateMessage,
  12703. validateState,
  12704. labelId,
  12705. inputIds,
  12706. isGroup,
  12707. hasLabel,
  12708. fieldValue,
  12709. addInputId,
  12710. removeInputId,
  12711. resetField,
  12712. clearValidate,
  12713. validate,
  12714. propString,
  12715. setInitialValue
  12716. });
  12717. provide(formItemContextKey, context);
  12718. onMounted(() => {
  12719. if (props.prop) {
  12720. setInitialValue(fieldValue.value);
  12721. formContext?.addField(context);
  12722. }
  12723. });
  12724. onBeforeUnmount(() => {
  12725. formContext?.removeField(context);
  12726. });
  12727. __expose({
  12728. size: _size,
  12729. validateMessage,
  12730. validateState,
  12731. validate,
  12732. clearValidate,
  12733. resetField,
  12734. setInitialValue
  12735. });
  12736. return (_ctx, _cache) => {
  12737. return openBlock(), createElementBlock("div", {
  12738. ref_key: "formItemRef",
  12739. ref: formItemRef,
  12740. class: normalizeClass(formItemClasses.value),
  12741. role: isGroup.value ? "group" : void 0,
  12742. "aria-labelledby": isGroup.value ? unref(labelId) : void 0
  12743. }, [createVNode(unref(form_label_wrap_default), {
  12744. "is-auto-width": labelStyle.value.width === "auto",
  12745. "update-all": unref(formContext)?.labelWidth === "auto"
  12746. }, {
  12747. default: withCtx(() => [!!(__props.label || _ctx.$slots.label) ? (openBlock(), createBlock(resolveDynamicComponent(labelFor.value ? "label" : "div"), {
  12748. key: 0,
  12749. id: unref(labelId),
  12750. for: labelFor.value,
  12751. class: normalizeClass(unref(ns).e("label")),
  12752. style: normalizeStyle(labelStyle.value)
  12753. }, {
  12754. default: withCtx(() => [renderSlot(_ctx.$slots, "label", { label: currentLabel.value }, () => [createTextVNode(toDisplayString(currentLabel.value), 1)])]),
  12755. _: 3
  12756. }, 8, [
  12757. "id",
  12758. "for",
  12759. "class",
  12760. "style"
  12761. ])) : createCommentVNode("v-if", true)]),
  12762. _: 3
  12763. }, 8, ["is-auto-width", "update-all"]), createElementVNode("div", {
  12764. class: normalizeClass(unref(ns).e("content")),
  12765. style: normalizeStyle(contentStyle.value)
  12766. }, [renderSlot(_ctx.$slots, "default"), createVNode(TransitionGroup, { name: `${unref(ns).namespace.value}-zoom-in-top` }, {
  12767. default: withCtx(() => [shouldShowError.value ? renderSlot(_ctx.$slots, "error", {
  12768. key: 0,
  12769. error: validateMessage.value
  12770. }, () => [createElementVNode("div", { class: normalizeClass(validateClasses.value) }, toDisplayString(validateMessage.value), 3)]) : createCommentVNode("v-if", true)]),
  12771. _: 3
  12772. }, 8, ["name"])], 6)], 10, _hoisted_1$78);
  12773. };
  12774. }
  12775. });
  12776. //#endregion
  12777. //#region ../../packages/components/form/src/form-item.vue
  12778. var form_item_default = form_item_vue_vue_type_script_setup_true_lang_default;
  12779. //#endregion
  12780. //#region ../../packages/components/form/index.ts
  12781. const ElForm = withInstall(form_default, { FormItem: form_item_default });
  12782. const ElFormItem = withNoopInstall(form_item_default);
  12783. //#endregion
  12784. //#region ../../packages/components/popper/src/utils.ts
  12785. const buildPopperOptions = (props, modifiers = []) => {
  12786. const { placement, strategy, popperOptions } = props;
  12787. const options = {
  12788. placement,
  12789. strategy,
  12790. ...popperOptions,
  12791. modifiers: [...genModifiers(props), ...modifiers]
  12792. };
  12793. deriveExtraModifiers(options, popperOptions?.modifiers);
  12794. return options;
  12795. };
  12796. const unwrapMeasurableEl = ($el) => {
  12797. if (!isClient) return;
  12798. return unrefElement($el);
  12799. };
  12800. function genModifiers(options) {
  12801. const { offset, gpuAcceleration, fallbackPlacements } = options;
  12802. return [
  12803. {
  12804. name: "offset",
  12805. options: { offset: [0, offset ?? 12] }
  12806. },
  12807. {
  12808. name: "preventOverflow",
  12809. options: { padding: {
  12810. top: 0,
  12811. bottom: 0,
  12812. left: 0,
  12813. right: 0
  12814. } }
  12815. },
  12816. {
  12817. name: "flip",
  12818. options: {
  12819. padding: 5,
  12820. fallbackPlacements
  12821. }
  12822. },
  12823. {
  12824. name: "computeStyles",
  12825. options: { gpuAcceleration }
  12826. }
  12827. ];
  12828. }
  12829. function deriveExtraModifiers(options, modifiers) {
  12830. if (modifiers) options.modifiers = [...options.modifiers, ...modifiers ?? []];
  12831. }
  12832. //#endregion
  12833. //#region ../../packages/components/popper/src/composables/use-content.ts
  12834. const DEFAULT_ARROW_OFFSET = 0;
  12835. const usePopperContent = (props) => {
  12836. const { popperInstanceRef, contentRef, triggerRef, role } = inject(POPPER_INJECTION_KEY, void 0);
  12837. const arrowRef = ref();
  12838. const arrowOffset = computed(() => props.arrowOffset);
  12839. const eventListenerModifier = computed(() => {
  12840. return {
  12841. name: "eventListeners",
  12842. enabled: !!props.visible
  12843. };
  12844. });
  12845. const arrowModifier = computed(() => {
  12846. const arrowEl = unref(arrowRef);
  12847. const offset = unref(arrowOffset) ?? DEFAULT_ARROW_OFFSET;
  12848. return {
  12849. name: "arrow",
  12850. enabled: !isUndefined$1(arrowEl),
  12851. options: {
  12852. element: arrowEl,
  12853. padding: offset
  12854. }
  12855. };
  12856. });
  12857. const options = computed(() => {
  12858. return {
  12859. onFirstUpdate: () => {
  12860. update();
  12861. },
  12862. ...buildPopperOptions(props, [unref(arrowModifier), unref(eventListenerModifier)])
  12863. };
  12864. });
  12865. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef));
  12866. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  12867. watch(instanceRef, (instance) => popperInstanceRef.value = instance, { flush: "sync" });
  12868. onMounted(() => {
  12869. watch(() => unref(computedReference)?.getBoundingClientRect?.(), () => {
  12870. update();
  12871. });
  12872. });
  12873. let stopResizeObserver;
  12874. watch(() => props.visible, (visible) => {
  12875. stopResizeObserver?.();
  12876. stopResizeObserver = void 0;
  12877. if (visible) stopResizeObserver = useResizeObserver(contentRef, update).stop;
  12878. });
  12879. onBeforeUnmount(() => {
  12880. popperInstanceRef.value = void 0;
  12881. stopResizeObserver?.();
  12882. stopResizeObserver = void 0;
  12883. });
  12884. return {
  12885. attributes,
  12886. arrowRef,
  12887. contentRef,
  12888. instanceRef,
  12889. state,
  12890. styles,
  12891. role,
  12892. forceUpdate,
  12893. update
  12894. };
  12895. };
  12896. //#endregion
  12897. //#region ../../packages/components/popper/src/composables/use-content-dom.ts
  12898. const usePopperContentDOM = (props, { attributes, styles, role }) => {
  12899. const { nextZIndex } = useZIndex();
  12900. const ns = useNamespace("popper");
  12901. const contentAttrs = computed(() => unref(attributes).popper);
  12902. const contentZIndex = ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  12903. const contentClass = computed(() => [
  12904. ns.b(),
  12905. ns.is("pure", props.pure),
  12906. ns.is(props.effect),
  12907. props.popperClass
  12908. ]);
  12909. const contentStyle = computed(() => {
  12910. return [
  12911. { zIndex: unref(contentZIndex) },
  12912. unref(styles).popper,
  12913. props.popperStyle || {}
  12914. ];
  12915. });
  12916. const ariaModal = computed(() => role.value === "dialog" ? "false" : void 0);
  12917. const arrowStyle = computed(() => unref(styles).arrow || {});
  12918. const updateZIndex = () => {
  12919. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  12920. };
  12921. return {
  12922. ariaModal,
  12923. arrowStyle,
  12924. contentAttrs,
  12925. contentClass,
  12926. contentStyle,
  12927. contentZIndex,
  12928. updateZIndex
  12929. };
  12930. };
  12931. //#endregion
  12932. //#region ../../packages/components/popper/src/composables/use-focus-trap.ts
  12933. const usePopperContentFocusTrap = (props, emit) => {
  12934. const trapped = ref(false);
  12935. const focusStartRef = ref();
  12936. const onFocusAfterTrapped = () => {
  12937. emit("focus");
  12938. };
  12939. const onFocusAfterReleased = (event) => {
  12940. if (event.detail?.focusReason !== "pointer") {
  12941. focusStartRef.value = "first";
  12942. emit("blur");
  12943. }
  12944. };
  12945. const onFocusInTrap = (event) => {
  12946. if (props.visible && !trapped.value) {
  12947. if (event.target) focusStartRef.value = event.target;
  12948. trapped.value = true;
  12949. }
  12950. };
  12951. const onFocusoutPrevented = (event) => {
  12952. if (!props.trapping) {
  12953. if (event.detail.focusReason === "pointer") event.preventDefault();
  12954. trapped.value = false;
  12955. }
  12956. };
  12957. const onReleaseRequested = () => {
  12958. trapped.value = false;
  12959. emit("close");
  12960. };
  12961. onBeforeUnmount(() => {
  12962. focusStartRef.value = void 0;
  12963. });
  12964. return {
  12965. focusStartRef,
  12966. trapped,
  12967. onFocusAfterReleased,
  12968. onFocusAfterTrapped,
  12969. onFocusInTrap,
  12970. onFocusoutPrevented,
  12971. onReleaseRequested
  12972. };
  12973. };
  12974. //#endregion
  12975. //#region ../../packages/components/popper/src/content.vue?vue&type=script&setup=true&lang.ts
  12976. var content_vue_vue_type_script_setup_true_lang_default$2 = /* @__PURE__ */ defineComponent({
  12977. name: "ElPopperContent",
  12978. __name: "content",
  12979. props: popperContentProps,
  12980. emits: popperContentEmits,
  12981. setup(__props, { expose: __expose, emit: __emit }) {
  12982. const emit = __emit;
  12983. const props = __props;
  12984. const { focusStartRef, trapped, onFocusAfterReleased, onFocusAfterTrapped, onFocusInTrap, onFocusoutPrevented, onReleaseRequested } = usePopperContentFocusTrap(props, emit);
  12985. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  12986. const { ariaModal, arrowStyle, contentAttrs, contentClass, contentStyle, updateZIndex } = usePopperContentDOM(props, {
  12987. styles,
  12988. attributes,
  12989. role
  12990. });
  12991. const formItemContext = inject(formItemContextKey, void 0);
  12992. provide(POPPER_CONTENT_INJECTION_KEY, {
  12993. arrowStyle,
  12994. arrowRef
  12995. });
  12996. if (formItemContext) provide(formItemContextKey, {
  12997. ...formItemContext,
  12998. addInputId: NOOP,
  12999. removeInputId: NOOP
  13000. });
  13001. let triggerTargetAriaStopWatch = void 0;
  13002. const updatePopper = (shouldUpdateZIndex = true) => {
  13003. update();
  13004. shouldUpdateZIndex && updateZIndex();
  13005. };
  13006. const togglePopperAlive = () => {
  13007. updatePopper(false);
  13008. if (props.visible && props.focusOnShow) trapped.value = true;
  13009. else if (props.visible === false) trapped.value = false;
  13010. };
  13011. onMounted(() => {
  13012. watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  13013. triggerTargetAriaStopWatch?.();
  13014. triggerTargetAriaStopWatch = void 0;
  13015. const el = unref(triggerTargetEl || contentRef.value);
  13016. const prevEl = unref(prevTriggerTargetEl || contentRef.value);
  13017. if (isElement$1(el)) triggerTargetAriaStopWatch = watch([
  13018. role,
  13019. () => props.ariaLabel,
  13020. ariaModal,
  13021. () => props.id
  13022. ], (watches) => {
  13023. [
  13024. "role",
  13025. "aria-label",
  13026. "aria-modal",
  13027. "id"
  13028. ].forEach((key, idx) => {
  13029. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  13030. });
  13031. }, { immediate: true });
  13032. if (prevEl !== el && isElement$1(prevEl)) [
  13033. "role",
  13034. "aria-label",
  13035. "aria-modal",
  13036. "id"
  13037. ].forEach((key) => {
  13038. prevEl.removeAttribute(key);
  13039. });
  13040. }, { immediate: true });
  13041. watch(() => props.visible, togglePopperAlive, { immediate: true });
  13042. });
  13043. onBeforeUnmount(() => {
  13044. triggerTargetAriaStopWatch?.();
  13045. triggerTargetAriaStopWatch = void 0;
  13046. contentRef.value = void 0;
  13047. });
  13048. __expose({
  13049. popperContentRef: contentRef,
  13050. popperInstanceRef: instanceRef,
  13051. updatePopper,
  13052. contentStyle
  13053. });
  13054. return (_ctx, _cache) => {
  13055. return openBlock(), createElementBlock("div", mergeProps({
  13056. ref_key: "contentRef",
  13057. ref: contentRef
  13058. }, unref(contentAttrs), {
  13059. style: unref(contentStyle),
  13060. class: unref(contentClass),
  13061. tabindex: "-1",
  13062. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  13063. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  13064. }), [createVNode(unref(focus_trap_default), {
  13065. loop: __props.loop,
  13066. trapped: unref(trapped),
  13067. "trap-on-focus-in": true,
  13068. "focus-trap-el": unref(contentRef),
  13069. "focus-start-el": unref(focusStartRef),
  13070. onFocusAfterTrapped: unref(onFocusAfterTrapped),
  13071. onFocusAfterReleased: unref(onFocusAfterReleased),
  13072. onFocusin: unref(onFocusInTrap),
  13073. onFocusoutPrevented: unref(onFocusoutPrevented),
  13074. onReleaseRequested: unref(onReleaseRequested)
  13075. }, {
  13076. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  13077. _: 3
  13078. }, 8, [
  13079. "loop",
  13080. "trapped",
  13081. "focus-trap-el",
  13082. "focus-start-el",
  13083. "onFocusAfterTrapped",
  13084. "onFocusAfterReleased",
  13085. "onFocusin",
  13086. "onFocusoutPrevented",
  13087. "onReleaseRequested"
  13088. ])], 16);
  13089. };
  13090. }
  13091. });
  13092. //#endregion
  13093. //#region ../../packages/components/popper/src/content.vue
  13094. var content_default = content_vue_vue_type_script_setup_true_lang_default$2;
  13095. //#endregion
  13096. //#region ../../packages/components/popper/index.ts
  13097. const ElPopper = withInstall(popper_default);
  13098. //#endregion
  13099. //#region ../../packages/components/tooltip/src/content.ts
  13100. const useTooltipContentPropsDefaults = {
  13101. ...useDelayedTogglePropsDefaults,
  13102. ...popperContentPropsDefaults,
  13103. content: "",
  13104. visible: null,
  13105. teleported: true
  13106. };
  13107. /**
  13108. * @deprecated Removed after 3.0.0, Use `ElTooltipContentProps` instead.
  13109. */
  13110. const useTooltipContentProps = buildProps({
  13111. ...useDelayedToggleProps,
  13112. ...popperContentProps,
  13113. appendTo: { type: teleportProps.to.type },
  13114. content: {
  13115. type: String,
  13116. default: ""
  13117. },
  13118. rawContent: Boolean,
  13119. persistent: Boolean,
  13120. visible: {
  13121. type: definePropType(Boolean),
  13122. default: null
  13123. },
  13124. transition: String,
  13125. teleported: {
  13126. type: Boolean,
  13127. default: true
  13128. },
  13129. disabled: Boolean,
  13130. ...useAriaProps(["ariaLabel"])
  13131. });
  13132. //#endregion
  13133. //#region ../../packages/components/tooltip/src/trigger.ts
  13134. const useTooltipTriggerPropsDefaults = {
  13135. trigger: "hover",
  13136. triggerKeys: () => [
  13137. EVENT_CODE.enter,
  13138. EVENT_CODE.numpadEnter,
  13139. EVENT_CODE.space
  13140. ]
  13141. };
  13142. /**
  13143. * @deprecated Removed after 3.0.0, Use `UseTooltipTriggerProps` instead.
  13144. */
  13145. const useTooltipTriggerProps = buildProps({
  13146. ...popperTriggerProps,
  13147. disabled: Boolean,
  13148. trigger: {
  13149. type: definePropType([String, Array]),
  13150. default: "hover"
  13151. },
  13152. triggerKeys: {
  13153. type: definePropType(Array),
  13154. default: () => [
  13155. EVENT_CODE.enter,
  13156. EVENT_CODE.numpadEnter,
  13157. EVENT_CODE.space
  13158. ]
  13159. },
  13160. focusOnTarget: Boolean
  13161. });
  13162. //#endregion
  13163. //#region ../../packages/components/tooltip/src/tooltip.ts
  13164. const { useModelToggleProps: useTooltipModelToggleProps, useModelToggleEmits: useTooltipModelToggleEmits, useModelToggle: useTooltipModelToggle } = createModelToggleComposable("visible");
  13165. /**
  13166. * @deprecated Removed after 3.0.0, Use `UseTooltipProps` instead.
  13167. */
  13168. const useTooltipProps = buildProps({
  13169. ...popperProps,
  13170. ...useTooltipModelToggleProps,
  13171. ...useTooltipContentProps,
  13172. ...useTooltipTriggerProps,
  13173. ...popperArrowProps,
  13174. showArrow: {
  13175. type: Boolean,
  13176. default: true
  13177. }
  13178. });
  13179. const tooltipEmits = [
  13180. ...useTooltipModelToggleEmits,
  13181. "before-show",
  13182. "before-hide",
  13183. "show",
  13184. "hide",
  13185. "open",
  13186. "close"
  13187. ];
  13188. //#endregion
  13189. //#region ../../packages/components/tooltip/src/constants.ts
  13190. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  13191. //#endregion
  13192. //#region ../../packages/components/tooltip/src/utils.ts
  13193. const isTriggerType = (trigger, type) => {
  13194. if (isArray$1(trigger)) return trigger.includes(type);
  13195. return trigger === type;
  13196. };
  13197. const whenTrigger = (trigger, type, handler) => {
  13198. return (e) => {
  13199. isTriggerType(unref(trigger), type) && handler(e);
  13200. };
  13201. };
  13202. //#endregion
  13203. //#region ../../packages/components/tooltip/src/trigger.vue?vue&type=script&setup=true&lang.ts
  13204. var trigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  13205. name: "ElTooltipTrigger",
  13206. __name: "trigger",
  13207. props: useTooltipTriggerProps,
  13208. setup(__props, { expose: __expose }) {
  13209. const props = __props;
  13210. const ns = useNamespace("tooltip");
  13211. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  13212. const triggerRef = ref(null);
  13213. const stopWhenControlledOrDisabled = () => {
  13214. if (unref(controlled) || props.disabled) return true;
  13215. };
  13216. const trigger = toRef(props, "trigger");
  13217. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", (e) => {
  13218. onOpen(e);
  13219. if (props.focusOnTarget && e.target) nextTick(() => {
  13220. focusElement(e.target, { preventScroll: true });
  13221. });
  13222. }));
  13223. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  13224. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  13225. if (e.button === 0) onToggle(e);
  13226. }));
  13227. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  13228. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  13229. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  13230. e.preventDefault();
  13231. onToggle(e);
  13232. }));
  13233. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  13234. const code = getEventCode(e);
  13235. if (props.triggerKeys.includes(code)) {
  13236. e.preventDefault();
  13237. onToggle(e);
  13238. }
  13239. });
  13240. __expose({ triggerRef });
  13241. return (_ctx, _cache) => {
  13242. return openBlock(), createBlock(unref(trigger_default), {
  13243. id: unref(id),
  13244. "virtual-ref": __props.virtualRef,
  13245. open: unref(open),
  13246. "virtual-triggering": __props.virtualTriggering,
  13247. class: normalizeClass(unref(ns).e("trigger")),
  13248. onBlur: unref(onBlur),
  13249. onClick: unref(onClick),
  13250. onContextmenu: unref(onContextMenu),
  13251. onFocus: unref(onFocus),
  13252. onMouseenter: unref(onMouseenter),
  13253. onMouseleave: unref(onMouseleave),
  13254. onKeydown: unref(onKeydown)
  13255. }, {
  13256. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  13257. _: 3
  13258. }, 8, [
  13259. "id",
  13260. "virtual-ref",
  13261. "open",
  13262. "virtual-triggering",
  13263. "class",
  13264. "onBlur",
  13265. "onClick",
  13266. "onContextmenu",
  13267. "onFocus",
  13268. "onMouseenter",
  13269. "onMouseleave",
  13270. "onKeydown"
  13271. ]);
  13272. };
  13273. }
  13274. });
  13275. //#endregion
  13276. //#region ../../packages/components/tooltip/src/trigger.vue
  13277. var trigger_default$1 = trigger_vue_vue_type_script_setup_true_lang_default;
  13278. //#endregion
  13279. //#region ../../packages/components/tooltip/src/content.vue?vue&type=script&setup=true&lang.ts
  13280. var content_vue_vue_type_script_setup_true_lang_default$1 = /* @__PURE__ */ defineComponent({
  13281. name: "ElTooltipContent",
  13282. inheritAttrs: false,
  13283. __name: "content",
  13284. props: useTooltipContentProps,
  13285. setup(__props, { expose: __expose }) {
  13286. const props = __props;
  13287. const { selector } = usePopperContainerId();
  13288. const ns = useNamespace("tooltip");
  13289. const contentRef = ref();
  13290. const popperContentRef = computedEager(() => contentRef.value?.popperContentRef);
  13291. let stopHandle;
  13292. const { controlled, id, open, trigger, onClose, onOpen, onShow, onHide, onBeforeShow, onBeforeHide } = inject(TOOLTIP_INJECTION_KEY, void 0);
  13293. const transitionClass = computed(() => {
  13294. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  13295. });
  13296. const persistentRef = computed(() => {
  13297. return props.persistent;
  13298. });
  13299. onBeforeUnmount(() => {
  13300. stopHandle?.();
  13301. });
  13302. const shouldRender = computed(() => {
  13303. return unref(persistentRef) ? true : unref(open);
  13304. });
  13305. const shouldShow = computed(() => {
  13306. return props.disabled ? false : unref(open);
  13307. });
  13308. const appendTo = computed(() => {
  13309. return props.appendTo || selector.value;
  13310. });
  13311. const contentStyle = computed(() => props.style ?? {});
  13312. const ariaHidden = ref(true);
  13313. const onTransitionLeave = () => {
  13314. onHide();
  13315. isFocusInsideContent() && focusElement(document.body, { preventScroll: true });
  13316. ariaHidden.value = true;
  13317. };
  13318. const stopWhenControlled = () => {
  13319. if (unref(controlled)) return true;
  13320. };
  13321. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  13322. if (props.enterable && isTriggerType(unref(trigger), "hover")) onOpen();
  13323. });
  13324. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  13325. if (isTriggerType(unref(trigger), "hover")) onClose();
  13326. });
  13327. const onBeforeEnter = () => {
  13328. contentRef.value?.updatePopper?.();
  13329. onBeforeShow?.();
  13330. };
  13331. const onBeforeLeave = () => {
  13332. onBeforeHide?.();
  13333. };
  13334. const onAfterShow = () => {
  13335. onShow();
  13336. };
  13337. const onBlur = () => {
  13338. if (!props.virtualTriggering) onClose();
  13339. };
  13340. const isFocusInsideContent = (event) => {
  13341. const popperContent = contentRef.value?.popperContentRef;
  13342. const activeElement = event?.relatedTarget || document.activeElement;
  13343. return popperContent?.contains(activeElement);
  13344. };
  13345. watch(() => unref(open), (val) => {
  13346. if (!val) stopHandle?.();
  13347. else {
  13348. ariaHidden.value = false;
  13349. stopHandle = onClickOutside(popperContentRef, () => {
  13350. if (unref(controlled)) return;
  13351. if (castArray(unref(trigger)).every((item) => {
  13352. return item !== "hover" && item !== "focus";
  13353. })) onClose();
  13354. }, { detectIframe: true });
  13355. }
  13356. }, { flush: "post" });
  13357. __expose({
  13358. contentRef,
  13359. isFocusInsideContent
  13360. });
  13361. return (_ctx, _cache) => {
  13362. return openBlock(), createBlock(unref(ElTeleport), {
  13363. disabled: !__props.teleported,
  13364. to: appendTo.value
  13365. }, {
  13366. default: withCtx(() => [shouldRender.value || !ariaHidden.value ? (openBlock(), createBlock(Transition, {
  13367. key: 0,
  13368. name: transitionClass.value,
  13369. appear: !persistentRef.value,
  13370. onAfterLeave: onTransitionLeave,
  13371. onBeforeEnter,
  13372. onAfterEnter: onAfterShow,
  13373. onBeforeLeave,
  13374. persisted: ""
  13375. }, {
  13376. default: withCtx(() => [withDirectives(createVNode(unref(content_default), mergeProps({
  13377. id: unref(id),
  13378. ref_key: "contentRef",
  13379. ref: contentRef
  13380. }, _ctx.$attrs, {
  13381. "aria-label": __props.ariaLabel,
  13382. "aria-hidden": ariaHidden.value,
  13383. "boundaries-padding": __props.boundariesPadding,
  13384. "fallback-placements": __props.fallbackPlacements,
  13385. "gpu-acceleration": __props.gpuAcceleration,
  13386. offset: __props.offset,
  13387. placement: __props.placement,
  13388. "popper-options": __props.popperOptions,
  13389. "arrow-offset": __props.arrowOffset,
  13390. strategy: __props.strategy,
  13391. effect: __props.effect,
  13392. enterable: __props.enterable,
  13393. pure: __props.pure,
  13394. "popper-class": __props.popperClass,
  13395. "popper-style": [__props.popperStyle, contentStyle.value],
  13396. "reference-el": __props.referenceEl,
  13397. "trigger-target-el": __props.triggerTargetEl,
  13398. visible: shouldShow.value,
  13399. "z-index": __props.zIndex,
  13400. loop: __props.loop,
  13401. onMouseenter: unref(onContentEnter),
  13402. onMouseleave: unref(onContentLeave),
  13403. onBlur,
  13404. onClose: unref(onClose)
  13405. }), {
  13406. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  13407. _: 3
  13408. }, 16, [
  13409. "id",
  13410. "aria-label",
  13411. "aria-hidden",
  13412. "boundaries-padding",
  13413. "fallback-placements",
  13414. "gpu-acceleration",
  13415. "offset",
  13416. "placement",
  13417. "popper-options",
  13418. "arrow-offset",
  13419. "strategy",
  13420. "effect",
  13421. "enterable",
  13422. "pure",
  13423. "popper-class",
  13424. "popper-style",
  13425. "reference-el",
  13426. "trigger-target-el",
  13427. "visible",
  13428. "z-index",
  13429. "loop",
  13430. "onMouseenter",
  13431. "onMouseleave",
  13432. "onClose"
  13433. ]), [[vShow, shouldShow.value]])]),
  13434. _: 3
  13435. }, 8, ["name", "appear"])) : createCommentVNode("v-if", true)]),
  13436. _: 3
  13437. }, 8, ["disabled", "to"]);
  13438. };
  13439. }
  13440. });
  13441. //#endregion
  13442. //#region ../../packages/components/tooltip/src/content.vue
  13443. var content_default$2 = content_vue_vue_type_script_setup_true_lang_default$1;
  13444. //#endregion
  13445. //#region ../../packages/components/tooltip/src/tooltip.vue?vue&type=script&setup=true&lang.ts
  13446. const _hoisted_1$77 = ["innerHTML"];
  13447. const _hoisted_2$43 = { key: 1 };
  13448. var tooltip_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  13449. name: "ElTooltip",
  13450. __name: "tooltip",
  13451. props: useTooltipProps,
  13452. emits: tooltipEmits,
  13453. setup(__props, { expose: __expose, emit: __emit }) {
  13454. const props = __props;
  13455. const emit = __emit;
  13456. usePopperContainer();
  13457. const ns = useNamespace("tooltip");
  13458. const id = useId();
  13459. const popperRef = ref();
  13460. const contentRef = ref();
  13461. const updatePopper = () => {
  13462. const popperComponent = unref(popperRef);
  13463. if (popperComponent) popperComponent.popperInstanceRef?.update();
  13464. };
  13465. const open = ref(false);
  13466. const toggleReason = ref();
  13467. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  13468. indicator: open,
  13469. toggleReason
  13470. });
  13471. const { onOpen, onClose } = useDelayedToggle({
  13472. showAfter: toRef(props, "showAfter"),
  13473. hideAfter: toRef(props, "hideAfter"),
  13474. autoClose: toRef(props, "autoClose"),
  13475. open: show,
  13476. close: hide
  13477. });
  13478. const controlled = computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  13479. const kls = computed(() => {
  13480. return [ns.b(), props.popperClass];
  13481. });
  13482. provide(TOOLTIP_INJECTION_KEY, {
  13483. controlled,
  13484. id,
  13485. open: readonly(open),
  13486. trigger: toRef(props, "trigger"),
  13487. onOpen,
  13488. onClose,
  13489. onToggle: (event) => {
  13490. if (unref(open)) onClose(event);
  13491. else onOpen(event);
  13492. },
  13493. onShow: () => {
  13494. emit("show", toggleReason.value);
  13495. },
  13496. onHide: () => {
  13497. emit("hide", toggleReason.value);
  13498. },
  13499. onBeforeShow: () => {
  13500. emit("before-show", toggleReason.value);
  13501. },
  13502. onBeforeHide: () => {
  13503. emit("before-hide", toggleReason.value);
  13504. },
  13505. updatePopper
  13506. });
  13507. watch(() => props.disabled, (disabled) => {
  13508. if (disabled && open.value) open.value = false;
  13509. if (!disabled && isBoolean(props.visible)) open.value = props.visible;
  13510. });
  13511. const isFocusInsideContent = (event) => {
  13512. return contentRef.value?.isFocusInsideContent(event);
  13513. };
  13514. onDeactivated(() => open.value && hide());
  13515. onBeforeUnmount(() => {
  13516. toggleReason.value = void 0;
  13517. });
  13518. __expose({
  13519. popperRef,
  13520. contentRef,
  13521. isFocusInsideContent,
  13522. updatePopper,
  13523. onOpen,
  13524. onClose,
  13525. hide
  13526. });
  13527. return (_ctx, _cache) => {
  13528. return openBlock(), createBlock(unref(ElPopper), {
  13529. ref_key: "popperRef",
  13530. ref: popperRef,
  13531. role: __props.role
  13532. }, {
  13533. default: withCtx(() => [createVNode(trigger_default$1, {
  13534. disabled: __props.disabled,
  13535. trigger: __props.trigger,
  13536. "trigger-keys": __props.triggerKeys,
  13537. "virtual-ref": __props.virtualRef,
  13538. "virtual-triggering": __props.virtualTriggering,
  13539. "focus-on-target": __props.focusOnTarget
  13540. }, {
  13541. default: withCtx(() => [_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)]),
  13542. _: 3
  13543. }, 8, [
  13544. "disabled",
  13545. "trigger",
  13546. "trigger-keys",
  13547. "virtual-ref",
  13548. "virtual-triggering",
  13549. "focus-on-target"
  13550. ]), createVNode(content_default$2, {
  13551. ref_key: "contentRef",
  13552. ref: contentRef,
  13553. "aria-label": __props.ariaLabel,
  13554. "boundaries-padding": __props.boundariesPadding,
  13555. content: __props.content,
  13556. disabled: __props.disabled,
  13557. effect: __props.effect,
  13558. enterable: __props.enterable,
  13559. "fallback-placements": __props.fallbackPlacements,
  13560. "hide-after": __props.hideAfter,
  13561. "gpu-acceleration": __props.gpuAcceleration,
  13562. offset: __props.offset,
  13563. persistent: __props.persistent,
  13564. "popper-class": kls.value,
  13565. "popper-style": __props.popperStyle,
  13566. placement: __props.placement,
  13567. "popper-options": __props.popperOptions,
  13568. "arrow-offset": __props.arrowOffset,
  13569. pure: __props.pure,
  13570. "raw-content": __props.rawContent,
  13571. "reference-el": __props.referenceEl,
  13572. "trigger-target-el": __props.triggerTargetEl,
  13573. "show-after": __props.showAfter,
  13574. strategy: __props.strategy,
  13575. teleported: __props.teleported,
  13576. transition: __props.transition,
  13577. "virtual-triggering": __props.virtualTriggering,
  13578. "z-index": __props.zIndex,
  13579. "append-to": __props.appendTo,
  13580. loop: __props.loop
  13581. }, {
  13582. default: withCtx(() => [renderSlot(_ctx.$slots, "content", {}, () => [__props.rawContent ? (openBlock(), createElementBlock("span", {
  13583. key: 0,
  13584. innerHTML: __props.content
  13585. }, null, 8, _hoisted_1$77)) : (openBlock(), createElementBlock("span", _hoisted_2$43, toDisplayString(__props.content), 1))]), __props.showArrow ? (openBlock(), createBlock(unref(arrow_default), { key: 0 })) : createCommentVNode("v-if", true)]),
  13586. _: 3
  13587. }, 8, [
  13588. "aria-label",
  13589. "boundaries-padding",
  13590. "content",
  13591. "disabled",
  13592. "effect",
  13593. "enterable",
  13594. "fallback-placements",
  13595. "hide-after",
  13596. "gpu-acceleration",
  13597. "offset",
  13598. "persistent",
  13599. "popper-class",
  13600. "popper-style",
  13601. "placement",
  13602. "popper-options",
  13603. "arrow-offset",
  13604. "pure",
  13605. "raw-content",
  13606. "reference-el",
  13607. "trigger-target-el",
  13608. "show-after",
  13609. "strategy",
  13610. "teleported",
  13611. "transition",
  13612. "virtual-triggering",
  13613. "z-index",
  13614. "append-to",
  13615. "loop"
  13616. ])]),
  13617. _: 3
  13618. }, 8, ["role"]);
  13619. };
  13620. }
  13621. });
  13622. //#endregion
  13623. //#region ../../packages/components/tooltip/src/tooltip.vue
  13624. var tooltip_default = tooltip_vue_vue_type_script_setup_true_lang_default;
  13625. //#endregion
  13626. //#region ../../packages/components/tooltip/index.ts
  13627. const ElTooltip = withInstall(tooltip_default);
  13628. //#endregion
  13629. //#region ../../packages/components/input/src/input.ts
  13630. /**
  13631. * @deprecated Removed after 3.0.0, Use `InputProps` instead.
  13632. */
  13633. const inputProps = buildProps({
  13634. id: {
  13635. type: String,
  13636. default: void 0
  13637. },
  13638. size: useSizeProp,
  13639. disabled: {
  13640. type: Boolean,
  13641. default: void 0
  13642. },
  13643. modelValue: {
  13644. type: definePropType([
  13645. String,
  13646. Number,
  13647. Object
  13648. ]),
  13649. default: ""
  13650. },
  13651. modelModifiers: {
  13652. type: definePropType(Object),
  13653. default: () => ({})
  13654. },
  13655. maxlength: { type: [String, Number] },
  13656. minlength: { type: [String, Number] },
  13657. type: {
  13658. type: definePropType(String),
  13659. default: "text"
  13660. },
  13661. resize: {
  13662. type: String,
  13663. values: [
  13664. "none",
  13665. "both",
  13666. "horizontal",
  13667. "vertical"
  13668. ]
  13669. },
  13670. autosize: {
  13671. type: definePropType([Boolean, Object]),
  13672. default: false
  13673. },
  13674. autocomplete: {
  13675. type: definePropType(String),
  13676. default: "off"
  13677. },
  13678. formatter: { type: Function },
  13679. parser: { type: Function },
  13680. placeholder: { type: String },
  13681. form: { type: String },
  13682. readonly: Boolean,
  13683. clearable: Boolean,
  13684. clearIcon: {
  13685. type: iconPropType,
  13686. default: circle_close_default
  13687. },
  13688. showPassword: Boolean,
  13689. showWordLimit: Boolean,
  13690. wordLimitPosition: {
  13691. type: String,
  13692. values: ["inside", "outside"],
  13693. default: "inside"
  13694. },
  13695. suffixIcon: { type: iconPropType },
  13696. prefixIcon: { type: iconPropType },
  13697. containerRole: {
  13698. type: String,
  13699. default: void 0
  13700. },
  13701. tabindex: {
  13702. type: [String, Number],
  13703. default: 0
  13704. },
  13705. validateEvent: {
  13706. type: Boolean,
  13707. default: true
  13708. },
  13709. inputStyle: {
  13710. type: definePropType([
  13711. Object,
  13712. Array,
  13713. String
  13714. ]),
  13715. default: () => mutable({})
  13716. },
  13717. autofocus: Boolean,
  13718. rows: {
  13719. type: Number,
  13720. default: 2
  13721. },
  13722. ...useAriaProps(["ariaLabel"]),
  13723. inputmode: {
  13724. type: definePropType(String),
  13725. default: void 0
  13726. },
  13727. name: String
  13728. });
  13729. const inputEmits = {
  13730. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  13731. input: (value) => isString(value),
  13732. change: (value, evt) => isString(value) && (evt instanceof Event || evt === void 0),
  13733. focus: (evt) => evt instanceof FocusEvent,
  13734. blur: (evt) => evt instanceof FocusEvent,
  13735. clear: (evt) => evt === void 0 || evt instanceof MouseEvent,
  13736. mouseleave: (evt) => evt instanceof MouseEvent,
  13737. mouseenter: (evt) => evt instanceof MouseEvent,
  13738. keydown: (evt) => evt instanceof Event,
  13739. compositionstart: (evt) => evt instanceof CompositionEvent,
  13740. compositionupdate: (evt) => evt instanceof CompositionEvent,
  13741. compositionend: (evt) => evt instanceof CompositionEvent
  13742. };
  13743. /**
  13744. * @description default values for InputProps, used in components that extend InputProps like Autocomplete
  13745. */
  13746. const inputPropsDefaults = {
  13747. disabled: void 0,
  13748. modelValue: "",
  13749. modelModifiers: () => ({}),
  13750. type: "text",
  13751. autocomplete: "off",
  13752. clearIcon: markRaw(circle_close_default),
  13753. wordLimitPosition: "inside",
  13754. tabindex: 0,
  13755. validateEvent: true,
  13756. inputStyle: () => ({}),
  13757. rows: 2
  13758. };
  13759. //#endregion
  13760. //#region ../../packages/components/input/src/utils.ts
  13761. let hiddenTextarea = void 0;
  13762. const HIDDEN_STYLE = {
  13763. height: "0",
  13764. visibility: "hidden",
  13765. overflow: isFirefox() ? "" : "hidden",
  13766. position: "absolute",
  13767. "z-index": "-1000",
  13768. top: "0",
  13769. right: "0"
  13770. };
  13771. const CONTEXT_STYLE = [
  13772. "letter-spacing",
  13773. "line-height",
  13774. "padding-top",
  13775. "padding-bottom",
  13776. "font-family",
  13777. "font-weight",
  13778. "font-size",
  13779. "text-rendering",
  13780. "text-transform",
  13781. "width",
  13782. "text-indent",
  13783. "padding-left",
  13784. "padding-right",
  13785. "border-width",
  13786. "box-sizing",
  13787. "word-break"
  13788. ];
  13789. const looseToNumber = (val) => {
  13790. const n = Number.parseFloat(val);
  13791. return Number.isNaN(n) ? val : n;
  13792. };
  13793. function calculateNodeStyling(targetElement) {
  13794. const style = window.getComputedStyle(targetElement);
  13795. const boxSizing = style.getPropertyValue("box-sizing");
  13796. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  13797. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  13798. return {
  13799. contextStyle: CONTEXT_STYLE.map((name) => [name, style.getPropertyValue(name)]),
  13800. paddingSize,
  13801. borderSize,
  13802. boxSizing
  13803. };
  13804. }
  13805. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  13806. if (!hiddenTextarea) {
  13807. hiddenTextarea = document.createElement("textarea");
  13808. let hostNode = document.body;
  13809. if (!isFirefox() && targetElement.parentNode) hostNode = targetElement.parentNode;
  13810. hostNode.appendChild(hiddenTextarea);
  13811. }
  13812. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  13813. contextStyle.forEach(([key, value]) => hiddenTextarea?.style.setProperty(key, value));
  13814. Object.entries(HIDDEN_STYLE).forEach(([key, value]) => hiddenTextarea?.style.setProperty(key, value, "important"));
  13815. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  13816. let height = hiddenTextarea.scrollHeight;
  13817. const result = {};
  13818. if (boxSizing === "border-box") height = height + borderSize;
  13819. else if (boxSizing === "content-box") height = height - paddingSize;
  13820. hiddenTextarea.value = "";
  13821. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  13822. if (isNumber(minRows)) {
  13823. let minHeight = singleRowHeight * minRows;
  13824. if (boxSizing === "border-box") minHeight = minHeight + paddingSize + borderSize;
  13825. height = Math.max(minHeight, height);
  13826. result.minHeight = `${minHeight}px`;
  13827. }
  13828. if (isNumber(maxRows)) {
  13829. let maxHeight = singleRowHeight * maxRows;
  13830. if (boxSizing === "border-box") maxHeight = maxHeight + paddingSize + borderSize;
  13831. height = Math.min(maxHeight, height);
  13832. }
  13833. result.height = `${height}px`;
  13834. hiddenTextarea.parentNode?.removeChild(hiddenTextarea);
  13835. hiddenTextarea = void 0;
  13836. return result;
  13837. }
  13838. //#endregion
  13839. //#region ../../packages/components/input/src/input.vue?vue&type=script&setup=true&lang.ts
  13840. const _hoisted_1$76 = [
  13841. "id",
  13842. "name",
  13843. "minlength",
  13844. "maxlength",
  13845. "type",
  13846. "disabled",
  13847. "readonly",
  13848. "autocomplete",
  13849. "tabindex",
  13850. "aria-label",
  13851. "placeholder",
  13852. "form",
  13853. "autofocus",
  13854. "role",
  13855. "inputmode"
  13856. ];
  13857. const _hoisted_2$42 = [
  13858. "id",
  13859. "name",
  13860. "minlength",
  13861. "maxlength",
  13862. "tabindex",
  13863. "disabled",
  13864. "readonly",
  13865. "autocomplete",
  13866. "aria-label",
  13867. "placeholder",
  13868. "form",
  13869. "autofocus",
  13870. "rows",
  13871. "role",
  13872. "inputmode"
  13873. ];
  13874. const COMPONENT_NAME$19 = "ElInput";
  13875. var input_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  13876. name: COMPONENT_NAME$19,
  13877. inheritAttrs: false,
  13878. __name: "input",
  13879. props: inputProps,
  13880. emits: inputEmits,
  13881. setup(__props, { expose: __expose, emit: __emit }) {
  13882. const props = __props;
  13883. const emit = __emit;
  13884. const rawAttrs = useAttrs$1();
  13885. const attrs = useAttrs();
  13886. const slots = useSlots();
  13887. const containerKls = computed(() => [
  13888. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  13889. nsInput.m(inputSize.value),
  13890. nsInput.is("disabled", inputDisabled.value),
  13891. nsInput.is("exceed", inputExceed.value),
  13892. {
  13893. [nsInput.b("group")]: slots.prepend || slots.append,
  13894. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  13895. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  13896. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
  13897. [nsInput.b("hidden")]: props.type === "hidden"
  13898. },
  13899. rawAttrs.class
  13900. ]);
  13901. const wrapperKls = computed(() => [nsInput.e("wrapper"), nsInput.is("focus", isFocused.value)]);
  13902. const { form: elForm, formItem: elFormItem } = useFormItem();
  13903. const { inputId } = useFormItemInputId(props, { formItemContext: elFormItem });
  13904. const inputSize = useFormSize();
  13905. const inputDisabled = useFormDisabled();
  13906. const nsInput = useNamespace("input");
  13907. const nsTextarea = useNamespace("textarea");
  13908. const input = shallowRef();
  13909. const textarea = shallowRef();
  13910. const hovering = ref(false);
  13911. const passwordVisible = ref(false);
  13912. const countStyle = ref();
  13913. const textareaCalcStyle = shallowRef(props.inputStyle);
  13914. const _ref = computed(() => input.value || textarea.value);
  13915. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
  13916. disabled: inputDisabled,
  13917. afterBlur() {
  13918. if (props.validateEvent) elFormItem?.validate?.("blur").catch((err) => /* @__PURE__ */ debugWarn(err));
  13919. }
  13920. });
  13921. const needStatusIcon = computed(() => elForm?.statusIcon ?? false);
  13922. const validateState = computed(() => elFormItem?.validateState || "");
  13923. const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  13924. const passwordIcon = computed(() => passwordVisible.value ? view_default : hide_default);
  13925. const containerStyle = computed(() => [rawAttrs.style]);
  13926. const textareaStyle = computed(() => [
  13927. props.inputStyle,
  13928. textareaCalcStyle.value,
  13929. { resize: props.resize }
  13930. ]);
  13931. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  13932. const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
  13933. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !!nativeInputValue.value);
  13934. const isWordLimitVisible = computed(() => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  13935. const textLength = computed(() => nativeInputValue.value.length);
  13936. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength));
  13937. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  13938. const hasModelModifiers = computed(() => !!Object.keys(props.modelModifiers).length);
  13939. const [recordCursor, setCursor] = useCursor(input);
  13940. useResizeObserver(textarea, (entries) => {
  13941. onceInitSizeTextarea();
  13942. if (!isWordLimitVisible.value || props.resize !== "both" && props.resize !== "horizontal") return;
  13943. const { width } = entries[0].contentRect;
  13944. countStyle.value = { right: `calc(100% - ${width + 22 - 10}px)` };
  13945. });
  13946. const resizeTextarea = () => {
  13947. const { type, autosize } = props;
  13948. if (!isClient || type !== "textarea" || !textarea.value) return;
  13949. if (autosize) {
  13950. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  13951. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  13952. const textareaStyle = calcTextareaHeight(textarea.value, minRows, maxRows);
  13953. textareaCalcStyle.value = {
  13954. overflowY: "hidden",
  13955. ...textareaStyle
  13956. };
  13957. nextTick(() => {
  13958. textarea.value.offsetHeight;
  13959. textareaCalcStyle.value = textareaStyle;
  13960. });
  13961. } else textareaCalcStyle.value = { minHeight: calcTextareaHeight(textarea.value).minHeight };
  13962. };
  13963. const createOnceInitResize = (resizeTextarea) => {
  13964. let isInit = false;
  13965. return () => {
  13966. if (isInit || !props.autosize) return;
  13967. if (!(textarea.value?.offsetParent === null)) {
  13968. setTimeout(resizeTextarea);
  13969. isInit = true;
  13970. }
  13971. };
  13972. };
  13973. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  13974. const setNativeInputValue = () => {
  13975. const input = _ref.value;
  13976. const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
  13977. if (!input || input.value === formatterValue || props.type === "file") return;
  13978. input.value = formatterValue;
  13979. };
  13980. const formatValue = (value) => {
  13981. const { trim, number } = props.modelModifiers;
  13982. if (trim) value = value.trim();
  13983. if (number) value = `${looseToNumber(value)}`;
  13984. if (props.formatter && props.parser) value = props.parser(value);
  13985. return value;
  13986. };
  13987. const handleInput = async (event) => {
  13988. if (isComposing.value) return;
  13989. const { lazy } = props.modelModifiers;
  13990. let { value } = event.target;
  13991. if (lazy) {
  13992. emit(INPUT_EVENT, value);
  13993. return;
  13994. }
  13995. value = formatValue(value);
  13996. if (String(value) === nativeInputValue.value) {
  13997. if (props.formatter) setNativeInputValue();
  13998. return;
  13999. }
  14000. recordCursor();
  14001. emit(UPDATE_MODEL_EVENT, value);
  14002. emit(INPUT_EVENT, value);
  14003. await nextTick();
  14004. if (props.formatter && props.parser || !hasModelModifiers.value) setNativeInputValue();
  14005. setCursor();
  14006. };
  14007. const handleChange = async (event) => {
  14008. let { value } = event.target;
  14009. value = formatValue(value);
  14010. if (props.modelModifiers.lazy) emit(UPDATE_MODEL_EVENT, value);
  14011. emit(CHANGE_EVENT, value, event);
  14012. await nextTick();
  14013. setNativeInputValue();
  14014. };
  14015. const { isComposing, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd } = useComposition({
  14016. emit,
  14017. afterComposition: handleInput
  14018. });
  14019. const handlePasswordVisible = () => {
  14020. passwordVisible.value = !passwordVisible.value;
  14021. };
  14022. const focus = () => _ref.value?.focus();
  14023. const blur = () => _ref.value?.blur();
  14024. const handleMouseLeave = (evt) => {
  14025. hovering.value = false;
  14026. emit("mouseleave", evt);
  14027. };
  14028. const handleMouseEnter = (evt) => {
  14029. hovering.value = true;
  14030. emit("mouseenter", evt);
  14031. };
  14032. const handleKeydown = (evt) => {
  14033. emit("keydown", evt);
  14034. };
  14035. const select = () => {
  14036. _ref.value?.select();
  14037. };
  14038. const clear = (evt) => {
  14039. emit(UPDATE_MODEL_EVENT, "");
  14040. emit(CHANGE_EVENT, "");
  14041. emit("clear", evt);
  14042. emit(INPUT_EVENT, "");
  14043. };
  14044. watch(() => props.modelValue, () => {
  14045. nextTick(() => resizeTextarea());
  14046. if (props.validateEvent) elFormItem?.validate?.("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  14047. });
  14048. watch(nativeInputValue, (newValue) => {
  14049. if (!_ref.value) return;
  14050. const { trim, number } = props.modelModifiers;
  14051. const elValue = _ref.value.value;
  14052. const displayValue = (number || props.type === "number") && !/^0\d/.test(elValue) ? `${looseToNumber(elValue)}` : elValue;
  14053. if (displayValue === newValue) return;
  14054. if (document.activeElement === _ref.value && _ref.value.type !== "range") {
  14055. if (trim && displayValue.trim() === newValue) return;
  14056. }
  14057. setNativeInputValue();
  14058. });
  14059. watch(() => props.type, async () => {
  14060. await nextTick();
  14061. setNativeInputValue();
  14062. resizeTextarea();
  14063. });
  14064. onMounted(() => {
  14065. if (!props.formatter && props.parser) /* @__PURE__ */ debugWarn(COMPONENT_NAME$19, "If you set the parser, you also need to set the formatter.");
  14066. setNativeInputValue();
  14067. nextTick(resizeTextarea);
  14068. });
  14069. __expose({
  14070. input,
  14071. textarea,
  14072. ref: _ref,
  14073. textareaStyle,
  14074. autosize: toRef(props, "autosize"),
  14075. isComposing,
  14076. focus,
  14077. blur,
  14078. select,
  14079. clear,
  14080. resizeTextarea
  14081. });
  14082. return (_ctx, _cache) => {
  14083. return openBlock(), createElementBlock("div", {
  14084. class: normalizeClass([containerKls.value, {
  14085. [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  14086. [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
  14087. }]),
  14088. style: normalizeStyle(containerStyle.value),
  14089. onMouseenter: handleMouseEnter,
  14090. onMouseleave: handleMouseLeave
  14091. }, [createCommentVNode(" input "), __props.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  14092. createCommentVNode(" prepend slot "),
  14093. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  14094. key: 0,
  14095. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  14096. }, [renderSlot(_ctx.$slots, "prepend")], 2)) : createCommentVNode("v-if", true),
  14097. createElementVNode("div", {
  14098. ref_key: "wrapperRef",
  14099. ref: wrapperRef,
  14100. class: normalizeClass(wrapperKls.value)
  14101. }, [
  14102. createCommentVNode(" prefix slot "),
  14103. _ctx.$slots.prefix || __props.prefixIcon ? (openBlock(), createElementBlock("span", {
  14104. key: 0,
  14105. class: normalizeClass(unref(nsInput).e("prefix"))
  14106. }, [createElementVNode("span", { class: normalizeClass(unref(nsInput).e("prefix-inner")) }, [renderSlot(_ctx.$slots, "prefix"), __props.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  14107. key: 0,
  14108. class: normalizeClass(unref(nsInput).e("icon"))
  14109. }, {
  14110. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.prefixIcon)))]),
  14111. _: 1
  14112. }, 8, ["class"])) : createCommentVNode("v-if", true)], 2)], 2)) : createCommentVNode("v-if", true),
  14113. createElementVNode("input", mergeProps({
  14114. id: unref(inputId),
  14115. ref_key: "input",
  14116. ref: input,
  14117. class: unref(nsInput).e("inner")
  14118. }, unref(attrs), {
  14119. name: __props.name,
  14120. minlength: __props.minlength,
  14121. maxlength: __props.maxlength,
  14122. type: __props.showPassword ? passwordVisible.value ? "text" : "password" : __props.type,
  14123. disabled: unref(inputDisabled),
  14124. readonly: __props.readonly,
  14125. autocomplete: __props.autocomplete,
  14126. tabindex: __props.tabindex,
  14127. "aria-label": __props.ariaLabel,
  14128. placeholder: __props.placeholder,
  14129. style: __props.inputStyle,
  14130. form: __props.form,
  14131. autofocus: __props.autofocus,
  14132. role: __props.containerRole,
  14133. inputmode: __props.inputmode,
  14134. onCompositionstart: _cache[0] || (_cache[0] = (...args) => unref(handleCompositionStart) && unref(handleCompositionStart)(...args)),
  14135. onCompositionupdate: _cache[1] || (_cache[1] = (...args) => unref(handleCompositionUpdate) && unref(handleCompositionUpdate)(...args)),
  14136. onCompositionend: _cache[2] || (_cache[2] = (...args) => unref(handleCompositionEnd) && unref(handleCompositionEnd)(...args)),
  14137. onInput: handleInput,
  14138. onChange: handleChange,
  14139. onKeydown: handleKeydown
  14140. }), null, 16, _hoisted_1$76),
  14141. createCommentVNode(" suffix slot "),
  14142. suffixVisible.value ? (openBlock(), createElementBlock("span", {
  14143. key: 1,
  14144. class: normalizeClass(unref(nsInput).e("suffix"))
  14145. }, [createElementVNode("span", { class: normalizeClass(unref(nsInput).e("suffix-inner")) }, [
  14146. !showClear.value || !showPwdVisible.value || !isWordLimitVisible.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [renderSlot(_ctx.$slots, "suffix"), __props.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  14147. key: 0,
  14148. class: normalizeClass(unref(nsInput).e("icon"))
  14149. }, {
  14150. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.suffixIcon)))]),
  14151. _: 1
  14152. }, 8, ["class"])) : createCommentVNode("v-if", true)], 64)) : createCommentVNode("v-if", true),
  14153. showClear.value ? (openBlock(), createBlock(unref(ElIcon), {
  14154. key: 1,
  14155. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  14156. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  14157. onClick: clear
  14158. }, {
  14159. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.clearIcon)))]),
  14160. _: 1
  14161. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
  14162. showPwdVisible.value ? (openBlock(), createBlock(unref(ElIcon), {
  14163. key: 2,
  14164. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  14165. onClick: handlePasswordVisible,
  14166. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  14167. onMouseup: withModifiers(unref(NOOP), ["prevent"])
  14168. }, {
  14169. default: withCtx(() => [renderSlot(_ctx.$slots, "password-icon", { visible: passwordVisible.value }, () => [(openBlock(), createBlock(resolveDynamicComponent(passwordIcon.value)))])]),
  14170. _: 3
  14171. }, 8, [
  14172. "class",
  14173. "onMousedown",
  14174. "onMouseup"
  14175. ])) : createCommentVNode("v-if", true),
  14176. isWordLimitVisible.value ? (openBlock(), createElementBlock("span", {
  14177. key: 3,
  14178. class: normalizeClass([unref(nsInput).e("count"), unref(nsInput).is("outside", __props.wordLimitPosition === "outside")])
  14179. }, [createElementVNode("span", { class: normalizeClass(unref(nsInput).e("count-inner")) }, toDisplayString(textLength.value) + " / " + toDisplayString(__props.maxlength), 3)], 2)) : createCommentVNode("v-if", true),
  14180. validateState.value && validateIcon.value && needStatusIcon.value ? (openBlock(), createBlock(unref(ElIcon), {
  14181. key: 4,
  14182. class: normalizeClass([
  14183. unref(nsInput).e("icon"),
  14184. unref(nsInput).e("validateIcon"),
  14185. unref(nsInput).is("loading", validateState.value === "validating")
  14186. ])
  14187. }, {
  14188. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(validateIcon.value)))]),
  14189. _: 1
  14190. }, 8, ["class"])) : createCommentVNode("v-if", true)
  14191. ], 2)], 2)) : createCommentVNode("v-if", true)
  14192. ], 2),
  14193. createCommentVNode(" append slot "),
  14194. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  14195. key: 1,
  14196. class: normalizeClass(unref(nsInput).be("group", "append"))
  14197. }, [renderSlot(_ctx.$slots, "append")], 2)) : createCommentVNode("v-if", true)
  14198. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  14199. createCommentVNode(" textarea "),
  14200. createElementVNode("textarea", mergeProps({
  14201. id: unref(inputId),
  14202. ref_key: "textarea",
  14203. ref: textarea,
  14204. class: [
  14205. unref(nsTextarea).e("inner"),
  14206. unref(nsInput).is("focus", unref(isFocused)),
  14207. unref(nsTextarea).is("clearable", __props.clearable)
  14208. ]
  14209. }, unref(attrs), {
  14210. name: __props.name,
  14211. minlength: __props.minlength,
  14212. maxlength: __props.maxlength,
  14213. tabindex: __props.tabindex,
  14214. disabled: unref(inputDisabled),
  14215. readonly: __props.readonly,
  14216. autocomplete: __props.autocomplete,
  14217. style: textareaStyle.value,
  14218. "aria-label": __props.ariaLabel,
  14219. placeholder: __props.placeholder,
  14220. form: __props.form,
  14221. autofocus: __props.autofocus,
  14222. rows: __props.rows,
  14223. role: __props.containerRole,
  14224. inputmode: __props.inputmode,
  14225. onCompositionstart: _cache[3] || (_cache[3] = (...args) => unref(handleCompositionStart) && unref(handleCompositionStart)(...args)),
  14226. onCompositionupdate: _cache[4] || (_cache[4] = (...args) => unref(handleCompositionUpdate) && unref(handleCompositionUpdate)(...args)),
  14227. onCompositionend: _cache[5] || (_cache[5] = (...args) => unref(handleCompositionEnd) && unref(handleCompositionEnd)(...args)),
  14228. onInput: handleInput,
  14229. onFocus: _cache[6] || (_cache[6] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  14230. onBlur: _cache[7] || (_cache[7] = (...args) => unref(handleBlur) && unref(handleBlur)(...args)),
  14231. onChange: handleChange,
  14232. onKeydown: handleKeydown
  14233. }), null, 16, _hoisted_2$42),
  14234. showClear.value ? (openBlock(), createBlock(unref(ElIcon), {
  14235. key: 0,
  14236. class: normalizeClass([unref(nsTextarea).e("icon"), unref(nsTextarea).e("clear")]),
  14237. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  14238. onClick: clear
  14239. }, {
  14240. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.clearIcon)))]),
  14241. _: 1
  14242. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
  14243. isWordLimitVisible.value ? (openBlock(), createElementBlock("span", {
  14244. key: 1,
  14245. style: normalizeStyle(countStyle.value),
  14246. class: normalizeClass([unref(nsInput).e("count"), unref(nsInput).is("outside", __props.wordLimitPosition === "outside")])
  14247. }, toDisplayString(textLength.value) + " / " + toDisplayString(__props.maxlength), 7)) : createCommentVNode("v-if", true)
  14248. ], 64))], 38);
  14249. };
  14250. }
  14251. });
  14252. //#endregion
  14253. //#region ../../packages/components/input/src/input.vue
  14254. var input_default = input_vue_vue_type_script_setup_true_lang_default;
  14255. //#endregion
  14256. //#region ../../packages/components/input/index.ts
  14257. const ElInput = withInstall(input_default);
  14258. //#endregion
  14259. //#region ../../packages/components/autocomplete/src/autocomplete.ts
  14260. /**
  14261. * @deprecated Removed after 3.0.0, Use `AutocompleteProps` instead.
  14262. */
  14263. const autocompleteProps = buildProps({
  14264. ...inputProps,
  14265. valueKey: {
  14266. type: String,
  14267. default: "value"
  14268. },
  14269. modelValue: {
  14270. type: [String, Number],
  14271. default: ""
  14272. },
  14273. debounce: {
  14274. type: Number,
  14275. default: 300
  14276. },
  14277. placement: {
  14278. type: definePropType(String),
  14279. values: [
  14280. "top",
  14281. "top-start",
  14282. "top-end",
  14283. "bottom",
  14284. "bottom-start",
  14285. "bottom-end"
  14286. ],
  14287. default: "bottom-start"
  14288. },
  14289. fetchSuggestions: {
  14290. type: definePropType([Function, Array]),
  14291. default: NOOP
  14292. },
  14293. popperClass: useTooltipContentProps.popperClass,
  14294. popperStyle: useTooltipContentProps.popperStyle,
  14295. triggerOnFocus: {
  14296. type: Boolean,
  14297. default: true
  14298. },
  14299. selectWhenUnmatched: Boolean,
  14300. hideLoading: Boolean,
  14301. teleported: useTooltipContentProps.teleported,
  14302. appendTo: useTooltipContentProps.appendTo,
  14303. highlightFirstItem: Boolean,
  14304. fitInputWidth: Boolean,
  14305. loopNavigation: {
  14306. type: Boolean,
  14307. default: true
  14308. }
  14309. });
  14310. const autocompleteEmits = {
  14311. [UPDATE_MODEL_EVENT]: (value) => isString(value) || isNumber(value),
  14312. [INPUT_EVENT]: (value) => isString(value) || isNumber(value),
  14313. [CHANGE_EVENT]: (value) => isString(value) || isNumber(value),
  14314. focus: (evt) => evt instanceof FocusEvent,
  14315. blur: (evt) => evt instanceof FocusEvent,
  14316. clear: () => true,
  14317. select: (item) => isObject$1(item)
  14318. };
  14319. //#endregion
  14320. //#region ../../packages/components/scrollbar/src/scrollbar.ts
  14321. /**
  14322. * @deprecated Removed after 3.0.0, Use `ScrollbarProps` instead.
  14323. */
  14324. const scrollbarProps = buildProps({
  14325. distance: {
  14326. type: Number,
  14327. default: 0
  14328. },
  14329. height: {
  14330. type: [String, Number],
  14331. default: ""
  14332. },
  14333. maxHeight: {
  14334. type: [String, Number],
  14335. default: ""
  14336. },
  14337. native: Boolean,
  14338. wrapStyle: {
  14339. type: definePropType([
  14340. String,
  14341. Object,
  14342. Array
  14343. ]),
  14344. default: ""
  14345. },
  14346. wrapClass: {
  14347. type: [String, Array],
  14348. default: ""
  14349. },
  14350. viewClass: {
  14351. type: [String, Array],
  14352. default: ""
  14353. },
  14354. viewStyle: {
  14355. type: [
  14356. String,
  14357. Array,
  14358. Object
  14359. ],
  14360. default: ""
  14361. },
  14362. noresize: Boolean,
  14363. tag: {
  14364. type: String,
  14365. default: "div"
  14366. },
  14367. always: Boolean,
  14368. minSize: {
  14369. type: Number,
  14370. default: 20
  14371. },
  14372. tabindex: {
  14373. type: [String, Number],
  14374. default: void 0
  14375. },
  14376. id: String,
  14377. role: String,
  14378. ...useAriaProps(["ariaLabel", "ariaOrientation"])
  14379. });
  14380. const scrollbarEmits = {
  14381. "end-reached": (direction) => [
  14382. "left",
  14383. "right",
  14384. "top",
  14385. "bottom"
  14386. ].includes(direction),
  14387. scroll: ({ scrollTop, scrollLeft }) => [scrollTop, scrollLeft].every(isNumber)
  14388. };
  14389. //#endregion
  14390. //#region ../../packages/components/scrollbar/src/bar.ts
  14391. /**
  14392. * @deprecated Removed after 3.0.0, Use `BarProps` instead.
  14393. */
  14394. const barProps = buildProps({
  14395. always: {
  14396. type: Boolean,
  14397. default: true
  14398. },
  14399. minSize: {
  14400. type: Number,
  14401. required: true
  14402. }
  14403. });
  14404. //#endregion
  14405. //#region ../../packages/components/scrollbar/src/util.ts
  14406. const GAP = 4;
  14407. const BAR_MAP = {
  14408. vertical: {
  14409. offset: "offsetHeight",
  14410. scroll: "scrollTop",
  14411. scrollSize: "scrollHeight",
  14412. size: "height",
  14413. key: "vertical",
  14414. axis: "Y",
  14415. client: "clientY",
  14416. direction: "top"
  14417. },
  14418. horizontal: {
  14419. offset: "offsetWidth",
  14420. scroll: "scrollLeft",
  14421. scrollSize: "scrollWidth",
  14422. size: "width",
  14423. key: "horizontal",
  14424. axis: "X",
  14425. client: "clientX",
  14426. direction: "left"
  14427. }
  14428. };
  14429. const renderThumbStyle = ({ move, size, bar }) => ({
  14430. [bar.size]: size,
  14431. transform: `translate${bar.axis}(${move}%)`
  14432. });
  14433. //#endregion
  14434. //#region ../../packages/components/scrollbar/src/thumb.ts
  14435. /**
  14436. * @deprecated Removed after 3.0.0, Use `ThumbProps` instead.
  14437. */
  14438. const thumbProps = buildProps({
  14439. vertical: Boolean,
  14440. size: String,
  14441. move: Number,
  14442. ratio: {
  14443. type: Number,
  14444. required: true
  14445. },
  14446. always: Boolean
  14447. });
  14448. //#endregion
  14449. //#region ../../packages/components/scrollbar/src/constants.ts
  14450. const scrollbarContextKey = Symbol("scrollbarContextKey");
  14451. //#endregion
  14452. //#region ../../packages/components/scrollbar/src/thumb.vue?vue&type=script&setup=true&lang.ts
  14453. const COMPONENT_NAME$18 = "Thumb";
  14454. var thumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  14455. __name: "thumb",
  14456. props: thumbProps,
  14457. setup(__props) {
  14458. const props = __props;
  14459. const scrollbar = inject(scrollbarContextKey);
  14460. const ns = useNamespace("scrollbar");
  14461. if (!scrollbar) throwError(COMPONENT_NAME$18, "can not inject scrollbar context");
  14462. const instance = ref();
  14463. const thumb = ref();
  14464. const thumbState = ref({});
  14465. const visible = ref(false);
  14466. let cursorDown = false;
  14467. let cursorLeave = false;
  14468. let baseScrollHeight = 0;
  14469. let baseScrollWidth = 0;
  14470. let originalOnSelectStart = isClient ? document.onselectstart : null;
  14471. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  14472. const thumbStyle = computed(() => renderThumbStyle({
  14473. size: props.size,
  14474. move: props.move,
  14475. bar: bar.value
  14476. }));
  14477. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  14478. const clickThumbHandler = (e) => {
  14479. e.stopPropagation();
  14480. if (e.ctrlKey || [1, 2].includes(e.button)) return;
  14481. window.getSelection()?.removeAllRanges();
  14482. startDrag(e);
  14483. const el = e.currentTarget;
  14484. if (!el) return;
  14485. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  14486. };
  14487. const clickTrackHandler = (e) => {
  14488. if (!thumb.value || !instance.value || !scrollbar.wrapElement) return;
  14489. const thumbPositionPercentage = (Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) - thumb.value[bar.value.offset] / 2) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  14490. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  14491. };
  14492. const startDrag = (e) => {
  14493. e.stopImmediatePropagation();
  14494. cursorDown = true;
  14495. baseScrollHeight = scrollbar.wrapElement.scrollHeight;
  14496. baseScrollWidth = scrollbar.wrapElement.scrollWidth;
  14497. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  14498. document.addEventListener("mouseup", mouseUpDocumentHandler);
  14499. originalOnSelectStart = document.onselectstart;
  14500. document.onselectstart = () => false;
  14501. };
  14502. const mouseMoveDocumentHandler = (e) => {
  14503. if (!instance.value || !thumb.value) return;
  14504. if (cursorDown === false) return;
  14505. const prevPage = thumbState.value[bar.value.axis];
  14506. if (!prevPage) return;
  14507. const thumbPositionPercentage = ((instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1 - (thumb.value[bar.value.offset] - prevPage)) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  14508. if (bar.value.scroll === "scrollLeft") scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * baseScrollWidth / 100;
  14509. else scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * baseScrollHeight / 100;
  14510. };
  14511. const mouseUpDocumentHandler = () => {
  14512. cursorDown = false;
  14513. thumbState.value[bar.value.axis] = 0;
  14514. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  14515. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  14516. restoreOnselectstart();
  14517. if (cursorLeave) visible.value = false;
  14518. };
  14519. const mouseMoveScrollbarHandler = () => {
  14520. cursorLeave = false;
  14521. visible.value = !!props.size;
  14522. };
  14523. const mouseLeaveScrollbarHandler = () => {
  14524. cursorLeave = true;
  14525. visible.value = cursorDown;
  14526. };
  14527. onBeforeUnmount(() => {
  14528. restoreOnselectstart();
  14529. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  14530. });
  14531. const restoreOnselectstart = () => {
  14532. if (document.onselectstart !== originalOnSelectStart) document.onselectstart = originalOnSelectStart;
  14533. };
  14534. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  14535. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  14536. return (_ctx, _cache) => {
  14537. return openBlock(), createBlock(Transition, {
  14538. name: unref(ns).b("fade"),
  14539. persisted: ""
  14540. }, {
  14541. default: withCtx(() => [withDirectives(createElementVNode("div", {
  14542. ref_key: "instance",
  14543. ref: instance,
  14544. class: normalizeClass([unref(ns).e("bar"), unref(ns).is(bar.value.key)]),
  14545. onMousedown: clickTrackHandler,
  14546. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  14547. }, [createElementVNode("div", {
  14548. ref_key: "thumb",
  14549. ref: thumb,
  14550. class: normalizeClass(unref(ns).e("thumb")),
  14551. style: normalizeStyle(thumbStyle.value),
  14552. onMousedown: clickThumbHandler
  14553. }, null, 38)], 34), [[vShow, __props.always || visible.value]])]),
  14554. _: 1
  14555. }, 8, ["name"]);
  14556. };
  14557. }
  14558. });
  14559. //#endregion
  14560. //#region ../../packages/components/scrollbar/src/thumb.vue
  14561. var thumb_default = thumb_vue_vue_type_script_setup_true_lang_default;
  14562. //#endregion
  14563. //#region ../../packages/components/scrollbar/src/bar.vue?vue&type=script&setup=true&lang.ts
  14564. var bar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  14565. __name: "bar",
  14566. props: barProps,
  14567. setup(__props, { expose: __expose }) {
  14568. const props = __props;
  14569. const scrollbar = inject(scrollbarContextKey);
  14570. const moveX = ref(0);
  14571. const moveY = ref(0);
  14572. const sizeWidth = ref("");
  14573. const sizeHeight = ref("");
  14574. const ratioY = ref(1);
  14575. const ratioX = ref(1);
  14576. const handleScroll = (wrap) => {
  14577. if (wrap) {
  14578. const offsetHeight = wrap.offsetHeight - GAP;
  14579. const offsetWidth = wrap.offsetWidth - GAP;
  14580. moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
  14581. moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
  14582. }
  14583. };
  14584. const update = () => {
  14585. const wrap = scrollbar?.wrapElement;
  14586. if (!wrap) return;
  14587. const offsetHeight = wrap.offsetHeight - GAP;
  14588. const offsetWidth = wrap.offsetWidth - GAP;
  14589. const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
  14590. const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
  14591. const height = Math.max(originalHeight, props.minSize);
  14592. const width = Math.max(originalWidth, props.minSize);
  14593. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  14594. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  14595. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  14596. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  14597. };
  14598. __expose({
  14599. handleScroll,
  14600. update
  14601. });
  14602. return (_ctx, _cache) => {
  14603. return openBlock(), createElementBlock(Fragment, null, [createVNode(thumb_default, {
  14604. move: moveX.value,
  14605. ratio: ratioX.value,
  14606. size: sizeWidth.value,
  14607. always: __props.always
  14608. }, null, 8, [
  14609. "move",
  14610. "ratio",
  14611. "size",
  14612. "always"
  14613. ]), createVNode(thumb_default, {
  14614. move: moveY.value,
  14615. ratio: ratioY.value,
  14616. size: sizeHeight.value,
  14617. vertical: "",
  14618. always: __props.always
  14619. }, null, 8, [
  14620. "move",
  14621. "ratio",
  14622. "size",
  14623. "always"
  14624. ])], 64);
  14625. };
  14626. }
  14627. });
  14628. //#endregion
  14629. //#region ../../packages/components/scrollbar/src/bar.vue
  14630. var bar_default = bar_vue_vue_type_script_setup_true_lang_default;
  14631. //#endregion
  14632. //#region ../../packages/components/scrollbar/src/scrollbar.vue?vue&type=script&setup=true&lang.ts
  14633. const _hoisted_1$75 = ["tabindex"];
  14634. const COMPONENT_NAME$17 = "ElScrollbar";
  14635. var scrollbar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  14636. name: COMPONENT_NAME$17,
  14637. __name: "scrollbar",
  14638. props: scrollbarProps,
  14639. emits: scrollbarEmits,
  14640. setup(__props, { expose: __expose, emit: __emit }) {
  14641. const props = __props;
  14642. const emit = __emit;
  14643. const ns = useNamespace("scrollbar");
  14644. let stopResizeObserver = void 0;
  14645. let stopWrapResizeObserver = void 0;
  14646. let stopResizeListener = void 0;
  14647. let wrapScrollTop = 0;
  14648. let wrapScrollLeft = 0;
  14649. let direction = "";
  14650. const distanceScrollState = {
  14651. bottom: false,
  14652. top: false,
  14653. right: false,
  14654. left: false
  14655. };
  14656. const scrollbarRef = ref();
  14657. const wrapRef = ref();
  14658. const resizeRef = ref();
  14659. const barRef = ref();
  14660. const wrapStyle = computed(() => {
  14661. const style = {};
  14662. const height = addUnit(props.height);
  14663. const maxHeight = addUnit(props.maxHeight);
  14664. if (height) style.height = height;
  14665. if (maxHeight) style.maxHeight = maxHeight;
  14666. return [props.wrapStyle, style];
  14667. });
  14668. const wrapKls = computed(() => {
  14669. return [
  14670. props.wrapClass,
  14671. ns.e("wrap"),
  14672. { [ns.em("wrap", "hidden-default")]: !props.native }
  14673. ];
  14674. });
  14675. const resizeKls = computed(() => {
  14676. return [ns.e("view"), props.viewClass];
  14677. });
  14678. const shouldSkipDirection = (direction) => {
  14679. return distanceScrollState[direction] ?? false;
  14680. };
  14681. const DIRECTION_PAIRS = {
  14682. top: "bottom",
  14683. bottom: "top",
  14684. left: "right",
  14685. right: "left"
  14686. };
  14687. const updateTriggerStatus = (arrivedStates) => {
  14688. const oppositeDirection = DIRECTION_PAIRS[direction];
  14689. if (!oppositeDirection) return;
  14690. const arrived = arrivedStates[direction];
  14691. const oppositeArrived = arrivedStates[oppositeDirection];
  14692. if (arrived && !distanceScrollState[direction]) distanceScrollState[direction] = true;
  14693. if (!oppositeArrived && distanceScrollState[oppositeDirection]) distanceScrollState[oppositeDirection] = false;
  14694. };
  14695. const handleScroll = () => {
  14696. if (wrapRef.value) {
  14697. barRef.value?.handleScroll(wrapRef.value);
  14698. const prevTop = wrapScrollTop;
  14699. const prevLeft = wrapScrollLeft;
  14700. wrapScrollTop = wrapRef.value.scrollTop;
  14701. wrapScrollLeft = wrapRef.value.scrollLeft;
  14702. const arrivedStates = {
  14703. bottom: wrapScrollTop + wrapRef.value.clientHeight >= wrapRef.value.scrollHeight - props.distance,
  14704. top: wrapScrollTop <= props.distance && prevTop !== 0,
  14705. right: wrapScrollLeft + wrapRef.value.clientWidth >= wrapRef.value.scrollWidth - props.distance && prevLeft !== wrapScrollLeft,
  14706. left: wrapScrollLeft <= props.distance && prevLeft !== 0
  14707. };
  14708. emit("scroll", {
  14709. scrollTop: wrapScrollTop,
  14710. scrollLeft: wrapScrollLeft
  14711. });
  14712. if (prevTop !== wrapScrollTop) direction = wrapScrollTop > prevTop ? "bottom" : "top";
  14713. if (prevLeft !== wrapScrollLeft) direction = wrapScrollLeft > prevLeft ? "right" : "left";
  14714. if (props.distance > 0) {
  14715. if (shouldSkipDirection(direction)) return;
  14716. updateTriggerStatus(arrivedStates);
  14717. }
  14718. if (arrivedStates[direction]) emit("end-reached", direction);
  14719. }
  14720. };
  14721. function scrollTo(arg1, arg2) {
  14722. if (isObject$1(arg1)) wrapRef.value.scrollTo(arg1);
  14723. else if (isNumber(arg1) && isNumber(arg2)) wrapRef.value.scrollTo(arg1, arg2);
  14724. }
  14725. const setScrollTop = (value) => {
  14726. if (!isNumber(value)) {
  14727. /* @__PURE__ */ debugWarn(COMPONENT_NAME$17, "value must be a number");
  14728. return;
  14729. }
  14730. wrapRef.value.scrollTop = value;
  14731. };
  14732. const setScrollLeft = (value) => {
  14733. if (!isNumber(value)) {
  14734. /* @__PURE__ */ debugWarn(COMPONENT_NAME$17, "value must be a number");
  14735. return;
  14736. }
  14737. wrapRef.value.scrollLeft = value;
  14738. };
  14739. const update = () => {
  14740. barRef.value?.update();
  14741. distanceScrollState[direction] = false;
  14742. };
  14743. watch(() => props.noresize, (noresize) => {
  14744. if (noresize) {
  14745. stopResizeObserver?.();
  14746. stopWrapResizeObserver?.();
  14747. stopResizeListener?.();
  14748. } else {
  14749. ({stop: stopResizeObserver} = useResizeObserver(resizeRef, update));
  14750. ({stop: stopWrapResizeObserver} = useResizeObserver(wrapRef, update));
  14751. stopResizeListener = useEventListener("resize", update);
  14752. }
  14753. }, { immediate: true });
  14754. watch(() => [props.maxHeight, props.height], () => {
  14755. if (!props.native) nextTick(() => {
  14756. update();
  14757. if (wrapRef.value) barRef.value?.handleScroll(wrapRef.value);
  14758. });
  14759. });
  14760. provide(scrollbarContextKey, reactive({
  14761. scrollbarElement: scrollbarRef,
  14762. wrapElement: wrapRef
  14763. }));
  14764. onActivated(() => {
  14765. if (wrapRef.value) {
  14766. wrapRef.value.scrollTop = wrapScrollTop;
  14767. wrapRef.value.scrollLeft = wrapScrollLeft;
  14768. }
  14769. });
  14770. onMounted(() => {
  14771. if (!props.native) nextTick(() => {
  14772. update();
  14773. });
  14774. });
  14775. onUpdated(() => update());
  14776. __expose({
  14777. wrapRef,
  14778. update,
  14779. scrollTo,
  14780. setScrollTop,
  14781. setScrollLeft,
  14782. handleScroll
  14783. });
  14784. return (_ctx, _cache) => {
  14785. return openBlock(), createElementBlock("div", {
  14786. ref_key: "scrollbarRef",
  14787. ref: scrollbarRef,
  14788. class: normalizeClass(unref(ns).b())
  14789. }, [createElementVNode("div", {
  14790. ref_key: "wrapRef",
  14791. ref: wrapRef,
  14792. class: normalizeClass(wrapKls.value),
  14793. style: normalizeStyle(wrapStyle.value),
  14794. tabindex: __props.tabindex,
  14795. onScroll: handleScroll
  14796. }, [(openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
  14797. id: __props.id,
  14798. ref_key: "resizeRef",
  14799. ref: resizeRef,
  14800. class: normalizeClass(resizeKls.value),
  14801. style: normalizeStyle(__props.viewStyle),
  14802. role: __props.role,
  14803. "aria-label": __props.ariaLabel,
  14804. "aria-orientation": __props.ariaOrientation
  14805. }, {
  14806. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  14807. _: 3
  14808. }, 8, [
  14809. "id",
  14810. "class",
  14811. "style",
  14812. "role",
  14813. "aria-label",
  14814. "aria-orientation"
  14815. ]))], 46, _hoisted_1$75), !__props.native ? (openBlock(), createBlock(bar_default, {
  14816. key: 0,
  14817. ref_key: "barRef",
  14818. ref: barRef,
  14819. always: __props.always,
  14820. "min-size": __props.minSize
  14821. }, null, 8, ["always", "min-size"])) : createCommentVNode("v-if", true)], 2);
  14822. };
  14823. }
  14824. });
  14825. //#endregion
  14826. //#region ../../packages/components/scrollbar/src/scrollbar.vue
  14827. var scrollbar_default = scrollbar_vue_vue_type_script_setup_true_lang_default;
  14828. //#endregion
  14829. //#region ../../packages/components/scrollbar/index.ts
  14830. const ElScrollbar = withInstall(scrollbar_default);
  14831. //#endregion
  14832. //#region ../../packages/components/autocomplete/src/autocomplete.vue?vue&type=script&setup=true&lang.ts
  14833. const _hoisted_1$74 = ["aria-expanded", "aria-owns"];
  14834. const _hoisted_2$41 = { key: 0 };
  14835. const _hoisted_3$18 = [
  14836. "id",
  14837. "aria-selected",
  14838. "onClick"
  14839. ];
  14840. const COMPONENT_NAME$16 = "ElAutocomplete";
  14841. var autocomplete_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  14842. name: COMPONENT_NAME$16,
  14843. inheritAttrs: false,
  14844. __name: "autocomplete",
  14845. props: autocompleteProps,
  14846. emits: autocompleteEmits,
  14847. setup(__props, { expose: __expose, emit: __emit }) {
  14848. const props = __props;
  14849. const emit = __emit;
  14850. const passInputProps = computed(() => pick(props, Object.keys(inputProps)));
  14851. const rawAttrs = useAttrs$1();
  14852. const disabled = useFormDisabled();
  14853. const ns = useNamespace("autocomplete");
  14854. const inputRef = ref();
  14855. const regionRef = ref();
  14856. const popperRef = ref();
  14857. const listboxRef = ref();
  14858. let readonly = false;
  14859. let ignoreFocusEvent = false;
  14860. const suggestions = ref([]);
  14861. const highlightedIndex = ref(-1);
  14862. const dropdownWidth = ref("");
  14863. const activated = ref(false);
  14864. const suggestionDisabled = ref(false);
  14865. const loading = ref(false);
  14866. const listboxId = useId();
  14867. const styles = computed(() => rawAttrs.style);
  14868. const suggestionVisible = computed(() => {
  14869. return (suggestions.value.length > 0 || loading.value) && activated.value;
  14870. });
  14871. const suggestionLoading = computed(() => !props.hideLoading && loading.value);
  14872. const refInput = computed(() => {
  14873. if (inputRef.value) return Array.from(inputRef.value.$el.querySelectorAll("input"));
  14874. return [];
  14875. });
  14876. const onSuggestionShow = () => {
  14877. if (suggestionVisible.value) dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  14878. };
  14879. const onHide = () => {
  14880. highlightedIndex.value = -1;
  14881. };
  14882. const getData = async (queryString) => {
  14883. if (suggestionDisabled.value) return;
  14884. const cb = (suggestionList) => {
  14885. loading.value = false;
  14886. if (suggestionDisabled.value) return;
  14887. if (isArray$1(suggestionList)) {
  14888. suggestions.value = suggestionList;
  14889. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  14890. } else throwError(COMPONENT_NAME$16, "autocomplete suggestions must be an array");
  14891. };
  14892. loading.value = true;
  14893. if (isArray$1(props.fetchSuggestions)) cb(props.fetchSuggestions);
  14894. else {
  14895. const result = await props.fetchSuggestions(queryString, cb);
  14896. if (isArray$1(result)) cb(result);
  14897. }
  14898. };
  14899. const debouncedGetData = useDebounceFn(getData, computed(() => props.debounce));
  14900. const handleInput = (value) => {
  14901. const valuePresented = !!value;
  14902. emit(INPUT_EVENT, value);
  14903. emit(UPDATE_MODEL_EVENT, value);
  14904. suggestionDisabled.value = false;
  14905. activated.value ||= valuePresented;
  14906. if (!props.triggerOnFocus && !value) {
  14907. suggestionDisabled.value = true;
  14908. suggestions.value = [];
  14909. return;
  14910. }
  14911. debouncedGetData(value);
  14912. };
  14913. const handleMouseDown = (event) => {
  14914. if (disabled.value) return;
  14915. if (event.target?.tagName !== "INPUT" || refInput.value.includes(document.activeElement)) activated.value = true;
  14916. };
  14917. const handleChange = (value) => {
  14918. emit(CHANGE_EVENT, value);
  14919. };
  14920. const handleFocus = (evt) => {
  14921. if (!ignoreFocusEvent) {
  14922. activated.value = true;
  14923. emit("focus", evt);
  14924. const queryString = props.modelValue ?? "";
  14925. if (props.triggerOnFocus && !readonly) debouncedGetData(String(queryString));
  14926. } else ignoreFocusEvent = false;
  14927. };
  14928. const handleBlur = (evt) => {
  14929. setTimeout(() => {
  14930. if (popperRef.value?.isFocusInsideContent()) {
  14931. ignoreFocusEvent = true;
  14932. return;
  14933. }
  14934. activated.value && close();
  14935. emit("blur", evt);
  14936. });
  14937. };
  14938. const handleClear = () => {
  14939. activated.value = false;
  14940. emit(UPDATE_MODEL_EVENT, "");
  14941. emit("clear");
  14942. };
  14943. const handleKeyEnter = async () => {
  14944. if (inputRef.value?.isComposing) return;
  14945. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) handleSelect(suggestions.value[highlightedIndex.value]);
  14946. else {
  14947. if (props.selectWhenUnmatched) {
  14948. emit("select", { value: props.modelValue });
  14949. suggestions.value = [];
  14950. highlightedIndex.value = -1;
  14951. }
  14952. activated.value = true;
  14953. debouncedGetData(String(props.modelValue));
  14954. }
  14955. };
  14956. const handleKeyEscape = (evt) => {
  14957. if (suggestionVisible.value) {
  14958. evt.preventDefault();
  14959. evt.stopPropagation();
  14960. close();
  14961. }
  14962. };
  14963. const close = () => {
  14964. activated.value = false;
  14965. };
  14966. const focus = () => {
  14967. inputRef.value?.focus();
  14968. };
  14969. const blur = () => {
  14970. inputRef.value?.blur();
  14971. };
  14972. const handleSelect = async (item) => {
  14973. emit(INPUT_EVENT, item[props.valueKey]);
  14974. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  14975. emit("select", item);
  14976. suggestions.value = [];
  14977. highlightedIndex.value = -1;
  14978. };
  14979. const highlight = (index) => {
  14980. if (!suggestionVisible.value || loading.value) return;
  14981. if (index < 0) {
  14982. if (!props.loopNavigation) {
  14983. highlightedIndex.value = -1;
  14984. return;
  14985. }
  14986. index = suggestions.value.length - 1;
  14987. }
  14988. if (index >= suggestions.value.length) index = props.loopNavigation ? 0 : suggestions.value.length - 1;
  14989. const [suggestion, suggestionList] = getSuggestionContext();
  14990. const highlightItem = suggestionList[index];
  14991. const scrollTop = suggestion.scrollTop;
  14992. const { offsetTop, scrollHeight } = highlightItem;
  14993. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) suggestion.scrollTop = offsetTop + scrollHeight - suggestion.clientHeight;
  14994. if (offsetTop < scrollTop) suggestion.scrollTop = offsetTop;
  14995. highlightedIndex.value = index;
  14996. inputRef.value?.ref?.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  14997. };
  14998. const getSuggestionContext = () => {
  14999. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  15000. return [suggestion, suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`)];
  15001. };
  15002. const stopHandle = onClickOutside(listboxRef, (event) => {
  15003. if (popperRef.value?.isFocusInsideContent()) return;
  15004. const hadIgnoredFocus = ignoreFocusEvent;
  15005. ignoreFocusEvent = false;
  15006. if (!suggestionVisible.value) return;
  15007. if (hadIgnoredFocus) handleBlur(new FocusEvent("blur", event));
  15008. else close();
  15009. });
  15010. const handleKeydown = (e) => {
  15011. switch (getEventCode(e)) {
  15012. case EVENT_CODE.up:
  15013. e.preventDefault();
  15014. highlight(highlightedIndex.value - 1);
  15015. break;
  15016. case EVENT_CODE.down:
  15017. e.preventDefault();
  15018. highlight(highlightedIndex.value + 1);
  15019. break;
  15020. case EVENT_CODE.enter:
  15021. case EVENT_CODE.numpadEnter:
  15022. e.preventDefault();
  15023. handleKeyEnter();
  15024. break;
  15025. case EVENT_CODE.tab:
  15026. close();
  15027. break;
  15028. case EVENT_CODE.esc:
  15029. handleKeyEscape(e);
  15030. break;
  15031. case EVENT_CODE.home:
  15032. e.preventDefault();
  15033. highlight(0);
  15034. break;
  15035. case EVENT_CODE.end:
  15036. e.preventDefault();
  15037. highlight(suggestions.value.length - 1);
  15038. break;
  15039. case EVENT_CODE.pageUp:
  15040. e.preventDefault();
  15041. highlight(Math.max(0, highlightedIndex.value - 10));
  15042. break;
  15043. case EVENT_CODE.pageDown:
  15044. e.preventDefault();
  15045. highlight(Math.min(suggestions.value.length - 1, highlightedIndex.value + 10));
  15046. break;
  15047. }
  15048. };
  15049. onBeforeUnmount(() => {
  15050. stopHandle?.();
  15051. });
  15052. onMounted(() => {
  15053. const inputElement = inputRef.value?.ref;
  15054. if (!inputElement) return;
  15055. [
  15056. {
  15057. key: "role",
  15058. value: "textbox"
  15059. },
  15060. {
  15061. key: "aria-autocomplete",
  15062. value: "list"
  15063. },
  15064. {
  15065. key: "aria-controls",
  15066. value: listboxId.value
  15067. },
  15068. {
  15069. key: "aria-activedescendant",
  15070. value: `${listboxId.value}-item-${highlightedIndex.value}`
  15071. }
  15072. ].forEach(({ key, value }) => inputElement.setAttribute(key, value));
  15073. readonly = inputElement.hasAttribute("readonly");
  15074. });
  15075. __expose({
  15076. highlightedIndex,
  15077. activated,
  15078. loading,
  15079. inputRef,
  15080. popperRef,
  15081. suggestions,
  15082. handleSelect,
  15083. handleKeyEnter,
  15084. focus,
  15085. blur,
  15086. close,
  15087. highlight,
  15088. getData
  15089. });
  15090. return (_ctx, _cache) => {
  15091. return openBlock(), createBlock(unref(ElTooltip), {
  15092. ref_key: "popperRef",
  15093. ref: popperRef,
  15094. visible: suggestionVisible.value,
  15095. placement: __props.placement,
  15096. "fallback-placements": ["bottom-start", "top-start"],
  15097. "popper-class": [unref(ns).e("popper"), __props.popperClass],
  15098. "popper-style": __props.popperStyle,
  15099. teleported: __props.teleported,
  15100. "append-to": __props.appendTo,
  15101. "gpu-acceleration": false,
  15102. pure: "",
  15103. "manual-mode": "",
  15104. effect: "light",
  15105. trigger: "click",
  15106. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  15107. persistent: "",
  15108. role: "listbox",
  15109. onBeforeShow: onSuggestionShow,
  15110. onHide
  15111. }, {
  15112. content: withCtx(() => [createElementVNode("div", {
  15113. ref_key: "regionRef",
  15114. ref: regionRef,
  15115. class: normalizeClass([unref(ns).b("suggestion"), unref(ns).is("loading", suggestionLoading.value)]),
  15116. style: normalizeStyle({
  15117. [__props.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  15118. outline: "none"
  15119. }),
  15120. role: "region"
  15121. }, [
  15122. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  15123. key: 0,
  15124. class: normalizeClass(unref(ns).be("suggestion", "header")),
  15125. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  15126. }, [renderSlot(_ctx.$slots, "header")], 2)) : createCommentVNode("v-if", true),
  15127. createVNode(unref(ElScrollbar), {
  15128. id: unref(listboxId),
  15129. tag: "ul",
  15130. "wrap-class": unref(ns).be("suggestion", "wrap"),
  15131. "view-class": unref(ns).be("suggestion", "list"),
  15132. role: "listbox"
  15133. }, {
  15134. default: withCtx(() => [suggestionLoading.value ? (openBlock(), createElementBlock("li", _hoisted_2$41, [renderSlot(_ctx.$slots, "loading", {}, () => [createVNode(unref(ElIcon), { class: normalizeClass(unref(ns).is("loading")) }, {
  15135. default: withCtx(() => [createVNode(unref(loading_default))]),
  15136. _: 1
  15137. }, 8, ["class"])])])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(suggestions.value, (item, index) => {
  15138. return openBlock(), createElementBlock("li", {
  15139. id: `${unref(listboxId)}-item-${index}`,
  15140. key: index,
  15141. class: normalizeClass({ highlighted: highlightedIndex.value === index }),
  15142. role: "option",
  15143. "aria-selected": highlightedIndex.value === index,
  15144. onClick: ($event) => handleSelect(item)
  15145. }, [renderSlot(_ctx.$slots, "default", { item }, () => [createTextVNode(toDisplayString(item[__props.valueKey]), 1)])], 10, _hoisted_3$18);
  15146. }), 128))]),
  15147. _: 3
  15148. }, 8, [
  15149. "id",
  15150. "wrap-class",
  15151. "view-class"
  15152. ]),
  15153. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  15154. key: 1,
  15155. class: normalizeClass(unref(ns).be("suggestion", "footer")),
  15156. onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
  15157. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  15158. ], 6)]),
  15159. default: withCtx(() => [createElementVNode("div", {
  15160. ref_key: "listboxRef",
  15161. ref: listboxRef,
  15162. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  15163. style: normalizeStyle(styles.value),
  15164. role: "combobox",
  15165. "aria-haspopup": "listbox",
  15166. "aria-expanded": suggestionVisible.value,
  15167. "aria-owns": unref(listboxId)
  15168. }, [createVNode(unref(ElInput), mergeProps({
  15169. ref_key: "inputRef",
  15170. ref: inputRef
  15171. }, mergeProps(passInputProps.value, _ctx.$attrs), {
  15172. "model-value": __props.modelValue,
  15173. disabled: unref(disabled),
  15174. onInput: handleInput,
  15175. onChange: handleChange,
  15176. onFocus: handleFocus,
  15177. onBlur: handleBlur,
  15178. onClear: handleClear,
  15179. onKeydown: handleKeydown,
  15180. onMousedown: handleMouseDown
  15181. }), createSlots({ _: 2 }, [
  15182. _ctx.$slots.prepend ? {
  15183. name: "prepend",
  15184. fn: withCtx(() => [renderSlot(_ctx.$slots, "prepend")]),
  15185. key: "0"
  15186. } : void 0,
  15187. _ctx.$slots.append ? {
  15188. name: "append",
  15189. fn: withCtx(() => [renderSlot(_ctx.$slots, "append")]),
  15190. key: "1"
  15191. } : void 0,
  15192. _ctx.$slots.prefix ? {
  15193. name: "prefix",
  15194. fn: withCtx(() => [renderSlot(_ctx.$slots, "prefix")]),
  15195. key: "2"
  15196. } : void 0,
  15197. _ctx.$slots.suffix ? {
  15198. name: "suffix",
  15199. fn: withCtx(() => [renderSlot(_ctx.$slots, "suffix")]),
  15200. key: "3"
  15201. } : void 0
  15202. ]), 1040, ["model-value", "disabled"])], 14, _hoisted_1$74)]),
  15203. _: 3
  15204. }, 8, [
  15205. "visible",
  15206. "placement",
  15207. "popper-class",
  15208. "popper-style",
  15209. "teleported",
  15210. "append-to",
  15211. "transition"
  15212. ]);
  15213. };
  15214. }
  15215. });
  15216. //#endregion
  15217. //#region ../../packages/components/autocomplete/src/autocomplete.vue
  15218. var autocomplete_default = autocomplete_vue_vue_type_script_setup_true_lang_default;
  15219. //#endregion
  15220. //#region ../../packages/components/autocomplete/index.ts
  15221. const ElAutocomplete = withInstall(autocomplete_default);
  15222. //#endregion
  15223. //#region ../../packages/components/avatar/src/avatar.ts
  15224. /**
  15225. * @deprecated Removed after 3.0.0, Use `AvatarProps` instead.
  15226. */
  15227. const avatarProps = buildProps({
  15228. size: {
  15229. type: [Number, String],
  15230. values: componentSizes,
  15231. validator: (val) => isNumber(val)
  15232. },
  15233. shape: {
  15234. type: String,
  15235. values: ["circle", "square"]
  15236. },
  15237. icon: { type: iconPropType },
  15238. src: {
  15239. type: String,
  15240. default: ""
  15241. },
  15242. alt: String,
  15243. srcSet: String,
  15244. fit: {
  15245. type: definePropType(String),
  15246. default: "cover"
  15247. }
  15248. });
  15249. const avatarEmits = { error: (evt) => evt instanceof Event };
  15250. //#endregion
  15251. //#region ../../packages/components/avatar/src/constants.ts
  15252. const avatarGroupContextKey = Symbol("avatarGroupContextKey");
  15253. //#endregion
  15254. //#region ../../packages/components/avatar/src/avatar.vue?vue&type=script&setup=true&lang.ts
  15255. const _hoisted_1$73 = [
  15256. "src",
  15257. "alt",
  15258. "srcset"
  15259. ];
  15260. var avatar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  15261. name: "ElAvatar",
  15262. __name: "avatar",
  15263. props: avatarProps,
  15264. emits: avatarEmits,
  15265. setup(__props, { emit: __emit }) {
  15266. const props = __props;
  15267. const emit = __emit;
  15268. const avatarGroupContext = inject(avatarGroupContextKey, void 0);
  15269. const ns = useNamespace("avatar");
  15270. const hasLoadError = ref(false);
  15271. const size = computed(() => props.size ?? avatarGroupContext?.size);
  15272. const shape = computed(() => props.shape ?? avatarGroupContext?.shape ?? "circle");
  15273. const avatarClass = computed(() => {
  15274. const { icon } = props;
  15275. const classList = [ns.b()];
  15276. if (isString(size.value)) classList.push(ns.m(size.value));
  15277. if (icon) classList.push(ns.m("icon"));
  15278. if (shape.value) classList.push(ns.m(shape.value));
  15279. return classList;
  15280. });
  15281. const sizeStyle = computed(() => {
  15282. return isNumber(size.value) ? ns.cssVarBlock({ size: addUnit(size.value) }) : void 0;
  15283. });
  15284. const fitStyle = computed(() => ({ objectFit: props.fit }));
  15285. watch(() => [props.src, props.srcSet], () => hasLoadError.value = false);
  15286. function handleError(e) {
  15287. hasLoadError.value = true;
  15288. emit("error", e);
  15289. }
  15290. return (_ctx, _cache) => {
  15291. return openBlock(), createElementBlock("span", {
  15292. class: normalizeClass(avatarClass.value),
  15293. style: normalizeStyle(sizeStyle.value)
  15294. }, [(__props.src || __props.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
  15295. key: 0,
  15296. src: __props.src,
  15297. alt: __props.alt,
  15298. srcset: __props.srcSet,
  15299. style: normalizeStyle(fitStyle.value),
  15300. onError: handleError
  15301. }, null, 44, _hoisted_1$73)) : __props.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  15302. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  15303. _: 1
  15304. })) : renderSlot(_ctx.$slots, "default", { key: 2 })], 6);
  15305. };
  15306. }
  15307. });
  15308. //#endregion
  15309. //#region ../../packages/components/avatar/src/avatar.vue
  15310. var avatar_default = avatar_vue_vue_type_script_setup_true_lang_default;
  15311. //#endregion
  15312. //#region ../../packages/components/avatar/src/avatar-group-props.ts
  15313. const avatarGroupProps = {
  15314. size: {
  15315. type: definePropType([Number, String]),
  15316. values: componentSizes,
  15317. validator: (val) => isNumber(val)
  15318. },
  15319. shape: {
  15320. type: definePropType(String),
  15321. values: ["circle", "square"]
  15322. },
  15323. collapseAvatars: Boolean,
  15324. collapseAvatarsTooltip: Boolean,
  15325. maxCollapseAvatars: {
  15326. type: Number,
  15327. default: 1
  15328. },
  15329. effect: {
  15330. type: definePropType(String),
  15331. default: "light"
  15332. },
  15333. placement: {
  15334. type: definePropType(String),
  15335. values: Ee,
  15336. default: "top"
  15337. },
  15338. popperClass: useTooltipContentProps.popperClass,
  15339. popperStyle: useTooltipContentProps.popperStyle,
  15340. collapseClass: String,
  15341. collapseStyle: { type: definePropType([
  15342. String,
  15343. Array,
  15344. Object
  15345. ]) }
  15346. };
  15347. //#endregion
  15348. //#region ../../packages/components/avatar/src/avatar-group.tsx
  15349. var avatar_group_default = /* @__PURE__ */ defineComponent({
  15350. name: "ElAvatarGroup",
  15351. props: avatarGroupProps,
  15352. setup(props, { slots }) {
  15353. const ns = useNamespace("avatar-group");
  15354. provide(avatarGroupContextKey, reactive({
  15355. size: toRef(props, "size"),
  15356. shape: toRef(props, "shape")
  15357. }));
  15358. return () => {
  15359. const avatars = flattedChildren(slots.default?.() ?? []);
  15360. let visibleAvatars = avatars;
  15361. if (props.collapseAvatars && avatars.length > props.maxCollapseAvatars) {
  15362. visibleAvatars = avatars.slice(0, props.maxCollapseAvatars);
  15363. const hiddenAvatars = avatars.slice(props.maxCollapseAvatars);
  15364. visibleAvatars.push(createVNode(ElTooltip, {
  15365. "popperClass": props.popperClass,
  15366. "popperStyle": props.popperStyle,
  15367. "placement": props.placement,
  15368. "effect": props.effect,
  15369. "disabled": !props.collapseAvatarsTooltip
  15370. }, {
  15371. default: () => createVNode(avatar_default, {
  15372. "size": props.size,
  15373. "shape": props.shape,
  15374. "class": props.collapseClass,
  15375. "style": props.collapseStyle
  15376. }, { default: () => [createTextVNode("+ "), hiddenAvatars.length] }),
  15377. content: () => createVNode("div", { "class": ns.e("collapse-avatars") }, [hiddenAvatars.map((node, idx) => isVNode(node) ? cloneVNode(node, { key: node.key ?? idx }) : node)])
  15378. }));
  15379. }
  15380. return createVNode("div", { "class": ns.b() }, [visibleAvatars]);
  15381. };
  15382. }
  15383. });
  15384. //#endregion
  15385. //#region ../../packages/components/avatar/index.ts
  15386. const ElAvatar = withInstall(avatar_default, { AvatarGroup: avatar_group_default });
  15387. const ElAvatarGroup = withNoopInstall(avatar_group_default);
  15388. //#endregion
  15389. //#region ../../packages/components/backtop/src/backtop.ts
  15390. /**
  15391. * @deprecated Removed after 3.0.0, Use `BacktopProps` instead.
  15392. */
  15393. const backtopProps = {
  15394. visibilityHeight: {
  15395. type: Number,
  15396. default: 200
  15397. },
  15398. target: {
  15399. type: String,
  15400. default: ""
  15401. },
  15402. right: {
  15403. type: Number,
  15404. default: 40
  15405. },
  15406. bottom: {
  15407. type: Number,
  15408. default: 40
  15409. }
  15410. };
  15411. const backtopEmits = { click: (evt) => evt instanceof MouseEvent };
  15412. //#endregion
  15413. //#region ../../packages/components/backtop/src/use-backtop.ts
  15414. const useBackTop = (props, emit, componentName) => {
  15415. const el = shallowRef();
  15416. const container = shallowRef();
  15417. const visible = ref(false);
  15418. const handleScroll = () => {
  15419. if (el.value) visible.value = el.value.scrollTop >= props.visibilityHeight;
  15420. };
  15421. const handleClick = (event) => {
  15422. el.value?.scrollTo({
  15423. top: 0,
  15424. behavior: "smooth"
  15425. });
  15426. emit("click", event);
  15427. };
  15428. useEventListener(container, "scroll", useThrottleFn(handleScroll, 300, true));
  15429. onMounted(() => {
  15430. container.value = document;
  15431. el.value = document.documentElement;
  15432. if (props.target) {
  15433. el.value = document.querySelector(props.target) ?? void 0;
  15434. if (!el.value) throwError(componentName, `target does not exist: ${props.target}`);
  15435. container.value = el.value;
  15436. }
  15437. handleScroll();
  15438. });
  15439. return {
  15440. visible,
  15441. handleClick
  15442. };
  15443. };
  15444. //#endregion
  15445. //#region ../../packages/components/backtop/src/backtop.vue?vue&type=script&setup=true&lang.ts
  15446. const COMPONENT_NAME$15 = "ElBacktop";
  15447. var backtop_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  15448. name: COMPONENT_NAME$15,
  15449. __name: "backtop",
  15450. props: backtopProps,
  15451. emits: backtopEmits,
  15452. setup(__props, { emit: __emit }) {
  15453. const props = __props;
  15454. const emit = __emit;
  15455. const ns = useNamespace("backtop");
  15456. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$15);
  15457. const backTopStyle = computed(() => ({
  15458. right: `${props.right}px`,
  15459. bottom: `${props.bottom}px`
  15460. }));
  15461. return (_ctx, _cache) => {
  15462. return openBlock(), createBlock(Transition, { name: `${unref(ns).namespace.value}-fade-in` }, {
  15463. default: withCtx(() => [unref(visible) ? (openBlock(), createElementBlock("div", {
  15464. key: 0,
  15465. style: normalizeStyle(backTopStyle.value),
  15466. class: normalizeClass(unref(ns).b()),
  15467. onClick: _cache[0] || (_cache[0] = withModifiers((...args) => unref(handleClick) && unref(handleClick)(...args), ["stop"]))
  15468. }, [renderSlot(_ctx.$slots, "default", {}, () => [createVNode(unref(ElIcon), { class: normalizeClass(unref(ns).e("icon")) }, {
  15469. default: withCtx(() => [createVNode(unref(caret_top_default))]),
  15470. _: 1
  15471. }, 8, ["class"])])], 6)) : createCommentVNode("v-if", true)]),
  15472. _: 3
  15473. }, 8, ["name"]);
  15474. };
  15475. }
  15476. });
  15477. //#endregion
  15478. //#region ../../packages/components/backtop/src/backtop.vue
  15479. var backtop_default = backtop_vue_vue_type_script_setup_true_lang_default;
  15480. //#endregion
  15481. //#region ../../packages/components/backtop/index.ts
  15482. const ElBacktop = withInstall(backtop_default);
  15483. //#endregion
  15484. //#region ../../packages/components/badge/src/badge.ts
  15485. /**
  15486. * @deprecated Removed after 3.0.0, Use `BadgeProps` instead.
  15487. */
  15488. const badgeProps = buildProps({
  15489. value: {
  15490. type: [String, Number],
  15491. default: ""
  15492. },
  15493. max: {
  15494. type: Number,
  15495. default: 99
  15496. },
  15497. isDot: Boolean,
  15498. hidden: Boolean,
  15499. type: {
  15500. type: String,
  15501. values: [
  15502. "primary",
  15503. "success",
  15504. "warning",
  15505. "info",
  15506. "danger"
  15507. ],
  15508. default: "danger"
  15509. },
  15510. showZero: {
  15511. type: Boolean,
  15512. default: true
  15513. },
  15514. color: String,
  15515. badgeStyle: { type: definePropType([
  15516. String,
  15517. Object,
  15518. Array
  15519. ]) },
  15520. offset: {
  15521. type: definePropType(Array),
  15522. default: () => [0, 0]
  15523. },
  15524. badgeClass: { type: String }
  15525. });
  15526. //#endregion
  15527. //#region ../../packages/components/badge/src/badge.vue?vue&type=script&setup=true&lang.ts
  15528. var badge_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  15529. name: "ElBadge",
  15530. __name: "badge",
  15531. props: badgeProps,
  15532. setup(__props, { expose: __expose }) {
  15533. const props = __props;
  15534. const ns = useNamespace("badge");
  15535. const content = computed(() => {
  15536. if (props.isDot) return "";
  15537. if (isNumber(props.value) && isNumber(props.max)) return props.max < props.value ? `${props.max}+` : `${props.value}`;
  15538. return `${props.value}`;
  15539. });
  15540. const style = computed(() => {
  15541. return [{
  15542. backgroundColor: props.color,
  15543. marginRight: addUnit(-props.offset[0]),
  15544. marginTop: addUnit(props.offset[1])
  15545. }, props.badgeStyle ?? {}];
  15546. });
  15547. __expose({ content });
  15548. return (_ctx, _cache) => {
  15549. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [renderSlot(_ctx.$slots, "default"), createVNode(Transition, { name: `${unref(ns).namespace.value}-zoom-in-center` }, {
  15550. default: withCtx(() => [!__props.hidden && (content.value || __props.isDot || _ctx.$slots.content) ? (openBlock(), createElementBlock("sup", {
  15551. key: 0,
  15552. class: normalizeClass([
  15553. unref(ns).e("content"),
  15554. unref(ns).em("content", __props.type),
  15555. unref(ns).is("fixed", !!_ctx.$slots.default),
  15556. unref(ns).is("dot", __props.isDot),
  15557. unref(ns).is("hide-zero", !__props.showZero && __props.value === 0),
  15558. __props.badgeClass
  15559. ]),
  15560. style: normalizeStyle(style.value)
  15561. }, [renderSlot(_ctx.$slots, "content", { value: content.value }, () => [createTextVNode(toDisplayString(content.value), 1)])], 6)) : createCommentVNode("v-if", true)]),
  15562. _: 3
  15563. }, 8, ["name"])], 2);
  15564. };
  15565. }
  15566. });
  15567. //#endregion
  15568. //#region ../../packages/components/badge/src/badge.vue
  15569. var badge_default = badge_vue_vue_type_script_setup_true_lang_default;
  15570. //#endregion
  15571. //#region ../../packages/components/badge/index.ts
  15572. const ElBadge = withInstall(badge_default);
  15573. //#endregion
  15574. //#region ../../packages/components/breadcrumb/src/breadcrumb.ts
  15575. /**
  15576. * @deprecated Removed after 3.0.0, Use `BreadcrumbProps` instead.
  15577. */
  15578. const breadcrumbProps = buildProps({
  15579. separator: {
  15580. type: String,
  15581. default: "/"
  15582. },
  15583. separatorIcon: { type: iconPropType }
  15584. });
  15585. //#endregion
  15586. //#region ../../packages/components/breadcrumb/src/constants.ts
  15587. const breadcrumbKey = Symbol("breadcrumbKey");
  15588. //#endregion
  15589. //#region ../../packages/components/breadcrumb/src/breadcrumb.vue?vue&type=script&setup=true&lang.ts
  15590. const _hoisted_1$72 = ["aria-label"];
  15591. var breadcrumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  15592. name: "ElBreadcrumb",
  15593. __name: "breadcrumb",
  15594. props: breadcrumbProps,
  15595. setup(__props) {
  15596. const { t } = useLocale();
  15597. const props = __props;
  15598. const ns = useNamespace("breadcrumb");
  15599. const breadcrumb = ref();
  15600. provide(breadcrumbKey, props);
  15601. onMounted(() => {
  15602. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  15603. if (items.length) items[items.length - 1].setAttribute("aria-current", "page");
  15604. });
  15605. return (_ctx, _cache) => {
  15606. return openBlock(), createElementBlock("div", {
  15607. ref_key: "breadcrumb",
  15608. ref: breadcrumb,
  15609. class: normalizeClass(unref(ns).b()),
  15610. "aria-label": unref(t)("el.breadcrumb.label"),
  15611. role: "navigation"
  15612. }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$72);
  15613. };
  15614. }
  15615. });
  15616. //#endregion
  15617. //#region ../../packages/components/breadcrumb/src/breadcrumb.vue
  15618. var breadcrumb_default = breadcrumb_vue_vue_type_script_setup_true_lang_default;
  15619. //#endregion
  15620. //#region ../../packages/components/breadcrumb/src/breadcrumb-item.ts
  15621. /**
  15622. * @deprecated Removed after 3.0.0, Use `BreadcrumbItemProps` instead.
  15623. */
  15624. const breadcrumbItemProps = buildProps({
  15625. to: {
  15626. type: definePropType([String, Object]),
  15627. default: ""
  15628. },
  15629. replace: Boolean
  15630. });
  15631. //#endregion
  15632. //#region ../../packages/components/breadcrumb/src/breadcrumb-item.vue?vue&type=script&setup=true&lang.ts
  15633. var breadcrumb_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  15634. name: "ElBreadcrumbItem",
  15635. __name: "breadcrumb-item",
  15636. props: breadcrumbItemProps,
  15637. setup(__props) {
  15638. const props = __props;
  15639. const instance = getCurrentInstance();
  15640. const breadcrumbContext = inject(breadcrumbKey, void 0);
  15641. const ns = useNamespace("breadcrumb");
  15642. const router = instance.appContext.config.globalProperties.$router;
  15643. const onClick = () => {
  15644. if (!props.to || !router) return;
  15645. props.replace ? router.replace(props.to) : router.push(props.to);
  15646. };
  15647. return (_ctx, _cache) => {
  15648. return openBlock(), createElementBlock("span", { class: normalizeClass(unref(ns).e("item")) }, [createElementVNode("span", {
  15649. class: normalizeClass([unref(ns).e("inner"), unref(ns).is("link", !!__props.to)]),
  15650. role: "link",
  15651. onClick
  15652. }, [renderSlot(_ctx.$slots, "default")], 2), unref(breadcrumbContext)?.separatorIcon ? (openBlock(), createBlock(unref(ElIcon), {
  15653. key: 0,
  15654. class: normalizeClass(unref(ns).e("separator"))
  15655. }, {
  15656. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(unref(breadcrumbContext).separatorIcon)))]),
  15657. _: 1
  15658. }, 8, ["class"])) : (openBlock(), createElementBlock("span", {
  15659. key: 1,
  15660. class: normalizeClass(unref(ns).e("separator")),
  15661. role: "presentation"
  15662. }, toDisplayString(unref(breadcrumbContext)?.separator), 3))], 2);
  15663. };
  15664. }
  15665. });
  15666. //#endregion
  15667. //#region ../../packages/components/breadcrumb/src/breadcrumb-item.vue
  15668. var breadcrumb_item_default = breadcrumb_item_vue_vue_type_script_setup_true_lang_default;
  15669. //#endregion
  15670. //#region ../../packages/components/breadcrumb/index.ts
  15671. const ElBreadcrumb = withInstall(breadcrumb_default, { BreadcrumbItem: breadcrumb_item_default });
  15672. const ElBreadcrumbItem = withNoopInstall(breadcrumb_item_default);
  15673. //#endregion
  15674. //#region ../../packages/components/button/src/button.ts
  15675. const buttonTypes = [
  15676. "default",
  15677. "primary",
  15678. "success",
  15679. "warning",
  15680. "info",
  15681. "danger",
  15682. "text",
  15683. ""
  15684. ];
  15685. const buttonNativeTypes = [
  15686. "button",
  15687. "submit",
  15688. "reset"
  15689. ];
  15690. /**
  15691. * @deprecated Removed after 3.0.0, Use `ButtonProps` instead.
  15692. */
  15693. const buttonProps = buildProps({
  15694. size: useSizeProp,
  15695. disabled: {
  15696. type: Boolean,
  15697. default: void 0
  15698. },
  15699. type: {
  15700. type: String,
  15701. values: buttonTypes,
  15702. default: ""
  15703. },
  15704. icon: { type: iconPropType },
  15705. nativeType: {
  15706. type: String,
  15707. values: buttonNativeTypes,
  15708. default: "button"
  15709. },
  15710. loading: Boolean,
  15711. loadingIcon: {
  15712. type: iconPropType,
  15713. default: () => loading_default
  15714. },
  15715. plain: {
  15716. type: Boolean,
  15717. default: void 0
  15718. },
  15719. text: {
  15720. type: Boolean,
  15721. default: void 0
  15722. },
  15723. link: Boolean,
  15724. bg: Boolean,
  15725. autofocus: Boolean,
  15726. round: {
  15727. type: Boolean,
  15728. default: void 0
  15729. },
  15730. circle: Boolean,
  15731. dashed: {
  15732. type: Boolean,
  15733. default: void 0
  15734. },
  15735. color: String,
  15736. dark: Boolean,
  15737. autoInsertSpace: {
  15738. type: Boolean,
  15739. default: void 0
  15740. },
  15741. tag: {
  15742. type: definePropType([String, Object]),
  15743. default: "button"
  15744. }
  15745. });
  15746. const buttonEmits = { click: (evt) => evt instanceof MouseEvent };
  15747. //#endregion
  15748. //#region ../../packages/components/button/src/constants.ts
  15749. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  15750. //#endregion
  15751. //#region ../../packages/components/button/src/use-button.ts
  15752. const useButton = (props, emit) => {
  15753. useDeprecated({
  15754. from: "type.text",
  15755. replacement: "link",
  15756. version: "3.0.0",
  15757. scope: "props",
  15758. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  15759. }, computed(() => props.type === "text"));
  15760. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  15761. const globalConfig = useGlobalConfig("button");
  15762. const { form } = useFormItem();
  15763. const _size = useFormSize(computed(() => buttonGroupContext?.size));
  15764. const _disabled = useFormDisabled();
  15765. const _ref = ref();
  15766. const slots = useSlots();
  15767. const _type = computed(() => props.type || buttonGroupContext?.type || globalConfig.value?.type || "");
  15768. const autoInsertSpace = computed(() => props.autoInsertSpace ?? globalConfig.value?.autoInsertSpace ?? false);
  15769. const _plain = computed(() => props.plain ?? globalConfig.value?.plain ?? false);
  15770. const _round = computed(() => props.round ?? globalConfig.value?.round ?? false);
  15771. const _text = computed(() => props.text ?? globalConfig.value?.text ?? false);
  15772. const _dashed = computed(() => props.dashed ?? globalConfig.value?.dashed ?? false);
  15773. const _props = computed(() => {
  15774. if (props.tag === "button") return {
  15775. ariaDisabled: _disabled.value || props.loading,
  15776. disabled: _disabled.value || props.loading,
  15777. autofocus: props.autofocus,
  15778. type: props.nativeType
  15779. };
  15780. return {};
  15781. });
  15782. const shouldAddSpace = computed(() => {
  15783. const defaultSlot = slots.default?.();
  15784. if (autoInsertSpace.value && defaultSlot?.length === 1) {
  15785. const slot = defaultSlot[0];
  15786. if (slot?.type === Text) {
  15787. const text = slot.children;
  15788. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  15789. }
  15790. }
  15791. return false;
  15792. });
  15793. const handleClick = (evt) => {
  15794. if (_disabled.value || props.loading) {
  15795. evt.stopPropagation();
  15796. return;
  15797. }
  15798. if (props.nativeType === "reset") form?.resetFields();
  15799. emit("click", evt);
  15800. };
  15801. return {
  15802. _disabled,
  15803. _size,
  15804. _type,
  15805. _ref,
  15806. _props,
  15807. _plain,
  15808. _round,
  15809. _text,
  15810. _dashed,
  15811. shouldAddSpace,
  15812. handleClick
  15813. };
  15814. };
  15815. //#endregion
  15816. //#region ../../node_modules/.pnpm/@ctrl+tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/util.js
  15817. /**
  15818. * Take input from [0, n] and return it as [0, 1]
  15819. * @hidden
  15820. */
  15821. function bound01(n, max) {
  15822. if (isOnePointZero(n)) n = "100%";
  15823. const isPercent = isPercentage(n);
  15824. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  15825. if (isPercent) n = parseInt(String(n * max), 10) / 100;
  15826. if (Math.abs(n - max) < 1e-6) return 1;
  15827. if (max === 360) n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  15828. else n = n % max / parseFloat(String(max));
  15829. return n;
  15830. }
  15831. /**
  15832. * Force a number between 0 and 1
  15833. * @hidden
  15834. */
  15835. function clamp01(val) {
  15836. return Math.min(1, Math.max(0, val));
  15837. }
  15838. /**
  15839. * Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
  15840. * <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
  15841. * @hidden
  15842. */
  15843. function isOnePointZero(n) {
  15844. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  15845. }
  15846. /**
  15847. * Check to see if string passed in is a percentage
  15848. * @hidden
  15849. */
  15850. function isPercentage(n) {
  15851. return typeof n === "string" && n.indexOf("%") !== -1;
  15852. }
  15853. /**
  15854. * Return a valid alpha value [0,1] with all invalid values being set to 1
  15855. * @hidden
  15856. */
  15857. function boundAlpha(a) {
  15858. a = parseFloat(a);
  15859. if (isNaN(a) || a < 0 || a > 1) a = 1;
  15860. return a;
  15861. }
  15862. /**
  15863. * Replace a decimal with it's percentage value
  15864. * @hidden
  15865. */
  15866. function convertToPercentage(n) {
  15867. if (Number(n) <= 1) return `${Number(n) * 100}%`;
  15868. return n;
  15869. }
  15870. /**
  15871. * Force a hex value to have 2 characters
  15872. * @hidden
  15873. */
  15874. function pad2(c) {
  15875. return c.length === 1 ? "0" + c : String(c);
  15876. }
  15877. //#endregion
  15878. //#region ../../node_modules/.pnpm/@ctrl+tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/conversion.js
  15879. /**
  15880. * Handle bounds / percentage checking to conform to CSS color spec
  15881. * <http://www.w3.org/TR/css3-color/>
  15882. * *Assumes:* r, g, b in [0, 255] or [0, 1]
  15883. * *Returns:* { r, g, b } in [0, 255]
  15884. */
  15885. function rgbToRgb(r, g, b) {
  15886. return {
  15887. r: bound01(r, 255) * 255,
  15888. g: bound01(g, 255) * 255,
  15889. b: bound01(b, 255) * 255
  15890. };
  15891. }
  15892. /**
  15893. * Converts an RGB color value to HSL.
  15894. * *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
  15895. * *Returns:* { h, s, l } in [0,1]
  15896. */
  15897. function rgbToHsl(r, g, b) {
  15898. r = bound01(r, 255);
  15899. g = bound01(g, 255);
  15900. b = bound01(b, 255);
  15901. const max = Math.max(r, g, b);
  15902. const min = Math.min(r, g, b);
  15903. let h = 0;
  15904. let s = 0;
  15905. const l = (max + min) / 2;
  15906. if (max === min) {
  15907. s = 0;
  15908. h = 0;
  15909. } else {
  15910. const d = max - min;
  15911. s = l > .5 ? d / (2 - max - min) : d / (max + min);
  15912. switch (max) {
  15913. case r:
  15914. h = (g - b) / d + (g < b ? 6 : 0);
  15915. break;
  15916. case g:
  15917. h = (b - r) / d + 2;
  15918. break;
  15919. case b:
  15920. h = (r - g) / d + 4;
  15921. break;
  15922. default: break;
  15923. }
  15924. h /= 6;
  15925. }
  15926. return {
  15927. h,
  15928. s,
  15929. l
  15930. };
  15931. }
  15932. function hue2rgb(p, q, t) {
  15933. if (t < 0) t += 1;
  15934. if (t > 1) t -= 1;
  15935. if (t < 1 / 6) return p + (q - p) * (6 * t);
  15936. if (t < 1 / 2) return q;
  15937. if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
  15938. return p;
  15939. }
  15940. /**
  15941. * Converts an HSL color value to RGB.
  15942. *
  15943. * *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
  15944. * *Returns:* { r, g, b } in the set [0, 255]
  15945. */
  15946. function hslToRgb(h, s, l) {
  15947. let r;
  15948. let g;
  15949. let b;
  15950. h = bound01(h, 360);
  15951. s = bound01(s, 100);
  15952. l = bound01(l, 100);
  15953. if (s === 0) {
  15954. g = l;
  15955. b = l;
  15956. r = l;
  15957. } else {
  15958. const q = l < .5 ? l * (1 + s) : l + s - l * s;
  15959. const p = 2 * l - q;
  15960. r = hue2rgb(p, q, h + 1 / 3);
  15961. g = hue2rgb(p, q, h);
  15962. b = hue2rgb(p, q, h - 1 / 3);
  15963. }
  15964. return {
  15965. r: r * 255,
  15966. g: g * 255,
  15967. b: b * 255
  15968. };
  15969. }
  15970. /**
  15971. * Converts an RGB color value to HSV
  15972. *
  15973. * *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
  15974. * *Returns:* { h, s, v } in [0,1]
  15975. */
  15976. function rgbToHsv(r, g, b) {
  15977. r = bound01(r, 255);
  15978. g = bound01(g, 255);
  15979. b = bound01(b, 255);
  15980. const max = Math.max(r, g, b);
  15981. const min = Math.min(r, g, b);
  15982. let h = 0;
  15983. const v = max;
  15984. const d = max - min;
  15985. const s = max === 0 ? 0 : d / max;
  15986. if (max === min) h = 0;
  15987. else {
  15988. switch (max) {
  15989. case r:
  15990. h = (g - b) / d + (g < b ? 6 : 0);
  15991. break;
  15992. case g:
  15993. h = (b - r) / d + 2;
  15994. break;
  15995. case b:
  15996. h = (r - g) / d + 4;
  15997. break;
  15998. default: break;
  15999. }
  16000. h /= 6;
  16001. }
  16002. return {
  16003. h,
  16004. s,
  16005. v
  16006. };
  16007. }
  16008. /**
  16009. * Converts an HSV color value to RGB.
  16010. *
  16011. * *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
  16012. * *Returns:* { r, g, b } in the set [0, 255]
  16013. */
  16014. function hsvToRgb(h, s, v) {
  16015. h = bound01(h, 360) * 6;
  16016. s = bound01(s, 100);
  16017. v = bound01(v, 100);
  16018. const i = Math.floor(h);
  16019. const f = h - i;
  16020. const p = v * (1 - s);
  16021. const q = v * (1 - f * s);
  16022. const t = v * (1 - (1 - f) * s);
  16023. const mod = i % 6;
  16024. const r = [
  16025. v,
  16026. q,
  16027. p,
  16028. p,
  16029. t,
  16030. v
  16031. ][mod];
  16032. const g = [
  16033. t,
  16034. v,
  16035. v,
  16036. q,
  16037. p,
  16038. p
  16039. ][mod];
  16040. const b = [
  16041. p,
  16042. p,
  16043. t,
  16044. v,
  16045. v,
  16046. q
  16047. ][mod];
  16048. return {
  16049. r: r * 255,
  16050. g: g * 255,
  16051. b: b * 255
  16052. };
  16053. }
  16054. /**
  16055. * Converts an RGB color to hex
  16056. *
  16057. * *Assumes:* r, g, and b are contained in the set [0, 255]
  16058. * *Returns:* a 3 or 6 character hex
  16059. */
  16060. function rgbToHex(r, g, b, allow3Char) {
  16061. const hex = [
  16062. pad2(Math.round(r).toString(16)),
  16063. pad2(Math.round(g).toString(16)),
  16064. pad2(Math.round(b).toString(16))
  16065. ];
  16066. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  16067. return hex.join("");
  16068. }
  16069. /**
  16070. * Converts an RGBA color plus alpha transparency to hex
  16071. *
  16072. * *Assumes:* r, g, b are contained in the set [0, 255] and a in [0, 1]
  16073. * *Returns:* a 4 or 8 character rgba hex
  16074. */
  16075. function rgbaToHex(r, g, b, a, allow4Char) {
  16076. const hex = [
  16077. pad2(Math.round(r).toString(16)),
  16078. pad2(Math.round(g).toString(16)),
  16079. pad2(Math.round(b).toString(16)),
  16080. pad2(convertDecimalToHex(a))
  16081. ];
  16082. 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))) return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  16083. return hex.join("");
  16084. }
  16085. /**
  16086. * Converts CMYK to RBG
  16087. * Assumes c, m, y, k are in the set [0, 100]
  16088. */
  16089. function cmykToRgb(c, m, y, k) {
  16090. const cConv = c / 100;
  16091. const mConv = m / 100;
  16092. const yConv = y / 100;
  16093. const kConv = k / 100;
  16094. return {
  16095. r: 255 * (1 - cConv) * (1 - kConv),
  16096. g: 255 * (1 - mConv) * (1 - kConv),
  16097. b: 255 * (1 - yConv) * (1 - kConv)
  16098. };
  16099. }
  16100. function rgbToCmyk(r, g, b) {
  16101. let c = 1 - r / 255;
  16102. let m = 1 - g / 255;
  16103. let y = 1 - b / 255;
  16104. let k = Math.min(c, m, y);
  16105. if (k === 1) {
  16106. c = 0;
  16107. m = 0;
  16108. y = 0;
  16109. } else {
  16110. c = (c - k) / (1 - k) * 100;
  16111. m = (m - k) / (1 - k) * 100;
  16112. y = (y - k) / (1 - k) * 100;
  16113. }
  16114. k *= 100;
  16115. return {
  16116. c: Math.round(c),
  16117. m: Math.round(m),
  16118. y: Math.round(y),
  16119. k: Math.round(k)
  16120. };
  16121. }
  16122. /** Converts a decimal to a hex value */
  16123. function convertDecimalToHex(d) {
  16124. return Math.round(parseFloat(d) * 255).toString(16);
  16125. }
  16126. /** Converts a hex value to a decimal */
  16127. function convertHexToDecimal(h) {
  16128. return parseIntFromHex(h) / 255;
  16129. }
  16130. /** Parse a base-16 hex value into a base-10 integer */
  16131. function parseIntFromHex(val) {
  16132. return parseInt(val, 16);
  16133. }
  16134. function numberInputToObject(color) {
  16135. return {
  16136. r: color >> 16,
  16137. g: (color & 65280) >> 8,
  16138. b: color & 255
  16139. };
  16140. }
  16141. //#endregion
  16142. //#region ../../node_modules/.pnpm/@ctrl+tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/css-color-names.js
  16143. /**
  16144. * @hidden
  16145. */
  16146. const names = {
  16147. aliceblue: "#f0f8ff",
  16148. antiquewhite: "#faebd7",
  16149. aqua: "#00ffff",
  16150. aquamarine: "#7fffd4",
  16151. azure: "#f0ffff",
  16152. beige: "#f5f5dc",
  16153. bisque: "#ffe4c4",
  16154. black: "#000000",
  16155. blanchedalmond: "#ffebcd",
  16156. blue: "#0000ff",
  16157. blueviolet: "#8a2be2",
  16158. brown: "#a52a2a",
  16159. burlywood: "#deb887",
  16160. cadetblue: "#5f9ea0",
  16161. chartreuse: "#7fff00",
  16162. chocolate: "#d2691e",
  16163. coral: "#ff7f50",
  16164. cornflowerblue: "#6495ed",
  16165. cornsilk: "#fff8dc",
  16166. crimson: "#dc143c",
  16167. cyan: "#00ffff",
  16168. darkblue: "#00008b",
  16169. darkcyan: "#008b8b",
  16170. darkgoldenrod: "#b8860b",
  16171. darkgray: "#a9a9a9",
  16172. darkgreen: "#006400",
  16173. darkgrey: "#a9a9a9",
  16174. darkkhaki: "#bdb76b",
  16175. darkmagenta: "#8b008b",
  16176. darkolivegreen: "#556b2f",
  16177. darkorange: "#ff8c00",
  16178. darkorchid: "#9932cc",
  16179. darkred: "#8b0000",
  16180. darksalmon: "#e9967a",
  16181. darkseagreen: "#8fbc8f",
  16182. darkslateblue: "#483d8b",
  16183. darkslategray: "#2f4f4f",
  16184. darkslategrey: "#2f4f4f",
  16185. darkturquoise: "#00ced1",
  16186. darkviolet: "#9400d3",
  16187. deeppink: "#ff1493",
  16188. deepskyblue: "#00bfff",
  16189. dimgray: "#696969",
  16190. dimgrey: "#696969",
  16191. dodgerblue: "#1e90ff",
  16192. firebrick: "#b22222",
  16193. floralwhite: "#fffaf0",
  16194. forestgreen: "#228b22",
  16195. fuchsia: "#ff00ff",
  16196. gainsboro: "#dcdcdc",
  16197. ghostwhite: "#f8f8ff",
  16198. goldenrod: "#daa520",
  16199. gold: "#ffd700",
  16200. gray: "#808080",
  16201. green: "#008000",
  16202. greenyellow: "#adff2f",
  16203. grey: "#808080",
  16204. honeydew: "#f0fff0",
  16205. hotpink: "#ff69b4",
  16206. indianred: "#cd5c5c",
  16207. indigo: "#4b0082",
  16208. ivory: "#fffff0",
  16209. khaki: "#f0e68c",
  16210. lavenderblush: "#fff0f5",
  16211. lavender: "#e6e6fa",
  16212. lawngreen: "#7cfc00",
  16213. lemonchiffon: "#fffacd",
  16214. lightblue: "#add8e6",
  16215. lightcoral: "#f08080",
  16216. lightcyan: "#e0ffff",
  16217. lightgoldenrodyellow: "#fafad2",
  16218. lightgray: "#d3d3d3",
  16219. lightgreen: "#90ee90",
  16220. lightgrey: "#d3d3d3",
  16221. lightpink: "#ffb6c1",
  16222. lightsalmon: "#ffa07a",
  16223. lightseagreen: "#20b2aa",
  16224. lightskyblue: "#87cefa",
  16225. lightslategray: "#778899",
  16226. lightslategrey: "#778899",
  16227. lightsteelblue: "#b0c4de",
  16228. lightyellow: "#ffffe0",
  16229. lime: "#00ff00",
  16230. limegreen: "#32cd32",
  16231. linen: "#faf0e6",
  16232. magenta: "#ff00ff",
  16233. maroon: "#800000",
  16234. mediumaquamarine: "#66cdaa",
  16235. mediumblue: "#0000cd",
  16236. mediumorchid: "#ba55d3",
  16237. mediumpurple: "#9370db",
  16238. mediumseagreen: "#3cb371",
  16239. mediumslateblue: "#7b68ee",
  16240. mediumspringgreen: "#00fa9a",
  16241. mediumturquoise: "#48d1cc",
  16242. mediumvioletred: "#c71585",
  16243. midnightblue: "#191970",
  16244. mintcream: "#f5fffa",
  16245. mistyrose: "#ffe4e1",
  16246. moccasin: "#ffe4b5",
  16247. navajowhite: "#ffdead",
  16248. navy: "#000080",
  16249. oldlace: "#fdf5e6",
  16250. olive: "#808000",
  16251. olivedrab: "#6b8e23",
  16252. orange: "#ffa500",
  16253. orangered: "#ff4500",
  16254. orchid: "#da70d6",
  16255. palegoldenrod: "#eee8aa",
  16256. palegreen: "#98fb98",
  16257. paleturquoise: "#afeeee",
  16258. palevioletred: "#db7093",
  16259. papayawhip: "#ffefd5",
  16260. peachpuff: "#ffdab9",
  16261. peru: "#cd853f",
  16262. pink: "#ffc0cb",
  16263. plum: "#dda0dd",
  16264. powderblue: "#b0e0e6",
  16265. purple: "#800080",
  16266. rebeccapurple: "#663399",
  16267. red: "#ff0000",
  16268. rosybrown: "#bc8f8f",
  16269. royalblue: "#4169e1",
  16270. saddlebrown: "#8b4513",
  16271. salmon: "#fa8072",
  16272. sandybrown: "#f4a460",
  16273. seagreen: "#2e8b57",
  16274. seashell: "#fff5ee",
  16275. sienna: "#a0522d",
  16276. silver: "#c0c0c0",
  16277. skyblue: "#87ceeb",
  16278. slateblue: "#6a5acd",
  16279. slategray: "#708090",
  16280. slategrey: "#708090",
  16281. snow: "#fffafa",
  16282. springgreen: "#00ff7f",
  16283. steelblue: "#4682b4",
  16284. tan: "#d2b48c",
  16285. teal: "#008080",
  16286. thistle: "#d8bfd8",
  16287. tomato: "#ff6347",
  16288. turquoise: "#40e0d0",
  16289. violet: "#ee82ee",
  16290. wheat: "#f5deb3",
  16291. white: "#ffffff",
  16292. whitesmoke: "#f5f5f5",
  16293. yellow: "#ffff00",
  16294. yellowgreen: "#9acd32"
  16295. };
  16296. //#endregion
  16297. //#region ../../node_modules/.pnpm/@ctrl+tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/format-input.js
  16298. /**
  16299. * Given a string or object, convert that input to RGB
  16300. *
  16301. * Possible string inputs:
  16302. * ```
  16303. * "red"
  16304. * "#f00" or "f00"
  16305. * "#ff0000" or "ff0000"
  16306. * "#ff000000" or "ff000000"
  16307. * "rgb 255 0 0" or "rgb (255, 0, 0)"
  16308. * "rgb 1.0 0 0" or "rgb (1, 0, 0)"
  16309. * "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
  16310. * "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
  16311. * "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
  16312. * "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
  16313. * "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
  16314. * "cmyk(0, 20, 0, 0)" or "cmyk 0 20 0 0"
  16315. * ```
  16316. */
  16317. function inputToRGB(color) {
  16318. let rgb = {
  16319. r: 0,
  16320. g: 0,
  16321. b: 0
  16322. };
  16323. let a = 1;
  16324. let s = null;
  16325. let v = null;
  16326. let l = null;
  16327. let ok = false;
  16328. let format = false;
  16329. if (typeof color === "string") color = stringInputToObject(color);
  16330. if (typeof color === "object") {
  16331. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  16332. rgb = rgbToRgb(color.r, color.g, color.b);
  16333. ok = true;
  16334. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  16335. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  16336. s = convertToPercentage(color.s);
  16337. v = convertToPercentage(color.v);
  16338. rgb = hsvToRgb(color.h, s, v);
  16339. ok = true;
  16340. format = "hsv";
  16341. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  16342. s = convertToPercentage(color.s);
  16343. l = convertToPercentage(color.l);
  16344. rgb = hslToRgb(color.h, s, l);
  16345. ok = true;
  16346. format = "hsl";
  16347. } else if (isValidCSSUnit(color.c) && isValidCSSUnit(color.m) && isValidCSSUnit(color.y) && isValidCSSUnit(color.k)) {
  16348. rgb = cmykToRgb(color.c, color.m, color.y, color.k);
  16349. ok = true;
  16350. format = "cmyk";
  16351. }
  16352. if (Object.prototype.hasOwnProperty.call(color, "a")) a = color.a;
  16353. }
  16354. a = boundAlpha(a);
  16355. return {
  16356. ok,
  16357. format: color.format || format,
  16358. r: Math.min(255, Math.max(rgb.r, 0)),
  16359. g: Math.min(255, Math.max(rgb.g, 0)),
  16360. b: Math.min(255, Math.max(rgb.b, 0)),
  16361. a
  16362. };
  16363. }
  16364. const CSS_UNIT = "(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)";
  16365. const PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))\\s*\\)?";
  16366. const PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))\\s*\\)?";
  16367. const matchers = {
  16368. CSS_UNIT: new RegExp(CSS_UNIT),
  16369. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  16370. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  16371. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  16372. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  16373. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  16374. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  16375. cmyk: new RegExp("cmyk" + PERMISSIVE_MATCH4),
  16376. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16377. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  16378. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16379. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  16380. };
  16381. /**
  16382. * Permissive string parsing. Take in a number of formats, and output an object
  16383. * based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` or `{c, m, y, k}` or `{c, m, y, k, a}`
  16384. */
  16385. function stringInputToObject(color) {
  16386. color = color.trim().toLowerCase();
  16387. if (color.length === 0) return false;
  16388. let named = false;
  16389. if (names[color]) {
  16390. color = names[color];
  16391. named = true;
  16392. } else if (color === "transparent") return {
  16393. r: 0,
  16394. g: 0,
  16395. b: 0,
  16396. a: 0,
  16397. format: "name"
  16398. };
  16399. let match = matchers.rgb.exec(color);
  16400. if (match) return {
  16401. r: match[1],
  16402. g: match[2],
  16403. b: match[3]
  16404. };
  16405. match = matchers.rgba.exec(color);
  16406. if (match) return {
  16407. r: match[1],
  16408. g: match[2],
  16409. b: match[3],
  16410. a: match[4]
  16411. };
  16412. match = matchers.hsl.exec(color);
  16413. if (match) return {
  16414. h: match[1],
  16415. s: match[2],
  16416. l: match[3]
  16417. };
  16418. match = matchers.hsla.exec(color);
  16419. if (match) return {
  16420. h: match[1],
  16421. s: match[2],
  16422. l: match[3],
  16423. a: match[4]
  16424. };
  16425. match = matchers.hsv.exec(color);
  16426. if (match) return {
  16427. h: match[1],
  16428. s: match[2],
  16429. v: match[3]
  16430. };
  16431. match = matchers.hsva.exec(color);
  16432. if (match) return {
  16433. h: match[1],
  16434. s: match[2],
  16435. v: match[3],
  16436. a: match[4]
  16437. };
  16438. match = matchers.cmyk.exec(color);
  16439. if (match) return {
  16440. c: match[1],
  16441. m: match[2],
  16442. y: match[3],
  16443. k: match[4]
  16444. };
  16445. match = matchers.hex8.exec(color);
  16446. if (match) return {
  16447. r: parseIntFromHex(match[1]),
  16448. g: parseIntFromHex(match[2]),
  16449. b: parseIntFromHex(match[3]),
  16450. a: convertHexToDecimal(match[4]),
  16451. format: named ? "name" : "hex8"
  16452. };
  16453. match = matchers.hex6.exec(color);
  16454. if (match) return {
  16455. r: parseIntFromHex(match[1]),
  16456. g: parseIntFromHex(match[2]),
  16457. b: parseIntFromHex(match[3]),
  16458. format: named ? "name" : "hex"
  16459. };
  16460. match = matchers.hex4.exec(color);
  16461. if (match) return {
  16462. r: parseIntFromHex(match[1] + match[1]),
  16463. g: parseIntFromHex(match[2] + match[2]),
  16464. b: parseIntFromHex(match[3] + match[3]),
  16465. a: convertHexToDecimal(match[4] + match[4]),
  16466. format: named ? "name" : "hex8"
  16467. };
  16468. match = matchers.hex3.exec(color);
  16469. if (match) return {
  16470. r: parseIntFromHex(match[1] + match[1]),
  16471. g: parseIntFromHex(match[2] + match[2]),
  16472. b: parseIntFromHex(match[3] + match[3]),
  16473. format: named ? "name" : "hex"
  16474. };
  16475. return false;
  16476. }
  16477. /**
  16478. * Check to see if it looks like a CSS unit
  16479. * (see `matchers` above for definition).
  16480. */
  16481. function isValidCSSUnit(color) {
  16482. if (typeof color === "number") return !Number.isNaN(color);
  16483. return matchers.CSS_UNIT.test(color);
  16484. }
  16485. //#endregion
  16486. //#region ../../node_modules/.pnpm/@ctrl+tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/index.js
  16487. var TinyColor = class TinyColor {
  16488. constructor(color = "", opts = {}) {
  16489. if (color instanceof TinyColor) return color;
  16490. if (typeof color === "number") color = numberInputToObject(color);
  16491. this.originalInput = color;
  16492. const rgb = inputToRGB(color);
  16493. this.originalInput = color;
  16494. this.r = rgb.r;
  16495. this.g = rgb.g;
  16496. this.b = rgb.b;
  16497. this.a = rgb.a;
  16498. this.roundA = Math.round(100 * this.a) / 100;
  16499. this.format = opts.format ?? rgb.format;
  16500. this.gradientType = opts.gradientType;
  16501. if (this.r < 1) this.r = Math.round(this.r);
  16502. if (this.g < 1) this.g = Math.round(this.g);
  16503. if (this.b < 1) this.b = Math.round(this.b);
  16504. this.isValid = rgb.ok;
  16505. }
  16506. isDark() {
  16507. return this.getBrightness() < 128;
  16508. }
  16509. isLight() {
  16510. return !this.isDark();
  16511. }
  16512. /**
  16513. * Returns the perceived brightness of the color, from 0-255.
  16514. */
  16515. getBrightness() {
  16516. const rgb = this.toRgb();
  16517. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  16518. }
  16519. /**
  16520. * Returns the perceived luminance of a color, from 0-1.
  16521. */
  16522. getLuminance() {
  16523. const rgb = this.toRgb();
  16524. let R;
  16525. let G;
  16526. let B;
  16527. const RsRGB = rgb.r / 255;
  16528. const GsRGB = rgb.g / 255;
  16529. const BsRGB = rgb.b / 255;
  16530. if (RsRGB <= .03928) R = RsRGB / 12.92;
  16531. else R = Math.pow((RsRGB + .055) / 1.055, 2.4);
  16532. if (GsRGB <= .03928) G = GsRGB / 12.92;
  16533. else G = Math.pow((GsRGB + .055) / 1.055, 2.4);
  16534. if (BsRGB <= .03928) B = BsRGB / 12.92;
  16535. else B = Math.pow((BsRGB + .055) / 1.055, 2.4);
  16536. return .2126 * R + .7152 * G + .0722 * B;
  16537. }
  16538. /**
  16539. * Returns the alpha value of a color, from 0-1.
  16540. */
  16541. getAlpha() {
  16542. return this.a;
  16543. }
  16544. /**
  16545. * Sets the alpha value on the current color.
  16546. *
  16547. * @param alpha - The new alpha value. The accepted range is 0-1.
  16548. */
  16549. setAlpha(alpha) {
  16550. this.a = boundAlpha(alpha);
  16551. this.roundA = Math.round(100 * this.a) / 100;
  16552. return this;
  16553. }
  16554. /**
  16555. * Returns whether the color is monochrome.
  16556. */
  16557. isMonochrome() {
  16558. const { s } = this.toHsl();
  16559. return s === 0;
  16560. }
  16561. /**
  16562. * Returns the object as a HSVA object.
  16563. */
  16564. toHsv() {
  16565. const hsv = rgbToHsv(this.r, this.g, this.b);
  16566. return {
  16567. h: hsv.h * 360,
  16568. s: hsv.s,
  16569. v: hsv.v,
  16570. a: this.a
  16571. };
  16572. }
  16573. /**
  16574. * Returns the hsva values interpolated into a string with the following format:
  16575. * "hsva(xxx, xxx, xxx, xx)".
  16576. */
  16577. toHsvString() {
  16578. const hsv = rgbToHsv(this.r, this.g, this.b);
  16579. const h = Math.round(hsv.h * 360);
  16580. const s = Math.round(hsv.s * 100);
  16581. const v = Math.round(hsv.v * 100);
  16582. return this.a === 1 ? `hsv(${h}, ${s}%, ${v}%)` : `hsva(${h}, ${s}%, ${v}%, ${this.roundA})`;
  16583. }
  16584. /**
  16585. * Returns the object as a HSLA object.
  16586. */
  16587. toHsl() {
  16588. const hsl = rgbToHsl(this.r, this.g, this.b);
  16589. return {
  16590. h: hsl.h * 360,
  16591. s: hsl.s,
  16592. l: hsl.l,
  16593. a: this.a
  16594. };
  16595. }
  16596. /**
  16597. * Returns the hsla values interpolated into a string with the following format:
  16598. * "hsla(xxx, xxx, xxx, xx)".
  16599. */
  16600. toHslString() {
  16601. const hsl = rgbToHsl(this.r, this.g, this.b);
  16602. const h = Math.round(hsl.h * 360);
  16603. const s = Math.round(hsl.s * 100);
  16604. const l = Math.round(hsl.l * 100);
  16605. return this.a === 1 ? `hsl(${h}, ${s}%, ${l}%)` : `hsla(${h}, ${s}%, ${l}%, ${this.roundA})`;
  16606. }
  16607. /**
  16608. * Returns the hex value of the color.
  16609. * @param allow3Char will shorten hex value to 3 char if possible
  16610. */
  16611. toHex(allow3Char = false) {
  16612. return rgbToHex(this.r, this.g, this.b, allow3Char);
  16613. }
  16614. /**
  16615. * Returns the hex value of the color -with a # prefixed.
  16616. * @param allow3Char will shorten hex value to 3 char if possible
  16617. */
  16618. toHexString(allow3Char = false) {
  16619. return "#" + this.toHex(allow3Char);
  16620. }
  16621. /**
  16622. * Returns the hex 8 value of the color.
  16623. * @param allow4Char will shorten hex value to 4 char if possible
  16624. */
  16625. toHex8(allow4Char = false) {
  16626. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  16627. }
  16628. /**
  16629. * Returns the hex 8 value of the color -with a # prefixed.
  16630. * @param allow4Char will shorten hex value to 4 char if possible
  16631. */
  16632. toHex8String(allow4Char = false) {
  16633. return "#" + this.toHex8(allow4Char);
  16634. }
  16635. /**
  16636. * Returns the shorter hex value of the color depends on its alpha -with a # prefixed.
  16637. * @param allowShortChar will shorten hex value to 3 or 4 char if possible
  16638. */
  16639. toHexShortString(allowShortChar = false) {
  16640. return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
  16641. }
  16642. /**
  16643. * Returns the object as a RGBA object.
  16644. */
  16645. toRgb() {
  16646. return {
  16647. r: Math.round(this.r),
  16648. g: Math.round(this.g),
  16649. b: Math.round(this.b),
  16650. a: this.a
  16651. };
  16652. }
  16653. /**
  16654. * Returns the RGBA values interpolated into a string with the following format:
  16655. * "RGBA(xxx, xxx, xxx, xx)".
  16656. */
  16657. toRgbString() {
  16658. const r = Math.round(this.r);
  16659. const g = Math.round(this.g);
  16660. const b = Math.round(this.b);
  16661. return this.a === 1 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${this.roundA})`;
  16662. }
  16663. /**
  16664. * Returns the object as a RGBA object.
  16665. */
  16666. toPercentageRgb() {
  16667. const fmt = (x) => `${Math.round(bound01(x, 255) * 100)}%`;
  16668. return {
  16669. r: fmt(this.r),
  16670. g: fmt(this.g),
  16671. b: fmt(this.b),
  16672. a: this.a
  16673. };
  16674. }
  16675. /**
  16676. * Returns the RGBA relative values interpolated into a string
  16677. */
  16678. toPercentageRgbString() {
  16679. const rnd = (x) => Math.round(bound01(x, 255) * 100);
  16680. return this.a === 1 ? `rgb(${rnd(this.r)}%, ${rnd(this.g)}%, ${rnd(this.b)}%)` : `rgba(${rnd(this.r)}%, ${rnd(this.g)}%, ${rnd(this.b)}%, ${this.roundA})`;
  16681. }
  16682. toCmyk() {
  16683. return { ...rgbToCmyk(this.r, this.g, this.b) };
  16684. }
  16685. toCmykString() {
  16686. const { c, m, y, k } = rgbToCmyk(this.r, this.g, this.b);
  16687. return `cmyk(${c}, ${m}, ${y}, ${k})`;
  16688. }
  16689. /**
  16690. * The 'real' name of the color -if there is one.
  16691. */
  16692. toName() {
  16693. if (this.a === 0) return "transparent";
  16694. if (this.a < 1) return false;
  16695. const hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  16696. for (const [key, value] of Object.entries(names)) if (hex === value) return key;
  16697. return false;
  16698. }
  16699. toString(format) {
  16700. const formatSet = Boolean(format);
  16701. format = format ?? this.format;
  16702. let formattedString = false;
  16703. const hasAlpha = this.a < 1 && this.a >= 0;
  16704. if (!formatSet && hasAlpha && (format.startsWith("hex") || format === "name")) {
  16705. if (format === "name" && this.a === 0) return this.toName();
  16706. return this.toRgbString();
  16707. }
  16708. if (format === "rgb") formattedString = this.toRgbString();
  16709. if (format === "prgb") formattedString = this.toPercentageRgbString();
  16710. if (format === "hex" || format === "hex6") formattedString = this.toHexString();
  16711. if (format === "hex3") formattedString = this.toHexString(true);
  16712. if (format === "hex4") formattedString = this.toHex8String(true);
  16713. if (format === "hex8") formattedString = this.toHex8String();
  16714. if (format === "name") formattedString = this.toName();
  16715. if (format === "hsl") formattedString = this.toHslString();
  16716. if (format === "hsv") formattedString = this.toHsvString();
  16717. if (format === "cmyk") formattedString = this.toCmykString();
  16718. return formattedString || this.toHexString();
  16719. }
  16720. toNumber() {
  16721. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  16722. }
  16723. clone() {
  16724. return new TinyColor(this.toString());
  16725. }
  16726. /**
  16727. * Lighten the color a given amount. Providing 100 will always return white.
  16728. * @param amount - valid between 1-100
  16729. */
  16730. lighten(amount = 10) {
  16731. const hsl = this.toHsl();
  16732. hsl.l += amount / 100;
  16733. hsl.l = clamp01(hsl.l);
  16734. return new TinyColor(hsl);
  16735. }
  16736. /**
  16737. * Brighten the color a given amount, from 0 to 100.
  16738. * @param amount - valid between 1-100
  16739. */
  16740. brighten(amount = 10) {
  16741. const rgb = this.toRgb();
  16742. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  16743. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  16744. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  16745. return new TinyColor(rgb);
  16746. }
  16747. /**
  16748. * Darken the color a given amount, from 0 to 100.
  16749. * Providing 100 will always return black.
  16750. * @param amount - valid between 1-100
  16751. */
  16752. darken(amount = 10) {
  16753. const hsl = this.toHsl();
  16754. hsl.l -= amount / 100;
  16755. hsl.l = clamp01(hsl.l);
  16756. return new TinyColor(hsl);
  16757. }
  16758. /**
  16759. * Mix the color with pure white, from 0 to 100.
  16760. * Providing 0 will do nothing, providing 100 will always return white.
  16761. * @param amount - valid between 1-100
  16762. */
  16763. tint(amount = 10) {
  16764. return this.mix("white", amount);
  16765. }
  16766. /**
  16767. * Mix the color with pure black, from 0 to 100.
  16768. * Providing 0 will do nothing, providing 100 will always return black.
  16769. * @param amount - valid between 1-100
  16770. */
  16771. shade(amount = 10) {
  16772. return this.mix("black", amount);
  16773. }
  16774. /**
  16775. * Desaturate the color a given amount, from 0 to 100.
  16776. * Providing 100 will is the same as calling greyscale
  16777. * @param amount - valid between 1-100
  16778. */
  16779. desaturate(amount = 10) {
  16780. const hsl = this.toHsl();
  16781. hsl.s -= amount / 100;
  16782. hsl.s = clamp01(hsl.s);
  16783. return new TinyColor(hsl);
  16784. }
  16785. /**
  16786. * Saturate the color a given amount, from 0 to 100.
  16787. * @param amount - valid between 1-100
  16788. */
  16789. saturate(amount = 10) {
  16790. const hsl = this.toHsl();
  16791. hsl.s += amount / 100;
  16792. hsl.s = clamp01(hsl.s);
  16793. return new TinyColor(hsl);
  16794. }
  16795. /**
  16796. * Completely desaturates a color into greyscale.
  16797. * Same as calling `desaturate(100)`
  16798. */
  16799. greyscale() {
  16800. return this.desaturate(100);
  16801. }
  16802. /**
  16803. * Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
  16804. * Values outside of this range will be wrapped into this range.
  16805. */
  16806. spin(amount) {
  16807. const hsl = this.toHsl();
  16808. const hue = (hsl.h + amount) % 360;
  16809. hsl.h = hue < 0 ? 360 + hue : hue;
  16810. return new TinyColor(hsl);
  16811. }
  16812. /**
  16813. * Mix the current color a given amount with another color, from 0 to 100.
  16814. * 0 means no mixing (return current color).
  16815. */
  16816. mix(color, amount = 50) {
  16817. const rgb1 = this.toRgb();
  16818. const rgb2 = new TinyColor(color).toRgb();
  16819. const p = amount / 100;
  16820. return new TinyColor({
  16821. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  16822. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  16823. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  16824. a: (rgb2.a - rgb1.a) * p + rgb1.a
  16825. });
  16826. }
  16827. analogous(results = 6, slices = 30) {
  16828. const hsl = this.toHsl();
  16829. const part = 360 / slices;
  16830. const ret = [this];
  16831. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
  16832. hsl.h = (hsl.h + part) % 360;
  16833. ret.push(new TinyColor(hsl));
  16834. }
  16835. return ret;
  16836. }
  16837. /**
  16838. * taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js
  16839. */
  16840. complement() {
  16841. const hsl = this.toHsl();
  16842. hsl.h = (hsl.h + 180) % 360;
  16843. return new TinyColor(hsl);
  16844. }
  16845. monochromatic(results = 6) {
  16846. const hsv = this.toHsv();
  16847. const { h } = hsv;
  16848. const { s } = hsv;
  16849. let { v } = hsv;
  16850. const res = [];
  16851. const modification = 1 / results;
  16852. while (results--) {
  16853. res.push(new TinyColor({
  16854. h,
  16855. s,
  16856. v
  16857. }));
  16858. v = (v + modification) % 1;
  16859. }
  16860. return res;
  16861. }
  16862. splitcomplement() {
  16863. const hsl = this.toHsl();
  16864. const { h } = hsl;
  16865. return [
  16866. this,
  16867. new TinyColor({
  16868. h: (h + 72) % 360,
  16869. s: hsl.s,
  16870. l: hsl.l
  16871. }),
  16872. new TinyColor({
  16873. h: (h + 216) % 360,
  16874. s: hsl.s,
  16875. l: hsl.l
  16876. })
  16877. ];
  16878. }
  16879. /**
  16880. * Compute how the color would appear on a background
  16881. */
  16882. onBackground(background) {
  16883. const fg = this.toRgb();
  16884. const bg = new TinyColor(background).toRgb();
  16885. const alpha = fg.a + bg.a * (1 - fg.a);
  16886. return new TinyColor({
  16887. r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
  16888. g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
  16889. b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
  16890. a: alpha
  16891. });
  16892. }
  16893. /**
  16894. * Alias for `polyad(3)`
  16895. */
  16896. triad() {
  16897. return this.polyad(3);
  16898. }
  16899. /**
  16900. * Alias for `polyad(4)`
  16901. */
  16902. tetrad() {
  16903. return this.polyad(4);
  16904. }
  16905. /**
  16906. * Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...)
  16907. * monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...
  16908. */
  16909. polyad(n) {
  16910. const hsl = this.toHsl();
  16911. const { h } = hsl;
  16912. const result = [this];
  16913. const increment = 360 / n;
  16914. for (let i = 1; i < n; i++) result.push(new TinyColor({
  16915. h: (h + i * increment) % 360,
  16916. s: hsl.s,
  16917. l: hsl.l
  16918. }));
  16919. return result;
  16920. }
  16921. /**
  16922. * compare color vs current color
  16923. */
  16924. equals(color) {
  16925. const comparedColor = new TinyColor(color);
  16926. /**
  16927. * RGB and CMYK do not have the same color gamut, so a CMYK conversion will never be 100%.
  16928. * This means we need to compare CMYK to CMYK to ensure accuracy of the equals function.
  16929. */
  16930. if (this.format === "cmyk" || comparedColor.format === "cmyk") return this.toCmykString() === comparedColor.toCmykString();
  16931. return this.toRgbString() === comparedColor.toRgbString();
  16932. }
  16933. };
  16934. //#endregion
  16935. //#region ../../packages/components/button/src/button-custom.ts
  16936. function darken(color, amount = 20) {
  16937. return color.mix("#141414", amount).toString();
  16938. }
  16939. function useButtonCustomStyle(props) {
  16940. const _disabled = useFormDisabled();
  16941. const ns = useNamespace("button");
  16942. return computed(() => {
  16943. let styles = {};
  16944. let buttonColor = props.color;
  16945. if (buttonColor) {
  16946. const match = buttonColor.match(/var\((.*?)\)/);
  16947. if (match) buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
  16948. const color = new TinyColor(buttonColor);
  16949. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  16950. if (props.plain) {
  16951. styles = ns.cssVarBlock({
  16952. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  16953. "text-color": buttonColor,
  16954. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  16955. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  16956. "hover-bg-color": buttonColor,
  16957. "hover-border-color": buttonColor,
  16958. "active-bg-color": activeBgColor,
  16959. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  16960. "active-border-color": activeBgColor
  16961. });
  16962. if (_disabled.value) {
  16963. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  16964. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  16965. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  16966. }
  16967. } else {
  16968. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  16969. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  16970. styles = ns.cssVarBlock({
  16971. "bg-color": buttonColor,
  16972. "text-color": textColor,
  16973. "border-color": buttonColor,
  16974. "hover-bg-color": hoverBgColor,
  16975. "hover-text-color": textColor,
  16976. "hover-border-color": hoverBgColor,
  16977. "active-bg-color": activeBgColor,
  16978. "active-border-color": activeBgColor
  16979. });
  16980. if (_disabled.value) {
  16981. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  16982. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  16983. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  16984. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  16985. }
  16986. }
  16987. }
  16988. return styles;
  16989. });
  16990. }
  16991. //#endregion
  16992. //#region ../../packages/components/button/src/button.vue?vue&type=script&setup=true&lang.ts
  16993. var button_vue_vue_type_script_setup_true_lang_default$1 = /* @__PURE__ */ defineComponent({
  16994. name: "ElButton",
  16995. __name: "button",
  16996. props: buttonProps,
  16997. emits: buttonEmits,
  16998. setup(__props, { expose: __expose, emit: __emit }) {
  16999. const props = __props;
  17000. const emit = __emit;
  17001. const buttonStyle = useButtonCustomStyle(props);
  17002. const ns = useNamespace("button");
  17003. const { _ref, _size, _type, _disabled, _props, _plain, _round, _text, _dashed, shouldAddSpace, handleClick } = useButton(props, emit);
  17004. const buttonKls = computed(() => [
  17005. ns.b(),
  17006. ns.m(_type.value),
  17007. ns.m(_size.value),
  17008. ns.is("disabled", _disabled.value),
  17009. ns.is("loading", props.loading),
  17010. ns.is("plain", _plain.value),
  17011. ns.is("round", _round.value),
  17012. ns.is("circle", props.circle),
  17013. ns.is("text", _text.value),
  17014. ns.is("dashed", _dashed.value),
  17015. ns.is("link", props.link),
  17016. ns.is("has-bg", props.bg)
  17017. ]);
  17018. __expose({
  17019. ref: _ref,
  17020. size: _size,
  17021. type: _type,
  17022. disabled: _disabled,
  17023. shouldAddSpace
  17024. });
  17025. return (_ctx, _cache) => {
  17026. return openBlock(), createBlock(resolveDynamicComponent(__props.tag), mergeProps({
  17027. ref_key: "_ref",
  17028. ref: _ref
  17029. }, unref(_props), {
  17030. class: buttonKls.value,
  17031. style: unref(buttonStyle),
  17032. onClick: unref(handleClick)
  17033. }), {
  17034. default: withCtx(() => [__props.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  17035. key: 1,
  17036. class: normalizeClass(unref(ns).is("loading"))
  17037. }, {
  17038. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.loadingIcon)))]),
  17039. _: 1
  17040. }, 8, ["class"]))], 64)) : __props.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  17041. default: withCtx(() => [__props.icon ? (openBlock(), createBlock(resolveDynamicComponent(__props.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })]),
  17042. _: 3
  17043. })) : createCommentVNode("v-if", true), _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  17044. key: 2,
  17045. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  17046. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true)]),
  17047. _: 3
  17048. }, 16, [
  17049. "class",
  17050. "style",
  17051. "onClick"
  17052. ]);
  17053. };
  17054. }
  17055. });
  17056. //#endregion
  17057. //#region ../../packages/components/button/src/button.vue
  17058. var button_default$1 = button_vue_vue_type_script_setup_true_lang_default$1;
  17059. //#endregion
  17060. //#region ../../packages/components/button/src/button-group.ts
  17061. /**
  17062. * @deprecated Removed after 3.0.0, Use `ButtonGroupProps` instead.
  17063. */
  17064. const buttonGroupProps = {
  17065. size: buttonProps.size,
  17066. type: buttonProps.type,
  17067. direction: {
  17068. type: definePropType(String),
  17069. values: ["horizontal", "vertical"],
  17070. default: "horizontal"
  17071. }
  17072. };
  17073. //#endregion
  17074. //#region ../../packages/components/button/src/button-group.vue?vue&type=script&setup=true&lang.ts
  17075. var button_group_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  17076. name: "ElButtonGroup",
  17077. __name: "button-group",
  17078. props: buttonGroupProps,
  17079. setup(__props) {
  17080. const props = __props;
  17081. provide(buttonGroupContextKey, reactive({
  17082. size: toRef(props, "size"),
  17083. type: toRef(props, "type")
  17084. }));
  17085. const ns = useNamespace("button");
  17086. return (_ctx, _cache) => {
  17087. return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b("group"), unref(ns).bm("group", props.direction)]) }, [renderSlot(_ctx.$slots, "default")], 2);
  17088. };
  17089. }
  17090. });
  17091. //#endregion
  17092. //#region ../../packages/components/button/src/button-group.vue
  17093. var button_group_default = button_group_vue_vue_type_script_setup_true_lang_default;
  17094. //#endregion
  17095. //#region ../../packages/components/button/index.ts
  17096. const ElButton = withInstall(button_default$1, { ButtonGroup: button_group_default });
  17097. const ElButtonGroup = withNoopInstall(button_group_default);
  17098. //#endregion
  17099. //#region ../../packages/components/calendar/src/calendar.ts
  17100. const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate(item));
  17101. /**
  17102. * @deprecated Removed after 3.0.0, Use `CalendarProps` instead.
  17103. */
  17104. const calendarProps = buildProps({
  17105. modelValue: { type: Date },
  17106. range: {
  17107. type: definePropType(Array),
  17108. validator: isValidRange$1
  17109. },
  17110. controllerType: {
  17111. type: String,
  17112. values: ["button", "select"],
  17113. default: "button"
  17114. },
  17115. formatter: { type: definePropType(Function) }
  17116. });
  17117. const calendarEmits = {
  17118. [UPDATE_MODEL_EVENT]: (value) => isDate(value),
  17119. [INPUT_EVENT]: (value) => isDate(value)
  17120. };
  17121. //#endregion
  17122. //#region ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js
  17123. var require_dayjs_min = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  17124. (function(t, e) {
  17125. "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
  17126. })(exports, (function() {
  17127. "use strict";
  17128. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = {
  17129. name: "en",
  17130. weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
  17131. months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
  17132. ordinal: function(t) {
  17133. var e = [
  17134. "th",
  17135. "st",
  17136. "nd",
  17137. "rd"
  17138. ], n = t % 100;
  17139. return "[" + t + (e[(n - 20) % 10] || e[n] || e[0]) + "]";
  17140. }
  17141. }, m = function(t, e, n) {
  17142. var r = String(t);
  17143. return !r || r.length >= e ? t : "" + Array(e + 1 - r.length).join(n) + t;
  17144. }, v = {
  17145. s: m,
  17146. z: function(t) {
  17147. var e = -t.utcOffset(), n = Math.abs(e), r = Math.floor(n / 60), i = n % 60;
  17148. return (e <= 0 ? "+" : "-") + m(r, 2, "0") + ":" + m(i, 2, "0");
  17149. },
  17150. m: function t(e, n) {
  17151. if (e.date() < n.date()) return -t(n, e);
  17152. var r = 12 * (n.year() - e.year()) + (n.month() - e.month()), i = e.clone().add(r, c), s = n - i < 0, u = e.clone().add(r + (s ? -1 : 1), c);
  17153. return +(-(r + (n - i) / (s ? i - u : u - i)) || 0);
  17154. },
  17155. a: function(t) {
  17156. return t < 0 ? Math.ceil(t) || 0 : Math.floor(t);
  17157. },
  17158. p: function(t) {
  17159. return {
  17160. M: c,
  17161. y: h,
  17162. w: o,
  17163. d: a,
  17164. D: d,
  17165. h: u,
  17166. m: s,
  17167. s: i,
  17168. ms: r,
  17169. Q: f
  17170. }[t] || String(t || "").toLowerCase().replace(/s$/, "");
  17171. },
  17172. u: function(t) {
  17173. return void 0 === t;
  17174. }
  17175. }, g = "en", D = {};
  17176. D[g] = M;
  17177. var p = "$isDayjsObject", S = function(t) {
  17178. return t instanceof _ || !(!t || !t[p]);
  17179. }, w = function t(e, n, r) {
  17180. var i;
  17181. if (!e) return g;
  17182. if ("string" == typeof e) {
  17183. var s = e.toLowerCase();
  17184. D[s] && (i = s), n && (D[s] = n, i = s);
  17185. var u = e.split("-");
  17186. if (!i && u.length > 1) return t(u[0]);
  17187. } else {
  17188. var a = e.name;
  17189. D[a] = e, i = a;
  17190. }
  17191. return !r && i && (g = i), i || !r && g;
  17192. }, O = function(t, e) {
  17193. if (S(t)) return t.clone();
  17194. var n = "object" == typeof e ? e : {};
  17195. return n.date = t, n.args = arguments, new _(n);
  17196. }, b = v;
  17197. b.l = w, b.i = S, b.w = function(t, e) {
  17198. return O(t, {
  17199. locale: e.$L,
  17200. utc: e.$u,
  17201. x: e.$x,
  17202. $offset: e.$offset
  17203. });
  17204. };
  17205. var _ = function() {
  17206. function M(t) {
  17207. this.$L = w(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[p] = !0;
  17208. }
  17209. var m = M.prototype;
  17210. return m.parse = function(t) {
  17211. this.$d = function(t) {
  17212. var e = t.date, n = t.utc;
  17213. if (null === e) return /* @__PURE__ */ new Date(NaN);
  17214. if (b.u(e)) return /* @__PURE__ */ new Date();
  17215. if (e instanceof Date) return new Date(e);
  17216. if ("string" == typeof e && !/Z$/i.test(e)) {
  17217. var r = e.match($);
  17218. if (r) {
  17219. var i = r[2] - 1 || 0, s = (r[7] || "0").substring(0, 3);
  17220. return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s);
  17221. }
  17222. }
  17223. return new Date(e);
  17224. }(t), this.init();
  17225. }, m.init = function() {
  17226. var t = this.$d;
  17227. this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
  17228. }, m.$utils = function() {
  17229. return b;
  17230. }, m.isValid = function() {
  17231. return !(this.$d.toString() === l);
  17232. }, m.isSame = function(t, e) {
  17233. var n = O(t);
  17234. return this.startOf(e) <= n && n <= this.endOf(e);
  17235. }, m.isAfter = function(t, e) {
  17236. return O(t) < this.startOf(e);
  17237. }, m.isBefore = function(t, e) {
  17238. return this.endOf(e) < O(t);
  17239. }, m.$g = function(t, e, n) {
  17240. return b.u(t) ? this[e] : this.set(n, t);
  17241. }, m.unix = function() {
  17242. return Math.floor(this.valueOf() / 1e3);
  17243. }, m.valueOf = function() {
  17244. return this.$d.getTime();
  17245. }, m.startOf = function(t, e) {
  17246. var n = this, r = !!b.u(e) || e, f = b.p(t), l = function(t, e) {
  17247. var i = b.w(n.$u ? Date.UTC(n.$y, e, t) : new Date(n.$y, e, t), n);
  17248. return r ? i : i.endOf(a);
  17249. }, $ = function(t, e) {
  17250. return b.w(n.toDate()[t].apply(n.toDate("s"), (r ? [
  17251. 0,
  17252. 0,
  17253. 0,
  17254. 0
  17255. ] : [
  17256. 23,
  17257. 59,
  17258. 59,
  17259. 999
  17260. ]).slice(e)), n);
  17261. }, y = this.$W, M = this.$M, m = this.$D, v = "set" + (this.$u ? "UTC" : "");
  17262. switch (f) {
  17263. case h: return r ? l(1, 0) : l(31, 11);
  17264. case c: return r ? l(1, M) : l(0, M + 1);
  17265. case o:
  17266. var g = this.$locale().weekStart || 0, D = (y < g ? y + 7 : y) - g;
  17267. return l(r ? m - D : m + (6 - D), M);
  17268. case a:
  17269. case d: return $(v + "Hours", 0);
  17270. case u: return $(v + "Minutes", 1);
  17271. case s: return $(v + "Seconds", 2);
  17272. case i: return $(v + "Milliseconds", 3);
  17273. default: return this.clone();
  17274. }
  17275. }, m.endOf = function(t) {
  17276. return this.startOf(t, !1);
  17277. }, m.$set = function(t, e) {
  17278. var n, o = b.p(t), f = "set" + (this.$u ? "UTC" : ""), l = (n = {}, n[a] = f + "Date", n[d] = f + "Date", n[c] = f + "Month", n[h] = f + "FullYear", n[u] = f + "Hours", n[s] = f + "Minutes", n[i] = f + "Seconds", n[r] = f + "Milliseconds", n)[o], $ = o === a ? this.$D + (e - this.$W) : e;
  17279. if (o === c || o === h) {
  17280. var y = this.clone().set(d, 1);
  17281. y.$d[l]($), y.init(), this.$d = y.set(d, Math.min(this.$D, y.daysInMonth())).$d;
  17282. } else l && this.$d[l]($);
  17283. return this.init(), this;
  17284. }, m.set = function(t, e) {
  17285. return this.clone().$set(t, e);
  17286. }, m.get = function(t) {
  17287. return this[b.p(t)]();
  17288. }, m.add = function(r, f) {
  17289. var d, l = this;
  17290. r = Number(r);
  17291. var $ = b.p(f), y = function(t) {
  17292. var e = O(l);
  17293. return b.w(e.date(e.date() + Math.round(t * r)), l);
  17294. };
  17295. if ($ === c) return this.set(c, this.$M + r);
  17296. if ($ === h) return this.set(h, this.$y + r);
  17297. if ($ === a) return y(1);
  17298. if ($ === o) return y(7);
  17299. var M = (d = {}, d[s] = e, d[u] = n, d[i] = t, d)[$] || 1, m = this.$d.getTime() + r * M;
  17300. return b.w(m, this);
  17301. }, m.subtract = function(t, e) {
  17302. return this.add(-1 * t, e);
  17303. }, m.format = function(t) {
  17304. var e = this, n = this.$locale();
  17305. if (!this.isValid()) return n.invalidDate || l;
  17306. var r = t || "YYYY-MM-DDTHH:mm:ssZ", i = b.z(this), s = this.$H, u = this.$m, a = this.$M, o = n.weekdays, c = n.months, f = n.meridiem, h = function(t, n, i, s) {
  17307. return t && (t[n] || t(e, r)) || i[n].slice(0, s);
  17308. }, d = function(t) {
  17309. return b.s(s % 12 || 12, t, "0");
  17310. }, $ = f || function(t, e, n) {
  17311. var r = t < 12 ? "AM" : "PM";
  17312. return n ? r.toLowerCase() : r;
  17313. };
  17314. return r.replace(y, (function(t, r) {
  17315. return r || function(t) {
  17316. switch (t) {
  17317. case "YY": return String(e.$y).slice(-2);
  17318. case "YYYY": return b.s(e.$y, 4, "0");
  17319. case "M": return a + 1;
  17320. case "MM": return b.s(a + 1, 2, "0");
  17321. case "MMM": return h(n.monthsShort, a, c, 3);
  17322. case "MMMM": return h(c, a);
  17323. case "D": return e.$D;
  17324. case "DD": return b.s(e.$D, 2, "0");
  17325. case "d": return String(e.$W);
  17326. case "dd": return h(n.weekdaysMin, e.$W, o, 2);
  17327. case "ddd": return h(n.weekdaysShort, e.$W, o, 3);
  17328. case "dddd": return o[e.$W];
  17329. case "H": return String(s);
  17330. case "HH": return b.s(s, 2, "0");
  17331. case "h": return d(1);
  17332. case "hh": return d(2);
  17333. case "a": return $(s, u, !0);
  17334. case "A": return $(s, u, !1);
  17335. case "m": return String(u);
  17336. case "mm": return b.s(u, 2, "0");
  17337. case "s": return String(e.$s);
  17338. case "ss": return b.s(e.$s, 2, "0");
  17339. case "SSS": return b.s(e.$ms, 3, "0");
  17340. case "Z": return i;
  17341. }
  17342. return null;
  17343. }(t) || i.replace(":", "");
  17344. }));
  17345. }, m.utcOffset = function() {
  17346. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  17347. }, m.diff = function(r, d, l) {
  17348. var $, y = this, M = b.p(d), m = O(r), v = (m.utcOffset() - this.utcOffset()) * e, g = this - m, D = function() {
  17349. return b.m(y, m);
  17350. };
  17351. switch (M) {
  17352. case h:
  17353. $ = D() / 12;
  17354. break;
  17355. case c:
  17356. $ = D();
  17357. break;
  17358. case f:
  17359. $ = D() / 3;
  17360. break;
  17361. case o:
  17362. $ = (g - v) / 6048e5;
  17363. break;
  17364. case a:
  17365. $ = (g - v) / 864e5;
  17366. break;
  17367. case u:
  17368. $ = g / n;
  17369. break;
  17370. case s:
  17371. $ = g / e;
  17372. break;
  17373. case i:
  17374. $ = g / t;
  17375. break;
  17376. default: $ = g;
  17377. }
  17378. return l ? $ : b.a($);
  17379. }, m.daysInMonth = function() {
  17380. return this.endOf(c).$D;
  17381. }, m.$locale = function() {
  17382. return D[this.$L];
  17383. }, m.locale = function(t, e) {
  17384. if (!t) return this.$L;
  17385. var n = this.clone(), r = w(t, e, !0);
  17386. return r && (n.$L = r), n;
  17387. }, m.clone = function() {
  17388. return b.w(this.$d, this);
  17389. }, m.toDate = function() {
  17390. return new Date(this.valueOf());
  17391. }, m.toJSON = function() {
  17392. return this.isValid() ? this.toISOString() : null;
  17393. }, m.toISOString = function() {
  17394. return this.$d.toISOString();
  17395. }, m.toString = function() {
  17396. return this.$d.toUTCString();
  17397. }, M;
  17398. }(), k = _.prototype;
  17399. return O.prototype = k, [
  17400. ["$ms", r],
  17401. ["$s", i],
  17402. ["$m", s],
  17403. ["$H", u],
  17404. ["$W", a],
  17405. ["$M", c],
  17406. ["$y", h],
  17407. ["$D", d]
  17408. ].forEach((function(t) {
  17409. k[t[1]] = function(e) {
  17410. return this.$g(e, t[0], t[1]);
  17411. };
  17412. })), O.extend = function(t, e) {
  17413. return t.$i || (t(e, _, O), t.$i = !0), O;
  17414. }, O.locale = w, O.isDayjs = S, O.unix = function(t) {
  17415. return O(1e3 * t);
  17416. }, O.en = D[g], O.Ls = D, O.p = {}, O;
  17417. }));
  17418. }));
  17419. //#endregion
  17420. //#region ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/customParseFormat.js
  17421. var require_customParseFormat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  17422. (function(e, t) {
  17423. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_customParseFormat = t();
  17424. })(exports, (function() {
  17425. "use strict";
  17426. var e = {
  17427. LTS: "h:mm:ss A",
  17428. LT: "h:mm A",
  17429. L: "MM/DD/YYYY",
  17430. LL: "MMMM D, YYYY",
  17431. LLL: "MMMM D, YYYY h:mm A",
  17432. LLLL: "dddd, MMMM D, YYYY h:mm A"
  17433. }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, s = {}, a = function(e) {
  17434. return (e = +e) + (e > 68 ? 1900 : 2e3);
  17435. };
  17436. var f = function(e) {
  17437. return function(t) {
  17438. this[e] = +t;
  17439. };
  17440. }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e) {
  17441. (this.zone || (this.zone = {})).offset = function(e) {
  17442. if (!e) return 0;
  17443. if ("Z" === e) return 0;
  17444. var t = e.match(/([+-]|\d\d)/g), n = 60 * t[1] + (+t[2] || 0);
  17445. return 0 === n ? 0 : "+" === t[0] ? -n : n;
  17446. }(e);
  17447. }], u = function(e) {
  17448. var t = s[e];
  17449. return t && (t.indexOf ? t : t.s.concat(t.f));
  17450. }, d = function(e, t) {
  17451. var n, r = s.meridiem;
  17452. if (r) {
  17453. for (var i = 1; i <= 24; i += 1) if (e.indexOf(r(i, 0, t)) > -1) {
  17454. n = i > 12;
  17455. break;
  17456. }
  17457. } else n = e === (t ? "pm" : "PM");
  17458. return n;
  17459. }, c = {
  17460. A: [o, function(e) {
  17461. this.afternoon = d(e, !1);
  17462. }],
  17463. a: [o, function(e) {
  17464. this.afternoon = d(e, !0);
  17465. }],
  17466. Q: [n, function(e) {
  17467. this.month = 3 * (e - 1) + 1;
  17468. }],
  17469. S: [n, function(e) {
  17470. this.milliseconds = 100 * +e;
  17471. }],
  17472. SS: [r, function(e) {
  17473. this.milliseconds = 10 * +e;
  17474. }],
  17475. SSS: [/\d{3}/, function(e) {
  17476. this.milliseconds = +e;
  17477. }],
  17478. s: [i, f("seconds")],
  17479. ss: [i, f("seconds")],
  17480. m: [i, f("minutes")],
  17481. mm: [i, f("minutes")],
  17482. H: [i, f("hours")],
  17483. h: [i, f("hours")],
  17484. HH: [i, f("hours")],
  17485. hh: [i, f("hours")],
  17486. D: [i, f("day")],
  17487. DD: [r, f("day")],
  17488. Do: [o, function(e) {
  17489. var t = s.ordinal;
  17490. if (this.day = e.match(/\d+/)[0], t) for (var r = 1; r <= 31; r += 1) t(r).replace(/\[|\]/g, "") === e && (this.day = r);
  17491. }],
  17492. w: [i, f("week")],
  17493. ww: [r, f("week")],
  17494. M: [i, f("month")],
  17495. MM: [r, f("month")],
  17496. MMM: [o, function(e) {
  17497. var t = u("months"), n = (u("monthsShort") || t.map((function(e) {
  17498. return e.slice(0, 3);
  17499. }))).indexOf(e) + 1;
  17500. if (n < 1) throw new Error();
  17501. this.month = n % 12 || n;
  17502. }],
  17503. MMMM: [o, function(e) {
  17504. var t = u("months").indexOf(e) + 1;
  17505. if (t < 1) throw new Error();
  17506. this.month = t % 12 || t;
  17507. }],
  17508. Y: [/[+-]?\d+/, f("year")],
  17509. YY: [r, function(e) {
  17510. this.year = a(e);
  17511. }],
  17512. YYYY: [/\d{4}/, f("year")],
  17513. Z: h,
  17514. ZZ: h
  17515. };
  17516. function l(n) {
  17517. var r = n, i = s && s.formats;
  17518. for (var o = (n = r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t, n, r) {
  17519. var o = r && r.toUpperCase();
  17520. return n || i[r] || e[r] || i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e, t, n) {
  17521. return t || n.slice(1);
  17522. }));
  17523. }))).match(t), a = o.length, f = 0; f < a; f += 1) {
  17524. var h = o[f], u = c[h], d = u && u[0], l = u && u[1];
  17525. o[f] = l ? {
  17526. regex: d,
  17527. parser: l
  17528. } : h.replace(/^\[|\]$/g, "");
  17529. }
  17530. return function(e) {
  17531. for (var t = {}, n = 0, r = 0; n < a; n += 1) {
  17532. var i = o[n];
  17533. if ("string" == typeof i) r += i.length;
  17534. else {
  17535. var s = i.regex, f = i.parser, h = e.slice(r), u = s.exec(h)[0];
  17536. f.call(t, u), e = e.replace(u, "");
  17537. }
  17538. }
  17539. return function(e) {
  17540. var t = e.afternoon;
  17541. if (void 0 !== t) {
  17542. var n = e.hours;
  17543. t ? n < 12 && (e.hours += 12) : 12 === n && (e.hours = 0), delete e.afternoon;
  17544. }
  17545. }(t), t;
  17546. };
  17547. }
  17548. return function(e, t, n) {
  17549. n.p.customParseFormat = !0, e && e.parseTwoDigitYear && (a = e.parseTwoDigitYear);
  17550. var r = t.prototype, i = r.parse;
  17551. r.parse = function(e) {
  17552. var t = e.date, r = e.utc, o = e.args;
  17553. this.$u = r;
  17554. var a = o[1];
  17555. if ("string" == typeof a) {
  17556. var f = !0 === o[2], h = !0 === o[3], u = f || h, d = o[2];
  17557. h && (d = o[2]), s = this.$locale(), !f && d && (s = n.Ls[d]), this.$d = function(e, t, n, r) {
  17558. try {
  17559. if (["x", "X"].indexOf(t) > -1) return /* @__PURE__ */ new Date(("X" === t ? 1e3 : 1) * e);
  17560. var i = l(t)(e), o = i.year, s = i.month, a = i.day, f = i.hours, h = i.minutes, u = i.seconds, d = i.milliseconds, c = i.zone, m = i.week, M = /* @__PURE__ */ new Date(), Y = a || (o || s ? 1 : M.getDate()), p = o || M.getFullYear(), v = 0;
  17561. o && !s || (v = s > 0 ? s - 1 : M.getMonth());
  17562. var D, w = f || 0, g = h || 0, y = u || 0, L = d || 0;
  17563. return c ? new Date(Date.UTC(p, v, Y, w, g, y, L + 60 * c.offset * 1e3)) : n ? new Date(Date.UTC(p, v, Y, w, g, y, L)) : (D = new Date(p, v, Y, w, g, y, L), m && (D = r(D).week(m).toDate()), D);
  17564. } catch (e) {
  17565. return /* @__PURE__ */ new Date("");
  17566. }
  17567. }(t, a, r, n), this.init(), d && !0 !== d && (this.$L = this.locale(d).$L), u && t != this.format(a) && (this.$d = /* @__PURE__ */ new Date("")), s = {};
  17568. } else if (a instanceof Array) for (var c = a.length, m = 1; m <= c; m += 1) {
  17569. o[1] = a[m - 1];
  17570. var M = n.apply(this, o);
  17571. if (M.isValid()) {
  17572. this.$d = M.$d, this.$L = M.$L, this.init();
  17573. break;
  17574. }
  17575. m === c && (this.$d = /* @__PURE__ */ new Date(""));
  17576. }
  17577. else i.call(this, e);
  17578. };
  17579. };
  17580. }));
  17581. }));
  17582. //#endregion
  17583. //#region ../../packages/components/time-picker/src/constants.ts
  17584. var import_customParseFormat = /* @__PURE__ */ __toESM(require_customParseFormat());
  17585. var import_dayjs_min = /* @__PURE__ */ __toESM(require_dayjs_min());
  17586. const timeUnits = [
  17587. "hours",
  17588. "minutes",
  17589. "seconds"
  17590. ];
  17591. const PICKER_BASE_INJECTION_KEY = "EP_PICKER_BASE";
  17592. const PICKER_POPPER_OPTIONS_INJECTION_KEY = "ElPopperOptions";
  17593. const ROOT_COMMON_PICKER_INJECTION_KEY = Symbol("commonPickerContextKey");
  17594. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  17595. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  17596. const DEFAULT_FORMATS_DATEPICKER = {
  17597. date: DEFAULT_FORMATS_DATE,
  17598. dates: DEFAULT_FORMATS_DATE,
  17599. week: "gggg[w]ww",
  17600. year: "YYYY",
  17601. years: "YYYY",
  17602. month: "YYYY-MM",
  17603. months: "YYYY-MM",
  17604. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  17605. monthrange: "YYYY-MM",
  17606. yearrange: "YYYY",
  17607. daterange: DEFAULT_FORMATS_DATE,
  17608. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  17609. };
  17610. //#endregion
  17611. //#region ../../packages/components/time-picker/src/utils.ts
  17612. const buildTimeList = (value, bound) => {
  17613. return [
  17614. value > 0 ? value - 1 : void 0,
  17615. value,
  17616. value < bound ? value + 1 : void 0
  17617. ];
  17618. };
  17619. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  17620. const extractDateFormat = (format) => {
  17621. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  17622. };
  17623. const extractTimeFormat = (format) => {
  17624. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  17625. };
  17626. const dateEquals = function(a, b) {
  17627. const aIsDate = isDate(a);
  17628. const bIsDate = isDate(b);
  17629. if (aIsDate && bIsDate) return a.getTime() === b.getTime();
  17630. if (!aIsDate && !bIsDate) return a === b;
  17631. return false;
  17632. };
  17633. const valueEquals = function(a, b) {
  17634. const aIsArray = isArray$1(a);
  17635. const bIsArray = isArray$1(b);
  17636. if (aIsArray && bIsArray) {
  17637. if (a.length !== b.length) return false;
  17638. return a.every((item, index) => dateEquals(item, b[index]));
  17639. }
  17640. if (!aIsArray && !bIsArray) return dateEquals(a, b);
  17641. return false;
  17642. };
  17643. const parseDate = function(date, format, lang) {
  17644. const day = isEmpty(format) || format === "x" ? (0, import_dayjs_min.default)(date).locale(lang) : (0, import_dayjs_min.default)(date, format).locale(lang);
  17645. return day.isValid() ? day : void 0;
  17646. };
  17647. const formatter = function(date, format, lang) {
  17648. if (isEmpty(format)) return date;
  17649. if (format === "x") return +date;
  17650. return (0, import_dayjs_min.default)(date).locale(lang).format(format);
  17651. };
  17652. const makeList = (total, method) => {
  17653. const arr = [];
  17654. const disabledArr = method?.();
  17655. for (let i = 0; i < total; i++) arr.push(disabledArr?.includes(i) ?? false);
  17656. return arr;
  17657. };
  17658. const dayOrDaysToDate = (dayOrDays) => {
  17659. return isArray$1(dayOrDays) ? dayOrDays.map((d) => d.toDate()) : dayOrDays.toDate();
  17660. };
  17661. //#endregion
  17662. //#region ../../packages/components/time-picker/src/composables/use-common-picker.ts
  17663. const useCommonPicker = (props, emit) => {
  17664. const { lang } = useLocale();
  17665. const pickerVisible = ref(false);
  17666. const pickerActualVisible = ref(false);
  17667. const userInput = ref(null);
  17668. const valueIsEmpty = computed(() => {
  17669. const { modelValue } = props;
  17670. return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length;
  17671. });
  17672. const emitInput = (input) => {
  17673. if (!valueEquals(props.modelValue, input)) {
  17674. let formatted;
  17675. if (isArray$1(input)) formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  17676. else if (input) formatted = formatter(input, props.valueFormat, lang.value);
  17677. emit(UPDATE_MODEL_EVENT, input ? formatted : input, lang.value);
  17678. }
  17679. };
  17680. const parsedValue = computed(() => {
  17681. let dayOrDays;
  17682. if (valueIsEmpty.value) {
  17683. if (pickerOptions.value.getDefaultValue) dayOrDays = pickerOptions.value.getDefaultValue();
  17684. } else if (isArray$1(props.modelValue)) dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  17685. else dayOrDays = parseDate(props.modelValue ?? "", props.valueFormat, lang.value);
  17686. if (pickerOptions.value.getRangeAvailableTime) {
  17687. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  17688. if (!isEqual$1(availableResult, dayOrDays)) {
  17689. dayOrDays = availableResult;
  17690. if (!valueIsEmpty.value) emitInput(dayOrDaysToDate(dayOrDays));
  17691. }
  17692. }
  17693. if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) dayOrDays = [];
  17694. return dayOrDays;
  17695. });
  17696. const pickerOptions = ref({});
  17697. const onSetPickerOption = (e) => {
  17698. pickerOptions.value[e[0]] = e[1];
  17699. pickerOptions.value.panelReady = true;
  17700. };
  17701. const onCalendarChange = (e) => {
  17702. emit("calendar-change", e);
  17703. };
  17704. const onPanelChange = (value, mode, view) => {
  17705. emit("panel-change", value, mode, view);
  17706. };
  17707. const onPick = (date = "", visible = false) => {
  17708. pickerVisible.value = visible;
  17709. let result;
  17710. if (isArray$1(date)) result = date.map((_) => _.toDate());
  17711. else result = date ? date.toDate() : date;
  17712. userInput.value = null;
  17713. emitInput(result);
  17714. };
  17715. return {
  17716. parsedValue,
  17717. pickerActualVisible,
  17718. pickerOptions,
  17719. pickerVisible,
  17720. userInput,
  17721. valueIsEmpty,
  17722. emitInput,
  17723. onCalendarChange,
  17724. onPanelChange,
  17725. onPick,
  17726. onSetPickerOption
  17727. };
  17728. };
  17729. //#endregion
  17730. //#region ../../packages/components/time-picker/src/props/shared.ts
  17731. const disabledTimeListsProps = buildProps({
  17732. disabledHours: { type: definePropType(Function) },
  17733. disabledMinutes: { type: definePropType(Function) },
  17734. disabledSeconds: { type: definePropType(Function) }
  17735. });
  17736. const timePanelSharedProps = buildProps({
  17737. visible: Boolean,
  17738. actualVisible: {
  17739. type: Boolean,
  17740. default: void 0
  17741. },
  17742. format: {
  17743. type: String,
  17744. default: ""
  17745. }
  17746. });
  17747. //#endregion
  17748. //#region ../../packages/components/time-picker/src/common/props.ts
  17749. const timePickerDefaultProps = buildProps({
  17750. automaticDropdown: {
  17751. type: Boolean,
  17752. default: true
  17753. },
  17754. id: { type: definePropType([Array, String]) },
  17755. name: { type: definePropType([Array, String]) },
  17756. popperClass: useTooltipContentProps.popperClass,
  17757. popperStyle: useTooltipContentProps.popperStyle,
  17758. format: String,
  17759. valueFormat: String,
  17760. dateFormat: String,
  17761. timeFormat: String,
  17762. type: {
  17763. type: String,
  17764. default: ""
  17765. },
  17766. clearable: {
  17767. type: Boolean,
  17768. default: true
  17769. },
  17770. clearIcon: {
  17771. type: definePropType([String, Object]),
  17772. default: circle_close_default
  17773. },
  17774. editable: {
  17775. type: Boolean,
  17776. default: true
  17777. },
  17778. saveOnBlur: {
  17779. type: Boolean,
  17780. default: true
  17781. },
  17782. prefixIcon: {
  17783. type: definePropType([String, Object]),
  17784. default: ""
  17785. },
  17786. size: useSizeProp,
  17787. readonly: Boolean,
  17788. disabled: {
  17789. type: Boolean,
  17790. default: void 0
  17791. },
  17792. placeholder: {
  17793. type: String,
  17794. default: ""
  17795. },
  17796. popperOptions: {
  17797. type: definePropType(Object),
  17798. default: () => ({})
  17799. },
  17800. modelValue: {
  17801. type: definePropType([
  17802. Date,
  17803. Array,
  17804. String,
  17805. Number
  17806. ]),
  17807. default: ""
  17808. },
  17809. rangeSeparator: {
  17810. type: String,
  17811. default: "-"
  17812. },
  17813. startPlaceholder: String,
  17814. endPlaceholder: String,
  17815. defaultValue: { type: definePropType([Date, Array]) },
  17816. defaultTime: { type: definePropType([Date, Array]) },
  17817. isRange: Boolean,
  17818. ...disabledTimeListsProps,
  17819. disabledDate: { type: Function },
  17820. cellClassName: { type: Function },
  17821. shortcuts: {
  17822. type: Array,
  17823. default: () => []
  17824. },
  17825. arrowControl: Boolean,
  17826. tabindex: {
  17827. type: definePropType([String, Number]),
  17828. default: 0
  17829. },
  17830. validateEvent: {
  17831. type: Boolean,
  17832. default: true
  17833. },
  17834. unlinkPanels: Boolean,
  17835. placement: {
  17836. type: definePropType(String),
  17837. values: Ee,
  17838. default: "bottom"
  17839. },
  17840. fallbackPlacements: {
  17841. type: definePropType(Array),
  17842. default: [
  17843. "bottom",
  17844. "top",
  17845. "right",
  17846. "left"
  17847. ]
  17848. },
  17849. ...useEmptyValuesProps,
  17850. ...useAriaProps(["ariaLabel"]),
  17851. showNow: {
  17852. type: Boolean,
  17853. default: true
  17854. },
  17855. showConfirm: {
  17856. type: Boolean,
  17857. default: true
  17858. },
  17859. showFooter: {
  17860. type: Boolean,
  17861. default: true
  17862. },
  17863. showWeekNumber: Boolean
  17864. });
  17865. const timePickerRangeTriggerProps = buildProps({
  17866. id: { type: definePropType(Array) },
  17867. name: { type: definePropType(Array) },
  17868. modelValue: { type: definePropType([Array, String]) },
  17869. startPlaceholder: String,
  17870. endPlaceholder: String,
  17871. disabled: Boolean
  17872. });
  17873. /**
  17874. * @deprecated Use `timePickerRangeTriggerProps` instead. This will be removed in future versions.
  17875. */
  17876. const timePickerRngeTriggerProps = timePickerRangeTriggerProps;
  17877. //#endregion
  17878. //#region ../../packages/components/time-picker/src/common/picker-range-trigger.vue?vue&type=script&setup=true&lang.ts
  17879. const _hoisted_1$71 = [
  17880. "id",
  17881. "name",
  17882. "placeholder",
  17883. "value",
  17884. "disabled"
  17885. ];
  17886. const _hoisted_2$40 = [
  17887. "id",
  17888. "name",
  17889. "placeholder",
  17890. "value",
  17891. "disabled"
  17892. ];
  17893. var picker_range_trigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  17894. name: "PickerRangeTrigger",
  17895. inheritAttrs: false,
  17896. __name: "picker-range-trigger",
  17897. props: timePickerRangeTriggerProps,
  17898. emits: [
  17899. "mouseenter",
  17900. "mouseleave",
  17901. "click",
  17902. "touchstart",
  17903. "focus",
  17904. "blur",
  17905. "startInput",
  17906. "endInput",
  17907. "startChange",
  17908. "endChange"
  17909. ],
  17910. setup(__props, { expose: __expose, emit: __emit }) {
  17911. const props = __props;
  17912. const emit = __emit;
  17913. const { formItem } = useFormItem();
  17914. const { inputId } = useFormItemInputId(reactive({ id: computed(() => props.id?.[0]) }), { formItemContext: formItem });
  17915. const attrs = useAttrs();
  17916. const nsDate = useNamespace("date");
  17917. const nsRange = useNamespace("range");
  17918. const inputRef = ref();
  17919. const endInputRef = ref();
  17920. const { wrapperRef, isFocused } = useFocusController(inputRef, { disabled: computed(() => props.disabled) });
  17921. const handleClick = (evt) => {
  17922. emit("click", evt);
  17923. };
  17924. const handleMouseEnter = (evt) => {
  17925. emit("mouseenter", evt);
  17926. };
  17927. const handleMouseLeave = (evt) => {
  17928. emit("mouseleave", evt);
  17929. };
  17930. const handleTouchStart = (evt) => {
  17931. emit("touchstart", evt);
  17932. };
  17933. const handleStartInput = (evt) => {
  17934. emit("startInput", evt);
  17935. };
  17936. const handleEndInput = (evt) => {
  17937. emit("endInput", evt);
  17938. };
  17939. const handleStartChange = (evt) => {
  17940. emit("startChange", evt);
  17941. };
  17942. const handleEndChange = (evt) => {
  17943. emit("endChange", evt);
  17944. };
  17945. const focus = () => {
  17946. inputRef.value?.focus();
  17947. };
  17948. const blur = () => {
  17949. inputRef.value?.blur();
  17950. endInputRef.value?.blur();
  17951. };
  17952. __expose({
  17953. focus,
  17954. blur
  17955. });
  17956. return (_ctx, _cache) => {
  17957. return openBlock(), createElementBlock("div", {
  17958. ref_key: "wrapperRef",
  17959. ref: wrapperRef,
  17960. class: normalizeClass([unref(nsDate).is("active", unref(isFocused)), _ctx.$attrs.class]),
  17961. style: normalizeStyle(_ctx.$attrs.style),
  17962. onClick: handleClick,
  17963. onMouseenter: handleMouseEnter,
  17964. onMouseleave: handleMouseLeave,
  17965. onTouchstartPassive: handleTouchStart
  17966. }, [
  17967. renderSlot(_ctx.$slots, "prefix"),
  17968. createElementVNode("input", mergeProps(unref(attrs), {
  17969. id: unref(inputId),
  17970. ref_key: "inputRef",
  17971. ref: inputRef,
  17972. name: _ctx.name && _ctx.name[0],
  17973. placeholder: _ctx.startPlaceholder,
  17974. value: _ctx.modelValue && _ctx.modelValue[0],
  17975. class: unref(nsRange).b("input"),
  17976. disabled: _ctx.disabled,
  17977. onInput: handleStartInput,
  17978. onChange: handleStartChange
  17979. }), null, 16, _hoisted_1$71),
  17980. renderSlot(_ctx.$slots, "range-separator"),
  17981. createElementVNode("input", mergeProps(unref(attrs), {
  17982. id: _ctx.id && _ctx.id[1],
  17983. ref_key: "endInputRef",
  17984. ref: endInputRef,
  17985. name: _ctx.name && _ctx.name[1],
  17986. placeholder: _ctx.endPlaceholder,
  17987. value: _ctx.modelValue && _ctx.modelValue[1],
  17988. class: unref(nsRange).b("input"),
  17989. disabled: _ctx.disabled,
  17990. onInput: handleEndInput,
  17991. onChange: handleEndChange
  17992. }), null, 16, _hoisted_2$40),
  17993. renderSlot(_ctx.$slots, "suffix")
  17994. ], 38);
  17995. };
  17996. }
  17997. });
  17998. //#endregion
  17999. //#region ../../packages/components/time-picker/src/common/picker-range-trigger.vue
  18000. var picker_range_trigger_default = picker_range_trigger_vue_vue_type_script_setup_true_lang_default;
  18001. //#endregion
  18002. //#region ../../packages/components/time-picker/src/common/picker.vue?vue&type=script&setup=true&lang.ts
  18003. var picker_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  18004. name: "Picker",
  18005. __name: "picker",
  18006. props: timePickerDefaultProps,
  18007. emits: [
  18008. UPDATE_MODEL_EVENT,
  18009. CHANGE_EVENT,
  18010. "focus",
  18011. "blur",
  18012. "clear",
  18013. "calendar-change",
  18014. "panel-change",
  18015. "visible-change",
  18016. "keydown"
  18017. ],
  18018. setup(__props, { expose: __expose, emit: __emit }) {
  18019. const props = __props;
  18020. const emit = __emit;
  18021. const attrs = useAttrs$1();
  18022. const nsDate = useNamespace("date");
  18023. const nsInput = useNamespace("input");
  18024. const nsRange = useNamespace("range");
  18025. const { formItem } = useFormItem();
  18026. const elPopperOptions = inject(PICKER_POPPER_OPTIONS_INJECTION_KEY, {});
  18027. const emptyValues = useEmptyValues(props, null);
  18028. const refPopper = ref();
  18029. const inputRef = ref();
  18030. const valueOnOpen = ref(null);
  18031. let hasJustTabExitedInput = false;
  18032. const pickerDisabled = useFormDisabled();
  18033. const commonPicker = useCommonPicker(props, emit);
  18034. const { parsedValue, pickerActualVisible, userInput, pickerVisible, pickerOptions, valueIsEmpty, emitInput, onPick, onSetPickerOption, onCalendarChange, onPanelChange } = commonPicker;
  18035. const { isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
  18036. disabled: pickerDisabled,
  18037. beforeFocus() {
  18038. return props.readonly;
  18039. },
  18040. afterFocus() {
  18041. if (!props.automaticDropdown) return;
  18042. pickerVisible.value = true;
  18043. },
  18044. beforeBlur(event) {
  18045. return !hasJustTabExitedInput && refPopper.value?.isFocusInsideContent(event);
  18046. },
  18047. afterBlur() {
  18048. if (isTimePicker.value && !props.saveOnBlur) {
  18049. if (!valueIsEmpty.value) pickerOptions.value.handleCancel?.();
  18050. } else handleChange();
  18051. pickerVisible.value = false;
  18052. hasJustTabExitedInput = false;
  18053. props.validateEvent && formItem?.validate("blur").catch((err) => /* @__PURE__ */ debugWarn(err));
  18054. }
  18055. });
  18056. const hovering = ref(false);
  18057. const rangeInputKls = computed(() => [
  18058. nsDate.b("editor"),
  18059. nsDate.bm("editor", props.type),
  18060. nsInput.e("wrapper"),
  18061. nsDate.is("disabled", pickerDisabled.value),
  18062. nsDate.is("active", pickerVisible.value),
  18063. nsRange.b("editor"),
  18064. pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
  18065. attrs.class
  18066. ]);
  18067. const clearIconKls = computed(() => [
  18068. nsInput.e("icon"),
  18069. nsRange.e("close-icon"),
  18070. !showClearBtn.value ? nsRange.em("close-icon", "hidden") : ""
  18071. ]);
  18072. watch(pickerVisible, (val) => {
  18073. if (!val) {
  18074. userInput.value = null;
  18075. nextTick(() => {
  18076. emitChange(props.modelValue);
  18077. });
  18078. } else nextTick(() => {
  18079. if (val) valueOnOpen.value = props.modelValue;
  18080. });
  18081. });
  18082. const emitChange = (val, isClear) => {
  18083. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  18084. emit(CHANGE_EVENT, val);
  18085. isClear && (valueOnOpen.value = val);
  18086. props.validateEvent && formItem?.validate("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  18087. }
  18088. };
  18089. const emitKeydown = (e) => {
  18090. emit("keydown", e);
  18091. };
  18092. const refInput = computed(() => {
  18093. if (inputRef.value) return Array.from(inputRef.value.$el.querySelectorAll("input"));
  18094. return [];
  18095. });
  18096. const setSelectionRange = (start, end, pos) => {
  18097. const _inputs = refInput.value;
  18098. if (!_inputs.length) return;
  18099. if (!pos || pos === "min") {
  18100. _inputs[0].setSelectionRange(start, end);
  18101. _inputs[0].focus();
  18102. } else if (pos === "max") {
  18103. _inputs[1].setSelectionRange(start, end);
  18104. _inputs[1].focus();
  18105. }
  18106. };
  18107. const onBeforeShow = () => {
  18108. pickerActualVisible.value = true;
  18109. };
  18110. const onShow = () => {
  18111. emit("visible-change", true);
  18112. };
  18113. const onHide = () => {
  18114. pickerActualVisible.value = false;
  18115. pickerVisible.value = false;
  18116. emit("visible-change", false);
  18117. };
  18118. const handleOpen = () => {
  18119. pickerVisible.value = true;
  18120. };
  18121. const handleClose = () => {
  18122. pickerVisible.value = false;
  18123. };
  18124. const displayValue = computed(() => {
  18125. const formattedValue = formatToString(parsedValue.value);
  18126. if (isArray$1(userInput.value)) return [userInput.value[0] || formattedValue && formattedValue[0] || "", userInput.value[1] || formattedValue && formattedValue[1] || ""];
  18127. else if (userInput.value !== null) return userInput.value;
  18128. if (isTimePicker.value && valueIsEmpty.value && !props.saveOnBlur) return "";
  18129. if (!isTimePicker.value && valueIsEmpty.value) return "";
  18130. if (!pickerVisible.value && valueIsEmpty.value) return "";
  18131. if (formattedValue) return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
  18132. return "";
  18133. });
  18134. const isTimeLikePicker = computed(() => props.type.includes("time"));
  18135. const isTimePicker = computed(() => props.type.startsWith("time"));
  18136. const isDatesPicker = computed(() => props.type === "dates");
  18137. const isMonthsPicker = computed(() => props.type === "months");
  18138. const isYearsPicker = computed(() => props.type === "years");
  18139. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default$1));
  18140. const showClearBtn = computed(() => props.clearable && !pickerDisabled.value && !props.readonly && !valueIsEmpty.value && (hovering.value || isFocused.value));
  18141. const onClear = (event) => {
  18142. if (props.readonly || pickerDisabled.value) return;
  18143. if (showClearBtn.value) {
  18144. event?.stopPropagation();
  18145. if (pickerOptions.value.handleClear) pickerOptions.value.handleClear();
  18146. else emitInput(emptyValues.valueOnClear.value);
  18147. emitChange(emptyValues.valueOnClear.value, true);
  18148. onHide();
  18149. }
  18150. emit("clear");
  18151. };
  18152. const onMouseDownInput = async (event) => {
  18153. if (props.readonly || pickerDisabled.value) return;
  18154. if (event.target?.tagName !== "INPUT" || isFocused.value || !props.automaticDropdown) pickerVisible.value = true;
  18155. };
  18156. const onMouseEnter = () => {
  18157. if (props.readonly || pickerDisabled.value) return;
  18158. if (!valueIsEmpty.value && props.clearable) hovering.value = true;
  18159. };
  18160. const onMouseLeave = () => {
  18161. hovering.value = false;
  18162. };
  18163. const onTouchStartInput = (event) => {
  18164. if (props.readonly || pickerDisabled.value) return;
  18165. if (event.touches[0].target?.tagName !== "INPUT" || isFocused.value || !props.automaticDropdown) pickerVisible.value = true;
  18166. };
  18167. const isRangeInput = computed(() => {
  18168. return props.type.includes("range");
  18169. });
  18170. const pickerSize = useFormSize();
  18171. const popperEl = computed(() => unref(refPopper)?.popperRef?.contentRef);
  18172. const stophandle = onClickOutside(inputRef, (e) => {
  18173. const unrefedPopperEl = unref(popperEl);
  18174. const inputEl = unrefElement(inputRef);
  18175. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || inputEl && e.composedPath().includes(inputEl)) return;
  18176. pickerVisible.value = false;
  18177. });
  18178. onBeforeUnmount(() => {
  18179. stophandle?.();
  18180. });
  18181. const handleChange = () => {
  18182. if (isTimePicker.value && !props.saveOnBlur) return;
  18183. if (userInput.value) {
  18184. const value = parseUserInputToDayjs(displayValue.value);
  18185. if (value) {
  18186. if (isValidValue(value)) emitInput(dayOrDaysToDate(value));
  18187. userInput.value = null;
  18188. }
  18189. }
  18190. if (userInput.value === "") {
  18191. emitInput(emptyValues.valueOnClear.value);
  18192. emitChange(emptyValues.valueOnClear.value, true);
  18193. userInput.value = null;
  18194. }
  18195. };
  18196. const parseUserInputToDayjs = (value) => {
  18197. if (!value) return null;
  18198. return pickerOptions.value.parseUserInput(value);
  18199. };
  18200. const formatToString = (value) => {
  18201. if (!value) return null;
  18202. return isArray$1(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
  18203. };
  18204. const isValidValue = (value) => {
  18205. return pickerOptions.value.isValidValue(value);
  18206. };
  18207. const handleKeydownInput = async (event) => {
  18208. if (props.readonly || pickerDisabled.value) return;
  18209. const code = getEventCode(event);
  18210. emitKeydown(event);
  18211. if (code === EVENT_CODE.esc) {
  18212. if (pickerVisible.value === true) {
  18213. pickerVisible.value = false;
  18214. event.preventDefault();
  18215. event.stopPropagation();
  18216. }
  18217. return;
  18218. }
  18219. if (code === EVENT_CODE.down) {
  18220. if (pickerOptions.value.handleFocusPicker) {
  18221. event.preventDefault();
  18222. event.stopPropagation();
  18223. }
  18224. if (pickerVisible.value === false) {
  18225. pickerVisible.value = true;
  18226. await nextTick();
  18227. }
  18228. if (pickerOptions.value.handleFocusPicker) {
  18229. pickerOptions.value.handleFocusPicker();
  18230. return;
  18231. }
  18232. }
  18233. if (code === EVENT_CODE.tab) {
  18234. hasJustTabExitedInput = true;
  18235. return;
  18236. }
  18237. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  18238. if (!pickerVisible.value) pickerVisible.value = true;
  18239. else if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  18240. handleChange();
  18241. pickerVisible.value = false;
  18242. }
  18243. event.preventDefault();
  18244. event.stopPropagation();
  18245. return;
  18246. }
  18247. if (userInput.value) {
  18248. event.stopPropagation();
  18249. return;
  18250. }
  18251. if (pickerOptions.value.handleKeydownInput) pickerOptions.value.handleKeydownInput(event);
  18252. };
  18253. const onUserInput = (e) => {
  18254. userInput.value = e;
  18255. if (!pickerVisible.value) pickerVisible.value = true;
  18256. };
  18257. const handleStartInput = (event) => {
  18258. const target = event.target;
  18259. if (userInput.value) userInput.value = [target.value, userInput.value[1]];
  18260. else userInput.value = [target.value, null];
  18261. };
  18262. const handleEndInput = (event) => {
  18263. const target = event.target;
  18264. if (userInput.value) userInput.value = [userInput.value[0], target.value];
  18265. else userInput.value = [null, target.value];
  18266. };
  18267. const handleStartChange = () => {
  18268. const values = userInput.value;
  18269. const value = parseUserInputToDayjs(values && values[0]);
  18270. const parsedVal = unref(parsedValue);
  18271. if (value && value.isValid()) {
  18272. userInput.value = [formatToString(value), displayValue.value?.[1] || null];
  18273. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  18274. if (isValidValue(newValue)) {
  18275. emitInput(dayOrDaysToDate(newValue));
  18276. userInput.value = null;
  18277. }
  18278. }
  18279. };
  18280. const handleEndChange = () => {
  18281. const values = unref(userInput);
  18282. const value = parseUserInputToDayjs(values && values[1]);
  18283. const parsedVal = unref(parsedValue);
  18284. if (value && value.isValid()) {
  18285. userInput.value = [unref(displayValue)?.[0] || null, formatToString(value)];
  18286. const newValue = [parsedVal && parsedVal[0], value];
  18287. if (isValidValue(newValue)) {
  18288. emitInput(dayOrDaysToDate(newValue));
  18289. userInput.value = null;
  18290. }
  18291. }
  18292. };
  18293. const focus = () => {
  18294. inputRef.value?.focus();
  18295. };
  18296. const blur = () => {
  18297. inputRef.value?.blur();
  18298. };
  18299. provide(PICKER_BASE_INJECTION_KEY, {
  18300. props,
  18301. emptyValues
  18302. });
  18303. provide(ROOT_COMMON_PICKER_INJECTION_KEY, commonPicker);
  18304. __expose({
  18305. focus,
  18306. blur,
  18307. handleOpen,
  18308. handleClose,
  18309. onPick
  18310. });
  18311. return (_ctx, _cache) => {
  18312. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  18313. ref_key: "refPopper",
  18314. ref: refPopper,
  18315. visible: unref(pickerVisible),
  18316. effect: "light",
  18317. pure: "",
  18318. trigger: "click"
  18319. }, _ctx.$attrs, {
  18320. role: "dialog",
  18321. teleported: "",
  18322. transition: `${unref(nsDate).namespace.value}-zoom-in-top`,
  18323. "popper-class": [`${unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  18324. "popper-style": _ctx.popperStyle,
  18325. "popper-options": unref(elPopperOptions),
  18326. "fallback-placements": _ctx.fallbackPlacements,
  18327. "gpu-acceleration": false,
  18328. placement: _ctx.placement,
  18329. "stop-popper-mouse-event": false,
  18330. "hide-after": 0,
  18331. persistent: "",
  18332. onBeforeShow,
  18333. onShow,
  18334. onHide
  18335. }), {
  18336. default: withCtx(() => [!isRangeInput.value ? (openBlock(), createBlock(unref(ElInput), {
  18337. key: 0,
  18338. id: _ctx.id,
  18339. ref_key: "inputRef",
  18340. ref: inputRef,
  18341. "container-role": "combobox",
  18342. "model-value": displayValue.value,
  18343. name: _ctx.name,
  18344. size: unref(pickerSize),
  18345. disabled: unref(pickerDisabled),
  18346. placeholder: _ctx.placeholder,
  18347. class: normalizeClass([
  18348. unref(nsDate).b("editor"),
  18349. unref(nsDate).bm("editor", _ctx.type),
  18350. unref(nsDate).is("focus", unref(pickerVisible)),
  18351. _ctx.$attrs.class
  18352. ]),
  18353. style: normalizeStyle(_ctx.$attrs.style),
  18354. readonly: !_ctx.editable || _ctx.readonly || isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value || _ctx.type === "week",
  18355. "aria-label": _ctx.ariaLabel,
  18356. tabindex: _ctx.tabindex,
  18357. "validate-event": false,
  18358. onInput: onUserInput,
  18359. onFocus: unref(handleFocus),
  18360. onBlur: unref(handleBlur),
  18361. onKeydown: handleKeydownInput,
  18362. onChange: handleChange,
  18363. onMousedown: onMouseDownInput,
  18364. onMouseenter: onMouseEnter,
  18365. onMouseleave: onMouseLeave,
  18366. onTouchstartPassive: onTouchStartInput,
  18367. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  18368. }, {
  18369. prefix: withCtx(() => [triggerIcon.value ? (openBlock(), createBlock(unref(ElIcon), {
  18370. key: 0,
  18371. class: normalizeClass(unref(nsInput).e("icon")),
  18372. onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
  18373. onTouchstartPassive: onTouchStartInput
  18374. }, {
  18375. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(triggerIcon.value)))]),
  18376. _: 1
  18377. }, 8, ["class"])) : createCommentVNode("v-if", true)]),
  18378. suffix: withCtx(() => [showClearBtn.value && _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18379. key: 0,
  18380. class: normalizeClass(`${unref(nsInput).e("icon")} clear-icon`),
  18381. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  18382. onClick: onClear
  18383. }, {
  18384. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))]),
  18385. _: 1
  18386. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)]),
  18387. _: 1
  18388. }, 8, [
  18389. "id",
  18390. "model-value",
  18391. "name",
  18392. "size",
  18393. "disabled",
  18394. "placeholder",
  18395. "class",
  18396. "style",
  18397. "readonly",
  18398. "aria-label",
  18399. "tabindex",
  18400. "onFocus",
  18401. "onBlur"
  18402. ])) : (openBlock(), createBlock(picker_range_trigger_default, {
  18403. key: 1,
  18404. id: _ctx.id,
  18405. ref_key: "inputRef",
  18406. ref: inputRef,
  18407. "model-value": displayValue.value,
  18408. name: _ctx.name,
  18409. disabled: unref(pickerDisabled),
  18410. readonly: !_ctx.editable || _ctx.readonly,
  18411. "start-placeholder": _ctx.startPlaceholder,
  18412. "end-placeholder": _ctx.endPlaceholder,
  18413. class: normalizeClass(rangeInputKls.value),
  18414. style: normalizeStyle(_ctx.$attrs.style),
  18415. "aria-label": _ctx.ariaLabel,
  18416. tabindex: _ctx.tabindex,
  18417. autocomplete: "off",
  18418. role: "combobox",
  18419. onClick: onMouseDownInput,
  18420. onFocus: unref(handleFocus),
  18421. onBlur: unref(handleBlur),
  18422. onStartInput: handleStartInput,
  18423. onStartChange: handleStartChange,
  18424. onEndInput: handleEndInput,
  18425. onEndChange: handleEndChange,
  18426. onMousedown: onMouseDownInput,
  18427. onMouseenter: onMouseEnter,
  18428. onMouseleave: onMouseLeave,
  18429. onTouchstartPassive: onTouchStartInput,
  18430. onKeydown: handleKeydownInput
  18431. }, {
  18432. prefix: withCtx(() => [triggerIcon.value ? (openBlock(), createBlock(unref(ElIcon), {
  18433. key: 0,
  18434. class: normalizeClass([unref(nsInput).e("icon"), unref(nsRange).e("icon")])
  18435. }, {
  18436. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(triggerIcon.value)))]),
  18437. _: 1
  18438. }, 8, ["class"])) : createCommentVNode("v-if", true)]),
  18439. "range-separator": withCtx(() => [renderSlot(_ctx.$slots, "range-separator", {}, () => [createElementVNode("span", { class: normalizeClass(unref(nsRange).b("separator")) }, toDisplayString(_ctx.rangeSeparator), 3)])]),
  18440. suffix: withCtx(() => [_ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18441. key: 0,
  18442. class: normalizeClass(clearIconKls.value),
  18443. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  18444. onClick: onClear
  18445. }, {
  18446. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))]),
  18447. _: 1
  18448. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)]),
  18449. _: 3
  18450. }, 8, [
  18451. "id",
  18452. "model-value",
  18453. "name",
  18454. "disabled",
  18455. "readonly",
  18456. "start-placeholder",
  18457. "end-placeholder",
  18458. "class",
  18459. "style",
  18460. "aria-label",
  18461. "tabindex",
  18462. "onFocus",
  18463. "onBlur"
  18464. ]))]),
  18465. content: withCtx(() => [renderSlot(_ctx.$slots, "default", {
  18466. visible: unref(pickerVisible),
  18467. actualVisible: unref(pickerActualVisible),
  18468. parsedValue: unref(parsedValue),
  18469. format: _ctx.format,
  18470. dateFormat: _ctx.dateFormat,
  18471. timeFormat: _ctx.timeFormat,
  18472. unlinkPanels: _ctx.unlinkPanels,
  18473. type: _ctx.type,
  18474. defaultValue: _ctx.defaultValue,
  18475. showNow: _ctx.showNow,
  18476. showConfirm: _ctx.showConfirm,
  18477. showFooter: _ctx.showFooter,
  18478. showWeekNumber: _ctx.showWeekNumber,
  18479. onPick: _cache[1] || (_cache[1] = (...args) => unref(onPick) && unref(onPick)(...args)),
  18480. onSelectRange: setSelectionRange,
  18481. onSetPickerOption: _cache[2] || (_cache[2] = (...args) => unref(onSetPickerOption) && unref(onSetPickerOption)(...args)),
  18482. onCalendarChange: _cache[3] || (_cache[3] = (...args) => unref(onCalendarChange) && unref(onCalendarChange)(...args)),
  18483. onClear,
  18484. onPanelChange: _cache[4] || (_cache[4] = (...args) => unref(onPanelChange) && unref(onPanelChange)(...args)),
  18485. onMousedown: _cache[5] || (_cache[5] = withModifiers(() => {}, ["stop"]))
  18486. })]),
  18487. _: 3
  18488. }, 16, [
  18489. "visible",
  18490. "transition",
  18491. "popper-class",
  18492. "popper-style",
  18493. "popper-options",
  18494. "fallback-placements",
  18495. "placement"
  18496. ]);
  18497. };
  18498. }
  18499. });
  18500. //#endregion
  18501. //#region ../../packages/components/time-picker/src/common/picker.vue
  18502. var picker_default = picker_vue_vue_type_script_setup_true_lang_default;
  18503. //#endregion
  18504. //#region ../../packages/components/time-picker/src/props/panel-time-picker.ts
  18505. const panelTimePickerProps = buildProps({
  18506. ...timePanelSharedProps,
  18507. datetimeRole: String,
  18508. parsedValue: { type: definePropType(Object) }
  18509. });
  18510. //#endregion
  18511. //#region ../../packages/components/time-picker/src/composables/use-time-panel.ts
  18512. const useTimePanel = ({ getAvailableHours, getAvailableMinutes, getAvailableSeconds }) => {
  18513. const getAvailableTime = (date, role, first, compareDate) => {
  18514. const availableTimeGetters = {
  18515. hour: getAvailableHours,
  18516. minute: getAvailableMinutes,
  18517. second: getAvailableSeconds
  18518. };
  18519. let result = date;
  18520. [
  18521. "hour",
  18522. "minute",
  18523. "second"
  18524. ].forEach((type) => {
  18525. if (availableTimeGetters[type]) {
  18526. let availableTimeSlots;
  18527. const method = availableTimeGetters[type];
  18528. switch (type) {
  18529. case "minute":
  18530. availableTimeSlots = method(result.hour(), role, compareDate);
  18531. break;
  18532. case "second":
  18533. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  18534. break;
  18535. default:
  18536. availableTimeSlots = method(role, compareDate);
  18537. break;
  18538. }
  18539. if (availableTimeSlots?.length && !availableTimeSlots.includes(result[type]())) {
  18540. const pos = first ? 0 : availableTimeSlots.length - 1;
  18541. result = result[type](availableTimeSlots[pos]);
  18542. }
  18543. }
  18544. });
  18545. return result;
  18546. };
  18547. const timePickerOptions = {};
  18548. const onSetOption = ([key, val]) => {
  18549. timePickerOptions[key] = val;
  18550. };
  18551. return {
  18552. timePickerOptions,
  18553. getAvailableTime,
  18554. onSetOption
  18555. };
  18556. };
  18557. //#endregion
  18558. //#region ../../packages/components/time-picker/src/composables/use-time-picker.ts
  18559. const makeAvailableArr = (disabledList) => {
  18560. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  18561. const getNumber = (predicate) => predicate !== true;
  18562. return disabledList.map(trueOrNumber).filter(getNumber);
  18563. };
  18564. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  18565. const getHoursList = (role, compare) => {
  18566. return makeList(24, disabledHours && (() => disabledHours?.(role, compare)));
  18567. };
  18568. const getMinutesList = (hour, role, compare) => {
  18569. return makeList(60, disabledMinutes && (() => disabledMinutes?.(hour, role, compare)));
  18570. };
  18571. const getSecondsList = (hour, minute, role, compare) => {
  18572. return makeList(60, disabledSeconds && (() => disabledSeconds?.(hour, minute, role, compare)));
  18573. };
  18574. return {
  18575. getHoursList,
  18576. getMinutesList,
  18577. getSecondsList
  18578. };
  18579. };
  18580. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  18581. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  18582. const getAvailableHours = (role, compare) => {
  18583. return makeAvailableArr(getHoursList(role, compare));
  18584. };
  18585. const getAvailableMinutes = (hour, role, compare) => {
  18586. return makeAvailableArr(getMinutesList(hour, role, compare));
  18587. };
  18588. const getAvailableSeconds = (hour, minute, role, compare) => {
  18589. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  18590. };
  18591. return {
  18592. getAvailableHours,
  18593. getAvailableMinutes,
  18594. getAvailableSeconds
  18595. };
  18596. };
  18597. const useOldValue = (props, options) => {
  18598. const oldValue = ref(props.parsedValue);
  18599. watch(() => props.visible, (val) => {
  18600. const modelValue = toValue(options.modelValue);
  18601. const valueOnClear = toValue(options.valueOnClear);
  18602. if (val && modelValue === valueOnClear) {
  18603. oldValue.value = valueOnClear;
  18604. return;
  18605. }
  18606. if (!val) oldValue.value = props.parsedValue;
  18607. });
  18608. return oldValue;
  18609. };
  18610. //#endregion
  18611. //#region ../../packages/directives/click-outside/index.ts
  18612. const nodeList = /* @__PURE__ */ new Map();
  18613. if (isClient) {
  18614. let startClick;
  18615. document.addEventListener("mousedown", (e) => startClick = e);
  18616. document.addEventListener("mouseup", (e) => {
  18617. if (startClick) {
  18618. for (const handlers of nodeList.values()) for (const { documentHandler } of handlers) documentHandler(e, startClick);
  18619. startClick = void 0;
  18620. }
  18621. });
  18622. }
  18623. function createDocumentHandler(el, binding) {
  18624. let excludes = [];
  18625. if (isArray$1(binding.arg)) excludes = binding.arg;
  18626. else if (isElement$1(binding.arg)) excludes.push(binding.arg);
  18627. return function(mouseup, mousedown) {
  18628. const popperRef = binding.instance.popperRef;
  18629. const mouseUpTarget = mouseup.target;
  18630. const mouseDownTarget = mousedown?.target;
  18631. const isBound = !binding || !binding.instance;
  18632. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  18633. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  18634. const isSelf = el === mouseUpTarget;
  18635. const isTargetExcluded = excludes.length && excludes.some((item) => item?.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  18636. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  18637. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) return;
  18638. binding.value(mouseup, mousedown);
  18639. };
  18640. }
  18641. const ClickOutside = {
  18642. beforeMount(el, binding) {
  18643. if (!nodeList.has(el)) nodeList.set(el, []);
  18644. nodeList.get(el).push({
  18645. documentHandler: createDocumentHandler(el, binding),
  18646. bindingFn: binding.value
  18647. });
  18648. },
  18649. updated(el, binding) {
  18650. if (!nodeList.has(el)) nodeList.set(el, []);
  18651. const handlers = nodeList.get(el);
  18652. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  18653. const newHandler = {
  18654. documentHandler: createDocumentHandler(el, binding),
  18655. bindingFn: binding.value
  18656. };
  18657. if (oldHandlerIndex >= 0) handlers.splice(oldHandlerIndex, 1, newHandler);
  18658. else handlers.push(newHandler);
  18659. },
  18660. unmounted(el) {
  18661. nodeList.delete(el);
  18662. }
  18663. };
  18664. //#endregion
  18665. //#region ../../packages/directives/repeat-click/index.ts
  18666. const REPEAT_INTERVAL = 100;
  18667. const REPEAT_DELAY = 600;
  18668. const SCOPE$6 = "_RepeatClick";
  18669. const vRepeatClick = {
  18670. beforeMount(el, binding) {
  18671. const value = binding.value;
  18672. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$1(value) ? {} : value;
  18673. let intervalId;
  18674. let delayId;
  18675. const handler = () => isFunction$1(value) ? value() : value.handler();
  18676. const clear = () => {
  18677. if (delayId) {
  18678. clearTimeout(delayId);
  18679. delayId = void 0;
  18680. }
  18681. if (intervalId) {
  18682. clearInterval(intervalId);
  18683. intervalId = void 0;
  18684. }
  18685. };
  18686. const start = (evt) => {
  18687. if (evt.button !== 0) return;
  18688. clear();
  18689. handler();
  18690. document.addEventListener("mouseup", clear, { once: true });
  18691. delayId = setTimeout(() => {
  18692. intervalId = setInterval(() => {
  18693. handler();
  18694. }, interval);
  18695. }, delay);
  18696. };
  18697. el[SCOPE$6] = {
  18698. start,
  18699. clear
  18700. };
  18701. el.addEventListener("mousedown", start);
  18702. },
  18703. unmounted(el) {
  18704. if (!el[SCOPE$6]) return;
  18705. const { start, clear } = el[SCOPE$6];
  18706. if (start) el.removeEventListener("mousedown", start);
  18707. if (clear) {
  18708. clear();
  18709. document.removeEventListener("mouseup", clear);
  18710. }
  18711. el[SCOPE$6] = null;
  18712. }
  18713. };
  18714. //#endregion
  18715. //#region ../../packages/directives/trap-focus/index.ts
  18716. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  18717. const FOCUS_STACK = [];
  18718. const FOCUS_HANDLER = (e) => {
  18719. if (FOCUS_STACK.length === 0) return;
  18720. const code = getEventCode(e);
  18721. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  18722. if (focusableElement.length > 0 && code === EVENT_CODE.tab) {
  18723. if (focusableElement.length === 1) {
  18724. e.preventDefault();
  18725. if (document.activeElement !== focusableElement[0]) focusableElement[0].focus();
  18726. return;
  18727. }
  18728. const goingBackward = e.shiftKey;
  18729. const isFirst = e.target === focusableElement[0];
  18730. const isLast = e.target === focusableElement[focusableElement.length - 1];
  18731. if (isFirst && goingBackward) {
  18732. e.preventDefault();
  18733. focusableElement[focusableElement.length - 1].focus();
  18734. }
  18735. if (isLast && !goingBackward) {
  18736. e.preventDefault();
  18737. focusableElement[0].focus();
  18738. }
  18739. }
  18740. };
  18741. const TrapFocus = {
  18742. beforeMount(el) {
  18743. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18744. FOCUS_STACK.push(el);
  18745. if (FOCUS_STACK.length <= 1) document.addEventListener("keydown", FOCUS_HANDLER);
  18746. },
  18747. updated(el) {
  18748. nextTick(() => {
  18749. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18750. });
  18751. },
  18752. unmounted() {
  18753. FOCUS_STACK.shift();
  18754. if (FOCUS_STACK.length === 0) document.removeEventListener("keydown", FOCUS_HANDLER);
  18755. }
  18756. };
  18757. //#endregion
  18758. //#region ../../node_modules/.pnpm/normalize-wheel-es@1.2.0/node_modules/normalize-wheel-es/dist/index.mjs
  18759. var v = !1, o, f, s, u, d, N, l, p, m, w, D, x, E, M, F;
  18760. function a() {
  18761. if (!v) {
  18762. v = !0;
  18763. 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);
  18764. 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) {
  18765. o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
  18766. var r = /(?:Trident\/(\d+.\d+))/.exec(e);
  18767. 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;
  18768. } else o = f = s = d = u = NaN;
  18769. if (i) {
  18770. if (i[1]) {
  18771. var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
  18772. l = t ? parseFloat(t[1].replace("_", ".")) : !0;
  18773. } else l = !1;
  18774. p = !!i[2], m = !!i[3];
  18775. } else l = p = m = !1;
  18776. }
  18777. }
  18778. var _ = {
  18779. ie: function() {
  18780. return a() || o;
  18781. },
  18782. ieCompatibilityMode: function() {
  18783. return a() || N > o;
  18784. },
  18785. ie64: function() {
  18786. return _.ie() && D;
  18787. },
  18788. firefox: function() {
  18789. return a() || f;
  18790. },
  18791. opera: function() {
  18792. return a() || s;
  18793. },
  18794. webkit: function() {
  18795. return a() || u;
  18796. },
  18797. safari: function() {
  18798. return _.webkit();
  18799. },
  18800. chrome: function() {
  18801. return a() || d;
  18802. },
  18803. windows: function() {
  18804. return a() || p;
  18805. },
  18806. osx: function() {
  18807. return a() || l;
  18808. },
  18809. linux: function() {
  18810. return a() || m;
  18811. },
  18812. iphone: function() {
  18813. return a() || x;
  18814. },
  18815. mobile: function() {
  18816. return a() || x || E || w || F;
  18817. },
  18818. nativeApp: function() {
  18819. return a() || M;
  18820. },
  18821. android: function() {
  18822. return a() || w;
  18823. },
  18824. ipad: function() {
  18825. return a() || E;
  18826. }
  18827. }, A = _;
  18828. var c = !!(typeof window < "u" && window.document && window.document.createElement), h$1 = {
  18829. canUseDOM: c,
  18830. canUseWorkers: typeof Worker < "u",
  18831. canUseEventListeners: c && !!(window.addEventListener || window.attachEvent),
  18832. canUseViewport: c && !!window.screen,
  18833. isInWorker: !c
  18834. };
  18835. var X;
  18836. h$1.canUseDOM && (X = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== !0);
  18837. function S(e, n) {
  18838. if (!h$1.canUseDOM || n && !("addEventListener" in document)) return !1;
  18839. var i = "on" + e, r = i in document;
  18840. if (!r) {
  18841. var t = document.createElement("div");
  18842. t.setAttribute(i, "return;"), r = typeof t[i] == "function";
  18843. }
  18844. return !r && X && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
  18845. }
  18846. var b = S;
  18847. var O = 10, I = 40, P = 800;
  18848. function T(e) {
  18849. var n = 0, i = 0, r = 0, t = 0;
  18850. 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), {
  18851. spinX: n,
  18852. spinY: i,
  18853. pixelX: r,
  18854. pixelY: t
  18855. };
  18856. }
  18857. T.getEventType = function() {
  18858. return A.firefox() ? "DOMMouseScroll" : b("wheel") ? "wheel" : "mousewheel";
  18859. };
  18860. var Y = T;
  18861. /**
  18862. * Checks if an event is supported in the current execution environment.
  18863. *
  18864. * NOTE: This will not work correctly for non-generic events such as `change`,
  18865. * `reset`, `load`, `error`, and `select`.
  18866. *
  18867. * Borrows from Modernizr.
  18868. *
  18869. * @param {string} eventNameSuffix Event name, e.g. "click".
  18870. * @param {?boolean} capture Check if the capture phase is supported.
  18871. * @return {boolean} True if the event is supported.
  18872. * @internal
  18873. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  18874. */
  18875. //#endregion
  18876. //#region ../../packages/directives/mousewheel/index.ts
  18877. const SCOPE$5 = "_Mousewheel";
  18878. const mousewheel = function(element, callback) {
  18879. if (element && element.addEventListener) {
  18880. removeWheelHandler(element);
  18881. const fn = function(event) {
  18882. const normalized = Y(event);
  18883. callback && Reflect.apply(callback, this, [event, normalized]);
  18884. };
  18885. element[SCOPE$5] = { wheelHandler: fn };
  18886. element.addEventListener("wheel", fn, { passive: true });
  18887. }
  18888. };
  18889. const removeWheelHandler = (element) => {
  18890. if (element[SCOPE$5]?.wheelHandler) {
  18891. element.removeEventListener("wheel", element[SCOPE$5].wheelHandler);
  18892. element[SCOPE$5] = null;
  18893. }
  18894. };
  18895. const Mousewheel = {
  18896. beforeMount(el, binding) {
  18897. mousewheel(el, binding.value);
  18898. },
  18899. unmounted(el) {
  18900. removeWheelHandler(el);
  18901. },
  18902. updated(el, binding) {
  18903. if (binding.value !== binding.oldValue) mousewheel(el, binding.value);
  18904. }
  18905. };
  18906. //#endregion
  18907. //#region ../../packages/components/time-picker/src/props/basic-time-spinner.ts
  18908. const basicTimeSpinnerProps = buildProps({
  18909. role: {
  18910. type: String,
  18911. required: true
  18912. },
  18913. spinnerDate: {
  18914. type: definePropType(Object),
  18915. required: true
  18916. },
  18917. showSeconds: {
  18918. type: Boolean,
  18919. default: true
  18920. },
  18921. arrowControl: Boolean,
  18922. amPmMode: {
  18923. type: definePropType(String),
  18924. default: ""
  18925. },
  18926. ...disabledTimeListsProps
  18927. });
  18928. //#endregion
  18929. //#region ../../packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue?vue&type=script&setup=true&lang.ts
  18930. const _hoisted_1$70 = ["onClick"];
  18931. const _hoisted_2$39 = ["onMouseenter"];
  18932. var basic_time_spinner_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  18933. __name: "basic-time-spinner",
  18934. props: basicTimeSpinnerProps,
  18935. emits: [
  18936. CHANGE_EVENT,
  18937. "select-range",
  18938. "set-option"
  18939. ],
  18940. setup(__props, { emit: __emit }) {
  18941. const props = __props;
  18942. const { isRange, format, saveOnBlur } = inject(PICKER_BASE_INJECTION_KEY).props;
  18943. const emit = __emit;
  18944. const ns = useNamespace("time");
  18945. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  18946. let isScrolling = false;
  18947. const ignoreScroll = {
  18948. hours: false,
  18949. minutes: false,
  18950. seconds: false
  18951. };
  18952. const currentScrollbar = ref();
  18953. const listRefsMap = {
  18954. hours: ref(),
  18955. minutes: ref(),
  18956. seconds: ref()
  18957. };
  18958. const spinnerItems = computed(() => {
  18959. return props.showSeconds ? timeUnits : timeUnits.slice(0, 2);
  18960. });
  18961. const timePartials = computed(() => {
  18962. const { spinnerDate } = props;
  18963. return {
  18964. hours: spinnerDate.hour(),
  18965. minutes: spinnerDate.minute(),
  18966. seconds: spinnerDate.second()
  18967. };
  18968. });
  18969. const timeList = computed(() => {
  18970. const { hours, minutes } = unref(timePartials);
  18971. const { role, spinnerDate } = props;
  18972. const compare = !isRange ? spinnerDate : void 0;
  18973. return {
  18974. hours: getHoursList(role, compare),
  18975. minutes: getMinutesList(hours, role, compare),
  18976. seconds: getSecondsList(hours, minutes, role, compare)
  18977. };
  18978. });
  18979. const arrowControlTimeList = computed(() => {
  18980. const { hours, minutes, seconds } = unref(timePartials);
  18981. return {
  18982. hours: buildTimeList(hours, 23),
  18983. minutes: buildTimeList(minutes, 59),
  18984. seconds: buildTimeList(seconds, 59)
  18985. };
  18986. });
  18987. const debouncedResetScroll = debounce((type) => {
  18988. isScrolling = false;
  18989. adjustCurrentSpinner(type);
  18990. }, 200);
  18991. const getAmPmFlag = (hour) => {
  18992. if (!!!props.amPmMode) return "";
  18993. const isCapital = props.amPmMode === "A";
  18994. let content = hour < 12 ? " am" : " pm";
  18995. if (isCapital) content = content.toUpperCase();
  18996. return content;
  18997. };
  18998. const emitSelectRange = (type) => {
  18999. let range = [0, 0];
  19000. const actualFormat = format || DEFAULT_FORMATS_TIME;
  19001. const hourIndex = actualFormat.indexOf("HH");
  19002. const minuteIndex = actualFormat.indexOf("mm");
  19003. const secondIndex = actualFormat.indexOf("ss");
  19004. switch (type) {
  19005. case "hours":
  19006. if (hourIndex !== -1) range = [hourIndex, hourIndex + 2];
  19007. break;
  19008. case "minutes":
  19009. if (minuteIndex !== -1) range = [minuteIndex, minuteIndex + 2];
  19010. break;
  19011. case "seconds":
  19012. if (secondIndex !== -1) range = [secondIndex, secondIndex + 2];
  19013. break;
  19014. }
  19015. const [left, right] = range;
  19016. emit("select-range", left, right);
  19017. currentScrollbar.value = type;
  19018. };
  19019. const adjustCurrentSpinner = (type) => {
  19020. adjustSpinner(type, unref(timePartials)[type]);
  19021. };
  19022. const adjustSpinners = () => {
  19023. adjustCurrentSpinner("hours");
  19024. adjustCurrentSpinner("minutes");
  19025. adjustCurrentSpinner("seconds");
  19026. };
  19027. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  19028. const adjustSpinner = (type, value) => {
  19029. if (props.arrowControl) return;
  19030. const scrollbar = unref(listRefsMap[type]);
  19031. if (scrollbar && scrollbar.$el) {
  19032. if (!saveOnBlur) {
  19033. ignoreScroll[type] = true;
  19034. rAF(() => {
  19035. ignoreScroll[type] = false;
  19036. });
  19037. }
  19038. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  19039. }
  19040. };
  19041. const typeItemHeight = (type) => {
  19042. const listItem = unref(listRefsMap[type])?.$el.querySelector("li");
  19043. if (listItem) return Number.parseFloat(getStyle(listItem, "height")) || 0;
  19044. return 0;
  19045. };
  19046. const onIncrement = () => {
  19047. scrollDown(1);
  19048. };
  19049. const onDecrement = () => {
  19050. scrollDown(-1);
  19051. };
  19052. const scrollDown = (step) => {
  19053. if (!currentScrollbar.value) emitSelectRange("hours");
  19054. const label = currentScrollbar.value;
  19055. const now = unref(timePartials)[label];
  19056. const next = findNextUnDisabled(label, now, step, currentScrollbar.value === "hours" ? 24 : 60);
  19057. modifyDateField(label, next);
  19058. adjustSpinner(label, next);
  19059. nextTick(() => emitSelectRange(label));
  19060. };
  19061. const findNextUnDisabled = (type, now, step, total) => {
  19062. let next = (now + step + total) % total;
  19063. const list = unref(timeList)[type];
  19064. while (list[next] && next !== now) next = (next + step + total) % total;
  19065. return next;
  19066. };
  19067. const modifyDateField = (type, value) => {
  19068. if (unref(timeList)[type][value]) return;
  19069. const { hours, minutes, seconds } = unref(timePartials);
  19070. let changeTo;
  19071. switch (type) {
  19072. case "hours":
  19073. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  19074. break;
  19075. case "minutes":
  19076. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  19077. break;
  19078. case "seconds":
  19079. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  19080. break;
  19081. }
  19082. emit(CHANGE_EVENT, changeTo);
  19083. };
  19084. const handleClick = (type, { value, disabled }) => {
  19085. if (!disabled) {
  19086. modifyDateField(type, value);
  19087. emitSelectRange(type);
  19088. adjustSpinner(type, value);
  19089. }
  19090. };
  19091. const handleScroll = (type) => {
  19092. if (!saveOnBlur && ignoreScroll[type]) return;
  19093. const scrollbar = unref(listRefsMap[type]);
  19094. if (!scrollbar) return;
  19095. isScrolling = true;
  19096. debouncedResetScroll(type);
  19097. modifyDateField(type, Math.min(Math.round((getScrollbarElement(scrollbar.$el).scrollTop - (scrollBarHeight(type) * .5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59));
  19098. };
  19099. const scrollBarHeight = (type) => {
  19100. return unref(listRefsMap[type]).$el.offsetHeight;
  19101. };
  19102. const bindScrollEvent = () => {
  19103. const bindFunction = (type) => {
  19104. const scrollbar = unref(listRefsMap[type]);
  19105. if (scrollbar && scrollbar.$el) getScrollbarElement(scrollbar.$el).onscroll = () => {
  19106. handleScroll(type);
  19107. };
  19108. };
  19109. bindFunction("hours");
  19110. bindFunction("minutes");
  19111. bindFunction("seconds");
  19112. };
  19113. onMounted(() => {
  19114. nextTick(() => {
  19115. !props.arrowControl && bindScrollEvent();
  19116. adjustSpinners();
  19117. if (props.role === "start") emitSelectRange("hours");
  19118. });
  19119. });
  19120. const setRef = (scrollbar, type) => {
  19121. listRefsMap[type].value = scrollbar ?? void 0;
  19122. };
  19123. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  19124. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  19125. watch(() => props.spinnerDate, () => {
  19126. if (isScrolling) return;
  19127. adjustSpinners();
  19128. });
  19129. return (_ctx, _cache) => {
  19130. return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }]) }, [!_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(spinnerItems.value, (item) => {
  19131. return openBlock(), createBlock(unref(ElScrollbar), {
  19132. key: item,
  19133. ref_for: true,
  19134. ref: (scrollbar) => setRef(scrollbar, item),
  19135. class: normalizeClass(unref(ns).be("spinner", "wrapper")),
  19136. "wrap-style": "max-height: inherit;",
  19137. "view-class": unref(ns).be("spinner", "list"),
  19138. noresize: "",
  19139. tag: "ul",
  19140. onMouseenter: ($event) => emitSelectRange(item),
  19141. onMousemove: ($event) => adjustCurrentSpinner(item)
  19142. }, {
  19143. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(timeList.value[item], (disabled, key) => {
  19144. return openBlock(), createElementBlock("li", {
  19145. key,
  19146. class: normalizeClass([
  19147. unref(ns).be("spinner", "item"),
  19148. unref(ns).is("active", key === timePartials.value[item]),
  19149. unref(ns).is("disabled", disabled)
  19150. ]),
  19151. onClick: ($event) => handleClick(item, {
  19152. value: key,
  19153. disabled
  19154. })
  19155. }, [item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(getAmPmFlag(key)), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)], 64))], 10, _hoisted_1$70);
  19156. }), 128))]),
  19157. _: 2
  19158. }, 1032, [
  19159. "class",
  19160. "view-class",
  19161. "onMouseenter",
  19162. "onMousemove"
  19163. ]);
  19164. }), 128)) : createCommentVNode("v-if", true), _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(spinnerItems.value, (item) => {
  19165. return openBlock(), createElementBlock("div", {
  19166. key: item,
  19167. class: normalizeClass([unref(ns).be("spinner", "wrapper"), unref(ns).is("arrow")]),
  19168. onMouseenter: ($event) => emitSelectRange(item)
  19169. }, [
  19170. withDirectives((openBlock(), createBlock(unref(ElIcon), { class: normalizeClass(["arrow-up", unref(ns).be("spinner", "arrow")]) }, {
  19171. default: withCtx(() => [createVNode(unref(arrow_up_default))]),
  19172. _: 1
  19173. }, 8, ["class"])), [[unref(vRepeatClick), onDecrement]]),
  19174. withDirectives((openBlock(), createBlock(unref(ElIcon), { class: normalizeClass(["arrow-down", unref(ns).be("spinner", "arrow")]) }, {
  19175. default: withCtx(() => [createVNode(unref(arrow_down_default))]),
  19176. _: 1
  19177. }, 8, ["class"])), [[unref(vRepeatClick), onIncrement]]),
  19178. createElementVNode("ul", { class: normalizeClass(unref(ns).be("spinner", "list")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(arrowControlTimeList.value[item], (time, key) => {
  19179. return openBlock(), createElementBlock("li", {
  19180. key,
  19181. class: normalizeClass([
  19182. unref(ns).be("spinner", "item"),
  19183. unref(ns).is("active", time === timePartials.value[item]),
  19184. unref(ns).is("disabled", timeList.value[item][time])
  19185. ])
  19186. }, [unref(isNumber)(time) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(getAmPmFlag(time)), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)], 64))], 64)) : createCommentVNode("v-if", true)], 2);
  19187. }), 128))], 2)
  19188. ], 42, _hoisted_2$39);
  19189. }), 128)) : createCommentVNode("v-if", true)], 2);
  19190. };
  19191. }
  19192. });
  19193. //#endregion
  19194. //#region ../../packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue
  19195. var basic_time_spinner_default = basic_time_spinner_vue_vue_type_script_setup_true_lang_default;
  19196. //#endregion
  19197. //#region ../../packages/components/time-picker/src/time-picker-com/panel-time-pick.vue?vue&type=script&setup=true&lang.ts
  19198. var panel_time_pick_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  19199. __name: "panel-time-pick",
  19200. props: panelTimePickerProps,
  19201. emits: [
  19202. "pick",
  19203. "select-range",
  19204. "set-picker-option"
  19205. ],
  19206. setup(__props, { emit: __emit }) {
  19207. const props = __props;
  19208. const emit = __emit;
  19209. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  19210. const { arrowControl, disabledHours, disabledMinutes, disabledSeconds, defaultValue } = pickerBase.props;
  19211. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  19212. const ns = useNamespace("time");
  19213. const { t, lang } = useLocale();
  19214. const selectionRange = ref([0, 2]);
  19215. const oldValue = useOldValue(props, {
  19216. modelValue: computed(() => pickerBase.props.modelValue),
  19217. valueOnClear: computed(() => pickerBase?.emptyValues ? pickerBase.emptyValues.valueOnClear.value : null)
  19218. });
  19219. const transitionName = computed(() => {
  19220. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  19221. });
  19222. const showSeconds = computed(() => {
  19223. return props.format.includes("ss");
  19224. });
  19225. const amPmMode = computed(() => {
  19226. if (props.format.includes("A")) return "A";
  19227. if (props.format.includes("a")) return "a";
  19228. return "";
  19229. });
  19230. const isValidValue = (_date) => {
  19231. const parsedDate = (0, import_dayjs_min.default)(_date).locale(lang.value);
  19232. const result = getRangeAvailableTime(parsedDate);
  19233. return parsedDate.isSame(result);
  19234. };
  19235. const handleCancel = () => {
  19236. const old = oldValue.value;
  19237. emit("pick", old, false);
  19238. nextTick(() => {
  19239. oldValue.value = old;
  19240. });
  19241. };
  19242. const handleConfirm = (visible = false, first = false) => {
  19243. if (first) return;
  19244. emit("pick", props.parsedValue, visible);
  19245. };
  19246. const handleChange = (_date) => {
  19247. if (!props.visible) return;
  19248. emit("pick", getRangeAvailableTime(_date).millisecond(0), true);
  19249. };
  19250. const setSelectionRange = (start, end) => {
  19251. emit("select-range", start, end);
  19252. selectionRange.value = [start, end];
  19253. };
  19254. const changeSelectionRange = (step) => {
  19255. const actualFormat = props.format;
  19256. const hourIndex = actualFormat.indexOf("HH");
  19257. const minuteIndex = actualFormat.indexOf("mm");
  19258. const secondIndex = actualFormat.indexOf("ss");
  19259. const list = [];
  19260. const mapping = [];
  19261. if (hourIndex !== -1) {
  19262. list.push(hourIndex);
  19263. mapping.push("hours");
  19264. }
  19265. if (minuteIndex !== -1) {
  19266. list.push(minuteIndex);
  19267. mapping.push("minutes");
  19268. }
  19269. if (secondIndex !== -1 && showSeconds.value) {
  19270. list.push(secondIndex);
  19271. mapping.push("seconds");
  19272. }
  19273. const next = (list.indexOf(selectionRange.value[0]) + step + list.length) % list.length;
  19274. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19275. };
  19276. const handleKeydown = (event) => {
  19277. const code = getEventCode(event);
  19278. const { left, right, up, down } = EVENT_CODE;
  19279. if ([left, right].includes(code)) {
  19280. changeSelectionRange(code === left ? -1 : 1);
  19281. event.preventDefault();
  19282. return;
  19283. }
  19284. if ([up, down].includes(code)) {
  19285. const step = code === up ? -1 : 1;
  19286. timePickerOptions["start_scrollDown"](step);
  19287. event.preventDefault();
  19288. return;
  19289. }
  19290. };
  19291. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  19292. getAvailableHours,
  19293. getAvailableMinutes,
  19294. getAvailableSeconds
  19295. });
  19296. const getRangeAvailableTime = (date) => {
  19297. return getAvailableTime(date, props.datetimeRole || "", true);
  19298. };
  19299. const parseUserInput = (value) => {
  19300. if (!value) return null;
  19301. return (0, import_dayjs_min.default)(value, props.format).locale(lang.value);
  19302. };
  19303. const getDefaultValue = () => {
  19304. return (0, import_dayjs_min.default)(defaultValue).locale(lang.value);
  19305. };
  19306. emit("set-picker-option", ["isValidValue", isValidValue]);
  19307. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19308. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19309. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19310. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19311. emit("set-picker-option", ["handleCancel", handleCancel]);
  19312. return (_ctx, _cache) => {
  19313. return openBlock(), createBlock(Transition, { name: transitionName.value }, {
  19314. default: withCtx(() => [_ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  19315. key: 0,
  19316. class: normalizeClass(unref(ns).b("panel"))
  19317. }, [createElementVNode("div", { class: normalizeClass([unref(ns).be("panel", "content"), { "has-seconds": showSeconds.value }]) }, [createVNode(basic_time_spinner_default, {
  19318. ref: "spinner",
  19319. role: _ctx.datetimeRole || "start",
  19320. "arrow-control": unref(arrowControl),
  19321. "show-seconds": showSeconds.value,
  19322. "am-pm-mode": amPmMode.value,
  19323. "spinner-date": _ctx.parsedValue,
  19324. "disabled-hours": unref(disabledHours),
  19325. "disabled-minutes": unref(disabledMinutes),
  19326. "disabled-seconds": unref(disabledSeconds),
  19327. onChange: handleChange,
  19328. onSetOption: unref(onSetOption),
  19329. onSelectRange: setSelectionRange
  19330. }, null, 8, [
  19331. "role",
  19332. "arrow-control",
  19333. "show-seconds",
  19334. "am-pm-mode",
  19335. "spinner-date",
  19336. "disabled-hours",
  19337. "disabled-minutes",
  19338. "disabled-seconds",
  19339. "onSetOption"
  19340. ])], 2), createElementVNode("div", { class: normalizeClass(unref(ns).be("panel", "footer")) }, [createElementVNode("button", {
  19341. type: "button",
  19342. class: normalizeClass([unref(ns).be("panel", "btn"), "cancel"]),
  19343. onClick: handleCancel
  19344. }, toDisplayString(unref(t)("el.datepicker.cancel")), 3), createElementVNode("button", {
  19345. type: "button",
  19346. class: normalizeClass([unref(ns).be("panel", "btn"), "confirm"]),
  19347. onClick: _cache[0] || (_cache[0] = ($event) => handleConfirm())
  19348. }, toDisplayString(unref(t)("el.datepicker.confirm")), 3)], 2)], 2)) : createCommentVNode("v-if", true)]),
  19349. _: 1
  19350. }, 8, ["name"]);
  19351. };
  19352. }
  19353. });
  19354. //#endregion
  19355. //#region ../../packages/components/time-picker/src/time-picker-com/panel-time-pick.vue
  19356. var panel_time_pick_default = panel_time_pick_vue_vue_type_script_setup_true_lang_default;
  19357. //#endregion
  19358. //#region ../../packages/components/time-picker/src/props/panel-time-range.ts
  19359. const panelTimeRangeProps = buildProps({
  19360. ...timePanelSharedProps,
  19361. parsedValue: { type: definePropType(Array) }
  19362. });
  19363. //#endregion
  19364. //#region ../../packages/components/time-picker/src/time-picker-com/panel-time-range.vue?vue&type=script&setup=true&lang.ts
  19365. const _hoisted_1$69 = ["disabled"];
  19366. var panel_time_range_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  19367. __name: "panel-time-range",
  19368. props: panelTimeRangeProps,
  19369. emits: [
  19370. "pick",
  19371. "select-range",
  19372. "set-picker-option"
  19373. ],
  19374. setup(__props, { emit: __emit }) {
  19375. const props = __props;
  19376. const emit = __emit;
  19377. const makeSelectRange = (start, end) => {
  19378. const result = [];
  19379. for (let i = start; i <= end; i++) result.push(i);
  19380. return result;
  19381. };
  19382. const { t, lang } = useLocale();
  19383. const nsTime = useNamespace("time");
  19384. const nsPicker = useNamespace("picker");
  19385. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  19386. const { arrowControl, disabledHours, disabledMinutes, disabledSeconds, defaultValue } = pickerBase.props;
  19387. const startContainerKls = computed(() => [
  19388. nsTime.be("range-picker", "body"),
  19389. nsTime.be("panel", "content"),
  19390. nsTime.is("arrow", arrowControl),
  19391. showSeconds.value ? "has-seconds" : ""
  19392. ]);
  19393. const endContainerKls = computed(() => [
  19394. nsTime.be("range-picker", "body"),
  19395. nsTime.be("panel", "content"),
  19396. nsTime.is("arrow", arrowControl),
  19397. showSeconds.value ? "has-seconds" : ""
  19398. ]);
  19399. const startTime = computed(() => props.parsedValue[0]);
  19400. const endTime = computed(() => props.parsedValue[1]);
  19401. const oldValue = useOldValue(props, {
  19402. modelValue: computed(() => pickerBase.props.modelValue),
  19403. valueOnClear: computed(() => pickerBase?.emptyValues ? pickerBase.emptyValues.valueOnClear.value : null)
  19404. });
  19405. const handleCancel = () => {
  19406. const old = oldValue.value;
  19407. emit("pick", old, false);
  19408. nextTick(() => {
  19409. oldValue.value = old;
  19410. });
  19411. };
  19412. const showSeconds = computed(() => {
  19413. return props.format.includes("ss");
  19414. });
  19415. const amPmMode = computed(() => {
  19416. if (props.format.includes("A")) return "A";
  19417. if (props.format.includes("a")) return "a";
  19418. return "";
  19419. });
  19420. const handleConfirm = (visible = false) => {
  19421. emit("pick", [startTime.value, endTime.value], visible);
  19422. };
  19423. const handleMinChange = (date) => {
  19424. handleChange(date.millisecond(0), endTime.value);
  19425. };
  19426. const handleMaxChange = (date) => {
  19427. handleChange(startTime.value, date.millisecond(0));
  19428. };
  19429. const isValidValue = (_date) => {
  19430. const parsedDate = _date.map((_) => (0, import_dayjs_min.default)(_).locale(lang.value));
  19431. const result = getRangeAvailableTime(parsedDate);
  19432. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  19433. };
  19434. const handleChange = (start, end) => {
  19435. if (!props.visible) return;
  19436. emit("pick", [start, end], true);
  19437. };
  19438. const btnConfirmDisabled = computed(() => {
  19439. return startTime.value > endTime.value;
  19440. });
  19441. const selectionRange = ref([0, 2]);
  19442. const setMinSelectionRange = (start, end) => {
  19443. emit("select-range", start, end, "min");
  19444. selectionRange.value = [start, end];
  19445. };
  19446. const offset = computed(() => showSeconds.value ? 11 : 8);
  19447. const setMaxSelectionRange = (start, end) => {
  19448. emit("select-range", start, end, "max");
  19449. const _offset = unref(offset);
  19450. selectionRange.value = [start + _offset, end + _offset];
  19451. };
  19452. const changeSelectionRange = (step) => {
  19453. const list = showSeconds.value ? [
  19454. 0,
  19455. 3,
  19456. 6,
  19457. 11,
  19458. 14,
  19459. 17
  19460. ] : [
  19461. 0,
  19462. 3,
  19463. 8,
  19464. 11
  19465. ];
  19466. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19467. const next = (list.indexOf(selectionRange.value[0]) + step + list.length) % list.length;
  19468. const half = list.length / 2;
  19469. if (next < half) timePickerOptions["start_emitSelectRange"](mapping[next]);
  19470. else timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  19471. };
  19472. const handleKeydown = (event) => {
  19473. const code = getEventCode(event);
  19474. const { left, right, up, down } = EVENT_CODE;
  19475. if ([left, right].includes(code)) {
  19476. changeSelectionRange(code === left ? -1 : 1);
  19477. event.preventDefault();
  19478. return;
  19479. }
  19480. if ([up, down].includes(code)) {
  19481. const step = code === up ? -1 : 1;
  19482. timePickerOptions[`${selectionRange.value[0] < offset.value ? "start" : "end"}_scrollDown`](step);
  19483. event.preventDefault();
  19484. return;
  19485. }
  19486. };
  19487. const disabledHours_ = (role, compare) => {
  19488. const defaultDisable = disabledHours ? disabledHours(role) : [];
  19489. const isStart = role === "start";
  19490. const compareHour = (compare || (isStart ? endTime.value : startTime.value)).hour();
  19491. return union(defaultDisable, isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1));
  19492. };
  19493. const disabledMinutes_ = (hour, role, compare) => {
  19494. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  19495. const isStart = role === "start";
  19496. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19497. if (hour !== compareDate.hour()) return defaultDisable;
  19498. const compareMinute = compareDate.minute();
  19499. return union(defaultDisable, isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1));
  19500. };
  19501. const disabledSeconds_ = (hour, minute, role, compare) => {
  19502. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  19503. const isStart = role === "start";
  19504. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19505. const compareHour = compareDate.hour();
  19506. const compareMinute = compareDate.minute();
  19507. if (hour !== compareHour || minute !== compareMinute) return defaultDisable;
  19508. const compareSecond = compareDate.second();
  19509. return union(defaultDisable, isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1));
  19510. };
  19511. const getRangeAvailableTime = ([start, end]) => {
  19512. return [getAvailableTime(start, "start", true, end), getAvailableTime(end, "end", false, start)];
  19513. };
  19514. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  19515. const { timePickerOptions, getAvailableTime, onSetOption } = useTimePanel({
  19516. getAvailableHours,
  19517. getAvailableMinutes,
  19518. getAvailableSeconds
  19519. });
  19520. const parseUserInput = (days) => {
  19521. if (!days) return null;
  19522. if (isArray$1(days)) return days.map((d) => (0, import_dayjs_min.default)(d, props.format).locale(lang.value));
  19523. return (0, import_dayjs_min.default)(days, props.format).locale(lang.value);
  19524. };
  19525. const getDefaultValue = () => {
  19526. if (isArray$1(defaultValue)) return defaultValue.map((d) => (0, import_dayjs_min.default)(d).locale(lang.value));
  19527. const defaultDay = (0, import_dayjs_min.default)(defaultValue).locale(lang.value);
  19528. return [defaultDay, defaultDay.add(60, "m")];
  19529. };
  19530. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19531. emit("set-picker-option", ["isValidValue", isValidValue]);
  19532. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19533. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19534. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19535. emit("set-picker-option", ["handleCancel", handleCancel]);
  19536. return (_ctx, _cache) => {
  19537. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  19538. key: 0,
  19539. class: normalizeClass([unref(nsTime).b("range-picker"), unref(nsPicker).b("panel")])
  19540. }, [createElementVNode("div", { class: normalizeClass(unref(nsTime).be("range-picker", "content")) }, [createElementVNode("div", { class: normalizeClass(unref(nsTime).be("range-picker", "cell")) }, [createElementVNode("div", { class: normalizeClass(unref(nsTime).be("range-picker", "header")) }, toDisplayString(unref(t)("el.datepicker.startTime")), 3), createElementVNode("div", { class: normalizeClass(startContainerKls.value) }, [createVNode(basic_time_spinner_default, {
  19541. ref: "minSpinner",
  19542. role: "start",
  19543. "show-seconds": showSeconds.value,
  19544. "am-pm-mode": amPmMode.value,
  19545. "arrow-control": unref(arrowControl),
  19546. "spinner-date": startTime.value,
  19547. "disabled-hours": disabledHours_,
  19548. "disabled-minutes": disabledMinutes_,
  19549. "disabled-seconds": disabledSeconds_,
  19550. onChange: handleMinChange,
  19551. onSetOption: unref(onSetOption),
  19552. onSelectRange: setMinSelectionRange
  19553. }, null, 8, [
  19554. "show-seconds",
  19555. "am-pm-mode",
  19556. "arrow-control",
  19557. "spinner-date",
  19558. "onSetOption"
  19559. ])], 2)], 2), createElementVNode("div", { class: normalizeClass(unref(nsTime).be("range-picker", "cell")) }, [createElementVNode("div", { class: normalizeClass(unref(nsTime).be("range-picker", "header")) }, toDisplayString(unref(t)("el.datepicker.endTime")), 3), createElementVNode("div", { class: normalizeClass(endContainerKls.value) }, [createVNode(basic_time_spinner_default, {
  19560. ref: "maxSpinner",
  19561. role: "end",
  19562. "show-seconds": showSeconds.value,
  19563. "am-pm-mode": amPmMode.value,
  19564. "arrow-control": unref(arrowControl),
  19565. "spinner-date": endTime.value,
  19566. "disabled-hours": disabledHours_,
  19567. "disabled-minutes": disabledMinutes_,
  19568. "disabled-seconds": disabledSeconds_,
  19569. onChange: handleMaxChange,
  19570. onSetOption: unref(onSetOption),
  19571. onSelectRange: setMaxSelectionRange
  19572. }, null, 8, [
  19573. "show-seconds",
  19574. "am-pm-mode",
  19575. "arrow-control",
  19576. "spinner-date",
  19577. "onSetOption"
  19578. ])], 2)], 2)], 2), createElementVNode("div", { class: normalizeClass(unref(nsTime).be("panel", "footer")) }, [createElementVNode("button", {
  19579. type: "button",
  19580. class: normalizeClass([unref(nsTime).be("panel", "btn"), "cancel"]),
  19581. onClick: _cache[0] || (_cache[0] = ($event) => handleCancel())
  19582. }, toDisplayString(unref(t)("el.datepicker.cancel")), 3), createElementVNode("button", {
  19583. type: "button",
  19584. class: normalizeClass([unref(nsTime).be("panel", "btn"), "confirm"]),
  19585. disabled: btnConfirmDisabled.value,
  19586. onClick: _cache[1] || (_cache[1] = ($event) => handleConfirm())
  19587. }, toDisplayString(unref(t)("el.datepicker.confirm")), 11, _hoisted_1$69)], 2)], 2)) : createCommentVNode("v-if", true);
  19588. };
  19589. }
  19590. });
  19591. //#endregion
  19592. //#region ../../packages/components/time-picker/src/time-picker-com/panel-time-range.vue
  19593. var panel_time_range_default = panel_time_range_vue_vue_type_script_setup_true_lang_default;
  19594. //#endregion
  19595. //#region ../../packages/components/time-picker/src/time-picker.tsx
  19596. import_dayjs_min.default.extend(import_customParseFormat.default);
  19597. var time_picker_default = /* @__PURE__ */ defineComponent({
  19598. name: "ElTimePicker",
  19599. install: null,
  19600. props: {
  19601. ...timePickerDefaultProps,
  19602. isRange: Boolean
  19603. },
  19604. emits: [UPDATE_MODEL_EVENT],
  19605. setup(props, ctx) {
  19606. const commonPicker = ref();
  19607. const [type, Panel] = props.isRange ? ["timerange", panel_time_range_default] : ["time", panel_time_pick_default];
  19608. const modelUpdater = (value) => ctx.emit(UPDATE_MODEL_EVENT, value);
  19609. provide(PICKER_POPPER_OPTIONS_INJECTION_KEY, props.popperOptions);
  19610. ctx.expose({
  19611. focus: () => {
  19612. commonPicker.value?.focus();
  19613. },
  19614. blur: () => {
  19615. commonPicker.value?.blur();
  19616. },
  19617. handleOpen: () => {
  19618. commonPicker.value?.handleOpen();
  19619. },
  19620. handleClose: () => {
  19621. commonPicker.value?.handleClose();
  19622. }
  19623. });
  19624. return () => {
  19625. const format = props.format ?? DEFAULT_FORMATS_TIME;
  19626. return createVNode(picker_default, mergeProps(props, {
  19627. "ref": commonPicker,
  19628. "type": type,
  19629. "format": format,
  19630. "onUpdate:modelValue": modelUpdater
  19631. }), { default: (props) => createVNode(Panel, props, null) });
  19632. };
  19633. }
  19634. });
  19635. //#endregion
  19636. //#region ../../packages/components/time-picker/index.ts
  19637. const ElTimePicker = withInstall(time_picker_default);
  19638. //#endregion
  19639. //#region ../../packages/components/calendar/src/date-table.ts
  19640. const getPrevMonthLastDays = (date, count) => {
  19641. const lastDay = date.subtract(1, "month").endOf("month").date();
  19642. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  19643. };
  19644. const getMonthDays = (date) => {
  19645. return rangeArr(date.daysInMonth()).map((_, index) => index + 1);
  19646. };
  19647. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  19648. const start = index * 7;
  19649. return days.slice(start, start + 7);
  19650. });
  19651. /**
  19652. * @deprecated Removed after 3.0.0, Use `DateTableProps` instead.
  19653. */
  19654. const dateTableProps = buildProps({
  19655. selectedDay: { type: definePropType(Object) },
  19656. range: { type: definePropType(Array) },
  19657. date: {
  19658. type: definePropType(Object),
  19659. required: true
  19660. },
  19661. hideHeader: { type: Boolean }
  19662. });
  19663. const dateTableEmits = { pick: (value) => isObject$1(value) };
  19664. //#endregion
  19665. //#region ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/localeData.js
  19666. var require_localeData = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  19667. (function(n, e) {
  19668. "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (n = "undefined" != typeof globalThis ? globalThis : n || self).dayjs_plugin_localeData = e();
  19669. })(exports, (function() {
  19670. "use strict";
  19671. return function(n, e, t) {
  19672. var r = e.prototype, o = function(n) {
  19673. return n && (n.indexOf ? n : n.s);
  19674. }, u = function(n, e, t, r, u) {
  19675. var i = n.name ? n : n.$locale(), a = o(i[e]), s = o(i[t]), f = a || s.map((function(n) {
  19676. return n.slice(0, r);
  19677. }));
  19678. if (!u) return f;
  19679. var d = i.weekStart;
  19680. return f.map((function(n, e) {
  19681. return f[(e + (d || 0)) % 7];
  19682. }));
  19683. }, i = function() {
  19684. return t.Ls[t.locale()];
  19685. }, a = function(n, e) {
  19686. return n.formats[e] || function(n) {
  19687. return n.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(n, e, t) {
  19688. return e || t.slice(1);
  19689. }));
  19690. }(n.formats[e.toUpperCase()]);
  19691. }, s = function() {
  19692. var n = this;
  19693. return {
  19694. months: function(e) {
  19695. return e ? e.format("MMMM") : u(n, "months");
  19696. },
  19697. monthsShort: function(e) {
  19698. return e ? e.format("MMM") : u(n, "monthsShort", "months", 3);
  19699. },
  19700. firstDayOfWeek: function() {
  19701. return n.$locale().weekStart || 0;
  19702. },
  19703. weekdays: function(e) {
  19704. return e ? e.format("dddd") : u(n, "weekdays");
  19705. },
  19706. weekdaysMin: function(e) {
  19707. return e ? e.format("dd") : u(n, "weekdaysMin", "weekdays", 2);
  19708. },
  19709. weekdaysShort: function(e) {
  19710. return e ? e.format("ddd") : u(n, "weekdaysShort", "weekdays", 3);
  19711. },
  19712. longDateFormat: function(e) {
  19713. return a(n.$locale(), e);
  19714. },
  19715. meridiem: this.$locale().meridiem,
  19716. ordinal: this.$locale().ordinal
  19717. };
  19718. };
  19719. r.localeData = function() {
  19720. return s.bind(this)();
  19721. }, t.localeData = function() {
  19722. var n = i();
  19723. return {
  19724. firstDayOfWeek: function() {
  19725. return n.weekStart || 0;
  19726. },
  19727. weekdays: function() {
  19728. return t.weekdays();
  19729. },
  19730. weekdaysShort: function() {
  19731. return t.weekdaysShort();
  19732. },
  19733. weekdaysMin: function() {
  19734. return t.weekdaysMin();
  19735. },
  19736. months: function() {
  19737. return t.months();
  19738. },
  19739. monthsShort: function() {
  19740. return t.monthsShort();
  19741. },
  19742. longDateFormat: function(e) {
  19743. return a(n, e);
  19744. },
  19745. meridiem: n.meridiem,
  19746. ordinal: n.ordinal
  19747. };
  19748. }, t.months = function() {
  19749. return u(i(), "months");
  19750. }, t.monthsShort = function() {
  19751. return u(i(), "monthsShort", "months", 3);
  19752. }, t.weekdays = function(n) {
  19753. return u(i(), "weekdays", null, null, n);
  19754. }, t.weekdaysShort = function(n) {
  19755. return u(i(), "weekdaysShort", "weekdays", 3, n);
  19756. }, t.weekdaysMin = function(n) {
  19757. return u(i(), "weekdaysMin", "weekdays", 2, n);
  19758. };
  19759. };
  19760. }));
  19761. }));
  19762. //#endregion
  19763. //#region ../../packages/components/calendar/src/use-date-table.ts
  19764. var import_localeData = /* @__PURE__ */ __toESM(require_localeData());
  19765. const useDateTable = (props, emit) => {
  19766. import_dayjs_min.default.extend(import_localeData.default);
  19767. const firstDayOfWeek = import_dayjs_min.default.localeData().firstDayOfWeek();
  19768. const { t, lang } = useLocale();
  19769. const now = (0, import_dayjs_min.default)().locale(lang.value);
  19770. const isInRange = computed(() => !!props.range && !!props.range.length);
  19771. const rows = computed(() => {
  19772. let days = [];
  19773. if (isInRange.value) {
  19774. const [start, end] = props.range;
  19775. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  19776. text: start.date() + index,
  19777. type: "current"
  19778. }));
  19779. let remaining = currentMonthRange.length % 7;
  19780. remaining = remaining === 0 ? 0 : 7 - remaining;
  19781. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  19782. text: index + 1,
  19783. type: "next"
  19784. }));
  19785. days = currentMonthRange.concat(nextMonthRange);
  19786. } else {
  19787. const firstDay = props.date.startOf("month").day();
  19788. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  19789. text: day,
  19790. type: "prev"
  19791. }));
  19792. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  19793. text: day,
  19794. type: "current"
  19795. }));
  19796. days = [...prevMonthDays, ...currentMonthDays];
  19797. const nextMonthDays = rangeArr(7 - (days.length % 7 || 7)).map((_, index) => ({
  19798. text: index + 1,
  19799. type: "next"
  19800. }));
  19801. days = days.concat(nextMonthDays);
  19802. }
  19803. return toNestedArr(days);
  19804. });
  19805. const weekDays = computed(() => {
  19806. const start = firstDayOfWeek;
  19807. if (start === 0) return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  19808. else return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  19809. });
  19810. const getFormattedDate = (day, type) => {
  19811. switch (type) {
  19812. case "prev": return props.date.startOf("month").subtract(1, "month").date(day);
  19813. case "next": return props.date.startOf("month").add(1, "month").date(day);
  19814. case "current": return props.date.date(day);
  19815. }
  19816. };
  19817. const handlePickDay = ({ text, type }) => {
  19818. emit("pick", getFormattedDate(text, type));
  19819. };
  19820. const getSlotData = ({ text, type }) => {
  19821. const day = getFormattedDate(text, type);
  19822. return {
  19823. isSelected: day.isSame(props.selectedDay),
  19824. type: `${type}-month`,
  19825. day: day.format("YYYY-MM-DD"),
  19826. date: day.toDate()
  19827. };
  19828. };
  19829. return {
  19830. now,
  19831. isInRange,
  19832. rows,
  19833. weekDays,
  19834. getFormattedDate,
  19835. handlePickDay,
  19836. getSlotData
  19837. };
  19838. };
  19839. //#endregion
  19840. //#region ../../packages/components/calendar/src/date-table.vue?vue&type=script&setup=true&lang.ts
  19841. const _hoisted_1$68 = { key: 0 };
  19842. const _hoisted_2$38 = ["onClick"];
  19843. var date_table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  19844. name: "DateTable",
  19845. __name: "date-table",
  19846. props: dateTableProps,
  19847. emits: dateTableEmits,
  19848. setup(__props, { expose: __expose, emit: __emit }) {
  19849. const props = __props;
  19850. const { isInRange, now, rows, weekDays, getFormattedDate, handlePickDay, getSlotData } = useDateTable(props, __emit);
  19851. const nsTable = useNamespace("calendar-table");
  19852. const nsDay = useNamespace("calendar-day");
  19853. const getCellClass = ({ text, type }) => {
  19854. const classes = [type];
  19855. if (type === "current") {
  19856. const date = getFormattedDate(text, type);
  19857. if (date.isSame(props.selectedDay, "day")) classes.push(nsDay.is("selected"));
  19858. if (date.isSame(now, "day")) classes.push(nsDay.is("today"));
  19859. }
  19860. return classes;
  19861. };
  19862. __expose({ getFormattedDate });
  19863. return (_ctx, _cache) => {
  19864. return openBlock(), createElementBlock("table", {
  19865. class: normalizeClass([unref(nsTable).b(), unref(nsTable).is("range", unref(isInRange))]),
  19866. cellspacing: "0",
  19867. cellpadding: "0"
  19868. }, [!__props.hideHeader ? (openBlock(), createElementBlock("thead", _hoisted_1$68, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(weekDays), (day) => {
  19869. return openBlock(), createElementBlock("th", {
  19870. key: day,
  19871. scope: "col"
  19872. }, toDisplayString(day), 1);
  19873. }), 128))])])) : createCommentVNode("v-if", true), createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, index) => {
  19874. return openBlock(), createElementBlock("tr", {
  19875. key: index,
  19876. class: normalizeClass({
  19877. [unref(nsTable).e("row")]: true,
  19878. [unref(nsTable).em("row", "hide-border")]: index === 0 && __props.hideHeader
  19879. })
  19880. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key) => {
  19881. return openBlock(), createElementBlock("td", {
  19882. key,
  19883. class: normalizeClass(getCellClass(cell)),
  19884. onClick: ($event) => unref(handlePickDay)(cell)
  19885. }, [createElementVNode("div", { class: normalizeClass(unref(nsDay).b()) }, [renderSlot(_ctx.$slots, "date-cell", { data: unref(getSlotData)(cell) }, () => [createElementVNode("span", null, toDisplayString(cell.text), 1)])], 2)], 10, _hoisted_2$38);
  19886. }), 128))], 2);
  19887. }), 128))])], 2);
  19888. };
  19889. }
  19890. });
  19891. //#endregion
  19892. //#region ../../packages/components/calendar/src/date-table.vue
  19893. var date_table_default = date_table_vue_vue_type_script_setup_true_lang_default;
  19894. //#endregion
  19895. //#region ../../packages/components/calendar/src/use-calendar.ts
  19896. const adjacentMonth = (start, end) => {
  19897. const firstMonthLastDay = start.endOf("month");
  19898. const lastMonthFirstDay = end.startOf("month");
  19899. const lastMonthStartDay = firstMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  19900. return [[start, firstMonthLastDay], [lastMonthStartDay.startOf("week"), end]];
  19901. };
  19902. const threeConsecutiveMonth = (start, end) => {
  19903. const firstMonthLastDay = start.endOf("month");
  19904. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  19905. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  19906. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  19907. const lastMonthFirstDay = end.startOf("month");
  19908. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  19909. return [
  19910. [start, firstMonthLastDay],
  19911. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  19912. [lastMonthStartDay.startOf("week"), end]
  19913. ];
  19914. };
  19915. const useCalendar = (props, emit, componentName) => {
  19916. const { lang } = useLocale();
  19917. const selectedDay = ref();
  19918. const now = (0, import_dayjs_min.default)().locale(lang.value);
  19919. const realSelectedDay = computed({
  19920. get() {
  19921. if (!props.modelValue) return selectedDay.value;
  19922. return date.value;
  19923. },
  19924. set(val) {
  19925. if (!val) return;
  19926. selectedDay.value = val;
  19927. const result = val.toDate();
  19928. emit(INPUT_EVENT, result);
  19929. emit(UPDATE_MODEL_EVENT, result);
  19930. }
  19931. });
  19932. const validatedRange = computed(() => {
  19933. if (!props.range || !isArray$1(props.range) || props.range.length !== 2 || props.range.some((item) => !isDate(item))) return [];
  19934. const [startDayjs, endDayjs] = props.range.map((_) => (0, import_dayjs_min.default)(_).locale(lang.value));
  19935. if (startDayjs.isAfter(endDayjs)) {
  19936. /* @__PURE__ */ debugWarn(componentName, "end time should be greater than start time");
  19937. return [];
  19938. }
  19939. if (startDayjs.isSame(endDayjs, "month")) return calculateValidatedDateRange(startDayjs, endDayjs);
  19940. else {
  19941. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  19942. /* @__PURE__ */ debugWarn(componentName, "start time and end time interval must not exceed two months");
  19943. return [];
  19944. }
  19945. return calculateValidatedDateRange(startDayjs, endDayjs);
  19946. }
  19947. });
  19948. const date = computed(() => {
  19949. if (!props.modelValue) return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  19950. else return (0, import_dayjs_min.default)(props.modelValue).locale(lang.value);
  19951. });
  19952. const prevMonthDayjs = computed(() => date.value.subtract(1, "month").date(1));
  19953. const nextMonthDayjs = computed(() => date.value.add(1, "month").date(1));
  19954. const prevYearDayjs = computed(() => date.value.subtract(1, "year").date(1));
  19955. const nextYearDayjs = computed(() => date.value.add(1, "year").date(1));
  19956. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  19957. const firstDay = startDayjs.startOf("week");
  19958. const lastDay = endDayjs.endOf("week");
  19959. const firstMonth = firstDay.get("month");
  19960. const lastMonth = lastDay.get("month");
  19961. if (firstMonth === lastMonth) return [[firstDay, lastDay]];
  19962. else if ((firstMonth + 1) % 12 === lastMonth) return adjacentMonth(firstDay, lastDay);
  19963. else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) return threeConsecutiveMonth(firstDay, lastDay);
  19964. else {
  19965. /* @__PURE__ */ debugWarn(componentName, "start time and end time interval must not exceed two months");
  19966. return [];
  19967. }
  19968. };
  19969. const pickDay = (day) => {
  19970. realSelectedDay.value = day;
  19971. };
  19972. const selectDate = (type) => {
  19973. const day = {
  19974. "prev-month": prevMonthDayjs.value,
  19975. "next-month": nextMonthDayjs.value,
  19976. "prev-year": prevYearDayjs.value,
  19977. "next-year": nextYearDayjs.value,
  19978. today: now
  19979. }[type];
  19980. if (!day.isSame(date.value, "day")) pickDay(day);
  19981. };
  19982. const handleDateChange = (date) => {
  19983. if (date === "today") selectDate("today");
  19984. else pickDay(date);
  19985. };
  19986. return {
  19987. calculateValidatedDateRange,
  19988. date,
  19989. realSelectedDay,
  19990. pickDay,
  19991. selectDate,
  19992. validatedRange,
  19993. handleDateChange
  19994. };
  19995. };
  19996. //#endregion
  19997. //#region ../../packages/components/calendar/src/select-controller.ts
  19998. /**
  19999. * @deprecated Removed after 3.0.0, Use `SelectControllerProps` instead.
  20000. */
  20001. const selectControllerProps = buildProps({
  20002. date: {
  20003. type: definePropType(Object),
  20004. required: true
  20005. },
  20006. formatter: { type: definePropType(Function) }
  20007. });
  20008. const selectControllerEmits = { "date-change": (date) => isObject$1(date) || isString(date) };
  20009. //#endregion
  20010. //#region ../../packages/components/tag/src/tag.ts
  20011. /**
  20012. * @deprecated Removed after 3.0.0, Use `TagProps` instead.
  20013. */
  20014. const tagProps = buildProps({
  20015. type: {
  20016. type: String,
  20017. values: [
  20018. "primary",
  20019. "success",
  20020. "info",
  20021. "warning",
  20022. "danger"
  20023. ],
  20024. default: "primary"
  20025. },
  20026. closable: Boolean,
  20027. disableTransitions: Boolean,
  20028. hit: Boolean,
  20029. color: String,
  20030. size: {
  20031. type: String,
  20032. values: componentSizes
  20033. },
  20034. effect: {
  20035. type: String,
  20036. values: [
  20037. "dark",
  20038. "light",
  20039. "plain"
  20040. ],
  20041. default: "light"
  20042. },
  20043. round: Boolean
  20044. });
  20045. const tagEmits = {
  20046. close: (evt) => evt instanceof MouseEvent,
  20047. click: (evt) => evt instanceof MouseEvent
  20048. };
  20049. //#endregion
  20050. //#region ../../packages/components/tag/src/tag.vue?vue&type=script&setup=true&lang.ts
  20051. const _hoisted_1$67 = ["aria-label"];
  20052. const _hoisted_2$37 = ["aria-label"];
  20053. var tag_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  20054. name: "ElTag",
  20055. __name: "tag",
  20056. props: tagProps,
  20057. emits: tagEmits,
  20058. setup(__props, { emit: __emit }) {
  20059. const props = __props;
  20060. const emit = __emit;
  20061. const tagSize = useFormSize();
  20062. const { t } = useLocale();
  20063. const ns = useNamespace("tag");
  20064. const containerKls = computed(() => {
  20065. const { type, hit, effect, closable, round } = props;
  20066. return [
  20067. ns.b(),
  20068. ns.is("closable", closable),
  20069. ns.m(type || "primary"),
  20070. ns.m(tagSize.value),
  20071. ns.m(effect),
  20072. ns.is("hit", hit),
  20073. ns.is("round", round)
  20074. ];
  20075. });
  20076. const handleClose = (event) => {
  20077. emit("close", event);
  20078. };
  20079. const handleClick = (event) => {
  20080. emit("click", event);
  20081. };
  20082. const handleVNodeMounted = (vnode) => {
  20083. if (vnode?.component?.subTree?.component?.bum) vnode.component.subTree.component.bum = null;
  20084. };
  20085. return (_ctx, _cache) => {
  20086. return __props.disableTransitions ? (openBlock(), createElementBlock("span", {
  20087. key: 0,
  20088. class: normalizeClass(containerKls.value),
  20089. style: normalizeStyle({ backgroundColor: __props.color }),
  20090. onClick: handleClick
  20091. }, [createElementVNode("span", { class: normalizeClass(unref(ns).e("content")) }, [renderSlot(_ctx.$slots, "default")], 2), __props.closable ? (openBlock(), createElementBlock("button", {
  20092. key: 0,
  20093. "aria-label": unref(t)("el.tag.close"),
  20094. class: normalizeClass(unref(ns).e("close")),
  20095. type: "button",
  20096. onClick: withModifiers(handleClose, ["stop"])
  20097. }, [createVNode(unref(ElIcon), null, {
  20098. default: withCtx(() => [createVNode(unref(close_default))]),
  20099. _: 1
  20100. })], 10, _hoisted_1$67)) : createCommentVNode("v-if", true)], 6)) : (openBlock(), createBlock(Transition, {
  20101. key: 1,
  20102. name: `${unref(ns).namespace.value}-zoom-in-center`,
  20103. appear: "",
  20104. onVnodeMounted: handleVNodeMounted
  20105. }, {
  20106. default: withCtx(() => [createElementVNode("span", {
  20107. class: normalizeClass(containerKls.value),
  20108. style: normalizeStyle({ backgroundColor: __props.color }),
  20109. onClick: handleClick
  20110. }, [createElementVNode("span", { class: normalizeClass(unref(ns).e("content")) }, [renderSlot(_ctx.$slots, "default")], 2), __props.closable ? (openBlock(), createElementBlock("button", {
  20111. key: 0,
  20112. "aria-label": unref(t)("el.tag.close"),
  20113. class: normalizeClass(unref(ns).e("close")),
  20114. type: "button",
  20115. onClick: withModifiers(handleClose, ["stop"])
  20116. }, [createVNode(unref(ElIcon), null, {
  20117. default: withCtx(() => [createVNode(unref(close_default))]),
  20118. _: 1
  20119. })], 10, _hoisted_2$37)) : createCommentVNode("v-if", true)], 6)]),
  20120. _: 3
  20121. }, 8, ["name"]));
  20122. };
  20123. }
  20124. });
  20125. //#endregion
  20126. //#region ../../packages/components/tag/src/tag.vue
  20127. var tag_default = tag_vue_vue_type_script_setup_true_lang_default;
  20128. //#endregion
  20129. //#region ../../packages/components/tag/index.ts
  20130. const ElTag = withInstall(tag_default);
  20131. //#endregion
  20132. //#region ../../packages/components/select-v2/src/useProps.ts
  20133. const defaultProps$2 = {
  20134. label: "label",
  20135. value: "value",
  20136. disabled: "disabled",
  20137. options: "options"
  20138. };
  20139. function useProps(props) {
  20140. const aliasProps = ref({
  20141. ...defaultProps$2,
  20142. ...props.props
  20143. });
  20144. let cache = { ...props.props };
  20145. watch(() => props.props, (val) => {
  20146. if (!isEqual$1(val, cache)) {
  20147. aliasProps.value = {
  20148. ...defaultProps$2,
  20149. ...val
  20150. };
  20151. cache = { ...val };
  20152. }
  20153. }, { deep: true });
  20154. const getLabel = (option) => get(option, aliasProps.value.label);
  20155. const getValue = (option) => get(option, aliasProps.value.value);
  20156. const getDisabled = (option) => get(option, aliasProps.value.disabled);
  20157. const getOptions = (option) => get(option, aliasProps.value.options);
  20158. return {
  20159. aliasProps,
  20160. getLabel,
  20161. getValue,
  20162. getDisabled,
  20163. getOptions
  20164. };
  20165. }
  20166. //#endregion
  20167. //#region ../../packages/components/select/src/token.ts
  20168. const selectGroupKey = Symbol("ElSelectGroup");
  20169. const selectKey = Symbol("ElSelect");
  20170. //#endregion
  20171. //#region ../../packages/components/select/src/option.ts
  20172. const COMPONENT_NAME$14 = "ElOption";
  20173. const optionProps = buildProps({
  20174. value: {
  20175. type: [
  20176. String,
  20177. Number,
  20178. Boolean,
  20179. Object
  20180. ],
  20181. required: true
  20182. },
  20183. label: { type: [String, Number] },
  20184. created: Boolean,
  20185. disabled: Boolean
  20186. });
  20187. //#endregion
  20188. //#region ../../packages/components/select/src/useOption.ts
  20189. function useOption$1(props, states) {
  20190. const select = inject(selectKey);
  20191. if (!select) throwError(COMPONENT_NAME$14, "usage: <el-select><el-option /></el-select/>");
  20192. const selectGroup = inject(selectGroupKey, { disabled: false });
  20193. const itemSelected = computed(() => {
  20194. return contains(castArray$1(select.props.modelValue), props.value);
  20195. });
  20196. const limitReached = computed(() => {
  20197. if (select.props.multiple) {
  20198. const modelValue = castArray$1(select.props.modelValue ?? []);
  20199. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  20200. } else return false;
  20201. });
  20202. const currentLabel = computed(() => {
  20203. return props.label ?? (isObject$1(props.value) ? "" : props.value);
  20204. });
  20205. const currentValue = computed(() => {
  20206. return props.value || props.label || "";
  20207. });
  20208. const isDisabled = computed(() => {
  20209. return props.disabled || states.groupDisabled || limitReached.value;
  20210. });
  20211. const instance = getCurrentInstance();
  20212. const contains = (arr = [], target) => {
  20213. if (!isObject$1(props.value)) return arr && arr.includes(target);
  20214. else {
  20215. const valueKey = select.props.valueKey;
  20216. return arr && arr.some((item) => {
  20217. return toRaw(get(item, valueKey)) === get(target, valueKey);
  20218. });
  20219. }
  20220. };
  20221. const hoverItem = () => {
  20222. if (!isDisabled.value) select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
  20223. };
  20224. const updateOption = (query) => {
  20225. states.visible = new RegExp(escapeStringRegexp(query), "i").test(String(currentLabel.value)) || props.created;
  20226. };
  20227. watch(() => currentLabel.value, () => {
  20228. if (!props.created && !select.props.remote) select.setSelected();
  20229. });
  20230. watch(() => props.value, (val, oldVal) => {
  20231. const { remote, valueKey } = select.props;
  20232. if (remote ? val !== oldVal : !isEqual$1(val, oldVal)) {
  20233. select.onOptionDestroy(oldVal, instance.proxy);
  20234. select.onOptionCreate(instance.proxy);
  20235. }
  20236. if (!props.created && !remote) {
  20237. if (valueKey && isObject$1(val) && isObject$1(oldVal) && val[valueKey] === oldVal[valueKey]) return;
  20238. select.setSelected();
  20239. }
  20240. });
  20241. watch(() => selectGroup.disabled, () => {
  20242. states.groupDisabled = selectGroup.disabled;
  20243. }, { immediate: true });
  20244. return {
  20245. select,
  20246. currentLabel,
  20247. currentValue,
  20248. itemSelected,
  20249. isDisabled,
  20250. hoverItem,
  20251. updateOption
  20252. };
  20253. }
  20254. //#endregion
  20255. //#region ../../packages/components/select/src/option.vue?vue&type=script&lang.ts
  20256. var option_vue_vue_type_script_lang_default = defineComponent({
  20257. name: COMPONENT_NAME$14,
  20258. componentName: COMPONENT_NAME$14,
  20259. props: optionProps,
  20260. setup(props) {
  20261. const ns = useNamespace("select");
  20262. const id = useId();
  20263. const containerKls = computed(() => [
  20264. ns.be("dropdown", "item"),
  20265. ns.is("disabled", unref(isDisabled)),
  20266. ns.is("selected", unref(itemSelected)),
  20267. ns.is("hovering", unref(hover))
  20268. ]);
  20269. const states = reactive({
  20270. index: -1,
  20271. groupDisabled: false,
  20272. visible: true,
  20273. hover: false
  20274. });
  20275. const { currentLabel, itemSelected, isDisabled, select, hoverItem, updateOption } = useOption$1(props, states);
  20276. const { visible, hover } = toRefs(states);
  20277. const vm = getCurrentInstance().proxy;
  20278. select.onOptionCreate(vm);
  20279. onBeforeUnmount(() => {
  20280. const key = vm.value;
  20281. nextTick(() => {
  20282. const { selected: selectedOptions } = select.states;
  20283. const doesSelected = selectedOptions.some((item) => {
  20284. return item.value === vm.value;
  20285. });
  20286. if (select.states.cachedOptions.get(key) === vm && !doesSelected) select.states.cachedOptions.delete(key);
  20287. });
  20288. select.onOptionDestroy(key, vm);
  20289. });
  20290. function selectOptionClick() {
  20291. if (!isDisabled.value) select.handleOptionSelect(vm);
  20292. }
  20293. return {
  20294. ns,
  20295. id,
  20296. containerKls,
  20297. currentLabel,
  20298. itemSelected,
  20299. isDisabled,
  20300. select,
  20301. visible,
  20302. hover,
  20303. states,
  20304. hoverItem,
  20305. updateOption,
  20306. selectOptionClick
  20307. };
  20308. }
  20309. });
  20310. //#endregion
  20311. //#region ../../packages/components/select/src/option.vue
  20312. const _hoisted_1$66 = [
  20313. "id",
  20314. "aria-disabled",
  20315. "aria-selected"
  20316. ];
  20317. function _sfc_render$20(_ctx, _cache, $props, $setup, $data, $options) {
  20318. return withDirectives((openBlock(), createElementBlock("li", {
  20319. id: _ctx.id,
  20320. class: normalizeClass(_ctx.containerKls),
  20321. role: "option",
  20322. "aria-disabled": _ctx.isDisabled || void 0,
  20323. "aria-selected": _ctx.itemSelected,
  20324. onMousemove: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  20325. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  20326. }, [renderSlot(_ctx.$slots, "default", {}, () => [createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)])], 42, _hoisted_1$66)), [[vShow, _ctx.visible]]);
  20327. }
  20328. var option_default = /* @__PURE__ */ _plugin_vue_export_helper_default(option_vue_vue_type_script_lang_default, [["render", _sfc_render$20]]);
  20329. //#endregion
  20330. //#region ../../packages/components/select/src/select-dropdown.vue?vue&type=script&lang.ts
  20331. var select_dropdown_vue_vue_type_script_lang_default = defineComponent({
  20332. name: "ElSelectDropdown",
  20333. componentName: "ElSelectDropdown",
  20334. setup() {
  20335. const select = inject(selectKey);
  20336. const ns = useNamespace("select");
  20337. const popperClass = computed(() => select.props.popperClass);
  20338. const isMultiple = computed(() => select.props.multiple);
  20339. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  20340. const minWidth = ref("");
  20341. function updateMinWidth() {
  20342. const offsetWidth = select.selectRef?.offsetWidth;
  20343. if (offsetWidth) minWidth.value = `${offsetWidth - BORDER_HORIZONTAL_WIDTH}px`;
  20344. else minWidth.value = "";
  20345. }
  20346. onMounted(() => {
  20347. updateMinWidth();
  20348. useResizeObserver(select.selectRef, updateMinWidth);
  20349. });
  20350. return {
  20351. ns,
  20352. minWidth,
  20353. popperClass,
  20354. isMultiple,
  20355. isFitInputWidth
  20356. };
  20357. }
  20358. });
  20359. //#endregion
  20360. //#region ../../packages/components/select/src/select-dropdown.vue
  20361. function _sfc_render$19(_ctx, _cache, $props, $setup, $data, $options) {
  20362. return openBlock(), createElementBlock("div", {
  20363. class: normalizeClass([
  20364. _ctx.ns.b("dropdown"),
  20365. _ctx.ns.is("multiple", _ctx.isMultiple),
  20366. _ctx.popperClass
  20367. ]),
  20368. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  20369. }, [
  20370. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  20371. key: 0,
  20372. class: normalizeClass(_ctx.ns.be("dropdown", "header"))
  20373. }, [renderSlot(_ctx.$slots, "header")], 2)) : createCommentVNode("v-if", true),
  20374. renderSlot(_ctx.$slots, "default"),
  20375. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  20376. key: 1,
  20377. class: normalizeClass(_ctx.ns.be("dropdown", "footer"))
  20378. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  20379. ], 6);
  20380. }
  20381. var select_dropdown_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(select_dropdown_vue_vue_type_script_lang_default, [["render", _sfc_render$19]]);
  20382. //#endregion
  20383. //#region ../../packages/components/select/src/useSelect.ts
  20384. const useSelect$2 = (props, emit) => {
  20385. const { t } = useLocale();
  20386. const slots = useSlots();
  20387. const contentId = useId();
  20388. const nsSelect = useNamespace("select");
  20389. const nsInput = useNamespace("input");
  20390. const states = reactive({
  20391. inputValue: "",
  20392. options: /* @__PURE__ */ new Map(),
  20393. cachedOptions: /* @__PURE__ */ new Map(),
  20394. optionValues: [],
  20395. selected: [],
  20396. selectionWidth: 0,
  20397. collapseItemWidth: 0,
  20398. selectedLabel: "",
  20399. hoveringIndex: -1,
  20400. previousQuery: null,
  20401. inputHovering: false,
  20402. menuVisibleOnFocus: false,
  20403. isBeforeHide: false
  20404. });
  20405. const selectRef = ref();
  20406. const selectionRef = ref();
  20407. const tooltipRef = ref();
  20408. const tagTooltipRef = ref();
  20409. const inputRef = ref();
  20410. const prefixRef = ref();
  20411. const suffixRef = ref();
  20412. const menuRef = ref();
  20413. const tagMenuRef = ref();
  20414. const collapseItemRef = ref();
  20415. const scrollbarRef = ref();
  20416. const expanded = ref(false);
  20417. const hoverOption = ref();
  20418. const debouncing = ref(false);
  20419. const { form, formItem } = useFormItem();
  20420. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  20421. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  20422. const { isComposing, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd } = useComposition({ afterComposition: (e) => onInput(e) });
  20423. const selectDisabled = useFormDisabled();
  20424. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  20425. disabled: selectDisabled,
  20426. afterFocus() {
  20427. if (props.automaticDropdown && !expanded.value) {
  20428. expanded.value = true;
  20429. states.menuVisibleOnFocus = true;
  20430. }
  20431. },
  20432. beforeBlur(event) {
  20433. return tooltipRef.value?.isFocusInsideContent(event) || tagTooltipRef.value?.isFocusInsideContent(event);
  20434. },
  20435. afterBlur() {
  20436. expanded.value = false;
  20437. states.menuVisibleOnFocus = false;
  20438. if (props.validateEvent) formItem?.validate?.("blur").catch((err) => /* @__PURE__ */ debugWarn(err));
  20439. }
  20440. });
  20441. const hasModelValue = computed(() => {
  20442. return isArray$1(props.modelValue) ? props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  20443. });
  20444. const needStatusIcon = computed(() => form?.statusIcon ?? false);
  20445. const showClearBtn = computed(() => {
  20446. return props.clearable && !selectDisabled.value && hasModelValue.value && (isFocused.value || states.inputHovering);
  20447. });
  20448. const iconComponent = computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  20449. const iconReverse = computed(() => nsSelect.is("reverse", !!(iconComponent.value && expanded.value)));
  20450. const validateState = computed(() => formItem?.validateState || "");
  20451. const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  20452. const debounce = computed(() => props.remote ? props.debounce : 0);
  20453. const isRemoteSearchEmpty = computed(() => props.remote && !states.inputValue && states.options.size === 0);
  20454. const emptyText = computed(() => {
  20455. if (props.loading) return props.loadingText || t("el.select.loading");
  20456. else {
  20457. if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) return props.noMatchText || t("el.select.noMatch");
  20458. if (states.options.size === 0) return props.noDataText || t("el.select.noData");
  20459. }
  20460. return null;
  20461. });
  20462. const filteredOptionsCount = computed(() => optionsArray.value.filter((option) => option.visible).length);
  20463. const optionsArray = computed(() => {
  20464. const list = Array.from(states.options.values());
  20465. const newList = [];
  20466. states.optionValues.forEach((item) => {
  20467. const index = list.findIndex((i) => i.value === item);
  20468. if (index > -1) newList.push(list[index]);
  20469. });
  20470. return newList.length >= list.length ? newList : list;
  20471. });
  20472. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  20473. const showNewOption = computed(() => {
  20474. const hasExistingOption = optionsArray.value.filter((option) => {
  20475. return !option.created;
  20476. }).some((option) => {
  20477. return option.currentLabel === states.inputValue;
  20478. });
  20479. return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
  20480. });
  20481. const updateOptions = () => {
  20482. if (props.filterable && isFunction$1(props.filterMethod)) return;
  20483. if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) return;
  20484. optionsArray.value.forEach((option) => {
  20485. option.updateOption?.(states.inputValue);
  20486. });
  20487. };
  20488. const selectSize = useFormSize();
  20489. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  20490. const dropdownMenuVisible = computed({
  20491. get() {
  20492. return expanded.value && (props.loading || !isRemoteSearchEmpty.value || props.remote && !!slots.empty) && (!debouncing.value || !isEmpty(states.previousQuery) || states.options.size > 0);
  20493. },
  20494. set(val) {
  20495. expanded.value = val;
  20496. }
  20497. });
  20498. const shouldShowPlaceholder = computed(() => {
  20499. if (props.multiple && !isUndefined(props.modelValue)) return castArray$1(props.modelValue).length === 0 && !states.inputValue;
  20500. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  20501. return props.filterable || isUndefined(value) ? !states.inputValue : true;
  20502. });
  20503. const currentPlaceholder = computed(() => {
  20504. const _placeholder = props.placeholder ?? t("el.select.placeholder");
  20505. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  20506. });
  20507. const mouseEnterEventName = computed(() => isIOS ? null : "mouseenter");
  20508. watch(() => props.modelValue, (val, oldVal) => {
  20509. if (props.multiple) {
  20510. if (props.filterable && !props.reserveKeyword) {
  20511. states.inputValue = "";
  20512. handleQueryChange("");
  20513. }
  20514. }
  20515. setSelected();
  20516. if (!isEqual$1(val, oldVal) && props.validateEvent) formItem?.validate("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  20517. }, {
  20518. flush: "post",
  20519. deep: true
  20520. });
  20521. watch(() => expanded.value, (val) => {
  20522. if (val) handleQueryChange(states.inputValue);
  20523. else {
  20524. states.inputValue = "";
  20525. states.previousQuery = null;
  20526. states.isBeforeHide = true;
  20527. states.menuVisibleOnFocus = false;
  20528. }
  20529. });
  20530. watch(() => states.options.entries(), () => {
  20531. if (!isClient) return;
  20532. setSelected();
  20533. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) checkDefaultFirstOption();
  20534. }, { flush: "post" });
  20535. watch([() => states.hoveringIndex, optionsArray], ([val]) => {
  20536. if (isNumber(val) && val > -1) hoverOption.value = optionsArray.value[val] || {};
  20537. else hoverOption.value = {};
  20538. optionsArray.value.forEach((option) => {
  20539. option.hover = hoverOption.value === option;
  20540. });
  20541. });
  20542. watchEffect(() => {
  20543. if (states.isBeforeHide) return;
  20544. updateOptions();
  20545. });
  20546. const handleQueryChange = (val) => {
  20547. if (states.previousQuery === val || isComposing.value) return;
  20548. states.previousQuery = val;
  20549. if (props.filterable && isFunction$1(props.filterMethod)) props.filterMethod(val);
  20550. else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) props.remoteMethod(val);
  20551. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) nextTick(checkDefaultFirstOption);
  20552. else nextTick(updateHoveringIndex);
  20553. };
  20554. /**
  20555. * find and highlight first option as default selected
  20556. * @remark
  20557. * - if the first option in dropdown list is user-created,
  20558. * it would be at the end of the optionsArray
  20559. * so find it and set hover.
  20560. * (NOTE: there must be only one user-created option in dropdown list with query)
  20561. * - if there's no user-created option in list, just find the first one as usual
  20562. * (NOTE: exclude options that are disabled or in disabled-group)
  20563. */
  20564. const checkDefaultFirstOption = () => {
  20565. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  20566. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  20567. const firstOriginOption = optionsInDropdown[0];
  20568. states.hoveringIndex = getValueIndex(optionsArray.value.map((item) => item.value), userCreatedOption || firstOriginOption);
  20569. };
  20570. const setSelected = () => {
  20571. if (!props.multiple) {
  20572. const option = getOption(isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue);
  20573. states.selectedLabel = option.currentLabel;
  20574. states.selected = [option];
  20575. return;
  20576. } else states.selectedLabel = "";
  20577. const result = [];
  20578. if (!isUndefined(props.modelValue)) castArray$1(props.modelValue).forEach((value) => {
  20579. result.push(getOption(value));
  20580. });
  20581. states.selected = result;
  20582. };
  20583. const getOption = (value) => {
  20584. let option;
  20585. const isObjectValue = isPlainObject$1(value);
  20586. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  20587. const cachedOption = cachedOptionsArray.value[i];
  20588. if (isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value) {
  20589. option = {
  20590. index: optionsArray.value.filter((opt) => !opt.created).indexOf(cachedOption),
  20591. value,
  20592. currentLabel: cachedOption.currentLabel,
  20593. get isDisabled() {
  20594. return cachedOption.isDisabled;
  20595. }
  20596. };
  20597. break;
  20598. }
  20599. }
  20600. if (option) return option;
  20601. return {
  20602. index: -1,
  20603. value,
  20604. currentLabel: isObjectValue ? value.label : value ?? ""
  20605. };
  20606. };
  20607. const updateHoveringIndex = () => {
  20608. const length = states.selected.length;
  20609. if (length > 0) {
  20610. const lastOption = states.selected[length - 1];
  20611. states.hoveringIndex = optionsArray.value.findIndex((item) => getValueKey(lastOption) === getValueKey(item));
  20612. } else states.hoveringIndex = -1;
  20613. };
  20614. const resetSelectionWidth = () => {
  20615. states.selectionWidth = Number.parseFloat(window.getComputedStyle(selectionRef.value).width);
  20616. };
  20617. const resetCollapseItemWidth = () => {
  20618. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  20619. };
  20620. const updateTooltip = () => {
  20621. tooltipRef.value?.updatePopper?.();
  20622. };
  20623. const updateTagTooltip = () => {
  20624. tagTooltipRef.value?.updatePopper?.();
  20625. };
  20626. const onInputChange = () => {
  20627. if (states.inputValue.length > 0 && !expanded.value) expanded.value = true;
  20628. handleQueryChange(states.inputValue);
  20629. };
  20630. const onInput = (event) => {
  20631. states.inputValue = event.target.value;
  20632. if (props.remote) {
  20633. debouncing.value = true;
  20634. debouncedOnInputChange();
  20635. } else return onInputChange();
  20636. };
  20637. const debouncedOnInputChange = useDebounceFn(() => {
  20638. onInputChange();
  20639. debouncing.value = false;
  20640. }, debounce);
  20641. const emitChange = (val) => {
  20642. if (!isEqual$1(props.modelValue, val)) emit(CHANGE_EVENT, val);
  20643. };
  20644. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => {
  20645. const option = states.cachedOptions.get(it);
  20646. return !option?.disabled && !option?.states.groupDisabled;
  20647. });
  20648. const deletePrevTag = (e) => {
  20649. const code = getEventCode(e);
  20650. if (!props.multiple) return;
  20651. if (code === EVENT_CODE.delete) return;
  20652. if (e.target.value.length <= 0) {
  20653. const value = castArray$1(props.modelValue).slice();
  20654. const lastNotDisabledIndex = getLastNotDisabledIndex(value);
  20655. if (lastNotDisabledIndex < 0) return;
  20656. const removeTagValue = value[lastNotDisabledIndex];
  20657. value.splice(lastNotDisabledIndex, 1);
  20658. emit(UPDATE_MODEL_EVENT, value);
  20659. emitChange(value);
  20660. emit("remove-tag", removeTagValue);
  20661. }
  20662. };
  20663. const deleteTag = (event, tag) => {
  20664. const index = states.selected.indexOf(tag);
  20665. if (index > -1 && !selectDisabled.value) {
  20666. const value = castArray$1(props.modelValue).slice();
  20667. value.splice(index, 1);
  20668. emit(UPDATE_MODEL_EVENT, value);
  20669. emitChange(value);
  20670. emit("remove-tag", tag.value);
  20671. }
  20672. event.stopPropagation();
  20673. focus();
  20674. };
  20675. const deleteSelected = (event) => {
  20676. event.stopPropagation();
  20677. const value = props.multiple ? [] : valueOnClear.value;
  20678. if (props.multiple) {
  20679. for (const item of states.selected) if (item.isDisabled) value.push(item.value);
  20680. }
  20681. emit(UPDATE_MODEL_EVENT, value);
  20682. emitChange(value);
  20683. states.hoveringIndex = -1;
  20684. expanded.value = false;
  20685. emit("clear");
  20686. focus();
  20687. };
  20688. const handleOptionSelect = (option) => {
  20689. if (props.multiple) {
  20690. const value = castArray$1(props.modelValue ?? []).slice();
  20691. const optionIndex = getValueIndex(value, option);
  20692. if (optionIndex > -1) value.splice(optionIndex, 1);
  20693. else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) value.push(option.value);
  20694. emit(UPDATE_MODEL_EVENT, value);
  20695. emitChange(value);
  20696. if (option.created) handleQueryChange("");
  20697. if (props.filterable && (option.created || !props.reserveKeyword)) states.inputValue = "";
  20698. } else {
  20699. !isEqual$1(props.modelValue, option.value) && emit(UPDATE_MODEL_EVENT, option.value);
  20700. emitChange(option.value);
  20701. expanded.value = false;
  20702. }
  20703. focus();
  20704. if (expanded.value) return;
  20705. nextTick(() => {
  20706. scrollToOption(option);
  20707. });
  20708. };
  20709. const getValueIndex = (arr, option) => {
  20710. if (isUndefined(option)) return -1;
  20711. if (!isObject$1(option.value)) return arr.indexOf(option.value);
  20712. return arr.findIndex((item) => {
  20713. return isEqual$1(get(item, props.valueKey), getValueKey(option));
  20714. });
  20715. };
  20716. const scrollToOption = (option) => {
  20717. const targetOption = isArray$1(option) ? option[option.length - 1] : option;
  20718. let target = null;
  20719. if (!isNil(targetOption?.value)) {
  20720. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  20721. if (options.length > 0) target = options[0].$el;
  20722. }
  20723. if (tooltipRef.value && target) {
  20724. const menu = tooltipRef.value?.popperRef?.contentRef?.querySelector?.(`.${nsSelect.be("dropdown", "wrap")}`);
  20725. if (menu) scrollIntoView(menu, target);
  20726. }
  20727. scrollbarRef.value?.handleScroll();
  20728. };
  20729. const onOptionCreate = (vm) => {
  20730. states.options.set(vm.value, vm);
  20731. states.cachedOptions.set(vm.value, vm);
  20732. };
  20733. const onOptionDestroy = (key, vm) => {
  20734. if (states.options.get(key) === vm) states.options.delete(key);
  20735. };
  20736. const popperRef = computed(() => {
  20737. return tooltipRef.value?.popperRef?.contentRef;
  20738. });
  20739. const handleMenuEnter = () => {
  20740. states.isBeforeHide = false;
  20741. nextTick(() => {
  20742. scrollbarRef.value?.update();
  20743. scrollToOption(states.selected);
  20744. });
  20745. };
  20746. const focus = () => {
  20747. inputRef.value?.focus();
  20748. };
  20749. const blur = () => {
  20750. if (expanded.value) {
  20751. expanded.value = false;
  20752. nextTick(() => inputRef.value?.blur());
  20753. return;
  20754. }
  20755. inputRef.value?.blur();
  20756. };
  20757. const handleClearClick = (event) => {
  20758. deleteSelected(event);
  20759. };
  20760. const handleClickOutside = (event) => {
  20761. expanded.value = false;
  20762. if (isFocused.value) {
  20763. const _event = new FocusEvent("blur", event);
  20764. nextTick(() => handleBlur(_event));
  20765. }
  20766. };
  20767. const handleEsc = () => {
  20768. if (states.inputValue.length > 0) states.inputValue = "";
  20769. else expanded.value = false;
  20770. };
  20771. const toggleMenu = (event) => {
  20772. if (selectDisabled.value || props.filterable && expanded.value && event && !suffixRef.value?.contains(event.target)) return;
  20773. if (isIOS) states.inputHovering = true;
  20774. if (states.menuVisibleOnFocus) states.menuVisibleOnFocus = false;
  20775. else expanded.value = !expanded.value;
  20776. };
  20777. const selectOption = () => {
  20778. if (!expanded.value) toggleMenu();
  20779. else {
  20780. const option = optionsArray.value[states.hoveringIndex];
  20781. if (option && !option.isDisabled) handleOptionSelect(option);
  20782. }
  20783. };
  20784. const getValueKey = (item) => {
  20785. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  20786. };
  20787. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.isDisabled));
  20788. const showTagList = computed(() => {
  20789. if (!props.multiple) return [];
  20790. return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
  20791. });
  20792. const collapseTagList = computed(() => {
  20793. if (!props.multiple) return [];
  20794. return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
  20795. });
  20796. const navigateOptions = (direction) => {
  20797. if (!expanded.value) {
  20798. expanded.value = true;
  20799. return;
  20800. }
  20801. if (states.options.size === 0 || filteredOptionsCount.value === 0 || isComposing.value) return;
  20802. if (!optionsAllDisabled.value) {
  20803. if (direction === "next") {
  20804. states.hoveringIndex++;
  20805. if (states.hoveringIndex === states.options.size) states.hoveringIndex = 0;
  20806. } else if (direction === "prev") {
  20807. states.hoveringIndex--;
  20808. if (states.hoveringIndex < 0) states.hoveringIndex = states.options.size - 1;
  20809. }
  20810. const option = optionsArray.value[states.hoveringIndex];
  20811. if (option.isDisabled || !option.visible) navigateOptions(direction);
  20812. nextTick(() => scrollToOption(hoverOption.value));
  20813. }
  20814. };
  20815. const findFocusableIndex = (arr, start, step, len) => {
  20816. for (let i = start; i >= 0 && i < len; i += step) {
  20817. const obj = arr[i];
  20818. if (!obj?.isDisabled && obj?.visible) return i;
  20819. }
  20820. return null;
  20821. };
  20822. const focusOption = (targetIndex, mode) => {
  20823. const len = states.options.size;
  20824. if (len === 0) return;
  20825. const start = clamp$1(targetIndex, 0, len - 1);
  20826. const options = optionsArray.value;
  20827. const direction = mode === "up" ? -1 : 1;
  20828. const newIndex = findFocusableIndex(options, start, direction, len) ?? findFocusableIndex(options, start - direction, -direction, len);
  20829. if (newIndex != null) {
  20830. states.hoveringIndex = newIndex;
  20831. nextTick(() => scrollToOption(hoverOption.value));
  20832. }
  20833. };
  20834. const handleKeydown = (e) => {
  20835. const code = getEventCode(e);
  20836. let isPreventDefault = true;
  20837. switch (code) {
  20838. case EVENT_CODE.up:
  20839. navigateOptions("prev");
  20840. break;
  20841. case EVENT_CODE.down:
  20842. navigateOptions("next");
  20843. break;
  20844. case EVENT_CODE.enter:
  20845. case EVENT_CODE.numpadEnter:
  20846. if (!isComposing.value) selectOption();
  20847. break;
  20848. case EVENT_CODE.esc:
  20849. handleEsc();
  20850. break;
  20851. case EVENT_CODE.backspace:
  20852. isPreventDefault = false;
  20853. deletePrevTag(e);
  20854. return;
  20855. case EVENT_CODE.home:
  20856. if (!expanded.value) return;
  20857. focusOption(0, "down");
  20858. break;
  20859. case EVENT_CODE.end:
  20860. if (!expanded.value) return;
  20861. focusOption(states.options.size - 1, "up");
  20862. break;
  20863. case EVENT_CODE.pageUp:
  20864. if (!expanded.value) return;
  20865. focusOption(states.hoveringIndex - 10, "up");
  20866. break;
  20867. case EVENT_CODE.pageDown:
  20868. if (!expanded.value) return;
  20869. focusOption(states.hoveringIndex + 10, "down");
  20870. break;
  20871. default:
  20872. isPreventDefault = false;
  20873. break;
  20874. }
  20875. if (isPreventDefault) {
  20876. e.preventDefault();
  20877. e.stopPropagation();
  20878. }
  20879. };
  20880. const getGapWidth = () => {
  20881. if (!selectionRef.value) return 0;
  20882. const style = window.getComputedStyle(selectionRef.value);
  20883. return Number.parseFloat(style.gap || "6px");
  20884. };
  20885. const tagStyle = computed(() => {
  20886. const gapWidth = getGapWidth();
  20887. const inputSlotWidth = props.filterable ? gapWidth + MINIMUM_INPUT_WIDTH : 0;
  20888. return { maxWidth: `${collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.selectionWidth - inputSlotWidth}px` };
  20889. });
  20890. const collapseTagStyle = computed(() => {
  20891. return { maxWidth: `${states.selectionWidth}px` };
  20892. });
  20893. const popupScroll = (data) => {
  20894. emit("popup-scroll", data);
  20895. };
  20896. useResizeObserver(selectionRef, resetSelectionWidth);
  20897. useResizeObserver(wrapperRef, updateTooltip);
  20898. useResizeObserver(tagMenuRef, updateTagTooltip);
  20899. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  20900. let stop;
  20901. watch(() => dropdownMenuVisible.value, (newVal) => {
  20902. if (newVal) stop = useResizeObserver(menuRef, updateTooltip).stop;
  20903. else {
  20904. stop?.();
  20905. stop = void 0;
  20906. }
  20907. emit("visible-change", newVal);
  20908. });
  20909. onMounted(() => {
  20910. setSelected();
  20911. });
  20912. return {
  20913. inputId,
  20914. contentId,
  20915. nsSelect,
  20916. nsInput,
  20917. states,
  20918. isFocused,
  20919. expanded,
  20920. optionsArray,
  20921. hoverOption,
  20922. selectSize,
  20923. filteredOptionsCount,
  20924. updateTooltip,
  20925. updateTagTooltip,
  20926. debouncedOnInputChange,
  20927. onInput,
  20928. deletePrevTag,
  20929. deleteTag,
  20930. deleteSelected,
  20931. handleOptionSelect,
  20932. scrollToOption,
  20933. hasModelValue,
  20934. shouldShowPlaceholder,
  20935. currentPlaceholder,
  20936. mouseEnterEventName,
  20937. needStatusIcon,
  20938. showClearBtn,
  20939. iconComponent,
  20940. iconReverse,
  20941. validateState,
  20942. validateIcon,
  20943. showNewOption,
  20944. updateOptions,
  20945. collapseTagSize,
  20946. setSelected,
  20947. selectDisabled,
  20948. emptyText,
  20949. handleCompositionStart,
  20950. handleCompositionUpdate,
  20951. handleCompositionEnd,
  20952. handleKeydown,
  20953. onOptionCreate,
  20954. onOptionDestroy,
  20955. handleMenuEnter,
  20956. focus,
  20957. blur,
  20958. handleClearClick,
  20959. handleClickOutside,
  20960. handleEsc,
  20961. toggleMenu,
  20962. selectOption,
  20963. getValueKey,
  20964. navigateOptions,
  20965. dropdownMenuVisible,
  20966. showTagList,
  20967. collapseTagList,
  20968. popupScroll,
  20969. getOption,
  20970. tagStyle,
  20971. collapseTagStyle,
  20972. popperRef,
  20973. inputRef,
  20974. tooltipRef,
  20975. tagTooltipRef,
  20976. prefixRef,
  20977. suffixRef,
  20978. selectRef,
  20979. wrapperRef,
  20980. selectionRef,
  20981. scrollbarRef,
  20982. menuRef,
  20983. tagMenuRef,
  20984. collapseItemRef
  20985. };
  20986. };
  20987. //#endregion
  20988. //#region ../../packages/components/select/src/options.ts
  20989. var options_default = defineComponent({
  20990. name: "ElOptions",
  20991. setup(_, { slots }) {
  20992. const select = inject(selectKey);
  20993. let cachedValueList = [];
  20994. return () => {
  20995. const children = slots.default?.();
  20996. const valueList = [];
  20997. function filterOptions(children) {
  20998. if (!isArray$1(children)) return;
  20999. children.forEach((item) => {
  21000. const name = (item?.type || {})?.name;
  21001. if (name === "ElOptionGroup") filterOptions(!isString(item.children) && !isArray$1(item.children) && isFunction$1(item.children?.default) ? item.children?.default() : item.children);
  21002. else if (name === "ElOption") valueList.push(item.props?.value);
  21003. else if (isArray$1(item.children)) filterOptions(item.children);
  21004. });
  21005. }
  21006. if (children.length) filterOptions(children[0]?.children);
  21007. if (!isEqual$1(valueList, cachedValueList)) {
  21008. cachedValueList = valueList;
  21009. if (select) select.states.optionValues = valueList;
  21010. }
  21011. return children;
  21012. };
  21013. }
  21014. });
  21015. //#endregion
  21016. //#region ../../packages/components/select/src/select.ts
  21017. const selectProps = buildProps({
  21018. name: String,
  21019. id: String,
  21020. modelValue: {
  21021. type: definePropType([
  21022. Array,
  21023. String,
  21024. Number,
  21025. Boolean,
  21026. Object
  21027. ]),
  21028. default: void 0
  21029. },
  21030. autocomplete: {
  21031. type: String,
  21032. default: "off"
  21033. },
  21034. automaticDropdown: Boolean,
  21035. size: useSizeProp,
  21036. effect: {
  21037. type: definePropType(String),
  21038. default: "light"
  21039. },
  21040. disabled: {
  21041. type: Boolean,
  21042. default: void 0
  21043. },
  21044. clearable: Boolean,
  21045. filterable: Boolean,
  21046. allowCreate: Boolean,
  21047. loading: Boolean,
  21048. popperClass: {
  21049. type: String,
  21050. default: ""
  21051. },
  21052. popperStyle: { type: definePropType([String, Object]) },
  21053. popperOptions: {
  21054. type: definePropType(Object),
  21055. default: () => ({})
  21056. },
  21057. remote: Boolean,
  21058. debounce: {
  21059. type: Number,
  21060. default: 300
  21061. },
  21062. loadingText: String,
  21063. noMatchText: String,
  21064. noDataText: String,
  21065. remoteMethod: { type: definePropType(Function) },
  21066. filterMethod: { type: definePropType(Function) },
  21067. multiple: Boolean,
  21068. multipleLimit: {
  21069. type: Number,
  21070. default: 0
  21071. },
  21072. placeholder: { type: String },
  21073. defaultFirstOption: Boolean,
  21074. reserveKeyword: {
  21075. type: Boolean,
  21076. default: true
  21077. },
  21078. valueKey: {
  21079. type: String,
  21080. default: "value"
  21081. },
  21082. collapseTags: Boolean,
  21083. collapseTagsTooltip: Boolean,
  21084. tagTooltip: {
  21085. type: definePropType(Object),
  21086. default: () => ({})
  21087. },
  21088. maxCollapseTags: {
  21089. type: Number,
  21090. default: 1
  21091. },
  21092. teleported: useTooltipContentProps.teleported,
  21093. persistent: {
  21094. type: Boolean,
  21095. default: true
  21096. },
  21097. clearIcon: {
  21098. type: iconPropType,
  21099. default: circle_close_default
  21100. },
  21101. fitInputWidth: Boolean,
  21102. suffixIcon: {
  21103. type: iconPropType,
  21104. default: arrow_down_default
  21105. },
  21106. tagType: {
  21107. ...tagProps.type,
  21108. default: "info"
  21109. },
  21110. tagEffect: {
  21111. ...tagProps.effect,
  21112. default: "light"
  21113. },
  21114. validateEvent: {
  21115. type: Boolean,
  21116. default: true
  21117. },
  21118. remoteShowSuffix: Boolean,
  21119. showArrow: {
  21120. type: Boolean,
  21121. default: true
  21122. },
  21123. offset: {
  21124. type: Number,
  21125. default: 12
  21126. },
  21127. placement: {
  21128. type: definePropType(String),
  21129. values: Ee,
  21130. default: "bottom-start"
  21131. },
  21132. fallbackPlacements: {
  21133. type: definePropType(Array),
  21134. default: [
  21135. "bottom-start",
  21136. "top-start",
  21137. "right",
  21138. "left"
  21139. ]
  21140. },
  21141. tabindex: {
  21142. type: [String, Number],
  21143. default: 0
  21144. },
  21145. appendTo: useTooltipContentProps.appendTo,
  21146. options: { type: definePropType(Array) },
  21147. props: {
  21148. type: definePropType(Object),
  21149. default: () => defaultProps$2
  21150. },
  21151. ...useEmptyValuesProps,
  21152. ...useAriaProps(["ariaLabel"])
  21153. });
  21154. const selectEmits = {
  21155. [UPDATE_MODEL_EVENT]: (val) => true,
  21156. [CHANGE_EVENT]: (val) => true,
  21157. "popup-scroll": scrollbarEmits.scroll,
  21158. "remove-tag": (val) => true,
  21159. "visible-change": (visible) => true,
  21160. focus: (evt) => evt instanceof FocusEvent,
  21161. blur: (evt) => evt instanceof FocusEvent,
  21162. clear: () => true
  21163. };
  21164. //#endregion
  21165. //#region ../../packages/components/select/src/option-group.vue?vue&type=script&lang.ts
  21166. var option_group_vue_vue_type_script_lang_default = defineComponent({
  21167. name: "ElOptionGroup",
  21168. componentName: "ElOptionGroup",
  21169. props: {
  21170. label: String,
  21171. disabled: Boolean
  21172. },
  21173. setup(props) {
  21174. const ns = useNamespace("select");
  21175. const groupRef = ref();
  21176. const instance = getCurrentInstance();
  21177. const children = ref([]);
  21178. provide(selectGroupKey, reactive({ ...toRefs(props) }));
  21179. const visible = computed(() => children.value.some((option) => option.visible === true));
  21180. const isOption = (node) => node.type.name === "ElOption" && !!node.component?.proxy;
  21181. const flattedChildren = (node) => {
  21182. const nodes = castArray$1(node);
  21183. const children = [];
  21184. nodes.forEach((child) => {
  21185. if (!isVNode(child)) return;
  21186. if (isOption(child)) children.push(child.component.proxy);
  21187. else if (isArray$1(child.children) && child.children.length) children.push(...flattedChildren(child.children));
  21188. else if (child.component?.subTree) children.push(...flattedChildren(child.component.subTree));
  21189. });
  21190. return children;
  21191. };
  21192. const updateChildren = () => {
  21193. children.value = flattedChildren(instance.subTree);
  21194. };
  21195. onMounted(() => {
  21196. updateChildren();
  21197. });
  21198. useMutationObserver(groupRef, updateChildren, {
  21199. attributes: true,
  21200. subtree: true,
  21201. childList: true
  21202. });
  21203. return {
  21204. groupRef,
  21205. visible,
  21206. ns
  21207. };
  21208. }
  21209. });
  21210. //#endregion
  21211. //#region ../../packages/components/select/src/option-group.vue
  21212. function _sfc_render$18(_ctx, _cache, $props, $setup, $data, $options) {
  21213. return withDirectives((openBlock(), createElementBlock("ul", {
  21214. ref: "groupRef",
  21215. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  21216. }, [createElementVNode("li", { class: normalizeClass(_ctx.ns.be("group", "title")) }, toDisplayString(_ctx.label), 3), createElementVNode("li", null, [createElementVNode("ul", { class: normalizeClass(_ctx.ns.b("group")) }, [renderSlot(_ctx.$slots, "default")], 2)])], 2)), [[vShow, _ctx.visible]]);
  21217. }
  21218. var option_group_default = /* @__PURE__ */ _plugin_vue_export_helper_default(option_group_vue_vue_type_script_lang_default, [["render", _sfc_render$18]]);
  21219. //#endregion
  21220. //#region ../../packages/components/select/src/select.vue?vue&type=script&lang.ts
  21221. const COMPONENT_NAME$13 = "ElSelect";
  21222. const warnHandlerMap = /* @__PURE__ */ new WeakMap();
  21223. const createSelectWarnHandler = (appContext) => {
  21224. return (...args) => {
  21225. const message = args[0];
  21226. if (!message || message.includes("Slot \"default\" invoked outside of the render function") && args[2]?.includes("ElTreeSelect")) return;
  21227. const original = warnHandlerMap.get(appContext)?.originalWarnHandler;
  21228. if (original) {
  21229. original(...args);
  21230. return;
  21231. }
  21232. console.warn(...args);
  21233. };
  21234. };
  21235. const getWarnHandlerRecord = (appContext) => {
  21236. let record = warnHandlerMap.get(appContext);
  21237. if (!record) {
  21238. record = {
  21239. originalWarnHandler: appContext.config.warnHandler,
  21240. handler: createSelectWarnHandler(appContext),
  21241. count: 0
  21242. };
  21243. warnHandlerMap.set(appContext, record);
  21244. }
  21245. return record;
  21246. };
  21247. var select_vue_vue_type_script_lang_default$1 = defineComponent({
  21248. name: COMPONENT_NAME$13,
  21249. componentName: COMPONENT_NAME$13,
  21250. components: {
  21251. ElSelectMenu: select_dropdown_default$1,
  21252. ElOption: option_default,
  21253. ElOptions: options_default,
  21254. ElOptionGroup: option_group_default,
  21255. ElTag,
  21256. ElScrollbar,
  21257. ElTooltip,
  21258. ElIcon
  21259. },
  21260. directives: { ClickOutside },
  21261. props: selectProps,
  21262. emits: [
  21263. UPDATE_MODEL_EVENT,
  21264. CHANGE_EVENT,
  21265. "remove-tag",
  21266. "clear",
  21267. "visible-change",
  21268. "focus",
  21269. "blur",
  21270. "popup-scroll"
  21271. ],
  21272. setup(props, { emit, slots }) {
  21273. const instance = getCurrentInstance();
  21274. const warnRecord = getWarnHandlerRecord(instance.appContext);
  21275. warnRecord.count += 1;
  21276. instance.appContext.config.warnHandler = warnRecord.handler;
  21277. const modelValue = computed(() => {
  21278. const { modelValue: rawModelValue, multiple } = props;
  21279. const fallback = multiple ? [] : void 0;
  21280. if (isArray$1(rawModelValue)) return multiple ? rawModelValue : fallback;
  21281. return multiple ? fallback : rawModelValue;
  21282. });
  21283. const _props = reactive({
  21284. ...toRefs(props),
  21285. modelValue
  21286. });
  21287. const API = useSelect$2(_props, emit);
  21288. const { calculatorRef, inputStyle } = useCalcInputWidth();
  21289. const { getLabel, getValue, getOptions, getDisabled } = useProps(props);
  21290. const getOptionProps = (option) => ({
  21291. label: getLabel(option),
  21292. value: getValue(option),
  21293. disabled: getDisabled(option)
  21294. });
  21295. const flatTreeSelectData = (data) => {
  21296. return data.reduce((acc, item) => {
  21297. acc.push(item);
  21298. if (item.children && item.children.length > 0) acc.push(...flatTreeSelectData(item.children));
  21299. return acc;
  21300. }, []);
  21301. };
  21302. const manuallyRenderSlots = (vnodes) => {
  21303. flattedChildren(vnodes || []).forEach((item) => {
  21304. if (isObject$1(item) && (item.type.name === "ElOption" || item.type.name === "ElTree")) {
  21305. const _name = item.type.name;
  21306. if (_name === "ElTree") flatTreeSelectData(item.props?.data || []).forEach((treeItem) => {
  21307. treeItem.currentLabel = treeItem.label ?? (isObject$1(treeItem.value) ? "" : treeItem.value);
  21308. API.onOptionCreate(treeItem);
  21309. });
  21310. else if (_name === "ElOption") {
  21311. const obj = { ...item.props };
  21312. obj.currentLabel = obj.label ?? (isObject$1(obj.value) ? "" : obj.value);
  21313. API.onOptionCreate(obj);
  21314. }
  21315. }
  21316. });
  21317. };
  21318. watch(() => [props.persistent || API.expanded.value || !slots.default ? void 0 : slots.default?.(), modelValue.value], () => {
  21319. if (props.persistent || API.expanded.value) return;
  21320. if (!slots.default) return;
  21321. API.states.options.clear();
  21322. manuallyRenderSlots(slots.default?.());
  21323. }, { immediate: true });
  21324. provide(selectKey, reactive({
  21325. props: _props,
  21326. states: API.states,
  21327. selectRef: API.selectRef,
  21328. optionsArray: API.optionsArray,
  21329. setSelected: API.setSelected,
  21330. handleOptionSelect: API.handleOptionSelect,
  21331. onOptionCreate: API.onOptionCreate,
  21332. onOptionDestroy: API.onOptionDestroy
  21333. }));
  21334. const selectedLabel = computed(() => {
  21335. if (!props.multiple) return API.states.selectedLabel;
  21336. return API.states.selected.map((i) => i.currentLabel);
  21337. });
  21338. onBeforeUnmount(() => {
  21339. const record = warnHandlerMap.get(instance.appContext);
  21340. if (!record) return;
  21341. record.count -= 1;
  21342. if (record.count <= 0) {
  21343. instance.appContext.config.warnHandler = record.originalWarnHandler;
  21344. warnHandlerMap.delete(instance.appContext);
  21345. }
  21346. });
  21347. return {
  21348. ...API,
  21349. modelValue,
  21350. selectedLabel,
  21351. calculatorRef,
  21352. inputStyle,
  21353. getLabel,
  21354. getValue,
  21355. getOptions,
  21356. getDisabled,
  21357. getOptionProps
  21358. };
  21359. }
  21360. });
  21361. //#endregion
  21362. //#region ../../packages/components/select/src/select.vue
  21363. const _hoisted_1$65 = [
  21364. "id",
  21365. "value",
  21366. "name",
  21367. "disabled",
  21368. "autocomplete",
  21369. "tabindex",
  21370. "readonly",
  21371. "aria-activedescendant",
  21372. "aria-controls",
  21373. "aria-expanded",
  21374. "aria-label"
  21375. ];
  21376. const _hoisted_2$36 = ["textContent"];
  21377. const _hoisted_3$17 = { key: 1 };
  21378. function _sfc_render$17(_ctx, _cache, $props, $setup, $data, $options) {
  21379. const _component_el_tag = resolveComponent("el-tag");
  21380. const _component_el_tooltip = resolveComponent("el-tooltip");
  21381. const _component_el_icon = resolveComponent("el-icon");
  21382. const _component_el_option = resolveComponent("el-option");
  21383. const _component_el_option_group = resolveComponent("el-option-group");
  21384. const _component_el_options = resolveComponent("el-options");
  21385. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  21386. const _component_el_select_menu = resolveComponent("el-select-menu");
  21387. const _directive_click_outside = resolveDirective("click-outside");
  21388. return withDirectives((openBlock(), createElementBlock("div", mergeProps({
  21389. ref: "selectRef",
  21390. class: [_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]
  21391. }, { [toHandlerKey(_ctx.mouseEnterEventName)]: _cache[11] || (_cache[11] = ($event) => _ctx.states.inputHovering = true) }, { onMouseleave: _cache[12] || (_cache[12] = ($event) => _ctx.states.inputHovering = false) }), [createVNode(_component_el_tooltip, {
  21392. ref: "tooltipRef",
  21393. visible: _ctx.dropdownMenuVisible,
  21394. placement: _ctx.placement,
  21395. teleported: _ctx.teleported,
  21396. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  21397. "popper-style": _ctx.popperStyle,
  21398. "popper-options": _ctx.popperOptions,
  21399. "fallback-placements": _ctx.fallbackPlacements,
  21400. effect: _ctx.effect,
  21401. pure: "",
  21402. trigger: "click",
  21403. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  21404. "stop-popper-mouse-event": false,
  21405. "gpu-acceleration": false,
  21406. persistent: _ctx.persistent,
  21407. "append-to": _ctx.appendTo,
  21408. "show-arrow": _ctx.showArrow,
  21409. offset: _ctx.offset,
  21410. onBeforeShow: _ctx.handleMenuEnter,
  21411. onHide: _cache[10] || (_cache[10] = ($event) => _ctx.states.isBeforeHide = false)
  21412. }, {
  21413. default: withCtx(() => [createElementVNode("div", {
  21414. ref: "wrapperRef",
  21415. class: normalizeClass([
  21416. _ctx.nsSelect.e("wrapper"),
  21417. _ctx.nsSelect.is("focused", _ctx.isFocused),
  21418. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  21419. _ctx.nsSelect.is("filterable", _ctx.filterable),
  21420. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  21421. ]),
  21422. onClick: _cache[7] || (_cache[7] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["prevent"]))
  21423. }, [
  21424. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
  21425. key: 0,
  21426. ref: "prefixRef",
  21427. class: normalizeClass(_ctx.nsSelect.e("prefix"))
  21428. }, [renderSlot(_ctx.$slots, "prefix")], 2)) : createCommentVNode("v-if", true),
  21429. createElementVNode("div", {
  21430. ref: "selectionRef",
  21431. class: normalizeClass([_ctx.nsSelect.e("selection"), _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)])
  21432. }, [
  21433. _ctx.multiple ? renderSlot(_ctx.$slots, "tag", {
  21434. key: 0,
  21435. data: _ctx.states.selected,
  21436. deleteTag: _ctx.deleteTag,
  21437. selectDisabled: _ctx.selectDisabled
  21438. }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  21439. return openBlock(), createElementBlock("div", {
  21440. key: _ctx.getValueKey(item),
  21441. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  21442. }, [createVNode(_component_el_tag, {
  21443. closable: !_ctx.selectDisabled && !item.isDisabled,
  21444. size: _ctx.collapseTagSize,
  21445. type: _ctx.tagType,
  21446. effect: _ctx.tagEffect,
  21447. "disable-transitions": "",
  21448. style: normalizeStyle(_ctx.tagStyle),
  21449. onClose: ($event) => _ctx.deleteTag($event, item)
  21450. }, {
  21451. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, [renderSlot(_ctx.$slots, "label", {
  21452. index: item.index,
  21453. label: item.currentLabel,
  21454. value: item.value
  21455. }, () => [createTextVNode(toDisplayString(item.currentLabel), 1)])], 2)]),
  21456. _: 2
  21457. }, 1032, [
  21458. "closable",
  21459. "size",
  21460. "type",
  21461. "effect",
  21462. "style",
  21463. "onClose"
  21464. ])], 2);
  21465. }), 128)), _ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
  21466. key: 0,
  21467. ref: "tagTooltipRef",
  21468. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  21469. "fallback-placements": _ctx.tagTooltip?.fallbackPlacements ?? [
  21470. "bottom",
  21471. "top",
  21472. "right",
  21473. "left"
  21474. ],
  21475. effect: _ctx.tagTooltip?.effect ?? _ctx.effect,
  21476. placement: _ctx.tagTooltip?.placement ?? "bottom",
  21477. "popper-class": _ctx.tagTooltip?.popperClass ?? _ctx.popperClass,
  21478. "popper-style": _ctx.tagTooltip?.popperStyle ?? _ctx.popperStyle,
  21479. teleported: _ctx.tagTooltip?.teleported ?? _ctx.teleported,
  21480. "append-to": _ctx.tagTooltip?.appendTo ?? _ctx.appendTo,
  21481. "popper-options": _ctx.tagTooltip?.popperOptions ?? _ctx.popperOptions,
  21482. transition: _ctx.tagTooltip?.transition,
  21483. "show-after": _ctx.tagTooltip?.showAfter,
  21484. "hide-after": _ctx.tagTooltip?.hideAfter,
  21485. "auto-close": _ctx.tagTooltip?.autoClose,
  21486. offset: _ctx.tagTooltip?.offset
  21487. }, {
  21488. default: withCtx(() => [createElementVNode("div", {
  21489. ref: "collapseItemRef",
  21490. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  21491. }, [createVNode(_component_el_tag, {
  21492. closable: false,
  21493. size: _ctx.collapseTagSize,
  21494. type: _ctx.tagType,
  21495. effect: _ctx.tagEffect,
  21496. "disable-transitions": "",
  21497. style: normalizeStyle(_ctx.collapseTagStyle)
  21498. }, {
  21499. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, " + " + toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)]),
  21500. _: 1
  21501. }, 8, [
  21502. "size",
  21503. "type",
  21504. "effect",
  21505. "style"
  21506. ])], 2)]),
  21507. content: withCtx(() => [createElementVNode("div", {
  21508. ref: "tagMenuRef",
  21509. class: normalizeClass(_ctx.nsSelect.e("selection"))
  21510. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
  21511. return openBlock(), createElementBlock("div", {
  21512. key: _ctx.getValueKey(item),
  21513. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  21514. }, [createVNode(_component_el_tag, {
  21515. class: "in-tooltip",
  21516. closable: !_ctx.selectDisabled && !item.isDisabled,
  21517. size: _ctx.collapseTagSize,
  21518. type: _ctx.tagType,
  21519. effect: _ctx.tagEffect,
  21520. "disable-transitions": "",
  21521. onClose: ($event) => _ctx.deleteTag($event, item)
  21522. }, {
  21523. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, [renderSlot(_ctx.$slots, "label", {
  21524. index: item.index,
  21525. label: item.currentLabel,
  21526. value: item.value
  21527. }, () => [createTextVNode(toDisplayString(item.currentLabel), 1)])], 2)]),
  21528. _: 2
  21529. }, 1032, [
  21530. "closable",
  21531. "size",
  21532. "type",
  21533. "effect",
  21534. "onClose"
  21535. ])], 2);
  21536. }), 128))], 2)]),
  21537. _: 3
  21538. }, 8, [
  21539. "disabled",
  21540. "fallback-placements",
  21541. "effect",
  21542. "placement",
  21543. "popper-class",
  21544. "popper-style",
  21545. "teleported",
  21546. "append-to",
  21547. "popper-options",
  21548. "transition",
  21549. "show-after",
  21550. "hide-after",
  21551. "auto-close",
  21552. "offset"
  21553. ])) : createCommentVNode("v-if", true)]) : createCommentVNode("v-if", true),
  21554. createElementVNode("div", { class: normalizeClass([
  21555. _ctx.nsSelect.e("selected-item"),
  21556. _ctx.nsSelect.e("input-wrapper"),
  21557. _ctx.nsSelect.is("hidden", !_ctx.filterable || _ctx.selectDisabled || !_ctx.states.inputValue && !_ctx.isFocused)
  21558. ]) }, [createElementVNode("input", {
  21559. id: _ctx.inputId,
  21560. ref: "inputRef",
  21561. value: _ctx.states.inputValue,
  21562. type: "text",
  21563. name: _ctx.name,
  21564. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  21565. disabled: _ctx.selectDisabled,
  21566. autocomplete: _ctx.autocomplete,
  21567. style: normalizeStyle(_ctx.inputStyle),
  21568. tabindex: _ctx.tabindex,
  21569. role: "combobox",
  21570. readonly: !_ctx.filterable,
  21571. spellcheck: "false",
  21572. "aria-activedescendant": _ctx.hoverOption?.id || "",
  21573. "aria-controls": _ctx.contentId,
  21574. "aria-expanded": _ctx.dropdownMenuVisible,
  21575. "aria-label": _ctx.ariaLabel,
  21576. "aria-autocomplete": "none",
  21577. "aria-haspopup": "listbox",
  21578. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args)),
  21579. onCompositionstart: _cache[1] || (_cache[1] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  21580. onCompositionupdate: _cache[2] || (_cache[2] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  21581. onCompositionend: _cache[3] || (_cache[3] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  21582. onInput: _cache[4] || (_cache[4] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  21583. onChange: _cache[5] || (_cache[5] = withModifiers(() => {}, ["stop"])),
  21584. onClick: _cache[6] || (_cache[6] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  21585. }, null, 46, _hoisted_1$65), _ctx.filterable ? (openBlock(), createElementBlock("span", {
  21586. key: 0,
  21587. ref: "calculatorRef",
  21588. "aria-hidden": "true",
  21589. class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
  21590. textContent: toDisplayString(_ctx.states.inputValue)
  21591. }, null, 10, _hoisted_2$36)) : createCommentVNode("v-if", true)], 2),
  21592. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
  21593. key: 1,
  21594. class: normalizeClass([
  21595. _ctx.nsSelect.e("selected-item"),
  21596. _ctx.nsSelect.e("placeholder"),
  21597. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  21598. ])
  21599. }, [_ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
  21600. key: 0,
  21601. index: _ctx.getOption(_ctx.modelValue).index,
  21602. label: _ctx.currentPlaceholder,
  21603. value: _ctx.modelValue
  21604. }, () => [createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)]) : (openBlock(), createElementBlock("span", _hoisted_3$17, toDisplayString(_ctx.currentPlaceholder), 1))], 2)) : createCommentVNode("v-if", true)
  21605. ], 2),
  21606. createElementVNode("div", {
  21607. ref: "suffixRef",
  21608. class: normalizeClass(_ctx.nsSelect.e("suffix"))
  21609. }, [
  21610. _ctx.iconComponent && !_ctx.showClearBtn ? (openBlock(), createBlock(_component_el_icon, {
  21611. key: 0,
  21612. class: normalizeClass([
  21613. _ctx.nsSelect.e("caret"),
  21614. _ctx.nsSelect.e("icon"),
  21615. _ctx.iconReverse
  21616. ])
  21617. }, {
  21618. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))]),
  21619. _: 1
  21620. }, 8, ["class"])) : createCommentVNode("v-if", true),
  21621. _ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  21622. key: 1,
  21623. class: normalizeClass([
  21624. _ctx.nsSelect.e("caret"),
  21625. _ctx.nsSelect.e("icon"),
  21626. _ctx.nsSelect.e("clear")
  21627. ]),
  21628. onClick: _ctx.handleClearClick
  21629. }, {
  21630. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))]),
  21631. _: 1
  21632. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  21633. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
  21634. key: 2,
  21635. class: normalizeClass([
  21636. _ctx.nsInput.e("icon"),
  21637. _ctx.nsInput.e("validateIcon"),
  21638. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  21639. ])
  21640. }, {
  21641. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))]),
  21642. _: 1
  21643. }, 8, ["class"])) : createCommentVNode("v-if", true)
  21644. ], 2)
  21645. ], 2)]),
  21646. content: withCtx(() => [createVNode(_component_el_select_menu, { ref: "menuRef" }, {
  21647. default: withCtx(() => [
  21648. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  21649. key: 0,
  21650. class: normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  21651. onClick: _cache[8] || (_cache[8] = withModifiers(() => {}, ["stop"]))
  21652. }, [renderSlot(_ctx.$slots, "header")], 2)) : createCommentVNode("v-if", true),
  21653. withDirectives(createVNode(_component_el_scrollbar, {
  21654. id: _ctx.contentId,
  21655. ref: "scrollbarRef",
  21656. tag: "ul",
  21657. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  21658. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  21659. class: normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
  21660. role: "listbox",
  21661. "aria-label": _ctx.ariaLabel,
  21662. "aria-orientation": "vertical",
  21663. onScroll: _ctx.popupScroll
  21664. }, {
  21665. default: withCtx(() => [_ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  21666. key: 0,
  21667. value: _ctx.states.inputValue,
  21668. created: true
  21669. }, null, 8, ["value"])) : createCommentVNode("v-if", true), createVNode(_component_el_options, null, {
  21670. default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
  21671. return openBlock(), createElementBlock(Fragment, { key: index }, [_ctx.getOptions(option)?.length ? (openBlock(), createBlock(_component_el_option_group, {
  21672. key: 0,
  21673. label: _ctx.getLabel(option),
  21674. disabled: _ctx.getDisabled(option)
  21675. }, {
  21676. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.getOptions(option), (item) => {
  21677. return openBlock(), createBlock(_component_el_option, mergeProps({ key: _ctx.getValue(item) }, { ref_for: true }, _ctx.getOptionProps(item)), null, 16);
  21678. }), 128))]),
  21679. _: 2
  21680. }, 1032, ["label", "disabled"])) : (openBlock(), createBlock(_component_el_option, mergeProps({
  21681. key: 1,
  21682. ref_for: true
  21683. }, _ctx.getOptionProps(option)), null, 16))], 64);
  21684. }), 128))])]),
  21685. _: 3
  21686. })]),
  21687. _: 3
  21688. }, 8, [
  21689. "id",
  21690. "wrap-class",
  21691. "view-class",
  21692. "class",
  21693. "aria-label",
  21694. "onScroll"
  21695. ]), [[vShow, _ctx.states.options.size > 0 && !_ctx.loading]]),
  21696. _ctx.$slots.loading && _ctx.loading ? (openBlock(), createElementBlock("div", {
  21697. key: 1,
  21698. class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  21699. }, [renderSlot(_ctx.$slots, "loading")], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (openBlock(), createElementBlock("div", {
  21700. key: 2,
  21701. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  21702. }, [renderSlot(_ctx.$slots, "empty", {}, () => [createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)])], 2)) : createCommentVNode("v-if", true),
  21703. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  21704. key: 3,
  21705. class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  21706. onClick: _cache[9] || (_cache[9] = withModifiers(() => {}, ["stop"]))
  21707. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  21708. ]),
  21709. _: 3
  21710. }, 512)]),
  21711. _: 3
  21712. }, 8, [
  21713. "visible",
  21714. "placement",
  21715. "teleported",
  21716. "popper-class",
  21717. "popper-style",
  21718. "popper-options",
  21719. "fallback-placements",
  21720. "effect",
  21721. "transition",
  21722. "persistent",
  21723. "append-to",
  21724. "show-arrow",
  21725. "offset",
  21726. "onBeforeShow"
  21727. ])], 16)), [[
  21728. _directive_click_outside,
  21729. _ctx.handleClickOutside,
  21730. _ctx.popperRef
  21731. ]]);
  21732. }
  21733. var select_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(select_vue_vue_type_script_lang_default$1, [["render", _sfc_render$17]]);
  21734. //#endregion
  21735. //#region ../../packages/components/select/index.ts
  21736. const ElSelect = withInstall(select_default$1, {
  21737. Option: option_default,
  21738. OptionGroup: option_group_default
  21739. });
  21740. const ElOption = withNoopInstall(option_default);
  21741. const ElOptionGroup = withNoopInstall(option_group_default);
  21742. //#endregion
  21743. //#region ../../packages/components/calendar/src/select-controller.vue?vue&type=script&setup=true&lang.ts
  21744. var select_controller_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  21745. name: "SelectController",
  21746. __name: "select-controller",
  21747. props: selectControllerProps,
  21748. emits: selectControllerEmits,
  21749. setup(__props, { emit: __emit }) {
  21750. const props = __props;
  21751. const emit = __emit;
  21752. const nsSelect = useNamespace("calendar-select");
  21753. const { t, lang } = useLocale();
  21754. const monthOptions = Array.from({ length: 12 }, (_, index) => {
  21755. const actualMonth = index + 1;
  21756. return {
  21757. value: actualMonth,
  21758. label: isFunction$1(props.formatter) ? props.formatter(actualMonth, "month") : actualMonth
  21759. };
  21760. });
  21761. const yearValue = computed(() => props.date.year());
  21762. const monthValue = computed(() => props.date.month() + 1);
  21763. const yearOptions = computed(() => {
  21764. const years = [];
  21765. for (let i = -10; i < 10; i++) {
  21766. const year = yearValue.value + i;
  21767. if (year > 0) {
  21768. const label = isFunction$1(props.formatter) ? props.formatter(year, "year") : year;
  21769. years.push({
  21770. value: year,
  21771. label
  21772. });
  21773. }
  21774. }
  21775. return years;
  21776. });
  21777. const handleYearChange = (year) => {
  21778. emit("date-change", (0, import_dayjs_min.default)(new Date(year, monthValue.value - 1, 1)).locale(lang.value));
  21779. };
  21780. const handleMonthChange = (month) => {
  21781. emit("date-change", (0, import_dayjs_min.default)(new Date(yearValue.value, month - 1, 1)).locale(lang.value));
  21782. };
  21783. const selectToday = () => {
  21784. emit("date-change", "today");
  21785. };
  21786. return (_ctx, _cache) => {
  21787. return openBlock(), createElementBlock(Fragment, null, [
  21788. createVNode(unref(ElSelect), {
  21789. "model-value": yearValue.value,
  21790. size: "small",
  21791. class: normalizeClass(unref(nsSelect).e("year")),
  21792. "validate-event": false,
  21793. options: yearOptions.value,
  21794. onChange: handleYearChange
  21795. }, null, 8, [
  21796. "model-value",
  21797. "class",
  21798. "options"
  21799. ]),
  21800. createVNode(unref(ElSelect), {
  21801. "model-value": monthValue.value,
  21802. size: "small",
  21803. class: normalizeClass(unref(nsSelect).e("month")),
  21804. "validate-event": false,
  21805. options: unref(monthOptions),
  21806. onChange: handleMonthChange
  21807. }, null, 8, [
  21808. "model-value",
  21809. "class",
  21810. "options"
  21811. ]),
  21812. createVNode(unref(ElButton), {
  21813. size: "small",
  21814. onClick: selectToday
  21815. }, {
  21816. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.today")), 1)]),
  21817. _: 1
  21818. })
  21819. ], 64);
  21820. };
  21821. }
  21822. });
  21823. //#endregion
  21824. //#region ../../packages/components/calendar/src/select-controller.vue
  21825. var select_controller_default = select_controller_vue_vue_type_script_setup_true_lang_default;
  21826. //#endregion
  21827. //#region ../../packages/components/calendar/src/calendar.vue?vue&type=script&setup=true&lang.ts
  21828. const COMPONENT_NAME$12 = "ElCalendar";
  21829. var calendar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  21830. name: COMPONENT_NAME$12,
  21831. __name: "calendar",
  21832. props: calendarProps,
  21833. emits: calendarEmits,
  21834. setup(__props, { expose: __expose, emit: __emit }) {
  21835. const ns = useNamespace("calendar");
  21836. const { calculateValidatedDateRange, date, pickDay, realSelectedDay, selectDate, validatedRange, handleDateChange } = useCalendar(__props, __emit, COMPONENT_NAME$12);
  21837. const { t } = useLocale();
  21838. const i18nDate = computed(() => {
  21839. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  21840. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  21841. });
  21842. __expose({
  21843. selectedDay: realSelectedDay,
  21844. pickDay,
  21845. selectDate,
  21846. calculateValidatedDateRange
  21847. });
  21848. return (_ctx, _cache) => {
  21849. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("header")) }, [renderSlot(_ctx.$slots, "header", { date: i18nDate.value }, () => [createElementVNode("div", { class: normalizeClass(unref(ns).e("title")) }, toDisplayString(i18nDate.value), 3), unref(validatedRange).length === 0 && __props.controllerType === "button" ? (openBlock(), createElementBlock("div", {
  21850. key: 0,
  21851. class: normalizeClass(unref(ns).e("button-group"))
  21852. }, [createVNode(unref(ElButtonGroup), null, {
  21853. default: withCtx(() => [
  21854. createVNode(unref(ElButton), {
  21855. size: "small",
  21856. onClick: _cache[0] || (_cache[0] = ($event) => unref(selectDate)("prev-month"))
  21857. }, {
  21858. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.prevMonth")), 1)]),
  21859. _: 1
  21860. }),
  21861. createVNode(unref(ElButton), {
  21862. size: "small",
  21863. onClick: _cache[1] || (_cache[1] = ($event) => unref(selectDate)("today"))
  21864. }, {
  21865. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.today")), 1)]),
  21866. _: 1
  21867. }),
  21868. createVNode(unref(ElButton), {
  21869. size: "small",
  21870. onClick: _cache[2] || (_cache[2] = ($event) => unref(selectDate)("next-month"))
  21871. }, {
  21872. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.nextMonth")), 1)]),
  21873. _: 1
  21874. })
  21875. ]),
  21876. _: 1
  21877. })], 2)) : unref(validatedRange).length === 0 && __props.controllerType === "select" ? (openBlock(), createElementBlock("div", {
  21878. key: 1,
  21879. class: normalizeClass(unref(ns).e("select-controller"))
  21880. }, [createVNode(select_controller_default, {
  21881. date: unref(date),
  21882. formatter: __props.formatter,
  21883. onDateChange: unref(handleDateChange)
  21884. }, null, 8, [
  21885. "date",
  21886. "formatter",
  21887. "onDateChange"
  21888. ])], 2)) : createCommentVNode("v-if", true)])], 2), unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
  21889. key: 0,
  21890. class: normalizeClass(unref(ns).e("body"))
  21891. }, [createVNode(date_table_default, {
  21892. date: unref(date),
  21893. "selected-day": unref(realSelectedDay),
  21894. onPick: unref(pickDay)
  21895. }, createSlots({ _: 2 }, [_ctx.$slots["date-cell"] ? {
  21896. name: "date-cell",
  21897. fn: withCtx((data) => [renderSlot(_ctx.$slots, "date-cell", normalizeProps(guardReactiveProps(data)))]),
  21898. key: "0"
  21899. } : void 0]), 1032, [
  21900. "date",
  21901. "selected-day",
  21902. "onPick"
  21903. ])], 2)) : (openBlock(), createElementBlock("div", {
  21904. key: 1,
  21905. class: normalizeClass(unref(ns).e("body"))
  21906. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(validatedRange), (range_, index) => {
  21907. return openBlock(), createBlock(date_table_default, {
  21908. key: index,
  21909. date: range_[0],
  21910. "selected-day": unref(realSelectedDay),
  21911. range: range_,
  21912. "hide-header": index !== 0,
  21913. onPick: unref(pickDay)
  21914. }, createSlots({ _: 2 }, [_ctx.$slots["date-cell"] ? {
  21915. name: "date-cell",
  21916. fn: withCtx((data) => [renderSlot(_ctx.$slots, "date-cell", mergeProps({ ref_for: true }, data))]),
  21917. key: "0"
  21918. } : void 0]), 1032, [
  21919. "date",
  21920. "selected-day",
  21921. "range",
  21922. "hide-header",
  21923. "onPick"
  21924. ]);
  21925. }), 128))], 2))], 2);
  21926. };
  21927. }
  21928. });
  21929. //#endregion
  21930. //#region ../../packages/components/calendar/src/calendar.vue
  21931. var calendar_default = calendar_vue_vue_type_script_setup_true_lang_default;
  21932. //#endregion
  21933. //#region ../../packages/components/calendar/index.ts
  21934. const ElCalendar = withInstall(calendar_default);
  21935. //#endregion
  21936. //#region ../../packages/components/card/src/card.ts
  21937. /**
  21938. * @deprecated Removed after 3.0.0, Use `CardProps` instead.
  21939. */
  21940. const cardProps = buildProps({
  21941. header: {
  21942. type: String,
  21943. default: ""
  21944. },
  21945. footer: {
  21946. type: String,
  21947. default: ""
  21948. },
  21949. bodyStyle: {
  21950. type: definePropType([
  21951. String,
  21952. Object,
  21953. Array
  21954. ]),
  21955. default: ""
  21956. },
  21957. headerClass: String,
  21958. bodyClass: String,
  21959. footerClass: String,
  21960. shadow: {
  21961. type: String,
  21962. values: [
  21963. "always",
  21964. "hover",
  21965. "never"
  21966. ],
  21967. default: void 0
  21968. }
  21969. });
  21970. const cardContextKey = Symbol("cardContextKey");
  21971. //#endregion
  21972. //#region ../../packages/components/card/src/card.vue?vue&type=script&setup=true&lang.ts
  21973. var card_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  21974. name: "ElCard",
  21975. __name: "card",
  21976. props: cardProps,
  21977. setup(__props) {
  21978. const globalConfig = useGlobalConfig("card");
  21979. const ns = useNamespace("card");
  21980. return (_ctx, _cache) => {
  21981. return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b(), unref(ns).is(`${__props.shadow || unref(globalConfig)?.shadow || "always"}-shadow`)]) }, [
  21982. _ctx.$slots.header || __props.header ? (openBlock(), createElementBlock("div", {
  21983. key: 0,
  21984. class: normalizeClass([unref(ns).e("header"), __props.headerClass])
  21985. }, [renderSlot(_ctx.$slots, "header", {}, () => [createTextVNode(toDisplayString(__props.header), 1)])], 2)) : createCommentVNode("v-if", true),
  21986. createElementVNode("div", {
  21987. class: normalizeClass([unref(ns).e("body"), __props.bodyClass]),
  21988. style: normalizeStyle(__props.bodyStyle)
  21989. }, [renderSlot(_ctx.$slots, "default")], 6),
  21990. _ctx.$slots.footer || __props.footer ? (openBlock(), createElementBlock("div", {
  21991. key: 1,
  21992. class: normalizeClass([unref(ns).e("footer"), __props.footerClass])
  21993. }, [renderSlot(_ctx.$slots, "footer", {}, () => [createTextVNode(toDisplayString(__props.footer), 1)])], 2)) : createCommentVNode("v-if", true)
  21994. ], 2);
  21995. };
  21996. }
  21997. });
  21998. //#endregion
  21999. //#region ../../packages/components/card/src/card.vue
  22000. var card_default = card_vue_vue_type_script_setup_true_lang_default;
  22001. //#endregion
  22002. //#region ../../packages/components/card/index.ts
  22003. const ElCard = withInstall(card_default);
  22004. //#endregion
  22005. //#region ../../packages/components/carousel/src/carousel.ts
  22006. /**
  22007. * @deprecated Removed after 3.0.0, Use `CarouselProps` instead.
  22008. */
  22009. const carouselProps = buildProps({
  22010. initialIndex: {
  22011. type: Number,
  22012. default: 0
  22013. },
  22014. height: {
  22015. type: String,
  22016. default: ""
  22017. },
  22018. trigger: {
  22019. type: String,
  22020. values: ["hover", "click"],
  22021. default: "hover"
  22022. },
  22023. autoplay: {
  22024. type: Boolean,
  22025. default: true
  22026. },
  22027. interval: {
  22028. type: Number,
  22029. default: 3e3
  22030. },
  22031. indicatorPosition: {
  22032. type: String,
  22033. values: [
  22034. "",
  22035. "none",
  22036. "outside"
  22037. ],
  22038. default: ""
  22039. },
  22040. arrow: {
  22041. type: String,
  22042. values: [
  22043. "always",
  22044. "hover",
  22045. "never"
  22046. ],
  22047. default: "hover"
  22048. },
  22049. type: {
  22050. type: String,
  22051. values: ["", "card"],
  22052. default: ""
  22053. },
  22054. cardScale: {
  22055. type: Number,
  22056. default: .83
  22057. },
  22058. loop: {
  22059. type: Boolean,
  22060. default: true
  22061. },
  22062. direction: {
  22063. type: String,
  22064. values: ["horizontal", "vertical"],
  22065. default: "horizontal"
  22066. },
  22067. pauseOnHover: {
  22068. type: Boolean,
  22069. default: true
  22070. },
  22071. motionBlur: Boolean
  22072. });
  22073. const carouselEmits = { change: (current, prev) => [current, prev].every(isNumber) };
  22074. //#endregion
  22075. //#region ../../packages/components/carousel/src/constants.ts
  22076. const carouselContextKey = Symbol("carouselContextKey");
  22077. const CAROUSEL_ITEM_NAME = "ElCarouselItem";
  22078. //#endregion
  22079. //#region ../../packages/components/carousel/src/use-carousel.ts
  22080. const THROTTLE_TIME = 300;
  22081. const useCarousel = (props, emit, componentName) => {
  22082. const { children: items, addChild: addItem, removeChild: removeItem, ChildrenSorter: ItemsSorter } = useOrderedChildren(getCurrentInstance(), CAROUSEL_ITEM_NAME);
  22083. const slots = useSlots();
  22084. const activeIndex = ref(-1);
  22085. const timer = ref(null);
  22086. const hover = ref(false);
  22087. const root = ref();
  22088. const containerHeight = ref(0);
  22089. const isItemsTwoLength = ref(true);
  22090. const arrowDisplay = computed(() => props.arrow !== "never" && !unref(isVertical));
  22091. const hasLabel = computed(() => {
  22092. return items.value.some((item) => item.props.label.toString().length > 0);
  22093. });
  22094. const isCardType = computed(() => props.type === "card");
  22095. const isVertical = computed(() => props.direction === "vertical");
  22096. const containerStyle = computed(() => {
  22097. if (props.height !== "auto") return { height: props.height };
  22098. return {
  22099. height: `${containerHeight.value}px`,
  22100. overflow: "hidden"
  22101. };
  22102. });
  22103. const throttledArrowClick = throttle((index) => {
  22104. setActiveItem(index);
  22105. }, THROTTLE_TIME, { trailing: true });
  22106. const throttledIndicatorHover = throttle((index) => {
  22107. handleIndicatorHover(index);
  22108. }, THROTTLE_TIME);
  22109. const isTwoLengthShow = (index) => {
  22110. if (!isItemsTwoLength.value) return true;
  22111. return activeIndex.value <= 1 ? index <= 1 : index > 1;
  22112. };
  22113. function pauseTimer() {
  22114. if (timer.value) {
  22115. clearInterval(timer.value);
  22116. timer.value = null;
  22117. }
  22118. }
  22119. function startTimer() {
  22120. if (props.interval <= 0 || !props.autoplay || timer.value) return;
  22121. timer.value = setInterval(() => playSlides(), props.interval);
  22122. }
  22123. const playSlides = () => {
  22124. if (activeIndex.value < items.value.length - 1) activeIndex.value = activeIndex.value + 1;
  22125. else if (props.loop) activeIndex.value = 0;
  22126. };
  22127. function setActiveItem(index) {
  22128. if (isString(index)) {
  22129. const filteredItems = items.value.filter((item) => item.props.name === index);
  22130. if (filteredItems.length > 0) index = items.value.indexOf(filteredItems[0]);
  22131. }
  22132. index = Number(index);
  22133. if (Number.isNaN(index) || index !== Math.floor(index)) {
  22134. /* @__PURE__ */ debugWarn(componentName, "index must be integer.");
  22135. return;
  22136. }
  22137. const itemCount = items.value.length;
  22138. const oldIndex = activeIndex.value;
  22139. if (index < 0) activeIndex.value = props.loop ? itemCount - 1 : 0;
  22140. else if (index >= itemCount) activeIndex.value = props.loop ? 0 : itemCount - 1;
  22141. else activeIndex.value = index;
  22142. if (oldIndex === activeIndex.value) resetItemPosition(oldIndex);
  22143. resetTimer();
  22144. }
  22145. function resetItemPosition(oldIndex) {
  22146. items.value.forEach((item, index) => {
  22147. item.translateItem(index, activeIndex.value, oldIndex);
  22148. });
  22149. }
  22150. function itemInStage(item, index) {
  22151. const _items = unref(items);
  22152. const itemCount = _items.length;
  22153. if (itemCount === 0 || !item.states.inStage) return false;
  22154. const nextItemIndex = index + 1;
  22155. const prevItemIndex = index - 1;
  22156. const lastItemIndex = itemCount - 1;
  22157. const isLastItemActive = _items[lastItemIndex].states.active;
  22158. const isFirstItemActive = _items[0].states.active;
  22159. const isNextItemActive = _items[nextItemIndex]?.states?.active;
  22160. const isPrevItemActive = _items[prevItemIndex]?.states?.active;
  22161. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) return "left";
  22162. else if (index === 0 && isLastItemActive || isPrevItemActive) return "right";
  22163. return false;
  22164. }
  22165. function handleMouseEnter() {
  22166. hover.value = true;
  22167. if (props.pauseOnHover) pauseTimer();
  22168. }
  22169. function handleMouseLeave() {
  22170. hover.value = false;
  22171. startTimer();
  22172. }
  22173. function handleButtonEnter(arrow) {
  22174. if (unref(isVertical)) return;
  22175. items.value.forEach((item, index) => {
  22176. if (arrow === itemInStage(item, index)) item.states.hover = true;
  22177. });
  22178. }
  22179. function handleButtonLeave() {
  22180. if (unref(isVertical)) return;
  22181. items.value.forEach((item) => {
  22182. item.states.hover = false;
  22183. });
  22184. }
  22185. function handleIndicatorClick(index) {
  22186. activeIndex.value = index;
  22187. }
  22188. function handleIndicatorHover(index) {
  22189. if (props.trigger === "hover" && index !== activeIndex.value) activeIndex.value = index;
  22190. }
  22191. function prev() {
  22192. setActiveItem(activeIndex.value - 1);
  22193. }
  22194. function next() {
  22195. setActiveItem(activeIndex.value + 1);
  22196. }
  22197. function resetTimer() {
  22198. pauseTimer();
  22199. if (!props.pauseOnHover || !hover.value) startTimer();
  22200. }
  22201. function setContainerHeight(height) {
  22202. if (props.height !== "auto") return;
  22203. containerHeight.value = height;
  22204. }
  22205. function PlaceholderItem() {
  22206. const defaultSlots = slots.default?.();
  22207. if (!defaultSlots) return null;
  22208. const normalizeSlots = flattedChildren(defaultSlots).filter((slot) => {
  22209. return isVNode(slot) && slot.type.name === CAROUSEL_ITEM_NAME;
  22210. });
  22211. if (normalizeSlots?.length === 2 && props.loop && !isCardType.value) {
  22212. isItemsTwoLength.value = true;
  22213. return normalizeSlots;
  22214. }
  22215. isItemsTwoLength.value = false;
  22216. return null;
  22217. }
  22218. watch(() => activeIndex.value, (current, prev) => {
  22219. resetItemPosition(prev);
  22220. if (isItemsTwoLength.value) {
  22221. current = current % 2;
  22222. prev = prev % 2;
  22223. }
  22224. if (prev > -1) emit(CHANGE_EVENT, current, prev);
  22225. });
  22226. const exposeActiveIndex = computed({
  22227. get: () => {
  22228. return isItemsTwoLength.value ? activeIndex.value % 2 : activeIndex.value;
  22229. },
  22230. set: (value) => activeIndex.value = value
  22231. });
  22232. watch(() => props.autoplay, (autoplay) => {
  22233. autoplay ? startTimer() : pauseTimer();
  22234. });
  22235. watch(() => props.loop, () => {
  22236. setActiveItem(activeIndex.value);
  22237. });
  22238. watch(() => props.interval, () => {
  22239. resetTimer();
  22240. });
  22241. const resizeObserver = shallowRef();
  22242. onMounted(() => {
  22243. watch(() => items.value, () => {
  22244. if (items.value.length > 0) setActiveItem(props.initialIndex);
  22245. }, { immediate: true });
  22246. resizeObserver.value = useResizeObserver(root.value, () => {
  22247. resetItemPosition();
  22248. });
  22249. startTimer();
  22250. });
  22251. onBeforeUnmount(() => {
  22252. pauseTimer();
  22253. if (root.value && resizeObserver.value) resizeObserver.value.stop();
  22254. });
  22255. provide(carouselContextKey, {
  22256. root,
  22257. isCardType,
  22258. isVertical,
  22259. items,
  22260. loop: props.loop,
  22261. cardScale: props.cardScale,
  22262. addItem,
  22263. removeItem,
  22264. setActiveItem,
  22265. setContainerHeight
  22266. });
  22267. return {
  22268. root,
  22269. activeIndex,
  22270. exposeActiveIndex,
  22271. arrowDisplay,
  22272. hasLabel,
  22273. hover,
  22274. isCardType,
  22275. items,
  22276. isVertical,
  22277. containerStyle,
  22278. isItemsTwoLength,
  22279. handleButtonEnter,
  22280. handleButtonLeave,
  22281. handleIndicatorClick,
  22282. handleMouseEnter,
  22283. handleMouseLeave,
  22284. setActiveItem,
  22285. prev,
  22286. next,
  22287. PlaceholderItem,
  22288. isTwoLengthShow,
  22289. ItemsSorter,
  22290. throttledArrowClick,
  22291. throttledIndicatorHover
  22292. };
  22293. };
  22294. //#endregion
  22295. //#region ../../packages/components/carousel/src/carousel.vue?vue&type=script&setup=true&lang.ts
  22296. const _hoisted_1$64 = ["aria-label"];
  22297. const _hoisted_2$35 = ["aria-label"];
  22298. const _hoisted_3$16 = ["onMouseenter", "onClick"];
  22299. const _hoisted_4$12 = ["aria-label"];
  22300. const _hoisted_5$9 = { key: 0 };
  22301. const _hoisted_6$4 = {
  22302. key: 2,
  22303. xmlns: "http://www.w3.org/2000/svg",
  22304. version: "1.1",
  22305. style: { "display": "none" }
  22306. };
  22307. const COMPONENT_NAME$11 = "ElCarousel";
  22308. var carousel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  22309. name: COMPONENT_NAME$11,
  22310. __name: "carousel",
  22311. props: carouselProps,
  22312. emits: carouselEmits,
  22313. setup(__props, { expose: __expose, emit: __emit }) {
  22314. const props = __props;
  22315. const { root, activeIndex, exposeActiveIndex, arrowDisplay, hasLabel, hover, isCardType, items, isVertical, containerStyle, handleButtonEnter, handleButtonLeave, handleIndicatorClick, handleMouseEnter, handleMouseLeave, setActiveItem, prev, next, PlaceholderItem, isTwoLengthShow, ItemsSorter, throttledArrowClick, throttledIndicatorHover } = useCarousel(props, __emit, COMPONENT_NAME$11);
  22316. const ns = useNamespace("carousel");
  22317. const { t } = useLocale();
  22318. const carouselClasses = computed(() => {
  22319. const classes = [ns.b(), ns.m(props.direction)];
  22320. if (unref(isCardType)) classes.push(ns.m("card"));
  22321. classes.push(ns.is("vertical-outside", unref(isVertical) && props.indicatorPosition === "outside"));
  22322. return classes;
  22323. });
  22324. const indicatorsClasses = computed(() => {
  22325. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  22326. if (unref(hasLabel)) classes.push(ns.em("indicators", "labels"));
  22327. if (props.indicatorPosition === "outside") classes.push(ns.em("indicators", "outside"));
  22328. if (unref(isVertical)) classes.push(ns.em("indicators", "right"));
  22329. return classes;
  22330. });
  22331. function handleTransitionStart(e) {
  22332. if (!props.motionBlur) return;
  22333. const kls = unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`;
  22334. e.currentTarget.classList.add(kls);
  22335. }
  22336. function handleTransitionEnd(e) {
  22337. if (!props.motionBlur) return;
  22338. const kls = unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`;
  22339. e.currentTarget.classList.remove(kls);
  22340. }
  22341. __expose({
  22342. activeIndex: exposeActiveIndex,
  22343. setActiveItem,
  22344. prev,
  22345. next
  22346. });
  22347. return (_ctx, _cache) => {
  22348. return openBlock(), createElementBlock("div", {
  22349. ref_key: "root",
  22350. ref: root,
  22351. class: normalizeClass(carouselClasses.value),
  22352. onMouseenter: _cache[6] || (_cache[6] = withModifiers((...args) => unref(handleMouseEnter) && unref(handleMouseEnter)(...args), ["stop"])),
  22353. onMouseleave: _cache[7] || (_cache[7] = withModifiers((...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args), ["stop"]))
  22354. }, [
  22355. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  22356. key: 0,
  22357. name: "carousel-arrow-left",
  22358. persisted: ""
  22359. }, {
  22360. default: withCtx(() => [withDirectives(createElementVNode("button", {
  22361. type: "button",
  22362. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "left")]),
  22363. "aria-label": unref(t)("el.carousel.leftArrow"),
  22364. onMouseenter: _cache[0] || (_cache[0] = ($event) => unref(handleButtonEnter)("left")),
  22365. onMouseleave: _cache[1] || (_cache[1] = (...args) => unref(handleButtonLeave) && unref(handleButtonLeave)(...args)),
  22366. onClick: _cache[2] || (_cache[2] = withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) - 1), ["stop"]))
  22367. }, [createVNode(unref(ElIcon), null, {
  22368. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  22369. _: 1
  22370. })], 42, _hoisted_1$64), [[vShow, (__props.arrow === "always" || unref(hover)) && (__props.loop || unref(activeIndex) > 0)]])]),
  22371. _: 1
  22372. })) : createCommentVNode("v-if", true),
  22373. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  22374. key: 1,
  22375. name: "carousel-arrow-right",
  22376. persisted: ""
  22377. }, {
  22378. default: withCtx(() => [withDirectives(createElementVNode("button", {
  22379. type: "button",
  22380. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "right")]),
  22381. "aria-label": unref(t)("el.carousel.rightArrow"),
  22382. onMouseenter: _cache[3] || (_cache[3] = ($event) => unref(handleButtonEnter)("right")),
  22383. onMouseleave: _cache[4] || (_cache[4] = (...args) => unref(handleButtonLeave) && unref(handleButtonLeave)(...args)),
  22384. onClick: _cache[5] || (_cache[5] = withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) + 1), ["stop"]))
  22385. }, [createVNode(unref(ElIcon), null, {
  22386. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  22387. _: 1
  22388. })], 42, _hoisted_2$35), [[vShow, (__props.arrow === "always" || unref(hover)) && (__props.loop || unref(activeIndex) < unref(items).length - 1)]])]),
  22389. _: 1
  22390. })) : createCommentVNode("v-if", true),
  22391. createElementVNode("div", {
  22392. class: normalizeClass(unref(ns).e("container")),
  22393. style: normalizeStyle(unref(containerStyle)),
  22394. onTransitionstart: handleTransitionStart,
  22395. onTransitionend: handleTransitionEnd
  22396. }, [createVNode(unref(PlaceholderItem)), renderSlot(_ctx.$slots, "default")], 38),
  22397. createVNode(unref(ItemsSorter), null, {
  22398. default: withCtx(() => [__props.indicatorPosition !== "none" ? (openBlock(), createElementBlock("ul", {
  22399. key: 0,
  22400. class: normalizeClass(indicatorsClasses.value)
  22401. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item, index) => {
  22402. return withDirectives((openBlock(), createElementBlock("li", {
  22403. key: index,
  22404. class: normalizeClass([
  22405. unref(ns).e("indicator"),
  22406. unref(ns).em("indicator", __props.direction),
  22407. unref(ns).is("active", index === unref(activeIndex))
  22408. ]),
  22409. onMouseenter: ($event) => unref(throttledIndicatorHover)(index),
  22410. onClick: withModifiers(($event) => unref(handleIndicatorClick)(index), ["stop"])
  22411. }, [createElementVNode("button", {
  22412. class: normalizeClass(unref(ns).e("button")),
  22413. "aria-label": unref(t)("el.carousel.indicator", { index: index + 1 })
  22414. }, [unref(hasLabel) ? (openBlock(), createElementBlock("span", _hoisted_5$9, toDisplayString(item.props.label), 1)) : createCommentVNode("v-if", true)], 10, _hoisted_4$12)], 42, _hoisted_3$16)), [[vShow, unref(isTwoLengthShow)(index)]]);
  22415. }), 128))], 2)) : createCommentVNode("v-if", true)]),
  22416. _: 1
  22417. }),
  22418. __props.motionBlur ? (openBlock(), createElementBlock("svg", _hoisted_6$4, [..._cache[8] || (_cache[8] = [createElementVNode("defs", null, [createElementVNode("filter", { id: "elCarouselHorizontal" }, [createElementVNode("feGaussianBlur", {
  22419. in: "SourceGraphic",
  22420. stdDeviation: "12,0"
  22421. })]), createElementVNode("filter", { id: "elCarouselVertical" }, [createElementVNode("feGaussianBlur", {
  22422. in: "SourceGraphic",
  22423. stdDeviation: "0,10"
  22424. })])], -1)])])) : createCommentVNode("v-if", true)
  22425. ], 34);
  22426. };
  22427. }
  22428. });
  22429. //#endregion
  22430. //#region ../../packages/components/carousel/src/carousel.vue
  22431. var carousel_default = carousel_vue_vue_type_script_setup_true_lang_default;
  22432. //#endregion
  22433. //#region ../../packages/components/carousel/src/carousel-item.ts
  22434. /**
  22435. * @deprecated Removed after 3.0.0, Use `CarouselItemProps` instead.
  22436. */
  22437. const carouselItemProps = buildProps({
  22438. name: {
  22439. type: String,
  22440. default: ""
  22441. },
  22442. label: {
  22443. type: [String, Number],
  22444. default: ""
  22445. }
  22446. });
  22447. //#endregion
  22448. //#region ../../packages/components/carousel/src/use-carousel-item.ts
  22449. const useCarouselItem = (props) => {
  22450. const carouselContext = inject(carouselContextKey);
  22451. const instance = getCurrentInstance();
  22452. if (!carouselContext) /* @__PURE__ */ debugWarn(CAROUSEL_ITEM_NAME, "usage: <el-carousel></el-carousel-item></el-carousel>");
  22453. if (!instance) /* @__PURE__ */ debugWarn(CAROUSEL_ITEM_NAME, "compositional hook can only be invoked inside setups");
  22454. const carouselItemRef = ref();
  22455. const hover = ref(false);
  22456. const translate = ref(0);
  22457. const scale = ref(1);
  22458. const active = ref(false);
  22459. const ready = ref(false);
  22460. const inStage = ref(false);
  22461. const animating = ref(false);
  22462. const { isCardType, isVertical, cardScale } = carouselContext;
  22463. function processIndex(index, activeIndex, length) {
  22464. const lastItemIndex = length - 1;
  22465. const prevItemIndex = activeIndex - 1;
  22466. const nextItemIndex = activeIndex + 1;
  22467. const halfItemIndex = length / 2;
  22468. if (activeIndex === 0 && index === lastItemIndex) return -1;
  22469. else if (activeIndex === lastItemIndex && index === 0) return length;
  22470. else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) return length + 1;
  22471. else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) return -2;
  22472. return index;
  22473. }
  22474. function calcCardTranslate(index, activeIndex) {
  22475. const parentWidth = unref(isVertical) ? carouselContext.root.value?.offsetHeight || 0 : carouselContext.root.value?.offsetWidth || 0;
  22476. if (inStage.value) return parentWidth * ((2 - cardScale) * (index - activeIndex) + 1) / 4;
  22477. else if (index < activeIndex) return -(1 + cardScale) * parentWidth / 4;
  22478. else return (3 + cardScale) * parentWidth / 4;
  22479. }
  22480. function calcTranslate(index, activeIndex, isVertical) {
  22481. const rootEl = carouselContext.root.value;
  22482. if (!rootEl) return 0;
  22483. return ((isVertical ? rootEl.offsetHeight : rootEl.offsetWidth) || 0) * (index - activeIndex);
  22484. }
  22485. const translateItem = (index, activeIndex, oldIndex) => {
  22486. const _isCardType = unref(isCardType);
  22487. const carouselItemLength = carouselContext.items.value.length ?? NaN;
  22488. const isActive = index === activeIndex;
  22489. if (!_isCardType && !isUndefined(oldIndex)) animating.value = isActive || index === oldIndex;
  22490. if (!isActive && carouselItemLength > 2 && carouselContext.loop) index = processIndex(index, activeIndex, carouselItemLength);
  22491. const _isVertical = unref(isVertical);
  22492. active.value = isActive;
  22493. if (_isCardType) {
  22494. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  22495. translate.value = calcCardTranslate(index, activeIndex);
  22496. scale.value = unref(active) ? 1 : cardScale;
  22497. } else translate.value = calcTranslate(index, activeIndex, _isVertical);
  22498. ready.value = true;
  22499. if (isActive && carouselItemRef.value) carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
  22500. };
  22501. function handleItemClick() {
  22502. if (carouselContext && unref(isCardType)) {
  22503. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  22504. carouselContext.setActiveItem(index);
  22505. }
  22506. }
  22507. const carouselItemContext = {
  22508. props,
  22509. states: reactive({
  22510. hover,
  22511. translate,
  22512. scale,
  22513. active,
  22514. ready,
  22515. inStage,
  22516. animating
  22517. }),
  22518. uid: instance.uid,
  22519. getVnode: () => instance.vnode,
  22520. translateItem
  22521. };
  22522. carouselContext.addItem(carouselItemContext);
  22523. onBeforeUnmount(() => {
  22524. carouselContext.removeItem(carouselItemContext);
  22525. });
  22526. return {
  22527. carouselItemRef,
  22528. active,
  22529. animating,
  22530. hover,
  22531. inStage,
  22532. isVertical,
  22533. translate,
  22534. isCardType,
  22535. scale,
  22536. ready,
  22537. handleItemClick
  22538. };
  22539. };
  22540. //#endregion
  22541. //#region ../../packages/components/carousel/src/carousel-item.vue?vue&type=script&setup=true&lang.ts
  22542. var carousel_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  22543. name: CAROUSEL_ITEM_NAME,
  22544. __name: "carousel-item",
  22545. props: carouselItemProps,
  22546. setup(__props) {
  22547. const props = __props;
  22548. const ns = useNamespace("carousel");
  22549. const { carouselItemRef, active, animating, hover, inStage, isVertical, translate, isCardType, scale, ready, handleItemClick } = useCarouselItem(props);
  22550. const itemKls = computed(() => [
  22551. ns.e("item"),
  22552. ns.is("active", active.value),
  22553. ns.is("in-stage", inStage.value),
  22554. ns.is("hover", hover.value),
  22555. ns.is("animating", animating.value),
  22556. {
  22557. [ns.em("item", "card")]: isCardType.value,
  22558. [ns.em("item", "card-vertical")]: isCardType.value && isVertical.value
  22559. }
  22560. ]);
  22561. const itemStyle = computed(() => {
  22562. return { transform: [`${`translate${unref(isVertical) ? "Y" : "X"}`}(${unref(translate)}px)`, `scale(${unref(scale)})`].join(" ") };
  22563. });
  22564. return (_ctx, _cache) => {
  22565. return withDirectives((openBlock(), createElementBlock("div", {
  22566. ref_key: "carouselItemRef",
  22567. ref: carouselItemRef,
  22568. class: normalizeClass(itemKls.value),
  22569. style: normalizeStyle(itemStyle.value),
  22570. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleItemClick) && unref(handleItemClick)(...args))
  22571. }, [unref(isCardType) ? withDirectives((openBlock(), createElementBlock("div", {
  22572. key: 0,
  22573. class: normalizeClass(unref(ns).e("mask"))
  22574. }, null, 2)), [[vShow, !unref(active)]]) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default")], 6)), [[vShow, unref(ready)]]);
  22575. };
  22576. }
  22577. });
  22578. //#endregion
  22579. //#region ../../packages/components/carousel/src/carousel-item.vue
  22580. var carousel_item_default = carousel_item_vue_vue_type_script_setup_true_lang_default;
  22581. //#endregion
  22582. //#region ../../packages/components/carousel/index.ts
  22583. const ElCarousel = withInstall(carousel_default, { CarouselItem: carousel_item_default });
  22584. const ElCarouselItem = withNoopInstall(carousel_item_default);
  22585. //#endregion
  22586. //#region ../../packages/components/cascader-panel/src/config.ts
  22587. const CommonProps = buildProps({
  22588. modelValue: { type: definePropType([
  22589. Number,
  22590. String,
  22591. Array,
  22592. Object
  22593. ]) },
  22594. options: {
  22595. type: definePropType(Array),
  22596. default: () => []
  22597. },
  22598. props: {
  22599. type: definePropType(Object),
  22600. default: () => ({})
  22601. }
  22602. });
  22603. const DefaultProps = {
  22604. expandTrigger: "click",
  22605. multiple: false,
  22606. checkStrictly: false,
  22607. emitPath: true,
  22608. lazy: false,
  22609. lazyLoad: NOOP,
  22610. value: "value",
  22611. label: "label",
  22612. children: "children",
  22613. leaf: "leaf",
  22614. disabled: "disabled",
  22615. hoverThreshold: 500,
  22616. checkOnClickNode: false,
  22617. checkOnClickLeaf: true,
  22618. showPrefix: true
  22619. };
  22620. /**
  22621. * @deprecated Removed after 3.0.0, Use `CascaderPanelProps` instead.
  22622. */
  22623. const cascaderPanelProps = buildProps({
  22624. ...CommonProps,
  22625. border: {
  22626. type: Boolean,
  22627. default: true
  22628. },
  22629. renderLabel: { type: Function }
  22630. });
  22631. const emitChangeFn$2 = (value) => true;
  22632. const cascaderPanelEmits = {
  22633. [UPDATE_MODEL_EVENT]: emitChangeFn$2,
  22634. [CHANGE_EVENT]: emitChangeFn$2,
  22635. close: () => true,
  22636. "expand-change": (value) => value
  22637. };
  22638. const useCascaderConfig = (props) => {
  22639. return computed(() => ({
  22640. ...DefaultProps,
  22641. ...props.props
  22642. }));
  22643. };
  22644. //#endregion
  22645. //#region ../../packages/components/checkbox/src/checkbox.ts
  22646. /**
  22647. * @deprecated Removed after 3.0.0, Use `CheckboxProps` instead.
  22648. */
  22649. const checkboxProps = {
  22650. modelValue: {
  22651. type: [
  22652. Number,
  22653. String,
  22654. Boolean
  22655. ],
  22656. default: void 0
  22657. },
  22658. label: {
  22659. type: [
  22660. String,
  22661. Boolean,
  22662. Number,
  22663. Object
  22664. ],
  22665. default: void 0
  22666. },
  22667. value: {
  22668. type: [
  22669. String,
  22670. Boolean,
  22671. Number,
  22672. Object
  22673. ],
  22674. default: void 0
  22675. },
  22676. indeterminate: Boolean,
  22677. disabled: {
  22678. type: Boolean,
  22679. default: void 0
  22680. },
  22681. checked: Boolean,
  22682. name: {
  22683. type: String,
  22684. default: void 0
  22685. },
  22686. trueValue: {
  22687. type: [String, Number],
  22688. default: void 0
  22689. },
  22690. falseValue: {
  22691. type: [String, Number],
  22692. default: void 0
  22693. },
  22694. trueLabel: {
  22695. type: [String, Number],
  22696. default: void 0
  22697. },
  22698. falseLabel: {
  22699. type: [String, Number],
  22700. default: void 0
  22701. },
  22702. id: {
  22703. type: String,
  22704. default: void 0
  22705. },
  22706. border: Boolean,
  22707. size: useSizeProp,
  22708. tabindex: [String, Number],
  22709. validateEvent: {
  22710. type: Boolean,
  22711. default: true
  22712. },
  22713. ariaLabel: String,
  22714. ...useAriaProps(["ariaControls"])
  22715. };
  22716. const checkboxEmits = {
  22717. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  22718. change: (val) => isString(val) || isNumber(val) || isBoolean(val)
  22719. };
  22720. const checkboxPropsDefaults = {
  22721. modelValue: void 0,
  22722. label: void 0,
  22723. value: void 0,
  22724. disabled: void 0,
  22725. name: void 0,
  22726. trueValue: void 0,
  22727. falseValue: void 0,
  22728. trueLabel: void 0,
  22729. falseLabel: void 0,
  22730. id: void 0,
  22731. validateEvent: true
  22732. };
  22733. //#endregion
  22734. //#region ../../packages/components/checkbox/src/constants.ts
  22735. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  22736. //#endregion
  22737. //#region ../../packages/components/checkbox/src/composables/use-checkbox-disabled.ts
  22738. const useCheckboxDisabled = ({ model, isChecked }) => {
  22739. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  22740. const formContext = inject(formContextKey, void 0);
  22741. const isLimitDisabled = computed(() => {
  22742. const max = checkboxGroup?.max?.value;
  22743. const min = checkboxGroup?.min?.value;
  22744. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  22745. });
  22746. return {
  22747. isDisabled: useFormDisabled(computed(() => {
  22748. if (checkboxGroup === void 0) return formContext?.disabled ?? isLimitDisabled.value;
  22749. else return checkboxGroup.disabled?.value || isLimitDisabled.value;
  22750. })),
  22751. isLimitDisabled
  22752. };
  22753. };
  22754. //#endregion
  22755. //#region ../../packages/components/checkbox/src/composables/use-checkbox-event.ts
  22756. const useCheckboxEvent = (props, { model, isLimitExceeded, hasOwnLabel, isDisabled, isLabeledByFormItem }) => {
  22757. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  22758. const { formItem } = useFormItem();
  22759. const { emit } = getCurrentInstance();
  22760. function getLabeledValue(value) {
  22761. return [
  22762. true,
  22763. props.trueValue,
  22764. props.trueLabel
  22765. ].includes(value) ? props.trueValue ?? props.trueLabel ?? true : props.falseValue ?? props.falseLabel ?? false;
  22766. }
  22767. function emitChangeEvent(checked, e) {
  22768. emit(CHANGE_EVENT, getLabeledValue(checked), e);
  22769. }
  22770. function handleChange(e) {
  22771. if (isLimitExceeded.value) return;
  22772. const target = e.target;
  22773. emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
  22774. }
  22775. async function onClickRoot(e) {
  22776. if (isLimitExceeded.value) return;
  22777. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  22778. if (!e.composedPath().some((item) => item.tagName === "LABEL")) {
  22779. model.value = getLabeledValue([
  22780. false,
  22781. props.falseValue,
  22782. props.falseLabel
  22783. ].includes(model.value));
  22784. await nextTick();
  22785. emitChangeEvent(model.value, e);
  22786. }
  22787. }
  22788. }
  22789. const validateEvent = computed(() => checkboxGroup?.validateEvent || props.validateEvent);
  22790. watch(() => props.modelValue, () => {
  22791. if (validateEvent.value) formItem?.validate("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  22792. });
  22793. return {
  22794. handleChange,
  22795. onClickRoot
  22796. };
  22797. };
  22798. //#endregion
  22799. //#region ../../packages/components/checkbox/src/composables/use-checkbox-model.ts
  22800. const useCheckboxModel = (props) => {
  22801. const selfModel = ref(false);
  22802. const { emit } = getCurrentInstance();
  22803. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  22804. const isGroup = computed(() => isUndefined(checkboxGroup) === false);
  22805. const isLimitExceeded = ref(false);
  22806. const model = computed({
  22807. get() {
  22808. return isGroup.value ? checkboxGroup?.modelValue?.value : props.modelValue ?? selfModel.value;
  22809. },
  22810. set(val) {
  22811. if (isGroup.value && isArray$1(val)) {
  22812. isLimitExceeded.value = checkboxGroup?.max?.value !== void 0 && val.length > checkboxGroup?.max.value && val.length > model.value.length;
  22813. isLimitExceeded.value === false && checkboxGroup?.changeEvent?.(val);
  22814. } else {
  22815. emit(UPDATE_MODEL_EVENT, val);
  22816. selfModel.value = val;
  22817. }
  22818. }
  22819. });
  22820. return {
  22821. model,
  22822. isGroup,
  22823. isLimitExceeded
  22824. };
  22825. };
  22826. //#endregion
  22827. //#region ../../packages/components/checkbox/src/composables/use-checkbox-status.ts
  22828. const useCheckboxStatus = (props, slots, { model }) => {
  22829. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  22830. const isFocused = ref(false);
  22831. const actualValue = computed(() => {
  22832. if (!isPropAbsent(props.value)) return props.value;
  22833. return props.label;
  22834. });
  22835. const isChecked = computed(() => {
  22836. const value = model.value;
  22837. if (isBoolean(value)) return value;
  22838. else if (isArray$1(value)) if (isObject$1(actualValue.value)) return value.map(toRaw).some((o) => isEqual$1(o, actualValue.value));
  22839. else return value.map(toRaw).includes(actualValue.value);
  22840. else if (value !== null && value !== void 0) return value === props.trueValue || value === props.trueLabel;
  22841. else return !!value;
  22842. });
  22843. return {
  22844. checkboxButtonSize: useFormSize(computed(() => checkboxGroup?.size?.value), { prop: true }),
  22845. isChecked,
  22846. isFocused,
  22847. checkboxSize: useFormSize(computed(() => checkboxGroup?.size?.value)),
  22848. hasOwnLabel: computed(() => {
  22849. return !!slots.default || !isPropAbsent(actualValue.value);
  22850. }),
  22851. actualValue
  22852. };
  22853. };
  22854. //#endregion
  22855. //#region ../../packages/components/checkbox/src/composables/use-checkbox.ts
  22856. const useCheckbox = (props, slots) => {
  22857. const { formItem: elFormItem } = useFormItem();
  22858. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  22859. const { isFocused, isChecked, checkboxButtonSize, checkboxSize, hasOwnLabel, actualValue } = useCheckboxStatus(props, slots, { model });
  22860. const { isDisabled } = useCheckboxDisabled({
  22861. model,
  22862. isChecked
  22863. });
  22864. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  22865. formItemContext: elFormItem,
  22866. disableIdGeneration: hasOwnLabel,
  22867. disableIdManagement: isGroup
  22868. });
  22869. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  22870. model,
  22871. isLimitExceeded,
  22872. hasOwnLabel,
  22873. isDisabled,
  22874. isLabeledByFormItem
  22875. });
  22876. const setStoreValue = () => {
  22877. function addToStore() {
  22878. if (isArray$1(model.value) && !model.value.includes(actualValue.value)) model.value.push(actualValue.value);
  22879. else model.value = props.trueValue ?? props.trueLabel ?? true;
  22880. }
  22881. props.checked && addToStore();
  22882. };
  22883. setStoreValue();
  22884. useDeprecated({
  22885. from: "label act as value",
  22886. replacement: "value",
  22887. version: "3.0.0",
  22888. scope: "el-checkbox",
  22889. ref: "https://element-plus.org/en-US/component/checkbox.html"
  22890. }, computed(() => isGroup.value && isPropAbsent(props.value)));
  22891. useDeprecated({
  22892. from: "true-label",
  22893. replacement: "true-value",
  22894. version: "3.0.0",
  22895. scope: "el-checkbox",
  22896. ref: "https://element-plus.org/en-US/component/checkbox.html"
  22897. }, computed(() => !!props.trueLabel));
  22898. useDeprecated({
  22899. from: "false-label",
  22900. replacement: "false-value",
  22901. version: "3.0.0",
  22902. scope: "el-checkbox",
  22903. ref: "https://element-plus.org/en-US/component/checkbox.html"
  22904. }, computed(() => !!props.falseLabel));
  22905. return {
  22906. inputId,
  22907. isLabeledByFormItem,
  22908. isChecked,
  22909. isDisabled,
  22910. isFocused,
  22911. checkboxButtonSize,
  22912. checkboxSize,
  22913. hasOwnLabel,
  22914. model,
  22915. actualValue,
  22916. handleChange,
  22917. onClickRoot
  22918. };
  22919. };
  22920. //#endregion
  22921. //#region ../../packages/components/checkbox/src/checkbox.vue?vue&type=script&setup=true&lang.ts
  22922. const _hoisted_1$63 = [
  22923. "id",
  22924. "indeterminate",
  22925. "name",
  22926. "tabindex",
  22927. "disabled"
  22928. ];
  22929. var checkbox_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  22930. name: "ElCheckbox",
  22931. __name: "checkbox",
  22932. props: checkboxProps,
  22933. emits: checkboxEmits,
  22934. setup(__props) {
  22935. const props = __props;
  22936. const { inputId, isLabeledByFormItem, isChecked, isDisabled, isFocused, checkboxSize, hasOwnLabel, model, actualValue, handleChange, onClickRoot } = useCheckbox(props, useSlots());
  22937. const inputBindings = computed(() => {
  22938. if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) return {
  22939. "true-value": props.trueValue ?? props.trueLabel ?? true,
  22940. "false-value": props.falseValue ?? props.falseLabel ?? false
  22941. };
  22942. return { value: actualValue.value };
  22943. });
  22944. const ns = useNamespace("checkbox");
  22945. const compKls = computed(() => {
  22946. return [
  22947. ns.b(),
  22948. ns.m(checkboxSize.value),
  22949. ns.is("disabled", isDisabled.value),
  22950. ns.is("bordered", props.border),
  22951. ns.is("checked", isChecked.value)
  22952. ];
  22953. });
  22954. const spanKls = computed(() => {
  22955. return [
  22956. ns.e("input"),
  22957. ns.is("disabled", isDisabled.value),
  22958. ns.is("checked", isChecked.value),
  22959. ns.is("indeterminate", props.indeterminate),
  22960. ns.is("focus", isFocused.value)
  22961. ];
  22962. });
  22963. return (_ctx, _cache) => {
  22964. return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
  22965. for: !unref(hasOwnLabel) && unref(isLabeledByFormItem) ? null : unref(inputId),
  22966. class: normalizeClass(compKls.value),
  22967. "aria-controls": __props.indeterminate ? __props.ariaControls : null,
  22968. "aria-checked": __props.indeterminate ? "mixed" : void 0,
  22969. "aria-label": __props.ariaLabel,
  22970. onClick: unref(onClickRoot)
  22971. }, {
  22972. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(spanKls.value) }, [withDirectives(createElementVNode("input", mergeProps({
  22973. id: unref(inputId),
  22974. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
  22975. class: unref(ns).e("original"),
  22976. type: "checkbox",
  22977. indeterminate: __props.indeterminate,
  22978. name: __props.name,
  22979. tabindex: __props.tabindex,
  22980. disabled: unref(isDisabled)
  22981. }, inputBindings.value, {
  22982. onChange: _cache[1] || (_cache[1] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
  22983. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  22984. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
  22985. onClick: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"]))
  22986. }), null, 16, _hoisted_1$63), [[vModelCheckbox, unref(model)]]), createElementVNode("span", { class: normalizeClass(unref(ns).e("inner")) }, null, 2)], 2), unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
  22987. key: 0,
  22988. class: normalizeClass(unref(ns).e("label"))
  22989. }, [renderSlot(_ctx.$slots, "default"), !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(__props.label), 1)], 64)) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true)]),
  22990. _: 3
  22991. }, 8, [
  22992. "for",
  22993. "class",
  22994. "aria-controls",
  22995. "aria-checked",
  22996. "aria-label",
  22997. "onClick"
  22998. ]);
  22999. };
  23000. }
  23001. });
  23002. //#endregion
  23003. //#region ../../packages/components/checkbox/src/checkbox.vue
  23004. var checkbox_default = checkbox_vue_vue_type_script_setup_true_lang_default;
  23005. //#endregion
  23006. //#region ../../packages/components/checkbox/src/checkbox-button.vue?vue&type=script&setup=true&lang.ts
  23007. const _hoisted_1$62 = [
  23008. "name",
  23009. "tabindex",
  23010. "disabled"
  23011. ];
  23012. var checkbox_button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  23013. name: "ElCheckboxButton",
  23014. __name: "checkbox-button",
  23015. props: checkboxProps,
  23016. emits: checkboxEmits,
  23017. setup(__props) {
  23018. const props = __props;
  23019. const { isFocused, isChecked, isDisabled, checkboxButtonSize, model, actualValue, handleChange } = useCheckbox(props, useSlots());
  23020. const inputBindings = computed(() => {
  23021. if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) return {
  23022. "true-value": props.trueValue ?? props.trueLabel ?? true,
  23023. "false-value": props.falseValue ?? props.falseLabel ?? false
  23024. };
  23025. return { value: actualValue.value };
  23026. });
  23027. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  23028. const ns = useNamespace("checkbox");
  23029. const activeStyle = computed(() => {
  23030. const fillValue = checkboxGroup?.fill?.value ?? "";
  23031. return {
  23032. backgroundColor: fillValue,
  23033. borderColor: fillValue,
  23034. color: checkboxGroup?.textColor?.value ?? "",
  23035. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  23036. };
  23037. });
  23038. const labelKls = computed(() => {
  23039. return [
  23040. ns.b("button"),
  23041. ns.bm("button", checkboxButtonSize.value),
  23042. ns.is("disabled", isDisabled.value),
  23043. ns.is("checked", isChecked.value),
  23044. ns.is("focus", isFocused.value)
  23045. ];
  23046. });
  23047. return (_ctx, _cache) => {
  23048. return openBlock(), createElementBlock("label", { class: normalizeClass(labelKls.value) }, [withDirectives(createElementVNode("input", mergeProps({
  23049. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
  23050. class: unref(ns).be("button", "original"),
  23051. type: "checkbox",
  23052. name: __props.name,
  23053. tabindex: __props.tabindex,
  23054. disabled: unref(isDisabled)
  23055. }, inputBindings.value, {
  23056. onChange: _cache[1] || (_cache[1] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
  23057. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  23058. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
  23059. onClick: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"]))
  23060. }), null, 16, _hoisted_1$62), [[vModelCheckbox, unref(model)]]), _ctx.$slots.default || __props.label ? (openBlock(), createElementBlock("span", {
  23061. key: 0,
  23062. class: normalizeClass(unref(ns).be("button", "inner")),
  23063. style: normalizeStyle(unref(isChecked) ? activeStyle.value : void 0)
  23064. }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])], 6)) : createCommentVNode("v-if", true)], 2);
  23065. };
  23066. }
  23067. });
  23068. //#endregion
  23069. //#region ../../packages/components/checkbox/src/checkbox-button.vue
  23070. var checkbox_button_default = checkbox_button_vue_vue_type_script_setup_true_lang_default;
  23071. //#endregion
  23072. //#region ../../packages/components/checkbox/src/checkbox-group.ts
  23073. /**
  23074. * @deprecated Removed after 3.0.0, Use `CheckboxGroupProps` instead.
  23075. */
  23076. const checkboxGroupProps = buildProps({
  23077. modelValue: {
  23078. type: definePropType(Array),
  23079. default: () => []
  23080. },
  23081. disabled: {
  23082. type: Boolean,
  23083. default: void 0
  23084. },
  23085. min: Number,
  23086. max: Number,
  23087. size: useSizeProp,
  23088. fill: String,
  23089. textColor: String,
  23090. tag: {
  23091. type: String,
  23092. default: "div"
  23093. },
  23094. validateEvent: {
  23095. type: Boolean,
  23096. default: true
  23097. },
  23098. options: { type: definePropType(Array) },
  23099. props: {
  23100. type: definePropType(Object),
  23101. default: () => checkboxDefaultProps
  23102. },
  23103. type: {
  23104. type: String,
  23105. values: ["checkbox", "button"],
  23106. default: "checkbox"
  23107. },
  23108. ...useAriaProps(["ariaLabel"])
  23109. });
  23110. const checkboxGroupEmits = {
  23111. [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
  23112. change: (val) => isArray$1(val)
  23113. };
  23114. const checkboxDefaultProps = {
  23115. label: "label",
  23116. value: "value",
  23117. disabled: "disabled"
  23118. };
  23119. //#endregion
  23120. //#region ../../packages/components/checkbox/src/checkbox-group.vue?vue&type=script&setup=true&lang.ts
  23121. var checkbox_group_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  23122. name: "ElCheckboxGroup",
  23123. __name: "checkbox-group",
  23124. props: checkboxGroupProps,
  23125. emits: checkboxGroupEmits,
  23126. setup(__props, { emit: __emit }) {
  23127. const props = __props;
  23128. const emit = __emit;
  23129. const ns = useNamespace("checkbox");
  23130. const checkboxDisabled = useFormDisabled();
  23131. const { formItem } = useFormItem();
  23132. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: formItem });
  23133. const changeEvent = async (value) => {
  23134. emit(UPDATE_MODEL_EVENT, value);
  23135. await nextTick();
  23136. emit(CHANGE_EVENT, value);
  23137. };
  23138. const modelValue = computed({
  23139. get() {
  23140. return props.modelValue;
  23141. },
  23142. set(val) {
  23143. changeEvent(val);
  23144. }
  23145. });
  23146. const aliasProps = computed(() => ({
  23147. ...checkboxDefaultProps,
  23148. ...props.props
  23149. }));
  23150. const getOptionProps = (option) => {
  23151. const { label, value, disabled } = aliasProps.value;
  23152. const base = {
  23153. label: option[label],
  23154. value: option[value],
  23155. disabled: option[disabled]
  23156. };
  23157. return {
  23158. ...omit(option, [
  23159. label,
  23160. value,
  23161. disabled
  23162. ]),
  23163. ...base
  23164. };
  23165. };
  23166. const optionComponent = computed(() => props.type === "button" ? checkbox_button_default : checkbox_default);
  23167. provide(checkboxGroupContextKey, {
  23168. ...pick(toRefs(props), [
  23169. "size",
  23170. "min",
  23171. "max",
  23172. "validateEvent",
  23173. "fill",
  23174. "textColor"
  23175. ]),
  23176. disabled: checkboxDisabled,
  23177. modelValue,
  23178. changeEvent
  23179. });
  23180. watch(() => props.modelValue, (newVal, oldValue) => {
  23181. if (props.validateEvent && !isEqual$1(newVal, oldValue)) formItem?.validate("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  23182. });
  23183. return (_ctx, _cache) => {
  23184. return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
  23185. id: unref(groupId),
  23186. class: normalizeClass(unref(ns).b("group")),
  23187. role: "group",
  23188. "aria-label": !unref(isLabeledByFormItem) ? __props.ariaLabel || "checkbox-group" : void 0,
  23189. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem)?.labelId : void 0
  23190. }, {
  23191. default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index) => {
  23192. return openBlock(), createBlock(resolveDynamicComponent(optionComponent.value), mergeProps({ key: index }, { ref_for: true }, getOptionProps(item)), null, 16);
  23193. }), 128))])]),
  23194. _: 3
  23195. }, 8, [
  23196. "id",
  23197. "class",
  23198. "aria-label",
  23199. "aria-labelledby"
  23200. ]);
  23201. };
  23202. }
  23203. });
  23204. //#endregion
  23205. //#region ../../packages/components/checkbox/src/checkbox-group.vue
  23206. var checkbox_group_default = checkbox_group_vue_vue_type_script_setup_true_lang_default;
  23207. //#endregion
  23208. //#region ../../packages/components/checkbox/index.ts
  23209. const ElCheckbox = withInstall(checkbox_default, {
  23210. CheckboxButton: checkbox_button_default,
  23211. CheckboxGroup: checkbox_group_default
  23212. });
  23213. const ElCheckboxButton = withNoopInstall(checkbox_button_default);
  23214. const ElCheckboxGroup = withNoopInstall(checkbox_group_default);
  23215. //#endregion
  23216. //#region ../../packages/components/radio/src/radio.ts
  23217. /**
  23218. * @deprecated Removed after 3.0.0, Use `RadioPropsBase` instead.
  23219. */
  23220. const radioPropsBase = buildProps({
  23221. modelValue: {
  23222. type: [
  23223. String,
  23224. Number,
  23225. Boolean
  23226. ],
  23227. default: void 0
  23228. },
  23229. size: useSizeProp,
  23230. disabled: {
  23231. type: Boolean,
  23232. default: void 0
  23233. },
  23234. label: {
  23235. type: [
  23236. String,
  23237. Number,
  23238. Boolean
  23239. ],
  23240. default: void 0
  23241. },
  23242. value: {
  23243. type: [
  23244. String,
  23245. Number,
  23246. Boolean
  23247. ],
  23248. default: void 0
  23249. },
  23250. name: {
  23251. type: String,
  23252. default: void 0
  23253. }
  23254. });
  23255. /**
  23256. * @deprecated Removed after 3.0.0, Use `RadioProps` instead.
  23257. */
  23258. const radioProps = buildProps({
  23259. ...radioPropsBase,
  23260. border: Boolean
  23261. });
  23262. const radioEmits = {
  23263. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  23264. [CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
  23265. };
  23266. /**
  23267. * @description default values for RadioProps
  23268. */
  23269. const radioPropsDefaults = {
  23270. modelValue: void 0,
  23271. disabled: void 0,
  23272. label: void 0,
  23273. value: void 0,
  23274. name: void 0,
  23275. border: false
  23276. };
  23277. //#endregion
  23278. //#region ../../packages/components/radio/src/constants.ts
  23279. const radioGroupKey = Symbol("radioGroupKey");
  23280. //#endregion
  23281. //#region ../../packages/components/radio/src/use-radio.ts
  23282. const useRadio = (props, emit) => {
  23283. const radioRef = ref();
  23284. const radioGroup = inject(radioGroupKey, void 0);
  23285. const isGroup = computed(() => !!radioGroup);
  23286. const actualValue = computed(() => {
  23287. if (!isPropAbsent(props.value)) return props.value;
  23288. return props.label;
  23289. });
  23290. const modelValue = computed({
  23291. get() {
  23292. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  23293. },
  23294. set(val) {
  23295. if (isGroup.value) radioGroup.changeEvent(val);
  23296. else emit && emit(UPDATE_MODEL_EVENT, val);
  23297. radioRef.value.checked = props.modelValue === actualValue.value;
  23298. }
  23299. });
  23300. const size = useFormSize(computed(() => radioGroup?.size));
  23301. const disabled = useFormDisabled(computed(() => radioGroup?.disabled));
  23302. const focus = ref(false);
  23303. const tabIndex = computed(() => {
  23304. return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
  23305. });
  23306. useDeprecated({
  23307. from: "label act as value",
  23308. replacement: "value",
  23309. version: "3.0.0",
  23310. scope: "el-radio",
  23311. ref: "https://element-plus.org/en-US/component/radio.html"
  23312. }, computed(() => isGroup.value && isPropAbsent(props.value)));
  23313. return {
  23314. radioRef,
  23315. isGroup,
  23316. radioGroup,
  23317. focus,
  23318. size,
  23319. disabled,
  23320. tabIndex,
  23321. modelValue,
  23322. actualValue
  23323. };
  23324. };
  23325. //#endregion
  23326. //#region ../../packages/components/radio/src/radio.vue?vue&type=script&setup=true&lang.ts
  23327. const _hoisted_1$61 = [
  23328. "value",
  23329. "name",
  23330. "disabled",
  23331. "checked"
  23332. ];
  23333. var radio_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  23334. name: "ElRadio",
  23335. __name: "radio",
  23336. props: radioProps,
  23337. emits: radioEmits,
  23338. setup(__props, { emit: __emit }) {
  23339. const props = __props;
  23340. const emit = __emit;
  23341. const ns = useNamespace("radio");
  23342. const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio(props, emit);
  23343. function handleChange() {
  23344. nextTick(() => emit(CHANGE_EVENT, modelValue.value));
  23345. }
  23346. return (_ctx, _cache) => {
  23347. return openBlock(), createElementBlock("label", { class: normalizeClass([
  23348. unref(ns).b(),
  23349. unref(ns).is("disabled", unref(disabled)),
  23350. unref(ns).is("focus", unref(focus)),
  23351. unref(ns).is("bordered", __props.border),
  23352. unref(ns).is("checked", unref(modelValue) === unref(actualValue)),
  23353. unref(ns).m(unref(size))
  23354. ]) }, [createElementVNode("span", { class: normalizeClass([
  23355. unref(ns).e("input"),
  23356. unref(ns).is("disabled", unref(disabled)),
  23357. unref(ns).is("checked", unref(modelValue) === unref(actualValue))
  23358. ]) }, [withDirectives(createElementVNode("input", {
  23359. ref_key: "radioRef",
  23360. ref: radioRef,
  23361. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  23362. class: normalizeClass(unref(ns).e("original")),
  23363. value: unref(actualValue),
  23364. name: __props.name || unref(radioGroup)?.name,
  23365. disabled: unref(disabled),
  23366. checked: unref(modelValue) === unref(actualValue),
  23367. type: "radio",
  23368. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  23369. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  23370. onChange: handleChange,
  23371. onClick: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"]))
  23372. }, null, 42, _hoisted_1$61), [[vModelRadio, unref(modelValue)]]), createElementVNode("span", { class: normalizeClass(unref(ns).e("inner")) }, null, 2)], 2), createElementVNode("span", {
  23373. class: normalizeClass(unref(ns).e("label")),
  23374. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"]))
  23375. }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])], 34)], 2);
  23376. };
  23377. }
  23378. });
  23379. //#endregion
  23380. //#region ../../packages/components/radio/src/radio.vue
  23381. var radio_default = radio_vue_vue_type_script_setup_true_lang_default;
  23382. //#endregion
  23383. //#region ../../packages/components/radio/src/radio-button.ts
  23384. /**
  23385. * @deprecated Removed after 3.0.0, Use `RadioButtonProps` instead.
  23386. */
  23387. const radioButtonProps = buildProps({ ...radioPropsBase });
  23388. /**
  23389. * @description default values for RadioButtonProps
  23390. */
  23391. const radioButtonPropsDefaults = {
  23392. modelValue: void 0,
  23393. disabled: void 0,
  23394. label: void 0,
  23395. value: void 0,
  23396. name: void 0
  23397. };
  23398. //#endregion
  23399. //#region ../../packages/components/radio/src/radio-button.vue?vue&type=script&setup=true&lang.ts
  23400. const _hoisted_1$60 = [
  23401. "value",
  23402. "name",
  23403. "disabled"
  23404. ];
  23405. var radio_button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  23406. name: "ElRadioButton",
  23407. __name: "radio-button",
  23408. props: radioButtonProps,
  23409. setup(__props) {
  23410. const props = __props;
  23411. const ns = useNamespace("radio");
  23412. const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio(props);
  23413. const activeStyle = computed(() => {
  23414. return {
  23415. backgroundColor: radioGroup?.fill || "",
  23416. borderColor: radioGroup?.fill || "",
  23417. boxShadow: radioGroup?.fill ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  23418. color: radioGroup?.textColor || ""
  23419. };
  23420. });
  23421. return (_ctx, _cache) => {
  23422. return openBlock(), createElementBlock("label", { class: normalizeClass([
  23423. unref(ns).b("button"),
  23424. unref(ns).is("active", unref(modelValue) === unref(actualValue)),
  23425. unref(ns).is("disabled", unref(disabled)),
  23426. unref(ns).is("focus", unref(focus)),
  23427. unref(ns).bm("button", unref(size))
  23428. ]) }, [withDirectives(createElementVNode("input", {
  23429. ref_key: "radioRef",
  23430. ref: radioRef,
  23431. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  23432. class: normalizeClass(unref(ns).be("button", "original-radio")),
  23433. value: unref(actualValue),
  23434. type: "radio",
  23435. name: __props.name || unref(radioGroup)?.name,
  23436. disabled: unref(disabled),
  23437. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  23438. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  23439. onClick: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"]))
  23440. }, null, 42, _hoisted_1$60), [[vModelRadio, unref(modelValue)]]), createElementVNode("span", {
  23441. class: normalizeClass(unref(ns).be("button", "inner")),
  23442. style: normalizeStyle(unref(modelValue) === unref(actualValue) ? activeStyle.value : {}),
  23443. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"]))
  23444. }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])], 38)], 2);
  23445. };
  23446. }
  23447. });
  23448. //#endregion
  23449. //#region ../../packages/components/radio/src/radio-button.vue
  23450. var radio_button_default = radio_button_vue_vue_type_script_setup_true_lang_default;
  23451. //#endregion
  23452. //#region ../../packages/components/radio/src/radio-group.ts
  23453. const radioDefaultProps = {
  23454. label: "label",
  23455. value: "value",
  23456. disabled: "disabled"
  23457. };
  23458. /**
  23459. * @deprecated Removed after 3.0.0, Use `RadioGroupProps` instead.
  23460. */
  23461. const radioGroupProps = buildProps({
  23462. id: {
  23463. type: String,
  23464. default: void 0
  23465. },
  23466. size: useSizeProp,
  23467. disabled: {
  23468. type: Boolean,
  23469. default: void 0
  23470. },
  23471. modelValue: {
  23472. type: [
  23473. String,
  23474. Number,
  23475. Boolean
  23476. ],
  23477. default: void 0
  23478. },
  23479. fill: {
  23480. type: String,
  23481. default: ""
  23482. },
  23483. textColor: {
  23484. type: String,
  23485. default: ""
  23486. },
  23487. name: {
  23488. type: String,
  23489. default: void 0
  23490. },
  23491. validateEvent: {
  23492. type: Boolean,
  23493. default: true
  23494. },
  23495. options: { type: definePropType(Array) },
  23496. props: {
  23497. type: definePropType(Object),
  23498. default: () => radioDefaultProps
  23499. },
  23500. type: {
  23501. type: String,
  23502. values: ["radio", "button"],
  23503. default: "radio"
  23504. },
  23505. ...useAriaProps(["ariaLabel"])
  23506. });
  23507. const radioGroupEmits = radioEmits;
  23508. /**
  23509. * @description default values for RadioGroupProps
  23510. */
  23511. const radioGroupPropsDefaults = {
  23512. id: void 0,
  23513. disabled: void 0,
  23514. modelValue: void 0,
  23515. fill: "",
  23516. textColor: "",
  23517. name: void 0,
  23518. validateEvent: true,
  23519. props: () => radioDefaultProps,
  23520. type: "radio"
  23521. };
  23522. //#endregion
  23523. //#region ../../packages/components/radio/src/radio-group.vue?vue&type=script&setup=true&lang.ts
  23524. const _hoisted_1$59 = [
  23525. "id",
  23526. "aria-label",
  23527. "aria-labelledby"
  23528. ];
  23529. var radio_group_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  23530. name: "ElRadioGroup",
  23531. __name: "radio-group",
  23532. props: radioGroupProps,
  23533. emits: radioGroupEmits,
  23534. setup(__props, { emit: __emit }) {
  23535. const props = __props;
  23536. const emit = __emit;
  23537. const ns = useNamespace("radio");
  23538. const radioId = useId();
  23539. const radioGroupRef = ref();
  23540. const { formItem } = useFormItem();
  23541. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: formItem });
  23542. const changeEvent = (value) => {
  23543. emit(UPDATE_MODEL_EVENT, value);
  23544. nextTick(() => emit(CHANGE_EVENT, value));
  23545. };
  23546. onMounted(() => {
  23547. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  23548. const firstLabel = radios[0];
  23549. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) firstLabel.tabIndex = 0;
  23550. });
  23551. const name = computed(() => {
  23552. return props.name || radioId.value;
  23553. });
  23554. const aliasProps = computed(() => ({
  23555. ...radioDefaultProps,
  23556. ...props.props
  23557. }));
  23558. const getOptionProps = (option) => {
  23559. const { label, value, disabled } = aliasProps.value;
  23560. const base = {
  23561. label: option[label],
  23562. value: option[value],
  23563. disabled: option[disabled]
  23564. };
  23565. return {
  23566. ...omit(option, [
  23567. label,
  23568. value,
  23569. disabled
  23570. ]),
  23571. ...base
  23572. };
  23573. };
  23574. const optionComponent = computed(() => props.type === "button" ? radio_button_default : radio_default);
  23575. provide(radioGroupKey, reactive({
  23576. ...toRefs(props),
  23577. changeEvent,
  23578. name
  23579. }));
  23580. watch(() => props.modelValue, (newVal, oldValue) => {
  23581. if (props.validateEvent && !isEqual$1(newVal, oldValue)) formItem?.validate("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  23582. });
  23583. return (_ctx, _cache) => {
  23584. return openBlock(), createElementBlock("div", {
  23585. id: unref(groupId),
  23586. ref_key: "radioGroupRef",
  23587. ref: radioGroupRef,
  23588. class: normalizeClass(unref(ns).b("group")),
  23589. role: "radiogroup",
  23590. "aria-label": !unref(isLabeledByFormItem) ? __props.ariaLabel || "radio-group" : void 0,
  23591. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  23592. }, [renderSlot(_ctx.$slots, "default", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index) => {
  23593. return openBlock(), createBlock(resolveDynamicComponent(optionComponent.value), mergeProps({ key: index }, { ref_for: true }, getOptionProps(item)), null, 16);
  23594. }), 128))])], 10, _hoisted_1$59);
  23595. };
  23596. }
  23597. });
  23598. //#endregion
  23599. //#region ../../packages/components/radio/src/radio-group.vue
  23600. var radio_group_default = radio_group_vue_vue_type_script_setup_true_lang_default;
  23601. //#endregion
  23602. //#region ../../packages/components/radio/index.ts
  23603. const ElRadio = withInstall(radio_default, {
  23604. RadioButton: radio_button_default,
  23605. RadioGroup: radio_group_default
  23606. });
  23607. const ElRadioGroup = withNoopInstall(radio_group_default);
  23608. const ElRadioButton = withNoopInstall(radio_button_default);
  23609. //#endregion
  23610. //#region ../../packages/components/cascader-panel/src/types.ts
  23611. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  23612. //#endregion
  23613. //#region ../../packages/components/cascader-panel/src/node-content.tsx
  23614. function isVNodeEmpty(vnodes) {
  23615. return !!(isArray$1(vnodes) ? vnodes.every(({ type }) => type === Comment) : vnodes?.type === Comment);
  23616. }
  23617. var node_content_default = /* @__PURE__ */ defineComponent({
  23618. name: "NodeContent",
  23619. props: { node: {
  23620. type: Object,
  23621. required: true
  23622. } },
  23623. setup(props) {
  23624. const ns = useNamespace("cascader-node");
  23625. const { renderLabelFn } = inject(CASCADER_PANEL_INJECTION_KEY);
  23626. const { node } = props;
  23627. const { data, label: nodeLabel } = node;
  23628. const label = () => {
  23629. const renderLabel = renderLabelFn?.({
  23630. node,
  23631. data
  23632. });
  23633. return isVNodeEmpty(renderLabel) ? nodeLabel : renderLabel ?? nodeLabel;
  23634. };
  23635. return () => createVNode("span", { "class": ns.e("label") }, [label()]);
  23636. }
  23637. });
  23638. //#endregion
  23639. //#region ../../packages/components/cascader-panel/src/node.vue?vue&type=script&setup=true&lang.ts
  23640. const _hoisted_1$58 = [
  23641. "id",
  23642. "aria-haspopup",
  23643. "aria-owns",
  23644. "aria-expanded",
  23645. "tabindex"
  23646. ];
  23647. var node_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  23648. name: "ElCascaderNode",
  23649. __name: "node",
  23650. props: {
  23651. node: {
  23652. type: Object,
  23653. required: true
  23654. },
  23655. menuId: String
  23656. },
  23657. emits: ["expand"],
  23658. setup(__props, { emit: __emit }) {
  23659. const props = __props;
  23660. const emit = __emit;
  23661. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  23662. const ns = useNamespace("cascader-node");
  23663. const isHoverMenu = computed(() => panel.isHoverMenu);
  23664. const multiple = computed(() => panel.config.multiple);
  23665. const checkStrictly = computed(() => panel.config.checkStrictly);
  23666. const showPrefix = computed(() => panel.config.showPrefix);
  23667. const checkedNodeId = computed(() => panel.checkedNodes[0]?.uid);
  23668. const isDisabled = computed(() => props.node.isDisabled);
  23669. const isLeaf = computed(() => props.node.isLeaf);
  23670. const expandable = computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  23671. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  23672. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  23673. const isInPath = (node) => {
  23674. const { level, uid } = props.node;
  23675. return node?.pathNodes[level - 1]?.uid === uid;
  23676. };
  23677. const doExpand = () => {
  23678. if (inExpandingPath.value) return;
  23679. panel.expandNode(props.node);
  23680. };
  23681. const doCheck = (checked) => {
  23682. const { node } = props;
  23683. if (checked === node.checked) return;
  23684. panel.handleCheckChange(node, checked);
  23685. };
  23686. const doLoad = () => {
  23687. panel.lazyLoad(props.node, () => {
  23688. if (!isLeaf.value) doExpand();
  23689. });
  23690. };
  23691. const handleHoverExpand = (e) => {
  23692. if (!isHoverMenu.value) return;
  23693. handleExpand();
  23694. !isLeaf.value && emit("expand", e);
  23695. };
  23696. const handleExpand = () => {
  23697. const { node } = props;
  23698. if (!expandable.value || node.loading) return;
  23699. node.loaded ? doExpand() : doLoad();
  23700. };
  23701. const handleClick = () => {
  23702. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) handleCheck(true);
  23703. else if ((panel.config.checkOnClickNode && (multiple.value || checkStrictly.value) || isLeaf.value && panel.config.checkOnClickLeaf) && !isDisabled.value) handleSelectCheck(!props.node.checked);
  23704. else if (!isHoverMenu.value) handleExpand();
  23705. };
  23706. const handleSelectCheck = (checked) => {
  23707. if (checkStrictly.value) {
  23708. doCheck(checked);
  23709. if (props.node.loaded) doExpand();
  23710. } else handleCheck(checked);
  23711. };
  23712. const handleCheck = (checked) => {
  23713. if (!props.node.loaded) doLoad();
  23714. else {
  23715. doCheck(checked);
  23716. !checkStrictly.value && doExpand();
  23717. }
  23718. };
  23719. return (_ctx, _cache) => {
  23720. return openBlock(), createElementBlock("li", {
  23721. id: `${__props.menuId}-${__props.node.uid}`,
  23722. role: "menuitem",
  23723. "aria-haspopup": !isLeaf.value,
  23724. "aria-owns": isLeaf.value ? void 0 : __props.menuId,
  23725. "aria-expanded": inExpandingPath.value,
  23726. tabindex: expandable.value ? -1 : void 0,
  23727. class: normalizeClass([
  23728. unref(ns).b(),
  23729. unref(ns).is("selectable", checkStrictly.value),
  23730. unref(ns).is("active", __props.node.checked),
  23731. unref(ns).is("disabled", !expandable.value),
  23732. inExpandingPath.value && "in-active-path",
  23733. inCheckedPath.value && "in-checked-path"
  23734. ]),
  23735. onMouseenter: handleHoverExpand,
  23736. onFocus: handleHoverExpand,
  23737. onClick: handleClick
  23738. }, [
  23739. createCommentVNode(" prefix "),
  23740. multiple.value && showPrefix.value ? (openBlock(), createBlock(unref(ElCheckbox), {
  23741. key: 0,
  23742. "model-value": __props.node.checked,
  23743. indeterminate: __props.node.indeterminate,
  23744. disabled: isDisabled.value,
  23745. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"])),
  23746. "onUpdate:modelValue": handleSelectCheck
  23747. }, null, 8, [
  23748. "model-value",
  23749. "indeterminate",
  23750. "disabled"
  23751. ])) : checkStrictly.value && showPrefix.value ? (openBlock(), createBlock(unref(ElRadio), {
  23752. key: 1,
  23753. "model-value": checkedNodeId.value,
  23754. label: __props.node.uid,
  23755. disabled: isDisabled.value,
  23756. "onUpdate:modelValue": handleSelectCheck,
  23757. onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
  23758. }, {
  23759. default: withCtx(() => [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 "), _cache[2] || (_cache[2] = createElementVNode("span", null, null, -1))]),
  23760. _: 1
  23761. }, 8, [
  23762. "model-value",
  23763. "label",
  23764. "disabled"
  23765. ])) : isLeaf.value && __props.node.checked ? (openBlock(), createBlock(unref(ElIcon), {
  23766. key: 2,
  23767. class: normalizeClass(unref(ns).e("prefix"))
  23768. }, {
  23769. default: withCtx(() => [createVNode(unref(check_default))]),
  23770. _: 1
  23771. }, 8, ["class"])) : createCommentVNode("v-if", true),
  23772. createCommentVNode(" content "),
  23773. createVNode(unref(node_content_default), { node: __props.node }, null, 8, ["node"]),
  23774. createCommentVNode(" postfix "),
  23775. !isLeaf.value ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [__props.node.loading ? (openBlock(), createBlock(unref(ElIcon), {
  23776. key: 0,
  23777. class: normalizeClass([unref(ns).is("loading"), unref(ns).e("postfix")])
  23778. }, {
  23779. default: withCtx(() => [createVNode(unref(loading_default))]),
  23780. _: 1
  23781. }, 8, ["class"])) : (openBlock(), createBlock(unref(ElIcon), {
  23782. key: 1,
  23783. class: normalizeClass(["arrow-right", unref(ns).e("postfix")])
  23784. }, {
  23785. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  23786. _: 1
  23787. }, 8, ["class"]))], 64)) : createCommentVNode("v-if", true)
  23788. ], 42, _hoisted_1$58);
  23789. };
  23790. }
  23791. });
  23792. //#endregion
  23793. //#region ../../packages/components/cascader-panel/src/node.vue
  23794. var node_default = node_vue_vue_type_script_setup_true_lang_default;
  23795. //#endregion
  23796. //#region ../../packages/components/cascader-panel/src/menu.vue?vue&type=script&setup=true&lang.ts
  23797. var menu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  23798. name: "ElCascaderMenu",
  23799. __name: "menu",
  23800. props: {
  23801. nodes: {
  23802. type: Array,
  23803. required: true
  23804. },
  23805. index: {
  23806. type: Number,
  23807. required: true
  23808. }
  23809. },
  23810. setup(__props) {
  23811. const props = __props;
  23812. const instance = getCurrentInstance();
  23813. const ns = useNamespace("cascader-menu");
  23814. const { t } = useLocale();
  23815. const id = useId();
  23816. let activeNode;
  23817. let hoverTimer;
  23818. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  23819. const hoverZone = ref();
  23820. const isEmpty = computed(() => !props.nodes.length);
  23821. const isLoading = computed(() => !panel.initialLoaded);
  23822. const menuId = computed(() => `${id.value}-${props.index}`);
  23823. const handleExpand = (e) => {
  23824. activeNode = e.target;
  23825. };
  23826. const handleMouseMove = (e) => {
  23827. if (!panel.isHoverMenu || !activeNode || !hoverZone.value) return;
  23828. if (activeNode.contains(e.target)) {
  23829. clearHoverTimer();
  23830. const el = instance.vnode.el;
  23831. const { left } = el.getBoundingClientRect();
  23832. const { offsetWidth, offsetHeight } = el;
  23833. const startX = e.clientX - left;
  23834. const top = activeNode.offsetTop;
  23835. const bottom = top + activeNode.offsetHeight;
  23836. const scrollTop = el.querySelector(`.${ns.e("wrap")}`)?.scrollTop || 0;
  23837. hoverZone.value.innerHTML = `
  23838. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} ${scrollTop} V${top} Z" />
  23839. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight + scrollTop} V${bottom} Z" />
  23840. `;
  23841. } else if (!hoverTimer) hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  23842. };
  23843. const clearHoverTimer = () => {
  23844. if (!hoverTimer) return;
  23845. clearTimeout(hoverTimer);
  23846. hoverTimer = void 0;
  23847. };
  23848. const clearHoverZone = () => {
  23849. if (!hoverZone.value) return;
  23850. hoverZone.value.innerHTML = "";
  23851. clearHoverTimer();
  23852. };
  23853. return (_ctx, _cache) => {
  23854. return openBlock(), createBlock(unref(ElScrollbar), {
  23855. key: menuId.value,
  23856. tag: "ul",
  23857. role: "menu",
  23858. class: normalizeClass(unref(ns).b()),
  23859. "wrap-class": unref(ns).e("wrap"),
  23860. "view-class": [unref(ns).e("list"), unref(ns).is("empty", isEmpty.value)],
  23861. onMousemove: handleMouseMove,
  23862. onMouseleave: clearHoverZone
  23863. }, {
  23864. default: withCtx(() => [
  23865. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.nodes, (node) => {
  23866. return openBlock(), createBlock(node_default, {
  23867. key: node.uid,
  23868. node,
  23869. "menu-id": menuId.value,
  23870. onExpand: handleExpand
  23871. }, null, 8, ["node", "menu-id"]);
  23872. }), 128)),
  23873. isLoading.value ? (openBlock(), createElementBlock("div", {
  23874. key: 0,
  23875. class: normalizeClass(unref(ns).e("empty-text"))
  23876. }, [createVNode(unref(ElIcon), {
  23877. size: "14",
  23878. class: normalizeClass(unref(ns).is("loading"))
  23879. }, {
  23880. default: withCtx(() => [createVNode(unref(loading_default))]),
  23881. _: 1
  23882. }, 8, ["class"]), createTextVNode(" " + toDisplayString(unref(t)("el.cascader.loading")), 1)], 2)) : isEmpty.value ? (openBlock(), createElementBlock("div", {
  23883. key: 1,
  23884. class: normalizeClass(unref(ns).e("empty-text"))
  23885. }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(unref(t)("el.cascader.noData")), 1)])], 2)) : unref(panel)?.isHoverMenu ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" eslint-disable vue/html-self-closing "), (openBlock(), createElementBlock("svg", {
  23886. ref_key: "hoverZone",
  23887. ref: hoverZone,
  23888. class: normalizeClass(unref(ns).e("hover-zone"))
  23889. }, null, 2))], 2112)) : createCommentVNode("v-if", true),
  23890. createCommentVNode(" eslint-enable vue/html-self-closing ")
  23891. ]),
  23892. _: 3
  23893. }, 8, [
  23894. "class",
  23895. "wrap-class",
  23896. "view-class"
  23897. ]);
  23898. };
  23899. }
  23900. });
  23901. //#endregion
  23902. //#region ../../packages/components/cascader-panel/src/menu.vue
  23903. var menu_default$1 = menu_vue_vue_type_script_setup_true_lang_default;
  23904. //#endregion
  23905. //#region ../../packages/components/cascader-panel/src/node.ts
  23906. let uid = 0;
  23907. const calculatePathNodes = (node) => {
  23908. const nodes = [node];
  23909. let { parent } = node;
  23910. while (parent) {
  23911. nodes.unshift(parent);
  23912. parent = parent.parent;
  23913. }
  23914. return nodes;
  23915. };
  23916. var Node$2 = class Node$2 {
  23917. constructor(data, config, parent, root = false) {
  23918. this.data = data;
  23919. this.config = config;
  23920. this.parent = parent;
  23921. this.root = root;
  23922. this.uid = uid++;
  23923. this.checked = false;
  23924. this.indeterminate = false;
  23925. this.loading = false;
  23926. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  23927. const childrenData = data[childrenKey];
  23928. const pathNodes = calculatePathNodes(this);
  23929. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  23930. this.value = data[valueKey];
  23931. this.label = data[labelKey];
  23932. this.pathNodes = pathNodes;
  23933. this.pathValues = pathNodes.map((node) => node.value);
  23934. this.pathLabels = pathNodes.map((node) => node.label);
  23935. this.childrenData = childrenData;
  23936. this.children = (childrenData || []).map((child) => new Node$2(child, config, this));
  23937. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  23938. this.text = "";
  23939. }
  23940. get isDisabled() {
  23941. const { data, parent, config } = this;
  23942. const { disabled, checkStrictly } = config;
  23943. return (isFunction$1(disabled) ? disabled(data, this) : !!data[disabled]) || !checkStrictly && !!parent?.isDisabled;
  23944. }
  23945. get isLeaf() {
  23946. const { data, config, childrenData, loaded } = this;
  23947. const { lazy, leaf } = config;
  23948. const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf];
  23949. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(isArray$1(childrenData) && childrenData.length) : !!isLeaf;
  23950. }
  23951. get valueByOption() {
  23952. return this.config.emitPath ? this.pathValues : this.value;
  23953. }
  23954. appendChild(childData) {
  23955. const { childrenData, children } = this;
  23956. const node = new Node$2(childData, this.config, this);
  23957. if (isArray$1(childrenData)) childrenData.push(childData);
  23958. else this.childrenData = [childData];
  23959. children.push(node);
  23960. return node;
  23961. }
  23962. calcText(allLevels, separator) {
  23963. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  23964. this.text = text;
  23965. return text;
  23966. }
  23967. broadcast(checked) {
  23968. this.children.forEach((child) => {
  23969. if (child) {
  23970. child.broadcast(checked);
  23971. child.onParentCheck?.(checked);
  23972. }
  23973. });
  23974. }
  23975. emit() {
  23976. const { parent } = this;
  23977. if (parent) {
  23978. parent.onChildCheck?.();
  23979. parent.emit();
  23980. }
  23981. }
  23982. onParentCheck(checked) {
  23983. if (!this.isDisabled) this.setCheckState(checked);
  23984. }
  23985. onChildCheck() {
  23986. const { children } = this;
  23987. const validChildren = children.filter((child) => !child.isDisabled);
  23988. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  23989. this.setCheckState(checked);
  23990. }
  23991. setCheckState(checked) {
  23992. const totalNum = this.children.length;
  23993. const checkedNum = this.children.reduce((c, p) => {
  23994. return c + (p.checked ? 1 : p.indeterminate ? .5 : 0);
  23995. }, 0);
  23996. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  23997. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  23998. }
  23999. doCheck(checked) {
  24000. if (this.checked === checked) return;
  24001. const { checkStrictly, multiple } = this.config;
  24002. if (checkStrictly || !multiple) this.checked = checked;
  24003. else {
  24004. this.broadcast(checked);
  24005. this.setCheckState(checked);
  24006. this.emit();
  24007. }
  24008. }
  24009. };
  24010. //#endregion
  24011. //#region ../../packages/components/cascader-panel/src/store.ts
  24012. const flatNodes = (nodes, leafOnly) => {
  24013. return nodes.reduce((res, node) => {
  24014. if (node.isLeaf) res.push(node);
  24015. else {
  24016. !leafOnly && res.push(node);
  24017. res = res.concat(flatNodes(node.children, leafOnly));
  24018. }
  24019. return res;
  24020. }, []);
  24021. };
  24022. var Store = class {
  24023. constructor(data, config) {
  24024. this.config = config;
  24025. const nodes = (data || []).map((nodeData) => new Node$2(nodeData, this.config));
  24026. this.nodes = nodes;
  24027. this.allNodes = flatNodes(nodes, false);
  24028. this.leafNodes = flatNodes(nodes, true);
  24029. }
  24030. getNodes() {
  24031. return this.nodes;
  24032. }
  24033. getFlattedNodes(leafOnly) {
  24034. return leafOnly ? this.leafNodes : this.allNodes;
  24035. }
  24036. appendNode(nodeData, parentNode) {
  24037. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$2(nodeData, this.config);
  24038. if (!parentNode) this.nodes.push(node);
  24039. this.appendAllNodesAndLeafNodes(node);
  24040. }
  24041. appendNodes(nodeDataList, parentNode) {
  24042. if (nodeDataList.length > 0) nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  24043. else parentNode && parentNode.isLeaf && this.leafNodes.push(parentNode);
  24044. }
  24045. appendAllNodesAndLeafNodes(node) {
  24046. this.allNodes.push(node);
  24047. node.isLeaf && this.leafNodes.push(node);
  24048. if (node.children) node.children.forEach((subNode) => {
  24049. this.appendAllNodesAndLeafNodes(subNode);
  24050. });
  24051. }
  24052. getNodeByValue(value, leafOnly = false) {
  24053. if (isPropAbsent(value)) return null;
  24054. return this.getFlattedNodes(leafOnly).find((node) => isEqual$1(node.value, value) || isEqual$1(node.pathValues, value)) || null;
  24055. }
  24056. getSameNode(node) {
  24057. if (!node) return null;
  24058. return this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level) || null;
  24059. }
  24060. };
  24061. //#endregion
  24062. //#region ../../packages/components/cascader-panel/src/utils.ts
  24063. const getMenuIndex = (el) => {
  24064. if (!el) return 0;
  24065. const pieces = el.id.split("-");
  24066. return Number(pieces[pieces.length - 2]);
  24067. };
  24068. const checkNode = (el) => {
  24069. if (!el) return;
  24070. const input = el.querySelector("input");
  24071. if (input) input.click();
  24072. else if (isLeaf(el)) el.click();
  24073. };
  24074. const sortByOriginalOrder = (oldNodes, newNodes) => {
  24075. const newNodesCopy = newNodes.slice(0);
  24076. const newIds = newNodesCopy.map((node) => node.uid);
  24077. const res = oldNodes.reduce((acc, item) => {
  24078. const index = newIds.indexOf(item.uid);
  24079. if (index > -1) {
  24080. acc.push(item);
  24081. newNodesCopy.splice(index, 1);
  24082. newIds.splice(index, 1);
  24083. }
  24084. return acc;
  24085. }, []);
  24086. res.push(...newNodesCopy);
  24087. return res;
  24088. };
  24089. //#endregion
  24090. //#region ../../packages/components/cascader-panel/src/index.vue?vue&type=script&setup=true&lang.ts
  24091. var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  24092. name: "ElCascaderPanel",
  24093. __name: "index",
  24094. props: cascaderPanelProps,
  24095. emits: cascaderPanelEmits,
  24096. setup(__props, { expose: __expose, emit: __emit }) {
  24097. const props = __props;
  24098. const emit = __emit;
  24099. let manualChecked = false;
  24100. const ns = useNamespace("cascader");
  24101. const config = useCascaderConfig(props);
  24102. const slots = useSlots();
  24103. let store;
  24104. const initialLoaded = ref(true);
  24105. const initialLoadedOnce = ref(false);
  24106. const menuList = ref([]);
  24107. const checkedValue = ref();
  24108. const menus = ref([]);
  24109. const expandingNode = ref();
  24110. const checkedNodes = ref([]);
  24111. const isHoverMenu = computed(() => config.value.expandTrigger === "hover");
  24112. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  24113. const initStore = () => {
  24114. const { options } = props;
  24115. const cfg = config.value;
  24116. manualChecked = false;
  24117. store = new Store(options, cfg);
  24118. menus.value = [store.getNodes()];
  24119. if (cfg.lazy && isEmpty(props.options)) {
  24120. initialLoaded.value = false;
  24121. lazyLoad(void 0, (list) => {
  24122. if (list) {
  24123. store = new Store(list, cfg);
  24124. menus.value = [store.getNodes()];
  24125. }
  24126. initialLoaded.value = true;
  24127. syncCheckedValue(false, true);
  24128. });
  24129. } else syncCheckedValue(false, true);
  24130. };
  24131. const lazyLoad = (node, cb) => {
  24132. const cfg = config.value;
  24133. node = node || new Node$2({}, cfg, void 0, true);
  24134. node.loading = true;
  24135. const resolve = (dataList) => {
  24136. const _node = node;
  24137. const parent = _node.root ? null : _node;
  24138. _node.loading = false;
  24139. _node.loaded = true;
  24140. _node.childrenData = _node.childrenData || [];
  24141. dataList && store?.appendNodes(dataList, parent);
  24142. dataList && cb?.(dataList);
  24143. if (node.level === 0) initialLoadedOnce.value = true;
  24144. };
  24145. const reject = () => {
  24146. node.loading = false;
  24147. node.loaded = false;
  24148. if (node.level === 0) initialLoaded.value = true;
  24149. };
  24150. cfg.lazyLoad(node, resolve, reject);
  24151. };
  24152. const expandNode = (node, silent) => {
  24153. const { level } = node;
  24154. const newMenus = menus.value.slice(0, level);
  24155. let newExpandingNode;
  24156. if (node.isLeaf) newExpandingNode = node.pathNodes[level - 2];
  24157. else {
  24158. newExpandingNode = node;
  24159. newMenus.push(node.children);
  24160. }
  24161. if (expandingNode.value?.uid !== newExpandingNode?.uid) {
  24162. expandingNode.value = node;
  24163. menus.value = newMenus;
  24164. !silent && emit("expand-change", node?.pathValues || []);
  24165. }
  24166. };
  24167. const handleCheckChange = (node, checked, emitClose = true) => {
  24168. const { checkStrictly, multiple } = config.value;
  24169. const oldNode = checkedNodes.value[0];
  24170. manualChecked = true;
  24171. !multiple && oldNode?.doCheck(false);
  24172. node.doCheck(checked);
  24173. calculateCheckedValue();
  24174. emitClose && !multiple && !checkStrictly && emit("close");
  24175. !emitClose && !multiple && expandParentNode(node);
  24176. };
  24177. const expandParentNode = (node) => {
  24178. if (!node) return;
  24179. node = node.parent;
  24180. expandParentNode(node);
  24181. node && expandNode(node);
  24182. };
  24183. const getFlattedNodes = (leafOnly) => store?.getFlattedNodes(leafOnly);
  24184. const getCheckedNodes = (leafOnly) => {
  24185. return getFlattedNodes(leafOnly)?.filter(({ checked }) => checked !== false);
  24186. };
  24187. const clearCheckedNodes = () => {
  24188. checkedNodes.value.forEach((node) => node.doCheck(false));
  24189. calculateCheckedValue();
  24190. menus.value = menus.value.slice(0, 1);
  24191. expandingNode.value = void 0;
  24192. emit("expand-change", []);
  24193. };
  24194. const calculateCheckedValue = () => {
  24195. const { checkStrictly, multiple } = config.value;
  24196. const oldNodes = checkedNodes.value;
  24197. const nodes = sortByOriginalOrder(oldNodes, getCheckedNodes(!checkStrictly));
  24198. const values = nodes.map((node) => node.valueByOption);
  24199. checkedNodes.value = nodes;
  24200. checkedValue.value = multiple ? values : values[0] ?? null;
  24201. };
  24202. const syncCheckedValue = (loaded = false, forced = false) => {
  24203. const { modelValue } = props;
  24204. const { lazy, multiple, checkStrictly } = config.value;
  24205. const leafOnly = !checkStrictly;
  24206. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value)) return;
  24207. if (lazy && !loaded) {
  24208. const nodes = unique(flattenDeep(castArray(modelValue))).map((val) => store?.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  24209. if (nodes.length) nodes.forEach((node) => {
  24210. lazyLoad(node, () => syncCheckedValue(false, forced));
  24211. });
  24212. else syncCheckedValue(true, forced);
  24213. } else {
  24214. syncMenuState(unique((multiple ? castArray(modelValue) : [modelValue]).map((val) => store?.getNodeByValue(val, leafOnly))), forced);
  24215. checkedValue.value = cloneDeep(modelValue ?? void 0);
  24216. }
  24217. };
  24218. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  24219. const { checkStrictly } = config.value;
  24220. const oldNodes = checkedNodes.value;
  24221. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  24222. const oldExpandingNode = store?.getSameNode(expandingNode.value);
  24223. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  24224. if (newExpandingNode) newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  24225. else expandingNode.value = void 0;
  24226. oldNodes.forEach((node) => node.doCheck(false));
  24227. reactive(newNodes).forEach((node) => node.doCheck(true));
  24228. checkedNodes.value = newNodes;
  24229. nextTick(scrollToExpandingNode);
  24230. };
  24231. const scrollToExpandingNode = () => {
  24232. if (!isClient) return;
  24233. menuList.value.forEach((menu) => {
  24234. const menuElement = menu?.$el;
  24235. if (menuElement) {
  24236. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  24237. let activeNode = menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  24238. if (!activeNode) {
  24239. const activeElements = menuElement.querySelectorAll(`.${ns.b("node")}.${ns.is("active")}`);
  24240. activeNode = activeElements[activeElements.length - 1];
  24241. }
  24242. scrollIntoView(container, activeNode);
  24243. }
  24244. });
  24245. };
  24246. const handleKeyDown = (e) => {
  24247. const target = e.target;
  24248. const code = getEventCode(e);
  24249. switch (code) {
  24250. case EVENT_CODE.up:
  24251. case EVENT_CODE.down:
  24252. e.preventDefault();
  24253. focusNode(getSibling(target, code === EVENT_CODE.up ? -1 : 1, `.${ns.b("node")}[tabindex="-1"]`));
  24254. break;
  24255. case EVENT_CODE.left: {
  24256. e.preventDefault();
  24257. const expandedNode = menuList.value[getMenuIndex(target) - 1]?.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  24258. focusNode(expandedNode);
  24259. break;
  24260. }
  24261. case EVENT_CODE.right: {
  24262. e.preventDefault();
  24263. const firstNode = menuList.value[getMenuIndex(target) + 1]?.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  24264. focusNode(firstNode);
  24265. break;
  24266. }
  24267. case EVENT_CODE.enter:
  24268. case EVENT_CODE.numpadEnter:
  24269. checkNode(target);
  24270. break;
  24271. }
  24272. };
  24273. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  24274. config,
  24275. expandingNode,
  24276. checkedNodes,
  24277. isHoverMenu,
  24278. initialLoaded,
  24279. renderLabelFn,
  24280. lazyLoad,
  24281. expandNode,
  24282. handleCheckChange
  24283. }));
  24284. watch(config, (newVal, oldVal) => {
  24285. if (isEqual$1(newVal, oldVal)) return;
  24286. initStore();
  24287. }, { immediate: true });
  24288. watch(() => props.options, initStore, { deep: true });
  24289. watch(() => props.modelValue, () => {
  24290. manualChecked = false;
  24291. syncCheckedValue();
  24292. }, { deep: true });
  24293. watch(() => checkedValue.value, (val) => {
  24294. if (!isEqual$1(val, props.modelValue)) {
  24295. emit(UPDATE_MODEL_EVENT, val);
  24296. emit(CHANGE_EVENT, val);
  24297. }
  24298. });
  24299. const loadLazyRootNodes = () => {
  24300. if (initialLoadedOnce.value) return;
  24301. initStore();
  24302. };
  24303. onBeforeUpdate(() => menuList.value = []);
  24304. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  24305. __expose({
  24306. menuList,
  24307. menus,
  24308. checkedNodes,
  24309. handleKeyDown,
  24310. handleCheckChange,
  24311. getFlattedNodes,
  24312. getCheckedNodes,
  24313. clearCheckedNodes,
  24314. calculateCheckedValue,
  24315. scrollToExpandingNode,
  24316. loadLazyRootNodes
  24317. });
  24318. return (_ctx, _cache) => {
  24319. return openBlock(), createElementBlock("div", {
  24320. class: normalizeClass([unref(ns).b("panel"), unref(ns).is("bordered", __props.border)]),
  24321. onKeydown: handleKeyDown
  24322. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(menus.value, (menu, index) => {
  24323. return openBlock(), createBlock(menu_default$1, {
  24324. key: index,
  24325. ref_for: true,
  24326. ref: (item) => menuList.value[index] = item,
  24327. index,
  24328. nodes: [...menu]
  24329. }, {
  24330. empty: withCtx(() => [renderSlot(_ctx.$slots, "empty")]),
  24331. _: 3
  24332. }, 8, ["index", "nodes"]);
  24333. }), 128))], 34);
  24334. };
  24335. }
  24336. });
  24337. //#endregion
  24338. //#region ../../packages/components/cascader-panel/src/index.vue
  24339. var src_default$1 = index_vue_vue_type_script_setup_true_lang_default;
  24340. //#endregion
  24341. //#region ../../packages/components/cascader-panel/index.ts
  24342. const ElCascaderPanel = withInstall(src_default$1);
  24343. //#endregion
  24344. //#region ../../packages/components/cascader/src/cascader.ts
  24345. /**
  24346. * @deprecated Removed after 3.0.0, Use `CascaderComponentProps` instead.
  24347. */
  24348. const cascaderProps = buildProps({
  24349. ...CommonProps,
  24350. size: useSizeProp,
  24351. placeholder: String,
  24352. disabled: {
  24353. type: Boolean,
  24354. default: void 0
  24355. },
  24356. clearable: Boolean,
  24357. clearIcon: {
  24358. type: iconPropType,
  24359. default: circle_close_default
  24360. },
  24361. filterable: Boolean,
  24362. filterMethod: {
  24363. type: definePropType(Function),
  24364. default: (node, keyword) => node.text.includes(keyword)
  24365. },
  24366. separator: {
  24367. type: String,
  24368. default: " / "
  24369. },
  24370. showAllLevels: {
  24371. type: Boolean,
  24372. default: true
  24373. },
  24374. collapseTags: Boolean,
  24375. maxCollapseTags: {
  24376. type: Number,
  24377. default: 1
  24378. },
  24379. collapseTagsTooltip: Boolean,
  24380. maxCollapseTagsTooltipHeight: { type: [String, Number] },
  24381. debounce: {
  24382. type: Number,
  24383. default: 300
  24384. },
  24385. beforeFilter: {
  24386. type: definePropType(Function),
  24387. default: () => true
  24388. },
  24389. placement: {
  24390. type: definePropType(String),
  24391. values: Ee,
  24392. default: "bottom-start"
  24393. },
  24394. fallbackPlacements: {
  24395. type: definePropType(Array),
  24396. default: [
  24397. "bottom-start",
  24398. "bottom",
  24399. "top-start",
  24400. "top",
  24401. "right",
  24402. "left"
  24403. ]
  24404. },
  24405. popperClass: useTooltipContentProps.popperClass,
  24406. popperStyle: useTooltipContentProps.popperStyle,
  24407. teleported: useTooltipContentProps.teleported,
  24408. effect: {
  24409. type: definePropType(String),
  24410. default: "light"
  24411. },
  24412. tagType: {
  24413. ...tagProps.type,
  24414. default: "info"
  24415. },
  24416. tagEffect: {
  24417. ...tagProps.effect,
  24418. default: "light"
  24419. },
  24420. validateEvent: {
  24421. type: Boolean,
  24422. default: true
  24423. },
  24424. persistent: {
  24425. type: Boolean,
  24426. default: true
  24427. },
  24428. showCheckedStrategy: {
  24429. type: String,
  24430. values: ["parent", "child"],
  24431. default: "child"
  24432. },
  24433. checkOnClickNode: Boolean,
  24434. showPrefix: {
  24435. type: Boolean,
  24436. default: true
  24437. },
  24438. ...useEmptyValuesProps
  24439. });
  24440. const emitChangeFn$1 = (value) => true;
  24441. const cascaderEmits = {
  24442. [UPDATE_MODEL_EVENT]: emitChangeFn$1,
  24443. [CHANGE_EVENT]: emitChangeFn$1,
  24444. focus: (evt) => evt instanceof FocusEvent,
  24445. blur: (evt) => evt instanceof FocusEvent,
  24446. clear: () => true,
  24447. visibleChange: (val) => isBoolean(val),
  24448. expandChange: (val) => !!val,
  24449. removeTag: (val) => !!val
  24450. };
  24451. //#endregion
  24452. //#region ../../packages/components/cascader/src/cascader.vue?vue&type=script&setup=true&lang.ts
  24453. const _hoisted_1$57 = ["placeholder"];
  24454. const _hoisted_2$34 = ["onClick"];
  24455. var cascader_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  24456. name: "ElCascader",
  24457. __name: "cascader",
  24458. props: cascaderProps,
  24459. emits: cascaderEmits,
  24460. setup(__props, { expose: __expose, emit: __emit }) {
  24461. const popperOptions = { modifiers: [{
  24462. name: "arrowPosition",
  24463. enabled: true,
  24464. phase: "main",
  24465. fn: ({ state }) => {
  24466. const { modifiersData, placement } = state;
  24467. if ([
  24468. "right",
  24469. "left",
  24470. "bottom",
  24471. "top"
  24472. ].includes(placement)) return;
  24473. if (modifiersData.arrow) modifiersData.arrow.x = 35;
  24474. },
  24475. requires: ["arrow"]
  24476. }] };
  24477. const props = __props;
  24478. const emit = __emit;
  24479. const attrs = useAttrs$1();
  24480. const slots = useSlots();
  24481. let inputInitialHeight = 0;
  24482. let pressDeleteCount = 0;
  24483. const nsCascader = useNamespace("cascader");
  24484. const nsInput = useNamespace("input");
  24485. const sizeMapPadding = {
  24486. small: 7,
  24487. default: 11,
  24488. large: 15
  24489. };
  24490. const { t } = useLocale();
  24491. const { formItem } = useFormItem();
  24492. const isDisabled = useFormDisabled();
  24493. const { valueOnClear } = useEmptyValues(props);
  24494. const { isComposing, handleComposition } = useComposition({ afterComposition(event) {
  24495. const text = event.target?.value;
  24496. handleInput(text);
  24497. } });
  24498. const tooltipRef = ref();
  24499. const tagTooltipRef = ref();
  24500. const inputRef = ref();
  24501. const tagWrapper = ref();
  24502. const cascaderPanelRef = ref();
  24503. const suggestionPanel = ref();
  24504. const popperVisible = ref(false);
  24505. const inputHover = ref(false);
  24506. const filtering = ref(false);
  24507. const inputValue = ref("");
  24508. const searchInputValue = ref("");
  24509. const tags = ref([]);
  24510. const suggestions = ref([]);
  24511. const showTagList = computed(() => {
  24512. if (!props.props.multiple) return [];
  24513. return props.collapseTags ? tags.value.slice(0, props.maxCollapseTags) : tags.value;
  24514. });
  24515. const collapseTagList = computed(() => {
  24516. if (!props.props.multiple) return [];
  24517. return props.collapseTags ? tags.value.slice(props.maxCollapseTags) : [];
  24518. });
  24519. const cascaderStyle = computed(() => {
  24520. return attrs.style;
  24521. });
  24522. const inputPlaceholder = computed(() => props.placeholder ?? t("el.cascader.placeholder"));
  24523. const currentPlaceholder = computed(() => searchInputValue.value || tags.value.length > 0 || isComposing.value ? "" : inputPlaceholder.value);
  24524. const realSize = useFormSize();
  24525. const tagSize = computed(() => realSize.value === "small" ? "small" : "default");
  24526. const multiple = computed(() => !!props.props.multiple);
  24527. const readonly = computed(() => !props.filterable || multiple.value);
  24528. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  24529. const checkedNodes = computed(() => cascaderPanelRef.value?.checkedNodes || []);
  24530. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  24531. disabled: isDisabled,
  24532. beforeBlur(event) {
  24533. return tooltipRef.value?.isFocusInsideContent(event) || tagTooltipRef.value?.isFocusInsideContent(event);
  24534. },
  24535. afterBlur() {
  24536. if (props.validateEvent) formItem?.validate?.("blur").catch((err) => /* @__PURE__ */ debugWarn(err));
  24537. }
  24538. });
  24539. const clearBtnVisible = computed(() => {
  24540. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value && !isFocused.value) return false;
  24541. return !!checkedNodes.value.length;
  24542. });
  24543. const presentText = computed(() => {
  24544. const { showAllLevels, separator } = props;
  24545. const nodes = checkedNodes.value;
  24546. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  24547. });
  24548. const validateState = computed(() => formItem?.validateState || "");
  24549. const checkedValue = computed({
  24550. get() {
  24551. return cloneDeep(props.modelValue);
  24552. },
  24553. set(val) {
  24554. const value = val ?? valueOnClear.value;
  24555. emit(UPDATE_MODEL_EVENT, value);
  24556. emit(CHANGE_EVENT, value);
  24557. if (props.validateEvent) formItem?.validate("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  24558. }
  24559. });
  24560. const cascaderKls = computed(() => {
  24561. return [
  24562. nsCascader.b(),
  24563. nsCascader.m(realSize.value),
  24564. nsCascader.is("disabled", isDisabled.value),
  24565. attrs.class
  24566. ];
  24567. });
  24568. const cascaderIconKls = computed(() => {
  24569. return [
  24570. nsInput.e("icon"),
  24571. "icon-arrow-down",
  24572. nsCascader.is("reverse", popperVisible.value)
  24573. ];
  24574. });
  24575. const inputClass = computed(() => nsCascader.is("focus", isFocused.value));
  24576. const contentRef = computed(() => {
  24577. return tooltipRef.value?.popperRef?.contentRef;
  24578. });
  24579. const handleClickOutside = (event) => {
  24580. if (isFocused.value) handleBlur(new FocusEvent("blur", event));
  24581. togglePopperVisible(false);
  24582. };
  24583. const togglePopperVisible = (visible) => {
  24584. if (isDisabled.value) return;
  24585. visible = visible ?? !popperVisible.value;
  24586. if (visible !== popperVisible.value) {
  24587. popperVisible.value = visible;
  24588. inputRef.value?.input?.setAttribute("aria-expanded", `${visible}`);
  24589. if (visible) {
  24590. updatePopperPosition();
  24591. cascaderPanelRef.value && nextTick(cascaderPanelRef.value.scrollToExpandingNode);
  24592. } else if (props.filterable) syncPresentTextValue();
  24593. emit("visibleChange", visible);
  24594. }
  24595. };
  24596. const updatePopperPosition = () => {
  24597. nextTick(() => {
  24598. tooltipRef.value?.updatePopper();
  24599. });
  24600. };
  24601. const hideSuggestionPanel = () => {
  24602. filtering.value = false;
  24603. };
  24604. const genTag = (node) => {
  24605. const { showAllLevels, separator } = props;
  24606. return {
  24607. node,
  24608. key: node.uid,
  24609. text: node.calcText(showAllLevels, separator),
  24610. hitState: false,
  24611. closable: !isDisabled.value && !node.isDisabled
  24612. };
  24613. };
  24614. const deleteTag = (tag) => {
  24615. const node = tag.node;
  24616. node.doCheck(false);
  24617. cascaderPanelRef.value?.calculateCheckedValue();
  24618. emit("removeTag", node.valueByOption);
  24619. };
  24620. const getStrategyCheckedNodes = () => {
  24621. switch (props.showCheckedStrategy) {
  24622. case "child": return checkedNodes.value;
  24623. case "parent": {
  24624. const clickedNodes = getCheckedNodes(false);
  24625. const clickedNodesValue = clickedNodes.map((o) => o.value);
  24626. return clickedNodes.filter((o) => !o.parent || !clickedNodesValue.includes(o.parent.value));
  24627. }
  24628. default: return [];
  24629. }
  24630. };
  24631. const calculatePresentTags = () => {
  24632. if (!multiple.value) return;
  24633. const nodes = getStrategyCheckedNodes();
  24634. const allTags = [];
  24635. nodes.forEach((node) => allTags.push(genTag(node)));
  24636. tags.value = allTags;
  24637. };
  24638. const calculateSuggestions = () => {
  24639. const { filterMethod, showAllLevels, separator } = props;
  24640. const res = cascaderPanelRef.value?.getFlattedNodes(!props.props.checkStrictly)?.filter((node) => {
  24641. if (node.isDisabled) return false;
  24642. node.calcText(showAllLevels, separator);
  24643. return filterMethod(node, searchKeyword.value);
  24644. });
  24645. if (multiple.value) tags.value.forEach((tag) => {
  24646. tag.hitState = false;
  24647. });
  24648. filtering.value = true;
  24649. suggestions.value = res;
  24650. updatePopperPosition();
  24651. };
  24652. const focusFirstNode = () => {
  24653. let firstNode;
  24654. if (filtering.value && suggestionPanel.value) firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  24655. else firstNode = cascaderPanelRef.value?.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  24656. if (firstNode) {
  24657. firstNode.focus();
  24658. !filtering.value && firstNode.click();
  24659. }
  24660. };
  24661. const updateStyle = () => {
  24662. const inputInner = inputRef.value?.input;
  24663. const tagWrapperEl = tagWrapper.value;
  24664. const suggestionPanelEl = suggestionPanel.value?.$el;
  24665. if (!isClient || !inputInner) return;
  24666. if (suggestionPanelEl) {
  24667. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  24668. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  24669. }
  24670. if (tagWrapperEl) {
  24671. const { offsetHeight } = tagWrapperEl;
  24672. const height = tags.value.length > 0 ? `${Math.max(offsetHeight, inputInitialHeight) - 2}px` : `${inputInitialHeight}px`;
  24673. inputInner.style.height = height;
  24674. if (slots.prefix) {
  24675. const prefix = inputRef.value?.$el.querySelector(`.${nsInput.e("prefix")}`);
  24676. let left = 0;
  24677. if (prefix) {
  24678. left = prefix.offsetWidth;
  24679. if (left > 0) left += sizeMapPadding[realSize.value || "default"];
  24680. }
  24681. tagWrapperEl.style.left = `${left}px`;
  24682. } else tagWrapperEl.style.left = `0`;
  24683. updatePopperPosition();
  24684. }
  24685. };
  24686. const getCheckedNodes = (leafOnly) => {
  24687. return cascaderPanelRef.value?.getCheckedNodes(leafOnly);
  24688. };
  24689. const handleExpandChange = (value) => {
  24690. updatePopperPosition();
  24691. emit("expandChange", value);
  24692. };
  24693. const handleKeyDown = (e) => {
  24694. if (isComposing.value) return;
  24695. switch (getEventCode(e)) {
  24696. case EVENT_CODE.enter:
  24697. case EVENT_CODE.numpadEnter:
  24698. togglePopperVisible();
  24699. break;
  24700. case EVENT_CODE.down:
  24701. togglePopperVisible(true);
  24702. nextTick(focusFirstNode);
  24703. e.preventDefault();
  24704. break;
  24705. case EVENT_CODE.esc:
  24706. if (popperVisible.value === true) {
  24707. e.preventDefault();
  24708. e.stopPropagation();
  24709. togglePopperVisible(false);
  24710. }
  24711. break;
  24712. case EVENT_CODE.tab:
  24713. togglePopperVisible(false);
  24714. break;
  24715. }
  24716. };
  24717. const handleClear = () => {
  24718. cascaderPanelRef.value?.clearCheckedNodes();
  24719. if (!popperVisible.value && props.filterable) syncPresentTextValue();
  24720. togglePopperVisible(false);
  24721. emit("clear");
  24722. };
  24723. const syncPresentTextValue = () => {
  24724. const { value } = presentText;
  24725. inputValue.value = value;
  24726. searchInputValue.value = value;
  24727. };
  24728. const handleSuggestionClick = (node) => {
  24729. const { checked } = node;
  24730. if (multiple.value) cascaderPanelRef.value?.handleCheckChange(node, !checked, false);
  24731. else {
  24732. !checked && cascaderPanelRef.value?.handleCheckChange(node, true, false);
  24733. togglePopperVisible(false);
  24734. }
  24735. };
  24736. const handleSuggestionKeyDown = (e) => {
  24737. const target = e.target;
  24738. const code = getEventCode(e);
  24739. switch (code) {
  24740. case EVENT_CODE.up:
  24741. case EVENT_CODE.down:
  24742. e.preventDefault();
  24743. focusNode(getSibling(target, code === EVENT_CODE.up ? -1 : 1, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  24744. break;
  24745. case EVENT_CODE.enter:
  24746. case EVENT_CODE.numpadEnter:
  24747. target.click();
  24748. break;
  24749. }
  24750. };
  24751. const handleDelete = () => {
  24752. const lastTag = tags.value[tags.value.length - 1];
  24753. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  24754. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.value.length > 1) return;
  24755. if (lastTag.hitState) deleteTag(lastTag);
  24756. else lastTag.hitState = true;
  24757. };
  24758. const handleFilter = useDebounceFn(() => {
  24759. const { value } = searchKeyword;
  24760. if (!value) return;
  24761. const passed = props.beforeFilter(value);
  24762. if (isPromise(passed)) passed.then(calculateSuggestions).catch(() => {});
  24763. else if (passed !== false) calculateSuggestions();
  24764. else hideSuggestionPanel();
  24765. }, computed(() => props.debounce));
  24766. const handleInput = (val, e) => {
  24767. !popperVisible.value && togglePopperVisible(true);
  24768. if (e?.isComposing) return;
  24769. val ? handleFilter() : hideSuggestionPanel();
  24770. };
  24771. const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  24772. const focus = () => {
  24773. inputRef.value?.focus();
  24774. };
  24775. const blur = () => {
  24776. inputRef.value?.blur();
  24777. };
  24778. watch(filtering, updatePopperPosition);
  24779. watch([
  24780. checkedNodes,
  24781. isDisabled,
  24782. () => props.collapseTags,
  24783. () => props.maxCollapseTags
  24784. ], calculatePresentTags);
  24785. watch(tags, () => {
  24786. nextTick(() => updateStyle());
  24787. });
  24788. watch(realSize, async () => {
  24789. await nextTick();
  24790. const inputInner = inputRef.value.input;
  24791. inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
  24792. updateStyle();
  24793. });
  24794. watch(presentText, syncPresentTextValue, { immediate: true });
  24795. watch(() => popperVisible.value, (val) => {
  24796. if (val && props.props.lazy && props.props.lazyLoad) cascaderPanelRef.value?.loadLazyRootNodes();
  24797. });
  24798. onMounted(() => {
  24799. const inputInner = inputRef.value.input;
  24800. const inputInnerHeight = getInputInnerHeight(inputInner);
  24801. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  24802. useResizeObserver(inputInner, updateStyle);
  24803. });
  24804. __expose({
  24805. getCheckedNodes,
  24806. cascaderPanelRef,
  24807. togglePopperVisible,
  24808. contentRef,
  24809. presentText,
  24810. focus,
  24811. blur
  24812. });
  24813. return (_ctx, _cache) => {
  24814. return openBlock(), createBlock(unref(ElTooltip), {
  24815. ref_key: "tooltipRef",
  24816. ref: tooltipRef,
  24817. visible: popperVisible.value,
  24818. teleported: __props.teleported,
  24819. "popper-class": [unref(nsCascader).e("dropdown"), __props.popperClass],
  24820. "popper-style": __props.popperStyle,
  24821. "popper-options": popperOptions,
  24822. "fallback-placements": __props.fallbackPlacements,
  24823. "stop-popper-mouse-event": false,
  24824. "gpu-acceleration": false,
  24825. placement: __props.placement,
  24826. transition: `${unref(nsCascader).namespace.value}-zoom-in-top`,
  24827. effect: __props.effect,
  24828. pure: "",
  24829. persistent: __props.persistent,
  24830. onHide: hideSuggestionPanel
  24831. }, {
  24832. default: withCtx(() => [withDirectives((openBlock(), createElementBlock("div", {
  24833. ref_key: "wrapperRef",
  24834. ref: wrapperRef,
  24835. class: normalizeClass(cascaderKls.value),
  24836. style: normalizeStyle(cascaderStyle.value),
  24837. onClick: _cache[8] || (_cache[8] = () => togglePopperVisible(readonly.value ? void 0 : true)),
  24838. onKeydown: handleKeyDown,
  24839. onMouseenter: _cache[9] || (_cache[9] = ($event) => inputHover.value = true),
  24840. onMouseleave: _cache[10] || (_cache[10] = ($event) => inputHover.value = false)
  24841. }, [createVNode(unref(ElInput), {
  24842. ref_key: "inputRef",
  24843. ref: inputRef,
  24844. modelValue: inputValue.value,
  24845. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inputValue.value = $event),
  24846. placeholder: currentPlaceholder.value,
  24847. readonly: readonly.value,
  24848. disabled: unref(isDisabled),
  24849. "validate-event": false,
  24850. size: unref(realSize),
  24851. class: normalizeClass(inputClass.value),
  24852. tabindex: multiple.value && __props.filterable && !unref(isDisabled) ? -1 : void 0,
  24853. onCompositionstart: unref(handleComposition),
  24854. onCompositionupdate: unref(handleComposition),
  24855. onCompositionend: unref(handleComposition),
  24856. onInput: handleInput
  24857. }, createSlots({
  24858. suffix: withCtx(() => [clearBtnVisible.value ? (openBlock(), createBlock(unref(ElIcon), {
  24859. key: "clear",
  24860. class: normalizeClass([unref(nsInput).e("icon"), "icon-circle-close"]),
  24861. onClick: withModifiers(handleClear, ["stop"])
  24862. }, {
  24863. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.clearIcon)))]),
  24864. _: 1
  24865. }, 8, ["class"])) : (openBlock(), createBlock(unref(ElIcon), {
  24866. key: "arrow-down",
  24867. class: normalizeClass(cascaderIconKls.value),
  24868. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => togglePopperVisible(), ["stop"]))
  24869. }, {
  24870. default: withCtx(() => [createVNode(unref(arrow_down_default))]),
  24871. _: 1
  24872. }, 8, ["class"]))]),
  24873. _: 2
  24874. }, [_ctx.$slots.prefix ? {
  24875. name: "prefix",
  24876. fn: withCtx(() => [renderSlot(_ctx.$slots, "prefix")]),
  24877. key: "0"
  24878. } : void 0]), 1032, [
  24879. "modelValue",
  24880. "placeholder",
  24881. "readonly",
  24882. "disabled",
  24883. "size",
  24884. "class",
  24885. "tabindex",
  24886. "onCompositionstart",
  24887. "onCompositionupdate",
  24888. "onCompositionend"
  24889. ]), multiple.value ? (openBlock(), createElementBlock("div", {
  24890. key: 0,
  24891. ref_key: "tagWrapper",
  24892. ref: tagWrapper,
  24893. class: normalizeClass([unref(nsCascader).e("tags"), unref(nsCascader).is("validate", Boolean(validateState.value))])
  24894. }, [
  24895. renderSlot(_ctx.$slots, "tag", {
  24896. data: tags.value,
  24897. deleteTag
  24898. }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(showTagList.value, (tag) => {
  24899. return openBlock(), createBlock(unref(ElTag), {
  24900. key: tag.key,
  24901. type: __props.tagType,
  24902. size: tagSize.value,
  24903. effect: __props.tagEffect,
  24904. hit: tag.hitState,
  24905. closable: tag.closable,
  24906. "disable-transitions": "",
  24907. onClose: ($event) => deleteTag(tag)
  24908. }, {
  24909. default: withCtx(() => [createElementVNode("span", null, toDisplayString(tag.text), 1)]),
  24910. _: 2
  24911. }, 1032, [
  24912. "type",
  24913. "size",
  24914. "effect",
  24915. "hit",
  24916. "closable",
  24917. "onClose"
  24918. ]);
  24919. }), 128))]),
  24920. __props.collapseTags && tags.value.length > __props.maxCollapseTags ? (openBlock(), createBlock(unref(ElTooltip), {
  24921. key: 0,
  24922. ref_key: "tagTooltipRef",
  24923. ref: tagTooltipRef,
  24924. disabled: popperVisible.value || !__props.collapseTagsTooltip,
  24925. "fallback-placements": [
  24926. "bottom",
  24927. "top",
  24928. "right",
  24929. "left"
  24930. ],
  24931. placement: "bottom",
  24932. "popper-class": __props.popperClass,
  24933. "popper-style": __props.popperStyle,
  24934. effect: __props.effect,
  24935. persistent: __props.persistent
  24936. }, {
  24937. default: withCtx(() => [createVNode(unref(ElTag), {
  24938. closable: false,
  24939. size: tagSize.value,
  24940. type: __props.tagType,
  24941. effect: __props.tagEffect,
  24942. "disable-transitions": ""
  24943. }, {
  24944. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(unref(nsCascader).e("tags-text")) }, " + " + toDisplayString(tags.value.length - __props.maxCollapseTags), 3)]),
  24945. _: 1
  24946. }, 8, [
  24947. "size",
  24948. "type",
  24949. "effect"
  24950. ])]),
  24951. content: withCtx(() => [createVNode(unref(ElScrollbar), { "max-height": __props.maxCollapseTagsTooltipHeight }, {
  24952. default: withCtx(() => [createElementVNode("div", { class: normalizeClass(unref(nsCascader).e("collapse-tags")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(collapseTagList.value, (tag, idx) => {
  24953. return openBlock(), createElementBlock("div", {
  24954. key: idx,
  24955. class: normalizeClass(unref(nsCascader).e("collapse-tag"))
  24956. }, [(openBlock(), createBlock(unref(ElTag), {
  24957. key: tag.key,
  24958. class: "in-tooltip",
  24959. type: __props.tagType,
  24960. size: tagSize.value,
  24961. effect: __props.tagEffect,
  24962. hit: tag.hitState,
  24963. closable: tag.closable,
  24964. "disable-transitions": "",
  24965. onClose: ($event) => deleteTag(tag)
  24966. }, {
  24967. default: withCtx(() => [createElementVNode("span", null, toDisplayString(tag.text), 1)]),
  24968. _: 2
  24969. }, 1032, [
  24970. "type",
  24971. "size",
  24972. "effect",
  24973. "hit",
  24974. "closable",
  24975. "onClose"
  24976. ]))], 2);
  24977. }), 128))], 2)]),
  24978. _: 1
  24979. }, 8, ["max-height"])]),
  24980. _: 1
  24981. }, 8, [
  24982. "disabled",
  24983. "popper-class",
  24984. "popper-style",
  24985. "effect",
  24986. "persistent"
  24987. ])) : createCommentVNode("v-if", true),
  24988. __props.filterable && !unref(isDisabled) ? withDirectives((openBlock(), createElementBlock("input", {
  24989. key: 1,
  24990. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => searchInputValue.value = $event),
  24991. type: "text",
  24992. class: normalizeClass(unref(nsCascader).e("search-input")),
  24993. placeholder: presentText.value ? "" : inputPlaceholder.value,
  24994. onInput: _cache[3] || (_cache[3] = (e) => handleInput(searchInputValue.value, e)),
  24995. onClick: _cache[4] || (_cache[4] = withModifiers(($event) => togglePopperVisible(true), ["stop"])),
  24996. onKeydown: withKeys(handleDelete, ["delete"]),
  24997. onCompositionstart: _cache[5] || (_cache[5] = (...args) => unref(handleComposition) && unref(handleComposition)(...args)),
  24998. onCompositionupdate: _cache[6] || (_cache[6] = (...args) => unref(handleComposition) && unref(handleComposition)(...args)),
  24999. onCompositionend: _cache[7] || (_cache[7] = (...args) => unref(handleComposition) && unref(handleComposition)(...args))
  25000. }, null, 42, _hoisted_1$57)), [[vModelText, searchInputValue.value]]) : createCommentVNode("v-if", true)
  25001. ], 2)) : createCommentVNode("v-if", true)], 38)), [[
  25002. unref(ClickOutside),
  25003. handleClickOutside,
  25004. contentRef.value
  25005. ]])]),
  25006. content: withCtx(() => [
  25007. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  25008. key: 0,
  25009. class: normalizeClass(unref(nsCascader).e("header")),
  25010. onClick: _cache[11] || (_cache[11] = withModifiers(() => {}, ["stop"]))
  25011. }, [renderSlot(_ctx.$slots, "header")], 2)) : createCommentVNode("v-if", true),
  25012. withDirectives(createVNode(unref(ElCascaderPanel), {
  25013. ref_key: "cascaderPanelRef",
  25014. ref: cascaderPanelRef,
  25015. modelValue: checkedValue.value,
  25016. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => checkedValue.value = $event),
  25017. options: __props.options,
  25018. props: props.props,
  25019. border: false,
  25020. "render-label": _ctx.$slots.default,
  25021. onExpandChange: handleExpandChange,
  25022. onClose: _cache[13] || (_cache[13] = ($event) => _ctx.$nextTick(() => togglePopperVisible(false)))
  25023. }, {
  25024. empty: withCtx(() => [renderSlot(_ctx.$slots, "empty")]),
  25025. _: 3
  25026. }, 8, [
  25027. "modelValue",
  25028. "options",
  25029. "props",
  25030. "render-label"
  25031. ]), [[vShow, !filtering.value]]),
  25032. __props.filterable ? withDirectives((openBlock(), createBlock(unref(ElScrollbar), {
  25033. key: 1,
  25034. ref_key: "suggestionPanel",
  25035. ref: suggestionPanel,
  25036. tag: "ul",
  25037. class: normalizeClass(unref(nsCascader).e("suggestion-panel")),
  25038. "view-class": unref(nsCascader).e("suggestion-list"),
  25039. onKeydown: handleSuggestionKeyDown
  25040. }, {
  25041. default: withCtx(() => [suggestions.value.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(suggestions.value, (item) => {
  25042. return openBlock(), createElementBlock("li", {
  25043. key: item.uid,
  25044. class: normalizeClass([unref(nsCascader).e("suggestion-item"), unref(nsCascader).is("checked", item.checked)]),
  25045. tabindex: -1,
  25046. onClick: ($event) => handleSuggestionClick(item)
  25047. }, [renderSlot(_ctx.$slots, "suggestion-item", { item }, () => [createElementVNode("span", null, toDisplayString(item.text), 1), item.checked ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  25048. default: withCtx(() => [createVNode(unref(check_default))]),
  25049. _: 1
  25050. })) : createCommentVNode("v-if", true)])], 10, _hoisted_2$34);
  25051. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [createElementVNode("li", { class: normalizeClass(unref(nsCascader).e("empty-text")) }, toDisplayString(unref(t)("el.cascader.noMatch")), 3)])]),
  25052. _: 3
  25053. }, 8, ["class", "view-class"])), [[vShow, filtering.value]]) : createCommentVNode("v-if", true),
  25054. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  25055. key: 2,
  25056. class: normalizeClass(unref(nsCascader).e("footer")),
  25057. onClick: _cache[14] || (_cache[14] = withModifiers(() => {}, ["stop"]))
  25058. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  25059. ]),
  25060. _: 3
  25061. }, 8, [
  25062. "visible",
  25063. "teleported",
  25064. "popper-class",
  25065. "popper-style",
  25066. "fallback-placements",
  25067. "placement",
  25068. "transition",
  25069. "effect",
  25070. "persistent"
  25071. ]);
  25072. };
  25073. }
  25074. });
  25075. //#endregion
  25076. //#region ../../packages/components/cascader/src/cascader.vue
  25077. var cascader_default = cascader_vue_vue_type_script_setup_true_lang_default;
  25078. //#endregion
  25079. //#region ../../packages/components/cascader/index.ts
  25080. const ElCascader = withInstall(cascader_default);
  25081. //#endregion
  25082. //#region ../../packages/components/check-tag/src/check-tag.ts
  25083. /**
  25084. * @deprecated Removed after 3.0.0, Use `CheckTagProps` instead.
  25085. */
  25086. const checkTagProps = buildProps({
  25087. checked: Boolean,
  25088. disabled: Boolean,
  25089. type: {
  25090. type: String,
  25091. values: [
  25092. "primary",
  25093. "success",
  25094. "info",
  25095. "warning",
  25096. "danger"
  25097. ],
  25098. default: "primary"
  25099. }
  25100. });
  25101. const checkTagEmits = {
  25102. "update:checked": (value) => isBoolean(value),
  25103. [CHANGE_EVENT]: (value) => isBoolean(value)
  25104. };
  25105. //#endregion
  25106. //#region ../../packages/components/check-tag/src/check-tag.vue?vue&type=script&setup=true&lang.ts
  25107. var check_tag_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25108. name: "ElCheckTag",
  25109. __name: "check-tag",
  25110. props: checkTagProps,
  25111. emits: checkTagEmits,
  25112. setup(__props, { emit: __emit }) {
  25113. const props = __props;
  25114. const emit = __emit;
  25115. const ns = useNamespace("check-tag");
  25116. const containerKls = computed(() => [
  25117. ns.b(),
  25118. ns.is("checked", props.checked),
  25119. ns.is("disabled", props.disabled),
  25120. ns.m(props.type || "primary")
  25121. ]);
  25122. const handleChange = () => {
  25123. if (props.disabled) return;
  25124. const checked = !props.checked;
  25125. emit(CHANGE_EVENT, checked);
  25126. emit("update:checked", checked);
  25127. };
  25128. return (_ctx, _cache) => {
  25129. return openBlock(), createElementBlock("span", {
  25130. class: normalizeClass(containerKls.value),
  25131. onClick: handleChange
  25132. }, [renderSlot(_ctx.$slots, "default")], 2);
  25133. };
  25134. }
  25135. });
  25136. //#endregion
  25137. //#region ../../packages/components/check-tag/src/check-tag.vue
  25138. var check_tag_default = check_tag_vue_vue_type_script_setup_true_lang_default;
  25139. //#endregion
  25140. //#region ../../packages/components/check-tag/index.ts
  25141. const ElCheckTag = withInstall(check_tag_default);
  25142. //#endregion
  25143. //#region ../../packages/components/col/src/col.ts
  25144. /**
  25145. * @deprecated Removed after 3.0.0, Use `ColProps` instead.
  25146. */
  25147. const colProps = buildProps({
  25148. tag: {
  25149. type: String,
  25150. default: "div"
  25151. },
  25152. span: {
  25153. type: Number,
  25154. default: 24
  25155. },
  25156. offset: {
  25157. type: Number,
  25158. default: 0
  25159. },
  25160. pull: {
  25161. type: Number,
  25162. default: 0
  25163. },
  25164. push: {
  25165. type: Number,
  25166. default: 0
  25167. },
  25168. xs: {
  25169. type: definePropType([Number, Object]),
  25170. default: () => mutable({})
  25171. },
  25172. sm: {
  25173. type: definePropType([Number, Object]),
  25174. default: () => mutable({})
  25175. },
  25176. md: {
  25177. type: definePropType([Number, Object]),
  25178. default: () => mutable({})
  25179. },
  25180. lg: {
  25181. type: definePropType([Number, Object]),
  25182. default: () => mutable({})
  25183. },
  25184. xl: {
  25185. type: definePropType([Number, Object]),
  25186. default: () => mutable({})
  25187. }
  25188. });
  25189. //#endregion
  25190. //#region ../../packages/components/row/src/row.ts
  25191. const RowJustify = [
  25192. "start",
  25193. "center",
  25194. "end",
  25195. "space-around",
  25196. "space-between",
  25197. "space-evenly"
  25198. ];
  25199. const RowAlign = [
  25200. "top",
  25201. "middle",
  25202. "bottom"
  25203. ];
  25204. /**
  25205. * @deprecated Removed after 3.0.0, Use `RowProps` instead.
  25206. */
  25207. const rowProps = buildProps({
  25208. tag: {
  25209. type: String,
  25210. default: "div"
  25211. },
  25212. gutter: {
  25213. type: Number,
  25214. default: 0
  25215. },
  25216. justify: {
  25217. type: String,
  25218. values: RowJustify,
  25219. default: "start"
  25220. },
  25221. align: {
  25222. type: String,
  25223. values: RowAlign
  25224. }
  25225. });
  25226. //#endregion
  25227. //#region ../../packages/components/row/src/constants.ts
  25228. const rowContextKey = Symbol("rowContextKey");
  25229. //#endregion
  25230. //#region ../../packages/components/row/src/row.vue?vue&type=script&setup=true&lang.ts
  25231. var row_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25232. name: "ElRow",
  25233. __name: "row",
  25234. props: rowProps,
  25235. setup(__props) {
  25236. const props = __props;
  25237. const ns = useNamespace("row");
  25238. provide(rowContextKey, { gutter: computed(() => props.gutter) });
  25239. const style = computed(() => {
  25240. const styles = {};
  25241. if (!props.gutter) return styles;
  25242. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  25243. return styles;
  25244. });
  25245. const rowKls = computed(() => [
  25246. ns.b(),
  25247. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  25248. ns.is(`align-${props.align}`, !!props.align)
  25249. ]);
  25250. return (_ctx, _cache) => {
  25251. return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
  25252. class: normalizeClass(rowKls.value),
  25253. style: normalizeStyle(style.value)
  25254. }, {
  25255. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  25256. _: 3
  25257. }, 8, ["class", "style"]);
  25258. };
  25259. }
  25260. });
  25261. //#endregion
  25262. //#region ../../packages/components/row/src/row.vue
  25263. var row_default = row_vue_vue_type_script_setup_true_lang_default;
  25264. //#endregion
  25265. //#region ../../packages/components/row/index.ts
  25266. const ElRow = withInstall(row_default);
  25267. //#endregion
  25268. //#region ../../packages/components/col/src/col.vue?vue&type=script&setup=true&lang.ts
  25269. var col_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25270. name: "ElCol",
  25271. __name: "col",
  25272. props: colProps,
  25273. setup(__props) {
  25274. const props = __props;
  25275. const { gutter } = inject(rowContextKey, { gutter: computed(() => 0) });
  25276. const ns = useNamespace("col");
  25277. const style = computed(() => {
  25278. const styles = {};
  25279. if (gutter.value) styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  25280. return styles;
  25281. });
  25282. const colKls = computed(() => {
  25283. const classes = [];
  25284. [
  25285. "span",
  25286. "offset",
  25287. "pull",
  25288. "push"
  25289. ].forEach((prop) => {
  25290. const size = props[prop];
  25291. if (isNumber(size)) {
  25292. if (prop === "span") classes.push(ns.b(`${props[prop]}`));
  25293. else if (size > 0) classes.push(ns.b(`${prop}-${props[prop]}`));
  25294. }
  25295. });
  25296. [
  25297. "xs",
  25298. "sm",
  25299. "md",
  25300. "lg",
  25301. "xl"
  25302. ].forEach((size) => {
  25303. if (isNumber(props[size])) classes.push(ns.b(`${size}-${props[size]}`));
  25304. else if (isObject$1(props[size])) Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  25305. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  25306. });
  25307. });
  25308. if (gutter.value) classes.push(ns.is("guttered"));
  25309. return [ns.b(), classes];
  25310. });
  25311. return (_ctx, _cache) => {
  25312. return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
  25313. class: normalizeClass(colKls.value),
  25314. style: normalizeStyle(style.value)
  25315. }, {
  25316. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  25317. _: 3
  25318. }, 8, ["class", "style"]);
  25319. };
  25320. }
  25321. });
  25322. //#endregion
  25323. //#region ../../packages/components/col/src/col.vue
  25324. var col_default = col_vue_vue_type_script_setup_true_lang_default;
  25325. //#endregion
  25326. //#region ../../packages/components/col/index.ts
  25327. const ElCol = withInstall(col_default);
  25328. //#endregion
  25329. //#region ../../packages/components/collapse/src/collapse.ts
  25330. const emitChangeFn = (value) => isNumber(value) || isString(value) || isArray$1(value);
  25331. /**
  25332. * @deprecated Removed after 3.0.0, Use `CollapseProps` instead.
  25333. */
  25334. const collapseProps = buildProps({
  25335. accordion: Boolean,
  25336. modelValue: {
  25337. type: definePropType([
  25338. Array,
  25339. String,
  25340. Number
  25341. ]),
  25342. default: () => mutable([])
  25343. },
  25344. expandIconPosition: {
  25345. type: definePropType([String]),
  25346. default: "right"
  25347. },
  25348. beforeCollapse: { type: definePropType(Function) }
  25349. });
  25350. const collapseEmits = {
  25351. [UPDATE_MODEL_EVENT]: emitChangeFn,
  25352. [CHANGE_EVENT]: emitChangeFn
  25353. };
  25354. //#endregion
  25355. //#region ../../packages/components/collapse/src/constants.ts
  25356. const collapseContextKey = Symbol("collapseContextKey");
  25357. //#endregion
  25358. //#region ../../packages/components/collapse/src/use-collapse.ts
  25359. const SCOPE$4 = "ElCollapse";
  25360. const useCollapse = (props, emit) => {
  25361. const activeNames = ref(castArray$1(props.modelValue));
  25362. const setActiveNames = (_activeNames) => {
  25363. activeNames.value = _activeNames;
  25364. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  25365. emit(UPDATE_MODEL_EVENT, value);
  25366. emit(CHANGE_EVENT, value);
  25367. };
  25368. const handleChange = (name) => {
  25369. if (props.accordion) setActiveNames([activeNames.value[0] === name ? "" : name]);
  25370. else {
  25371. const _activeNames = [...activeNames.value];
  25372. const index = _activeNames.indexOf(name);
  25373. if (index > -1) _activeNames.splice(index, 1);
  25374. else _activeNames.push(name);
  25375. setActiveNames(_activeNames);
  25376. }
  25377. };
  25378. const handleItemClick = async (name) => {
  25379. const { beforeCollapse } = props;
  25380. if (!beforeCollapse) {
  25381. handleChange(name);
  25382. return;
  25383. }
  25384. const shouldChange = beforeCollapse(name);
  25385. if (![isPromise(shouldChange), isBoolean(shouldChange)].includes(true)) throwError(SCOPE$4, "beforeCollapse must return type `Promise<boolean>` or `boolean`");
  25386. if (isPromise(shouldChange)) shouldChange.then((result) => {
  25387. if (result !== false) handleChange(name);
  25388. }).catch((e) => {
  25389. /* @__PURE__ */ debugWarn(SCOPE$4, `some error occurred: ${e}`);
  25390. });
  25391. else if (shouldChange) handleChange(name);
  25392. };
  25393. watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  25394. provide(collapseContextKey, {
  25395. activeNames,
  25396. handleItemClick
  25397. });
  25398. return {
  25399. activeNames,
  25400. setActiveNames
  25401. };
  25402. };
  25403. const useCollapseDOM = (props) => {
  25404. const ns = useNamespace("collapse");
  25405. return { rootKls: computed(() => [ns.b(), ns.b(`icon-position-${props.expandIconPosition}`)]) };
  25406. };
  25407. //#endregion
  25408. //#region ../../packages/components/collapse/src/collapse.vue?vue&type=script&setup=true&lang.ts
  25409. var collapse_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25410. name: "ElCollapse",
  25411. __name: "collapse",
  25412. props: collapseProps,
  25413. emits: collapseEmits,
  25414. setup(__props, { expose: __expose, emit: __emit }) {
  25415. const props = __props;
  25416. const { activeNames, setActiveNames } = useCollapse(props, __emit);
  25417. const { rootKls } = useCollapseDOM(props);
  25418. __expose({
  25419. activeNames,
  25420. setActiveNames
  25421. });
  25422. return (_ctx, _cache) => {
  25423. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(rootKls)) }, [renderSlot(_ctx.$slots, "default")], 2);
  25424. };
  25425. }
  25426. });
  25427. //#endregion
  25428. //#region ../../packages/components/collapse/src/collapse.vue
  25429. var collapse_default = collapse_vue_vue_type_script_setup_true_lang_default;
  25430. //#endregion
  25431. //#region ../../packages/components/collapse/src/collapse-item.ts
  25432. /**
  25433. * @deprecated Removed after 3.0.0, Use `CollapseItemProps` instead.
  25434. */
  25435. const collapseItemProps = buildProps({
  25436. title: {
  25437. type: String,
  25438. default: ""
  25439. },
  25440. name: {
  25441. type: definePropType([String, Number]),
  25442. default: void 0
  25443. },
  25444. icon: {
  25445. type: iconPropType,
  25446. default: arrow_right_default
  25447. },
  25448. disabled: Boolean
  25449. });
  25450. //#endregion
  25451. //#region ../../packages/components/collapse-transition/src/collapse-transition.vue?vue&type=script&setup=true&lang.ts
  25452. var collapse_transition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25453. name: "ElCollapseTransition",
  25454. __name: "collapse-transition",
  25455. setup(__props) {
  25456. const ns = useNamespace("collapse-transition");
  25457. const reset = (el) => {
  25458. el.style.maxHeight = "";
  25459. el.style.overflow = el.dataset.oldOverflow;
  25460. el.style.paddingTop = el.dataset.oldPaddingTop;
  25461. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  25462. };
  25463. const on = {
  25464. beforeEnter(el) {
  25465. if (!el.dataset) el.dataset = {};
  25466. el.dataset.oldPaddingTop = el.style.paddingTop;
  25467. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  25468. if (el.style.height) el.dataset.elExistsHeight = el.style.height;
  25469. el.style.maxHeight = 0;
  25470. el.style.paddingTop = 0;
  25471. el.style.paddingBottom = 0;
  25472. },
  25473. enter(el) {
  25474. requestAnimationFrame(() => {
  25475. el.dataset.oldOverflow = el.style.overflow;
  25476. if (el.dataset.elExistsHeight) el.style.maxHeight = el.dataset.elExistsHeight;
  25477. else if (el.scrollHeight !== 0) el.style.maxHeight = `${el.scrollHeight}px`;
  25478. else el.style.maxHeight = 0;
  25479. el.style.paddingTop = el.dataset.oldPaddingTop;
  25480. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  25481. el.style.overflow = "hidden";
  25482. });
  25483. },
  25484. afterEnter(el) {
  25485. el.style.maxHeight = "";
  25486. el.style.overflow = el.dataset.oldOverflow;
  25487. },
  25488. enterCancelled(el) {
  25489. reset(el);
  25490. },
  25491. beforeLeave(el) {
  25492. if (!el.dataset) el.dataset = {};
  25493. el.dataset.oldPaddingTop = el.style.paddingTop;
  25494. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  25495. el.dataset.oldOverflow = el.style.overflow;
  25496. el.style.maxHeight = `${el.scrollHeight}px`;
  25497. el.style.overflow = "hidden";
  25498. },
  25499. leave(el) {
  25500. if (el.scrollHeight !== 0) {
  25501. el.style.maxHeight = 0;
  25502. el.style.paddingTop = 0;
  25503. el.style.paddingBottom = 0;
  25504. }
  25505. },
  25506. afterLeave(el) {
  25507. reset(el);
  25508. },
  25509. leaveCancelled(el) {
  25510. reset(el);
  25511. }
  25512. };
  25513. return (_ctx, _cache) => {
  25514. return openBlock(), createBlock(Transition, mergeProps({ name: unref(ns).b() }, toHandlers(on)), {
  25515. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  25516. _: 3
  25517. }, 16, ["name"]);
  25518. };
  25519. }
  25520. });
  25521. //#endregion
  25522. //#region ../../packages/components/collapse-transition/src/collapse-transition.vue
  25523. var collapse_transition_default = collapse_transition_vue_vue_type_script_setup_true_lang_default;
  25524. //#endregion
  25525. //#region ../../packages/components/collapse-transition/index.ts
  25526. const ElCollapseTransition = withInstall(collapse_transition_default);
  25527. //#endregion
  25528. //#region ../../packages/components/collapse/src/use-collapse-item.ts
  25529. const useCollapseItem = (props) => {
  25530. const collapse = inject(collapseContextKey);
  25531. const { namespace } = useNamespace("collapse");
  25532. const focusing = ref(false);
  25533. const isClick = ref(false);
  25534. const idInjection = useIdInjection();
  25535. const id = computed(() => idInjection.current++);
  25536. const name = computed(() => {
  25537. return props.name ?? `${namespace.value}-id-${idInjection.prefix}-${unref(id)}`;
  25538. });
  25539. const isActive = computed(() => collapse?.activeNames.value.includes(unref(name)));
  25540. const handleFocus = () => {
  25541. setTimeout(() => {
  25542. if (!isClick.value) focusing.value = true;
  25543. else isClick.value = false;
  25544. }, 50);
  25545. };
  25546. const handleHeaderClick = (e) => {
  25547. if (props.disabled) return;
  25548. if (e.target?.closest("input, textarea, select")) return;
  25549. collapse?.handleItemClick(unref(name));
  25550. focusing.value = false;
  25551. isClick.value = true;
  25552. };
  25553. const handleEnterClick = (e) => {
  25554. if (e.target?.closest("input, textarea, select")) return;
  25555. e.preventDefault();
  25556. collapse?.handleItemClick(unref(name));
  25557. };
  25558. return {
  25559. focusing,
  25560. id,
  25561. isActive,
  25562. handleFocus,
  25563. handleHeaderClick,
  25564. handleEnterClick
  25565. };
  25566. };
  25567. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  25568. const ns = useNamespace("collapse");
  25569. const rootKls = computed(() => [
  25570. ns.b("item"),
  25571. ns.is("active", unref(isActive)),
  25572. ns.is("disabled", props.disabled)
  25573. ]);
  25574. const headKls = computed(() => [
  25575. ns.be("item", "header"),
  25576. ns.is("active", unref(isActive)),
  25577. { focusing: unref(focusing) && !props.disabled }
  25578. ]);
  25579. const arrowKls = computed(() => [ns.be("item", "arrow"), ns.is("active", unref(isActive))]);
  25580. return {
  25581. itemTitleKls: computed(() => [ns.be("item", "title")]),
  25582. arrowKls,
  25583. headKls,
  25584. rootKls,
  25585. itemWrapperKls: computed(() => ns.be("item", "wrap")),
  25586. itemContentKls: computed(() => ns.be("item", "content")),
  25587. scopedContentId: computed(() => ns.b(`content-${unref(id)}`)),
  25588. scopedHeadId: computed(() => ns.b(`head-${unref(id)}`))
  25589. };
  25590. };
  25591. //#endregion
  25592. //#region ../../packages/components/collapse/src/collapse-item.vue?vue&type=script&setup=true&lang.ts
  25593. const _hoisted_1$56 = [
  25594. "id",
  25595. "aria-expanded",
  25596. "aria-controls",
  25597. "aria-describedby",
  25598. "tabindex",
  25599. "aria-disabled"
  25600. ];
  25601. const _hoisted_2$33 = [
  25602. "id",
  25603. "aria-hidden",
  25604. "aria-labelledby"
  25605. ];
  25606. var collapse_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25607. name: "ElCollapseItem",
  25608. __name: "collapse-item",
  25609. props: collapseItemProps,
  25610. setup(__props, { expose: __expose }) {
  25611. const props = __props;
  25612. const { focusing, id, isActive, handleFocus, handleHeaderClick, handleEnterClick } = useCollapseItem(props);
  25613. const { arrowKls, headKls, rootKls, itemTitleKls, itemWrapperKls, itemContentKls, scopedContentId, scopedHeadId } = useCollapseItemDOM(props, {
  25614. focusing,
  25615. isActive,
  25616. id
  25617. });
  25618. __expose({ isActive });
  25619. return (_ctx, _cache) => {
  25620. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(rootKls)) }, [createElementVNode("div", {
  25621. id: unref(scopedHeadId),
  25622. class: normalizeClass(unref(headKls)),
  25623. "aria-expanded": unref(isActive),
  25624. "aria-controls": unref(scopedContentId),
  25625. "aria-describedby": unref(scopedContentId),
  25626. tabindex: __props.disabled ? void 0 : 0,
  25627. "aria-disabled": __props.disabled,
  25628. role: "button",
  25629. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleHeaderClick) && unref(handleHeaderClick)(...args)),
  25630. onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers((...args) => unref(handleEnterClick) && unref(handleEnterClick)(...args), ["stop"]), ["space", "enter"])),
  25631. onFocus: _cache[2] || (_cache[2] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  25632. onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
  25633. }, [createElementVNode("span", { class: normalizeClass(unref(itemTitleKls)) }, [renderSlot(_ctx.$slots, "title", { isActive: unref(isActive) }, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2), renderSlot(_ctx.$slots, "icon", { isActive: unref(isActive) }, () => [createVNode(unref(ElIcon), { class: normalizeClass(unref(arrowKls)) }, {
  25634. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  25635. _: 1
  25636. }, 8, ["class"])])], 42, _hoisted_1$56), createVNode(unref(ElCollapseTransition), null, {
  25637. default: withCtx(() => [withDirectives(createElementVNode("div", {
  25638. id: unref(scopedContentId),
  25639. role: "region",
  25640. class: normalizeClass(unref(itemWrapperKls)),
  25641. "aria-hidden": !unref(isActive),
  25642. "aria-labelledby": unref(scopedHeadId)
  25643. }, [createElementVNode("div", { class: normalizeClass(unref(itemContentKls)) }, [renderSlot(_ctx.$slots, "default")], 2)], 10, _hoisted_2$33), [[vShow, unref(isActive)]])]),
  25644. _: 3
  25645. })], 2);
  25646. };
  25647. }
  25648. });
  25649. //#endregion
  25650. //#region ../../packages/components/collapse/src/collapse-item.vue
  25651. var collapse_item_default = collapse_item_vue_vue_type_script_setup_true_lang_default;
  25652. //#endregion
  25653. //#region ../../packages/components/collapse/index.ts
  25654. const ElCollapse = withInstall(collapse_default, { CollapseItem: collapse_item_default });
  25655. const ElCollapseItem = withNoopInstall(collapse_item_default);
  25656. //#endregion
  25657. //#region ../../packages/components/color-picker-panel/src/color-picker-panel.ts
  25658. /**
  25659. * @deprecated Removed after 3.0.0, Use `ColorPickerPanelProps` instead.
  25660. */
  25661. const colorPickerPanelProps = buildProps({
  25662. modelValue: {
  25663. type: definePropType(String),
  25664. default: void 0
  25665. },
  25666. border: {
  25667. type: Boolean,
  25668. default: true
  25669. },
  25670. showAlpha: Boolean,
  25671. colorFormat: { type: definePropType(String) },
  25672. disabled: Boolean,
  25673. predefine: { type: definePropType(Array) },
  25674. validateEvent: {
  25675. type: Boolean,
  25676. default: true
  25677. },
  25678. hueSliderClass: { type: definePropType([
  25679. String,
  25680. Array,
  25681. Object
  25682. ]) },
  25683. hueSliderStyle: { type: definePropType([
  25684. String,
  25685. Array,
  25686. Object
  25687. ]) }
  25688. });
  25689. const colorPickerPanelEmits = { [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val) };
  25690. const ROOT_COMMON_COLOR_INJECTION_KEY = Symbol("colorCommonPickerKey");
  25691. const colorPickerPanelContextKey = Symbol("colorPickerPanelContextKey");
  25692. //#endregion
  25693. //#region ../../packages/components/color-picker-panel/src/props/slider.ts
  25694. /**
  25695. * @deprecated Removed after 3.0.0, Use `AlphaSliderProps` instead.
  25696. */
  25697. const alphaSliderProps = buildProps({
  25698. color: {
  25699. type: definePropType(Object),
  25700. required: true
  25701. },
  25702. vertical: Boolean,
  25703. disabled: Boolean
  25704. });
  25705. /**
  25706. * @deprecated Removed after 3.0.0, Use `HueSliderProps` instead.
  25707. */
  25708. const hueSliderProps = alphaSliderProps;
  25709. //#endregion
  25710. //#region ../../packages/components/color-picker-panel/src/utils/draggable.ts
  25711. let isDragging = false;
  25712. function draggable(element, options) {
  25713. if (!isClient) return;
  25714. const moveFn = function(event) {
  25715. options.drag?.(event);
  25716. };
  25717. const upFn = function(event) {
  25718. document.removeEventListener("mousemove", moveFn);
  25719. document.removeEventListener("mouseup", upFn);
  25720. document.removeEventListener("touchmove", moveFn);
  25721. document.removeEventListener("touchend", upFn);
  25722. document.onselectstart = null;
  25723. document.ondragstart = null;
  25724. isDragging = false;
  25725. options.end?.(event);
  25726. };
  25727. const downFn = function(event) {
  25728. if (isDragging) return;
  25729. document.onselectstart = () => false;
  25730. document.ondragstart = () => false;
  25731. document.addEventListener("mousemove", moveFn);
  25732. document.addEventListener("mouseup", upFn);
  25733. document.addEventListener("touchmove", moveFn);
  25734. document.addEventListener("touchend", upFn);
  25735. isDragging = true;
  25736. options.start?.(event);
  25737. };
  25738. element.addEventListener("mousedown", downFn);
  25739. element.addEventListener("touchstart", downFn, { passive: false });
  25740. }
  25741. //#endregion
  25742. //#region ../../packages/components/color-picker-panel/src/composables/use-slider.ts
  25743. const useSlider = (props, { key, minValue, maxValue }) => {
  25744. const instance = getCurrentInstance();
  25745. const thumb = shallowRef();
  25746. const bar = shallowRef();
  25747. const currentValue = computed(() => props.color.get(key));
  25748. function handleClick(event) {
  25749. if (props.disabled) return;
  25750. if (event.target !== thumb.value) handleDrag(event);
  25751. thumb.value?.focus();
  25752. }
  25753. function handleDrag(event) {
  25754. if (!bar.value || !thumb.value || props.disabled) return;
  25755. const rect = instance.vnode.el.getBoundingClientRect();
  25756. const { clientX, clientY } = getClientXY(event);
  25757. let value;
  25758. if (!props.vertical) {
  25759. let left = clientX - rect.left;
  25760. left = Math.max(thumb.value.offsetWidth / 2, left);
  25761. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  25762. value = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * maxValue);
  25763. } else {
  25764. let top = clientY - rect.top;
  25765. top = Math.max(thumb.value.offsetHeight / 2, top);
  25766. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  25767. value = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * maxValue);
  25768. }
  25769. props.color.set(key, value);
  25770. }
  25771. function handleKeydown(event) {
  25772. if (props.disabled) return;
  25773. const { shiftKey } = event;
  25774. const code = getEventCode(event);
  25775. const step = shiftKey ? 10 : 1;
  25776. const reverse = key === "hue" ? -1 : 1;
  25777. let isPreventDefault = true;
  25778. switch (code) {
  25779. case EVENT_CODE.left:
  25780. case EVENT_CODE.down:
  25781. incrementPosition(-step * reverse);
  25782. break;
  25783. case EVENT_CODE.right:
  25784. case EVENT_CODE.up:
  25785. incrementPosition(step * reverse);
  25786. break;
  25787. case EVENT_CODE.home:
  25788. props.color.set(key, key === "hue" ? maxValue : minValue);
  25789. break;
  25790. case EVENT_CODE.end:
  25791. props.color.set(key, key === "hue" ? minValue : maxValue);
  25792. break;
  25793. case EVENT_CODE.pageDown:
  25794. incrementPosition(-4 * reverse);
  25795. break;
  25796. case EVENT_CODE.pageUp:
  25797. incrementPosition(4 * reverse);
  25798. break;
  25799. default:
  25800. isPreventDefault = false;
  25801. break;
  25802. }
  25803. isPreventDefault && event.preventDefault();
  25804. }
  25805. function incrementPosition(step) {
  25806. let next = currentValue.value + step;
  25807. next = next < minValue ? minValue : next > maxValue ? maxValue : next;
  25808. props.color.set(key, next);
  25809. }
  25810. return {
  25811. thumb,
  25812. bar,
  25813. currentValue,
  25814. handleDrag,
  25815. handleClick,
  25816. handleKeydown
  25817. };
  25818. };
  25819. const useSliderDOM = (props, { namespace, maxValue, bar, thumb, currentValue, handleDrag, getBackground }) => {
  25820. const instance = getCurrentInstance();
  25821. const ns = useNamespace(namespace);
  25822. const thumbLeft = ref(0);
  25823. const thumbTop = ref(0);
  25824. const background = ref();
  25825. function getThumbLeft() {
  25826. if (!thumb.value) return 0;
  25827. if (props.vertical) return 0;
  25828. const el = instance.vnode.el;
  25829. const value = currentValue.value;
  25830. if (!el) return 0;
  25831. return Math.round(value * (el.offsetWidth - thumb.value.offsetWidth / 2) / maxValue);
  25832. }
  25833. function getThumbTop() {
  25834. if (!thumb.value) return 0;
  25835. const el = instance.vnode.el;
  25836. if (!props.vertical) return 0;
  25837. const value = currentValue.value;
  25838. if (!el) return 0;
  25839. return Math.round(value * (el.offsetHeight - thumb.value.offsetHeight / 2) / maxValue);
  25840. }
  25841. function update() {
  25842. thumbLeft.value = getThumbLeft();
  25843. thumbTop.value = getThumbTop();
  25844. background.value = getBackground?.();
  25845. }
  25846. onMounted(() => {
  25847. if (!bar.value || !thumb.value) return;
  25848. const dragConfig = {
  25849. drag: (event) => {
  25850. handleDrag(event);
  25851. },
  25852. end: (event) => {
  25853. handleDrag(event);
  25854. }
  25855. };
  25856. draggable(bar.value, dragConfig);
  25857. draggable(thumb.value, dragConfig);
  25858. update();
  25859. });
  25860. watch(currentValue, () => update());
  25861. watch(() => props.color.value, () => update());
  25862. const rootKls = computed(() => [
  25863. ns.b(),
  25864. ns.is("vertical", props.vertical),
  25865. ns.is("disabled", props.disabled)
  25866. ]);
  25867. const barKls = computed(() => ns.e("bar"));
  25868. const thumbKls = computed(() => ns.e("thumb"));
  25869. return {
  25870. rootKls,
  25871. barKls,
  25872. barStyle: computed(() => ({ background: background.value })),
  25873. thumbKls,
  25874. thumbStyle: computed(() => ({
  25875. left: addUnit(thumbLeft.value),
  25876. top: addUnit(thumbTop.value)
  25877. })),
  25878. thumbLeft,
  25879. thumbTop,
  25880. update
  25881. };
  25882. };
  25883. //#endregion
  25884. //#region ../../packages/components/color-picker-panel/src/components/alpha-slider.vue?vue&type=script&setup=true&lang.ts
  25885. const _hoisted_1$55 = [
  25886. "aria-label",
  25887. "aria-valuenow",
  25888. "aria-valuetext",
  25889. "aria-orientation",
  25890. "tabindex",
  25891. "aria-disabled"
  25892. ];
  25893. const minValue$1 = 0;
  25894. const maxValue$1 = 100;
  25895. var alpha_slider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25896. name: "ElColorAlphaSlider",
  25897. __name: "alpha-slider",
  25898. props: alphaSliderProps,
  25899. setup(__props, { expose: __expose }) {
  25900. const props = __props;
  25901. const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, {
  25902. key: "alpha",
  25903. minValue: minValue$1,
  25904. maxValue: maxValue$1
  25905. });
  25906. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useSliderDOM(props, {
  25907. namespace: "color-alpha-slider",
  25908. maxValue: maxValue$1,
  25909. currentValue,
  25910. bar,
  25911. thumb,
  25912. handleDrag,
  25913. getBackground
  25914. });
  25915. const { t } = useLocale();
  25916. const ariaLabel = computed(() => t("el.colorpicker.alphaLabel"));
  25917. const ariaValuetext = computed(() => {
  25918. return t("el.colorpicker.alphaDescription", {
  25919. alpha: currentValue.value,
  25920. color: props.color.value
  25921. });
  25922. });
  25923. function getBackground() {
  25924. if (props.color && props.color.value) {
  25925. const { r, g, b } = props.color.toRgb();
  25926. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  25927. }
  25928. return "";
  25929. }
  25930. __expose({
  25931. update,
  25932. bar,
  25933. thumb
  25934. });
  25935. return (_ctx, _cache) => {
  25936. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(rootKls)) }, [createElementVNode("div", {
  25937. ref_key: "bar",
  25938. ref: bar,
  25939. class: normalizeClass(unref(barKls)),
  25940. style: normalizeStyle(unref(barStyle)),
  25941. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
  25942. }, null, 6), createElementVNode("div", {
  25943. ref_key: "thumb",
  25944. ref: thumb,
  25945. class: normalizeClass(unref(thumbKls)),
  25946. style: normalizeStyle(unref(thumbStyle)),
  25947. "aria-label": ariaLabel.value,
  25948. "aria-valuenow": unref(currentValue),
  25949. "aria-valuetext": ariaValuetext.value,
  25950. "aria-orientation": __props.vertical ? "vertical" : "horizontal",
  25951. "aria-valuemin": minValue$1,
  25952. "aria-valuemax": maxValue$1,
  25953. role: "slider",
  25954. tabindex: __props.disabled ? void 0 : 0,
  25955. "aria-disabled": __props.disabled,
  25956. onKeydown: _cache[1] || (_cache[1] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
  25957. }, null, 46, _hoisted_1$55)], 2);
  25958. };
  25959. }
  25960. });
  25961. //#endregion
  25962. //#region ../../packages/components/color-picker-panel/src/components/alpha-slider.vue
  25963. var alpha_slider_default = alpha_slider_vue_vue_type_script_setup_true_lang_default;
  25964. //#endregion
  25965. //#region ../../packages/components/color-picker-panel/src/components/hue-slider.vue?vue&type=script&setup=true&lang.ts
  25966. const _hoisted_1$54 = [
  25967. "aria-label",
  25968. "aria-valuenow",
  25969. "aria-valuetext",
  25970. "aria-orientation",
  25971. "tabindex",
  25972. "aria-disabled"
  25973. ];
  25974. const minValue = 0;
  25975. const maxValue = 360;
  25976. var hue_slider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25977. name: "ElColorHueSlider",
  25978. __name: "hue-slider",
  25979. props: hueSliderProps,
  25980. setup(__props, { expose: __expose }) {
  25981. const props = __props;
  25982. const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, {
  25983. key: "hue",
  25984. minValue,
  25985. maxValue
  25986. });
  25987. const { rootKls, barKls, thumbKls, thumbStyle, thumbTop, update } = useSliderDOM(props, {
  25988. namespace: "color-hue-slider",
  25989. maxValue,
  25990. currentValue,
  25991. bar,
  25992. thumb,
  25993. handleDrag
  25994. });
  25995. const { t } = useLocale();
  25996. const ariaLabel = computed(() => t("el.colorpicker.hueLabel"));
  25997. const ariaValuetext = computed(() => {
  25998. return t("el.colorpicker.hueDescription", {
  25999. hue: currentValue.value,
  26000. color: props.color.value
  26001. });
  26002. });
  26003. __expose({
  26004. bar,
  26005. thumb,
  26006. thumbTop,
  26007. update
  26008. });
  26009. return (_ctx, _cache) => {
  26010. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(rootKls)) }, [createElementVNode("div", {
  26011. ref_key: "bar",
  26012. ref: bar,
  26013. class: normalizeClass(unref(barKls)),
  26014. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
  26015. }, null, 2), createElementVNode("div", {
  26016. ref_key: "thumb",
  26017. ref: thumb,
  26018. class: normalizeClass(unref(thumbKls)),
  26019. style: normalizeStyle(unref(thumbStyle)),
  26020. "aria-label": ariaLabel.value,
  26021. "aria-valuenow": unref(currentValue),
  26022. "aria-valuetext": ariaValuetext.value,
  26023. "aria-orientation": __props.vertical ? "vertical" : "horizontal",
  26024. "aria-valuemin": minValue,
  26025. "aria-valuemax": maxValue,
  26026. role: "slider",
  26027. tabindex: __props.disabled ? void 0 : 0,
  26028. "aria-disabled": __props.disabled,
  26029. onKeydown: _cache[1] || (_cache[1] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
  26030. }, null, 46, _hoisted_1$54)], 2);
  26031. };
  26032. }
  26033. });
  26034. //#endregion
  26035. //#region ../../packages/components/color-picker-panel/src/components/hue-slider.vue
  26036. var hue_slider_default = hue_slider_vue_vue_type_script_setup_true_lang_default;
  26037. //#endregion
  26038. //#region ../../packages/components/color-picker-panel/src/props/predefine.ts
  26039. /**
  26040. * @deprecated Removed after 3.0.0, Use `PredefineProps` instead.
  26041. */
  26042. const predefineProps = buildProps({
  26043. colors: {
  26044. type: definePropType(Array),
  26045. required: true
  26046. },
  26047. color: {
  26048. type: definePropType(Object),
  26049. required: true
  26050. },
  26051. enableAlpha: {
  26052. type: Boolean,
  26053. required: true
  26054. },
  26055. disabled: Boolean
  26056. });
  26057. //#endregion
  26058. //#region ../../packages/components/color-picker-panel/src/utils/color.ts
  26059. var Color = class {
  26060. constructor(options = {}) {
  26061. this._hue = 0;
  26062. this._saturation = 100;
  26063. this._value = 100;
  26064. this._alpha = 100;
  26065. this._tiny = new TinyColor();
  26066. this._isValid = false;
  26067. this.enableAlpha = false;
  26068. this.format = "";
  26069. this.value = "";
  26070. for (const option in options) if (hasOwn(options, option)) this[option] = options[option];
  26071. if (options.value) this.fromString(options.value);
  26072. else this.doOnChange();
  26073. }
  26074. set(prop, value) {
  26075. if (arguments.length === 1 && typeof prop === "object") {
  26076. for (const p in prop) if (hasOwn(prop, p)) this.set(p, prop[p]);
  26077. return;
  26078. }
  26079. this[`_${prop}`] = value;
  26080. this._isValid = true;
  26081. this.doOnChange();
  26082. }
  26083. get(prop) {
  26084. if ([
  26085. "hue",
  26086. "saturation",
  26087. "value",
  26088. "alpha"
  26089. ].includes(prop)) return Math.round(this[`_${prop}`]);
  26090. return this[`_${prop}`];
  26091. }
  26092. toRgb() {
  26093. return this._isValid ? this._tiny.toRgb() : {
  26094. r: 255,
  26095. g: 255,
  26096. b: 255,
  26097. a: 0
  26098. };
  26099. }
  26100. fromString(value) {
  26101. const color = new TinyColor(value);
  26102. this._isValid = color.isValid;
  26103. if (color.isValid) {
  26104. const { h, s, v, a } = color.toHsv();
  26105. this._hue = h;
  26106. this._saturation = s * 100;
  26107. this._value = v * 100;
  26108. this._alpha = a * 100;
  26109. } else {
  26110. this._hue = 0;
  26111. this._saturation = 100;
  26112. this._value = 100;
  26113. this._alpha = 100;
  26114. }
  26115. this.doOnChange();
  26116. }
  26117. clear() {
  26118. this._isValid = false;
  26119. this.value = "";
  26120. this._hue = 0;
  26121. this._saturation = 100;
  26122. this._value = 100;
  26123. this._alpha = 100;
  26124. }
  26125. compare(color) {
  26126. const compareColor = new TinyColor({
  26127. h: color._hue,
  26128. s: color._saturation / 100,
  26129. v: color._value / 100,
  26130. a: color._alpha / 100
  26131. });
  26132. return this._tiny.equals(compareColor);
  26133. }
  26134. doOnChange() {
  26135. const { _hue, _saturation, _value, _alpha, format, enableAlpha } = this;
  26136. let _format = format || (enableAlpha ? "rgb" : "hex");
  26137. if (format === "hex" && enableAlpha) _format = "hex8";
  26138. this._tiny = new TinyColor({
  26139. h: _hue,
  26140. s: _saturation / 100,
  26141. v: _value / 100,
  26142. a: _alpha / 100
  26143. });
  26144. this.value = this._isValid ? this._tiny.toString(_format) : "";
  26145. }
  26146. };
  26147. //#endregion
  26148. //#region ../../packages/components/color-picker-panel/src/composables/use-predefine.ts
  26149. const usePredefine = (props) => {
  26150. const { currentColor } = inject(colorPickerPanelContextKey);
  26151. const rgbaColors = ref(parseColors(props.colors, props.color));
  26152. watch(() => currentColor.value, (val) => {
  26153. const color = new Color({
  26154. value: val,
  26155. enableAlpha: props.enableAlpha
  26156. });
  26157. rgbaColors.value.forEach((item) => {
  26158. item.selected = color.compare(item);
  26159. });
  26160. });
  26161. watchEffect(() => {
  26162. rgbaColors.value = parseColors(props.colors, props.color);
  26163. });
  26164. function handleSelect(index) {
  26165. props.color.fromString(props.colors[index]);
  26166. }
  26167. function parseColors(colors, color) {
  26168. return colors.map((value) => {
  26169. const c = new Color({
  26170. value,
  26171. enableAlpha: props.enableAlpha
  26172. });
  26173. c.selected = c.compare(color);
  26174. return c;
  26175. });
  26176. }
  26177. return {
  26178. rgbaColors,
  26179. handleSelect
  26180. };
  26181. };
  26182. const usePredefineDOM = (props) => {
  26183. const ns = useNamespace("color-predefine");
  26184. const rootKls = computed(() => [ns.b(), ns.is("disabled", props.disabled)]);
  26185. const colorsKls = computed(() => ns.e("colors"));
  26186. function colorSelectorKls(item) {
  26187. return [
  26188. ns.e("color-selector"),
  26189. ns.is("alpha", item.get("alpha") < 100),
  26190. { selected: item.selected }
  26191. ];
  26192. }
  26193. return {
  26194. rootKls,
  26195. colorsKls,
  26196. colorSelectorKls
  26197. };
  26198. };
  26199. //#endregion
  26200. //#region ../../packages/components/color-picker-panel/src/components/predefine.vue?vue&type=script&setup=true&lang.ts
  26201. const _hoisted_1$53 = [
  26202. "disabled",
  26203. "aria-label",
  26204. "onClick"
  26205. ];
  26206. var predefine_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  26207. name: "ElColorPredefine",
  26208. __name: "predefine",
  26209. props: predefineProps,
  26210. setup(__props) {
  26211. const props = __props;
  26212. const { rgbaColors, handleSelect } = usePredefine(props);
  26213. const { rootKls, colorsKls, colorSelectorKls } = usePredefineDOM(props);
  26214. const { t } = useLocale();
  26215. const ariaLabel = (value) => {
  26216. return t("el.colorpicker.predefineDescription", { value });
  26217. };
  26218. return (_ctx, _cache) => {
  26219. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(rootKls)) }, [createElementVNode("div", { class: normalizeClass(unref(colorsKls)) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rgbaColors), (item, index) => {
  26220. return openBlock(), createElementBlock("button", {
  26221. key: __props.colors[index],
  26222. type: "button",
  26223. disabled: __props.disabled,
  26224. "aria-label": ariaLabel(item.value),
  26225. class: normalizeClass(unref(colorSelectorKls)(item)),
  26226. onClick: ($event) => unref(handleSelect)(index)
  26227. }, [createElementVNode("div", { style: normalizeStyle({ backgroundColor: item.value }) }, null, 4)], 10, _hoisted_1$53);
  26228. }), 128))], 2)], 2);
  26229. };
  26230. }
  26231. });
  26232. //#endregion
  26233. //#region ../../packages/components/color-picker-panel/src/components/predefine.vue
  26234. var predefine_default = predefine_vue_vue_type_script_setup_true_lang_default;
  26235. //#endregion
  26236. //#region ../../packages/components/color-picker-panel/src/props/sv-panel.ts
  26237. /**
  26238. * @deprecated Removed after 3.0.0, Use `SvPanelProps` instead.
  26239. */
  26240. const svPanelProps = buildProps({
  26241. color: {
  26242. type: definePropType(Object),
  26243. required: true
  26244. },
  26245. disabled: Boolean
  26246. });
  26247. //#endregion
  26248. //#region ../../packages/components/color-picker-panel/src/composables/use-sv-panel.ts
  26249. const useSvPanel = (props) => {
  26250. const instance = getCurrentInstance();
  26251. const cursorRef = ref();
  26252. const cursorTop = ref(0);
  26253. const cursorLeft = ref(0);
  26254. const background = ref("hsl(0, 100%, 50%)");
  26255. const saturation = computed(() => props.color.get("saturation"));
  26256. const brightness = computed(() => props.color.get("value"));
  26257. const hue = computed(() => props.color.get("hue"));
  26258. function handleClick(event) {
  26259. if (props.disabled) return;
  26260. if (event.target !== cursorRef.value) handleDrag(event);
  26261. cursorRef.value?.focus({ preventScroll: true });
  26262. }
  26263. function handleDrag(event) {
  26264. if (props.disabled) return;
  26265. const rect = instance.vnode.el.getBoundingClientRect();
  26266. const { clientX, clientY } = getClientXY(event);
  26267. let left = clientX - rect.left;
  26268. let top = clientY - rect.top;
  26269. left = Math.max(0, left);
  26270. left = Math.min(left, rect.width);
  26271. top = Math.max(0, top);
  26272. top = Math.min(top, rect.height);
  26273. cursorLeft.value = left;
  26274. cursorTop.value = top;
  26275. props.color.set({
  26276. saturation: left / rect.width * 100,
  26277. value: 100 - top / rect.height * 100
  26278. });
  26279. }
  26280. function handleKeydown(event) {
  26281. if (props.disabled) return;
  26282. const { shiftKey } = event;
  26283. const code = getEventCode(event);
  26284. const step = shiftKey ? 10 : 1;
  26285. let isPreventDefault = true;
  26286. switch (code) {
  26287. case EVENT_CODE.left:
  26288. incrementSaturation(-step);
  26289. break;
  26290. case EVENT_CODE.right:
  26291. incrementSaturation(step);
  26292. break;
  26293. case EVENT_CODE.up:
  26294. incrementBrightness(step);
  26295. break;
  26296. case EVENT_CODE.down:
  26297. incrementBrightness(-step);
  26298. break;
  26299. default:
  26300. isPreventDefault = false;
  26301. break;
  26302. }
  26303. isPreventDefault && event.preventDefault();
  26304. }
  26305. function incrementSaturation(step) {
  26306. let next = saturation.value + step;
  26307. next = next < 0 ? 0 : next > 100 ? 100 : next;
  26308. props.color.set("saturation", next);
  26309. }
  26310. function incrementBrightness(step) {
  26311. let next = brightness.value + step;
  26312. next = next < 0 ? 0 : next > 100 ? 100 : next;
  26313. props.color.set("value", next);
  26314. }
  26315. return {
  26316. cursorRef,
  26317. cursorTop,
  26318. cursorLeft,
  26319. background,
  26320. saturation,
  26321. brightness,
  26322. hue,
  26323. handleClick,
  26324. handleDrag,
  26325. handleKeydown
  26326. };
  26327. };
  26328. const useSvPanelDOM = (props, { cursorTop, cursorLeft, background, handleDrag }) => {
  26329. const instance = getCurrentInstance();
  26330. const ns = useNamespace("color-svpanel");
  26331. function update() {
  26332. const saturation = props.color.get("saturation");
  26333. const brightness = props.color.get("value");
  26334. const { clientWidth: width, clientHeight: height } = instance.vnode.el;
  26335. cursorLeft.value = saturation * width / 100;
  26336. cursorTop.value = (100 - brightness) * height / 100;
  26337. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  26338. }
  26339. onMounted(() => {
  26340. draggable(instance.vnode.el, {
  26341. drag: (event) => {
  26342. handleDrag(event);
  26343. },
  26344. end: (event) => {
  26345. handleDrag(event);
  26346. }
  26347. });
  26348. update();
  26349. });
  26350. watch([
  26351. () => props.color.get("hue"),
  26352. () => props.color.get("value"),
  26353. () => props.color.value
  26354. ], () => update());
  26355. return {
  26356. rootKls: computed(() => ns.b()),
  26357. cursorKls: computed(() => ns.e("cursor")),
  26358. rootStyle: computed(() => ({ backgroundColor: background.value })),
  26359. cursorStyle: computed(() => ({
  26360. top: addUnit(cursorTop.value),
  26361. left: addUnit(cursorLeft.value)
  26362. })),
  26363. update
  26364. };
  26365. };
  26366. //#endregion
  26367. //#region ../../packages/components/color-picker-panel/src/components/sv-panel.vue?vue&type=script&setup=true&lang.ts
  26368. const _hoisted_1$52 = [
  26369. "tabindex",
  26370. "aria-disabled",
  26371. "aria-label",
  26372. "aria-valuenow",
  26373. "aria-valuetext"
  26374. ];
  26375. var sv_panel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  26376. name: "ElSvPanel",
  26377. __name: "sv-panel",
  26378. props: svPanelProps,
  26379. setup(__props, { expose: __expose }) {
  26380. const props = __props;
  26381. const { cursorRef, cursorTop, cursorLeft, background, saturation, brightness, handleClick, handleDrag, handleKeydown } = useSvPanel(props);
  26382. const { rootKls, cursorKls, rootStyle, cursorStyle, update } = useSvPanelDOM(props, {
  26383. cursorTop,
  26384. cursorLeft,
  26385. background,
  26386. handleDrag
  26387. });
  26388. const { t } = useLocale();
  26389. const ariaLabel = computed(() => t("el.colorpicker.svLabel"));
  26390. const ariaValuetext = computed(() => {
  26391. return t("el.colorpicker.svDescription", {
  26392. saturation: saturation.value,
  26393. brightness: brightness.value,
  26394. color: props.color.value
  26395. });
  26396. });
  26397. __expose({ update });
  26398. return (_ctx, _cache) => {
  26399. return openBlock(), createElementBlock("div", {
  26400. class: normalizeClass(unref(rootKls)),
  26401. style: normalizeStyle(unref(rootStyle)),
  26402. onClick: _cache[1] || (_cache[1] = (...args) => unref(handleClick) && unref(handleClick)(...args))
  26403. }, [createElementVNode("div", {
  26404. ref_key: "cursorRef",
  26405. ref: cursorRef,
  26406. class: normalizeClass(unref(cursorKls)),
  26407. style: normalizeStyle(unref(cursorStyle)),
  26408. tabindex: __props.disabled ? void 0 : 0,
  26409. "aria-disabled": __props.disabled,
  26410. role: "slider",
  26411. "aria-valuemin": "0,0",
  26412. "aria-valuemax": "100,100",
  26413. "aria-label": ariaLabel.value,
  26414. "aria-valuenow": `${unref(saturation)},${unref(brightness)}`,
  26415. "aria-valuetext": ariaValuetext.value,
  26416. onKeydown: _cache[0] || (_cache[0] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
  26417. }, null, 46, _hoisted_1$52)], 6);
  26418. };
  26419. }
  26420. });
  26421. //#endregion
  26422. //#region ../../packages/components/color-picker-panel/src/components/sv-panel.vue
  26423. var sv_panel_default = sv_panel_vue_vue_type_script_setup_true_lang_default;
  26424. //#endregion
  26425. //#region ../../packages/components/color-picker-panel/src/composables/use-common-color.ts
  26426. const useCommonColor = (props, emit) => {
  26427. const color = reactive(new Color({
  26428. enableAlpha: props.showAlpha,
  26429. format: props.colorFormat || "",
  26430. value: props.modelValue
  26431. }));
  26432. watch(() => [props.colorFormat, props.showAlpha], () => {
  26433. color.enableAlpha = props.showAlpha;
  26434. color.format = props.colorFormat || color.format;
  26435. color.doOnChange();
  26436. emit(UPDATE_MODEL_EVENT, color.value);
  26437. });
  26438. return { color };
  26439. };
  26440. //#endregion
  26441. //#region ../../packages/components/color-picker-panel/src/color-picker-panel.vue?vue&type=script&setup=true&lang.ts
  26442. var color_picker_panel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  26443. name: "ElColorPickerPanel",
  26444. __name: "color-picker-panel",
  26445. props: colorPickerPanelProps,
  26446. emits: colorPickerPanelEmits,
  26447. setup(__props, { expose: __expose, emit: __emit }) {
  26448. const props = __props;
  26449. const emit = __emit;
  26450. const ns = useNamespace("color-picker-panel");
  26451. const { formItem } = useFormItem();
  26452. const disabled = useFormDisabled();
  26453. const hueRef = ref();
  26454. const svRef = ref();
  26455. const alphaRef = ref();
  26456. const inputRef = ref();
  26457. const customInput = ref("");
  26458. const { color } = inject(ROOT_COMMON_COLOR_INJECTION_KEY, () => useCommonColor(props, emit), true);
  26459. function handleConfirm() {
  26460. color.fromString(customInput.value);
  26461. if (color.value !== customInput.value) customInput.value = color.value;
  26462. }
  26463. function handleFocusout() {
  26464. if (props.validateEvent) formItem?.validate?.("blur").catch((err) => /* @__PURE__ */ debugWarn(err));
  26465. }
  26466. function update() {
  26467. hueRef.value?.update();
  26468. svRef.value?.update();
  26469. alphaRef.value?.update();
  26470. }
  26471. onMounted(() => {
  26472. if (props.modelValue) customInput.value = color.value;
  26473. nextTick(update);
  26474. });
  26475. watch(() => props.modelValue, (newVal) => {
  26476. if (newVal !== color.value) newVal ? color.fromString(newVal) : color.clear();
  26477. });
  26478. watch(() => color.value, (val) => {
  26479. emit(UPDATE_MODEL_EVENT, val);
  26480. customInput.value = val;
  26481. if (props.validateEvent) formItem?.validate("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  26482. });
  26483. provide(colorPickerPanelContextKey, { currentColor: computed(() => color.value) });
  26484. __expose({
  26485. color,
  26486. inputRef,
  26487. update
  26488. });
  26489. return (_ctx, _cache) => {
  26490. return openBlock(), createElementBlock("div", {
  26491. class: normalizeClass([
  26492. unref(ns).b(),
  26493. unref(ns).is("disabled", unref(disabled)),
  26494. unref(ns).is("border", __props.border)
  26495. ]),
  26496. onFocusout: handleFocusout
  26497. }, [
  26498. createElementVNode("div", { class: normalizeClass(unref(ns).e("wrapper")) }, [createVNode(hue_slider_default, {
  26499. ref_key: "hueRef",
  26500. ref: hueRef,
  26501. color: unref(color),
  26502. vertical: "",
  26503. disabled: unref(disabled),
  26504. class: normalizeClass(["hue-slider", __props.hueSliderClass]),
  26505. style: normalizeStyle(__props.hueSliderStyle)
  26506. }, null, 8, [
  26507. "color",
  26508. "disabled",
  26509. "class",
  26510. "style"
  26511. ]), createVNode(sv_panel_default, {
  26512. ref_key: "svRef",
  26513. ref: svRef,
  26514. color: unref(color),
  26515. disabled: unref(disabled)
  26516. }, null, 8, ["color", "disabled"])], 2),
  26517. __props.showAlpha ? (openBlock(), createBlock(alpha_slider_default, {
  26518. key: 0,
  26519. ref_key: "alphaRef",
  26520. ref: alphaRef,
  26521. color: unref(color),
  26522. disabled: unref(disabled)
  26523. }, null, 8, ["color", "disabled"])) : createCommentVNode("v-if", true),
  26524. __props.predefine ? (openBlock(), createBlock(predefine_default, {
  26525. key: 1,
  26526. ref: "predefine",
  26527. "enable-alpha": __props.showAlpha,
  26528. color: unref(color),
  26529. colors: __props.predefine,
  26530. disabled: unref(disabled)
  26531. }, null, 8, [
  26532. "enable-alpha",
  26533. "color",
  26534. "colors",
  26535. "disabled"
  26536. ])) : createCommentVNode("v-if", true),
  26537. createElementVNode("div", { class: normalizeClass(unref(ns).e("footer")) }, [createVNode(unref(ElInput), {
  26538. ref_key: "inputRef",
  26539. ref: inputRef,
  26540. modelValue: customInput.value,
  26541. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
  26542. "validate-event": false,
  26543. size: "small",
  26544. disabled: unref(disabled),
  26545. onChange: handleConfirm
  26546. }, null, 8, ["modelValue", "disabled"]), renderSlot(_ctx.$slots, "footer")], 2)
  26547. ], 34);
  26548. };
  26549. }
  26550. });
  26551. //#endregion
  26552. //#region ../../packages/components/color-picker-panel/src/color-picker-panel.vue
  26553. var color_picker_panel_default = color_picker_panel_vue_vue_type_script_setup_true_lang_default;
  26554. //#endregion
  26555. //#region ../../packages/components/color-picker-panel/index.ts
  26556. const ElColorPickerPanel = withInstall(color_picker_panel_default);
  26557. //#endregion
  26558. //#region ../../packages/components/color-picker/src/color-picker.ts
  26559. /**
  26560. * @deprecated Removed after 3.0.0, Use `ColorPickerProps` instead.
  26561. */
  26562. const colorPickerProps = buildProps({
  26563. persistent: {
  26564. type: Boolean,
  26565. default: true
  26566. },
  26567. modelValue: {
  26568. type: definePropType(String),
  26569. default: void 0
  26570. },
  26571. id: String,
  26572. showAlpha: Boolean,
  26573. colorFormat: { type: definePropType(String) },
  26574. disabled: {
  26575. type: Boolean,
  26576. default: void 0
  26577. },
  26578. clearable: {
  26579. type: Boolean,
  26580. default: true
  26581. },
  26582. size: useSizeProp,
  26583. popperClass: useTooltipContentProps.popperClass,
  26584. popperStyle: useTooltipContentProps.popperStyle,
  26585. tabindex: {
  26586. type: [String, Number],
  26587. default: 0
  26588. },
  26589. teleported: useTooltipContentProps.teleported,
  26590. appendTo: useTooltipContentProps.appendTo,
  26591. predefine: { type: definePropType(Array) },
  26592. validateEvent: {
  26593. type: Boolean,
  26594. default: true
  26595. },
  26596. ...useEmptyValuesProps,
  26597. ...useAriaProps(["ariaLabel"])
  26598. });
  26599. const colorPickerEmits = {
  26600. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val),
  26601. [CHANGE_EVENT]: (val) => isString(val) || isNil(val),
  26602. activeChange: (val) => isString(val) || isNil(val),
  26603. focus: (evt) => evt instanceof FocusEvent,
  26604. blur: (evt) => evt instanceof FocusEvent,
  26605. clear: () => true
  26606. };
  26607. /**
  26608. * @description default values for ColorPickerProps, used in components that extend ColorPickerProps
  26609. */
  26610. const colorPickerPropsDefaults = {
  26611. persistent: true,
  26612. modelValue: void 0,
  26613. disabled: void 0,
  26614. clearable: true,
  26615. popperStyle: void 0,
  26616. tabindex: 0,
  26617. teleported: true,
  26618. validateEvent: true,
  26619. valueOnClear: void 0
  26620. };
  26621. //#endregion
  26622. //#region ../../packages/components/color-picker/src/color-picker.vue?vue&type=script&setup=true&lang.ts
  26623. const _hoisted_1$51 = [
  26624. "id",
  26625. "aria-label",
  26626. "aria-labelledby",
  26627. "aria-description",
  26628. "aria-disabled",
  26629. "tabindex"
  26630. ];
  26631. var color_picker_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  26632. name: "ElColorPicker",
  26633. __name: "color-picker",
  26634. props: colorPickerProps,
  26635. emits: colorPickerEmits,
  26636. setup(__props, { expose: __expose, emit: __emit }) {
  26637. const props = __props;
  26638. const emit = __emit;
  26639. const { t } = useLocale();
  26640. const ns = useNamespace("color");
  26641. const { formItem } = useFormItem();
  26642. const colorSize = useFormSize();
  26643. const colorDisabled = useFormDisabled();
  26644. const { valueOnClear, isEmptyValue } = useEmptyValues(props, null);
  26645. const commonColor = useCommonColor(props, emit);
  26646. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: formItem });
  26647. const popper = ref();
  26648. const triggerRef = ref();
  26649. const pickerPanelRef = ref();
  26650. const showPicker = ref(false);
  26651. const showPanelColor = ref(false);
  26652. let shouldActiveChange = true;
  26653. const { isFocused, handleFocus, handleBlur } = useFocusController(triggerRef, {
  26654. disabled: colorDisabled,
  26655. beforeBlur(event) {
  26656. return popper.value?.isFocusInsideContent(event);
  26657. },
  26658. afterBlur() {
  26659. setShowPicker(false);
  26660. resetColor();
  26661. if (props.validateEvent) formItem?.validate?.("blur").catch((err) => /* @__PURE__ */ debugWarn(err));
  26662. }
  26663. });
  26664. const color = reactiveComputed(() => pickerPanelRef.value?.color ?? commonColor.color);
  26665. const panelProps = computed(() => pick(props, Object.keys(colorPickerPanelProps)));
  26666. const displayedColor = computed(() => {
  26667. if (!props.modelValue && !showPanelColor.value) return "transparent";
  26668. return displayedRgb(color, props.showAlpha);
  26669. });
  26670. const currentColor = computed(() => {
  26671. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  26672. });
  26673. const buttonAriaLabel = computed(() => {
  26674. return !isLabeledByFormItem.value ? props.ariaLabel || t("el.colorpicker.defaultLabel") : void 0;
  26675. });
  26676. const buttonAriaLabelledby = computed(() => {
  26677. return isLabeledByFormItem.value ? formItem?.labelId : void 0;
  26678. });
  26679. const btnKls = computed(() => {
  26680. return [
  26681. ns.b("picker"),
  26682. ns.is("disabled", colorDisabled.value),
  26683. ns.bm("picker", colorSize.value),
  26684. ns.is("focused", isFocused.value)
  26685. ];
  26686. });
  26687. function displayedRgb(color, showAlpha) {
  26688. const { r, g, b, a } = color.toRgb();
  26689. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${a})` : `rgb(${r}, ${g}, ${b})`;
  26690. }
  26691. function setShowPicker(value) {
  26692. showPicker.value = value;
  26693. }
  26694. const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
  26695. function show() {
  26696. if (colorDisabled.value) return;
  26697. setShowPicker(true);
  26698. }
  26699. function hide() {
  26700. debounceSetShowPicker(false);
  26701. resetColor();
  26702. }
  26703. function resetColor() {
  26704. nextTick(() => {
  26705. if (props.modelValue) color.fromString(props.modelValue);
  26706. else {
  26707. color.value = "";
  26708. nextTick(() => {
  26709. showPanelColor.value = false;
  26710. });
  26711. }
  26712. });
  26713. }
  26714. function handleTrigger() {
  26715. if (colorDisabled.value) return;
  26716. if (showPicker.value) resetColor();
  26717. debounceSetShowPicker(!showPicker.value);
  26718. }
  26719. function confirmValue() {
  26720. const value = isEmptyValue(color.value) ? valueOnClear.value : color.value;
  26721. emit(UPDATE_MODEL_EVENT, value);
  26722. emit(CHANGE_EVENT, value);
  26723. if (props.validateEvent) formItem?.validate("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  26724. debounceSetShowPicker(false);
  26725. nextTick(() => {
  26726. const newColor = new Color({
  26727. enableAlpha: props.showAlpha,
  26728. format: props.colorFormat || "",
  26729. value: props.modelValue
  26730. });
  26731. if (!color.compare(newColor)) resetColor();
  26732. });
  26733. }
  26734. function clear() {
  26735. debounceSetShowPicker(false);
  26736. emit(UPDATE_MODEL_EVENT, valueOnClear.value);
  26737. emit(CHANGE_EVENT, valueOnClear.value);
  26738. if (props.modelValue !== valueOnClear.value && props.validateEvent) formItem?.validate("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  26739. resetColor();
  26740. emit("clear");
  26741. }
  26742. function handleShowTooltip() {
  26743. pickerPanelRef?.value?.inputRef?.focus();
  26744. }
  26745. function handleClickOutside() {
  26746. if (!showPicker.value) return;
  26747. hide();
  26748. isFocused.value && focus();
  26749. }
  26750. function handleEsc(event) {
  26751. event.preventDefault();
  26752. event.stopPropagation();
  26753. setShowPicker(false);
  26754. resetColor();
  26755. }
  26756. function handleKeyDown(event) {
  26757. switch (getEventCode(event)) {
  26758. case EVENT_CODE.enter:
  26759. case EVENT_CODE.numpadEnter:
  26760. case EVENT_CODE.space:
  26761. event.preventDefault();
  26762. event.stopPropagation();
  26763. show();
  26764. break;
  26765. case EVENT_CODE.esc:
  26766. handleEsc(event);
  26767. break;
  26768. }
  26769. }
  26770. function focus() {
  26771. triggerRef.value.focus();
  26772. }
  26773. function blur() {
  26774. triggerRef.value.blur();
  26775. }
  26776. watch(() => currentColor.value, (val) => {
  26777. shouldActiveChange && emit("activeChange", val);
  26778. shouldActiveChange = true;
  26779. });
  26780. watch(() => color.value, () => {
  26781. if (!props.modelValue && !showPanelColor.value) showPanelColor.value = true;
  26782. });
  26783. watch(() => props.modelValue, (newVal) => {
  26784. if (!newVal) showPanelColor.value = false;
  26785. else if (newVal && newVal !== color.value) {
  26786. shouldActiveChange = false;
  26787. color.fromString(newVal);
  26788. }
  26789. });
  26790. watch(() => showPicker.value, () => {
  26791. pickerPanelRef.value && nextTick(pickerPanelRef.value.update);
  26792. });
  26793. provide(ROOT_COMMON_COLOR_INJECTION_KEY, commonColor);
  26794. __expose({
  26795. color,
  26796. show,
  26797. hide,
  26798. focus,
  26799. blur
  26800. });
  26801. return (_ctx, _cache) => {
  26802. return openBlock(), createBlock(unref(ElTooltip), {
  26803. ref_key: "popper",
  26804. ref: popper,
  26805. visible: showPicker.value,
  26806. "show-arrow": false,
  26807. "fallback-placements": [
  26808. "bottom",
  26809. "top",
  26810. "right",
  26811. "left"
  26812. ],
  26813. offset: 0,
  26814. "gpu-acceleration": false,
  26815. "popper-class": [unref(ns).be("picker", "panel"), __props.popperClass],
  26816. "popper-style": __props.popperStyle,
  26817. "stop-popper-mouse-event": false,
  26818. pure: "",
  26819. loop: "",
  26820. role: "dialog",
  26821. effect: "light",
  26822. trigger: "click",
  26823. teleported: __props.teleported,
  26824. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  26825. persistent: __props.persistent,
  26826. "append-to": __props.appendTo,
  26827. onShow: handleShowTooltip,
  26828. onHide: _cache[2] || (_cache[2] = ($event) => setShowPicker(false))
  26829. }, {
  26830. content: withCtx(() => [withDirectives((openBlock(), createBlock(unref(ElColorPickerPanel), mergeProps({
  26831. ref_key: "pickerPanelRef",
  26832. ref: pickerPanelRef
  26833. }, panelProps.value, {
  26834. border: false,
  26835. "validate-event": false,
  26836. onKeydown: withKeys(handleEsc, ["esc"])
  26837. }), {
  26838. footer: withCtx(() => [createElementVNode("div", null, [__props.clearable ? (openBlock(), createBlock(unref(ElButton), {
  26839. key: 0,
  26840. class: normalizeClass(unref(ns).be("footer", "link-btn")),
  26841. text: "",
  26842. size: "small",
  26843. onClick: clear
  26844. }, {
  26845. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.colorpicker.clear")), 1)]),
  26846. _: 1
  26847. }, 8, ["class"])) : createCommentVNode("v-if", true), createVNode(unref(ElButton), {
  26848. plain: "",
  26849. size: "small",
  26850. class: normalizeClass(unref(ns).be("footer", "btn")),
  26851. onClick: confirmValue
  26852. }, {
  26853. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.colorpicker.confirm")), 1)]),
  26854. _: 1
  26855. }, 8, ["class"])])]),
  26856. _: 1
  26857. }, 16)), [[
  26858. unref(ClickOutside),
  26859. handleClickOutside,
  26860. triggerRef.value
  26861. ]])]),
  26862. default: withCtx(() => [createElementVNode("div", mergeProps({
  26863. id: unref(buttonId),
  26864. ref_key: "triggerRef",
  26865. ref: triggerRef
  26866. }, _ctx.$attrs, {
  26867. class: btnKls.value,
  26868. role: "button",
  26869. "aria-label": buttonAriaLabel.value,
  26870. "aria-labelledby": buttonAriaLabelledby.value,
  26871. "aria-description": unref(t)("el.colorpicker.description", { color: __props.modelValue || "" }),
  26872. "aria-disabled": unref(colorDisabled),
  26873. tabindex: unref(colorDisabled) ? void 0 : __props.tabindex,
  26874. onKeydown: handleKeyDown,
  26875. onFocus: _cache[0] || (_cache[0] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  26876. onBlur: _cache[1] || (_cache[1] = (...args) => unref(handleBlur) && unref(handleBlur)(...args))
  26877. }), [createElementVNode("div", {
  26878. class: normalizeClass(unref(ns).be("picker", "trigger")),
  26879. onClick: handleTrigger
  26880. }, [createElementVNode("span", { class: normalizeClass([unref(ns).be("picker", "color"), unref(ns).is("alpha", __props.showAlpha)]) }, [createElementVNode("span", {
  26881. class: normalizeClass(unref(ns).be("picker", "color-inner")),
  26882. style: normalizeStyle({ backgroundColor: displayedColor.value })
  26883. }, [withDirectives(createVNode(unref(ElIcon), { class: normalizeClass([unref(ns).be("picker", "icon"), unref(ns).is("icon-arrow-down")]) }, {
  26884. default: withCtx(() => [createVNode(unref(arrow_down_default))]),
  26885. _: 1
  26886. }, 8, ["class"]), [[vShow, __props.modelValue || showPanelColor.value]]), withDirectives(createVNode(unref(ElIcon), { class: normalizeClass([unref(ns).be("picker", "empty"), unref(ns).is("icon-close")]) }, {
  26887. default: withCtx(() => [createVNode(unref(close_default))]),
  26888. _: 1
  26889. }, 8, ["class"]), [[vShow, !__props.modelValue && !showPanelColor.value]])], 6)], 2)], 2)], 16, _hoisted_1$51)]),
  26890. _: 1
  26891. }, 8, [
  26892. "visible",
  26893. "popper-class",
  26894. "popper-style",
  26895. "teleported",
  26896. "transition",
  26897. "persistent",
  26898. "append-to"
  26899. ]);
  26900. };
  26901. }
  26902. });
  26903. //#endregion
  26904. //#region ../../packages/components/color-picker/src/color-picker.vue
  26905. var color_picker_default = color_picker_vue_vue_type_script_setup_true_lang_default;
  26906. //#endregion
  26907. //#region ../../packages/components/color-picker/index.ts
  26908. const ElColorPicker = withInstall(color_picker_default);
  26909. //#endregion
  26910. //#region ../../packages/components/container/src/container.vue?vue&type=script&setup=true&lang.ts
  26911. var container_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  26912. name: "ElContainer",
  26913. __name: "container",
  26914. props: { direction: {
  26915. type: String,
  26916. required: false
  26917. } },
  26918. setup(__props) {
  26919. const props = __props;
  26920. const slots = useSlots();
  26921. const ns = useNamespace("container");
  26922. const isVertical = computed(() => {
  26923. if (props.direction === "vertical") return true;
  26924. else if (props.direction === "horizontal") return false;
  26925. if (slots && slots.default) return slots.default().some((vNode) => {
  26926. const tag = vNode.type.name;
  26927. return tag === "ElHeader" || tag === "ElFooter";
  26928. });
  26929. else return false;
  26930. });
  26931. return (_ctx, _cache) => {
  26932. return openBlock(), createElementBlock("section", { class: normalizeClass([unref(ns).b(), unref(ns).is("vertical", isVertical.value)]) }, [renderSlot(_ctx.$slots, "default")], 2);
  26933. };
  26934. }
  26935. });
  26936. //#endregion
  26937. //#region ../../packages/components/container/src/container.vue
  26938. var container_default = container_vue_vue_type_script_setup_true_lang_default;
  26939. //#endregion
  26940. //#region ../../packages/components/container/src/aside.vue?vue&type=script&setup=true&lang.ts
  26941. var aside_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  26942. name: "ElAside",
  26943. __name: "aside",
  26944. props: { width: {
  26945. type: [String, null],
  26946. required: false,
  26947. default: null
  26948. } },
  26949. setup(__props) {
  26950. const props = __props;
  26951. const ns = useNamespace("aside");
  26952. const style = computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  26953. return (_ctx, _cache) => {
  26954. return openBlock(), createElementBlock("aside", {
  26955. class: normalizeClass(unref(ns).b()),
  26956. style: normalizeStyle(style.value)
  26957. }, [renderSlot(_ctx.$slots, "default")], 6);
  26958. };
  26959. }
  26960. });
  26961. //#endregion
  26962. //#region ../../packages/components/container/src/aside.vue
  26963. var aside_default = aside_vue_vue_type_script_setup_true_lang_default;
  26964. //#endregion
  26965. //#region ../../packages/components/container/src/footer.vue?vue&type=script&setup=true&lang.ts
  26966. var footer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  26967. name: "ElFooter",
  26968. __name: "footer",
  26969. props: { height: {
  26970. type: [String, null],
  26971. required: false,
  26972. default: null
  26973. } },
  26974. setup(__props) {
  26975. const props = __props;
  26976. const ns = useNamespace("footer");
  26977. const style = computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  26978. return (_ctx, _cache) => {
  26979. return openBlock(), createElementBlock("footer", {
  26980. class: normalizeClass(unref(ns).b()),
  26981. style: normalizeStyle(style.value)
  26982. }, [renderSlot(_ctx.$slots, "default")], 6);
  26983. };
  26984. }
  26985. });
  26986. //#endregion
  26987. //#region ../../packages/components/container/src/footer.vue
  26988. var footer_default = footer_vue_vue_type_script_setup_true_lang_default;
  26989. //#endregion
  26990. //#region ../../packages/components/container/src/header.vue?vue&type=script&setup=true&lang.ts
  26991. var header_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  26992. name: "ElHeader",
  26993. __name: "header",
  26994. props: { height: {
  26995. type: [String, null],
  26996. required: false,
  26997. default: null
  26998. } },
  26999. setup(__props) {
  27000. const props = __props;
  27001. const ns = useNamespace("header");
  27002. const style = computed(() => {
  27003. return props.height ? ns.cssVarBlock({ height: props.height }) : {};
  27004. });
  27005. return (_ctx, _cache) => {
  27006. return openBlock(), createElementBlock("header", {
  27007. class: normalizeClass(unref(ns).b()),
  27008. style: normalizeStyle(style.value)
  27009. }, [renderSlot(_ctx.$slots, "default")], 6);
  27010. };
  27011. }
  27012. });
  27013. //#endregion
  27014. //#region ../../packages/components/container/src/header.vue
  27015. var header_default = header_vue_vue_type_script_setup_true_lang_default;
  27016. //#endregion
  27017. //#region ../../packages/components/container/src/main.vue?vue&type=script&setup=true&lang.ts
  27018. var main_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  27019. name: "ElMain",
  27020. __name: "main",
  27021. setup(__props) {
  27022. const ns = useNamespace("main");
  27023. return (_ctx, _cache) => {
  27024. return openBlock(), createElementBlock("main", { class: normalizeClass(unref(ns).b()) }, [renderSlot(_ctx.$slots, "default")], 2);
  27025. };
  27026. }
  27027. });
  27028. //#endregion
  27029. //#region ../../packages/components/container/src/main.vue
  27030. var main_default = main_vue_vue_type_script_setup_true_lang_default;
  27031. //#endregion
  27032. //#region ../../packages/components/container/index.ts
  27033. const ElContainer = withInstall(container_default, {
  27034. Aside: aside_default,
  27035. Footer: footer_default,
  27036. Header: header_default,
  27037. Main: main_default
  27038. });
  27039. const ElAside = withNoopInstall(aside_default);
  27040. const ElFooter = withNoopInstall(footer_default);
  27041. const ElHeader = withNoopInstall(header_default);
  27042. const ElMain = withNoopInstall(main_default);
  27043. //#endregion
  27044. //#region ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/advancedFormat.js
  27045. var require_advancedFormat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  27046. (function(e, t) {
  27047. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_advancedFormat = t();
  27048. })(exports, (function() {
  27049. "use strict";
  27050. return function(e, t) {
  27051. var r = t.prototype, n = r.format;
  27052. r.format = function(e) {
  27053. var t = this, r = this.$locale();
  27054. if (!this.isValid()) return n.bind(this)(e);
  27055. var s = this.$utils(), a = (e || "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(e) {
  27056. switch (e) {
  27057. case "Q": return Math.ceil((t.$M + 1) / 3);
  27058. case "Do": return r.ordinal(t.$D);
  27059. case "gggg": return t.weekYear();
  27060. case "GGGG": return t.isoWeekYear();
  27061. case "wo": return r.ordinal(t.week(), "W");
  27062. case "w":
  27063. case "ww": return s.s(t.week(), "w" === e ? 1 : 2, "0");
  27064. case "W":
  27065. case "WW": return s.s(t.isoWeek(), "W" === e ? 1 : 2, "0");
  27066. case "k":
  27067. case "kk": return s.s(String(0 === t.$H ? 24 : t.$H), "k" === e ? 1 : 2, "0");
  27068. case "X": return Math.floor(t.$d.getTime() / 1e3);
  27069. case "x": return t.$d.getTime();
  27070. case "z": return "[" + t.offsetName() + "]";
  27071. case "zzz": return "[" + t.offsetName("long") + "]";
  27072. default: return e;
  27073. }
  27074. }));
  27075. return n.bind(this)(a);
  27076. };
  27077. };
  27078. }));
  27079. }));
  27080. //#endregion
  27081. //#region ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/weekOfYear.js
  27082. var require_weekOfYear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  27083. (function(e, t) {
  27084. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_weekOfYear = t();
  27085. })(exports, (function() {
  27086. "use strict";
  27087. var e = "week", t = "year";
  27088. return function(i, n, r) {
  27089. var f = n.prototype;
  27090. f.week = function(i) {
  27091. if (void 0 === i && (i = null), null !== i) return this.add(7 * (i - this.week()), "day");
  27092. var n = this.$locale().yearStart || 1;
  27093. if (11 === this.month() && this.date() > 25) {
  27094. var f = r(this).startOf(t).add(1, t).date(n), s = r(this).endOf(e);
  27095. if (f.isBefore(s)) return 1;
  27096. }
  27097. var a = r(this).startOf(t).date(n).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, !0);
  27098. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  27099. }, f.weeks = function(e) {
  27100. return void 0 === e && (e = null), this.week(e);
  27101. };
  27102. };
  27103. }));
  27104. }));
  27105. //#endregion
  27106. //#region ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/weekYear.js
  27107. var require_weekYear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  27108. (function(e, t) {
  27109. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_weekYear = t();
  27110. })(exports, (function() {
  27111. "use strict";
  27112. return function(e, t) {
  27113. t.prototype.weekYear = function() {
  27114. var e = this.month(), t = this.week(), n = this.year();
  27115. return 1 === t && 11 === e ? n + 1 : 0 === e && t >= 52 ? n - 1 : n;
  27116. };
  27117. };
  27118. }));
  27119. }));
  27120. //#endregion
  27121. //#region ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/dayOfYear.js
  27122. var require_dayOfYear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  27123. (function(e, t) {
  27124. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_dayOfYear = t();
  27125. })(exports, (function() {
  27126. "use strict";
  27127. return function(e, t, n) {
  27128. t.prototype.dayOfYear = function(e) {
  27129. var t = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  27130. return null == e ? t : this.add(e - t, "day");
  27131. };
  27132. };
  27133. }));
  27134. }));
  27135. //#endregion
  27136. //#region ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isSameOrAfter.js
  27137. var require_isSameOrAfter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  27138. (function(e, t) {
  27139. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_isSameOrAfter = t();
  27140. })(exports, (function() {
  27141. "use strict";
  27142. return function(e, t) {
  27143. t.prototype.isSameOrAfter = function(e, t) {
  27144. return this.isSame(e, t) || this.isAfter(e, t);
  27145. };
  27146. };
  27147. }));
  27148. }));
  27149. //#endregion
  27150. //#region ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isSameOrBefore.js
  27151. var require_isSameOrBefore = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  27152. (function(e, i) {
  27153. "object" == typeof exports && "undefined" != typeof module ? module.exports = i() : "function" == typeof define && define.amd ? define(i) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_isSameOrBefore = i();
  27154. })(exports, (function() {
  27155. "use strict";
  27156. return function(e, i) {
  27157. i.prototype.isSameOrBefore = function(e, i) {
  27158. return this.isSame(e, i) || this.isBefore(e, i);
  27159. };
  27160. };
  27161. }));
  27162. }));
  27163. //#endregion
  27164. //#region ../../packages/components/date-picker-panel/src/props/date-picker-panel.ts
  27165. var import_isSameOrBefore = /* @__PURE__ */ __toESM(require_isSameOrBefore());
  27166. var import_isSameOrAfter = /* @__PURE__ */ __toESM(require_isSameOrAfter());
  27167. var import_dayOfYear = /* @__PURE__ */ __toESM(require_dayOfYear());
  27168. var import_weekYear = /* @__PURE__ */ __toESM(require_weekYear());
  27169. var import_weekOfYear = /* @__PURE__ */ __toESM(require_weekOfYear());
  27170. var import_advancedFormat = /* @__PURE__ */ __toESM(require_advancedFormat());
  27171. const datePickerPanelProps = buildProps({
  27172. valueFormat: String,
  27173. dateFormat: String,
  27174. timeFormat: String,
  27175. disabled: {
  27176. type: Boolean,
  27177. default: void 0
  27178. },
  27179. modelValue: {
  27180. type: definePropType([
  27181. Date,
  27182. Array,
  27183. String,
  27184. Number
  27185. ]),
  27186. default: ""
  27187. },
  27188. defaultValue: { type: definePropType([Date, Array]) },
  27189. defaultTime: { type: definePropType([Date, Array]) },
  27190. isRange: Boolean,
  27191. ...disabledTimeListsProps,
  27192. disabledDate: { type: Function },
  27193. cellClassName: { type: Function },
  27194. shortcuts: {
  27195. type: Array,
  27196. default: () => []
  27197. },
  27198. arrowControl: Boolean,
  27199. unlinkPanels: Boolean,
  27200. showNow: {
  27201. type: Boolean,
  27202. default: true
  27203. },
  27204. showConfirm: Boolean,
  27205. showFooter: Boolean,
  27206. showWeekNumber: Boolean,
  27207. type: {
  27208. type: definePropType(String),
  27209. default: "date"
  27210. },
  27211. clearable: {
  27212. type: Boolean,
  27213. default: true
  27214. },
  27215. border: {
  27216. type: Boolean,
  27217. default: true
  27218. },
  27219. editable: {
  27220. type: Boolean,
  27221. default: true
  27222. }
  27223. });
  27224. //#endregion
  27225. //#region ../../packages/components/date-picker-panel/src/constants.ts
  27226. const ROOT_PICKER_INJECTION_KEY = Symbol("rootPickerContextKey");
  27227. const ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY = "ElIsDefaultFormat";
  27228. //#endregion
  27229. //#region ../../packages/components/date-picker-panel/src/props/shared.ts
  27230. const selectionModes = [
  27231. "date",
  27232. "dates",
  27233. "year",
  27234. "years",
  27235. "month",
  27236. "months",
  27237. "week",
  27238. "range"
  27239. ];
  27240. const datePickerSharedProps = buildProps({
  27241. cellClassName: { type: definePropType(Function) },
  27242. disabledDate: { type: definePropType(Function) },
  27243. date: {
  27244. type: definePropType(Object),
  27245. required: true
  27246. },
  27247. minDate: { type: definePropType(Object) },
  27248. maxDate: { type: definePropType(Object) },
  27249. parsedValue: { type: definePropType([Object, Array]) },
  27250. rangeState: {
  27251. type: definePropType(Object),
  27252. default: () => ({
  27253. endDate: null,
  27254. selecting: false
  27255. })
  27256. },
  27257. disabled: Boolean
  27258. });
  27259. const panelSharedProps = buildProps({
  27260. type: {
  27261. type: definePropType(String),
  27262. required: true,
  27263. values: datePickTypes
  27264. },
  27265. dateFormat: String,
  27266. timeFormat: String,
  27267. showNow: {
  27268. type: Boolean,
  27269. default: true
  27270. },
  27271. showConfirm: Boolean,
  27272. showFooter: {
  27273. type: Boolean,
  27274. default: true
  27275. },
  27276. showWeekNumber: Boolean,
  27277. border: Boolean,
  27278. disabled: Boolean,
  27279. editable: {
  27280. type: Boolean,
  27281. default: true
  27282. }
  27283. });
  27284. const panelRangeSharedProps = buildProps({
  27285. unlinkPanels: Boolean,
  27286. visible: {
  27287. type: Boolean,
  27288. default: true
  27289. },
  27290. showConfirm: Boolean,
  27291. showFooter: {
  27292. type: Boolean,
  27293. default: true
  27294. },
  27295. border: Boolean,
  27296. disabled: Boolean,
  27297. parsedValue: { type: definePropType(Array) }
  27298. });
  27299. const selectionModeWithDefault = (mode) => {
  27300. return {
  27301. type: String,
  27302. values: selectionModes,
  27303. default: mode
  27304. };
  27305. };
  27306. //#endregion
  27307. //#region ../../packages/components/date-picker-panel/src/props/panel-date-pick.ts
  27308. const panelDatePickProps = buildProps({
  27309. ...panelSharedProps,
  27310. parsedValue: { type: definePropType([Object, Array]) },
  27311. visible: {
  27312. type: Boolean,
  27313. default: true
  27314. },
  27315. format: {
  27316. type: String,
  27317. default: ""
  27318. }
  27319. });
  27320. //#endregion
  27321. //#region ../../packages/components/date-picker-panel/src/utils.ts
  27322. const isValidRange = (range) => {
  27323. if (!isArray$1(range)) return false;
  27324. const [left, right] = range;
  27325. return import_dayjs_min.default.isDayjs(left) && import_dayjs_min.default.isDayjs(right) && (0, import_dayjs_min.default)(left).isValid() && (0, import_dayjs_min.default)(right).isValid() && left.isSameOrBefore(right);
  27326. };
  27327. const getDefaultValue = (defaultValue, { lang, step = 1, unit, unlinkPanels }) => {
  27328. let start;
  27329. if (isArray$1(defaultValue)) {
  27330. let [left, right] = defaultValue.map((d) => (0, import_dayjs_min.default)(d).locale(lang));
  27331. if (!unlinkPanels) right = left.add(step, unit);
  27332. return [left, right];
  27333. } else if (defaultValue) start = (0, import_dayjs_min.default)(defaultValue);
  27334. else start = (0, import_dayjs_min.default)();
  27335. start = start.locale(lang);
  27336. return [start, start.add(step, unit)];
  27337. };
  27338. const buildPickerTable = (dimension, rows, { columnIndexOffset, startDate, nextEndDate, now, unit, relativeDateGetter, setCellMetadata, setRowMetadata }) => {
  27339. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  27340. const row = rows[rowIndex];
  27341. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  27342. let cell = row[columnIndex + columnIndexOffset];
  27343. if (!cell) cell = {
  27344. row: rowIndex,
  27345. column: columnIndex,
  27346. type: "normal",
  27347. inRange: false,
  27348. start: false,
  27349. end: false
  27350. };
  27351. const nextStartDate = relativeDateGetter(rowIndex * dimension.column + columnIndex);
  27352. cell.dayjs = nextStartDate;
  27353. cell.date = nextStartDate.toDate();
  27354. cell.timestamp = nextStartDate.valueOf();
  27355. cell.type = "normal";
  27356. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  27357. if (startDate?.isSameOrAfter(nextEndDate)) {
  27358. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  27359. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  27360. } else {
  27361. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  27362. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  27363. }
  27364. if (nextStartDate.isSame(now, unit)) cell.type = "today";
  27365. setCellMetadata?.(cell, {
  27366. rowIndex,
  27367. columnIndex
  27368. });
  27369. row[columnIndex + columnIndexOffset] = cell;
  27370. }
  27371. setRowMetadata?.(row);
  27372. }
  27373. };
  27374. const datesInMonth = (date, year, month, lang) => {
  27375. const firstDay = (0, import_dayjs_min.default)().locale(lang).startOf("month").month(month).year(year).hour(date.hour()).minute(date.minute()).second(date.second());
  27376. return rangeArr(firstDay.daysInMonth()).map((n) => firstDay.add(n, "day").toDate());
  27377. };
  27378. const getValidDateOfMonth = (date, year, month, lang, disabledDate) => {
  27379. const _value = (0, import_dayjs_min.default)().year(year).month(month).startOf("month").hour(date.hour()).minute(date.minute()).second(date.second());
  27380. const _date = datesInMonth(date, year, month, lang).find((date) => {
  27381. return !disabledDate?.(date);
  27382. });
  27383. if (_date) return (0, import_dayjs_min.default)(_date).locale(lang);
  27384. return _value.locale(lang);
  27385. };
  27386. const getValidDateOfYear = (value, lang, disabledDate) => {
  27387. const year = value.year();
  27388. if (!disabledDate?.(value.toDate())) return value.locale(lang);
  27389. const month = value.month();
  27390. if (!datesInMonth(value, year, month, lang).every(disabledDate)) return getValidDateOfMonth(value, year, month, lang, disabledDate);
  27391. for (let i = 0; i < 12; i++) if (!datesInMonth(value, year, i, lang).every(disabledDate)) return getValidDateOfMonth(value, year, i, lang, disabledDate);
  27392. return value;
  27393. };
  27394. const correctlyParseUserInput = (value, format, lang, defaultFormat) => {
  27395. if (isArray$1(value)) return value.map((v) => correctlyParseUserInput(v, format, lang, defaultFormat));
  27396. if (isString(value)) {
  27397. const dayjsValue = defaultFormat?.value ? (0, import_dayjs_min.default)(value) : (0, import_dayjs_min.default)(value, format);
  27398. if (!dayjsValue.isValid()) return dayjsValue;
  27399. }
  27400. return (0, import_dayjs_min.default)(value, format).locale(lang);
  27401. };
  27402. //#endregion
  27403. //#region ../../packages/components/date-picker-panel/src/props/basic-date-table.ts
  27404. const basicDateTableProps = buildProps({
  27405. ...datePickerSharedProps,
  27406. showWeekNumber: Boolean,
  27407. selectionMode: selectionModeWithDefault("date")
  27408. });
  27409. const basicDateTableEmits = [
  27410. "changerange",
  27411. "pick",
  27412. "select"
  27413. ];
  27414. //#endregion
  27415. //#region ../../packages/components/date-picker-panel/src/composables/use-basic-date-table.ts
  27416. const isNormalDay = (type = "") => {
  27417. return ["normal", "today"].includes(type);
  27418. };
  27419. const useBasicDateTable = (props, emit) => {
  27420. const { lang } = useLocale();
  27421. const tbodyRef = ref();
  27422. const currentCellRef = ref();
  27423. const lastRow = ref();
  27424. const lastColumn = ref();
  27425. const tableRows = ref([
  27426. [],
  27427. [],
  27428. [],
  27429. [],
  27430. [],
  27431. []
  27432. ]);
  27433. let focusWithClick = false;
  27434. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  27435. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  27436. const offsetDay = computed(() => {
  27437. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  27438. });
  27439. const startDate = computed(() => {
  27440. const startDayOfMonth = props.date.startOf("month");
  27441. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  27442. });
  27443. const WEEKS = computed(() => {
  27444. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  27445. });
  27446. const hasCurrent = computed(() => {
  27447. return flatten(unref(rows)).some((row) => {
  27448. return row.isCurrent;
  27449. });
  27450. });
  27451. const days = computed(() => {
  27452. const startOfMonth = props.date.startOf("month");
  27453. return {
  27454. startOfMonthDay: startOfMonth.day() || 7,
  27455. dateCountOfMonth: startOfMonth.daysInMonth(),
  27456. dateCountOfLastMonth: startOfMonth.subtract(1, "month").daysInMonth()
  27457. };
  27458. });
  27459. const selectedDate = computed(() => {
  27460. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  27461. });
  27462. const setDateText = (cell, { count, rowIndex, columnIndex }) => {
  27463. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = unref(days);
  27464. const offset = unref(offsetDay);
  27465. if (rowIndex >= 0 && rowIndex <= 1) {
  27466. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  27467. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  27468. cell.text = count;
  27469. return true;
  27470. } else {
  27471. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  27472. cell.type = "prev-month";
  27473. }
  27474. } else {
  27475. if (count <= dateCountOfMonth) cell.text = count;
  27476. else {
  27477. cell.text = count - dateCountOfMonth;
  27478. cell.type = "next-month";
  27479. }
  27480. return true;
  27481. }
  27482. return false;
  27483. };
  27484. const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
  27485. const { disabledDate, cellClassName } = props;
  27486. const _selectedDate = unref(selectedDate);
  27487. const shouldIncrement = setDateText(cell, {
  27488. count,
  27489. rowIndex,
  27490. columnIndex
  27491. });
  27492. const cellDate = cell.dayjs.toDate();
  27493. cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
  27494. cell.isSelected = !!cell.selected;
  27495. cell.isCurrent = isCurrent(cell);
  27496. cell.disabled = disabledDate?.(cellDate);
  27497. cell.customClass = cellClassName?.(cellDate);
  27498. return shouldIncrement;
  27499. };
  27500. const setRowMetadata = (row) => {
  27501. if (props.selectionMode === "week") {
  27502. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  27503. const isActive = isWeekActive(row[start + 1]);
  27504. row[start].inRange = isActive;
  27505. row[start].start = isActive;
  27506. row[end].inRange = isActive;
  27507. row[end].end = isActive;
  27508. }
  27509. };
  27510. const rows = computed(() => {
  27511. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  27512. const offset = unref(offsetDay);
  27513. const rows_ = unref(tableRows);
  27514. const dateUnit = "day";
  27515. let count = 1;
  27516. buildPickerTable({
  27517. row: 6,
  27518. column: 7
  27519. }, rows_, {
  27520. startDate: minDate,
  27521. columnIndexOffset: showWeekNumber ? 1 : 0,
  27522. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  27523. now: (0, import_dayjs_min.default)().locale(unref(lang)).startOf(dateUnit),
  27524. unit: dateUnit,
  27525. relativeDateGetter: (idx) => unref(startDate).add(idx - offset, dateUnit),
  27526. setCellMetadata: (...args) => {
  27527. if (setCellMetadata(...args, count)) count += 1;
  27528. },
  27529. setRowMetadata
  27530. });
  27531. if (showWeekNumber) {
  27532. for (let rowIndex = 0; rowIndex < 6; rowIndex++) if (rows_[rowIndex][1].dayjs) rows_[rowIndex][0] = {
  27533. type: "week",
  27534. text: rows_[rowIndex][1].dayjs.week()
  27535. };
  27536. }
  27537. return rows_;
  27538. });
  27539. watch(() => props.date, async () => {
  27540. if (unref(tbodyRef)?.contains(document.activeElement)) {
  27541. await nextTick();
  27542. await focus();
  27543. }
  27544. });
  27545. const focus = async () => unref(currentCellRef)?.focus();
  27546. const isCurrent = (cell) => {
  27547. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  27548. };
  27549. const cellMatchesDate = (cell, date) => {
  27550. if (!date) return false;
  27551. return (0, import_dayjs_min.default)(date).locale(unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
  27552. };
  27553. const getDateOfCell = (row, column) => {
  27554. const startOfMonthDay = unref(days).startOfMonthDay;
  27555. const offset = unref(offsetDay);
  27556. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  27557. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0));
  27558. return props.date.startOf("month").subtract(numberOfDaysFromPreviousMonth, "day").add(offsetFromStart, "day");
  27559. };
  27560. const handleMouseMove = (event) => {
  27561. if (!props.rangeState.selecting) return;
  27562. let target = event.target;
  27563. if (target.tagName === "SPAN") target = target.parentNode?.parentNode;
  27564. if (target.tagName === "DIV") target = target.parentNode;
  27565. if (target.tagName !== "TD") return;
  27566. const row = target.parentNode.rowIndex - 1;
  27567. const column = target.cellIndex;
  27568. if (unref(rows)[row][column].disabled) return;
  27569. if (row !== unref(lastRow) || column !== unref(lastColumn)) {
  27570. lastRow.value = row;
  27571. lastColumn.value = column;
  27572. emit("changerange", {
  27573. selecting: true,
  27574. endDate: getDateOfCell(row, column)
  27575. });
  27576. }
  27577. };
  27578. const isSelectedCell = (cell) => {
  27579. return !unref(hasCurrent) && cell?.text === 1 && isNormalDay(cell.type) || cell.isCurrent;
  27580. };
  27581. const handleFocus = (event) => {
  27582. if (focusWithClick || unref(hasCurrent) || props.selectionMode !== "date") return;
  27583. handlePickDate(event, true);
  27584. };
  27585. const handleMouseDown = (event) => {
  27586. if (!event.target.closest("td")) return;
  27587. focusWithClick = true;
  27588. };
  27589. const handleMouseUp = (event) => {
  27590. if (!event.target.closest("td")) return;
  27591. focusWithClick = false;
  27592. };
  27593. const handleRangePick = (newDate) => {
  27594. if (!props.rangeState.selecting || !props.minDate) {
  27595. emit("pick", {
  27596. minDate: newDate,
  27597. maxDate: null
  27598. });
  27599. emit("select", true);
  27600. } else {
  27601. if (newDate >= props.minDate) emit("pick", {
  27602. minDate: props.minDate,
  27603. maxDate: newDate
  27604. });
  27605. else emit("pick", {
  27606. minDate: newDate,
  27607. maxDate: props.minDate
  27608. });
  27609. emit("select", false);
  27610. }
  27611. };
  27612. const handleWeekPick = (newDate) => {
  27613. const weekNumber = newDate.week();
  27614. const value = `${newDate.year()}w${weekNumber}`;
  27615. emit("pick", {
  27616. year: newDate.year(),
  27617. week: weekNumber,
  27618. value,
  27619. date: newDate.startOf("week")
  27620. });
  27621. };
  27622. const handleDatesPick = (newDate, selected) => {
  27623. emit("pick", selected ? castArray(props.parsedValue).filter((d) => d?.valueOf() !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]));
  27624. };
  27625. const handlePickDate = (event, isKeyboardMovement = false) => {
  27626. if (props.disabled) return;
  27627. const target = event.target.closest("td");
  27628. if (!target) return;
  27629. const row = target.parentNode.rowIndex - 1;
  27630. const column = target.cellIndex;
  27631. const cell = unref(rows)[row][column];
  27632. if (cell.disabled || cell.type === "week") return;
  27633. const newDate = getDateOfCell(row, column);
  27634. switch (props.selectionMode) {
  27635. case "range":
  27636. handleRangePick(newDate);
  27637. break;
  27638. case "date":
  27639. emit("pick", newDate, isKeyboardMovement);
  27640. break;
  27641. case "week":
  27642. handleWeekPick(newDate);
  27643. break;
  27644. case "dates":
  27645. handleDatesPick(newDate, !!cell.selected);
  27646. break;
  27647. default: break;
  27648. }
  27649. };
  27650. const isWeekActive = (cell) => {
  27651. if (props.selectionMode !== "week") return false;
  27652. let newDate = props.date.startOf("day");
  27653. if (cell.type === "prev-month") newDate = newDate.subtract(1, "month");
  27654. if (cell.type === "next-month") newDate = newDate.add(1, "month");
  27655. newDate = newDate.date(Number.parseInt(cell.text, 10));
  27656. if (props.parsedValue && !isArray$1(props.parsedValue)) {
  27657. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  27658. return props.parsedValue.subtract(dayOffset, "day").isSame(newDate, "day");
  27659. }
  27660. return false;
  27661. };
  27662. return {
  27663. WEEKS,
  27664. rows,
  27665. tbodyRef,
  27666. currentCellRef,
  27667. focus,
  27668. isCurrent,
  27669. isWeekActive,
  27670. isSelectedCell,
  27671. handlePickDate,
  27672. handleMouseUp,
  27673. handleMouseDown,
  27674. handleMouseMove,
  27675. handleFocus
  27676. };
  27677. };
  27678. const useBasicDateTableDOM = (props, { isCurrent, isWeekActive }) => {
  27679. const ns = useNamespace("date-table");
  27680. const { t } = useLocale();
  27681. const tableKls = computed(() => [ns.b(), ns.is("week-mode", props.selectionMode === "week" && !props.disabled)]);
  27682. const tableLabel = computed(() => t("el.datepicker.dateTablePrompt"));
  27683. const getCellClasses = (cell) => {
  27684. const classes = [];
  27685. if (isNormalDay(cell.type) && !cell.disabled) {
  27686. classes.push("available");
  27687. if (cell.type === "today") classes.push("today");
  27688. } else classes.push(cell.type);
  27689. if (isCurrent(cell)) classes.push("current");
  27690. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  27691. classes.push("in-range");
  27692. if (cell.start) classes.push("start-date");
  27693. if (cell.end) classes.push("end-date");
  27694. }
  27695. if (cell.disabled || props.disabled) classes.push("disabled");
  27696. if (cell.selected) classes.push("selected");
  27697. if (cell.customClass) classes.push(cell.customClass);
  27698. return classes.join(" ");
  27699. };
  27700. const getRowKls = (cell) => [ns.e("row"), { current: isWeekActive(cell) }];
  27701. return {
  27702. tableKls,
  27703. tableLabel,
  27704. weekHeaderClass: ns.e("week-header"),
  27705. getCellClasses,
  27706. getRowKls,
  27707. t
  27708. };
  27709. };
  27710. //#endregion
  27711. //#region ../../packages/components/date-picker-panel/src/props/basic-cell.ts
  27712. const basicCellProps = buildProps({ cell: { type: definePropType(Object) } });
  27713. //#endregion
  27714. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-cell-render.tsx
  27715. var basic_cell_render_default = /* @__PURE__ */ defineComponent({
  27716. name: "ElDatePickerCell",
  27717. props: basicCellProps,
  27718. setup(props) {
  27719. const ns = useNamespace("date-table-cell");
  27720. const { slots } = inject(ROOT_PICKER_INJECTION_KEY);
  27721. return () => {
  27722. const { cell } = props;
  27723. return renderSlot(slots, "default", { ...cell }, () => [createVNode("div", { "class": ns.b() }, [createVNode("span", { "class": ns.e("text") }, [cell?.renderText ?? cell?.text])])]);
  27724. };
  27725. }
  27726. });
  27727. //#endregion
  27728. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-date-table.vue?vue&type=script&setup=true&lang.ts
  27729. const _hoisted_1$50 = ["aria-label"];
  27730. const _hoisted_2$32 = ["aria-label"];
  27731. const _hoisted_3$15 = [
  27732. "aria-current",
  27733. "aria-selected",
  27734. "tabindex",
  27735. "aria-disabled"
  27736. ];
  27737. var basic_date_table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  27738. __name: "basic-date-table",
  27739. props: basicDateTableProps,
  27740. emits: basicDateTableEmits,
  27741. setup(__props, { expose: __expose, emit: __emit }) {
  27742. const props = __props;
  27743. const { WEEKS, rows, tbodyRef, currentCellRef, focus, isCurrent, isWeekActive, isSelectedCell, handlePickDate, handleMouseUp, handleMouseDown, handleMouseMove, handleFocus } = useBasicDateTable(props, __emit);
  27744. const { tableLabel, tableKls, getCellClasses, getRowKls, weekHeaderClass, t } = useBasicDateTableDOM(props, {
  27745. isCurrent,
  27746. isWeekActive
  27747. });
  27748. let isUnmounting = false;
  27749. onBeforeUnmount(() => {
  27750. isUnmounting = true;
  27751. });
  27752. __expose({ focus });
  27753. return (_ctx, _cache) => {
  27754. return openBlock(), createElementBlock("table", {
  27755. "aria-label": unref(tableLabel),
  27756. class: normalizeClass(unref(tableKls)),
  27757. cellspacing: "0",
  27758. cellpadding: "0",
  27759. role: "grid",
  27760. onClick: _cache[1] || (_cache[1] = (...args) => unref(handlePickDate) && unref(handlePickDate)(...args)),
  27761. onMousemove: _cache[2] || (_cache[2] = (...args) => unref(handleMouseMove) && unref(handleMouseMove)(...args)),
  27762. onMousedown: _cache[3] || (_cache[3] = (...args) => unref(handleMouseDown) && unref(handleMouseDown)(...args)),
  27763. onMouseup: _cache[4] || (_cache[4] = (...args) => unref(handleMouseUp) && unref(handleMouseUp)(...args))
  27764. }, [createElementVNode("tbody", {
  27765. ref_key: "tbodyRef",
  27766. ref: tbodyRef
  27767. }, [createElementVNode("tr", null, [_ctx.showWeekNumber ? (openBlock(), createElementBlock("th", {
  27768. key: 0,
  27769. scope: "col",
  27770. class: normalizeClass(unref(weekHeaderClass))
  27771. }, null, 2)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(WEEKS), (week, key) => {
  27772. return openBlock(), createElementBlock("th", {
  27773. key,
  27774. "aria-label": unref(t)("el.datepicker.weeksFull." + week),
  27775. scope: "col"
  27776. }, toDisplayString(unref(t)("el.datepicker.weeks." + week)), 9, _hoisted_2$32);
  27777. }), 128))]), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
  27778. return openBlock(), createElementBlock("tr", {
  27779. key: rowKey,
  27780. class: normalizeClass(unref(getRowKls)(_ctx.showWeekNumber ? row[2] : row[1]))
  27781. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, columnKey) => {
  27782. return openBlock(), createElementBlock("td", {
  27783. key: `${rowKey}.${columnKey}`,
  27784. ref_for: true,
  27785. ref: (el) => !unref(isUnmounting) && unref(isSelectedCell)(cell) && (currentCellRef.value = el),
  27786. class: normalizeClass(unref(getCellClasses)(cell)),
  27787. "aria-current": cell.isCurrent ? "date" : void 0,
  27788. "aria-selected": cell.isCurrent,
  27789. tabindex: _ctx.disabled ? void 0 : unref(isSelectedCell)(cell) ? 0 : -1,
  27790. "aria-disabled": _ctx.disabled,
  27791. onFocus: _cache[0] || (_cache[0] = (...args) => unref(handleFocus) && unref(handleFocus)(...args))
  27792. }, [createVNode(unref(basic_cell_render_default), { cell }, null, 8, ["cell"])], 42, _hoisted_3$15);
  27793. }), 128))], 2);
  27794. }), 128))], 512)], 42, _hoisted_1$50);
  27795. };
  27796. }
  27797. });
  27798. //#endregion
  27799. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-date-table.vue
  27800. var basic_date_table_default = basic_date_table_vue_vue_type_script_setup_true_lang_default;
  27801. //#endregion
  27802. //#region ../../packages/components/date-picker-panel/src/props/basic-month-table.ts
  27803. const basicMonthTableProps = buildProps({
  27804. ...datePickerSharedProps,
  27805. selectionMode: selectionModeWithDefault("month")
  27806. });
  27807. //#endregion
  27808. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-month-table.vue?vue&type=script&setup=true&lang.ts
  27809. const _hoisted_1$49 = ["aria-label"];
  27810. const _hoisted_2$31 = [
  27811. "aria-selected",
  27812. "aria-label",
  27813. "tabindex",
  27814. "onKeydown"
  27815. ];
  27816. var basic_month_table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  27817. __name: "basic-month-table",
  27818. props: basicMonthTableProps,
  27819. emits: [
  27820. "changerange",
  27821. "pick",
  27822. "select"
  27823. ],
  27824. setup(__props, { expose: __expose, emit: __emit }) {
  27825. const props = __props;
  27826. const emit = __emit;
  27827. const ns = useNamespace("month-table");
  27828. const { t, lang } = useLocale();
  27829. const tbodyRef = ref();
  27830. const currentCellRef = ref();
  27831. const months = ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  27832. const tableRows = ref([
  27833. [],
  27834. [],
  27835. []
  27836. ]);
  27837. const lastRow = ref();
  27838. const lastColumn = ref();
  27839. const rows = computed(() => {
  27840. const rows = tableRows.value;
  27841. const now = (0, import_dayjs_min.default)().locale(lang.value).startOf("month");
  27842. for (let i = 0; i < 3; i++) {
  27843. const row = rows[i];
  27844. for (let j = 0; j < 4; j++) {
  27845. const cell = row[j] ||= {
  27846. row: i,
  27847. column: j,
  27848. type: "normal",
  27849. inRange: false,
  27850. start: false,
  27851. end: false,
  27852. text: -1,
  27853. disabled: false,
  27854. isSelected: false,
  27855. customClass: void 0,
  27856. date: void 0,
  27857. dayjs: void 0,
  27858. isCurrent: void 0,
  27859. selected: void 0,
  27860. renderText: void 0,
  27861. timestamp: void 0
  27862. };
  27863. cell.type = "normal";
  27864. const index = i * 4 + j;
  27865. const calTime = props.date.startOf("year").month(index);
  27866. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  27867. 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"));
  27868. if (props.minDate?.isSameOrAfter(calEndDate)) {
  27869. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  27870. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  27871. } else {
  27872. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  27873. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  27874. }
  27875. if (now.isSame(calTime)) cell.type = "today";
  27876. const cellDate = calTime.toDate();
  27877. cell.text = index;
  27878. cell.disabled = props.disabledDate?.(cellDate) || false;
  27879. cell.date = cellDate;
  27880. cell.customClass = props.cellClassName?.(cellDate);
  27881. cell.dayjs = calTime;
  27882. cell.timestamp = calTime.valueOf();
  27883. cell.isSelected = isSelectedCell(cell);
  27884. }
  27885. }
  27886. return rows;
  27887. });
  27888. const focus = () => {
  27889. currentCellRef.value?.focus();
  27890. };
  27891. const getCellStyle = (cell) => {
  27892. const style = {};
  27893. const year = props.date.year();
  27894. const today = /* @__PURE__ */ new Date();
  27895. const month = cell.text;
  27896. style.disabled = props.disabled || (props.disabledDate ? datesInMonth(props.date, year, month, lang.value).every(props.disabledDate) : false);
  27897. style.current = castArray(props.parsedValue).some((date) => import_dayjs_min.default.isDayjs(date) && date.year() === year && date.month() === month);
  27898. style.today = today.getFullYear() === year && today.getMonth() === month;
  27899. if (cell.customClass) style[cell.customClass] = true;
  27900. if (cell.inRange) {
  27901. style["in-range"] = true;
  27902. if (cell.start) style["start-date"] = true;
  27903. if (cell.end) style["end-date"] = true;
  27904. }
  27905. return style;
  27906. };
  27907. const isSelectedCell = (cell) => {
  27908. const year = props.date.year();
  27909. const month = cell.text;
  27910. return castArray(props.date).some((date) => date.year() === year && date.month() === month);
  27911. };
  27912. const handleMouseMove = (event) => {
  27913. if (!props.rangeState.selecting) return;
  27914. let target = event.target;
  27915. if (target.tagName === "SPAN") target = target.parentNode?.parentNode;
  27916. if (target.tagName === "DIV") target = target.parentNode;
  27917. if (target.tagName !== "TD") return;
  27918. const row = target.parentNode.rowIndex;
  27919. const column = target.cellIndex;
  27920. if (rows.value[row][column].disabled) return;
  27921. if (row !== lastRow.value || column !== lastColumn.value) {
  27922. lastRow.value = row;
  27923. lastColumn.value = column;
  27924. emit("changerange", {
  27925. selecting: true,
  27926. endDate: props.date.startOf("year").month(row * 4 + column)
  27927. });
  27928. }
  27929. };
  27930. const handleMonthTableClick = (event) => {
  27931. if (props.disabled) return;
  27932. const target = event.target?.closest("td");
  27933. if (target?.tagName !== "TD") return;
  27934. if (hasClass(target, "disabled")) return;
  27935. const column = target.cellIndex;
  27936. const month = target.parentNode.rowIndex * 4 + column;
  27937. const newDate = props.date.startOf("year").month(month);
  27938. if (props.selectionMode === "months") {
  27939. if (event.type === "keydown") {
  27940. emit("pick", castArray(props.parsedValue), false);
  27941. return;
  27942. }
  27943. const newMonth = getValidDateOfMonth(props.date, props.date.year(), month, lang.value, props.disabledDate);
  27944. emit("pick", hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => d?.year() !== newMonth.year() || d?.month() !== newMonth.month()) : castArray(props.parsedValue).concat([(0, import_dayjs_min.default)(newMonth)]));
  27945. } else if (props.selectionMode === "range") if (!props.rangeState.selecting) {
  27946. emit("pick", {
  27947. minDate: newDate,
  27948. maxDate: null
  27949. });
  27950. emit("select", true);
  27951. } else {
  27952. if (props.minDate && newDate >= props.minDate) emit("pick", {
  27953. minDate: props.minDate,
  27954. maxDate: newDate
  27955. });
  27956. else emit("pick", {
  27957. minDate: newDate,
  27958. maxDate: props.minDate
  27959. });
  27960. emit("select", false);
  27961. }
  27962. else emit("pick", month);
  27963. };
  27964. watch(() => props.date, async () => {
  27965. if (tbodyRef.value?.contains(document.activeElement)) {
  27966. await nextTick();
  27967. currentCellRef.value?.focus();
  27968. }
  27969. });
  27970. __expose({ focus });
  27971. return (_ctx, _cache) => {
  27972. return openBlock(), createElementBlock("table", {
  27973. role: "grid",
  27974. "aria-label": unref(t)("el.datepicker.monthTablePrompt"),
  27975. class: normalizeClass(unref(ns).b()),
  27976. onClick: handleMonthTableClick,
  27977. onMousemove: handleMouseMove
  27978. }, [createElementVNode("tbody", {
  27979. ref_key: "tbodyRef",
  27980. ref: tbodyRef
  27981. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row, key) => {
  27982. return openBlock(), createElementBlock("tr", { key }, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  27983. return openBlock(), createElementBlock("td", {
  27984. key: key_,
  27985. ref_for: true,
  27986. ref: (el) => cell.isSelected && (currentCellRef.value = el),
  27987. class: normalizeClass(getCellStyle(cell)),
  27988. "aria-selected": !!cell.isSelected,
  27989. "aria-label": unref(t)(`el.datepicker.month${+cell.text + 1}`),
  27990. tabindex: cell.isSelected ? 0 : -1,
  27991. onKeydown: [withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]), withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])]
  27992. }, [createVNode(unref(basic_cell_render_default), { cell: {
  27993. ...cell,
  27994. renderText: unref(t)("el.datepicker.months." + months.value[cell.text])
  27995. } }, null, 8, ["cell"])], 42, _hoisted_2$31);
  27996. }), 128))]);
  27997. }), 128))], 512)], 42, _hoisted_1$49);
  27998. };
  27999. }
  28000. });
  28001. //#endregion
  28002. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-month-table.vue
  28003. var basic_month_table_default = basic_month_table_vue_vue_type_script_setup_true_lang_default;
  28004. //#endregion
  28005. //#region ../../packages/components/date-picker-panel/src/props/basic-year-table.ts
  28006. const basicYearTableProps = buildProps({
  28007. ...datePickerSharedProps,
  28008. selectionMode: selectionModeWithDefault("year")
  28009. });
  28010. //#endregion
  28011. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-year-table.vue?vue&type=script&setup=true&lang.ts
  28012. const _hoisted_1$48 = ["aria-label"];
  28013. const _hoisted_2$30 = [
  28014. "aria-selected",
  28015. "aria-label",
  28016. "tabindex",
  28017. "onKeydown"
  28018. ];
  28019. var basic_year_table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  28020. __name: "basic-year-table",
  28021. props: basicYearTableProps,
  28022. emits: [
  28023. "changerange",
  28024. "pick",
  28025. "select"
  28026. ],
  28027. setup(__props, { expose: __expose, emit: __emit }) {
  28028. const datesInYear = (year, lang) => {
  28029. const firstDay = (0, import_dayjs_min.default)(String(year)).locale(lang).startOf("year");
  28030. return rangeArr(firstDay.endOf("year").dayOfYear()).map((n) => firstDay.add(n, "day").toDate());
  28031. };
  28032. const props = __props;
  28033. const emit = __emit;
  28034. const ns = useNamespace("year-table");
  28035. const { t, lang } = useLocale();
  28036. const tbodyRef = ref();
  28037. const currentCellRef = ref();
  28038. const startYear = computed(() => {
  28039. return Math.floor(props.date.year() / 10) * 10;
  28040. });
  28041. const tableRows = ref([
  28042. [],
  28043. [],
  28044. []
  28045. ]);
  28046. const lastRow = ref();
  28047. const lastColumn = ref();
  28048. const rows = computed(() => {
  28049. const rows = tableRows.value;
  28050. const now = (0, import_dayjs_min.default)().locale(lang.value).startOf("year");
  28051. for (let i = 0; i < 3; i++) {
  28052. const row = rows[i];
  28053. for (let j = 0; j < 4; j++) {
  28054. if (i * 4 + j >= 10) break;
  28055. let cell = row[j];
  28056. if (!cell) cell = {
  28057. row: i,
  28058. column: j,
  28059. type: "normal",
  28060. inRange: false,
  28061. start: false,
  28062. end: false,
  28063. text: -1,
  28064. disabled: false,
  28065. isSelected: false,
  28066. customClass: void 0,
  28067. date: void 0,
  28068. dayjs: void 0,
  28069. isCurrent: void 0,
  28070. selected: void 0,
  28071. renderText: void 0,
  28072. timestamp: void 0
  28073. };
  28074. cell.type = "normal";
  28075. const index = i * 4 + j + startYear.value;
  28076. const calTime = (0, import_dayjs_min.default)().year(index);
  28077. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  28078. cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "year") && calEndDate && calTime.isSameOrBefore(calEndDate, "year")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "year") && calEndDate && calTime.isSameOrAfter(calEndDate, "year"));
  28079. if (props.minDate?.isSameOrAfter(calEndDate)) {
  28080. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  28081. cell.end = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  28082. } else {
  28083. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  28084. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  28085. }
  28086. if (now.isSame(calTime)) cell.type = "today";
  28087. cell.text = index;
  28088. const cellDate = calTime.toDate();
  28089. cell.disabled = props.disabledDate?.(cellDate) || false;
  28090. cell.date = cellDate;
  28091. cell.customClass = props.cellClassName?.(cellDate);
  28092. cell.dayjs = calTime;
  28093. cell.timestamp = calTime.valueOf();
  28094. cell.isSelected = isSelectedCell(cell);
  28095. row[j] = cell;
  28096. }
  28097. }
  28098. return rows;
  28099. });
  28100. const focus = () => {
  28101. currentCellRef.value?.focus();
  28102. };
  28103. const getCellKls = (cell) => {
  28104. const kls = {};
  28105. const today = (0, import_dayjs_min.default)().locale(lang.value);
  28106. const year = cell.text;
  28107. kls.disabled = props.disabled || (props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false);
  28108. kls.today = today.year() === year;
  28109. kls.current = castArray(props.parsedValue).some((d) => d.year() === year);
  28110. if (cell.customClass) kls[cell.customClass] = true;
  28111. if (cell.inRange) {
  28112. kls["in-range"] = true;
  28113. if (cell.start) kls["start-date"] = true;
  28114. if (cell.end) kls["end-date"] = true;
  28115. }
  28116. return kls;
  28117. };
  28118. const isSelectedCell = (cell) => {
  28119. const year = cell.text;
  28120. return castArray(props.date).some((date) => date.year() === year);
  28121. };
  28122. const handleYearTableClick = (event) => {
  28123. if (props.disabled) return;
  28124. const target = event.target?.closest("td");
  28125. if (!target || !target.textContent || hasClass(target, "disabled")) return;
  28126. const column = target.cellIndex;
  28127. const selectedYear = target.parentNode.rowIndex * 4 + column + startYear.value;
  28128. const newDate = (0, import_dayjs_min.default)().year(selectedYear);
  28129. if (props.selectionMode === "range") if (!props.rangeState.selecting) {
  28130. emit("pick", {
  28131. minDate: newDate,
  28132. maxDate: null
  28133. });
  28134. emit("select", true);
  28135. } else {
  28136. if (props.minDate && newDate >= props.minDate) emit("pick", {
  28137. minDate: props.minDate,
  28138. maxDate: newDate
  28139. });
  28140. else emit("pick", {
  28141. minDate: newDate,
  28142. maxDate: props.minDate
  28143. });
  28144. emit("select", false);
  28145. }
  28146. else if (props.selectionMode === "years") {
  28147. if (event.type === "keydown") {
  28148. emit("pick", castArray(props.parsedValue), false);
  28149. return;
  28150. }
  28151. const vaildYear = getValidDateOfYear(newDate.startOf("year"), lang.value, props.disabledDate);
  28152. emit("pick", hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => d?.year() !== selectedYear) : castArray(props.parsedValue).concat([vaildYear]));
  28153. } else emit("pick", selectedYear);
  28154. };
  28155. const handleMouseMove = (event) => {
  28156. if (!props.rangeState.selecting) return;
  28157. const target = event.target?.closest("td");
  28158. if (!target) return;
  28159. const row = target.parentNode.rowIndex;
  28160. const column = target.cellIndex;
  28161. if (rows.value[row][column].disabled) return;
  28162. if (row !== lastRow.value || column !== lastColumn.value) {
  28163. lastRow.value = row;
  28164. lastColumn.value = column;
  28165. emit("changerange", {
  28166. selecting: true,
  28167. endDate: (0, import_dayjs_min.default)().year(startYear.value).add(row * 4 + column, "year")
  28168. });
  28169. }
  28170. };
  28171. watch(() => props.date, async () => {
  28172. if (tbodyRef.value?.contains(document.activeElement)) {
  28173. await nextTick();
  28174. currentCellRef.value?.focus();
  28175. }
  28176. });
  28177. __expose({ focus });
  28178. return (_ctx, _cache) => {
  28179. return openBlock(), createElementBlock("table", {
  28180. role: "grid",
  28181. "aria-label": unref(t)("el.datepicker.yearTablePrompt"),
  28182. class: normalizeClass(unref(ns).b()),
  28183. onClick: handleYearTableClick,
  28184. onMousemove: handleMouseMove
  28185. }, [createElementVNode("tbody", {
  28186. ref_key: "tbodyRef",
  28187. ref: tbodyRef
  28188. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row, rowKey) => {
  28189. return openBlock(), createElementBlock("tr", { key: rowKey }, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, cellKey) => {
  28190. return openBlock(), createElementBlock("td", {
  28191. key: `${rowKey}_${cellKey}`,
  28192. ref_for: true,
  28193. ref: (el) => cell.isSelected && (currentCellRef.value = el),
  28194. class: normalizeClass(["available", getCellKls(cell)]),
  28195. "aria-selected": cell.isSelected,
  28196. "aria-label": String(cell.text),
  28197. tabindex: cell.isSelected ? 0 : -1,
  28198. onKeydown: [withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]), withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])]
  28199. }, [createVNode(unref(basic_cell_render_default), { cell }, null, 8, ["cell"])], 42, _hoisted_2$30);
  28200. }), 128))]);
  28201. }), 128))], 512)], 42, _hoisted_1$48);
  28202. };
  28203. }
  28204. });
  28205. //#endregion
  28206. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-year-table.vue
  28207. var basic_year_table_default = basic_year_table_vue_vue_type_script_setup_true_lang_default;
  28208. //#endregion
  28209. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue?vue&type=script&setup=true&lang.ts
  28210. const _hoisted_1$47 = ["disabled", "onClick"];
  28211. const _hoisted_2$29 = ["aria-label", "disabled"];
  28212. const _hoisted_3$14 = ["aria-label", "disabled"];
  28213. const _hoisted_4$11 = ["tabindex", "aria-disabled"];
  28214. const _hoisted_5$8 = ["tabindex", "aria-disabled"];
  28215. const _hoisted_6$3 = ["aria-label", "disabled"];
  28216. const _hoisted_7$2 = ["aria-label", "disabled"];
  28217. var panel_date_pick_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  28218. __name: "panel-date-pick",
  28219. props: panelDatePickProps,
  28220. emits: [
  28221. "pick",
  28222. "set-picker-option",
  28223. "panel-change"
  28224. ],
  28225. setup(__props, { emit: __emit }) {
  28226. const timeWithinRange = (_, __, ___) => true;
  28227. const props = __props;
  28228. const contextEmit = __emit;
  28229. const ppNs = useNamespace("picker-panel");
  28230. const dpNs = useNamespace("date-picker");
  28231. const attrs = useAttrs$1();
  28232. const slots = useSlots();
  28233. const { t, lang } = useLocale();
  28234. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  28235. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  28236. const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
  28237. const defaultValue = toRef(pickerBase.props, "defaultValue");
  28238. const currentViewRef = ref();
  28239. const innerDate = ref((0, import_dayjs_min.default)().locale(lang.value));
  28240. const isChangeToNow = ref(false);
  28241. let isShortcut = false;
  28242. const defaultTimeD = computed(() => {
  28243. return (0, import_dayjs_min.default)(defaultTime).locale(lang.value);
  28244. });
  28245. const month = computed(() => {
  28246. return innerDate.value.month();
  28247. });
  28248. const year = computed(() => {
  28249. return innerDate.value.year();
  28250. });
  28251. const selectableRange = ref([]);
  28252. const userInputDate = ref(null);
  28253. const userInputTime = ref(null);
  28254. const checkDateWithinRange = (date) => {
  28255. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  28256. };
  28257. const formatEmit = (emitDayjs) => {
  28258. if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  28259. if (showTime.value) return emitDayjs.millisecond(0);
  28260. return emitDayjs.startOf("day");
  28261. };
  28262. const emit = (value, ...args) => {
  28263. if (!value) contextEmit("pick", value, ...args);
  28264. else if (isArray$1(value)) contextEmit("pick", value.map(formatEmit), ...args);
  28265. else contextEmit("pick", formatEmit(value), ...args);
  28266. userInputDate.value = null;
  28267. userInputTime.value = null;
  28268. isChangeToNow.value = false;
  28269. isShortcut = false;
  28270. };
  28271. const handleDatePick = async (value, keepOpen) => {
  28272. if (selectionMode.value === "date" && import_dayjs_min.default.isDayjs(value)) {
  28273. const parsedDateValue = extractFirst(props.parsedValue);
  28274. let newDate = parsedDateValue ? parsedDateValue.year(value.year()).month(value.month()).date(value.date()) : value;
  28275. if (!checkDateWithinRange(newDate)) newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  28276. innerDate.value = newDate;
  28277. emit(newDate, showTime.value || keepOpen);
  28278. } else if (selectionMode.value === "week") emit(value.date);
  28279. else if (selectionMode.value === "dates") emit(value, true);
  28280. };
  28281. const moveByMonth = (forward) => {
  28282. const action = forward ? "add" : "subtract";
  28283. innerDate.value = innerDate.value[action](1, "month");
  28284. handlePanelChange("month");
  28285. };
  28286. const moveByYear = (forward) => {
  28287. const currentDate = innerDate.value;
  28288. const action = forward ? "add" : "subtract";
  28289. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  28290. handlePanelChange("year");
  28291. };
  28292. const currentView = ref("date");
  28293. const yearLabel = computed(() => {
  28294. const yearTranslation = t("el.datepicker.year");
  28295. if (currentView.value === "year") {
  28296. const startYear = Math.floor(year.value / 10) * 10;
  28297. if (yearTranslation) return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  28298. return `${startYear} - ${startYear + 9}`;
  28299. }
  28300. return `${year.value} ${yearTranslation}`;
  28301. });
  28302. const handleShortcutClick = (shortcut) => {
  28303. const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  28304. if (shortcutValue) {
  28305. isShortcut = true;
  28306. emit((0, import_dayjs_min.default)(shortcutValue).locale(lang.value));
  28307. return;
  28308. }
  28309. if (shortcut.onClick) shortcut.onClick({
  28310. attrs,
  28311. slots,
  28312. emit: contextEmit
  28313. });
  28314. };
  28315. const selectionMode = computed(() => {
  28316. const { type } = props;
  28317. if ([
  28318. "week",
  28319. "month",
  28320. "months",
  28321. "year",
  28322. "years",
  28323. "dates"
  28324. ].includes(type)) return type;
  28325. return "date";
  28326. });
  28327. const isMultipleType = computed(() => {
  28328. return selectionMode.value === "dates" || selectionMode.value === "months" || selectionMode.value === "years";
  28329. });
  28330. const keyboardMode = computed(() => {
  28331. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  28332. });
  28333. const hasShortcuts = computed(() => !!shortcuts.length);
  28334. const handleMonthPick = async (month, keepOpen) => {
  28335. if (selectionMode.value === "month") {
  28336. innerDate.value = getValidDateOfMonth(innerDate.value, innerDate.value.year(), month, lang.value, disabledDate);
  28337. emit(innerDate.value, false);
  28338. } else if (selectionMode.value === "months") emit(month, keepOpen ?? true);
  28339. else {
  28340. innerDate.value = getValidDateOfMonth(innerDate.value, innerDate.value.year(), month, lang.value, disabledDate);
  28341. currentView.value = "date";
  28342. if ([
  28343. "month",
  28344. "year",
  28345. "date",
  28346. "week"
  28347. ].includes(selectionMode.value)) {
  28348. emit(innerDate.value, true);
  28349. await nextTick();
  28350. handleFocusPicker();
  28351. }
  28352. }
  28353. handlePanelChange("month");
  28354. };
  28355. const handleYearPick = async (year, keepOpen) => {
  28356. if (selectionMode.value === "year") {
  28357. innerDate.value = getValidDateOfYear(innerDate.value.startOf("year").year(year), lang.value, disabledDate);
  28358. emit(innerDate.value, false);
  28359. } else if (selectionMode.value === "years") emit(year, keepOpen ?? true);
  28360. else {
  28361. innerDate.value = getValidDateOfYear(innerDate.value.year(year), lang.value, disabledDate);
  28362. currentView.value = "month";
  28363. if ([
  28364. "month",
  28365. "year",
  28366. "date",
  28367. "week"
  28368. ].includes(selectionMode.value)) {
  28369. emit(innerDate.value, true);
  28370. await nextTick();
  28371. handleFocusPicker();
  28372. }
  28373. }
  28374. handlePanelChange("year");
  28375. };
  28376. const dateDisabled = useFormDisabled();
  28377. const showPicker = async (view) => {
  28378. if (dateDisabled.value) return;
  28379. currentView.value = view;
  28380. await nextTick();
  28381. handleFocusPicker();
  28382. };
  28383. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  28384. const footerVisible = computed(() => {
  28385. const showDateFooter = showTime.value || selectionMode.value === "dates";
  28386. const showYearFooter = selectionMode.value === "years";
  28387. const showMonthFooter = selectionMode.value === "months";
  28388. const isDateView = currentView.value === "date";
  28389. const isYearView = currentView.value === "year";
  28390. const isMonthView = currentView.value === "month";
  28391. return showDateFooter && isDateView || showYearFooter && isYearView || showMonthFooter && isMonthView;
  28392. });
  28393. const footerFilled = computed(() => !isMultipleType.value && props.showNow || props.showConfirm);
  28394. const disabledConfirm = computed(() => {
  28395. if (!disabledDate) return false;
  28396. if (!props.parsedValue) return true;
  28397. if (isArray$1(props.parsedValue)) return disabledDate(props.parsedValue[0].toDate());
  28398. return disabledDate(props.parsedValue.toDate());
  28399. });
  28400. const onConfirm = () => {
  28401. if (isMultipleType.value) emit(props.parsedValue);
  28402. else {
  28403. let result = extractFirst(props.parsedValue);
  28404. if (!result) {
  28405. const defaultTimeD = (0, import_dayjs_min.default)(defaultTime).locale(lang.value);
  28406. const defaultValueD = getDefaultValue();
  28407. result = defaultTimeD.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  28408. }
  28409. innerDate.value = result;
  28410. emit(result);
  28411. }
  28412. };
  28413. const disabledNow = computed(() => {
  28414. if (!disabledDate) return false;
  28415. return disabledDate((0, import_dayjs_min.default)().locale(lang.value).toDate());
  28416. });
  28417. const changeToNow = () => {
  28418. const nowDate = (0, import_dayjs_min.default)().locale(lang.value).toDate();
  28419. isChangeToNow.value = true;
  28420. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  28421. innerDate.value = (0, import_dayjs_min.default)().locale(lang.value);
  28422. emit(innerDate.value);
  28423. }
  28424. };
  28425. const timeFormat = computed(() => {
  28426. return props.timeFormat || extractTimeFormat(props.format) || DEFAULT_FORMATS_TIME;
  28427. });
  28428. const dateFormat = computed(() => {
  28429. return props.dateFormat || extractDateFormat(props.format) || DEFAULT_FORMATS_DATE;
  28430. });
  28431. const visibleTime = computed(() => {
  28432. if (userInputTime.value) return userInputTime.value;
  28433. if (!props.parsedValue && !defaultValue.value) return;
  28434. return (extractFirst(props.parsedValue) || innerDate.value).format(timeFormat.value);
  28435. });
  28436. const visibleDate = computed(() => {
  28437. if (userInputDate.value) return userInputDate.value;
  28438. if (!props.parsedValue && !defaultValue.value) return;
  28439. return (extractFirst(props.parsedValue) || innerDate.value).format(dateFormat.value);
  28440. });
  28441. const timePickerVisible = ref(false);
  28442. const onTimePickerInputFocus = () => {
  28443. timePickerVisible.value = true;
  28444. };
  28445. const handleTimePickClose = () => {
  28446. timePickerVisible.value = false;
  28447. };
  28448. const getUnits = (date) => {
  28449. return {
  28450. hour: date.hour(),
  28451. minute: date.minute(),
  28452. second: date.second(),
  28453. year: date.year(),
  28454. month: date.month(),
  28455. date: date.date()
  28456. };
  28457. };
  28458. const handleTimePick = (value, visible, first) => {
  28459. const { hour, minute, second } = getUnits(value);
  28460. const parsedDateValue = extractFirst(props.parsedValue);
  28461. innerDate.value = parsedDateValue ? parsedDateValue.hour(hour).minute(minute).second(second) : value;
  28462. emit(innerDate.value, true);
  28463. if (!first) timePickerVisible.value = visible;
  28464. };
  28465. const handleVisibleTimeChange = (value) => {
  28466. const newDate = (0, import_dayjs_min.default)(value, timeFormat.value).locale(lang.value);
  28467. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  28468. const { year, month, date } = getUnits(innerDate.value);
  28469. innerDate.value = newDate.year(year).month(month).date(date);
  28470. userInputTime.value = null;
  28471. timePickerVisible.value = false;
  28472. emit(innerDate.value, true);
  28473. }
  28474. };
  28475. const handleVisibleDateChange = (value) => {
  28476. const newDate = correctlyParseUserInput(value, dateFormat.value, lang.value, isDefaultFormat);
  28477. if (newDate.isValid()) {
  28478. if (disabledDate && disabledDate(newDate.toDate())) return;
  28479. const { hour, minute, second } = getUnits(innerDate.value);
  28480. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  28481. userInputDate.value = null;
  28482. emit(innerDate.value, true);
  28483. }
  28484. };
  28485. const isValidValue = (date) => {
  28486. return import_dayjs_min.default.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  28487. };
  28488. const parseUserInput = (value) => {
  28489. return correctlyParseUserInput(value, props.format, lang.value, isDefaultFormat);
  28490. };
  28491. const getDefaultValue = () => {
  28492. const parseDate = (0, import_dayjs_min.default)(defaultValue.value).locale(lang.value);
  28493. if (!defaultValue.value) {
  28494. const defaultTimeDValue = defaultTimeD.value;
  28495. return (0, import_dayjs_min.default)().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  28496. }
  28497. return parseDate;
  28498. };
  28499. const handleFocusPicker = () => {
  28500. if ([
  28501. "week",
  28502. "month",
  28503. "year",
  28504. "date"
  28505. ].includes(selectionMode.value)) currentViewRef.value?.focus();
  28506. };
  28507. const _handleFocusPicker = () => {
  28508. handleFocusPicker();
  28509. if (selectionMode.value === "week") handleKeyControl(EVENT_CODE.down);
  28510. };
  28511. const handleKeydownTable = (event) => {
  28512. const code = getEventCode(event);
  28513. if ([
  28514. EVENT_CODE.up,
  28515. EVENT_CODE.down,
  28516. EVENT_CODE.left,
  28517. EVENT_CODE.right,
  28518. EVENT_CODE.home,
  28519. EVENT_CODE.end,
  28520. EVENT_CODE.pageUp,
  28521. EVENT_CODE.pageDown
  28522. ].includes(code)) {
  28523. handleKeyControl(code);
  28524. event.stopPropagation();
  28525. event.preventDefault();
  28526. }
  28527. if ([
  28528. EVENT_CODE.enter,
  28529. EVENT_CODE.space,
  28530. EVENT_CODE.numpadEnter
  28531. ].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  28532. event.preventDefault();
  28533. emit(innerDate.value, false);
  28534. }
  28535. };
  28536. const handleKeyControl = (code) => {
  28537. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  28538. const mapping = {
  28539. year: {
  28540. [up]: -4,
  28541. [down]: 4,
  28542. [left]: -1,
  28543. [right]: 1,
  28544. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  28545. },
  28546. month: {
  28547. [up]: -4,
  28548. [down]: 4,
  28549. [left]: -1,
  28550. [right]: 1,
  28551. offset: (date, step) => date.setMonth(date.getMonth() + step)
  28552. },
  28553. week: {
  28554. [up]: -1,
  28555. [down]: 1,
  28556. [left]: -1,
  28557. [right]: 1,
  28558. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  28559. },
  28560. date: {
  28561. [up]: -7,
  28562. [down]: 7,
  28563. [left]: -1,
  28564. [right]: 1,
  28565. [home]: (date) => -date.getDay(),
  28566. [end]: (date) => -date.getDay() + 6,
  28567. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  28568. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  28569. offset: (date, step) => date.setDate(date.getDate() + step)
  28570. }
  28571. };
  28572. const newDate = innerDate.value.toDate();
  28573. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  28574. const map = mapping[keyboardMode.value];
  28575. if (!map) return;
  28576. map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : map[code] ?? 0);
  28577. if (disabledDate && disabledDate(newDate)) break;
  28578. const result = (0, import_dayjs_min.default)(newDate).locale(lang.value);
  28579. innerDate.value = result;
  28580. contextEmit("pick", result, true);
  28581. break;
  28582. }
  28583. };
  28584. const handlePanelChange = (mode) => {
  28585. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  28586. };
  28587. watch(() => selectionMode.value, (val) => {
  28588. if (["month", "year"].includes(val)) {
  28589. currentView.value = val;
  28590. return;
  28591. } else if (val === "years") {
  28592. currentView.value = "year";
  28593. return;
  28594. } else if (val === "months") {
  28595. currentView.value = "month";
  28596. return;
  28597. }
  28598. currentView.value = "date";
  28599. }, { immediate: true });
  28600. watch(() => defaultValue.value, (val) => {
  28601. if (val) innerDate.value = getDefaultValue();
  28602. }, { immediate: true });
  28603. watch(() => props.parsedValue, (val) => {
  28604. if (val) {
  28605. if (isMultipleType.value) return;
  28606. if (isArray$1(val)) return;
  28607. innerDate.value = val;
  28608. } else innerDate.value = getDefaultValue();
  28609. }, { immediate: true });
  28610. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  28611. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  28612. contextEmit("set-picker-option", ["handleFocusPicker", _handleFocusPicker]);
  28613. return (_ctx, _cache) => {
  28614. return openBlock(), createElementBlock("div", { class: normalizeClass([
  28615. unref(ppNs).b(),
  28616. unref(dpNs).b(),
  28617. unref(ppNs).is("border", _ctx.border),
  28618. unref(ppNs).is("disabled", unref(dateDisabled)),
  28619. {
  28620. "has-sidebar": _ctx.$slots.sidebar || hasShortcuts.value,
  28621. "has-time": showTime.value
  28622. }
  28623. ]) }, [createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body-wrapper")) }, [
  28624. renderSlot(_ctx.$slots, "sidebar", { class: normalizeClass(unref(ppNs).e("sidebar")) }),
  28625. hasShortcuts.value ? (openBlock(), createElementBlock("div", {
  28626. key: 0,
  28627. class: normalizeClass(unref(ppNs).e("sidebar"))
  28628. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  28629. return openBlock(), createElementBlock("button", {
  28630. key,
  28631. type: "button",
  28632. disabled: unref(dateDisabled),
  28633. class: normalizeClass(unref(ppNs).e("shortcut")),
  28634. onClick: ($event) => handleShortcutClick(shortcut)
  28635. }, toDisplayString(shortcut.text), 11, _hoisted_1$47);
  28636. }), 128))], 2)) : createCommentVNode("v-if", true),
  28637. createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body")) }, [
  28638. showTime.value ? (openBlock(), createElementBlock("div", {
  28639. key: 0,
  28640. class: normalizeClass(unref(dpNs).e("time-header"))
  28641. }, [createElementVNode("span", { class: normalizeClass(unref(dpNs).e("editor-wrap")) }, [createVNode(unref(ElInput), {
  28642. placeholder: unref(t)("el.datepicker.selectDate"),
  28643. "model-value": visibleDate.value,
  28644. size: "small",
  28645. "validate-event": false,
  28646. disabled: unref(dateDisabled),
  28647. readonly: !_ctx.editable,
  28648. onInput: _cache[0] || (_cache[0] = (val) => userInputDate.value = val),
  28649. onChange: handleVisibleDateChange
  28650. }, null, 8, [
  28651. "placeholder",
  28652. "model-value",
  28653. "disabled",
  28654. "readonly"
  28655. ])], 2), withDirectives((openBlock(), createElementBlock("span", { class: normalizeClass(unref(dpNs).e("editor-wrap")) }, [createVNode(unref(ElInput), {
  28656. placeholder: unref(t)("el.datepicker.selectTime"),
  28657. "model-value": visibleTime.value,
  28658. size: "small",
  28659. "validate-event": false,
  28660. disabled: unref(dateDisabled),
  28661. readonly: !_ctx.editable,
  28662. onFocus: onTimePickerInputFocus,
  28663. onInput: _cache[1] || (_cache[1] = (val) => userInputTime.value = val),
  28664. onChange: handleVisibleTimeChange
  28665. }, null, 8, [
  28666. "placeholder",
  28667. "model-value",
  28668. "disabled",
  28669. "readonly"
  28670. ]), createVNode(unref(panel_time_pick_default), {
  28671. visible: timePickerVisible.value,
  28672. format: timeFormat.value,
  28673. "parsed-value": innerDate.value,
  28674. onPick: handleTimePick
  28675. }, null, 8, [
  28676. "visible",
  28677. "format",
  28678. "parsed-value"
  28679. ])], 2)), [[unref(ClickOutside), handleTimePickClose]])], 2)) : createCommentVNode("v-if", true),
  28680. withDirectives(createElementVNode("div", { class: normalizeClass([unref(dpNs).e("header"), (currentView.value === "year" || currentView.value === "month") && unref(dpNs).em("header", "bordered")]) }, [
  28681. createElementVNode("span", { class: normalizeClass(unref(dpNs).e("prev-btn")) }, [createElementVNode("button", {
  28682. type: "button",
  28683. "aria-label": unref(t)(`el.datepicker.prevYear`),
  28684. class: normalizeClass(["d-arrow-left", unref(ppNs).e("icon-btn")]),
  28685. disabled: unref(dateDisabled),
  28686. onClick: _cache[2] || (_cache[2] = ($event) => moveByYear(false))
  28687. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  28688. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  28689. _: 1
  28690. })])], 10, _hoisted_2$29), withDirectives(createElementVNode("button", {
  28691. type: "button",
  28692. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  28693. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  28694. disabled: unref(dateDisabled),
  28695. onClick: _cache[3] || (_cache[3] = ($event) => moveByMonth(false))
  28696. }, [renderSlot(_ctx.$slots, "prev-month", {}, () => [createVNode(unref(ElIcon), null, {
  28697. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  28698. _: 1
  28699. })])], 10, _hoisted_3$14), [[vShow, currentView.value === "date"]])], 2),
  28700. createElementVNode("span", {
  28701. role: "button",
  28702. class: normalizeClass(unref(dpNs).e("header-label")),
  28703. "aria-live": "polite",
  28704. tabindex: _ctx.disabled ? void 0 : 0,
  28705. "aria-disabled": _ctx.disabled,
  28706. onKeydown: _cache[4] || (_cache[4] = withKeys(($event) => showPicker("year"), ["enter"])),
  28707. onClick: _cache[5] || (_cache[5] = ($event) => showPicker("year"))
  28708. }, toDisplayString(yearLabel.value), 43, _hoisted_4$11),
  28709. withDirectives(createElementVNode("span", {
  28710. role: "button",
  28711. "aria-live": "polite",
  28712. tabindex: _ctx.disabled ? void 0 : 0,
  28713. "aria-disabled": _ctx.disabled,
  28714. class: normalizeClass([unref(dpNs).e("header-label"), { active: currentView.value === "month" }]),
  28715. onKeydown: _cache[6] || (_cache[6] = withKeys(($event) => showPicker("month"), ["enter"])),
  28716. onClick: _cache[7] || (_cache[7] = ($event) => showPicker("month"))
  28717. }, toDisplayString(unref(t)(`el.datepicker.month${month.value + 1}`)), 43, _hoisted_5$8), [[vShow, currentView.value === "date"]]),
  28718. createElementVNode("span", { class: normalizeClass(unref(dpNs).e("next-btn")) }, [withDirectives(createElementVNode("button", {
  28719. type: "button",
  28720. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  28721. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  28722. disabled: unref(dateDisabled),
  28723. onClick: _cache[8] || (_cache[8] = ($event) => moveByMonth(true))
  28724. }, [renderSlot(_ctx.$slots, "next-month", {}, () => [createVNode(unref(ElIcon), null, {
  28725. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  28726. _: 1
  28727. })])], 10, _hoisted_6$3), [[vShow, currentView.value === "date"]]), createElementVNode("button", {
  28728. type: "button",
  28729. "aria-label": unref(t)(`el.datepicker.nextYear`),
  28730. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28731. disabled: unref(dateDisabled),
  28732. onClick: _cache[9] || (_cache[9] = ($event) => moveByYear(true))
  28733. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  28734. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  28735. _: 1
  28736. })])], 10, _hoisted_7$2)], 2)
  28737. ], 2), [[vShow, currentView.value !== "time"]]),
  28738. createElementVNode("div", {
  28739. class: normalizeClass(unref(ppNs).e("content")),
  28740. onKeydown: handleKeydownTable
  28741. }, [
  28742. currentView.value === "date" ? (openBlock(), createBlock(basic_date_table_default, {
  28743. key: 0,
  28744. ref_key: "currentViewRef",
  28745. ref: currentViewRef,
  28746. "selection-mode": selectionMode.value,
  28747. date: innerDate.value,
  28748. "parsed-value": _ctx.parsedValue,
  28749. "disabled-date": unref(disabledDate),
  28750. disabled: unref(dateDisabled),
  28751. "cell-class-name": unref(cellClassName),
  28752. "show-week-number": _ctx.showWeekNumber,
  28753. onPick: handleDatePick
  28754. }, null, 8, [
  28755. "selection-mode",
  28756. "date",
  28757. "parsed-value",
  28758. "disabled-date",
  28759. "disabled",
  28760. "cell-class-name",
  28761. "show-week-number"
  28762. ])) : createCommentVNode("v-if", true),
  28763. currentView.value === "year" ? (openBlock(), createBlock(basic_year_table_default, {
  28764. key: 1,
  28765. ref_key: "currentViewRef",
  28766. ref: currentViewRef,
  28767. "selection-mode": selectionMode.value,
  28768. date: innerDate.value,
  28769. "disabled-date": unref(disabledDate),
  28770. disabled: unref(dateDisabled),
  28771. "parsed-value": _ctx.parsedValue,
  28772. "cell-class-name": unref(cellClassName),
  28773. onPick: handleYearPick
  28774. }, null, 8, [
  28775. "selection-mode",
  28776. "date",
  28777. "disabled-date",
  28778. "disabled",
  28779. "parsed-value",
  28780. "cell-class-name"
  28781. ])) : createCommentVNode("v-if", true),
  28782. currentView.value === "month" ? (openBlock(), createBlock(basic_month_table_default, {
  28783. key: 2,
  28784. ref_key: "currentViewRef",
  28785. ref: currentViewRef,
  28786. "selection-mode": selectionMode.value,
  28787. date: innerDate.value,
  28788. "parsed-value": _ctx.parsedValue,
  28789. "disabled-date": unref(disabledDate),
  28790. disabled: unref(dateDisabled),
  28791. "cell-class-name": unref(cellClassName),
  28792. onPick: handleMonthPick
  28793. }, null, 8, [
  28794. "selection-mode",
  28795. "date",
  28796. "parsed-value",
  28797. "disabled-date",
  28798. "disabled",
  28799. "cell-class-name"
  28800. ])) : createCommentVNode("v-if", true)
  28801. ], 34)
  28802. ], 2)
  28803. ], 2), _ctx.showFooter && footerVisible.value && footerFilled.value ? (openBlock(), createElementBlock("div", {
  28804. key: 0,
  28805. class: normalizeClass(unref(ppNs).e("footer"))
  28806. }, [withDirectives(createVNode(unref(ElButton), {
  28807. text: "",
  28808. size: "small",
  28809. class: normalizeClass(unref(ppNs).e("link-btn")),
  28810. disabled: disabledNow.value,
  28811. onClick: changeToNow
  28812. }, {
  28813. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.now")), 1)]),
  28814. _: 1
  28815. }, 8, ["class", "disabled"]), [[vShow, !isMultipleType.value && _ctx.showNow]]), _ctx.showConfirm ? (openBlock(), createBlock(unref(ElButton), {
  28816. key: 0,
  28817. plain: "",
  28818. size: "small",
  28819. class: normalizeClass(unref(ppNs).e("link-btn")),
  28820. disabled: disabledConfirm.value,
  28821. onClick: onConfirm
  28822. }, {
  28823. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)]),
  28824. _: 1
  28825. }, 8, ["class", "disabled"])) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true)], 2);
  28826. };
  28827. }
  28828. });
  28829. //#endregion
  28830. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue
  28831. var panel_date_pick_default = panel_date_pick_vue_vue_type_script_setup_true_lang_default;
  28832. //#endregion
  28833. //#region ../../packages/components/date-picker-panel/src/props/panel-date-range.ts
  28834. const panelDateRangeProps = buildProps({
  28835. ...panelSharedProps,
  28836. ...panelRangeSharedProps
  28837. });
  28838. //#endregion
  28839. //#region ../../packages/components/date-picker-panel/src/composables/use-shortcut.ts
  28840. const useShortcut = (lang) => {
  28841. const { emit } = getCurrentInstance();
  28842. const attrs = useAttrs$1();
  28843. const slots = useSlots();
  28844. const handleShortcutClick = (shortcut) => {
  28845. const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  28846. if (shortcutValues) {
  28847. emit("pick", [(0, import_dayjs_min.default)(shortcutValues[0]).locale(lang.value), (0, import_dayjs_min.default)(shortcutValues[1]).locale(lang.value)]);
  28848. return;
  28849. }
  28850. if (shortcut.onClick) shortcut.onClick({
  28851. attrs,
  28852. slots,
  28853. emit
  28854. });
  28855. };
  28856. return handleShortcutClick;
  28857. };
  28858. //#endregion
  28859. //#region ../../packages/components/date-picker-panel/src/composables/use-range-picker.ts
  28860. const useRangePicker = (props, { defaultValue, defaultTime, leftDate, rightDate, step, unit, sortDates }) => {
  28861. const { emit } = getCurrentInstance();
  28862. const { pickerNs } = inject(ROOT_PICKER_INJECTION_KEY);
  28863. const drpNs = useNamespace("date-range-picker");
  28864. const { t, lang } = useLocale();
  28865. const handleShortcutClick = useShortcut(lang);
  28866. const minDate = ref();
  28867. const maxDate = ref();
  28868. const rangeState = ref({
  28869. endDate: null,
  28870. selecting: false
  28871. });
  28872. const handleChangeRange = (val) => {
  28873. rangeState.value = val;
  28874. };
  28875. const handleRangeConfirm = (visible = false) => {
  28876. const _minDate = unref(minDate);
  28877. const _maxDate = unref(maxDate);
  28878. if (isValidRange([_minDate, _maxDate])) emit("pick", [_minDate, _maxDate], visible);
  28879. };
  28880. const onSelect = (selecting) => {
  28881. rangeState.value.selecting = selecting;
  28882. if (!selecting) rangeState.value.endDate = null;
  28883. };
  28884. const parseValue = (parsedValue) => {
  28885. if (isArray$1(parsedValue) && parsedValue.length === 2) {
  28886. const [start, end] = parsedValue;
  28887. minDate.value = start;
  28888. leftDate.value = start;
  28889. maxDate.value = end;
  28890. sortDates(unref(minDate), unref(maxDate));
  28891. } else restoreDefault();
  28892. };
  28893. const restoreDefault = () => {
  28894. let [start, end] = getDefaultValue(unref(defaultValue), {
  28895. lang: unref(lang),
  28896. step,
  28897. unit,
  28898. unlinkPanels: props.unlinkPanels
  28899. });
  28900. const getShift = (day) => {
  28901. return day.diff(day.startOf("d"), "ms");
  28902. };
  28903. const maybeTimes = unref(defaultTime);
  28904. if (maybeTimes) {
  28905. let leftShift = 0;
  28906. let rightShift = 0;
  28907. if (isArray$1(maybeTimes)) {
  28908. const [timeStart, timeEnd] = maybeTimes.map(import_dayjs_min.default);
  28909. leftShift = getShift(timeStart);
  28910. rightShift = getShift(timeEnd);
  28911. } else {
  28912. const shift = getShift((0, import_dayjs_min.default)(maybeTimes));
  28913. leftShift = shift;
  28914. rightShift = shift;
  28915. }
  28916. start = start.startOf("d").add(leftShift, "ms");
  28917. end = end.startOf("d").add(rightShift, "ms");
  28918. }
  28919. minDate.value = void 0;
  28920. maxDate.value = void 0;
  28921. leftDate.value = start;
  28922. rightDate.value = end;
  28923. };
  28924. watch(defaultValue, (val) => {
  28925. if (val) restoreDefault();
  28926. }, { immediate: true });
  28927. watch(() => props.parsedValue, (parsedValue) => {
  28928. if (!parsedValue?.length || !isEqual$1(parsedValue, [minDate.value, maxDate.value])) parseValue(parsedValue);
  28929. }, { immediate: true });
  28930. watch(() => props.visible, () => {
  28931. if (props.visible) parseValue(props.parsedValue);
  28932. }, { immediate: true });
  28933. return {
  28934. minDate,
  28935. maxDate,
  28936. rangeState,
  28937. lang,
  28938. ppNs: pickerNs,
  28939. drpNs,
  28940. handleChangeRange,
  28941. handleRangeConfirm,
  28942. handleShortcutClick,
  28943. onSelect,
  28944. parseValue,
  28945. t
  28946. };
  28947. };
  28948. //#endregion
  28949. //#region ../../packages/components/date-picker-panel/src/composables/use-panel-date-range.ts
  28950. const usePanelDateRange = (props, emit, leftDate, rightDate) => {
  28951. const leftCurrentView = ref("date");
  28952. const leftCurrentViewRef = ref();
  28953. const rightCurrentView = ref("date");
  28954. const rightCurrentViewRef = ref();
  28955. const { disabledDate } = inject(PICKER_BASE_INJECTION_KEY).props;
  28956. const { t, lang } = useLocale();
  28957. const leftYear = computed(() => {
  28958. return leftDate.value.year();
  28959. });
  28960. const leftMonth = computed(() => {
  28961. return leftDate.value.month();
  28962. });
  28963. const rightYear = computed(() => {
  28964. return rightDate.value.year();
  28965. });
  28966. const rightMonth = computed(() => {
  28967. return rightDate.value.month();
  28968. });
  28969. function computedYearLabel(currentView, yearValue) {
  28970. const yearTranslation = t("el.datepicker.year");
  28971. if (currentView.value === "year") {
  28972. const startYear = Math.floor(yearValue.value / 10) * 10;
  28973. return yearTranslation ? `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}` : `${startYear} - ${startYear + 9}`;
  28974. }
  28975. return `${yearValue.value} ${yearTranslation}`;
  28976. }
  28977. function focusPicker(currentViewRef) {
  28978. currentViewRef?.focus();
  28979. }
  28980. async function showPicker(pickerType, view) {
  28981. if (props.disabled) return;
  28982. const currentView = pickerType === "left" ? leftCurrentView : rightCurrentView;
  28983. const currentViewRef = pickerType === "left" ? leftCurrentViewRef : rightCurrentViewRef;
  28984. currentView.value = view;
  28985. await nextTick();
  28986. focusPicker(currentViewRef.value);
  28987. }
  28988. async function handlePick(mode, pickerType, value) {
  28989. if (props.disabled) return;
  28990. const isLeftPicker = pickerType === "left";
  28991. const startDate = isLeftPicker ? leftDate : rightDate;
  28992. const endDate = isLeftPicker ? rightDate : leftDate;
  28993. const currentView = isLeftPicker ? leftCurrentView : rightCurrentView;
  28994. const currentViewRef = isLeftPicker ? leftCurrentViewRef : rightCurrentViewRef;
  28995. if (mode === "year") startDate.value = getValidDateOfYear(startDate.value.year(value), lang.value, disabledDate);
  28996. if (mode === "month") startDate.value = getValidDateOfMonth(startDate.value, startDate.value.year(), value, lang.value, disabledDate);
  28997. if (!props.unlinkPanels) endDate.value = pickerType === "left" ? startDate.value.add(1, "month") : startDate.value.subtract(1, "month");
  28998. currentView.value = mode === "year" ? "month" : "date";
  28999. await nextTick();
  29000. focusPicker(currentViewRef.value);
  29001. handlePanelChange(mode);
  29002. }
  29003. function handlePanelChange(mode) {
  29004. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  29005. }
  29006. function adjustDateByView(currentView, date, forward) {
  29007. const action = forward ? "add" : "subtract";
  29008. return currentView === "year" ? date[action](10, "year") : date[action](1, "year");
  29009. }
  29010. return {
  29011. leftCurrentView,
  29012. rightCurrentView,
  29013. leftCurrentViewRef,
  29014. rightCurrentViewRef,
  29015. leftYear,
  29016. rightYear,
  29017. leftMonth,
  29018. rightMonth,
  29019. leftYearLabel: computed(() => computedYearLabel(leftCurrentView, leftYear)),
  29020. rightYearLabel: computed(() => computedYearLabel(rightCurrentView, rightYear)),
  29021. showLeftPicker: (view) => showPicker("left", view),
  29022. showRightPicker: (view) => showPicker("right", view),
  29023. handleLeftYearPick: (year) => handlePick("year", "left", year),
  29024. handleRightYearPick: (year) => handlePick("year", "right", year),
  29025. handleLeftMonthPick: (month) => handlePick("month", "left", month),
  29026. handleRightMonthPick: (month) => handlePick("month", "right", month),
  29027. handlePanelChange,
  29028. adjustDateByView
  29029. };
  29030. };
  29031. //#endregion
  29032. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-date-range.vue?vue&type=script&setup=true&lang.ts
  29033. const _hoisted_1$46 = ["disabled", "onClick"];
  29034. const _hoisted_2$28 = ["aria-label", "disabled"];
  29035. const _hoisted_3$13 = ["aria-label", "disabled"];
  29036. const _hoisted_4$10 = ["disabled", "aria-label"];
  29037. const _hoisted_5$7 = ["disabled", "aria-label"];
  29038. const _hoisted_6$2 = ["tabindex", "aria-disabled"];
  29039. const _hoisted_7$1 = ["tabindex", "aria-disabled"];
  29040. const _hoisted_8$1 = ["disabled", "aria-label"];
  29041. const _hoisted_9$1 = ["disabled", "aria-label"];
  29042. const _hoisted_10$1 = ["aria-label", "disabled"];
  29043. const _hoisted_11$1 = ["disabled", "aria-label"];
  29044. const _hoisted_12$1 = ["tabindex", "aria-disabled"];
  29045. const _hoisted_13$1 = ["tabindex", "aria-disabled"];
  29046. const unit$2 = "month";
  29047. var panel_date_range_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  29048. __name: "panel-date-range",
  29049. props: panelDateRangeProps,
  29050. emits: [
  29051. "pick",
  29052. "set-picker-option",
  29053. "calendar-change",
  29054. "panel-change",
  29055. "clear"
  29056. ],
  29057. setup(__props, { emit: __emit }) {
  29058. const props = __props;
  29059. const emit = __emit;
  29060. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  29061. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  29062. const { disabledDate, cellClassName, defaultTime, clearable } = pickerBase.props;
  29063. const format = toRef(pickerBase.props, "format");
  29064. const shortcuts = toRef(pickerBase.props, "shortcuts");
  29065. const defaultValue = toRef(pickerBase.props, "defaultValue");
  29066. const { lang } = useLocale();
  29067. const leftDate = ref((0, import_dayjs_min.default)().locale(lang.value));
  29068. const rightDate = ref((0, import_dayjs_min.default)().locale(lang.value).add(1, unit$2));
  29069. const { minDate, maxDate, rangeState, ppNs, drpNs, handleChangeRange, handleRangeConfirm, handleShortcutClick, onSelect, parseValue, t } = useRangePicker(props, {
  29070. defaultValue,
  29071. defaultTime,
  29072. leftDate,
  29073. rightDate,
  29074. unit: unit$2,
  29075. sortDates
  29076. });
  29077. watch(() => props.visible, (visible) => {
  29078. if (!visible && rangeState.value.selecting) {
  29079. parseValue(props.parsedValue);
  29080. onSelect(false);
  29081. }
  29082. });
  29083. const dateUserInput = ref({
  29084. min: null,
  29085. max: null
  29086. });
  29087. const timeUserInput = ref({
  29088. min: null,
  29089. max: null
  29090. });
  29091. const { leftCurrentView, rightCurrentView, leftCurrentViewRef, rightCurrentViewRef, leftYear, rightYear, leftMonth, rightMonth, leftYearLabel, rightYearLabel, showLeftPicker, showRightPicker, handleLeftYearPick, handleRightYearPick, handleLeftMonthPick, handleRightMonthPick, handlePanelChange, adjustDateByView } = usePanelDateRange(props, emit, leftDate, rightDate);
  29092. const hasShortcuts = computed(() => !!shortcuts.value.length);
  29093. const minVisibleDate = computed(() => {
  29094. if (dateUserInput.value.min !== null) return dateUserInput.value.min;
  29095. if (minDate.value) return minDate.value.format(dateFormat.value);
  29096. return "";
  29097. });
  29098. const maxVisibleDate = computed(() => {
  29099. if (dateUserInput.value.max !== null) return dateUserInput.value.max;
  29100. if (maxDate.value || minDate.value) return (maxDate.value || minDate.value).format(dateFormat.value);
  29101. return "";
  29102. });
  29103. const minVisibleTime = computed(() => {
  29104. if (timeUserInput.value.min !== null) return timeUserInput.value.min;
  29105. if (minDate.value) return minDate.value.format(timeFormat.value);
  29106. return "";
  29107. });
  29108. const maxVisibleTime = computed(() => {
  29109. if (timeUserInput.value.max !== null) return timeUserInput.value.max;
  29110. if (maxDate.value || minDate.value) return (maxDate.value || minDate.value).format(timeFormat.value);
  29111. return "";
  29112. });
  29113. const timeFormat = computed(() => {
  29114. return props.timeFormat || extractTimeFormat(format.value || "") || DEFAULT_FORMATS_TIME;
  29115. });
  29116. const dateFormat = computed(() => {
  29117. return props.dateFormat || extractDateFormat(format.value || "") || DEFAULT_FORMATS_DATE;
  29118. });
  29119. const isValidValue = (date) => {
  29120. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  29121. };
  29122. const leftPrevYear = () => {
  29123. leftDate.value = adjustDateByView(leftCurrentView.value, leftDate.value, false);
  29124. if (!props.unlinkPanels) rightDate.value = leftDate.value.add(1, "month");
  29125. handlePanelChange("year");
  29126. };
  29127. const leftPrevMonth = () => {
  29128. leftDate.value = leftDate.value.subtract(1, "month");
  29129. if (!props.unlinkPanels) rightDate.value = leftDate.value.add(1, "month");
  29130. handlePanelChange("month");
  29131. };
  29132. const rightNextYear = () => {
  29133. if (!props.unlinkPanels) {
  29134. leftDate.value = adjustDateByView(rightCurrentView.value, leftDate.value, true);
  29135. rightDate.value = leftDate.value.add(1, "month");
  29136. } else rightDate.value = adjustDateByView(rightCurrentView.value, rightDate.value, true);
  29137. handlePanelChange("year");
  29138. };
  29139. const rightNextMonth = () => {
  29140. if (!props.unlinkPanels) {
  29141. leftDate.value = leftDate.value.add(1, "month");
  29142. rightDate.value = leftDate.value.add(1, "month");
  29143. } else rightDate.value = rightDate.value.add(1, "month");
  29144. handlePanelChange("month");
  29145. };
  29146. const leftNextYear = () => {
  29147. leftDate.value = adjustDateByView(leftCurrentView.value, leftDate.value, true);
  29148. handlePanelChange("year");
  29149. };
  29150. const leftNextMonth = () => {
  29151. leftDate.value = leftDate.value.add(1, "month");
  29152. handlePanelChange("month");
  29153. };
  29154. const rightPrevYear = () => {
  29155. rightDate.value = adjustDateByView(rightCurrentView.value, rightDate.value, false);
  29156. handlePanelChange("year");
  29157. };
  29158. const rightPrevMonth = () => {
  29159. rightDate.value = rightDate.value.subtract(1, "month");
  29160. handlePanelChange("month");
  29161. };
  29162. const enableMonthArrow = computed(() => {
  29163. const nextMonth = (leftMonth.value + 1) % 12;
  29164. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  29165. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  29166. });
  29167. const enableYearArrow = computed(() => {
  29168. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  29169. });
  29170. const dateRangeDisabled = useFormDisabled();
  29171. const btnDisabled = computed(() => {
  29172. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]) && !dateRangeDisabled.value);
  29173. });
  29174. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  29175. const formatEmit = (emitDayjs, index) => {
  29176. if (!emitDayjs) return;
  29177. if (defaultTime) return (0, import_dayjs_min.default)(defaultTime[index] || defaultTime).locale(lang.value).year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  29178. return emitDayjs;
  29179. };
  29180. const handleRangePick = (val, close = true) => {
  29181. const min_ = val.minDate;
  29182. const max_ = val.maxDate;
  29183. const minDate_ = formatEmit(min_, 0);
  29184. const maxDate_ = formatEmit(max_, 1);
  29185. if (maxDate.value === maxDate_ && minDate.value === minDate_) return;
  29186. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  29187. maxDate.value = maxDate_;
  29188. minDate.value = minDate_;
  29189. if (!showTime.value && close) close = !minDate_ || !maxDate_;
  29190. handleRangeConfirm(close);
  29191. };
  29192. const minTimePickerVisible = ref(false);
  29193. const maxTimePickerVisible = ref(false);
  29194. const handleMinTimeClose = () => {
  29195. minTimePickerVisible.value = false;
  29196. };
  29197. const handleMaxTimeClose = () => {
  29198. maxTimePickerVisible.value = false;
  29199. };
  29200. const handleDateInput = (value, type) => {
  29201. dateUserInput.value[type] = value;
  29202. const parsedValueD = (0, import_dayjs_min.default)(value, dateFormat.value).locale(lang.value);
  29203. if (parsedValueD.isValid()) {
  29204. if (disabledDate && disabledDate(parsedValueD.toDate())) return;
  29205. if (type === "min") {
  29206. leftDate.value = parsedValueD;
  29207. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  29208. if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
  29209. rightDate.value = parsedValueD.add(1, "month");
  29210. maxDate.value = minDate.value.add(1, "month");
  29211. }
  29212. } else {
  29213. rightDate.value = parsedValueD;
  29214. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  29215. if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
  29216. leftDate.value = parsedValueD.subtract(1, "month");
  29217. minDate.value = maxDate.value.subtract(1, "month");
  29218. }
  29219. }
  29220. sortDates(minDate.value, maxDate.value);
  29221. handleRangeConfirm(true);
  29222. }
  29223. };
  29224. const handleDateChange = (_, type) => {
  29225. dateUserInput.value[type] = null;
  29226. };
  29227. const handleTimeInput = (value, type) => {
  29228. timeUserInput.value[type] = value;
  29229. const parsedValueD = (0, import_dayjs_min.default)(value, timeFormat.value).locale(lang.value);
  29230. if (parsedValueD.isValid()) if (type === "min") {
  29231. minTimePickerVisible.value = true;
  29232. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  29233. leftDate.value = minDate.value;
  29234. } else {
  29235. maxTimePickerVisible.value = true;
  29236. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  29237. rightDate.value = maxDate.value;
  29238. }
  29239. };
  29240. const handleTimeChange = (_value, type) => {
  29241. timeUserInput.value[type] = null;
  29242. if (type === "min") {
  29243. leftDate.value = minDate.value;
  29244. minTimePickerVisible.value = false;
  29245. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) maxDate.value = minDate.value;
  29246. } else {
  29247. rightDate.value = maxDate.value;
  29248. maxTimePickerVisible.value = false;
  29249. if (maxDate.value && maxDate.value.isBefore(minDate.value)) minDate.value = maxDate.value;
  29250. }
  29251. handleRangeConfirm(true);
  29252. };
  29253. const handleMinTimePick = (value, visible, first) => {
  29254. if (timeUserInput.value.min) return;
  29255. if (value) minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  29256. if (!first) minTimePickerVisible.value = visible;
  29257. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  29258. maxDate.value = minDate.value;
  29259. rightDate.value = value;
  29260. nextTick(() => {
  29261. parseValue(props.parsedValue);
  29262. });
  29263. }
  29264. handleRangeConfirm(true);
  29265. };
  29266. const handleMaxTimePick = (value, visible, first) => {
  29267. if (timeUserInput.value.max) return;
  29268. if (value) maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  29269. if (!first) maxTimePickerVisible.value = visible;
  29270. if (maxDate.value && maxDate.value.isBefore(minDate.value)) minDate.value = maxDate.value;
  29271. handleRangeConfirm(true);
  29272. };
  29273. const onClear = () => {
  29274. handleClear();
  29275. emit("clear");
  29276. };
  29277. const handleClear = () => {
  29278. let valueOnClear = null;
  29279. if (pickerBase?.emptyValues) valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  29280. leftDate.value = getDefaultValue(unref(defaultValue), {
  29281. lang: unref(lang),
  29282. unit: "month",
  29283. unlinkPanels: props.unlinkPanels
  29284. })[0];
  29285. rightDate.value = leftDate.value.add(1, "month");
  29286. maxDate.value = void 0;
  29287. minDate.value = void 0;
  29288. handleRangeConfirm(true);
  29289. emit("pick", valueOnClear);
  29290. };
  29291. const parseUserInput = (value) => {
  29292. return correctlyParseUserInput(value, format.value || "", lang.value, isDefaultFormat);
  29293. };
  29294. function sortDates(minDate, maxDate) {
  29295. if (props.unlinkPanels && maxDate) {
  29296. const minDateYear = minDate?.year() || 0;
  29297. const minDateMonth = minDate?.month() || 0;
  29298. const maxDateYear = maxDate.year();
  29299. const maxDateMonth = maxDate.month();
  29300. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate.add(1, unit$2) : maxDate;
  29301. } else {
  29302. rightDate.value = leftDate.value.add(1, unit$2);
  29303. if (maxDate) rightDate.value = rightDate.value.hour(maxDate.hour()).minute(maxDate.minute()).second(maxDate.second());
  29304. }
  29305. }
  29306. emit("set-picker-option", ["isValidValue", isValidValue]);
  29307. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  29308. emit("set-picker-option", ["handleClear", handleClear]);
  29309. return (_ctx, _cache) => {
  29310. return openBlock(), createElementBlock("div", { class: normalizeClass([
  29311. unref(ppNs).b(),
  29312. unref(drpNs).b(),
  29313. unref(ppNs).is("border", _ctx.border),
  29314. unref(ppNs).is("disabled", unref(dateRangeDisabled)),
  29315. {
  29316. "has-sidebar": _ctx.$slots.sidebar || hasShortcuts.value,
  29317. "has-time": showTime.value
  29318. }
  29319. ]) }, [createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body-wrapper")) }, [
  29320. renderSlot(_ctx.$slots, "sidebar", { class: normalizeClass(unref(ppNs).e("sidebar")) }),
  29321. hasShortcuts.value ? (openBlock(), createElementBlock("div", {
  29322. key: 0,
  29323. class: normalizeClass(unref(ppNs).e("sidebar"))
  29324. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(shortcuts.value, (shortcut, key) => {
  29325. return openBlock(), createElementBlock("button", {
  29326. key,
  29327. type: "button",
  29328. disabled: unref(dateRangeDisabled),
  29329. class: normalizeClass(unref(ppNs).e("shortcut")),
  29330. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  29331. }, toDisplayString(shortcut.text), 11, _hoisted_1$46);
  29332. }), 128))], 2)) : createCommentVNode("v-if", true),
  29333. createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body")) }, [
  29334. showTime.value ? (openBlock(), createElementBlock("div", {
  29335. key: 0,
  29336. class: normalizeClass(unref(drpNs).e("time-header"))
  29337. }, [
  29338. createElementVNode("span", { class: normalizeClass(unref(drpNs).e("editors-wrap")) }, [createElementVNode("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
  29339. size: "small",
  29340. disabled: unref(rangeState).selecting || unref(dateRangeDisabled),
  29341. placeholder: unref(t)("el.datepicker.startDate"),
  29342. class: normalizeClass(unref(drpNs).e("editor")),
  29343. "model-value": minVisibleDate.value,
  29344. "validate-event": false,
  29345. readonly: !_ctx.editable,
  29346. onInput: _cache[0] || (_cache[0] = (val) => handleDateInput(val, "min")),
  29347. onChange: _cache[1] || (_cache[1] = (val) => handleDateChange(val, "min"))
  29348. }, null, 8, [
  29349. "disabled",
  29350. "placeholder",
  29351. "class",
  29352. "model-value",
  29353. "readonly"
  29354. ])], 2), withDirectives((openBlock(), createElementBlock("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
  29355. size: "small",
  29356. class: normalizeClass(unref(drpNs).e("editor")),
  29357. disabled: unref(rangeState).selecting || unref(dateRangeDisabled),
  29358. placeholder: unref(t)("el.datepicker.startTime"),
  29359. "model-value": minVisibleTime.value,
  29360. "validate-event": false,
  29361. readonly: !_ctx.editable,
  29362. onFocus: _cache[2] || (_cache[2] = ($event) => minTimePickerVisible.value = true),
  29363. onInput: _cache[3] || (_cache[3] = (val) => handleTimeInput(val, "min")),
  29364. onChange: _cache[4] || (_cache[4] = (val) => handleTimeChange(val, "min"))
  29365. }, null, 8, [
  29366. "class",
  29367. "disabled",
  29368. "placeholder",
  29369. "model-value",
  29370. "readonly"
  29371. ]), createVNode(unref(panel_time_pick_default), {
  29372. visible: minTimePickerVisible.value,
  29373. format: timeFormat.value,
  29374. "datetime-role": "start",
  29375. "parsed-value": unref(minDate) || leftDate.value,
  29376. onPick: handleMinTimePick
  29377. }, null, 8, [
  29378. "visible",
  29379. "format",
  29380. "parsed-value"
  29381. ])], 2)), [[unref(ClickOutside), handleMinTimeClose]])], 2),
  29382. createElementVNode("span", null, [createVNode(unref(ElIcon), null, {
  29383. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  29384. _: 1
  29385. })]),
  29386. createElementVNode("span", { class: normalizeClass([unref(drpNs).e("editors-wrap"), "is-right"]) }, [createElementVNode("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
  29387. size: "small",
  29388. class: normalizeClass(unref(drpNs).e("editor")),
  29389. disabled: unref(rangeState).selecting || unref(dateRangeDisabled),
  29390. placeholder: unref(t)("el.datepicker.endDate"),
  29391. "model-value": maxVisibleDate.value,
  29392. readonly: !unref(minDate) || !_ctx.editable,
  29393. "validate-event": false,
  29394. onInput: _cache[5] || (_cache[5] = (val) => handleDateInput(val, "max")),
  29395. onChange: _cache[6] || (_cache[6] = (val) => handleDateChange(val, "max"))
  29396. }, null, 8, [
  29397. "class",
  29398. "disabled",
  29399. "placeholder",
  29400. "model-value",
  29401. "readonly"
  29402. ])], 2), withDirectives((openBlock(), createElementBlock("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
  29403. size: "small",
  29404. class: normalizeClass(unref(drpNs).e("editor")),
  29405. disabled: unref(rangeState).selecting || unref(dateRangeDisabled),
  29406. placeholder: unref(t)("el.datepicker.endTime"),
  29407. "model-value": maxVisibleTime.value,
  29408. readonly: !unref(minDate) || !_ctx.editable,
  29409. "validate-event": false,
  29410. onFocus: _cache[7] || (_cache[7] = ($event) => unref(minDate) && (maxTimePickerVisible.value = true)),
  29411. onInput: _cache[8] || (_cache[8] = (val) => handleTimeInput(val, "max")),
  29412. onChange: _cache[9] || (_cache[9] = (val) => handleTimeChange(val, "max"))
  29413. }, null, 8, [
  29414. "class",
  29415. "disabled",
  29416. "placeholder",
  29417. "model-value",
  29418. "readonly"
  29419. ]), createVNode(unref(panel_time_pick_default), {
  29420. "datetime-role": "end",
  29421. visible: maxTimePickerVisible.value,
  29422. format: timeFormat.value,
  29423. "parsed-value": unref(maxDate) || rightDate.value,
  29424. onPick: handleMaxTimePick
  29425. }, null, 8, [
  29426. "visible",
  29427. "format",
  29428. "parsed-value"
  29429. ])], 2)), [[unref(ClickOutside), handleMaxTimeClose]])], 2)
  29430. ], 2)) : createCommentVNode("v-if", true),
  29431. createElementVNode("div", { class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"]) }, [
  29432. createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  29433. createElementVNode("button", {
  29434. type: "button",
  29435. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  29436. "aria-label": unref(t)(`el.datepicker.prevYear`),
  29437. disabled: unref(dateRangeDisabled),
  29438. onClick: leftPrevYear
  29439. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  29440. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  29441. _: 1
  29442. })])], 10, _hoisted_2$28),
  29443. withDirectives(createElementVNode("button", {
  29444. type: "button",
  29445. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  29446. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  29447. disabled: unref(dateRangeDisabled),
  29448. onClick: leftPrevMonth
  29449. }, [renderSlot(_ctx.$slots, "prev-month", {}, () => [createVNode(unref(ElIcon), null, {
  29450. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  29451. _: 1
  29452. })])], 10, _hoisted_3$13), [[vShow, unref(leftCurrentView) === "date"]]),
  29453. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  29454. key: 0,
  29455. type: "button",
  29456. disabled: !enableYearArrow.value || unref(dateRangeDisabled),
  29457. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableYearArrow.value || unref(dateRangeDisabled))], "d-arrow-right"]),
  29458. "aria-label": unref(t)(`el.datepicker.nextYear`),
  29459. onClick: leftNextYear
  29460. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  29461. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  29462. _: 1
  29463. })])], 10, _hoisted_4$10)) : createCommentVNode("v-if", true),
  29464. _ctx.unlinkPanels && unref(leftCurrentView) === "date" ? (openBlock(), createElementBlock("button", {
  29465. key: 1,
  29466. type: "button",
  29467. disabled: !enableMonthArrow.value || unref(dateRangeDisabled),
  29468. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableMonthArrow.value || unref(dateRangeDisabled))], "arrow-right"]),
  29469. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  29470. onClick: leftNextMonth
  29471. }, [renderSlot(_ctx.$slots, "next-month", {}, () => [createVNode(unref(ElIcon), null, {
  29472. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  29473. _: 1
  29474. })])], 10, _hoisted_5$7)) : createCommentVNode("v-if", true),
  29475. createElementVNode("div", null, [createElementVNode("span", {
  29476. role: "button",
  29477. class: normalizeClass(unref(drpNs).e("header-label")),
  29478. "aria-live": "polite",
  29479. tabindex: _ctx.disabled ? void 0 : 0,
  29480. "aria-disabled": _ctx.disabled,
  29481. onKeydown: _cache[10] || (_cache[10] = withKeys(($event) => unref(showLeftPicker)("year"), ["enter"])),
  29482. onClick: _cache[11] || (_cache[11] = ($event) => unref(showLeftPicker)("year"))
  29483. }, toDisplayString(unref(leftYearLabel)), 43, _hoisted_6$2), withDirectives(createElementVNode("span", {
  29484. role: "button",
  29485. "aria-live": "polite",
  29486. tabindex: _ctx.disabled ? void 0 : 0,
  29487. "aria-disabled": _ctx.disabled,
  29488. class: normalizeClass([unref(drpNs).e("header-label"), { active: unref(leftCurrentView) === "month" }]),
  29489. onKeydown: _cache[12] || (_cache[12] = withKeys(($event) => unref(showLeftPicker)("month"), ["enter"])),
  29490. onClick: _cache[13] || (_cache[13] = ($event) => unref(showLeftPicker)("month"))
  29491. }, toDisplayString(unref(t)(`el.datepicker.month${leftDate.value.month() + 1}`)), 43, _hoisted_7$1), [[vShow, unref(leftCurrentView) === "date"]])])
  29492. ], 2),
  29493. unref(leftCurrentView) === "date" ? (openBlock(), createBlock(basic_date_table_default, {
  29494. key: 0,
  29495. ref_key: "leftCurrentViewRef",
  29496. ref: leftCurrentViewRef,
  29497. "selection-mode": "range",
  29498. date: leftDate.value,
  29499. "min-date": unref(minDate),
  29500. "max-date": unref(maxDate),
  29501. "range-state": unref(rangeState),
  29502. "disabled-date": unref(disabledDate),
  29503. "cell-class-name": unref(cellClassName),
  29504. "show-week-number": _ctx.showWeekNumber,
  29505. disabled: unref(dateRangeDisabled),
  29506. onChangerange: unref(handleChangeRange),
  29507. onPick: handleRangePick,
  29508. onSelect: unref(onSelect)
  29509. }, null, 8, [
  29510. "date",
  29511. "min-date",
  29512. "max-date",
  29513. "range-state",
  29514. "disabled-date",
  29515. "cell-class-name",
  29516. "show-week-number",
  29517. "disabled",
  29518. "onChangerange",
  29519. "onSelect"
  29520. ])) : createCommentVNode("v-if", true),
  29521. unref(leftCurrentView) === "year" ? (openBlock(), createBlock(basic_year_table_default, {
  29522. key: 1,
  29523. ref_key: "leftCurrentViewRef",
  29524. ref: leftCurrentViewRef,
  29525. "selection-mode": "year",
  29526. date: leftDate.value,
  29527. "disabled-date": unref(disabledDate),
  29528. "parsed-value": _ctx.parsedValue,
  29529. disabled: unref(dateRangeDisabled),
  29530. onPick: unref(handleLeftYearPick)
  29531. }, null, 8, [
  29532. "date",
  29533. "disabled-date",
  29534. "parsed-value",
  29535. "disabled",
  29536. "onPick"
  29537. ])) : createCommentVNode("v-if", true),
  29538. unref(leftCurrentView) === "month" ? (openBlock(), createBlock(basic_month_table_default, {
  29539. key: 2,
  29540. ref_key: "leftCurrentViewRef",
  29541. ref: leftCurrentViewRef,
  29542. "selection-mode": "month",
  29543. date: leftDate.value,
  29544. "parsed-value": _ctx.parsedValue,
  29545. "disabled-date": unref(disabledDate),
  29546. disabled: unref(dateRangeDisabled),
  29547. onPick: unref(handleLeftMonthPick)
  29548. }, null, 8, [
  29549. "date",
  29550. "parsed-value",
  29551. "disabled-date",
  29552. "disabled",
  29553. "onPick"
  29554. ])) : createCommentVNode("v-if", true)
  29555. ], 2),
  29556. createElementVNode("div", { class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"]) }, [
  29557. createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  29558. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  29559. key: 0,
  29560. type: "button",
  29561. disabled: !enableYearArrow.value || unref(dateRangeDisabled),
  29562. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableYearArrow.value || unref(dateRangeDisabled))], "d-arrow-left"]),
  29563. "aria-label": unref(t)(`el.datepicker.prevYear`),
  29564. onClick: rightPrevYear
  29565. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  29566. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  29567. _: 1
  29568. })])], 10, _hoisted_8$1)) : createCommentVNode("v-if", true),
  29569. _ctx.unlinkPanels && unref(rightCurrentView) === "date" ? (openBlock(), createElementBlock("button", {
  29570. key: 1,
  29571. type: "button",
  29572. disabled: !enableMonthArrow.value || unref(dateRangeDisabled),
  29573. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableMonthArrow.value || unref(dateRangeDisabled))], "arrow-left"]),
  29574. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  29575. onClick: rightPrevMonth
  29576. }, [renderSlot(_ctx.$slots, "prev-month", {}, () => [createVNode(unref(ElIcon), null, {
  29577. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  29578. _: 1
  29579. })])], 10, _hoisted_9$1)) : createCommentVNode("v-if", true),
  29580. createElementVNode("button", {
  29581. type: "button",
  29582. "aria-label": unref(t)(`el.datepicker.nextYear`),
  29583. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  29584. disabled: unref(dateRangeDisabled),
  29585. onClick: rightNextYear
  29586. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  29587. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  29588. _: 1
  29589. })])], 10, _hoisted_10$1),
  29590. withDirectives(createElementVNode("button", {
  29591. type: "button",
  29592. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  29593. disabled: unref(dateRangeDisabled),
  29594. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  29595. onClick: rightNextMonth
  29596. }, [renderSlot(_ctx.$slots, "next-month", {}, () => [createVNode(unref(ElIcon), null, {
  29597. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  29598. _: 1
  29599. })])], 10, _hoisted_11$1), [[vShow, unref(rightCurrentView) === "date"]]),
  29600. createElementVNode("div", null, [createElementVNode("span", {
  29601. role: "button",
  29602. class: normalizeClass(unref(drpNs).e("header-label")),
  29603. "aria-live": "polite",
  29604. tabindex: _ctx.disabled ? void 0 : 0,
  29605. "aria-disabled": _ctx.disabled,
  29606. onKeydown: _cache[14] || (_cache[14] = withKeys(($event) => unref(showRightPicker)("year"), ["enter"])),
  29607. onClick: _cache[15] || (_cache[15] = ($event) => unref(showRightPicker)("year"))
  29608. }, toDisplayString(unref(rightYearLabel)), 43, _hoisted_12$1), withDirectives(createElementVNode("span", {
  29609. role: "button",
  29610. "aria-live": "polite",
  29611. tabindex: _ctx.disabled ? void 0 : 0,
  29612. "aria-disabled": _ctx.disabled,
  29613. class: normalizeClass([unref(drpNs).e("header-label"), { active: unref(rightCurrentView) === "month" }]),
  29614. onKeydown: _cache[16] || (_cache[16] = withKeys(($event) => unref(showRightPicker)("month"), ["enter"])),
  29615. onClick: _cache[17] || (_cache[17] = ($event) => unref(showRightPicker)("month"))
  29616. }, toDisplayString(unref(t)(`el.datepicker.month${rightDate.value.month() + 1}`)), 43, _hoisted_13$1), [[vShow, unref(rightCurrentView) === "date"]])])
  29617. ], 2),
  29618. unref(rightCurrentView) === "date" ? (openBlock(), createBlock(basic_date_table_default, {
  29619. key: 0,
  29620. ref_key: "rightCurrentViewRef",
  29621. ref: rightCurrentViewRef,
  29622. "selection-mode": "range",
  29623. date: rightDate.value,
  29624. "min-date": unref(minDate),
  29625. "max-date": unref(maxDate),
  29626. "range-state": unref(rangeState),
  29627. "disabled-date": unref(disabledDate),
  29628. "cell-class-name": unref(cellClassName),
  29629. "show-week-number": _ctx.showWeekNumber,
  29630. disabled: unref(dateRangeDisabled),
  29631. onChangerange: unref(handleChangeRange),
  29632. onPick: handleRangePick,
  29633. onSelect: unref(onSelect)
  29634. }, null, 8, [
  29635. "date",
  29636. "min-date",
  29637. "max-date",
  29638. "range-state",
  29639. "disabled-date",
  29640. "cell-class-name",
  29641. "show-week-number",
  29642. "disabled",
  29643. "onChangerange",
  29644. "onSelect"
  29645. ])) : createCommentVNode("v-if", true),
  29646. unref(rightCurrentView) === "year" ? (openBlock(), createBlock(basic_year_table_default, {
  29647. key: 1,
  29648. ref_key: "rightCurrentViewRef",
  29649. ref: rightCurrentViewRef,
  29650. "selection-mode": "year",
  29651. date: rightDate.value,
  29652. "disabled-date": unref(disabledDate),
  29653. "parsed-value": _ctx.parsedValue,
  29654. disabled: unref(dateRangeDisabled),
  29655. onPick: unref(handleRightYearPick)
  29656. }, null, 8, [
  29657. "date",
  29658. "disabled-date",
  29659. "parsed-value",
  29660. "disabled",
  29661. "onPick"
  29662. ])) : createCommentVNode("v-if", true),
  29663. unref(rightCurrentView) === "month" ? (openBlock(), createBlock(basic_month_table_default, {
  29664. key: 2,
  29665. ref_key: "rightCurrentViewRef",
  29666. ref: rightCurrentViewRef,
  29667. "selection-mode": "month",
  29668. date: rightDate.value,
  29669. "parsed-value": _ctx.parsedValue,
  29670. "disabled-date": unref(disabledDate),
  29671. disabled: unref(dateRangeDisabled),
  29672. onPick: unref(handleRightMonthPick)
  29673. }, null, 8, [
  29674. "date",
  29675. "parsed-value",
  29676. "disabled-date",
  29677. "disabled",
  29678. "onPick"
  29679. ])) : createCommentVNode("v-if", true)
  29680. ], 2)
  29681. ], 2)
  29682. ], 2), _ctx.showFooter && showTime.value && (_ctx.showConfirm || unref(clearable)) ? (openBlock(), createElementBlock("div", {
  29683. key: 0,
  29684. class: normalizeClass(unref(ppNs).e("footer"))
  29685. }, [unref(clearable) ? (openBlock(), createBlock(unref(ElButton), {
  29686. key: 0,
  29687. text: "",
  29688. size: "small",
  29689. class: normalizeClass(unref(ppNs).e("link-btn")),
  29690. onClick: onClear
  29691. }, {
  29692. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.clear")), 1)]),
  29693. _: 1
  29694. }, 8, ["class"])) : createCommentVNode("v-if", true), _ctx.showConfirm ? (openBlock(), createBlock(unref(ElButton), {
  29695. key: 1,
  29696. plain: "",
  29697. size: "small",
  29698. class: normalizeClass(unref(ppNs).e("link-btn")),
  29699. disabled: btnDisabled.value,
  29700. onClick: _cache[18] || (_cache[18] = ($event) => unref(handleRangeConfirm)(false))
  29701. }, {
  29702. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)]),
  29703. _: 1
  29704. }, 8, ["class", "disabled"])) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true)], 2);
  29705. };
  29706. }
  29707. });
  29708. //#endregion
  29709. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-date-range.vue
  29710. var panel_date_range_default = panel_date_range_vue_vue_type_script_setup_true_lang_default;
  29711. //#endregion
  29712. //#region ../../packages/components/date-picker-panel/src/props/panel-month-range.ts
  29713. const panelMonthRangeProps = buildProps({ ...panelRangeSharedProps });
  29714. const panelMonthRangeEmits = [
  29715. "pick",
  29716. "set-picker-option",
  29717. "calendar-change"
  29718. ];
  29719. //#endregion
  29720. //#region ../../packages/components/date-picker-panel/src/composables/use-month-range-header.ts
  29721. const useMonthRangeHeader = ({ unlinkPanels, leftDate, rightDate }) => {
  29722. const { t } = useLocale();
  29723. const leftPrevYear = () => {
  29724. leftDate.value = leftDate.value.subtract(1, "year");
  29725. if (!unlinkPanels.value) rightDate.value = rightDate.value.subtract(1, "year");
  29726. };
  29727. const rightNextYear = () => {
  29728. if (!unlinkPanels.value) leftDate.value = leftDate.value.add(1, "year");
  29729. rightDate.value = rightDate.value.add(1, "year");
  29730. };
  29731. const leftNextYear = () => {
  29732. leftDate.value = leftDate.value.add(1, "year");
  29733. };
  29734. const rightPrevYear = () => {
  29735. rightDate.value = rightDate.value.subtract(1, "year");
  29736. };
  29737. return {
  29738. leftPrevYear,
  29739. rightNextYear,
  29740. leftNextYear,
  29741. rightPrevYear,
  29742. leftLabel: computed(() => {
  29743. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  29744. }),
  29745. rightLabel: computed(() => {
  29746. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  29747. }),
  29748. leftYear: computed(() => {
  29749. return leftDate.value.year();
  29750. }),
  29751. rightYear: computed(() => {
  29752. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  29753. })
  29754. };
  29755. };
  29756. //#endregion
  29757. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-month-range.vue?vue&type=script&setup=true&lang.ts
  29758. const _hoisted_1$45 = ["disabled", "onClick"];
  29759. const _hoisted_2$27 = ["disabled"];
  29760. const _hoisted_3$12 = ["disabled"];
  29761. const _hoisted_4$9 = ["disabled"];
  29762. const _hoisted_5$6 = ["disabled"];
  29763. const unit$1 = "year";
  29764. var panel_month_range_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  29765. name: "DatePickerMonthRange",
  29766. __name: "panel-month-range",
  29767. props: panelMonthRangeProps,
  29768. emits: panelMonthRangeEmits,
  29769. setup(__props, { emit: __emit }) {
  29770. const props = __props;
  29771. const emit = __emit;
  29772. const { lang } = useLocale();
  29773. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  29774. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  29775. const { shortcuts, disabledDate, cellClassName } = pickerBase.props;
  29776. const format = toRef(pickerBase.props, "format");
  29777. const defaultValue = toRef(pickerBase.props, "defaultValue");
  29778. const leftDate = ref((0, import_dayjs_min.default)().locale(lang.value));
  29779. const rightDate = ref((0, import_dayjs_min.default)().locale(lang.value).add(1, unit$1));
  29780. const { minDate, maxDate, rangeState, ppNs, drpNs, handleChangeRange, handleRangeConfirm, handleShortcutClick, onSelect, parseValue } = useRangePicker(props, {
  29781. defaultValue,
  29782. leftDate,
  29783. rightDate,
  29784. unit: unit$1,
  29785. sortDates
  29786. });
  29787. const hasShortcuts = computed(() => !!shortcuts.length);
  29788. const { leftPrevYear, rightNextYear, leftNextYear, rightPrevYear, leftLabel, rightLabel, leftYear, rightYear } = useMonthRangeHeader({
  29789. unlinkPanels: toRef(props, "unlinkPanels"),
  29790. leftDate,
  29791. rightDate
  29792. });
  29793. const enableYearArrow = computed(() => {
  29794. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  29795. });
  29796. const handleRangePick = (val, close = true) => {
  29797. const minDate_ = val.minDate;
  29798. const maxDate_ = val.maxDate;
  29799. if (maxDate.value === maxDate_ && minDate.value === minDate_) return;
  29800. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  29801. maxDate.value = maxDate_;
  29802. minDate.value = minDate_;
  29803. if (!close) return;
  29804. handleRangeConfirm();
  29805. };
  29806. const handleClear = () => {
  29807. let valueOnClear = null;
  29808. if (pickerBase?.emptyValues) valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  29809. leftDate.value = getDefaultValue(unref(defaultValue), {
  29810. lang: unref(lang),
  29811. unit: "year",
  29812. unlinkPanels: props.unlinkPanels
  29813. })[0];
  29814. rightDate.value = leftDate.value.add(1, "year");
  29815. emit("pick", valueOnClear);
  29816. };
  29817. const parseUserInput = (value) => {
  29818. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  29819. };
  29820. function sortDates(minDate, maxDate) {
  29821. if (props.unlinkPanels && maxDate) rightDate.value = (minDate?.year() || 0) === maxDate.year() ? maxDate.add(1, unit$1) : maxDate;
  29822. else rightDate.value = leftDate.value.add(1, unit$1);
  29823. }
  29824. const monthRangeDisabled = useFormDisabled();
  29825. watch(() => props.visible, (visible) => {
  29826. if (!visible && rangeState.value.selecting) {
  29827. parseValue(props.parsedValue);
  29828. onSelect(false);
  29829. }
  29830. });
  29831. emit("set-picker-option", ["isValidValue", isValidRange]);
  29832. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  29833. emit("set-picker-option", ["handleClear", handleClear]);
  29834. return (_ctx, _cache) => {
  29835. return openBlock(), createElementBlock("div", { class: normalizeClass([
  29836. unref(ppNs).b(),
  29837. unref(drpNs).b(),
  29838. unref(ppNs).is("border", _ctx.border),
  29839. unref(ppNs).is("disabled", unref(monthRangeDisabled)),
  29840. { "has-sidebar": Boolean(_ctx.$slots.sidebar) || hasShortcuts.value }
  29841. ]) }, [createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body-wrapper")) }, [
  29842. renderSlot(_ctx.$slots, "sidebar", { class: normalizeClass(unref(ppNs).e("sidebar")) }),
  29843. hasShortcuts.value ? (openBlock(), createElementBlock("div", {
  29844. key: 0,
  29845. class: normalizeClass(unref(ppNs).e("sidebar"))
  29846. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  29847. return openBlock(), createElementBlock("button", {
  29848. key,
  29849. type: "button",
  29850. class: normalizeClass(unref(ppNs).e("shortcut")),
  29851. disabled: unref(monthRangeDisabled),
  29852. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  29853. }, toDisplayString(shortcut.text), 11, _hoisted_1$45);
  29854. }), 128))], 2)) : createCommentVNode("v-if", true),
  29855. createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body")) }, [createElementVNode("div", { class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"]) }, [createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  29856. createElementVNode("button", {
  29857. type: "button",
  29858. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  29859. disabled: unref(monthRangeDisabled),
  29860. onClick: _cache[0] || (_cache[0] = (...args) => unref(leftPrevYear) && unref(leftPrevYear)(...args))
  29861. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  29862. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  29863. _: 1
  29864. })])], 10, _hoisted_2$27),
  29865. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  29866. key: 0,
  29867. type: "button",
  29868. disabled: !enableYearArrow.value || unref(monthRangeDisabled),
  29869. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableYearArrow.value || unref(monthRangeDisabled))], "d-arrow-right"]),
  29870. onClick: _cache[1] || (_cache[1] = (...args) => unref(leftNextYear) && unref(leftNextYear)(...args))
  29871. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  29872. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  29873. _: 1
  29874. })])], 10, _hoisted_3$12)) : createCommentVNode("v-if", true),
  29875. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  29876. ], 2), createVNode(basic_month_table_default, {
  29877. "selection-mode": "range",
  29878. date: leftDate.value,
  29879. "min-date": unref(minDate),
  29880. "max-date": unref(maxDate),
  29881. "range-state": unref(rangeState),
  29882. "disabled-date": unref(disabledDate),
  29883. disabled: unref(monthRangeDisabled),
  29884. "cell-class-name": unref(cellClassName),
  29885. onChangerange: unref(handleChangeRange),
  29886. onPick: handleRangePick,
  29887. onSelect: unref(onSelect)
  29888. }, null, 8, [
  29889. "date",
  29890. "min-date",
  29891. "max-date",
  29892. "range-state",
  29893. "disabled-date",
  29894. "disabled",
  29895. "cell-class-name",
  29896. "onChangerange",
  29897. "onSelect"
  29898. ])], 2), createElementVNode("div", { class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"]) }, [createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  29899. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  29900. key: 0,
  29901. type: "button",
  29902. disabled: !enableYearArrow.value || unref(monthRangeDisabled),
  29903. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableYearArrow.value || unref(monthRangeDisabled))], "d-arrow-left"]),
  29904. onClick: _cache[2] || (_cache[2] = (...args) => unref(rightPrevYear) && unref(rightPrevYear)(...args))
  29905. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  29906. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  29907. _: 1
  29908. })])], 10, _hoisted_4$9)) : createCommentVNode("v-if", true),
  29909. createElementVNode("button", {
  29910. type: "button",
  29911. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  29912. disabled: unref(monthRangeDisabled),
  29913. onClick: _cache[3] || (_cache[3] = (...args) => unref(rightNextYear) && unref(rightNextYear)(...args))
  29914. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  29915. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  29916. _: 1
  29917. })])], 10, _hoisted_5$6),
  29918. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  29919. ], 2), createVNode(basic_month_table_default, {
  29920. "selection-mode": "range",
  29921. date: rightDate.value,
  29922. "min-date": unref(minDate),
  29923. "max-date": unref(maxDate),
  29924. "range-state": unref(rangeState),
  29925. "disabled-date": unref(disabledDate),
  29926. disabled: unref(monthRangeDisabled),
  29927. "cell-class-name": unref(cellClassName),
  29928. onChangerange: unref(handleChangeRange),
  29929. onPick: handleRangePick,
  29930. onSelect: unref(onSelect)
  29931. }, null, 8, [
  29932. "date",
  29933. "min-date",
  29934. "max-date",
  29935. "range-state",
  29936. "disabled-date",
  29937. "disabled",
  29938. "cell-class-name",
  29939. "onChangerange",
  29940. "onSelect"
  29941. ])], 2)], 2)
  29942. ], 2)], 2);
  29943. };
  29944. }
  29945. });
  29946. //#endregion
  29947. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-month-range.vue
  29948. var panel_month_range_default = panel_month_range_vue_vue_type_script_setup_true_lang_default;
  29949. //#endregion
  29950. //#region ../../packages/components/date-picker-panel/src/props/panel-year-range.ts
  29951. const panelYearRangeProps = buildProps({ ...panelRangeSharedProps });
  29952. const panelYearRangeEmits = [
  29953. "pick",
  29954. "set-picker-option",
  29955. "calendar-change"
  29956. ];
  29957. //#endregion
  29958. //#region ../../packages/components/date-picker-panel/src/composables/use-year-range-header.ts
  29959. const useYearRangeHeader = ({ unlinkPanels, leftDate, rightDate }) => {
  29960. const leftPrevYear = () => {
  29961. leftDate.value = leftDate.value.subtract(10, "year");
  29962. if (!unlinkPanels.value) rightDate.value = rightDate.value.subtract(10, "year");
  29963. };
  29964. const rightNextYear = () => {
  29965. if (!unlinkPanels.value) leftDate.value = leftDate.value.add(10, "year");
  29966. rightDate.value = rightDate.value.add(10, "year");
  29967. };
  29968. const leftNextYear = () => {
  29969. leftDate.value = leftDate.value.add(10, "year");
  29970. };
  29971. const rightPrevYear = () => {
  29972. rightDate.value = rightDate.value.subtract(10, "year");
  29973. };
  29974. return {
  29975. leftPrevYear,
  29976. rightNextYear,
  29977. leftNextYear,
  29978. rightPrevYear,
  29979. leftLabel: computed(() => {
  29980. const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10;
  29981. return `${leftStartDate}-${leftStartDate + 9}`;
  29982. }),
  29983. rightLabel: computed(() => {
  29984. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  29985. return `${rightStartDate}-${rightStartDate + 9}`;
  29986. }),
  29987. leftYear: computed(() => {
  29988. return Math.floor(leftDate.value.year() / 10) * 10 + 9;
  29989. }),
  29990. rightYear: computed(() => {
  29991. return Math.floor(rightDate.value.year() / 10) * 10;
  29992. })
  29993. };
  29994. };
  29995. //#endregion
  29996. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-year-range.vue?vue&type=script&setup=true&lang.ts
  29997. const _hoisted_1$44 = ["disabled", "onClick"];
  29998. const _hoisted_2$26 = ["disabled"];
  29999. const _hoisted_3$11 = ["disabled"];
  30000. const _hoisted_4$8 = ["disabled"];
  30001. const _hoisted_5$5 = ["disabled"];
  30002. const step = 10;
  30003. const unit = "year";
  30004. var panel_year_range_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  30005. name: "DatePickerYearRange",
  30006. __name: "panel-year-range",
  30007. props: panelYearRangeProps,
  30008. emits: panelYearRangeEmits,
  30009. setup(__props, { emit: __emit }) {
  30010. const props = __props;
  30011. const emit = __emit;
  30012. const { lang } = useLocale();
  30013. const leftDate = ref((0, import_dayjs_min.default)().locale(lang.value));
  30014. const rightDate = ref((0, import_dayjs_min.default)().locale(lang.value).add(step, unit));
  30015. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  30016. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  30017. const { shortcuts, disabledDate, cellClassName } = pickerBase.props;
  30018. const format = toRef(pickerBase.props, "format");
  30019. const defaultValue = toRef(pickerBase.props, "defaultValue");
  30020. const { minDate, maxDate, rangeState, ppNs, drpNs, handleChangeRange, handleRangeConfirm, handleShortcutClick, onSelect, parseValue } = useRangePicker(props, {
  30021. defaultValue,
  30022. leftDate,
  30023. rightDate,
  30024. step,
  30025. unit,
  30026. sortDates
  30027. });
  30028. const { leftPrevYear, rightNextYear, leftNextYear, rightPrevYear, leftLabel, rightLabel, leftYear, rightYear } = useYearRangeHeader({
  30029. unlinkPanels: toRef(props, "unlinkPanels"),
  30030. leftDate,
  30031. rightDate
  30032. });
  30033. const yearRangeDisabled = useFormDisabled();
  30034. const hasShortcuts = computed(() => !!shortcuts.length);
  30035. const panelKls = computed(() => [
  30036. ppNs.b(),
  30037. drpNs.b(),
  30038. ppNs.is("border", props.border),
  30039. ppNs.is("disabled", yearRangeDisabled.value),
  30040. { "has-sidebar": Boolean(useSlots().sidebar) || hasShortcuts.value }
  30041. ]);
  30042. const leftPanelKls = computed(() => {
  30043. return {
  30044. content: [
  30045. ppNs.e("content"),
  30046. drpNs.e("content"),
  30047. "is-left"
  30048. ],
  30049. arrowLeftBtn: [ppNs.e("icon-btn"), "d-arrow-left"],
  30050. arrowRightBtn: [
  30051. ppNs.e("icon-btn"),
  30052. ppNs.is("disabled", !enableYearArrow.value || yearRangeDisabled.value),
  30053. "d-arrow-right"
  30054. ]
  30055. };
  30056. });
  30057. const rightPanelKls = computed(() => {
  30058. return {
  30059. content: [
  30060. ppNs.e("content"),
  30061. drpNs.e("content"),
  30062. "is-right"
  30063. ],
  30064. arrowLeftBtn: [
  30065. ppNs.e("icon-btn"),
  30066. ppNs.is("disabled", !enableYearArrow.value || yearRangeDisabled.value),
  30067. "d-arrow-left"
  30068. ],
  30069. arrowRightBtn: [ppNs.e("icon-btn"), "d-arrow-right"]
  30070. };
  30071. });
  30072. const enableYearArrow = computed(() => {
  30073. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  30074. });
  30075. const handleRangePick = (val, close = true) => {
  30076. const minDate_ = val.minDate;
  30077. const maxDate_ = val.maxDate;
  30078. if (maxDate.value === maxDate_ && minDate.value === minDate_) return;
  30079. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  30080. maxDate.value = maxDate_;
  30081. minDate.value = minDate_;
  30082. if (!close) return;
  30083. handleRangeConfirm();
  30084. };
  30085. const parseUserInput = (value) => {
  30086. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  30087. };
  30088. const isValidValue = (date) => {
  30089. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  30090. };
  30091. const handleClear = () => {
  30092. let valueOnClear = null;
  30093. if (pickerBase?.emptyValues) valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  30094. const defaultArr = getDefaultValue(unref(defaultValue), {
  30095. lang: unref(lang),
  30096. step,
  30097. unit,
  30098. unlinkPanels: props.unlinkPanels
  30099. });
  30100. leftDate.value = defaultArr[0];
  30101. rightDate.value = defaultArr[1];
  30102. emit("pick", valueOnClear);
  30103. };
  30104. function sortDates(minDate, maxDate) {
  30105. if (props.unlinkPanels && maxDate) {
  30106. const minDateYear = minDate?.year() || 0;
  30107. const maxDateYear = maxDate.year();
  30108. rightDate.value = minDateYear + step > maxDateYear ? maxDate.add(step, unit) : maxDate;
  30109. } else rightDate.value = leftDate.value.add(step, unit);
  30110. }
  30111. watch(() => props.visible, (visible) => {
  30112. if (!visible && rangeState.value.selecting) {
  30113. parseValue(props.parsedValue);
  30114. onSelect(false);
  30115. }
  30116. });
  30117. emit("set-picker-option", ["isValidValue", isValidValue]);
  30118. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  30119. emit("set-picker-option", ["handleClear", handleClear]);
  30120. return (_ctx, _cache) => {
  30121. return openBlock(), createElementBlock("div", { class: normalizeClass(panelKls.value) }, [createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body-wrapper")) }, [
  30122. renderSlot(_ctx.$slots, "sidebar", { class: normalizeClass(unref(ppNs).e("sidebar")) }),
  30123. hasShortcuts.value ? (openBlock(), createElementBlock("div", {
  30124. key: 0,
  30125. class: normalizeClass(unref(ppNs).e("sidebar"))
  30126. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  30127. return openBlock(), createElementBlock("button", {
  30128. key,
  30129. type: "button",
  30130. class: normalizeClass(unref(ppNs).e("shortcut")),
  30131. disabled: unref(yearRangeDisabled),
  30132. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  30133. }, toDisplayString(shortcut.text), 11, _hoisted_1$44);
  30134. }), 128))], 2)) : createCommentVNode("v-if", true),
  30135. createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body")) }, [createElementVNode("div", { class: normalizeClass(leftPanelKls.value.content) }, [createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  30136. createElementVNode("button", {
  30137. type: "button",
  30138. class: normalizeClass(leftPanelKls.value.arrowLeftBtn),
  30139. disabled: unref(yearRangeDisabled),
  30140. onClick: _cache[0] || (_cache[0] = (...args) => unref(leftPrevYear) && unref(leftPrevYear)(...args))
  30141. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  30142. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  30143. _: 1
  30144. })])], 10, _hoisted_2$26),
  30145. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  30146. key: 0,
  30147. type: "button",
  30148. disabled: !enableYearArrow.value || unref(yearRangeDisabled),
  30149. class: normalizeClass(leftPanelKls.value.arrowRightBtn),
  30150. onClick: _cache[1] || (_cache[1] = (...args) => unref(leftNextYear) && unref(leftNextYear)(...args))
  30151. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  30152. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  30153. _: 1
  30154. })])], 10, _hoisted_3$11)) : createCommentVNode("v-if", true),
  30155. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  30156. ], 2), createVNode(basic_year_table_default, {
  30157. "selection-mode": "range",
  30158. date: leftDate.value,
  30159. "min-date": unref(minDate),
  30160. "max-date": unref(maxDate),
  30161. "range-state": unref(rangeState),
  30162. "disabled-date": unref(disabledDate),
  30163. disabled: unref(yearRangeDisabled),
  30164. "cell-class-name": unref(cellClassName),
  30165. onChangerange: unref(handleChangeRange),
  30166. onPick: handleRangePick,
  30167. onSelect: unref(onSelect)
  30168. }, null, 8, [
  30169. "date",
  30170. "min-date",
  30171. "max-date",
  30172. "range-state",
  30173. "disabled-date",
  30174. "disabled",
  30175. "cell-class-name",
  30176. "onChangerange",
  30177. "onSelect"
  30178. ])], 2), createElementVNode("div", { class: normalizeClass(rightPanelKls.value.content) }, [createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  30179. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  30180. key: 0,
  30181. type: "button",
  30182. disabled: !enableYearArrow.value || unref(yearRangeDisabled),
  30183. class: normalizeClass(rightPanelKls.value.arrowLeftBtn),
  30184. onClick: _cache[2] || (_cache[2] = (...args) => unref(rightPrevYear) && unref(rightPrevYear)(...args))
  30185. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  30186. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  30187. _: 1
  30188. })])], 10, _hoisted_4$8)) : createCommentVNode("v-if", true),
  30189. createElementVNode("button", {
  30190. type: "button",
  30191. class: normalizeClass(rightPanelKls.value.arrowRightBtn),
  30192. disabled: unref(yearRangeDisabled),
  30193. onClick: _cache[3] || (_cache[3] = (...args) => unref(rightNextYear) && unref(rightNextYear)(...args))
  30194. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  30195. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  30196. _: 1
  30197. })])], 10, _hoisted_5$5),
  30198. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  30199. ], 2), createVNode(basic_year_table_default, {
  30200. "selection-mode": "range",
  30201. date: rightDate.value,
  30202. "min-date": unref(minDate),
  30203. "max-date": unref(maxDate),
  30204. "range-state": unref(rangeState),
  30205. "disabled-date": unref(disabledDate),
  30206. disabled: unref(yearRangeDisabled),
  30207. "cell-class-name": unref(cellClassName),
  30208. onChangerange: unref(handleChangeRange),
  30209. onPick: handleRangePick,
  30210. onSelect: unref(onSelect)
  30211. }, null, 8, [
  30212. "date",
  30213. "min-date",
  30214. "max-date",
  30215. "range-state",
  30216. "disabled-date",
  30217. "disabled",
  30218. "cell-class-name",
  30219. "onChangerange",
  30220. "onSelect"
  30221. ])], 2)], 2)
  30222. ], 2)], 2);
  30223. };
  30224. }
  30225. });
  30226. //#endregion
  30227. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-year-range.vue
  30228. var panel_year_range_default = panel_year_range_vue_vue_type_script_setup_true_lang_default;
  30229. //#endregion
  30230. //#region ../../packages/components/date-picker-panel/src/panel-utils.ts
  30231. const getPanel = function(type) {
  30232. switch (type) {
  30233. case "daterange":
  30234. case "datetimerange": return panel_date_range_default;
  30235. case "monthrange": return panel_month_range_default;
  30236. case "yearrange": return panel_year_range_default;
  30237. default: return panel_date_pick_default;
  30238. }
  30239. };
  30240. //#endregion
  30241. //#region ../../packages/components/date-picker-panel/src/date-picker-panel.tsx
  30242. function _isSlot$7(s) {
  30243. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  30244. }
  30245. import_dayjs_min.default.extend(import_localeData.default);
  30246. import_dayjs_min.default.extend(import_advancedFormat.default);
  30247. import_dayjs_min.default.extend(import_customParseFormat.default);
  30248. import_dayjs_min.default.extend(import_weekOfYear.default);
  30249. import_dayjs_min.default.extend(import_weekYear.default);
  30250. import_dayjs_min.default.extend(import_dayOfYear.default);
  30251. import_dayjs_min.default.extend(import_isSameOrAfter.default);
  30252. import_dayjs_min.default.extend(import_isSameOrBefore.default);
  30253. var date_picker_panel_default = /* @__PURE__ */ defineComponent({
  30254. name: "ElDatePickerPanel",
  30255. install: null,
  30256. inheritAttrs: false,
  30257. props: datePickerPanelProps,
  30258. emits: [
  30259. UPDATE_MODEL_EVENT,
  30260. "calendar-change",
  30261. "panel-change",
  30262. "visible-change",
  30263. "clear"
  30264. ],
  30265. setup(props, { slots, emit, attrs }) {
  30266. const ns = useNamespace("picker-panel");
  30267. if (isUndefined(inject(PICKER_BASE_INJECTION_KEY, void 0))) provide(PICKER_BASE_INJECTION_KEY, { props: reactive({ ...toRefs(props) }) });
  30268. provide(ROOT_PICKER_INJECTION_KEY, {
  30269. slots,
  30270. pickerNs: ns
  30271. });
  30272. const { parsedValue, onCalendarChange, onPanelChange, onSetPickerOption, onPick } = inject(ROOT_COMMON_PICKER_INJECTION_KEY, () => useCommonPicker(props, emit), true);
  30273. return () => {
  30274. return createVNode(getPanel(props.type), mergeProps(omit(attrs, "onPick"), props, {
  30275. "parsedValue": parsedValue.value,
  30276. "onSet-picker-option": onSetPickerOption,
  30277. "onCalendar-change": onCalendarChange,
  30278. "onPanel-change": onPanelChange,
  30279. "onClear": () => emit("clear"),
  30280. "onPick": onPick
  30281. }), _isSlot$7(slots) ? slots : { default: () => [slots] });
  30282. };
  30283. }
  30284. });
  30285. //#endregion
  30286. //#region ../../packages/components/date-picker-panel/index.ts
  30287. const ElDatePickerPanel = withInstall(date_picker_panel_default);
  30288. //#endregion
  30289. //#region ../../packages/components/date-picker/src/props.ts
  30290. const datePickerProps = buildProps({
  30291. ...timePickerDefaultProps,
  30292. type: {
  30293. type: definePropType(String),
  30294. default: "date"
  30295. }
  30296. });
  30297. //#endregion
  30298. //#region ../../packages/components/date-picker/src/date-picker.tsx
  30299. function _isSlot$6(s) {
  30300. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  30301. }
  30302. var date_picker_default = /* @__PURE__ */ defineComponent({
  30303. name: "ElDatePicker",
  30304. install: null,
  30305. props: datePickerProps,
  30306. emits: [UPDATE_MODEL_EVENT],
  30307. setup(props, { expose, emit, slots }) {
  30308. provide(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, computed(() => {
  30309. return !props.format;
  30310. }));
  30311. provide(PICKER_POPPER_OPTIONS_INJECTION_KEY, reactive(toRef(props, "popperOptions")));
  30312. const commonPicker = ref();
  30313. expose({
  30314. focus: () => {
  30315. commonPicker.value?.focus();
  30316. },
  30317. blur: () => {
  30318. commonPicker.value?.blur();
  30319. },
  30320. handleOpen: () => {
  30321. commonPicker.value?.handleOpen();
  30322. },
  30323. handleClose: () => {
  30324. commonPicker.value?.handleClose();
  30325. }
  30326. });
  30327. const onModelValueUpdated = (val) => {
  30328. emit(UPDATE_MODEL_EVENT, val);
  30329. };
  30330. return () => {
  30331. const format = props.format ?? (DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE);
  30332. return createVNode(picker_default, mergeProps(props, {
  30333. "format": format,
  30334. "type": props.type,
  30335. "ref": commonPicker,
  30336. "onUpdate:modelValue": onModelValueUpdated
  30337. }), {
  30338. default: (scopedProps) => createVNode(ElDatePickerPanel, mergeProps({
  30339. "disabled": props.disabled,
  30340. "editable": props.editable,
  30341. "border": false
  30342. }, scopedProps), _isSlot$6(slots) ? slots : { default: () => [slots] }),
  30343. "range-separator": slots["range-separator"]
  30344. });
  30345. };
  30346. }
  30347. });
  30348. //#endregion
  30349. //#region ../../packages/components/date-picker/index.ts
  30350. const ElDatePicker = withInstall(date_picker_default);
  30351. //#endregion
  30352. //#region ../../packages/components/descriptions/src/description.ts
  30353. /**
  30354. * @deprecated Removed after 3.0.0, Use `DescriptionProps` instead.
  30355. */
  30356. const descriptionProps = buildProps({
  30357. border: Boolean,
  30358. column: {
  30359. type: Number,
  30360. default: 3
  30361. },
  30362. direction: {
  30363. type: String,
  30364. values: ["horizontal", "vertical"],
  30365. default: "horizontal"
  30366. },
  30367. size: useSizeProp,
  30368. title: {
  30369. type: String,
  30370. default: ""
  30371. },
  30372. extra: {
  30373. type: String,
  30374. default: ""
  30375. },
  30376. labelWidth: { type: [String, Number] }
  30377. });
  30378. //#endregion
  30379. //#region ../../packages/components/descriptions/src/descriptions-row.ts
  30380. /**
  30381. * @deprecated Removed after 3.0.0, Use `DescriptionsRowProps` instead.
  30382. */
  30383. const descriptionsRowProps = buildProps({ row: {
  30384. type: definePropType(Array),
  30385. default: () => []
  30386. } });
  30387. //#endregion
  30388. //#region ../../packages/components/descriptions/src/token.ts
  30389. const descriptionsKey = Symbol("elDescriptions");
  30390. //#endregion
  30391. //#region ../../packages/components/descriptions/src/descriptions-cell.ts
  30392. var descriptions_cell_default = defineComponent({
  30393. name: "ElDescriptionsCell",
  30394. props: {
  30395. cell: { type: Object },
  30396. tag: {
  30397. type: String,
  30398. default: "td"
  30399. },
  30400. type: { type: String }
  30401. },
  30402. setup() {
  30403. return { descriptions: inject(descriptionsKey, {}) };
  30404. },
  30405. render() {
  30406. const item = getNormalizedProps(this.cell);
  30407. const directives = (this.cell?.dirs || []).map((dire) => {
  30408. const { dir, arg, modifiers, value } = dire;
  30409. return [
  30410. dir,
  30411. value,
  30412. arg,
  30413. modifiers
  30414. ];
  30415. });
  30416. const { border, direction } = this.descriptions;
  30417. const isVertical = direction === "vertical";
  30418. const renderLabel = () => this.cell?.children?.label?.() || item.label;
  30419. const renderContent = () => this.cell?.children?.default?.();
  30420. const span = item.span;
  30421. const rowspan = item.rowspan;
  30422. const align = item.align ? `is-${item.align}` : "";
  30423. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  30424. const className = item.className;
  30425. const labelClassName = item.labelClassName;
  30426. const style = {
  30427. width: addUnit(this.type === "label" ? item.labelWidth ?? this.descriptions.labelWidth ?? item.width : item.width),
  30428. minWidth: addUnit(item.minWidth)
  30429. };
  30430. const ns = useNamespace("descriptions");
  30431. switch (this.type) {
  30432. case "label": return withDirectives(h(this.tag, {
  30433. style,
  30434. class: [
  30435. ns.e("cell"),
  30436. ns.e("label"),
  30437. ns.is("bordered-label", border),
  30438. ns.is("vertical-label", isVertical),
  30439. labelAlign,
  30440. labelClassName
  30441. ],
  30442. colSpan: isVertical ? span : 1,
  30443. rowspan: isVertical ? 1 : rowspan
  30444. }, renderLabel()), directives);
  30445. case "content": return withDirectives(h(this.tag, {
  30446. style,
  30447. class: [
  30448. ns.e("cell"),
  30449. ns.e("content"),
  30450. ns.is("bordered-content", border),
  30451. ns.is("vertical-content", isVertical),
  30452. align,
  30453. className
  30454. ],
  30455. colSpan: isVertical ? span : span * 2 - 1,
  30456. rowspan: isVertical ? rowspan * 2 - 1 : rowspan
  30457. }, renderContent()), directives);
  30458. default: {
  30459. const label = renderLabel();
  30460. const labelStyle = {};
  30461. const width = addUnit(item.labelWidth ?? this.descriptions.labelWidth);
  30462. if (width) {
  30463. labelStyle.width = width;
  30464. labelStyle.display = "inline-block";
  30465. }
  30466. return withDirectives(h("td", {
  30467. style,
  30468. class: [ns.e("cell"), align],
  30469. colSpan: span,
  30470. rowspan
  30471. }, [!isNil(label) ? h("span", {
  30472. style: labelStyle,
  30473. class: [ns.e("label"), labelClassName]
  30474. }, label) : void 0, h("span", { class: [ns.e("content"), className] }, renderContent())]), directives);
  30475. }
  30476. }
  30477. }
  30478. });
  30479. //#endregion
  30480. //#region ../../packages/components/descriptions/src/descriptions-row.vue?vue&type=script&setup=true&lang.ts
  30481. const _hoisted_1$43 = { key: 1 };
  30482. var descriptions_row_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  30483. name: "ElDescriptionsRow",
  30484. __name: "descriptions-row",
  30485. props: descriptionsRowProps,
  30486. setup(__props) {
  30487. const descriptions = inject(descriptionsKey, {});
  30488. return (_ctx, _cache) => {
  30489. return unref(descriptions).direction === "vertical" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.row, (cell, _index) => {
  30490. return openBlock(), createBlock(unref(descriptions_cell_default), {
  30491. key: `tr1-${_index}`,
  30492. cell,
  30493. tag: "th",
  30494. type: "label"
  30495. }, null, 8, ["cell"]);
  30496. }), 128))]), createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.row, (cell, _index) => {
  30497. return openBlock(), createBlock(unref(descriptions_cell_default), {
  30498. key: `tr2-${_index}`,
  30499. cell,
  30500. tag: "td",
  30501. type: "content"
  30502. }, null, 8, ["cell"]);
  30503. }), 128))])], 64)) : (openBlock(), createElementBlock("tr", _hoisted_1$43, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.row, (cell, _index) => {
  30504. return openBlock(), createElementBlock(Fragment, { key: `tr3-${_index}` }, [unref(descriptions).border ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(unref(descriptions_cell_default), {
  30505. cell,
  30506. tag: "td",
  30507. type: "label"
  30508. }, null, 8, ["cell"]), createVNode(unref(descriptions_cell_default), {
  30509. cell,
  30510. tag: "td",
  30511. type: "content"
  30512. }, null, 8, ["cell"])], 64)) : (openBlock(), createBlock(unref(descriptions_cell_default), {
  30513. key: 1,
  30514. cell,
  30515. tag: "td",
  30516. type: "both"
  30517. }, null, 8, ["cell"]))], 64);
  30518. }), 128))]));
  30519. };
  30520. }
  30521. });
  30522. //#endregion
  30523. //#region ../../packages/components/descriptions/src/descriptions-row.vue
  30524. var descriptions_row_default = descriptions_row_vue_vue_type_script_setup_true_lang_default;
  30525. //#endregion
  30526. //#region ../../packages/components/descriptions/src/constants.ts
  30527. const COMPONENT_NAME$10 = "ElDescriptionsItem";
  30528. //#endregion
  30529. //#region ../../packages/components/descriptions/src/description.vue?vue&type=script&setup=true&lang.ts
  30530. var description_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  30531. name: "ElDescriptions",
  30532. __name: "description",
  30533. props: descriptionProps,
  30534. setup(__props) {
  30535. const props = __props;
  30536. const ns = useNamespace("descriptions");
  30537. const descriptionsSize = useFormSize();
  30538. const slots = useSlots();
  30539. provide(descriptionsKey, props);
  30540. const descriptionKls = computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  30541. const filledNode = (node, span, count, isLast = false) => {
  30542. if (!node.props) node.props = {};
  30543. if (span > count) node.props.span = count;
  30544. if (isLast) node.props.span = span;
  30545. return node;
  30546. };
  30547. const getRows = () => {
  30548. if (!slots.default) return [];
  30549. const children = flattedChildren(slots.default()).filter((node) => node?.type?.name === COMPONENT_NAME$10);
  30550. const rows = [];
  30551. let temp = [];
  30552. let count = props.column;
  30553. let totalSpan = 0;
  30554. const rowspanTemp = [];
  30555. children.forEach((node, index) => {
  30556. const span = node.props?.span || 1;
  30557. const rowspan = node.props?.rowspan || 1;
  30558. const rowNo = rows.length;
  30559. rowspanTemp[rowNo] ||= 0;
  30560. if (rowspan > 1) for (let i = 1; i < rowspan; i++) {
  30561. rowspanTemp[rowNo + i] ||= 0;
  30562. rowspanTemp[rowNo + i]++;
  30563. totalSpan++;
  30564. }
  30565. if (rowspanTemp[rowNo] > 0) {
  30566. count -= rowspanTemp[rowNo];
  30567. rowspanTemp[rowNo] = 0;
  30568. }
  30569. if (index < children.length - 1) totalSpan += span > count ? count : span;
  30570. if (index === children.length - 1) {
  30571. const lastSpan = props.column - totalSpan % props.column;
  30572. temp.push(filledNode(node, lastSpan, count, true));
  30573. rows.push(temp);
  30574. return;
  30575. }
  30576. if (span < count) {
  30577. count -= span;
  30578. temp.push(node);
  30579. } else {
  30580. temp.push(filledNode(node, span, count));
  30581. rows.push(temp);
  30582. count = props.column;
  30583. temp = [];
  30584. }
  30585. });
  30586. return rows;
  30587. };
  30588. return (_ctx, _cache) => {
  30589. return openBlock(), createElementBlock("div", { class: normalizeClass(descriptionKls.value) }, [__props.title || __props.extra || _ctx.$slots.title || _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  30590. key: 0,
  30591. class: normalizeClass(unref(ns).e("header"))
  30592. }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("title")) }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2), createElementVNode("div", { class: normalizeClass(unref(ns).e("extra")) }, [renderSlot(_ctx.$slots, "extra", {}, () => [createTextVNode(toDisplayString(__props.extra), 1)])], 2)], 2)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("body")) }, [createElementVNode("table", { class: normalizeClass([unref(ns).e("table"), unref(ns).is("bordered", __props.border)]) }, [createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(getRows(), (row, _index) => {
  30593. return openBlock(), createBlock(descriptions_row_default, {
  30594. key: _index,
  30595. row
  30596. }, null, 8, ["row"]);
  30597. }), 128))])], 2)], 2)], 2);
  30598. };
  30599. }
  30600. });
  30601. //#endregion
  30602. //#region ../../packages/components/descriptions/src/description.vue
  30603. var description_default = description_vue_vue_type_script_setup_true_lang_default;
  30604. //#endregion
  30605. //#region ../../packages/components/descriptions/src/description-item.ts
  30606. const descriptionItemProps = buildProps({
  30607. label: {
  30608. type: String,
  30609. default: ""
  30610. },
  30611. span: {
  30612. type: Number,
  30613. default: 1
  30614. },
  30615. rowspan: {
  30616. type: Number,
  30617. default: 1
  30618. },
  30619. width: {
  30620. type: [String, Number],
  30621. default: ""
  30622. },
  30623. minWidth: {
  30624. type: [String, Number],
  30625. default: ""
  30626. },
  30627. labelWidth: { type: [String, Number] },
  30628. align: {
  30629. type: String,
  30630. values: columnAlignment,
  30631. default: "left"
  30632. },
  30633. labelAlign: {
  30634. type: String,
  30635. values: columnAlignment
  30636. },
  30637. className: {
  30638. type: String,
  30639. default: ""
  30640. },
  30641. labelClassName: {
  30642. type: String,
  30643. default: ""
  30644. }
  30645. });
  30646. const DescriptionItem = defineComponent({
  30647. name: COMPONENT_NAME$10,
  30648. props: descriptionItemProps
  30649. });
  30650. //#endregion
  30651. //#region ../../packages/components/descriptions/index.ts
  30652. const ElDescriptions = withInstall(description_default, { DescriptionsItem: DescriptionItem });
  30653. const ElDescriptionsItem = withNoopInstall(DescriptionItem);
  30654. //#endregion
  30655. //#region ../../packages/components/dialog/src/dialog-content.ts
  30656. /**
  30657. * @deprecated Removed after 3.0.0, Use `DialogContentProps` instead.
  30658. */
  30659. const dialogContentProps = buildProps({
  30660. center: Boolean,
  30661. alignCenter: {
  30662. type: Boolean,
  30663. default: void 0
  30664. },
  30665. closeIcon: { type: iconPropType },
  30666. draggable: {
  30667. type: Boolean,
  30668. default: void 0
  30669. },
  30670. overflow: {
  30671. type: Boolean,
  30672. default: void 0
  30673. },
  30674. fullscreen: Boolean,
  30675. headerClass: String,
  30676. bodyClass: String,
  30677. footerClass: String,
  30678. showClose: {
  30679. type: Boolean,
  30680. default: true
  30681. },
  30682. title: {
  30683. type: String,
  30684. default: ""
  30685. },
  30686. ariaLevel: {
  30687. type: String,
  30688. default: "2"
  30689. }
  30690. });
  30691. const dialogContentEmits = { close: () => true };
  30692. const dialogContentPropsDefaults = {
  30693. alignCenter: void 0,
  30694. draggable: void 0,
  30695. overflow: void 0,
  30696. showClose: true,
  30697. title: "",
  30698. ariaLevel: "2"
  30699. };
  30700. //#endregion
  30701. //#region ../../packages/components/dialog/src/dialog.ts
  30702. /**
  30703. * @deprecated Removed after 3.0.0, Use `DialogProps` instead.
  30704. */
  30705. const dialogProps = buildProps({
  30706. ...dialogContentProps,
  30707. appendToBody: Boolean,
  30708. appendTo: {
  30709. type: teleportProps.to.type,
  30710. default: "body"
  30711. },
  30712. beforeClose: { type: definePropType(Function) },
  30713. destroyOnClose: Boolean,
  30714. closeOnClickModal: {
  30715. type: Boolean,
  30716. default: true
  30717. },
  30718. closeOnPressEscape: {
  30719. type: Boolean,
  30720. default: true
  30721. },
  30722. lockScroll: {
  30723. type: Boolean,
  30724. default: true
  30725. },
  30726. modal: {
  30727. type: Boolean,
  30728. default: true
  30729. },
  30730. modalPenetrable: Boolean,
  30731. openDelay: {
  30732. type: Number,
  30733. default: 0
  30734. },
  30735. closeDelay: {
  30736. type: Number,
  30737. default: 0
  30738. },
  30739. top: { type: String },
  30740. modelValue: Boolean,
  30741. modalClass: String,
  30742. headerClass: String,
  30743. bodyClass: String,
  30744. footerClass: String,
  30745. width: { type: [String, Number] },
  30746. zIndex: { type: Number },
  30747. trapFocus: Boolean,
  30748. headerAriaLevel: {
  30749. type: String,
  30750. default: "2"
  30751. },
  30752. transition: {
  30753. type: definePropType([String, Object]),
  30754. default: void 0
  30755. }
  30756. });
  30757. const dialogEmits = {
  30758. open: () => true,
  30759. opened: () => true,
  30760. close: () => true,
  30761. closed: () => true,
  30762. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  30763. openAutoFocus: () => true,
  30764. closeAutoFocus: () => true
  30765. };
  30766. const dialogContextKey = Symbol("dialogContextKey");
  30767. const dialogPropsDefaults = {
  30768. ...dialogContentPropsDefaults,
  30769. appendTo: "body",
  30770. closeOnClickModal: true,
  30771. closeOnPressEscape: true,
  30772. lockScroll: true,
  30773. modal: true,
  30774. openDelay: 0,
  30775. closeDelay: 0,
  30776. headerAriaLevel: "2",
  30777. transition: void 0
  30778. };
  30779. //#endregion
  30780. //#region ../../packages/components/overlay/src/overlay.ts
  30781. const overlayProps = buildProps({
  30782. mask: {
  30783. type: Boolean,
  30784. default: true
  30785. },
  30786. customMaskEvent: Boolean,
  30787. overlayClass: { type: definePropType([
  30788. String,
  30789. Array,
  30790. Object
  30791. ]) },
  30792. zIndex: { type: definePropType([String, Number]) }
  30793. });
  30794. const overlayEmits = { click: (evt) => evt instanceof MouseEvent };
  30795. const BLOCK = "overlay";
  30796. var overlay_default = defineComponent({
  30797. name: "ElOverlay",
  30798. props: overlayProps,
  30799. emits: overlayEmits,
  30800. setup(props, { slots, emit }) {
  30801. const ns = useNamespace(BLOCK);
  30802. const onMaskClick = (e) => {
  30803. emit("click", e);
  30804. };
  30805. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  30806. return () => {
  30807. return props.mask ? createVNode("div", {
  30808. class: [ns.b(), props.overlayClass],
  30809. style: { zIndex: props.zIndex },
  30810. onClick,
  30811. onMousedown,
  30812. onMouseup
  30813. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, [
  30814. "onClick",
  30815. "onMouseup",
  30816. "onMousedown"
  30817. ]) : h("div", {
  30818. class: props.overlayClass,
  30819. style: {
  30820. zIndex: props.zIndex,
  30821. position: "fixed",
  30822. top: "0px",
  30823. right: "0px",
  30824. bottom: "0px",
  30825. left: "0px"
  30826. }
  30827. }, [renderSlot(slots, "default")]);
  30828. };
  30829. }
  30830. });
  30831. //#endregion
  30832. //#region ../../packages/components/overlay/index.ts
  30833. const ElOverlay = overlay_default;
  30834. //#endregion
  30835. //#region ../../packages/components/dialog/src/constants.ts
  30836. const dialogInjectionKey = Symbol("dialogInjectionKey");
  30837. const DEFAULT_DIALOG_TRANSITION = "dialog-fade";
  30838. //#endregion
  30839. //#region ../../packages/components/dialog/src/dialog-content.vue?vue&type=script&setup=true&lang.ts
  30840. const _hoisted_1$42 = ["aria-level"];
  30841. const _hoisted_2$25 = ["aria-label"];
  30842. const _hoisted_3$10 = ["id"];
  30843. var dialog_content_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  30844. name: "ElDialogContent",
  30845. __name: "dialog-content",
  30846. props: dialogContentProps,
  30847. emits: dialogContentEmits,
  30848. setup(__props, { expose: __expose }) {
  30849. const { t } = useLocale();
  30850. const { Close } = CloseComponents;
  30851. const props = __props;
  30852. const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey);
  30853. const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY);
  30854. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  30855. const draggable = computed(() => !!props.draggable);
  30856. const { resetPosition, updatePosition, isDragging } = useDraggable(dialogRef, headerRef, draggable, computed(() => !!props.overflow));
  30857. const dialogKls = computed(() => [
  30858. ns.b(),
  30859. ns.is("fullscreen", props.fullscreen),
  30860. ns.is("draggable", draggable.value),
  30861. ns.is("dragging", isDragging.value),
  30862. ns.is("align-center", !!props.alignCenter),
  30863. { [ns.m("center")]: props.center }
  30864. ]);
  30865. __expose({
  30866. resetPosition,
  30867. updatePosition
  30868. });
  30869. return (_ctx, _cache) => {
  30870. return openBlock(), createElementBlock("div", {
  30871. ref: unref(composedDialogRef),
  30872. class: normalizeClass(dialogKls.value),
  30873. style: normalizeStyle(unref(style)),
  30874. tabindex: "-1"
  30875. }, [
  30876. createElementVNode("header", {
  30877. ref_key: "headerRef",
  30878. ref: headerRef,
  30879. class: normalizeClass([
  30880. unref(ns).e("header"),
  30881. __props.headerClass,
  30882. { "show-close": __props.showClose }
  30883. ])
  30884. }, [renderSlot(_ctx.$slots, "header", {}, () => [createElementVNode("span", {
  30885. role: "heading",
  30886. "aria-level": __props.ariaLevel,
  30887. class: normalizeClass(unref(ns).e("title"))
  30888. }, toDisplayString(__props.title), 11, _hoisted_1$42)]), __props.showClose ? (openBlock(), createElementBlock("button", {
  30889. key: 0,
  30890. "aria-label": unref(t)("el.dialog.close"),
  30891. class: normalizeClass(unref(ns).e("headerbtn")),
  30892. type: "button",
  30893. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  30894. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(ns).e("close")) }, {
  30895. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.closeIcon || unref(Close))))]),
  30896. _: 1
  30897. }, 8, ["class"])], 10, _hoisted_2$25)) : createCommentVNode("v-if", true)], 2),
  30898. createElementVNode("div", {
  30899. id: unref(bodyId),
  30900. class: normalizeClass([unref(ns).e("body"), __props.bodyClass])
  30901. }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_3$10),
  30902. _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", {
  30903. key: 0,
  30904. class: normalizeClass([unref(ns).e("footer"), __props.footerClass])
  30905. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  30906. ], 6);
  30907. };
  30908. }
  30909. });
  30910. //#endregion
  30911. //#region ../../packages/components/dialog/src/dialog-content.vue
  30912. var dialog_content_default = dialog_content_vue_vue_type_script_setup_true_lang_default;
  30913. //#endregion
  30914. //#region ../../packages/components/dialog/src/use-dialog.ts
  30915. const COMPONENT_NAME$9 = "ElDialog";
  30916. const useDialog = (props, targetRef) => {
  30917. const emit = getCurrentInstance().emit;
  30918. const { nextZIndex } = useZIndex();
  30919. let lastPosition = "";
  30920. const titleId = useId();
  30921. const bodyId = useId();
  30922. const visible = ref(false);
  30923. const closed = ref(false);
  30924. const rendered = ref(false);
  30925. const zIndex = ref(props.zIndex ?? nextZIndex());
  30926. const closing = ref(false);
  30927. let openTimer = void 0;
  30928. let closeTimer = void 0;
  30929. const config = useGlobalConfig();
  30930. const namespace = computed(() => config.value?.namespace ?? defaultNamespace);
  30931. const globalConfig = computed(() => config.value?.dialog);
  30932. const style = computed(() => {
  30933. const style = {};
  30934. const varPrefix = `--${namespace.value}-dialog`;
  30935. if (!props.fullscreen) {
  30936. if (props.top) style[`${varPrefix}-margin-top`] = props.top;
  30937. const width = addUnit(props.width);
  30938. if (width) style[`${varPrefix}-width`] = width;
  30939. }
  30940. return style;
  30941. });
  30942. const _draggable = computed(() => (props.draggable ?? globalConfig.value?.draggable ?? false) && !props.fullscreen);
  30943. const _alignCenter = computed(() => props.alignCenter ?? globalConfig.value?.alignCenter ?? false);
  30944. const _overflow = computed(() => props.overflow ?? globalConfig.value?.overflow ?? false);
  30945. const overlayDialogStyle = computed(() => {
  30946. if (_alignCenter.value) return { display: "flex" };
  30947. return {};
  30948. });
  30949. const transitionConfig = computed(() => {
  30950. const transition = props.transition ?? globalConfig.value?.transition ?? DEFAULT_DIALOG_TRANSITION;
  30951. const baseConfig = {
  30952. name: transition,
  30953. onAfterEnter: afterEnter,
  30954. onBeforeLeave: beforeLeave,
  30955. onAfterLeave: afterLeave
  30956. };
  30957. if (isObject$1(transition)) {
  30958. const config = { ...transition };
  30959. const _mergeHook = (userHook, defaultHook) => {
  30960. return (el) => {
  30961. if (isArray$1(userHook)) userHook.forEach((fn) => {
  30962. if (isFunction$1(fn)) fn(el);
  30963. });
  30964. else if (isFunction$1(userHook)) userHook(el);
  30965. defaultHook();
  30966. };
  30967. };
  30968. config.onAfterEnter = _mergeHook(config.onAfterEnter, afterEnter);
  30969. config.onBeforeLeave = _mergeHook(config.onBeforeLeave, beforeLeave);
  30970. config.onAfterLeave = _mergeHook(config.onAfterLeave, afterLeave);
  30971. if (!config.name) {
  30972. config.name = DEFAULT_DIALOG_TRANSITION;
  30973. /* @__PURE__ */ debugWarn(COMPONENT_NAME$9, `transition.name is missing when using object syntax, fallback to '${DEFAULT_DIALOG_TRANSITION}'`);
  30974. }
  30975. return config;
  30976. }
  30977. return baseConfig;
  30978. });
  30979. function afterEnter() {
  30980. emit("opened");
  30981. }
  30982. function afterLeave() {
  30983. emit("closed");
  30984. emit(UPDATE_MODEL_EVENT, false);
  30985. if (props.destroyOnClose) rendered.value = false;
  30986. closing.value = false;
  30987. }
  30988. function beforeLeave() {
  30989. closing.value = true;
  30990. emit("close");
  30991. }
  30992. function open() {
  30993. closeTimer?.();
  30994. openTimer?.();
  30995. if (props.openDelay && props.openDelay > 0) ({stop: openTimer} = useTimeoutFn(() => doOpen(), props.openDelay));
  30996. else doOpen();
  30997. }
  30998. function close() {
  30999. openTimer?.();
  31000. closeTimer?.();
  31001. if (props.closeDelay && props.closeDelay > 0) ({stop: closeTimer} = useTimeoutFn(() => doClose(), props.closeDelay));
  31002. else doClose();
  31003. }
  31004. function handleClose() {
  31005. function hide(shouldCancel) {
  31006. if (shouldCancel) return;
  31007. closed.value = true;
  31008. visible.value = false;
  31009. }
  31010. if (props.beforeClose) props.beforeClose(hide);
  31011. else close();
  31012. }
  31013. function onModalClick() {
  31014. if (props.closeOnClickModal) handleClose();
  31015. }
  31016. function doOpen() {
  31017. if (!isClient) return;
  31018. visible.value = true;
  31019. }
  31020. function doClose() {
  31021. visible.value = false;
  31022. }
  31023. function onOpenAutoFocus() {
  31024. emit("openAutoFocus");
  31025. }
  31026. function onCloseAutoFocus() {
  31027. emit("closeAutoFocus");
  31028. }
  31029. function onFocusoutPrevented(event) {
  31030. if (event.detail?.focusReason === "pointer") event.preventDefault();
  31031. }
  31032. if (props.lockScroll) useLockscreen(visible);
  31033. function onCloseRequested() {
  31034. if (props.closeOnPressEscape) handleClose();
  31035. }
  31036. watch(() => props.zIndex, () => {
  31037. zIndex.value = props.zIndex ?? nextZIndex();
  31038. });
  31039. watch(() => props.modelValue, (val) => {
  31040. if (val) {
  31041. closed.value = false;
  31042. closing.value = false;
  31043. open();
  31044. rendered.value = true;
  31045. zIndex.value = props.zIndex ?? nextZIndex();
  31046. nextTick(() => {
  31047. emit("open");
  31048. if (targetRef.value) {
  31049. targetRef.value.parentElement.scrollTop = 0;
  31050. targetRef.value.parentElement.scrollLeft = 0;
  31051. targetRef.value.scrollTop = 0;
  31052. }
  31053. });
  31054. } else if (visible.value) close();
  31055. });
  31056. watch(() => props.fullscreen, (val) => {
  31057. if (!targetRef.value) return;
  31058. if (val) {
  31059. lastPosition = targetRef.value.style.transform;
  31060. targetRef.value.style.transform = "";
  31061. } else targetRef.value.style.transform = lastPosition;
  31062. });
  31063. onMounted(() => {
  31064. if (props.modelValue) {
  31065. visible.value = true;
  31066. rendered.value = true;
  31067. open();
  31068. }
  31069. });
  31070. return {
  31071. afterEnter,
  31072. afterLeave,
  31073. beforeLeave,
  31074. handleClose,
  31075. onModalClick,
  31076. close,
  31077. doClose,
  31078. onOpenAutoFocus,
  31079. onCloseAutoFocus,
  31080. onCloseRequested,
  31081. onFocusoutPrevented,
  31082. titleId,
  31083. bodyId,
  31084. closed,
  31085. style,
  31086. overlayDialogStyle,
  31087. rendered,
  31088. visible,
  31089. zIndex,
  31090. transitionConfig,
  31091. _draggable,
  31092. _alignCenter,
  31093. _overflow,
  31094. closing
  31095. };
  31096. };
  31097. //#endregion
  31098. //#region ../../packages/components/dialog/src/dialog.vue?vue&type=script&setup=true&lang.ts
  31099. const _hoisted_1$41 = [
  31100. "aria-label",
  31101. "aria-labelledby",
  31102. "aria-describedby"
  31103. ];
  31104. var dialog_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  31105. name: "ElDialog",
  31106. inheritAttrs: false,
  31107. __name: "dialog",
  31108. props: dialogProps,
  31109. emits: dialogEmits,
  31110. setup(__props, { expose: __expose }) {
  31111. const props = __props;
  31112. const slots = useSlots();
  31113. useDeprecated({
  31114. scope: "el-dialog",
  31115. from: "the title slot",
  31116. replacement: "the header slot",
  31117. version: "3.0.0",
  31118. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  31119. }, computed(() => !!slots.title));
  31120. const ns = useNamespace("dialog");
  31121. const dialogRef = ref();
  31122. const headerRef = ref();
  31123. const dialogContentRef = ref();
  31124. const { visible, titleId, bodyId, style, overlayDialogStyle, rendered, transitionConfig, zIndex, _draggable, _alignCenter, _overflow, handleClose, onModalClick, onOpenAutoFocus, onCloseAutoFocus, onCloseRequested, onFocusoutPrevented, closing } = useDialog(props, dialogRef);
  31125. provide(dialogInjectionKey, {
  31126. dialogRef,
  31127. headerRef,
  31128. bodyId,
  31129. ns,
  31130. rendered,
  31131. style
  31132. });
  31133. const overlayEvent = useSameTarget(onModalClick);
  31134. const penetrable = computed(() => props.modalPenetrable && !props.modal && !props.fullscreen);
  31135. const resetPosition = () => {
  31136. dialogContentRef.value?.resetPosition();
  31137. };
  31138. __expose({
  31139. visible,
  31140. dialogContentRef,
  31141. resetPosition,
  31142. handleClose
  31143. });
  31144. return (_ctx, _cache) => {
  31145. return openBlock(), createBlock(unref(ElTeleport), {
  31146. to: __props.appendTo,
  31147. disabled: __props.appendTo !== "body" ? false : !__props.appendToBody
  31148. }, {
  31149. default: withCtx(() => [createVNode(Transition, mergeProps(unref(transitionConfig), { persisted: "" }), {
  31150. default: withCtx(() => [withDirectives(createVNode(unref(ElOverlay), {
  31151. "custom-mask-event": "",
  31152. mask: __props.modal,
  31153. "overlay-class": [
  31154. __props.modalClass ?? "",
  31155. `${unref(ns).namespace.value}-modal-dialog`,
  31156. unref(ns).is("penetrable", penetrable.value)
  31157. ],
  31158. "z-index": unref(zIndex)
  31159. }, {
  31160. default: withCtx(() => [createElementVNode("div", {
  31161. role: "dialog",
  31162. "aria-modal": "true",
  31163. "aria-label": __props.title || void 0,
  31164. "aria-labelledby": !__props.title ? unref(titleId) : void 0,
  31165. "aria-describedby": unref(bodyId),
  31166. class: normalizeClass([`${unref(ns).namespace.value}-overlay-dialog`, unref(ns).is("closing", unref(closing))]),
  31167. style: normalizeStyle(unref(overlayDialogStyle)),
  31168. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  31169. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  31170. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  31171. }, [createVNode(unref(focus_trap_default), {
  31172. loop: "",
  31173. trapped: unref(visible),
  31174. "focus-start-el": "container",
  31175. onFocusAfterTrapped: unref(onOpenAutoFocus),
  31176. onFocusAfterReleased: unref(onCloseAutoFocus),
  31177. onFocusoutPrevented: unref(onFocusoutPrevented),
  31178. onReleaseRequested: unref(onCloseRequested)
  31179. }, {
  31180. default: withCtx(() => [unref(rendered) ? (openBlock(), createBlock(dialog_content_default, mergeProps({
  31181. key: 0,
  31182. ref_key: "dialogContentRef",
  31183. ref: dialogContentRef
  31184. }, _ctx.$attrs, {
  31185. center: __props.center,
  31186. "align-center": unref(_alignCenter),
  31187. "close-icon": __props.closeIcon,
  31188. draggable: unref(_draggable),
  31189. overflow: unref(_overflow),
  31190. fullscreen: __props.fullscreen,
  31191. "header-class": __props.headerClass,
  31192. "body-class": __props.bodyClass,
  31193. "footer-class": __props.footerClass,
  31194. "show-close": __props.showClose,
  31195. title: __props.title,
  31196. "aria-level": __props.headerAriaLevel,
  31197. onClose: unref(handleClose)
  31198. }), createSlots({
  31199. header: withCtx(() => [!_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  31200. key: 0,
  31201. close: unref(handleClose),
  31202. titleId: unref(titleId),
  31203. titleClass: unref(ns).e("title")
  31204. }) : renderSlot(_ctx.$slots, "title", { key: 1 })]),
  31205. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  31206. _: 2
  31207. }, [_ctx.$slots.footer ? {
  31208. name: "footer",
  31209. fn: withCtx(() => [renderSlot(_ctx.$slots, "footer")]),
  31210. key: "0"
  31211. } : void 0]), 1040, [
  31212. "center",
  31213. "align-center",
  31214. "close-icon",
  31215. "draggable",
  31216. "overflow",
  31217. "fullscreen",
  31218. "header-class",
  31219. "body-class",
  31220. "footer-class",
  31221. "show-close",
  31222. "title",
  31223. "aria-level",
  31224. "onClose"
  31225. ])) : createCommentVNode("v-if", true)]),
  31226. _: 3
  31227. }, 8, [
  31228. "trapped",
  31229. "onFocusAfterTrapped",
  31230. "onFocusAfterReleased",
  31231. "onFocusoutPrevented",
  31232. "onReleaseRequested"
  31233. ])], 46, _hoisted_1$41)]),
  31234. _: 3
  31235. }, 8, [
  31236. "mask",
  31237. "overlay-class",
  31238. "z-index"
  31239. ]), [[vShow, unref(visible)]])]),
  31240. _: 3
  31241. }, 16)]),
  31242. _: 3
  31243. }, 8, ["to", "disabled"]);
  31244. };
  31245. }
  31246. });
  31247. //#endregion
  31248. //#region ../../packages/components/dialog/src/dialog.vue
  31249. var dialog_default = dialog_vue_vue_type_script_setup_true_lang_default;
  31250. //#endregion
  31251. //#region ../../packages/components/dialog/index.ts
  31252. const ElDialog = withInstall(dialog_default);
  31253. //#endregion
  31254. //#region ../../packages/components/divider/src/divider.ts
  31255. /**
  31256. * @deprecated Removed after 3.0.0, Use `DividerProps` instead.
  31257. */
  31258. const dividerProps = buildProps({
  31259. direction: {
  31260. type: String,
  31261. values: ["horizontal", "vertical"],
  31262. default: "horizontal"
  31263. },
  31264. contentPosition: {
  31265. type: String,
  31266. values: [
  31267. "left",
  31268. "center",
  31269. "right"
  31270. ],
  31271. default: "center"
  31272. },
  31273. borderStyle: {
  31274. type: definePropType(String),
  31275. default: "solid"
  31276. }
  31277. });
  31278. //#endregion
  31279. //#region ../../packages/components/divider/src/divider.vue?vue&type=script&setup=true&lang.ts
  31280. var divider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  31281. name: "ElDivider",
  31282. __name: "divider",
  31283. props: dividerProps,
  31284. setup(__props) {
  31285. const props = __props;
  31286. const ns = useNamespace("divider");
  31287. const dividerStyle = computed(() => {
  31288. return ns.cssVar({ "border-style": props.borderStyle });
  31289. });
  31290. return (_ctx, _cache) => {
  31291. return openBlock(), createElementBlock("div", {
  31292. class: normalizeClass([unref(ns).b(), unref(ns).m(__props.direction)]),
  31293. style: normalizeStyle(dividerStyle.value),
  31294. role: "separator"
  31295. }, [_ctx.$slots.default && __props.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  31296. key: 0,
  31297. class: normalizeClass([unref(ns).e("text"), unref(ns).is(__props.contentPosition)])
  31298. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true)], 6);
  31299. };
  31300. }
  31301. });
  31302. //#endregion
  31303. //#region ../../packages/components/divider/src/divider.vue
  31304. var divider_default = divider_vue_vue_type_script_setup_true_lang_default;
  31305. //#endregion
  31306. //#region ../../packages/components/divider/index.ts
  31307. const ElDivider = withInstall(divider_default);
  31308. //#endregion
  31309. //#region ../../packages/components/drawer/src/drawer.ts
  31310. /**
  31311. * @deprecated Removed after 3.0.0, Use `DrawerProps` instead.
  31312. */
  31313. const drawerProps = buildProps({
  31314. ...dialogProps,
  31315. direction: {
  31316. type: String,
  31317. default: "rtl",
  31318. values: [
  31319. "ltr",
  31320. "rtl",
  31321. "ttb",
  31322. "btt"
  31323. ]
  31324. },
  31325. resizable: Boolean,
  31326. size: {
  31327. type: [String, Number],
  31328. default: "30%"
  31329. },
  31330. withHeader: {
  31331. type: Boolean,
  31332. default: true
  31333. },
  31334. modalFade: {
  31335. type: Boolean,
  31336. default: true
  31337. },
  31338. headerAriaLevel: {
  31339. type: String,
  31340. default: "2"
  31341. }
  31342. });
  31343. const drawerEmits = {
  31344. ...dialogEmits,
  31345. "resize-start": (evt, size) => evt instanceof MouseEvent && typeof size === "number",
  31346. resize: (evt, size) => evt instanceof MouseEvent && typeof size === "number",
  31347. "resize-end": (evt, size) => evt instanceof MouseEvent && typeof size === "number"
  31348. };
  31349. //#endregion
  31350. //#region ../../packages/components/drawer/src/composables/useResizable.ts
  31351. function useResizable(props, target, emit) {
  31352. const { width, height } = useWindowSize();
  31353. const isHorizontal = computed(() => ["ltr", "rtl"].includes(props.direction));
  31354. const sign = computed(() => ["ltr", "ttb"].includes(props.direction) ? 1 : -1);
  31355. const windowSize = computed(() => isHorizontal.value ? width.value : height.value);
  31356. const getSize = computed(() => {
  31357. return clamp$2(startSize.value + sign.value * offset.value, 4, windowSize.value);
  31358. });
  31359. const startSize = ref(0);
  31360. const offset = ref(0);
  31361. const isResizing = ref(false);
  31362. const hasStartedDragging = ref(false);
  31363. let startPos = [];
  31364. let cleanups = [];
  31365. const getActualSize = () => {
  31366. const drawerEl = target.value?.closest("[aria-modal=\"true\"]");
  31367. if (drawerEl) return isHorizontal.value ? drawerEl.offsetWidth : drawerEl.offsetHeight;
  31368. return 100;
  31369. };
  31370. watch(() => [props.size, props.resizable], () => {
  31371. hasStartedDragging.value = false;
  31372. startSize.value = 0;
  31373. offset.value = 0;
  31374. onMouseUp();
  31375. });
  31376. const onMousedown = (e) => {
  31377. if (!props.resizable) return;
  31378. if (!hasStartedDragging.value) {
  31379. startSize.value = getActualSize();
  31380. hasStartedDragging.value = true;
  31381. }
  31382. startPos = [e.pageX, e.pageY];
  31383. isResizing.value = true;
  31384. emit("resize-start", e, startSize.value);
  31385. cleanups.push(useEventListener(window, "mouseup", onMouseUp), useEventListener(window, "mousemove", onMouseMove));
  31386. };
  31387. const onMouseMove = (e) => {
  31388. const { pageX, pageY } = e;
  31389. const offsetX = pageX - startPos[0];
  31390. const offsetY = pageY - startPos[1];
  31391. offset.value = isHorizontal.value ? offsetX : offsetY;
  31392. emit("resize", e, getSize.value);
  31393. };
  31394. const onMouseUp = (e) => {
  31395. if (!isResizing.value) return;
  31396. startPos = [];
  31397. startSize.value = getSize.value;
  31398. offset.value = 0;
  31399. isResizing.value = false;
  31400. cleanups.forEach((cleanup) => cleanup?.());
  31401. cleanups = [];
  31402. if (e) emit("resize-end", e, startSize.value);
  31403. };
  31404. const cleanup = useEventListener(target, "mousedown", onMousedown);
  31405. onBeforeUnmount(() => {
  31406. cleanup();
  31407. onMouseUp();
  31408. });
  31409. return {
  31410. size: computed(() => {
  31411. return hasStartedDragging.value ? `${getSize.value}px` : addUnit(props.size);
  31412. }),
  31413. isResizing,
  31414. isHorizontal
  31415. };
  31416. }
  31417. //#endregion
  31418. //#region ../../packages/components/drawer/src/drawer.vue?vue&type=script&setup=true&lang.ts
  31419. const _hoisted_1$40 = [
  31420. "aria-label",
  31421. "aria-labelledby",
  31422. "aria-describedby"
  31423. ];
  31424. const _hoisted_2$24 = ["id", "aria-level"];
  31425. const _hoisted_3$9 = ["aria-label"];
  31426. const _hoisted_4$7 = ["id"];
  31427. var drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  31428. name: "ElDrawer",
  31429. inheritAttrs: false,
  31430. __name: "drawer",
  31431. props: drawerProps,
  31432. emits: drawerEmits,
  31433. setup(__props, { expose: __expose, emit: __emit }) {
  31434. const props = __props;
  31435. const emit = __emit;
  31436. const slots = useSlots();
  31437. useDeprecated({
  31438. scope: "el-drawer",
  31439. from: "the title slot",
  31440. replacement: "the header slot",
  31441. version: "3.0.0",
  31442. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  31443. }, computed(() => !!slots.title));
  31444. const drawerRef = ref();
  31445. const focusStartRef = ref();
  31446. const draggerRef = ref();
  31447. const ns = useNamespace("drawer");
  31448. const { t } = useLocale();
  31449. const { afterEnter, afterLeave, beforeLeave, visible, rendered, titleId, bodyId, zIndex, onModalClick, onOpenAutoFocus, onCloseAutoFocus, onFocusoutPrevented, onCloseRequested, handleClose } = useDialog(props, drawerRef);
  31450. const { isHorizontal, size, isResizing } = useResizable(props, draggerRef, emit);
  31451. const penetrable = computed(() => props.modalPenetrable && !props.modal);
  31452. __expose({
  31453. handleClose,
  31454. afterEnter,
  31455. afterLeave
  31456. });
  31457. return (_ctx, _cache) => {
  31458. return openBlock(), createBlock(unref(ElTeleport), {
  31459. to: __props.appendTo,
  31460. disabled: __props.appendTo !== "body" ? false : !__props.appendToBody
  31461. }, {
  31462. default: withCtx(() => [createVNode(Transition, {
  31463. name: unref(ns).b("fade"),
  31464. onAfterEnter: unref(afterEnter),
  31465. onAfterLeave: unref(afterLeave),
  31466. onBeforeLeave: unref(beforeLeave),
  31467. persisted: ""
  31468. }, {
  31469. default: withCtx(() => [withDirectives(createVNode(unref(ElOverlay), {
  31470. mask: __props.modal,
  31471. "overlay-class": [
  31472. unref(ns).is("drawer"),
  31473. __props.modalClass ?? "",
  31474. `${unref(ns).namespace.value}-modal-drawer`,
  31475. unref(ns).is("penetrable", penetrable.value)
  31476. ],
  31477. "z-index": unref(zIndex),
  31478. onClick: unref(onModalClick)
  31479. }, {
  31480. default: withCtx(() => [createVNode(unref(focus_trap_default), {
  31481. loop: "",
  31482. trapped: unref(visible),
  31483. "focus-trap-el": drawerRef.value,
  31484. "focus-start-el": focusStartRef.value,
  31485. onFocusAfterTrapped: unref(onOpenAutoFocus),
  31486. onFocusAfterReleased: unref(onCloseAutoFocus),
  31487. onFocusoutPrevented: unref(onFocusoutPrevented),
  31488. onReleaseRequested: unref(onCloseRequested)
  31489. }, {
  31490. default: withCtx(() => [createElementVNode("div", mergeProps({
  31491. ref_key: "drawerRef",
  31492. ref: drawerRef,
  31493. "aria-modal": "true",
  31494. "aria-label": __props.title || void 0,
  31495. "aria-labelledby": !__props.title ? unref(titleId) : void 0,
  31496. "aria-describedby": unref(bodyId)
  31497. }, _ctx.$attrs, {
  31498. class: [
  31499. unref(ns).b(),
  31500. __props.direction,
  31501. unref(visible) && "open",
  31502. unref(ns).is("dragging", unref(isResizing))
  31503. ],
  31504. style: { [unref(isHorizontal) ? "width" : "height"]: unref(size) },
  31505. role: "dialog",
  31506. onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
  31507. }), [
  31508. createElementVNode("span", {
  31509. ref_key: "focusStartRef",
  31510. ref: focusStartRef,
  31511. class: normalizeClass(unref(ns).e("sr-focus")),
  31512. tabindex: "-1"
  31513. }, null, 2),
  31514. __props.withHeader ? (openBlock(), createElementBlock("header", {
  31515. key: 0,
  31516. class: normalizeClass([unref(ns).e("header"), __props.headerClass])
  31517. }, [!_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  31518. key: 0,
  31519. close: unref(handleClose),
  31520. titleId: unref(titleId),
  31521. titleClass: unref(ns).e("title")
  31522. }, () => [createElementVNode("span", {
  31523. id: unref(titleId),
  31524. role: "heading",
  31525. "aria-level": __props.headerAriaLevel,
  31526. class: normalizeClass(unref(ns).e("title"))
  31527. }, toDisplayString(__props.title), 11, _hoisted_2$24)]) : renderSlot(_ctx.$slots, "title", { key: 1 }, () => [createCommentVNode(" DEPRECATED SLOT ")]), __props.showClose ? (openBlock(), createElementBlock("button", {
  31528. key: 2,
  31529. "aria-label": unref(t)("el.drawer.close"),
  31530. class: normalizeClass(unref(ns).e("close-btn")),
  31531. type: "button",
  31532. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClose) && unref(handleClose)(...args))
  31533. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(ns).e("close")) }, {
  31534. default: withCtx(() => [createVNode(unref(close_default))]),
  31535. _: 1
  31536. }, 8, ["class"])], 10, _hoisted_3$9)) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true),
  31537. unref(rendered) ? (openBlock(), createElementBlock("div", {
  31538. key: 1,
  31539. id: unref(bodyId),
  31540. class: normalizeClass([unref(ns).e("body"), __props.bodyClass])
  31541. }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_4$7)) : createCommentVNode("v-if", true),
  31542. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  31543. key: 2,
  31544. class: normalizeClass([unref(ns).e("footer"), __props.footerClass])
  31545. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true),
  31546. __props.resizable ? (openBlock(), createElementBlock("div", {
  31547. key: 3,
  31548. ref_key: "draggerRef",
  31549. ref: draggerRef,
  31550. style: normalizeStyle({ zIndex: unref(zIndex) }),
  31551. class: normalizeClass(unref(ns).e("dragger"))
  31552. }, null, 6)) : createCommentVNode("v-if", true)
  31553. ], 16, _hoisted_1$40)]),
  31554. _: 3
  31555. }, 8, [
  31556. "trapped",
  31557. "focus-trap-el",
  31558. "focus-start-el",
  31559. "onFocusAfterTrapped",
  31560. "onFocusAfterReleased",
  31561. "onFocusoutPrevented",
  31562. "onReleaseRequested"
  31563. ])]),
  31564. _: 3
  31565. }, 8, [
  31566. "mask",
  31567. "overlay-class",
  31568. "z-index",
  31569. "onClick"
  31570. ]), [[vShow, unref(visible)]])]),
  31571. _: 3
  31572. }, 8, [
  31573. "name",
  31574. "onAfterEnter",
  31575. "onAfterLeave",
  31576. "onBeforeLeave"
  31577. ])]),
  31578. _: 3
  31579. }, 8, ["to", "disabled"]);
  31580. };
  31581. }
  31582. });
  31583. //#endregion
  31584. //#region ../../packages/components/drawer/src/drawer.vue
  31585. var drawer_default = drawer_vue_vue_type_script_setup_true_lang_default;
  31586. //#endregion
  31587. //#region ../../packages/components/drawer/index.ts
  31588. const ElDrawer = withInstall(drawer_default);
  31589. //#endregion
  31590. //#region ../../packages/components/collection/src/collection.vue?vue&type=script&lang.ts
  31591. var collection_vue_vue_type_script_lang_default = defineComponent({ inheritAttrs: false });
  31592. //#endregion
  31593. //#region ../../packages/components/collection/src/collection.vue
  31594. function _sfc_render$16(_ctx, _cache, $props, $setup, $data, $options) {
  31595. return renderSlot(_ctx.$slots, "default");
  31596. }
  31597. var collection_default = /* @__PURE__ */ _plugin_vue_export_helper_default(collection_vue_vue_type_script_lang_default, [["render", _sfc_render$16]]);
  31598. //#endregion
  31599. //#region ../../packages/components/collection/src/collection-item.vue?vue&type=script&lang.ts
  31600. var collection_item_vue_vue_type_script_lang_default = defineComponent({
  31601. name: "ElCollectionItem",
  31602. inheritAttrs: false
  31603. });
  31604. //#endregion
  31605. //#region ../../packages/components/collection/src/collection-item.vue
  31606. function _sfc_render$15(_ctx, _cache, $props, $setup, $data, $options) {
  31607. return renderSlot(_ctx.$slots, "default");
  31608. }
  31609. var collection_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(collection_item_vue_vue_type_script_lang_default, [["render", _sfc_render$15]]);
  31610. //#endregion
  31611. //#region ../../packages/components/collection/src/collection.ts
  31612. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  31613. const createCollectionWithScope = (name) => {
  31614. const COLLECTION_NAME = `El${name}Collection`;
  31615. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  31616. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  31617. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  31618. return {
  31619. COLLECTION_INJECTION_KEY,
  31620. COLLECTION_ITEM_INJECTION_KEY,
  31621. ElCollection: Object.assign({}, collection_default, {
  31622. name: COLLECTION_NAME,
  31623. setup() {
  31624. const collectionRef = ref();
  31625. const itemMap = /* @__PURE__ */ new Map();
  31626. const getItems = (() => {
  31627. const collectionEl = unref(collectionRef);
  31628. if (!collectionEl) return [];
  31629. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  31630. return [...itemMap.values()].sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  31631. });
  31632. provide(COLLECTION_INJECTION_KEY, {
  31633. itemMap,
  31634. getItems,
  31635. collectionRef
  31636. });
  31637. }
  31638. }),
  31639. ElCollectionItem: Object.assign({}, collection_item_default, {
  31640. name: COLLECTION_ITEM_NAME,
  31641. setup(_, { attrs }) {
  31642. const collectionItemRef = ref();
  31643. const collectionInjection = inject(COLLECTION_INJECTION_KEY, void 0);
  31644. provide(COLLECTION_ITEM_INJECTION_KEY, { collectionItemRef });
  31645. onMounted(() => {
  31646. const collectionItemEl = unref(collectionItemRef);
  31647. if (collectionItemEl) collectionInjection.itemMap.set(collectionItemEl, {
  31648. ref: collectionItemEl,
  31649. ...attrs
  31650. });
  31651. });
  31652. onBeforeUnmount(() => {
  31653. const collectionItemEl = unref(collectionItemRef);
  31654. collectionInjection.itemMap.delete(collectionItemEl);
  31655. });
  31656. }
  31657. })
  31658. };
  31659. };
  31660. //#endregion
  31661. //#region ../../packages/components/roving-focus-group/src/roving-focus-group.ts
  31662. const rovingFocusGroupProps = buildProps({
  31663. style: { type: definePropType([
  31664. String,
  31665. Array,
  31666. Object
  31667. ]) },
  31668. currentTabId: { type: definePropType(String) },
  31669. defaultCurrentTabId: String,
  31670. loop: Boolean,
  31671. dir: {
  31672. type: String,
  31673. values: ["ltr", "rtl"],
  31674. default: "ltr"
  31675. },
  31676. orientation: { type: definePropType(String) },
  31677. onBlur: Function,
  31678. onFocus: Function,
  31679. onMousedown: Function
  31680. });
  31681. const { ElCollection, ElCollectionItem, COLLECTION_INJECTION_KEY, COLLECTION_ITEM_INJECTION_KEY } = createCollectionWithScope("RovingFocusGroup");
  31682. //#endregion
  31683. //#region ../../packages/components/roving-focus-group/src/tokens.ts
  31684. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  31685. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  31686. //#endregion
  31687. //#region ../../packages/components/roving-focus-group/src/utils.ts
  31688. const MAP_KEY_TO_FOCUS_INTENT = {
  31689. ArrowLeft: "prev",
  31690. ArrowUp: "prev",
  31691. ArrowRight: "next",
  31692. ArrowDown: "next",
  31693. PageUp: "first",
  31694. Home: "first",
  31695. PageDown: "last",
  31696. End: "last"
  31697. };
  31698. const getDirectionAwareKey = (key, dir) => {
  31699. if (dir !== "rtl") return key;
  31700. switch (key) {
  31701. case EVENT_CODE.right: return EVENT_CODE.left;
  31702. case EVENT_CODE.left: return EVENT_CODE.right;
  31703. default: return key;
  31704. }
  31705. };
  31706. const getFocusIntent = (event, orientation, dir) => {
  31707. const key = getDirectionAwareKey(getEventCode(event), dir);
  31708. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key)) return void 0;
  31709. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key)) return void 0;
  31710. return MAP_KEY_TO_FOCUS_INTENT[key];
  31711. };
  31712. const reorderArray = (array, atIdx) => {
  31713. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  31714. };
  31715. const focusFirst = (elements) => {
  31716. const { activeElement: prevActive } = document;
  31717. for (const element of elements) {
  31718. if (element === prevActive) return;
  31719. element.focus();
  31720. if (prevActive !== document.activeElement) return;
  31721. }
  31722. };
  31723. //#endregion
  31724. //#region ../../packages/components/roving-focus-group/src/roving-focus-group-impl.vue?vue&type=script&lang.ts
  31725. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  31726. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  31727. const EVT_OPTS = {
  31728. bubbles: false,
  31729. cancelable: true
  31730. };
  31731. var roving_focus_group_impl_vue_vue_type_script_lang_default = defineComponent({
  31732. name: "ElRovingFocusGroupImpl",
  31733. inheritAttrs: false,
  31734. props: rovingFocusGroupProps,
  31735. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  31736. setup(props, { emit }) {
  31737. const currentTabbedId = ref((props.currentTabId || props.defaultCurrentTabId) ?? null);
  31738. const isBackingOut = ref(false);
  31739. const isClickFocus = ref(false);
  31740. const rovingFocusGroupRef = ref();
  31741. const { getItems } = inject(COLLECTION_INJECTION_KEY, void 0);
  31742. const rovingFocusGroupRootStyle = computed(() => {
  31743. return [{ outline: "none" }, props.style];
  31744. });
  31745. const onItemFocus = (tabbedId) => {
  31746. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  31747. };
  31748. const onItemShiftTab = () => {
  31749. isBackingOut.value = true;
  31750. };
  31751. const onMousedown = composeEventHandlers((e) => {
  31752. props.onMousedown?.(e);
  31753. }, () => {
  31754. isClickFocus.value = true;
  31755. });
  31756. const onFocus = composeEventHandlers((e) => {
  31757. props.onFocus?.(e);
  31758. }, (e) => {
  31759. const isKeyboardFocus = !unref(isClickFocus);
  31760. const { target, currentTarget } = e;
  31761. if (target === currentTarget && isKeyboardFocus && !unref(isBackingOut)) {
  31762. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  31763. currentTarget?.dispatchEvent(entryFocusEvt);
  31764. if (!entryFocusEvt.defaultPrevented) {
  31765. const items = getItems().filter((item) => item.focusable);
  31766. focusFirst([
  31767. items.find((item) => item.active),
  31768. items.find((item) => item.id === unref(currentTabbedId)),
  31769. ...items
  31770. ].filter(Boolean).map((item) => item.ref));
  31771. }
  31772. }
  31773. isClickFocus.value = false;
  31774. });
  31775. const onBlur = composeEventHandlers((e) => {
  31776. props.onBlur?.(e);
  31777. }, () => {
  31778. isBackingOut.value = false;
  31779. });
  31780. const handleEntryFocus = (...args) => {
  31781. emit("entryFocus", ...args);
  31782. };
  31783. const onKeydown = (e) => {
  31784. const focusIntent = getFocusIntent(e);
  31785. if (focusIntent) {
  31786. e.preventDefault();
  31787. let elements = getItems().filter((item) => item.focusable).map((item) => item.ref);
  31788. switch (focusIntent) {
  31789. case "last":
  31790. elements.reverse();
  31791. break;
  31792. case "prev":
  31793. case "next": {
  31794. if (focusIntent === "prev") elements.reverse();
  31795. const currentIdx = elements.indexOf(e.currentTarget);
  31796. elements = props.loop ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  31797. break;
  31798. }
  31799. default: break;
  31800. }
  31801. nextTick(() => {
  31802. focusFirst(elements);
  31803. });
  31804. }
  31805. };
  31806. provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  31807. currentTabbedId: readonly(currentTabbedId),
  31808. loop: toRef(props, "loop"),
  31809. tabIndex: computed(() => {
  31810. return unref(isBackingOut) ? -1 : 0;
  31811. }),
  31812. rovingFocusGroupRef,
  31813. rovingFocusGroupRootStyle,
  31814. orientation: toRef(props, "orientation"),
  31815. dir: toRef(props, "dir"),
  31816. onItemFocus,
  31817. onItemShiftTab,
  31818. onBlur,
  31819. onFocus,
  31820. onMousedown,
  31821. onKeydown
  31822. });
  31823. watch(() => props.currentTabId, (val) => {
  31824. currentTabbedId.value = val ?? null;
  31825. });
  31826. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  31827. }
  31828. });
  31829. //#endregion
  31830. //#region ../../packages/components/roving-focus-group/src/roving-focus-group-impl.vue
  31831. function _sfc_render$14(_ctx, _cache, $props, $setup, $data, $options) {
  31832. return renderSlot(_ctx.$slots, "default");
  31833. }
  31834. var roving_focus_group_impl_default = /* @__PURE__ */ _plugin_vue_export_helper_default(roving_focus_group_impl_vue_vue_type_script_lang_default, [["render", _sfc_render$14]]);
  31835. //#endregion
  31836. //#region ../../packages/components/roving-focus-group/src/roving-focus-group.vue?vue&type=script&lang.ts
  31837. var roving_focus_group_vue_vue_type_script_lang_default = defineComponent({
  31838. name: "ElRovingFocusGroup",
  31839. components: {
  31840. ElFocusGroupCollection: ElCollection,
  31841. ElRovingFocusGroupImpl: roving_focus_group_impl_default
  31842. }
  31843. });
  31844. //#endregion
  31845. //#region ../../packages/components/roving-focus-group/src/roving-focus-group.vue
  31846. function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
  31847. const _component_el_roving_focus_group_impl = resolveComponent("el-roving-focus-group-impl");
  31848. const _component_el_focus_group_collection = resolveComponent("el-focus-group-collection");
  31849. return openBlock(), createBlock(_component_el_focus_group_collection, null, {
  31850. default: withCtx(() => [createVNode(_component_el_roving_focus_group_impl, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
  31851. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  31852. _: 3
  31853. }, 16)]),
  31854. _: 3
  31855. });
  31856. }
  31857. var roving_focus_group_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(roving_focus_group_vue_vue_type_script_lang_default, [["render", _sfc_render$13]]);
  31858. //#endregion
  31859. //#region ../../packages/components/roving-focus-group/src/roving-focus-item.vue?vue&type=script&lang.ts
  31860. var roving_focus_item_vue_vue_type_script_lang_default = defineComponent({
  31861. components: { ElRovingFocusCollectionItem: ElCollectionItem },
  31862. props: {
  31863. focusable: {
  31864. type: Boolean,
  31865. default: true
  31866. },
  31867. active: Boolean
  31868. },
  31869. emits: [
  31870. "mousedown",
  31871. "focus",
  31872. "keydown"
  31873. ],
  31874. setup(props, { emit }) {
  31875. const { currentTabbedId, onItemFocus, onItemShiftTab, onKeydown } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  31876. const id = useId();
  31877. const rovingFocusGroupItemRef = ref();
  31878. const handleMousedown = composeEventHandlers((e) => {
  31879. emit("mousedown", e);
  31880. }, (e) => {
  31881. if (!props.focusable) e.preventDefault();
  31882. else onItemFocus(unref(id));
  31883. });
  31884. const handleFocus = composeEventHandlers((e) => {
  31885. emit("focus", e);
  31886. }, () => {
  31887. onItemFocus(unref(id));
  31888. });
  31889. const handleKeydown = composeEventHandlers((e) => {
  31890. emit("keydown", e);
  31891. }, (e) => {
  31892. const { shiftKey, target, currentTarget } = e;
  31893. if (getEventCode(e) === EVENT_CODE.tab && shiftKey) {
  31894. onItemShiftTab();
  31895. return;
  31896. }
  31897. if (target !== currentTarget) return;
  31898. onKeydown(e);
  31899. });
  31900. const isCurrentTab = computed(() => currentTabbedId.value === unref(id));
  31901. provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  31902. rovingFocusGroupItemRef,
  31903. tabIndex: computed(() => unref(isCurrentTab) ? 0 : -1),
  31904. handleMousedown,
  31905. handleFocus,
  31906. handleKeydown
  31907. });
  31908. return {
  31909. id,
  31910. handleKeydown,
  31911. handleFocus,
  31912. handleMousedown
  31913. };
  31914. }
  31915. });
  31916. //#endregion
  31917. //#region ../../packages/components/roving-focus-group/src/roving-focus-item.vue
  31918. function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
  31919. const _component_el_roving_focus_collection_item = resolveComponent("el-roving-focus-collection-item");
  31920. return openBlock(), createBlock(_component_el_roving_focus_collection_item, {
  31921. id: _ctx.id,
  31922. focusable: _ctx.focusable,
  31923. active: _ctx.active
  31924. }, {
  31925. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  31926. _: 3
  31927. }, 8, [
  31928. "id",
  31929. "focusable",
  31930. "active"
  31931. ]);
  31932. }
  31933. var roving_focus_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(roving_focus_item_vue_vue_type_script_lang_default, [["render", _sfc_render$12]]);
  31934. //#endregion
  31935. //#region ../../packages/components/roving-focus-group/index.ts
  31936. var roving_focus_group_default = roving_focus_group_default$1;
  31937. //#endregion
  31938. //#region ../../packages/components/dropdown/src/dropdown.ts
  31939. const dropdownProps = buildProps({
  31940. trigger: {
  31941. ...useTooltipTriggerProps.trigger,
  31942. type: definePropType([String, Array])
  31943. },
  31944. triggerKeys: {
  31945. type: definePropType(Array),
  31946. default: () => [
  31947. EVENT_CODE.enter,
  31948. EVENT_CODE.numpadEnter,
  31949. EVENT_CODE.space,
  31950. EVENT_CODE.down
  31951. ]
  31952. },
  31953. virtualTriggering: useTooltipTriggerProps.virtualTriggering,
  31954. virtualRef: useTooltipTriggerProps.virtualRef,
  31955. effect: {
  31956. ...useTooltipContentProps.effect,
  31957. default: "light"
  31958. },
  31959. type: { type: definePropType(String) },
  31960. placement: {
  31961. type: definePropType(String),
  31962. default: "bottom"
  31963. },
  31964. popperOptions: {
  31965. type: definePropType(Object),
  31966. default: () => ({})
  31967. },
  31968. id: String,
  31969. size: {
  31970. type: String,
  31971. default: ""
  31972. },
  31973. splitButton: Boolean,
  31974. hideOnClick: {
  31975. type: Boolean,
  31976. default: true
  31977. },
  31978. loop: {
  31979. type: Boolean,
  31980. default: true
  31981. },
  31982. showArrow: {
  31983. type: Boolean,
  31984. default: true
  31985. },
  31986. showTimeout: {
  31987. type: Number,
  31988. default: 150
  31989. },
  31990. hideTimeout: {
  31991. type: Number,
  31992. default: 150
  31993. },
  31994. tabindex: {
  31995. type: definePropType([Number, String]),
  31996. default: 0
  31997. },
  31998. maxHeight: {
  31999. type: definePropType([Number, String]),
  32000. default: ""
  32001. },
  32002. popperClass: useTooltipContentProps.popperClass,
  32003. popperStyle: useTooltipContentProps.popperStyle,
  32004. disabled: Boolean,
  32005. role: {
  32006. type: String,
  32007. values: roleTypes,
  32008. default: "menu"
  32009. },
  32010. buttonProps: { type: definePropType(Object) },
  32011. teleported: useTooltipContentProps.teleported,
  32012. appendTo: useTooltipContentProps.appendTo,
  32013. persistent: {
  32014. type: Boolean,
  32015. default: true
  32016. }
  32017. });
  32018. const dropdownItemProps = buildProps({
  32019. command: {
  32020. type: [
  32021. Object,
  32022. String,
  32023. Number
  32024. ],
  32025. default: () => ({})
  32026. },
  32027. disabled: Boolean,
  32028. divided: Boolean,
  32029. textValue: String,
  32030. icon: { type: iconPropType }
  32031. });
  32032. const dropdownMenuProps = buildProps({ onKeydown: { type: definePropType(Function) } });
  32033. const FIRST_KEYS = [
  32034. EVENT_CODE.down,
  32035. EVENT_CODE.pageDown,
  32036. EVENT_CODE.home
  32037. ];
  32038. const LAST_KEYS = [
  32039. EVENT_CODE.up,
  32040. EVENT_CODE.pageUp,
  32041. EVENT_CODE.end
  32042. ];
  32043. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  32044. //#endregion
  32045. //#region ../../packages/components/dropdown/src/tokens.ts
  32046. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  32047. const DROPDOWN_INSTANCE_INJECTION_KEY = "elDropdown";
  32048. //#endregion
  32049. //#region ../../packages/components/dropdown/src/dropdown.vue?vue&type=script&lang.ts
  32050. const { ButtonGroup: ElButtonGroup$1 } = ElButton;
  32051. var dropdown_vue_vue_type_script_lang_default = defineComponent({
  32052. name: "ElDropdown",
  32053. components: {
  32054. ElButton,
  32055. ElButtonGroup: ElButtonGroup$1,
  32056. ElScrollbar,
  32057. ElTooltip,
  32058. ElRovingFocusGroup: roving_focus_group_default,
  32059. ElOnlyChild: OnlyChild,
  32060. ElIcon,
  32061. ArrowDown: arrow_down_default
  32062. },
  32063. props: dropdownProps,
  32064. emits: [
  32065. "visible-change",
  32066. "click",
  32067. "command"
  32068. ],
  32069. setup(props, { emit }) {
  32070. const _instance = getCurrentInstance();
  32071. const ns = useNamespace("dropdown");
  32072. const { t } = useLocale();
  32073. const triggeringElementRef = ref();
  32074. const referenceElementRef = ref();
  32075. const popperRef = ref();
  32076. const contentRef = ref();
  32077. const scrollbar = ref(null);
  32078. const currentTabId = ref(null);
  32079. const isUsingKeyboard = ref(false);
  32080. const wrapStyle = computed(() => ({ maxHeight: addUnit(props.maxHeight) }));
  32081. const dropdownTriggerKls = computed(() => [ns.m(dropdownSize.value)]);
  32082. const trigger = computed(() => castArray$1(props.trigger));
  32083. const defaultTriggerId = useId().value;
  32084. const triggerId = computed(() => props.id || defaultTriggerId);
  32085. function handleClick() {
  32086. popperRef.value?.onClose(void 0, 0);
  32087. }
  32088. function handleClose() {
  32089. popperRef.value?.onClose();
  32090. }
  32091. function handleOpen() {
  32092. popperRef.value?.onOpen();
  32093. }
  32094. const dropdownSize = useFormSize();
  32095. function commandHandler(...args) {
  32096. emit("command", ...args);
  32097. }
  32098. function onItemEnter() {}
  32099. function onItemLeave() {
  32100. const contentEl = unref(contentRef);
  32101. trigger.value.includes("hover") && contentEl?.focus({ preventScroll: true });
  32102. currentTabId.value = null;
  32103. }
  32104. function handleCurrentTabIdChange(id) {
  32105. currentTabId.value = id;
  32106. }
  32107. function handleBeforeShowTooltip() {
  32108. emit("visible-change", true);
  32109. }
  32110. function handleShowTooltip(event) {
  32111. isUsingKeyboard.value = event?.type === "keydown";
  32112. contentRef.value?.focus();
  32113. }
  32114. function handleBeforeHideTooltip() {
  32115. emit("visible-change", false);
  32116. }
  32117. provide(DROPDOWN_INJECTION_KEY, {
  32118. contentRef,
  32119. role: computed(() => props.role),
  32120. triggerId,
  32121. isUsingKeyboard,
  32122. onItemEnter,
  32123. onItemLeave,
  32124. handleClose
  32125. });
  32126. provide(DROPDOWN_INSTANCE_INJECTION_KEY, {
  32127. instance: _instance,
  32128. dropdownSize,
  32129. handleClick,
  32130. commandHandler,
  32131. trigger: toRef(props, "trigger"),
  32132. hideOnClick: toRef(props, "hideOnClick")
  32133. });
  32134. const handlerMainButtonClick = (event) => {
  32135. emit("click", event);
  32136. };
  32137. return {
  32138. t,
  32139. ns,
  32140. scrollbar,
  32141. wrapStyle,
  32142. dropdownTriggerKls,
  32143. dropdownSize,
  32144. triggerId,
  32145. currentTabId,
  32146. handleCurrentTabIdChange,
  32147. handlerMainButtonClick,
  32148. handleClose,
  32149. handleOpen,
  32150. handleBeforeShowTooltip,
  32151. handleShowTooltip,
  32152. handleBeforeHideTooltip,
  32153. popperRef,
  32154. contentRef,
  32155. triggeringElementRef,
  32156. referenceElementRef
  32157. };
  32158. }
  32159. });
  32160. //#endregion
  32161. //#region ../../packages/components/dropdown/src/dropdown.vue
  32162. function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
  32163. const _component_el_roving_focus_group = resolveComponent("el-roving-focus-group");
  32164. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  32165. const _component_el_only_child = resolveComponent("el-only-child");
  32166. const _component_el_tooltip = resolveComponent("el-tooltip");
  32167. const _component_el_button = resolveComponent("el-button");
  32168. const _component_arrow_down = resolveComponent("arrow-down");
  32169. const _component_el_icon = resolveComponent("el-icon");
  32170. const _component_el_button_group = resolveComponent("el-button-group");
  32171. return openBlock(), createElementBlock("div", { class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)]) }, [createVNode(_component_el_tooltip, {
  32172. ref: "popperRef",
  32173. role: _ctx.role,
  32174. effect: _ctx.effect,
  32175. "fallback-placements": ["bottom", "top"],
  32176. "popper-options": _ctx.popperOptions,
  32177. "gpu-acceleration": false,
  32178. placement: _ctx.placement,
  32179. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  32180. "popper-style": _ctx.popperStyle,
  32181. trigger: _ctx.trigger,
  32182. "trigger-keys": _ctx.triggerKeys,
  32183. "trigger-target-el": _ctx.contentRef,
  32184. "show-arrow": _ctx.showArrow,
  32185. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  32186. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  32187. "virtual-ref": _ctx.virtualRef ?? _ctx.triggeringElementRef,
  32188. "virtual-triggering": _ctx.virtualTriggering || _ctx.splitButton,
  32189. disabled: _ctx.disabled,
  32190. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  32191. teleported: _ctx.teleported,
  32192. "append-to": _ctx.appendTo,
  32193. pure: "",
  32194. "focus-on-target": "",
  32195. persistent: _ctx.persistent,
  32196. onBeforeShow: _ctx.handleBeforeShowTooltip,
  32197. onShow: _ctx.handleShowTooltip,
  32198. onBeforeHide: _ctx.handleBeforeHideTooltip
  32199. }, createSlots({
  32200. content: withCtx(() => [createVNode(_component_el_scrollbar, {
  32201. ref: "scrollbar",
  32202. "wrap-style": _ctx.wrapStyle,
  32203. tag: "div",
  32204. "view-class": _ctx.ns.e("list")
  32205. }, {
  32206. default: withCtx(() => [createVNode(_component_el_roving_focus_group, {
  32207. loop: _ctx.loop,
  32208. "current-tab-id": _ctx.currentTabId,
  32209. orientation: "horizontal",
  32210. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange
  32211. }, {
  32212. default: withCtx(() => [renderSlot(_ctx.$slots, "dropdown")]),
  32213. _: 3
  32214. }, 8, [
  32215. "loop",
  32216. "current-tab-id",
  32217. "onCurrentTabIdChange"
  32218. ])]),
  32219. _: 3
  32220. }, 8, ["wrap-style", "view-class"])]),
  32221. _: 2
  32222. }, [!_ctx.splitButton ? {
  32223. name: "default",
  32224. fn: withCtx(() => [createVNode(_component_el_only_child, {
  32225. id: _ctx.triggerId,
  32226. ref: "triggeringElementRef",
  32227. role: "button",
  32228. tabindex: _ctx.tabindex
  32229. }, {
  32230. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  32231. _: 3
  32232. }, 8, ["id", "tabindex"])]),
  32233. key: "0"
  32234. } : void 0]), 1032, [
  32235. "role",
  32236. "effect",
  32237. "popper-options",
  32238. "placement",
  32239. "popper-class",
  32240. "popper-style",
  32241. "trigger",
  32242. "trigger-keys",
  32243. "trigger-target-el",
  32244. "show-arrow",
  32245. "show-after",
  32246. "hide-after",
  32247. "virtual-ref",
  32248. "virtual-triggering",
  32249. "disabled",
  32250. "transition",
  32251. "teleported",
  32252. "append-to",
  32253. "persistent",
  32254. "onBeforeShow",
  32255. "onShow",
  32256. "onBeforeHide"
  32257. ]), _ctx.splitButton ? (openBlock(), createBlock(_component_el_button_group, { key: 0 }, {
  32258. default: withCtx(() => [createVNode(_component_el_button, mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  32259. size: _ctx.dropdownSize,
  32260. type: _ctx.type,
  32261. disabled: _ctx.disabled,
  32262. tabindex: _ctx.tabindex,
  32263. onClick: _ctx.handlerMainButtonClick
  32264. }), {
  32265. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  32266. _: 3
  32267. }, 16, [
  32268. "size",
  32269. "type",
  32270. "disabled",
  32271. "tabindex",
  32272. "onClick"
  32273. ]), createVNode(_component_el_button, mergeProps({
  32274. id: _ctx.triggerId,
  32275. ref: "triggeringElementRef"
  32276. }, _ctx.buttonProps, {
  32277. role: "button",
  32278. size: _ctx.dropdownSize,
  32279. type: _ctx.type,
  32280. class: _ctx.ns.e("caret-button"),
  32281. disabled: _ctx.disabled,
  32282. tabindex: _ctx.tabindex,
  32283. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  32284. }), {
  32285. default: withCtx(() => [createVNode(_component_el_icon, { class: normalizeClass(_ctx.ns.e("icon")) }, {
  32286. default: withCtx(() => [createVNode(_component_arrow_down)]),
  32287. _: 1
  32288. }, 8, ["class"])]),
  32289. _: 1
  32290. }, 16, [
  32291. "id",
  32292. "size",
  32293. "type",
  32294. "class",
  32295. "disabled",
  32296. "tabindex",
  32297. "aria-label"
  32298. ])]),
  32299. _: 3
  32300. })) : createCommentVNode("v-if", true)], 2);
  32301. }
  32302. var dropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(dropdown_vue_vue_type_script_lang_default, [["render", _sfc_render$11]]);
  32303. //#endregion
  32304. //#region ../../packages/components/dropdown/src/dropdown-item-impl.vue?vue&type=script&lang.ts
  32305. var dropdown_item_impl_vue_vue_type_script_lang_default = defineComponent({
  32306. name: "DropdownItemImpl",
  32307. components: { ElIcon },
  32308. props: dropdownItemProps,
  32309. emits: [
  32310. "pointermove",
  32311. "pointerleave",
  32312. "click",
  32313. "clickimpl"
  32314. ],
  32315. setup(_, { emit }) {
  32316. const ns = useNamespace("dropdown");
  32317. const { role: menuRole } = inject(DROPDOWN_INJECTION_KEY, void 0);
  32318. const { collectionItemRef: rovingFocusCollectionItemRef } = inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  32319. const { rovingFocusGroupItemRef, tabIndex, handleFocus, handleKeydown: handleItemKeydown, handleMousedown } = inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  32320. const itemRef = composeRefs(rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  32321. const role = computed(() => {
  32322. if (menuRole.value === "menu") return "menuitem";
  32323. else if (menuRole.value === "navigation") return "link";
  32324. return "button";
  32325. });
  32326. const handleKeydown = composeEventHandlers((e) => {
  32327. const code = getEventCode(e);
  32328. if ([
  32329. EVENT_CODE.enter,
  32330. EVENT_CODE.numpadEnter,
  32331. EVENT_CODE.space
  32332. ].includes(code)) {
  32333. e.preventDefault();
  32334. e.stopImmediatePropagation();
  32335. emit("clickimpl", e);
  32336. return true;
  32337. }
  32338. }, handleItemKeydown);
  32339. return {
  32340. ns,
  32341. itemRef,
  32342. dataset: { [COLLECTION_ITEM_SIGN]: "" },
  32343. role,
  32344. tabIndex,
  32345. handleFocus,
  32346. handleKeydown,
  32347. handleMousedown
  32348. };
  32349. }
  32350. });
  32351. //#endregion
  32352. //#region ../../packages/components/dropdown/src/dropdown-item-impl.vue
  32353. const _hoisted_1$39 = [
  32354. "aria-disabled",
  32355. "tabindex",
  32356. "role"
  32357. ];
  32358. function _sfc_render$10(_ctx, _cache, $props, $setup, $data, $options) {
  32359. const _component_el_icon = resolveComponent("el-icon");
  32360. return openBlock(), createElementBlock(Fragment, null, [_ctx.divided ? (openBlock(), createElementBlock("li", {
  32361. key: 0,
  32362. role: "separator",
  32363. class: normalizeClass(_ctx.ns.bem("menu", "item", "divided"))
  32364. }, null, 2)) : createCommentVNode("v-if", true), createElementVNode("li", mergeProps({ ref: _ctx.itemRef }, {
  32365. ..._ctx.dataset,
  32366. ..._ctx.$attrs
  32367. }, {
  32368. "aria-disabled": _ctx.disabled,
  32369. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  32370. tabindex: _ctx.tabIndex,
  32371. role: _ctx.role,
  32372. onClick: _cache[0] || (_cache[0] = (e) => _ctx.$emit("clickimpl", e)),
  32373. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  32374. onKeydown: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])),
  32375. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)),
  32376. onPointermove: _cache[4] || (_cache[4] = (e) => _ctx.$emit("pointermove", e)),
  32377. onPointerleave: _cache[5] || (_cache[5] = (e) => _ctx.$emit("pointerleave", e))
  32378. }), [_ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  32379. default: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, () => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))])]),
  32380. _: 3
  32381. })) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$39)], 64);
  32382. }
  32383. var dropdown_item_impl_default = /* @__PURE__ */ _plugin_vue_export_helper_default(dropdown_item_impl_vue_vue_type_script_lang_default, [["render", _sfc_render$10]]);
  32384. //#endregion
  32385. //#region ../../packages/components/dropdown/src/useDropdown.ts
  32386. const useDropdown = () => {
  32387. const elDropdown = inject(DROPDOWN_INSTANCE_INJECTION_KEY, {});
  32388. return {
  32389. elDropdown,
  32390. _elDropdownSize: computed(() => elDropdown?.dropdownSize)
  32391. };
  32392. };
  32393. //#endregion
  32394. //#region ../../packages/components/dropdown/src/dropdown-item.vue?vue&type=script&lang.ts
  32395. var dropdown_item_vue_vue_type_script_lang_default = defineComponent({
  32396. name: "ElDropdownItem",
  32397. components: {
  32398. ElRovingFocusItem: roving_focus_item_default,
  32399. ElDropdownItemImpl: dropdown_item_impl_default
  32400. },
  32401. inheritAttrs: false,
  32402. props: dropdownItemProps,
  32403. emits: [
  32404. "pointermove",
  32405. "pointerleave",
  32406. "click"
  32407. ],
  32408. setup(props, { emit, attrs }) {
  32409. const { elDropdown } = useDropdown();
  32410. const _instance = getCurrentInstance();
  32411. const { onItemEnter, onItemLeave } = inject(DROPDOWN_INJECTION_KEY, void 0);
  32412. const handlePointerMove = composeEventHandlers((e) => {
  32413. emit("pointermove", e);
  32414. return e.defaultPrevented;
  32415. }, whenMouse((e) => {
  32416. if (props.disabled) {
  32417. onItemLeave(e);
  32418. return;
  32419. }
  32420. const target = e.currentTarget;
  32421. /**
  32422. * This handles the following scenario:
  32423. * when the item contains a form element such as input element
  32424. * when the mouse is moving over the element itself which is contained by
  32425. * the item, the default focusing logic should be prevented so that
  32426. * it won't cause weird action.
  32427. */
  32428. if (target === document.activeElement || target.contains(document.activeElement)) return;
  32429. onItemEnter(e);
  32430. if (!e.defaultPrevented) target?.focus({ preventScroll: true });
  32431. }));
  32432. const handlePointerLeave = composeEventHandlers((e) => {
  32433. emit("pointerleave", e);
  32434. return e.defaultPrevented;
  32435. }, whenMouse(onItemLeave));
  32436. return {
  32437. handleClick: composeEventHandlers((e) => {
  32438. if (props.disabled) return;
  32439. emit("click", e);
  32440. return e.type !== "keydown" && e.defaultPrevented;
  32441. }, (e) => {
  32442. if (props.disabled) {
  32443. e.stopImmediatePropagation();
  32444. return;
  32445. }
  32446. if (elDropdown?.hideOnClick?.value) elDropdown.handleClick?.();
  32447. elDropdown.commandHandler?.(props.command, _instance, e);
  32448. }),
  32449. handlePointerMove,
  32450. handlePointerLeave,
  32451. propsAndAttrs: computed(() => ({
  32452. ...props,
  32453. ...attrs
  32454. }))
  32455. };
  32456. }
  32457. });
  32458. //#endregion
  32459. //#region ../../packages/components/dropdown/src/dropdown-item.vue
  32460. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  32461. const _component_el_dropdown_item_impl = resolveComponent("el-dropdown-item-impl");
  32462. const _component_el_roving_focus_item = resolveComponent("el-roving-focus-item");
  32463. return openBlock(), createBlock(_component_el_roving_focus_item, { focusable: !_ctx.disabled }, {
  32464. default: withCtx(() => [createVNode(_component_el_dropdown_item_impl, mergeProps(_ctx.propsAndAttrs, {
  32465. onPointerleave: _ctx.handlePointerLeave,
  32466. onPointermove: _ctx.handlePointerMove,
  32467. onClickimpl: _ctx.handleClick
  32468. }), createSlots({
  32469. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  32470. _: 2
  32471. }, [_ctx.$slots.icon ? {
  32472. name: "icon",
  32473. fn: withCtx(() => [renderSlot(_ctx.$slots, "icon")]),
  32474. key: "0"
  32475. } : void 0]), 1040, [
  32476. "onPointerleave",
  32477. "onPointermove",
  32478. "onClickimpl"
  32479. ])]),
  32480. _: 3
  32481. }, 8, ["focusable"]);
  32482. }
  32483. var dropdown_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(dropdown_item_vue_vue_type_script_lang_default, [["render", _sfc_render$9]]);
  32484. //#endregion
  32485. //#region ../../packages/components/dropdown/src/dropdown-menu.vue?vue&type=script&lang.ts
  32486. var dropdown_menu_vue_vue_type_script_lang_default = defineComponent({
  32487. name: "ElDropdownMenu",
  32488. props: dropdownMenuProps,
  32489. setup(props) {
  32490. const ns = useNamespace("dropdown");
  32491. const { _elDropdownSize } = useDropdown();
  32492. const size = _elDropdownSize.value;
  32493. const { contentRef, role, triggerId, isUsingKeyboard, handleClose } = inject(DROPDOWN_INJECTION_KEY, void 0);
  32494. const { rovingFocusGroupRef, rovingFocusGroupRootStyle, onBlur, onFocus, onKeydown, onMousedown } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  32495. const { collectionRef: rovingFocusGroupCollectionRef } = inject(COLLECTION_INJECTION_KEY, void 0);
  32496. const dropdownKls = computed(() => {
  32497. return [ns.b("menu"), ns.bm("menu", size?.value)];
  32498. });
  32499. const dropdownListWrapperRef = composeRefs(contentRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  32500. const handleKeydown = composeEventHandlers((e) => {
  32501. props.onKeydown?.(e);
  32502. }, (e) => {
  32503. const { currentTarget, target } = e;
  32504. const code = getEventCode(e);
  32505. if (currentTarget.contains(target)) {}
  32506. if (EVENT_CODE.tab === code) return handleClose();
  32507. onKeydown(e);
  32508. });
  32509. function handleFocus(e) {
  32510. isUsingKeyboard.value && onFocus(e);
  32511. }
  32512. return {
  32513. size,
  32514. rovingFocusGroupRootStyle,
  32515. dropdownKls,
  32516. role,
  32517. triggerId,
  32518. dropdownListWrapperRef,
  32519. handleKeydown,
  32520. onBlur,
  32521. handleFocus,
  32522. onMousedown
  32523. };
  32524. }
  32525. });
  32526. //#endregion
  32527. //#region ../../packages/components/dropdown/src/dropdown-menu.vue
  32528. const _hoisted_1$38 = ["role", "aria-labelledby"];
  32529. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  32530. return openBlock(), createElementBlock("ul", {
  32531. ref: _ctx.dropdownListWrapperRef,
  32532. class: normalizeClass(_ctx.dropdownKls),
  32533. style: normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  32534. tabindex: -1,
  32535. role: _ctx.role,
  32536. "aria-labelledby": _ctx.triggerId,
  32537. onFocusin: _cache[0] || (_cache[0] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  32538. onFocusout: _cache[1] || (_cache[1] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
  32539. onKeydown: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])),
  32540. onMousedown: _cache[3] || (_cache[3] = withModifiers((...args) => _ctx.onMousedown && _ctx.onMousedown(...args), ["self"]))
  32541. }, [renderSlot(_ctx.$slots, "default")], 46, _hoisted_1$38);
  32542. }
  32543. var dropdown_menu_default = /* @__PURE__ */ _plugin_vue_export_helper_default(dropdown_menu_vue_vue_type_script_lang_default, [["render", _sfc_render$8]]);
  32544. //#endregion
  32545. //#region ../../packages/components/dropdown/index.ts
  32546. const ElDropdown = withInstall(dropdown_default, {
  32547. DropdownItem: dropdown_item_default,
  32548. DropdownMenu: dropdown_menu_default
  32549. });
  32550. const ElDropdownItem = withNoopInstall(dropdown_item_default);
  32551. const ElDropdownMenu = withNoopInstall(dropdown_menu_default);
  32552. //#endregion
  32553. //#region ../../packages/components/empty/src/empty.ts
  32554. /**
  32555. * @deprecated Removed after 3.0.0, Use `EmptyProps` instead.
  32556. */
  32557. const emptyProps = buildProps({
  32558. image: {
  32559. type: String,
  32560. default: ""
  32561. },
  32562. imageSize: Number,
  32563. description: {
  32564. type: String,
  32565. default: ""
  32566. }
  32567. });
  32568. //#endregion
  32569. //#region ../../packages/components/empty/src/img-empty.vue?vue&type=script&setup=true&lang.ts
  32570. const _hoisted_1$37 = {
  32571. viewBox: "0 0 79 86",
  32572. version: "1.1",
  32573. xmlns: "http://www.w3.org/2000/svg",
  32574. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  32575. };
  32576. const _hoisted_2$23 = ["id"];
  32577. const _hoisted_3$8 = ["stop-color"];
  32578. const _hoisted_4$6 = ["stop-color"];
  32579. const _hoisted_5$4 = ["id"];
  32580. const _hoisted_6$1 = ["stop-color"];
  32581. const _hoisted_7 = ["stop-color"];
  32582. const _hoisted_8 = ["id"];
  32583. const _hoisted_9 = {
  32584. stroke: "none",
  32585. "stroke-width": "1",
  32586. fill: "none",
  32587. "fill-rule": "evenodd"
  32588. };
  32589. const _hoisted_10 = { transform: "translate(-1268.000000, -535.000000)" };
  32590. const _hoisted_11 = { transform: "translate(1268.000000, 535.000000)" };
  32591. const _hoisted_12 = ["fill"];
  32592. const _hoisted_13 = ["fill"];
  32593. const _hoisted_14 = { transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)" };
  32594. const _hoisted_15 = ["fill"];
  32595. const _hoisted_16 = ["fill"];
  32596. const _hoisted_17 = ["fill"];
  32597. const _hoisted_18 = ["fill"];
  32598. const _hoisted_19 = ["fill"];
  32599. const _hoisted_20 = { transform: "translate(53.000000, 45.000000)" };
  32600. const _hoisted_21 = ["fill", "xlink:href"];
  32601. const _hoisted_22 = ["fill", "mask"];
  32602. const _hoisted_23 = ["fill"];
  32603. var img_empty_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  32604. name: "ImgEmpty",
  32605. __name: "img-empty",
  32606. setup(__props) {
  32607. const ns = useNamespace("empty");
  32608. const id = useId();
  32609. return (_ctx, _cache) => {
  32610. return openBlock(), createElementBlock("svg", _hoisted_1$37, [createElementVNode("defs", null, [
  32611. createElementVNode("linearGradient", {
  32612. id: `linearGradient-1-${unref(id)}`,
  32613. x1: "38.8503086%",
  32614. y1: "0%",
  32615. x2: "61.1496914%",
  32616. y2: "100%"
  32617. }, [createElementVNode("stop", {
  32618. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  32619. offset: "0%"
  32620. }, null, 8, _hoisted_3$8), createElementVNode("stop", {
  32621. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-4")})`,
  32622. offset: "100%"
  32623. }, null, 8, _hoisted_4$6)], 8, _hoisted_2$23),
  32624. createElementVNode("linearGradient", {
  32625. id: `linearGradient-2-${unref(id)}`,
  32626. x1: "0%",
  32627. y1: "9.5%",
  32628. x2: "100%",
  32629. y2: "90.5%"
  32630. }, [createElementVNode("stop", {
  32631. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  32632. offset: "0%"
  32633. }, null, 8, _hoisted_6$1), createElementVNode("stop", {
  32634. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-6")})`,
  32635. offset: "100%"
  32636. }, null, 8, _hoisted_7)], 8, _hoisted_5$4),
  32637. createElementVNode("rect", {
  32638. id: `path-3-${unref(id)}`,
  32639. x: "0",
  32640. y: "0",
  32641. width: "17",
  32642. height: "36"
  32643. }, null, 8, _hoisted_8)
  32644. ]), createElementVNode("g", _hoisted_9, [createElementVNode("g", _hoisted_10, [createElementVNode("g", _hoisted_11, [
  32645. createElementVNode("path", {
  32646. 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",
  32647. fill: `var(${unref(ns).cssVarBlockName("fill-color-3")})`
  32648. }, null, 8, _hoisted_12),
  32649. createElementVNode("polygon", {
  32650. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  32651. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  32652. points: "13 58 53 58 42 45 2 45"
  32653. }, null, 8, _hoisted_13),
  32654. createElementVNode("g", _hoisted_14, [
  32655. createElementVNode("polygon", {
  32656. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  32657. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  32658. points: "2.84078316e-14 3 18 3 23 7 5 7"
  32659. }, null, 8, _hoisted_15),
  32660. createElementVNode("polygon", {
  32661. fill: `var(${unref(ns).cssVarBlockName("fill-color-5")})`,
  32662. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  32663. }, null, 8, _hoisted_16),
  32664. createElementVNode("rect", {
  32665. fill: `url(#linearGradient-1-${unref(id)})`,
  32666. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  32667. x: "38",
  32668. y: "7",
  32669. width: "17",
  32670. height: "36"
  32671. }, null, 8, _hoisted_17),
  32672. createElementVNode("polygon", {
  32673. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  32674. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  32675. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  32676. }, null, 8, _hoisted_18)
  32677. ]),
  32678. createElementVNode("rect", {
  32679. fill: `url(#linearGradient-2-${unref(id)})`,
  32680. x: "13",
  32681. y: "45",
  32682. width: "40",
  32683. height: "36"
  32684. }, null, 8, _hoisted_19),
  32685. createElementVNode("g", _hoisted_20, [createElementVNode("use", {
  32686. fill: `var(${unref(ns).cssVarBlockName("fill-color-8")})`,
  32687. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  32688. "xlink:href": `#path-3-${unref(id)}`
  32689. }, null, 8, _hoisted_21), createElementVNode("polygon", {
  32690. fill: `var(${unref(ns).cssVarBlockName("fill-color-9")})`,
  32691. mask: `url(#mask-4-${unref(id)})`,
  32692. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  32693. points: "7 0 24 0 20 18 7 16.5"
  32694. }, null, 8, _hoisted_22)]),
  32695. createElementVNode("polygon", {
  32696. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  32697. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  32698. points: "62 45 79 45 70 58 53 58"
  32699. }, null, 8, _hoisted_23)
  32700. ])])])]);
  32701. };
  32702. }
  32703. });
  32704. //#endregion
  32705. //#region ../../packages/components/empty/src/img-empty.vue
  32706. var img_empty_default = img_empty_vue_vue_type_script_setup_true_lang_default;
  32707. //#endregion
  32708. //#region ../../packages/components/empty/src/empty.vue?vue&type=script&setup=true&lang.ts
  32709. const _hoisted_1$36 = ["src"];
  32710. const _hoisted_2$22 = { key: 1 };
  32711. var empty_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  32712. name: "ElEmpty",
  32713. __name: "empty",
  32714. props: emptyProps,
  32715. setup(__props) {
  32716. const props = __props;
  32717. const { t } = useLocale();
  32718. const ns = useNamespace("empty");
  32719. const emptyDescription = computed(() => props.description || t("el.table.emptyText"));
  32720. const imageStyle = computed(() => ({ width: addUnit(props.imageSize) }));
  32721. return (_ctx, _cache) => {
  32722. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [
  32723. createElementVNode("div", {
  32724. class: normalizeClass(unref(ns).e("image")),
  32725. style: normalizeStyle(imageStyle.value)
  32726. }, [__props.image ? (openBlock(), createElementBlock("img", {
  32727. key: 0,
  32728. src: __props.image,
  32729. ondragstart: "return false"
  32730. }, null, 8, _hoisted_1$36)) : renderSlot(_ctx.$slots, "image", { key: 1 }, () => [createVNode(img_empty_default)])], 6),
  32731. createElementVNode("div", { class: normalizeClass(unref(ns).e("description")) }, [_ctx.$slots.description ? renderSlot(_ctx.$slots, "description", { key: 0 }) : (openBlock(), createElementBlock("p", _hoisted_2$22, toDisplayString(emptyDescription.value), 1))], 2),
  32732. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  32733. key: 0,
  32734. class: normalizeClass(unref(ns).e("bottom"))
  32735. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true)
  32736. ], 2);
  32737. };
  32738. }
  32739. });
  32740. //#endregion
  32741. //#region ../../packages/components/empty/src/empty.vue
  32742. var empty_default = empty_vue_vue_type_script_setup_true_lang_default;
  32743. //#endregion
  32744. //#region ../../packages/components/empty/index.ts
  32745. const ElEmpty = withInstall(empty_default);
  32746. //#endregion
  32747. //#region ../../packages/components/image/src/image.ts
  32748. /**
  32749. * @deprecated Removed after 3.0.0, Use `ImageProps` instead.
  32750. */
  32751. const imageProps = buildProps({
  32752. hideOnClickModal: Boolean,
  32753. src: {
  32754. type: String,
  32755. default: ""
  32756. },
  32757. fit: {
  32758. type: String,
  32759. values: [
  32760. "",
  32761. "contain",
  32762. "cover",
  32763. "fill",
  32764. "none",
  32765. "scale-down"
  32766. ],
  32767. default: ""
  32768. },
  32769. loading: {
  32770. type: String,
  32771. values: ["eager", "lazy"]
  32772. },
  32773. lazy: Boolean,
  32774. scrollContainer: { type: definePropType([String, Object]) },
  32775. previewSrcList: {
  32776. type: definePropType(Array),
  32777. default: () => mutable([])
  32778. },
  32779. previewTeleported: Boolean,
  32780. zIndex: { type: Number },
  32781. initialIndex: {
  32782. type: Number,
  32783. default: 0
  32784. },
  32785. infinite: {
  32786. type: Boolean,
  32787. default: true
  32788. },
  32789. closeOnPressEscape: {
  32790. type: Boolean,
  32791. default: true
  32792. },
  32793. zoomRate: {
  32794. type: Number,
  32795. default: 1.2
  32796. },
  32797. scale: {
  32798. type: Number,
  32799. default: 1
  32800. },
  32801. minScale: {
  32802. type: Number,
  32803. default: .2
  32804. },
  32805. maxScale: {
  32806. type: Number,
  32807. default: 7
  32808. },
  32809. showProgress: Boolean,
  32810. crossorigin: { type: definePropType(String) }
  32811. });
  32812. const imageEmits = {
  32813. load: (evt) => evt instanceof Event,
  32814. error: (evt) => evt instanceof Event,
  32815. switch: (val) => isNumber(val),
  32816. close: () => true,
  32817. show: () => true
  32818. };
  32819. //#endregion
  32820. //#region ../../packages/components/image-viewer/src/image-viewer.ts
  32821. /**
  32822. * @deprecated Removed after 3.0.0, Use `ImageViewerProps` instead.
  32823. */
  32824. const imageViewerProps = buildProps({
  32825. urlList: {
  32826. type: definePropType(Array),
  32827. default: () => mutable([])
  32828. },
  32829. zIndex: { type: Number },
  32830. initialIndex: {
  32831. type: Number,
  32832. default: 0
  32833. },
  32834. infinite: {
  32835. type: Boolean,
  32836. default: true
  32837. },
  32838. hideOnClickModal: Boolean,
  32839. teleported: Boolean,
  32840. closeOnPressEscape: {
  32841. type: Boolean,
  32842. default: true
  32843. },
  32844. zoomRate: {
  32845. type: Number,
  32846. default: 1.2
  32847. },
  32848. scale: {
  32849. type: Number,
  32850. default: 1
  32851. },
  32852. minScale: {
  32853. type: Number,
  32854. default: .2
  32855. },
  32856. maxScale: {
  32857. type: Number,
  32858. default: 7
  32859. },
  32860. showProgress: Boolean,
  32861. crossorigin: { type: definePropType(String) }
  32862. });
  32863. const imageViewerEmits = {
  32864. close: () => true,
  32865. error: (evt) => evt instanceof Event,
  32866. switch: (index) => isNumber(index),
  32867. rotate: (deg) => isNumber(deg)
  32868. };
  32869. //#endregion
  32870. //#region ../../packages/components/image-viewer/src/image-viewer.vue?vue&type=script&setup=true&lang.ts
  32871. const _hoisted_1$35 = ["src", "crossorigin"];
  32872. var image_viewer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  32873. name: "ElImageViewer",
  32874. __name: "image-viewer",
  32875. props: imageViewerProps,
  32876. emits: imageViewerEmits,
  32877. setup(__props, { expose: __expose, emit: __emit }) {
  32878. const modes = {
  32879. CONTAIN: {
  32880. name: "contain",
  32881. icon: markRaw(full_screen_default)
  32882. },
  32883. ORIGINAL: {
  32884. name: "original",
  32885. icon: markRaw(scale_to_original_default)
  32886. }
  32887. };
  32888. const props = __props;
  32889. const emit = __emit;
  32890. let stopWheelListener;
  32891. const { t } = useLocale();
  32892. const ns = useNamespace("image-viewer");
  32893. const { nextZIndex } = useZIndex();
  32894. const wrapper = ref();
  32895. const imgRef = ref();
  32896. const scopeEventListener = effectScope();
  32897. const scaleClamped = computed(() => {
  32898. const { scale, minScale, maxScale } = props;
  32899. return clamp$2(scale, minScale, maxScale);
  32900. });
  32901. const loading = ref(true);
  32902. const loadError = ref(false);
  32903. const visible = ref(false);
  32904. const activeIndex = ref(props.initialIndex);
  32905. const mode = shallowRef(modes.CONTAIN);
  32906. const transform = ref({
  32907. scale: scaleClamped.value,
  32908. deg: 0,
  32909. offsetX: 0,
  32910. offsetY: 0,
  32911. enableTransition: false
  32912. });
  32913. const zIndex = ref(props.zIndex ?? nextZIndex());
  32914. useLockscreen(visible, { ns });
  32915. const isSingle = computed(() => {
  32916. const { urlList } = props;
  32917. return urlList.length <= 1;
  32918. });
  32919. const isFirst = computed(() => activeIndex.value === 0);
  32920. const isLast = computed(() => activeIndex.value === props.urlList.length - 1);
  32921. const currentImg = computed(() => props.urlList[activeIndex.value]);
  32922. const arrowPrevKls = computed(() => [
  32923. ns.e("btn"),
  32924. ns.e("prev"),
  32925. ns.is("disabled", !props.infinite && isFirst.value)
  32926. ]);
  32927. const arrowNextKls = computed(() => [
  32928. ns.e("btn"),
  32929. ns.e("next"),
  32930. ns.is("disabled", !props.infinite && isLast.value)
  32931. ]);
  32932. const imgStyle = computed(() => {
  32933. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  32934. let translateX = offsetX / scale;
  32935. let translateY = offsetY / scale;
  32936. const radian = deg * Math.PI / 180;
  32937. const cosRadian = Math.cos(radian);
  32938. const sinRadian = Math.sin(radian);
  32939. translateX = translateX * cosRadian + translateY * sinRadian;
  32940. translateY = translateY * cosRadian - offsetX / scale * sinRadian;
  32941. const style = {
  32942. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  32943. transition: enableTransition ? "transform .3s" : ""
  32944. };
  32945. if (mode.value.name === modes.CONTAIN.name) style.maxWidth = style.maxHeight = "100%";
  32946. return style;
  32947. });
  32948. const progress = computed(() => `${activeIndex.value + 1} / ${props.urlList.length}`);
  32949. function hide() {
  32950. unregisterEventListener();
  32951. stopWheelListener?.();
  32952. visible.value = false;
  32953. emit("close");
  32954. }
  32955. function registerEventListener() {
  32956. const keydownHandler = throttle((e) => {
  32957. switch (getEventCode(e)) {
  32958. case EVENT_CODE.esc:
  32959. props.closeOnPressEscape && hide();
  32960. break;
  32961. case EVENT_CODE.space:
  32962. toggleMode();
  32963. break;
  32964. case EVENT_CODE.left:
  32965. prev();
  32966. break;
  32967. case EVENT_CODE.up:
  32968. handleActions("zoomIn");
  32969. break;
  32970. case EVENT_CODE.right:
  32971. next();
  32972. break;
  32973. case EVENT_CODE.down:
  32974. handleActions("zoomOut");
  32975. break;
  32976. }
  32977. });
  32978. const mousewheelHandler = throttle((e) => {
  32979. handleActions((e.deltaY || e.deltaX) < 0 ? "zoomIn" : "zoomOut", {
  32980. zoomRate: props.zoomRate,
  32981. enableTransition: false
  32982. });
  32983. });
  32984. scopeEventListener.run(() => {
  32985. useEventListener(document, "keydown", keydownHandler);
  32986. useEventListener(wrapper, "wheel", mousewheelHandler);
  32987. });
  32988. }
  32989. function unregisterEventListener() {
  32990. scopeEventListener.stop();
  32991. }
  32992. function handleImgLoad() {
  32993. loading.value = false;
  32994. }
  32995. function handleImgError(e) {
  32996. loadError.value = true;
  32997. loading.value = false;
  32998. emit("error", e);
  32999. e.target.alt = t("el.image.error");
  33000. }
  33001. function handleMouseDown(e) {
  33002. if (loading.value || e.button !== 0 || !wrapper.value) return;
  33003. transform.value.enableTransition = false;
  33004. const { offsetX, offsetY } = transform.value;
  33005. const startX = e.pageX;
  33006. const startY = e.pageY;
  33007. const dragHandler = throttle((ev) => {
  33008. transform.value = {
  33009. ...transform.value,
  33010. offsetX: offsetX + ev.pageX - startX,
  33011. offsetY: offsetY + ev.pageY - startY
  33012. };
  33013. });
  33014. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  33015. const removeMouseup = useEventListener(document, "mouseup", () => {
  33016. removeMousemove();
  33017. removeMouseup();
  33018. });
  33019. e.preventDefault();
  33020. }
  33021. function handleTouchStart(e) {
  33022. if (loading.value || !wrapper.value || e.touches.length !== 1) return;
  33023. transform.value.enableTransition = false;
  33024. const { offsetX, offsetY } = transform.value;
  33025. const { pageX: startX, pageY: startY } = e.touches[0];
  33026. const dragHandler = throttle((ev) => {
  33027. const targetTouch = ev.touches[0];
  33028. transform.value = {
  33029. ...transform.value,
  33030. offsetX: offsetX + targetTouch.pageX - startX,
  33031. offsetY: offsetY + targetTouch.pageY - startY
  33032. };
  33033. });
  33034. const removeTouchmove = useEventListener(document, "touchmove", dragHandler);
  33035. const removeTouchend = useEventListener(document, "touchend", () => {
  33036. removeTouchmove();
  33037. removeTouchend();
  33038. });
  33039. e.preventDefault();
  33040. }
  33041. function reset() {
  33042. transform.value = {
  33043. scale: scaleClamped.value,
  33044. deg: 0,
  33045. offsetX: 0,
  33046. offsetY: 0,
  33047. enableTransition: false
  33048. };
  33049. }
  33050. function toggleMode() {
  33051. if (loading.value || loadError.value) return;
  33052. const modeNames = keysOf(modes);
  33053. const modeValues = Object.values(modes);
  33054. const currentMode = mode.value.name;
  33055. mode.value = modes[modeNames[(modeValues.findIndex((i) => i.name === currentMode) + 1) % modeNames.length]];
  33056. reset();
  33057. }
  33058. function setActiveItem(index) {
  33059. loadError.value = false;
  33060. const len = props.urlList.length;
  33061. activeIndex.value = (index + len) % len;
  33062. }
  33063. function prev() {
  33064. if (isFirst.value && !props.infinite) return;
  33065. setActiveItem(activeIndex.value - 1);
  33066. }
  33067. function next() {
  33068. if (isLast.value && !props.infinite) return;
  33069. setActiveItem(activeIndex.value + 1);
  33070. }
  33071. function handleActions(action, options = {}) {
  33072. if (loading.value || loadError.value) return;
  33073. const { minScale, maxScale } = props;
  33074. const { zoomRate, rotateDeg, enableTransition } = {
  33075. zoomRate: props.zoomRate,
  33076. rotateDeg: 90,
  33077. enableTransition: true,
  33078. ...options
  33079. };
  33080. switch (action) {
  33081. case "zoomOut":
  33082. if (transform.value.scale > minScale) transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  33083. break;
  33084. case "zoomIn":
  33085. if (transform.value.scale < maxScale) transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  33086. break;
  33087. case "clockwise":
  33088. transform.value.deg += rotateDeg;
  33089. emit("rotate", transform.value.deg);
  33090. break;
  33091. case "anticlockwise":
  33092. transform.value.deg -= rotateDeg;
  33093. emit("rotate", transform.value.deg);
  33094. break;
  33095. }
  33096. transform.value.enableTransition = enableTransition;
  33097. }
  33098. function onFocusoutPrevented(event) {
  33099. if (event.detail?.focusReason === "pointer") event.preventDefault();
  33100. }
  33101. function onCloseRequested() {
  33102. if (props.closeOnPressEscape) hide();
  33103. }
  33104. function wheelHandler(e) {
  33105. if (!e.ctrlKey) return;
  33106. if (e.deltaY < 0) {
  33107. e.preventDefault();
  33108. return false;
  33109. } else if (e.deltaY > 0) {
  33110. e.preventDefault();
  33111. return false;
  33112. }
  33113. }
  33114. watch(() => scaleClamped.value, (val) => {
  33115. transform.value.scale = val;
  33116. });
  33117. watch(currentImg, () => {
  33118. nextTick(() => {
  33119. if (!imgRef.value?.complete) loading.value = true;
  33120. });
  33121. });
  33122. watch(activeIndex, (val) => {
  33123. reset();
  33124. emit("switch", val);
  33125. });
  33126. onMounted(() => {
  33127. visible.value = true;
  33128. registerEventListener();
  33129. stopWheelListener = useEventListener("wheel", wheelHandler, { passive: false });
  33130. });
  33131. __expose({ setActiveItem });
  33132. return (_ctx, _cache) => {
  33133. return openBlock(), createBlock(unref(ElTeleport), {
  33134. to: "body",
  33135. disabled: !__props.teleported
  33136. }, {
  33137. default: withCtx(() => [createVNode(Transition, {
  33138. name: "viewer-fade",
  33139. appear: ""
  33140. }, {
  33141. default: withCtx(() => [createElementVNode("div", {
  33142. ref_key: "wrapper",
  33143. ref: wrapper,
  33144. tabindex: -1,
  33145. class: normalizeClass(unref(ns).e("wrapper")),
  33146. style: normalizeStyle({ zIndex: zIndex.value })
  33147. }, [createVNode(unref(focus_trap_default), {
  33148. loop: "",
  33149. trapped: "",
  33150. "focus-trap-el": wrapper.value,
  33151. "focus-start-el": "container",
  33152. onFocusoutPrevented,
  33153. onReleaseRequested: onCloseRequested
  33154. }, {
  33155. default: withCtx(() => [
  33156. createElementVNode("div", {
  33157. class: normalizeClass(unref(ns).e("mask")),
  33158. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => __props.hideOnClickModal && hide(), ["self"]))
  33159. }, null, 2),
  33160. createCommentVNode(" CLOSE "),
  33161. createElementVNode("span", {
  33162. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  33163. onClick: hide
  33164. }, [createVNode(unref(ElIcon), null, {
  33165. default: withCtx(() => [createVNode(unref(close_default))]),
  33166. _: 1
  33167. })], 2),
  33168. createCommentVNode(" ARROW "),
  33169. !isSingle.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", {
  33170. class: normalizeClass(arrowPrevKls.value),
  33171. onClick: prev
  33172. }, [createVNode(unref(ElIcon), null, {
  33173. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  33174. _: 1
  33175. })], 2), createElementVNode("span", {
  33176. class: normalizeClass(arrowNextKls.value),
  33177. onClick: next
  33178. }, [createVNode(unref(ElIcon), null, {
  33179. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  33180. _: 1
  33181. })], 2)], 64)) : createCommentVNode("v-if", true),
  33182. _ctx.$slots.progress || __props.showProgress ? (openBlock(), createElementBlock("div", {
  33183. key: 1,
  33184. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("progress")])
  33185. }, [renderSlot(_ctx.$slots, "progress", {
  33186. activeIndex: activeIndex.value,
  33187. total: __props.urlList.length
  33188. }, () => [createTextVNode(toDisplayString(progress.value), 1)])], 2)) : createCommentVNode("v-if", true),
  33189. createCommentVNode(" ACTIONS "),
  33190. createElementVNode("div", { class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")]) }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("actions__inner")) }, [renderSlot(_ctx.$slots, "toolbar", {
  33191. actions: handleActions,
  33192. prev,
  33193. next,
  33194. reset: toggleMode,
  33195. activeIndex: activeIndex.value,
  33196. setActiveItem
  33197. }, () => [
  33198. createVNode(unref(ElIcon), { onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut")) }, {
  33199. default: withCtx(() => [createVNode(unref(zoom_out_default))]),
  33200. _: 1
  33201. }),
  33202. createVNode(unref(ElIcon), { onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn")) }, {
  33203. default: withCtx(() => [createVNode(unref(zoom_in_default))]),
  33204. _: 1
  33205. }),
  33206. createElementVNode("i", { class: normalizeClass(unref(ns).e("actions__divider")) }, null, 2),
  33207. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  33208. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(mode.value.icon)))]),
  33209. _: 1
  33210. }),
  33211. createElementVNode("i", { class: normalizeClass(unref(ns).e("actions__divider")) }, null, 2),
  33212. createVNode(unref(ElIcon), { onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise")) }, {
  33213. default: withCtx(() => [createVNode(unref(refresh_left_default))]),
  33214. _: 1
  33215. }),
  33216. createVNode(unref(ElIcon), { onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise")) }, {
  33217. default: withCtx(() => [createVNode(unref(refresh_right_default))]),
  33218. _: 1
  33219. })
  33220. ])], 2)], 2),
  33221. createCommentVNode(" CANVAS "),
  33222. createElementVNode("div", { class: normalizeClass(unref(ns).e("canvas")) }, [loadError.value && _ctx.$slots["viewer-error"] ? renderSlot(_ctx.$slots, "viewer-error", {
  33223. key: 0,
  33224. activeIndex: activeIndex.value,
  33225. src: currentImg.value
  33226. }) : (openBlock(), createElementBlock("img", {
  33227. ref_key: "imgRef",
  33228. ref: imgRef,
  33229. key: currentImg.value,
  33230. src: currentImg.value,
  33231. style: normalizeStyle(imgStyle.value),
  33232. class: normalizeClass(unref(ns).e("img")),
  33233. crossorigin: __props.crossorigin,
  33234. onLoad: handleImgLoad,
  33235. onError: handleImgError,
  33236. onMousedown: handleMouseDown,
  33237. onTouchstart: handleTouchStart
  33238. }, null, 46, _hoisted_1$35))], 2),
  33239. renderSlot(_ctx.$slots, "default")
  33240. ]),
  33241. _: 3
  33242. }, 8, ["focus-trap-el"])], 6)]),
  33243. _: 3
  33244. })]),
  33245. _: 3
  33246. }, 8, ["disabled"]);
  33247. };
  33248. }
  33249. });
  33250. //#endregion
  33251. //#region ../../packages/components/image-viewer/src/image-viewer.vue
  33252. var image_viewer_default = image_viewer_vue_vue_type_script_setup_true_lang_default;
  33253. //#endregion
  33254. //#region ../../packages/components/image-viewer/index.ts
  33255. const ElImageViewer = withInstall(image_viewer_default);
  33256. //#endregion
  33257. //#region ../../packages/components/image/src/image.vue?vue&type=script&setup=true&lang.ts
  33258. const _hoisted_1$34 = [
  33259. "src",
  33260. "loading",
  33261. "crossorigin"
  33262. ];
  33263. const _hoisted_2$21 = { key: 0 };
  33264. var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  33265. name: "ElImage",
  33266. inheritAttrs: false,
  33267. __name: "image",
  33268. props: imageProps,
  33269. emits: imageEmits,
  33270. setup(__props, { expose: __expose, emit: __emit }) {
  33271. const props = __props;
  33272. const emit = __emit;
  33273. const { t } = useLocale();
  33274. const ns = useNamespace("image");
  33275. const rawAttrs = useAttrs$1();
  33276. const containerAttrs = computed(() => {
  33277. return fromPairs(Object.entries(rawAttrs).filter(([key]) => /^(data-|on[A-Z])/i.test(key) || ["id", "style"].includes(key)));
  33278. });
  33279. const imgAttrs = useAttrs({
  33280. excludeListeners: true,
  33281. excludeKeys: computed(() => {
  33282. return Object.keys(containerAttrs.value);
  33283. })
  33284. });
  33285. const imageSrc = ref();
  33286. const hasLoadError = ref(false);
  33287. const isLoading = ref(true);
  33288. const showViewer = ref(false);
  33289. const container = ref();
  33290. const _scrollContainer = ref();
  33291. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  33292. let stopScrollListener;
  33293. const imageKls = computed(() => [
  33294. ns.e("inner"),
  33295. preview.value && ns.e("preview"),
  33296. isLoading.value && ns.is("loading")
  33297. ]);
  33298. const imageStyle = computed(() => {
  33299. const { fit } = props;
  33300. if (isClient && fit) return { objectFit: fit };
  33301. return {};
  33302. });
  33303. const preview = computed(() => {
  33304. const { previewSrcList } = props;
  33305. return isArray$1(previewSrcList) && previewSrcList.length > 0;
  33306. });
  33307. const imageIndex = computed(() => {
  33308. const { previewSrcList, initialIndex } = props;
  33309. let previewIndex = initialIndex;
  33310. if (initialIndex > previewSrcList.length - 1) previewIndex = 0;
  33311. return previewIndex;
  33312. });
  33313. const isManual = computed(() => {
  33314. if (props.loading === "eager") return false;
  33315. return !supportLoading && props.loading === "lazy" || props.lazy;
  33316. });
  33317. const loadImage = () => {
  33318. if (!isClient) return;
  33319. isLoading.value = true;
  33320. hasLoadError.value = false;
  33321. imageSrc.value = props.src;
  33322. };
  33323. function handleLoad(event) {
  33324. isLoading.value = false;
  33325. hasLoadError.value = false;
  33326. emit("load", event);
  33327. }
  33328. function handleError(event) {
  33329. isLoading.value = false;
  33330. hasLoadError.value = true;
  33331. emit("error", event);
  33332. }
  33333. function handleLazyLoad(isIntersecting) {
  33334. if (isIntersecting) {
  33335. loadImage();
  33336. removeLazyLoadListener();
  33337. }
  33338. }
  33339. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
  33340. async function addLazyLoadListener() {
  33341. if (!isClient) return;
  33342. await nextTick();
  33343. const { scrollContainer } = props;
  33344. if (isElement$1(scrollContainer)) _scrollContainer.value = scrollContainer;
  33345. else if (isString(scrollContainer) && scrollContainer !== "") _scrollContainer.value = document.querySelector(scrollContainer) ?? void 0;
  33346. else if (container.value) {
  33347. const scrollContainer = getScrollContainer(container.value);
  33348. _scrollContainer.value = isWindow(scrollContainer) ? void 0 : scrollContainer;
  33349. }
  33350. const { stop } = useIntersectionObserver(container, ([entry]) => {
  33351. lazyLoadHandler(entry.isIntersecting);
  33352. }, { root: _scrollContainer });
  33353. stopScrollListener = stop;
  33354. }
  33355. function removeLazyLoadListener() {
  33356. if (!isClient || !lazyLoadHandler) return;
  33357. stopScrollListener?.();
  33358. _scrollContainer.value = void 0;
  33359. stopScrollListener = void 0;
  33360. }
  33361. function clickHandler() {
  33362. if (!preview.value) return;
  33363. showViewer.value = true;
  33364. emit("show");
  33365. }
  33366. function closeViewer() {
  33367. showViewer.value = false;
  33368. emit("close");
  33369. }
  33370. function switchViewer(val) {
  33371. emit("switch", val);
  33372. }
  33373. watch(() => props.src, () => {
  33374. if (isManual.value) {
  33375. isLoading.value = true;
  33376. hasLoadError.value = false;
  33377. removeLazyLoadListener();
  33378. addLazyLoadListener();
  33379. } else loadImage();
  33380. });
  33381. onMounted(() => {
  33382. if (isManual.value) addLazyLoadListener();
  33383. else loadImage();
  33384. });
  33385. __expose({ showPreview: clickHandler });
  33386. return (_ctx, _cache) => {
  33387. return openBlock(), createElementBlock("div", mergeProps({
  33388. ref_key: "container",
  33389. ref: container
  33390. }, containerAttrs.value, { class: [unref(ns).b(), _ctx.$attrs.class] }), [hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 0 }, () => [createElementVNode("div", { class: normalizeClass(unref(ns).e("error")) }, toDisplayString(unref(t)("el.image.error")), 3)]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [imageSrc.value !== void 0 ? (openBlock(), createElementBlock("img", mergeProps({ key: 0 }, unref(imgAttrs), {
  33391. src: imageSrc.value,
  33392. loading: __props.loading,
  33393. style: imageStyle.value,
  33394. class: imageKls.value,
  33395. crossorigin: __props.crossorigin,
  33396. onClick: clickHandler,
  33397. onLoad: handleLoad,
  33398. onError: handleError
  33399. }), null, 16, _hoisted_1$34)) : createCommentVNode("v-if", true), isLoading.value ? (openBlock(), createElementBlock("div", {
  33400. key: 1,
  33401. class: normalizeClass(unref(ns).e("wrapper"))
  33402. }, [renderSlot(_ctx.$slots, "placeholder", {}, () => [createElementVNode("div", { class: normalizeClass(unref(ns).e("placeholder")) }, null, 2)])], 2)) : createCommentVNode("v-if", true)], 64)), preview.value ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  33403. key: 0,
  33404. "z-index": __props.zIndex,
  33405. "initial-index": imageIndex.value,
  33406. infinite: __props.infinite,
  33407. "zoom-rate": __props.zoomRate,
  33408. "min-scale": __props.minScale,
  33409. "max-scale": __props.maxScale,
  33410. "show-progress": __props.showProgress,
  33411. "url-list": __props.previewSrcList,
  33412. scale: __props.scale,
  33413. crossorigin: __props.crossorigin,
  33414. "hide-on-click-modal": __props.hideOnClickModal,
  33415. teleported: __props.previewTeleported,
  33416. "close-on-press-escape": __props.closeOnPressEscape,
  33417. onClose: closeViewer,
  33418. onSwitch: switchViewer
  33419. }, createSlots({
  33420. toolbar: withCtx((toolbar) => [renderSlot(_ctx.$slots, "toolbar", normalizeProps(guardReactiveProps(toolbar)))]),
  33421. default: withCtx(() => [_ctx.$slots.viewer ? (openBlock(), createElementBlock("div", _hoisted_2$21, [renderSlot(_ctx.$slots, "viewer")])) : createCommentVNode("v-if", true)]),
  33422. _: 2
  33423. }, [_ctx.$slots.progress ? {
  33424. name: "progress",
  33425. fn: withCtx((progress) => [renderSlot(_ctx.$slots, "progress", normalizeProps(guardReactiveProps(progress)))]),
  33426. key: "0"
  33427. } : void 0, _ctx.$slots["viewer-error"] ? {
  33428. name: "viewer-error",
  33429. fn: withCtx((viewerError) => [renderSlot(_ctx.$slots, "viewer-error", normalizeProps(guardReactiveProps(viewerError)))]),
  33430. key: "1"
  33431. } : void 0]), 1032, [
  33432. "z-index",
  33433. "initial-index",
  33434. "infinite",
  33435. "zoom-rate",
  33436. "min-scale",
  33437. "max-scale",
  33438. "show-progress",
  33439. "url-list",
  33440. "scale",
  33441. "crossorigin",
  33442. "hide-on-click-modal",
  33443. "teleported",
  33444. "close-on-press-escape"
  33445. ])) : createCommentVNode("v-if", true)], 64)) : createCommentVNode("v-if", true)], 16);
  33446. };
  33447. }
  33448. });
  33449. //#endregion
  33450. //#region ../../packages/components/image/src/image.vue
  33451. var image_default = image_vue_vue_type_script_setup_true_lang_default;
  33452. //#endregion
  33453. //#region ../../packages/components/image/index.ts
  33454. const ElImage = withInstall(image_default);
  33455. //#endregion
  33456. //#region ../../packages/components/input-number/src/input-number.ts
  33457. /**
  33458. * @deprecated Removed after 3.0.0, Use `InputNumberProps` instead.
  33459. */
  33460. const inputNumberProps = buildProps({
  33461. id: {
  33462. type: String,
  33463. default: void 0
  33464. },
  33465. step: {
  33466. type: Number,
  33467. default: 1
  33468. },
  33469. stepStrictly: Boolean,
  33470. max: {
  33471. type: Number,
  33472. default: Number.MAX_SAFE_INTEGER
  33473. },
  33474. min: {
  33475. type: Number,
  33476. default: Number.MIN_SAFE_INTEGER
  33477. },
  33478. modelValue: { type: [Number, null] },
  33479. readonly: Boolean,
  33480. disabled: {
  33481. type: Boolean,
  33482. default: void 0
  33483. },
  33484. size: useSizeProp,
  33485. controls: {
  33486. type: Boolean,
  33487. default: true
  33488. },
  33489. controlsPosition: {
  33490. type: String,
  33491. default: "",
  33492. values: ["", "right"]
  33493. },
  33494. valueOnClear: {
  33495. type: definePropType([
  33496. String,
  33497. Number,
  33498. null
  33499. ]),
  33500. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  33501. default: null
  33502. },
  33503. name: String,
  33504. placeholder: String,
  33505. precision: {
  33506. type: Number,
  33507. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  33508. },
  33509. validateEvent: {
  33510. type: Boolean,
  33511. default: true
  33512. },
  33513. ...useAriaProps(["ariaLabel"]),
  33514. inputmode: {
  33515. type: definePropType(String),
  33516. default: void 0
  33517. },
  33518. align: {
  33519. type: definePropType(String),
  33520. default: "center"
  33521. },
  33522. disabledScientific: Boolean
  33523. });
  33524. const inputNumberEmits = {
  33525. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  33526. blur: (e) => e instanceof FocusEvent,
  33527. focus: (e) => e instanceof FocusEvent,
  33528. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  33529. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  33530. };
  33531. //#endregion
  33532. //#region ../../packages/components/input-number/src/input-number.vue?vue&type=script&setup=true&lang.ts
  33533. const _hoisted_1$33 = ["aria-label"];
  33534. const _hoisted_2$20 = ["aria-label"];
  33535. var input_number_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  33536. name: "ElInputNumber",
  33537. __name: "input-number",
  33538. props: inputNumberProps,
  33539. emits: inputNumberEmits,
  33540. setup(__props, { expose: __expose, emit: __emit }) {
  33541. const props = __props;
  33542. const emit = __emit;
  33543. const { t } = useLocale();
  33544. const ns = useNamespace("input-number");
  33545. const input = ref();
  33546. const data = reactive({
  33547. currentValue: props.modelValue,
  33548. userInput: null
  33549. });
  33550. const { formItem } = useFormItem();
  33551. const minDisabled = computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  33552. const maxDisabled = computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  33553. const numPrecision = computed(() => {
  33554. const stepPrecision = getPrecision(props.step);
  33555. if (!isUndefined(props.precision)) {
  33556. if (stepPrecision > props.precision) /* @__PURE__ */ debugWarn("InputNumber", "precision should not be less than the decimal places of step");
  33557. return props.precision;
  33558. } else return Math.max(getPrecision(props.modelValue), stepPrecision);
  33559. });
  33560. const controlsAtRight = computed(() => {
  33561. return props.controls && props.controlsPosition === "right";
  33562. });
  33563. const inputNumberSize = useFormSize();
  33564. const inputNumberDisabled = useFormDisabled();
  33565. const displayValue = computed(() => {
  33566. if (data.userInput !== null) return data.userInput;
  33567. let currentValue = data.currentValue;
  33568. if (isNil(currentValue)) return "";
  33569. if (isNumber(currentValue)) {
  33570. if (Number.isNaN(currentValue)) return "";
  33571. if (!isUndefined(props.precision)) currentValue = currentValue.toFixed(props.precision);
  33572. }
  33573. return currentValue;
  33574. });
  33575. const toPrecision = (num, pre) => {
  33576. if (isUndefined(pre)) pre = numPrecision.value;
  33577. if (pre === 0) return Math.round(num);
  33578. let snum = String(num);
  33579. const pointPos = snum.indexOf(".");
  33580. if (pointPos === -1) return num;
  33581. if (!snum.replace(".", "").split("")[pointPos + pre]) return num;
  33582. const length = snum.length;
  33583. if (snum.charAt(length - 1) === "5") snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  33584. return Number.parseFloat(Number(snum).toFixed(pre));
  33585. };
  33586. const getPrecision = (value) => {
  33587. if (isNil(value)) return 0;
  33588. const valueString = value.toString();
  33589. const dotPosition = valueString.indexOf(".");
  33590. let precision = 0;
  33591. if (dotPosition !== -1) precision = valueString.length - dotPosition - 1;
  33592. return precision;
  33593. };
  33594. const ensurePrecision = (val, coefficient = 1) => {
  33595. if (!isNumber(val)) return data.currentValue;
  33596. if (val >= Number.MAX_SAFE_INTEGER && coefficient === 1) {
  33597. /* @__PURE__ */ debugWarn("InputNumber", "The value has reached the maximum safe integer limit.");
  33598. return val;
  33599. } else if (val <= Number.MIN_SAFE_INTEGER && coefficient === -1) {
  33600. /* @__PURE__ */ debugWarn("InputNumber", "The value has reached the minimum safe integer limit.");
  33601. return val;
  33602. }
  33603. return toPrecision(val + props.step * coefficient);
  33604. };
  33605. const handleKeydown = (event) => {
  33606. const code = getEventCode(event);
  33607. const key = getEventKey(event);
  33608. if (props.disabledScientific && ["e", "E"].includes(key)) {
  33609. event.preventDefault();
  33610. return;
  33611. }
  33612. switch (code) {
  33613. case EVENT_CODE.up:
  33614. event.preventDefault();
  33615. increase();
  33616. break;
  33617. case EVENT_CODE.down:
  33618. event.preventDefault();
  33619. decrease();
  33620. break;
  33621. }
  33622. };
  33623. const increase = () => {
  33624. if (props.readonly || inputNumberDisabled.value || maxDisabled.value) return;
  33625. setCurrentValue(ensurePrecision(Number(displayValue.value) || 0));
  33626. emit(INPUT_EVENT, data.currentValue);
  33627. setCurrentValueToModelValue();
  33628. };
  33629. const decrease = () => {
  33630. if (props.readonly || inputNumberDisabled.value || minDisabled.value) return;
  33631. setCurrentValue(ensurePrecision(Number(displayValue.value) || 0, -1));
  33632. emit(INPUT_EVENT, data.currentValue);
  33633. setCurrentValueToModelValue();
  33634. };
  33635. const verifyValue = (value, update) => {
  33636. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  33637. if (max < min) throwError("InputNumber", "min should not be greater than max.");
  33638. let newVal = Number(value);
  33639. if (isNil(value) || Number.isNaN(newVal)) return null;
  33640. if (value === "") {
  33641. if (valueOnClear === null) return null;
  33642. newVal = isString(valueOnClear) ? {
  33643. min,
  33644. max
  33645. }[valueOnClear] : valueOnClear;
  33646. }
  33647. if (stepStrictly) {
  33648. newVal = toPrecision(Math.round(toPrecision(newVal / step)) * step, precision);
  33649. if (newVal !== value) update && emit(UPDATE_MODEL_EVENT, newVal);
  33650. }
  33651. if (!isUndefined(precision)) newVal = toPrecision(newVal, precision);
  33652. if (newVal > max || newVal < min) {
  33653. newVal = newVal > max ? max : min;
  33654. update && emit(UPDATE_MODEL_EVENT, newVal);
  33655. }
  33656. return newVal;
  33657. };
  33658. const setCurrentValue = (value, emitChange = true) => {
  33659. const oldVal = data.currentValue;
  33660. const newVal = verifyValue(value);
  33661. if (!emitChange) {
  33662. emit(UPDATE_MODEL_EVENT, newVal);
  33663. return;
  33664. }
  33665. data.userInput = null;
  33666. if (oldVal === newVal && value) return;
  33667. emit(UPDATE_MODEL_EVENT, newVal);
  33668. if (oldVal !== newVal) emit(CHANGE_EVENT, newVal, oldVal);
  33669. if (props.validateEvent) formItem?.validate?.("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  33670. data.currentValue = newVal;
  33671. };
  33672. const handleInput = (value) => {
  33673. data.userInput = value;
  33674. const newVal = value === "" ? null : Number(value);
  33675. emit(INPUT_EVENT, newVal);
  33676. setCurrentValue(newVal, false);
  33677. };
  33678. const handleInputChange = (value) => {
  33679. const newVal = value !== "" ? Number(value) : "";
  33680. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") setCurrentValue(newVal);
  33681. setCurrentValueToModelValue();
  33682. data.userInput = null;
  33683. };
  33684. const focus = () => {
  33685. input.value?.focus?.();
  33686. };
  33687. const blur = () => {
  33688. input.value?.blur?.();
  33689. };
  33690. const handleFocus = (event) => {
  33691. emit("focus", event);
  33692. };
  33693. const handleBlur = (event) => {
  33694. data.userInput = null;
  33695. if (data.currentValue === null && input.value?.input) input.value.input.value = "";
  33696. emit("blur", event);
  33697. if (props.validateEvent) formItem?.validate?.("blur").catch((err) => /* @__PURE__ */ debugWarn(err));
  33698. };
  33699. const setCurrentValueToModelValue = () => {
  33700. if (data.currentValue !== props.modelValue) data.currentValue = props.modelValue;
  33701. };
  33702. const handleWheel = (e) => {
  33703. if (document.activeElement === e.target) e.preventDefault();
  33704. };
  33705. watch(() => props.modelValue, (value, oldValue) => {
  33706. const newValue = verifyValue(value, true);
  33707. if (data.userInput === null && newValue !== oldValue) data.currentValue = newValue;
  33708. }, { immediate: true });
  33709. watch(() => props.precision, () => {
  33710. data.currentValue = verifyValue(props.modelValue);
  33711. });
  33712. onMounted(() => {
  33713. const { min, max, modelValue } = props;
  33714. const innerInput = input.value?.input;
  33715. innerInput.setAttribute("role", "spinbutton");
  33716. if (Number.isFinite(max)) innerInput.setAttribute("aria-valuemax", String(max));
  33717. else innerInput.removeAttribute("aria-valuemax");
  33718. if (Number.isFinite(min)) innerInput.setAttribute("aria-valuemin", String(min));
  33719. else innerInput.removeAttribute("aria-valuemin");
  33720. innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
  33721. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  33722. if (!isNumber(modelValue) && modelValue != null) {
  33723. let val = Number(modelValue);
  33724. if (Number.isNaN(val)) val = null;
  33725. emit(UPDATE_MODEL_EVENT, val);
  33726. }
  33727. innerInput.addEventListener("wheel", handleWheel, { passive: false });
  33728. });
  33729. onUpdated(() => {
  33730. (input.value?.input)?.setAttribute("aria-valuenow", `${data.currentValue ?? ""}`);
  33731. });
  33732. __expose({
  33733. focus,
  33734. blur
  33735. });
  33736. return (_ctx, _cache) => {
  33737. return openBlock(), createElementBlock("div", {
  33738. class: normalizeClass([
  33739. unref(ns).b(),
  33740. unref(ns).m(unref(inputNumberSize)),
  33741. unref(ns).is("disabled", unref(inputNumberDisabled)),
  33742. unref(ns).is("without-controls", !__props.controls),
  33743. unref(ns).is("controls-right", controlsAtRight.value),
  33744. unref(ns).is(__props.align, !!__props.align)
  33745. ]),
  33746. onDragstart: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
  33747. }, [
  33748. __props.controls ? withDirectives((openBlock(), createElementBlock("span", {
  33749. key: 0,
  33750. role: "button",
  33751. "aria-label": unref(t)("el.inputNumber.decrease"),
  33752. class: normalizeClass([unref(ns).e("decrease"), unref(ns).is("disabled", minDisabled.value)]),
  33753. onKeydown: withKeys(decrease, ["enter"])
  33754. }, [renderSlot(_ctx.$slots, "decrease-icon", {}, () => [createVNode(unref(ElIcon), null, {
  33755. default: withCtx(() => [controlsAtRight.value ? (openBlock(), createBlock(unref(arrow_down_default), { key: 0 })) : (openBlock(), createBlock(unref(minus_default), { key: 1 }))]),
  33756. _: 1
  33757. })])], 42, _hoisted_1$33)), [[unref(vRepeatClick), decrease]]) : createCommentVNode("v-if", true),
  33758. __props.controls ? withDirectives((openBlock(), createElementBlock("span", {
  33759. key: 1,
  33760. role: "button",
  33761. "aria-label": unref(t)("el.inputNumber.increase"),
  33762. class: normalizeClass([unref(ns).e("increase"), unref(ns).is("disabled", maxDisabled.value)]),
  33763. onKeydown: withKeys(increase, ["enter"])
  33764. }, [renderSlot(_ctx.$slots, "increase-icon", {}, () => [createVNode(unref(ElIcon), null, {
  33765. default: withCtx(() => [controlsAtRight.value ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(plus_default), { key: 1 }))]),
  33766. _: 1
  33767. })])], 42, _hoisted_2$20)), [[unref(vRepeatClick), increase]]) : createCommentVNode("v-if", true),
  33768. createVNode(unref(ElInput), {
  33769. id: __props.id,
  33770. ref_key: "input",
  33771. ref: input,
  33772. type: "number",
  33773. step: __props.step,
  33774. "model-value": displayValue.value,
  33775. placeholder: __props.placeholder,
  33776. readonly: __props.readonly,
  33777. disabled: unref(inputNumberDisabled),
  33778. size: unref(inputNumberSize),
  33779. max: __props.max,
  33780. min: __props.min,
  33781. name: __props.name,
  33782. "aria-label": __props.ariaLabel,
  33783. "validate-event": false,
  33784. inputmode: __props.inputmode,
  33785. onKeydown: handleKeydown,
  33786. onBlur: handleBlur,
  33787. onFocus: handleFocus,
  33788. onInput: handleInput,
  33789. onChange: handleInputChange
  33790. }, createSlots({ _: 2 }, [_ctx.$slots.prefix ? {
  33791. name: "prefix",
  33792. fn: withCtx(() => [renderSlot(_ctx.$slots, "prefix")]),
  33793. key: "0"
  33794. } : void 0, _ctx.$slots.suffix ? {
  33795. name: "suffix",
  33796. fn: withCtx(() => [renderSlot(_ctx.$slots, "suffix")]),
  33797. key: "1"
  33798. } : void 0]), 1032, [
  33799. "id",
  33800. "step",
  33801. "model-value",
  33802. "placeholder",
  33803. "readonly",
  33804. "disabled",
  33805. "size",
  33806. "max",
  33807. "min",
  33808. "name",
  33809. "aria-label",
  33810. "inputmode"
  33811. ])
  33812. ], 34);
  33813. };
  33814. }
  33815. });
  33816. //#endregion
  33817. //#region ../../packages/components/input-number/src/input-number.vue
  33818. var input_number_default = input_number_vue_vue_type_script_setup_true_lang_default;
  33819. //#endregion
  33820. //#region ../../packages/components/input-number/index.ts
  33821. const ElInputNumber = withInstall(input_number_default);
  33822. //#endregion
  33823. //#region ../../packages/components/input-tag/src/input-tag.ts
  33824. /**
  33825. * @deprecated Removed after 3.0.0, Use `InputTagProps` instead.
  33826. */
  33827. const inputTagProps = buildProps({
  33828. modelValue: { type: definePropType(Array) },
  33829. max: Number,
  33830. tagType: {
  33831. ...tagProps.type,
  33832. default: "info"
  33833. },
  33834. tagEffect: tagProps.effect,
  33835. effect: {
  33836. type: definePropType(String),
  33837. default: "light"
  33838. },
  33839. trigger: {
  33840. type: definePropType(String),
  33841. default: EVENT_CODE.enter
  33842. },
  33843. draggable: Boolean,
  33844. delimiter: {
  33845. type: [String, RegExp],
  33846. default: ""
  33847. },
  33848. size: useSizeProp,
  33849. clearable: Boolean,
  33850. clearIcon: {
  33851. type: iconPropType,
  33852. default: circle_close_default
  33853. },
  33854. disabled: {
  33855. type: Boolean,
  33856. default: void 0
  33857. },
  33858. validateEvent: {
  33859. type: Boolean,
  33860. default: true
  33861. },
  33862. readonly: Boolean,
  33863. autofocus: Boolean,
  33864. id: {
  33865. type: String,
  33866. default: void 0
  33867. },
  33868. tabindex: {
  33869. type: [String, Number],
  33870. default: 0
  33871. },
  33872. maxlength: { type: [String, Number] },
  33873. minlength: { type: [String, Number] },
  33874. placeholder: String,
  33875. autocomplete: {
  33876. type: definePropType(String),
  33877. default: "off"
  33878. },
  33879. saveOnBlur: {
  33880. type: Boolean,
  33881. default: true
  33882. },
  33883. collapseTags: Boolean,
  33884. collapseTagsTooltip: Boolean,
  33885. maxCollapseTags: {
  33886. type: Number,
  33887. default: 1
  33888. },
  33889. ariaLabel: String
  33890. });
  33891. const inputTagEmits = {
  33892. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  33893. [CHANGE_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  33894. [INPUT_EVENT]: (value) => isString(value),
  33895. "add-tag": (value) => isString(value) || isArray$1(value),
  33896. "remove-tag": (value, index) => isString(value) && isNumber(index),
  33897. "drag-tag": (oldIndex, newIndex, value) => isNumber(oldIndex) && isNumber(newIndex) && isString(value),
  33898. focus: (evt) => evt instanceof FocusEvent,
  33899. blur: (evt) => evt instanceof FocusEvent,
  33900. clear: () => true
  33901. };
  33902. //#endregion
  33903. //#region ../../packages/components/input-tag/src/composables/use-drag-tag.ts
  33904. function useDragTag({ wrapperRef, handleDragged, afterDragged }) {
  33905. const ns = useNamespace("input-tag");
  33906. const dropIndicatorRef = shallowRef();
  33907. const showDropIndicator = ref(false);
  33908. let draggingIndex;
  33909. let draggingTag;
  33910. let dropIndex;
  33911. let dropType;
  33912. function getTagClassName(index) {
  33913. return `.${ns.e("inner")} .${ns.namespace.value}-tag:nth-child(${index + 1})`;
  33914. }
  33915. function handleDragStart(event, index) {
  33916. draggingIndex = index;
  33917. draggingTag = wrapperRef.value.querySelector(getTagClassName(index));
  33918. if (draggingTag) draggingTag.style.opacity = "0.5";
  33919. event.dataTransfer.effectAllowed = "move";
  33920. }
  33921. function handleDragOver(event, index) {
  33922. dropIndex = index;
  33923. event.preventDefault();
  33924. event.dataTransfer.dropEffect = "move";
  33925. if (isUndefined(draggingIndex) || draggingIndex === index) {
  33926. showDropIndicator.value = false;
  33927. return;
  33928. }
  33929. const dropPosition = wrapperRef.value.querySelector(getTagClassName(index)).getBoundingClientRect();
  33930. const dropPrev = !(draggingIndex + 1 === index);
  33931. const dropNext = !(draggingIndex - 1 === index);
  33932. const distance = event.clientX - dropPosition.left;
  33933. const prevPercent = dropPrev ? dropNext ? .5 : 1 : -1;
  33934. const nextPercent = dropNext ? dropPrev ? .5 : 0 : 1;
  33935. if (distance <= dropPosition.width * prevPercent) dropType = "before";
  33936. else if (distance > dropPosition.width * nextPercent) dropType = "after";
  33937. else dropType = void 0;
  33938. const innerEl = wrapperRef.value.querySelector(`.${ns.e("inner")}`);
  33939. const innerPosition = innerEl.getBoundingClientRect();
  33940. const gap = Number.parseFloat(getStyle(innerEl, "gap")) / 2;
  33941. const indicatorTop = dropPosition.top - innerPosition.top;
  33942. let indicatorLeft = -9999;
  33943. if (dropType === "before") indicatorLeft = Math.max(dropPosition.left - innerPosition.left - gap, Math.floor(-gap / 2));
  33944. else if (dropType === "after") {
  33945. const left = dropPosition.right - innerPosition.left;
  33946. indicatorLeft = left + (innerPosition.width === left ? Math.floor(gap / 2) : gap);
  33947. }
  33948. setStyle(dropIndicatorRef.value, {
  33949. top: `${indicatorTop}px`,
  33950. left: `${indicatorLeft}px`
  33951. });
  33952. showDropIndicator.value = !!dropType;
  33953. }
  33954. function handleDragEnd(event) {
  33955. event.preventDefault();
  33956. if (draggingTag) draggingTag.style.opacity = "";
  33957. if (dropType && !isUndefined(draggingIndex) && !isUndefined(dropIndex) && draggingIndex !== dropIndex) handleDragged(draggingIndex, dropIndex, dropType);
  33958. showDropIndicator.value = false;
  33959. draggingIndex = void 0;
  33960. draggingTag = null;
  33961. dropIndex = void 0;
  33962. dropType = void 0;
  33963. afterDragged?.();
  33964. }
  33965. return {
  33966. dropIndicatorRef,
  33967. showDropIndicator,
  33968. handleDragStart,
  33969. handleDragOver,
  33970. handleDragEnd
  33971. };
  33972. }
  33973. //#endregion
  33974. //#region ../../packages/components/input-tag/src/composables/use-hovering.ts
  33975. function useHovering() {
  33976. const hovering = ref(false);
  33977. const handleMouseEnter = () => {
  33978. hovering.value = true;
  33979. };
  33980. const handleMouseLeave = () => {
  33981. hovering.value = false;
  33982. };
  33983. return {
  33984. hovering,
  33985. handleMouseEnter,
  33986. handleMouseLeave
  33987. };
  33988. }
  33989. //#endregion
  33990. //#region ../../packages/components/input-tag/src/composables/use-input-tag.ts
  33991. function useInputTag({ props, emit, formItem }) {
  33992. const disabled = useFormDisabled();
  33993. const size = useFormSize();
  33994. const inputRef = shallowRef();
  33995. const inputValue = ref();
  33996. const tagTooltipRef = ref();
  33997. const tagSize = computed(() => {
  33998. return ["small"].includes(size.value) ? "small" : "default";
  33999. });
  34000. const placeholder = computed(() => {
  34001. return props.modelValue?.length ? void 0 : props.placeholder;
  34002. });
  34003. const closable = computed(() => !(props.readonly || disabled.value));
  34004. const inputLimit = computed(() => {
  34005. return isUndefined(props.max) ? false : (props.modelValue?.length ?? 0) >= props.max;
  34006. });
  34007. const showTagList = computed(() => {
  34008. return props.collapseTags ? props.modelValue?.slice(0, props.maxCollapseTags) : props.modelValue;
  34009. });
  34010. const collapseTagList = computed(() => {
  34011. return props.collapseTags ? props.modelValue?.slice(props.maxCollapseTags) : [];
  34012. });
  34013. const addTagsEmit = (value) => {
  34014. const list = [...props.modelValue ?? [], ...castArray$1(value)];
  34015. emit(UPDATE_MODEL_EVENT, list);
  34016. emit(CHANGE_EVENT, list);
  34017. emit("add-tag", value);
  34018. inputValue.value = void 0;
  34019. };
  34020. const getDelimitedTags = (input) => {
  34021. const parts = input.split(props.delimiter);
  34022. const tags = parts.length > 1 ? parts.map((val) => val.trim()).filter(Boolean) : [];
  34023. if (props.max) {
  34024. const maxInsert = props.max - (props.modelValue?.length ?? 0);
  34025. tags.splice(maxInsert);
  34026. }
  34027. return tags.length === 1 ? tags[0] : tags;
  34028. };
  34029. const handlePaste = (event) => {
  34030. const pasted = event.clipboardData?.getData("text");
  34031. if (props.readonly || inputLimit.value || !props.delimiter || !pasted) return;
  34032. const { selectionStart = 0, selectionEnd = 0, value } = event.target;
  34033. const nextValue = value.slice(0, selectionStart) + pasted + value.slice(selectionEnd);
  34034. const tags = getDelimitedTags(nextValue);
  34035. if (tags.length) {
  34036. addTagsEmit(tags);
  34037. emit(INPUT_EVENT, nextValue);
  34038. event.preventDefault();
  34039. }
  34040. };
  34041. const handleInput = (event) => {
  34042. if (inputLimit.value) {
  34043. inputValue.value = void 0;
  34044. return;
  34045. }
  34046. if (isComposing.value) return;
  34047. if (props.delimiter && inputValue.value) {
  34048. const tags = getDelimitedTags(inputValue.value);
  34049. if (tags.length) addTagsEmit(tags);
  34050. }
  34051. emit(INPUT_EVENT, event.target.value);
  34052. };
  34053. const handleKeydown = (event) => {
  34054. if (isComposing.value) return;
  34055. switch (getEventCode(event)) {
  34056. case props.trigger:
  34057. event.preventDefault();
  34058. event.stopPropagation();
  34059. handleAddTag();
  34060. break;
  34061. case EVENT_CODE.numpadEnter:
  34062. if (props.trigger === EVENT_CODE.enter) {
  34063. event.preventDefault();
  34064. event.stopPropagation();
  34065. handleAddTag();
  34066. }
  34067. break;
  34068. case EVENT_CODE.backspace:
  34069. if (!inputValue.value && props.modelValue?.length) {
  34070. event.preventDefault();
  34071. event.stopPropagation();
  34072. handleRemoveTag(props.modelValue.length - 1);
  34073. }
  34074. break;
  34075. }
  34076. };
  34077. const handleKeyup = (event) => {
  34078. if (isComposing.value || !isAndroid()) return;
  34079. switch (getEventCode(event)) {
  34080. case EVENT_CODE.space:
  34081. if (props.trigger === EVENT_CODE.space) {
  34082. event.preventDefault();
  34083. event.stopPropagation();
  34084. handleAddTag();
  34085. }
  34086. break;
  34087. }
  34088. };
  34089. const handleAddTag = () => {
  34090. const value = inputValue.value?.trim();
  34091. if (!value || inputLimit.value) return;
  34092. addTagsEmit(value);
  34093. };
  34094. const handleRemoveTag = (index) => {
  34095. const value = (props.modelValue ?? []).slice();
  34096. const [item] = value.splice(index, 1);
  34097. emit(UPDATE_MODEL_EVENT, value);
  34098. emit(CHANGE_EVENT, value);
  34099. emit("remove-tag", item, index);
  34100. };
  34101. const handleClear = () => {
  34102. inputValue.value = void 0;
  34103. emit(UPDATE_MODEL_EVENT, void 0);
  34104. emit(CHANGE_EVENT, void 0);
  34105. emit("clear");
  34106. };
  34107. const handleDragged = (draggingIndex, dropIndex, type) => {
  34108. const value = (props.modelValue ?? []).slice();
  34109. const [draggedItem] = value.splice(draggingIndex, 1);
  34110. const step = dropIndex > draggingIndex && type === "before" ? -1 : dropIndex < draggingIndex && type === "after" ? 1 : 0;
  34111. value.splice(dropIndex + step, 0, draggedItem);
  34112. emit(UPDATE_MODEL_EVENT, value);
  34113. emit(CHANGE_EVENT, value);
  34114. emit("drag-tag", draggingIndex, dropIndex + step, draggedItem);
  34115. };
  34116. const focus = () => {
  34117. inputRef.value?.focus();
  34118. };
  34119. const blur = () => {
  34120. inputRef.value?.blur();
  34121. };
  34122. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  34123. disabled,
  34124. beforeBlur(event) {
  34125. return tagTooltipRef.value?.isFocusInsideContent(event);
  34126. },
  34127. afterBlur() {
  34128. if (props.saveOnBlur) handleAddTag();
  34129. else inputValue.value = void 0;
  34130. if (props.validateEvent) formItem?.validate?.("blur").catch((err) => /* @__PURE__ */ debugWarn(err));
  34131. }
  34132. });
  34133. const { isComposing, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd } = useComposition({ afterComposition: handleInput });
  34134. watch(() => props.modelValue, () => {
  34135. if (props.validateEvent) formItem?.validate?.(CHANGE_EVENT).catch((err) => /* @__PURE__ */ debugWarn(err));
  34136. });
  34137. return {
  34138. inputRef,
  34139. wrapperRef,
  34140. tagTooltipRef,
  34141. isFocused,
  34142. isComposing,
  34143. inputValue,
  34144. size,
  34145. tagSize,
  34146. placeholder,
  34147. closable,
  34148. disabled,
  34149. inputLimit,
  34150. showTagList,
  34151. collapseTagList,
  34152. handleDragged,
  34153. handlePaste,
  34154. handleInput,
  34155. handleKeydown,
  34156. handleKeyup,
  34157. handleAddTag,
  34158. handleRemoveTag,
  34159. handleClear,
  34160. handleCompositionStart,
  34161. handleCompositionUpdate,
  34162. handleCompositionEnd,
  34163. focus,
  34164. blur
  34165. };
  34166. }
  34167. //#endregion
  34168. //#region ../../packages/components/input-tag/src/composables/use-input-tag-dom.ts
  34169. function useInputTagDom({ props, isFocused, hovering, disabled, inputValue, size, validateState, validateIcon, needStatusIcon }) {
  34170. const attrs = useAttrs$1();
  34171. const slots = useSlots();
  34172. const ns = useNamespace("input-tag");
  34173. const nsInput = useNamespace("input");
  34174. const collapseItemRef = ref();
  34175. const innerRef = ref();
  34176. const containerKls = computed(() => [
  34177. ns.b(),
  34178. ns.is("focused", isFocused.value),
  34179. ns.is("hovering", hovering.value),
  34180. ns.is("disabled", disabled.value),
  34181. ns.m(size.value),
  34182. ns.e("wrapper"),
  34183. attrs.class
  34184. ]);
  34185. const containerStyle = computed(() => [attrs.style]);
  34186. const innerKls = computed(() => [
  34187. ns.e("inner"),
  34188. ns.is("draggable", props.draggable),
  34189. ns.is("left-space", !props.modelValue?.length && !slots.prefix),
  34190. ns.is("right-space", !props.modelValue?.length && !showSuffix.value)
  34191. ]);
  34192. const showClear = computed(() => {
  34193. return props.clearable && !disabled.value && !props.readonly && (props.modelValue?.length || inputValue.value) && (isFocused.value || hovering.value);
  34194. });
  34195. const showSuffix = computed(() => {
  34196. return slots.suffix || showClear.value || validateState.value && validateIcon.value && needStatusIcon.value;
  34197. });
  34198. const states = reactive({
  34199. innerWidth: 0,
  34200. collapseItemWidth: 0
  34201. });
  34202. const getGapWidth = () => {
  34203. if (!innerRef.value) return 0;
  34204. const style = window.getComputedStyle(innerRef.value);
  34205. return Number.parseFloat(style.gap || "6px");
  34206. };
  34207. const resetInnerWidth = () => {
  34208. states.innerWidth = Number.parseFloat(window.getComputedStyle(innerRef.value).width);
  34209. };
  34210. const resetCollapseItemWidth = () => {
  34211. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  34212. };
  34213. const tagStyle = computed(() => {
  34214. if (!props.collapseTags) return {};
  34215. const gapWidth = getGapWidth();
  34216. const inputSlotWidth = gapWidth + MINIMUM_INPUT_WIDTH;
  34217. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.innerWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.innerWidth - inputSlotWidth;
  34218. return { maxWidth: `${Math.max(maxWidth, 0)}px` };
  34219. });
  34220. useResizeObserver(innerRef, resetInnerWidth);
  34221. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  34222. return {
  34223. ns,
  34224. nsInput,
  34225. containerKls,
  34226. containerStyle,
  34227. innerKls,
  34228. showClear,
  34229. showSuffix,
  34230. tagStyle,
  34231. collapseItemRef,
  34232. innerRef
  34233. };
  34234. }
  34235. //#endregion
  34236. //#region ../../packages/components/input-tag/src/input-tag.vue?vue&type=script&setup=true&lang.ts
  34237. const _hoisted_1$32 = [
  34238. "id",
  34239. "minlength",
  34240. "maxlength",
  34241. "disabled",
  34242. "readonly",
  34243. "autocomplete",
  34244. "tabindex",
  34245. "placeholder",
  34246. "autofocus",
  34247. "ariaLabel"
  34248. ];
  34249. const _hoisted_2$19 = ["textContent"];
  34250. var input_tag_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34251. name: "ElInputTag",
  34252. inheritAttrs: false,
  34253. __name: "input-tag",
  34254. props: inputTagProps,
  34255. emits: inputTagEmits,
  34256. setup(__props, { expose: __expose, emit: __emit }) {
  34257. const props = __props;
  34258. const emit = __emit;
  34259. const attrs = useAttrs();
  34260. const slots = useSlots();
  34261. const { form, formItem } = useFormItem();
  34262. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  34263. const needStatusIcon = computed(() => form?.statusIcon ?? false);
  34264. const validateState = computed(() => formItem?.validateState || "");
  34265. const validateIcon = computed(() => {
  34266. return validateState.value && ValidateComponentsMap[validateState.value];
  34267. });
  34268. const { inputRef, wrapperRef, tagTooltipRef, isFocused, inputValue, size, tagSize, placeholder, closable, disabled, showTagList, collapseTagList, handleDragged, handlePaste, handleInput, handleKeydown, handleKeyup, handleRemoveTag, handleClear, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd, focus, blur } = useInputTag({
  34269. props,
  34270. emit,
  34271. formItem
  34272. });
  34273. const { hovering, handleMouseEnter, handleMouseLeave } = useHovering();
  34274. const { calculatorRef, inputStyle } = useCalcInputWidth();
  34275. const { dropIndicatorRef, showDropIndicator, handleDragStart, handleDragOver, handleDragEnd } = useDragTag({
  34276. wrapperRef,
  34277. handleDragged,
  34278. afterDragged: focus
  34279. });
  34280. const { ns, nsInput, containerKls, containerStyle, innerKls, showClear, showSuffix, tagStyle, collapseItemRef, innerRef } = useInputTagDom({
  34281. props,
  34282. hovering,
  34283. isFocused,
  34284. inputValue,
  34285. disabled,
  34286. size,
  34287. validateState,
  34288. validateIcon,
  34289. needStatusIcon
  34290. });
  34291. __expose({
  34292. focus,
  34293. blur
  34294. });
  34295. return (_ctx, _cache) => {
  34296. return openBlock(), createElementBlock("div", {
  34297. ref_key: "wrapperRef",
  34298. ref: wrapperRef,
  34299. class: normalizeClass(unref(containerKls)),
  34300. style: normalizeStyle(unref(containerStyle)),
  34301. onMouseenter: _cache[9] || (_cache[9] = (...args) => unref(handleMouseEnter) && unref(handleMouseEnter)(...args)),
  34302. onMouseleave: _cache[10] || (_cache[10] = (...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args))
  34303. }, [
  34304. unref(slots).prefix ? (openBlock(), createElementBlock("div", {
  34305. key: 0,
  34306. class: normalizeClass(unref(ns).e("prefix"))
  34307. }, [renderSlot(_ctx.$slots, "prefix")], 2)) : createCommentVNode("v-if", true),
  34308. createElementVNode("div", {
  34309. ref_key: "innerRef",
  34310. ref: innerRef,
  34311. class: normalizeClass(unref(innerKls))
  34312. }, [
  34313. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(showTagList), (item, index) => {
  34314. return openBlock(), createBlock(unref(ElTag), {
  34315. key: index,
  34316. size: unref(tagSize),
  34317. closable: unref(closable),
  34318. type: __props.tagType,
  34319. effect: __props.tagEffect,
  34320. draggable: unref(closable) && __props.draggable,
  34321. style: normalizeStyle(unref(tagStyle)),
  34322. "disable-transitions": "",
  34323. onClose: ($event) => unref(handleRemoveTag)(index),
  34324. onDragstart: (event) => unref(handleDragStart)(event, index),
  34325. onDragover: (event) => unref(handleDragOver)(event, index),
  34326. onDragend: unref(handleDragEnd),
  34327. onDrop: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  34328. }, {
  34329. default: withCtx(() => [renderSlot(_ctx.$slots, "tag", {
  34330. value: item,
  34331. index
  34332. }, () => [createTextVNode(toDisplayString(item), 1)])]),
  34333. _: 2
  34334. }, 1032, [
  34335. "size",
  34336. "closable",
  34337. "type",
  34338. "effect",
  34339. "draggable",
  34340. "style",
  34341. "onClose",
  34342. "onDragstart",
  34343. "onDragover",
  34344. "onDragend"
  34345. ]);
  34346. }), 128)),
  34347. __props.collapseTags && __props.modelValue && __props.modelValue.length > __props.maxCollapseTags ? (openBlock(), createBlock(unref(ElTooltip), {
  34348. key: 0,
  34349. ref_key: "tagTooltipRef",
  34350. ref: tagTooltipRef,
  34351. disabled: !__props.collapseTagsTooltip,
  34352. "fallback-placements": [
  34353. "bottom",
  34354. "top",
  34355. "right",
  34356. "left"
  34357. ],
  34358. effect: __props.effect,
  34359. placement: "bottom"
  34360. }, {
  34361. default: withCtx(() => [createElementVNode("div", {
  34362. ref_key: "collapseItemRef",
  34363. ref: collapseItemRef,
  34364. class: normalizeClass(unref(ns).e("collapse-tag"))
  34365. }, [createVNode(unref(ElTag), {
  34366. closable: false,
  34367. size: unref(tagSize),
  34368. type: __props.tagType,
  34369. effect: __props.tagEffect,
  34370. "disable-transitions": ""
  34371. }, {
  34372. default: withCtx(() => [createTextVNode(" + " + toDisplayString(__props.modelValue.length - __props.maxCollapseTags), 1)]),
  34373. _: 1
  34374. }, 8, [
  34375. "size",
  34376. "type",
  34377. "effect"
  34378. ])], 2)]),
  34379. content: withCtx(() => [createElementVNode("div", { class: normalizeClass(unref(ns).e("input-tag-list")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(collapseTagList), (item, index) => {
  34380. return openBlock(), createBlock(unref(ElTag), {
  34381. key: index,
  34382. size: unref(tagSize),
  34383. closable: unref(closable),
  34384. type: __props.tagType,
  34385. effect: __props.tagEffect,
  34386. "disable-transitions": "",
  34387. onClose: ($event) => unref(handleRemoveTag)(index + __props.maxCollapseTags)
  34388. }, {
  34389. default: withCtx(() => [renderSlot(_ctx.$slots, "tag", {
  34390. value: item,
  34391. index: index + __props.maxCollapseTags
  34392. }, () => [createTextVNode(toDisplayString(item), 1)])]),
  34393. _: 2
  34394. }, 1032, [
  34395. "size",
  34396. "closable",
  34397. "type",
  34398. "effect",
  34399. "onClose"
  34400. ]);
  34401. }), 128))], 2)]),
  34402. _: 3
  34403. }, 8, ["disabled", "effect"])) : createCommentVNode("v-if", true),
  34404. createElementVNode("div", { class: normalizeClass(unref(ns).e("input-wrapper")) }, [withDirectives(createElementVNode("input", mergeProps({
  34405. id: unref(inputId),
  34406. ref_key: "inputRef",
  34407. ref: inputRef,
  34408. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(inputValue) ? inputValue.value = $event : null)
  34409. }, unref(attrs), {
  34410. type: "text",
  34411. minlength: __props.minlength,
  34412. maxlength: __props.maxlength,
  34413. disabled: unref(disabled),
  34414. readonly: __props.readonly,
  34415. autocomplete: __props.autocomplete,
  34416. tabindex: __props.tabindex,
  34417. placeholder: unref(placeholder),
  34418. autofocus: __props.autofocus,
  34419. ariaLabel: __props.ariaLabel,
  34420. class: unref(ns).e("input"),
  34421. style: unref(inputStyle),
  34422. onCompositionstart: _cache[2] || (_cache[2] = (...args) => unref(handleCompositionStart) && unref(handleCompositionStart)(...args)),
  34423. onCompositionupdate: _cache[3] || (_cache[3] = (...args) => unref(handleCompositionUpdate) && unref(handleCompositionUpdate)(...args)),
  34424. onCompositionend: _cache[4] || (_cache[4] = (...args) => unref(handleCompositionEnd) && unref(handleCompositionEnd)(...args)),
  34425. onPaste: _cache[5] || (_cache[5] = (...args) => unref(handlePaste) && unref(handlePaste)(...args)),
  34426. onInput: _cache[6] || (_cache[6] = (...args) => unref(handleInput) && unref(handleInput)(...args)),
  34427. onKeydown: _cache[7] || (_cache[7] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args)),
  34428. onKeyup: _cache[8] || (_cache[8] = (...args) => unref(handleKeyup) && unref(handleKeyup)(...args))
  34429. }), null, 16, _hoisted_1$32), [[vModelText, unref(inputValue)]]), createElementVNode("span", {
  34430. ref_key: "calculatorRef",
  34431. ref: calculatorRef,
  34432. "aria-hidden": "true",
  34433. class: normalizeClass(unref(ns).e("input-calculator")),
  34434. textContent: toDisplayString(unref(inputValue))
  34435. }, null, 10, _hoisted_2$19)], 2),
  34436. withDirectives(createElementVNode("div", {
  34437. ref_key: "dropIndicatorRef",
  34438. ref: dropIndicatorRef,
  34439. class: normalizeClass(unref(ns).e("drop-indicator"))
  34440. }, null, 2), [[vShow, unref(showDropIndicator)]])
  34441. ], 2),
  34442. unref(showSuffix) ? (openBlock(), createElementBlock("div", {
  34443. key: 1,
  34444. class: normalizeClass(unref(ns).e("suffix"))
  34445. }, [
  34446. renderSlot(_ctx.$slots, "suffix"),
  34447. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  34448. key: 0,
  34449. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("clear")]),
  34450. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  34451. onClick: unref(handleClear)
  34452. }, {
  34453. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.clearIcon)))]),
  34454. _: 1
  34455. }, 8, [
  34456. "class",
  34457. "onMousedown",
  34458. "onClick"
  34459. ])) : createCommentVNode("v-if", true),
  34460. validateState.value && validateIcon.value && needStatusIcon.value ? (openBlock(), createBlock(unref(ElIcon), {
  34461. key: 1,
  34462. class: normalizeClass([
  34463. unref(nsInput).e("icon"),
  34464. unref(nsInput).e("validateIcon"),
  34465. unref(nsInput).is("loading", validateState.value === "validating")
  34466. ])
  34467. }, {
  34468. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(validateIcon.value)))]),
  34469. _: 1
  34470. }, 8, ["class"])) : createCommentVNode("v-if", true)
  34471. ], 2)) : createCommentVNode("v-if", true)
  34472. ], 38);
  34473. };
  34474. }
  34475. });
  34476. //#endregion
  34477. //#region ../../packages/components/input-tag/src/input-tag.vue
  34478. var input_tag_default = input_tag_vue_vue_type_script_setup_true_lang_default;
  34479. //#endregion
  34480. //#region ../../packages/components/input-tag/index.ts
  34481. const ElInputTag = withInstall(input_tag_default);
  34482. //#endregion
  34483. //#region ../../packages/components/link/src/link.ts
  34484. /**
  34485. * @deprecated Removed after 3.0.0, Use `LinkProps` instead.
  34486. */
  34487. const linkProps = buildProps({
  34488. type: {
  34489. type: String,
  34490. values: [
  34491. "primary",
  34492. "success",
  34493. "warning",
  34494. "info",
  34495. "danger",
  34496. "default"
  34497. ],
  34498. default: void 0
  34499. },
  34500. underline: {
  34501. type: [Boolean, String],
  34502. values: [
  34503. true,
  34504. false,
  34505. "always",
  34506. "never",
  34507. "hover"
  34508. ],
  34509. default: void 0
  34510. },
  34511. disabled: Boolean,
  34512. href: {
  34513. type: String,
  34514. default: ""
  34515. },
  34516. target: {
  34517. type: String,
  34518. default: "_self"
  34519. },
  34520. icon: { type: iconPropType }
  34521. });
  34522. const linkEmits = { click: (evt) => evt instanceof MouseEvent };
  34523. //#endregion
  34524. //#region ../../packages/components/link/src/link.vue?vue&type=script&setup=true&lang.ts
  34525. const _hoisted_1$31 = ["href", "target"];
  34526. var link_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34527. name: "ElLink",
  34528. __name: "link",
  34529. props: linkProps,
  34530. emits: linkEmits,
  34531. setup(__props, { emit: __emit }) {
  34532. const props = __props;
  34533. const emit = __emit;
  34534. const globalConfig = useGlobalConfig("link");
  34535. useDeprecated({
  34536. scope: "el-link",
  34537. from: "The underline option (boolean)",
  34538. replacement: "'always' | 'hover' | 'never'",
  34539. version: "3.0.0",
  34540. ref: "https://element-plus.org/en-US/component/link.html#underline"
  34541. }, computed(() => isBoolean(props.underline)));
  34542. const ns = useNamespace("link");
  34543. const linkKls = computed(() => [
  34544. ns.b(),
  34545. ns.m(props.type ?? globalConfig.value?.type ?? "default"),
  34546. ns.is("disabled", props.disabled),
  34547. ns.is("underline", underline.value === "always"),
  34548. ns.is("hover-underline", underline.value === "hover" && !props.disabled)
  34549. ]);
  34550. const underline = computed(() => {
  34551. if (isBoolean(props.underline)) return props.underline ? "hover" : "never";
  34552. else return props.underline ?? globalConfig.value?.underline ?? "hover";
  34553. });
  34554. function handleClick(event) {
  34555. if (!props.disabled) emit("click", event);
  34556. }
  34557. return (_ctx, _cache) => {
  34558. return openBlock(), createElementBlock("a", {
  34559. class: normalizeClass(linkKls.value),
  34560. href: __props.disabled || !__props.href ? void 0 : __props.href,
  34561. target: __props.disabled || !__props.href ? void 0 : __props.target,
  34562. onClick: handleClick
  34563. }, [
  34564. __props.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  34565. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  34566. _: 1
  34567. })) : createCommentVNode("v-if", true),
  34568. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  34569. key: 1,
  34570. class: normalizeClass(unref(ns).e("inner"))
  34571. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true),
  34572. _ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 2 }) : createCommentVNode("v-if", true)
  34573. ], 10, _hoisted_1$31);
  34574. };
  34575. }
  34576. });
  34577. //#endregion
  34578. //#region ../../packages/components/link/src/link.vue
  34579. var link_default = link_vue_vue_type_script_setup_true_lang_default;
  34580. //#endregion
  34581. //#region ../../packages/components/link/index.ts
  34582. const ElLink = withInstall(link_default);
  34583. //#endregion
  34584. //#region ../../packages/components/menu/src/utils/submenu.ts
  34585. var SubMenu = class {
  34586. constructor(parent, domNode) {
  34587. this.parent = parent;
  34588. this.domNode = domNode;
  34589. this.subIndex = 0;
  34590. this.subIndex = 0;
  34591. this.init();
  34592. }
  34593. init() {
  34594. this.subMenuItems = this.domNode.querySelectorAll("li");
  34595. this.addListeners();
  34596. }
  34597. gotoSubIndex(idx) {
  34598. if (idx === this.subMenuItems.length) idx = 0;
  34599. else if (idx < 0) idx = this.subMenuItems.length - 1;
  34600. this.subMenuItems[idx].focus();
  34601. this.subIndex = idx;
  34602. }
  34603. addListeners() {
  34604. const parentNode = this.parent.domNode;
  34605. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  34606. el.addEventListener("keydown", (event) => {
  34607. const code = getEventCode(event);
  34608. let prevDef = false;
  34609. switch (code) {
  34610. case EVENT_CODE.down:
  34611. this.gotoSubIndex(this.subIndex + 1);
  34612. prevDef = true;
  34613. break;
  34614. case EVENT_CODE.up:
  34615. this.gotoSubIndex(this.subIndex - 1);
  34616. prevDef = true;
  34617. break;
  34618. case EVENT_CODE.tab:
  34619. triggerEvent(parentNode, "mouseleave");
  34620. break;
  34621. case EVENT_CODE.enter:
  34622. case EVENT_CODE.numpadEnter:
  34623. case EVENT_CODE.space:
  34624. prevDef = true;
  34625. event.currentTarget.click();
  34626. break;
  34627. }
  34628. if (prevDef) {
  34629. event.preventDefault();
  34630. event.stopPropagation();
  34631. }
  34632. return false;
  34633. });
  34634. });
  34635. }
  34636. };
  34637. //#endregion
  34638. //#region ../../packages/components/menu/src/utils/menu-item.ts
  34639. var MenuItem = class {
  34640. constructor(domNode, namespace) {
  34641. this.domNode = domNode;
  34642. this.submenu = null;
  34643. this.submenu = null;
  34644. this.init(namespace);
  34645. }
  34646. init(namespace) {
  34647. this.domNode.setAttribute("tabindex", "0");
  34648. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  34649. if (menuChild) this.submenu = new SubMenu(this, menuChild);
  34650. this.addListeners();
  34651. }
  34652. addListeners() {
  34653. this.domNode.addEventListener("keydown", (event) => {
  34654. const code = getEventCode(event);
  34655. let prevDef = false;
  34656. switch (code) {
  34657. case EVENT_CODE.down:
  34658. triggerEvent(event.currentTarget, "mouseenter");
  34659. this.submenu && this.submenu.gotoSubIndex(0);
  34660. prevDef = true;
  34661. break;
  34662. case EVENT_CODE.up:
  34663. triggerEvent(event.currentTarget, "mouseenter");
  34664. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  34665. prevDef = true;
  34666. break;
  34667. case EVENT_CODE.tab:
  34668. triggerEvent(event.currentTarget, "mouseleave");
  34669. break;
  34670. case EVENT_CODE.enter:
  34671. case EVENT_CODE.numpadEnter:
  34672. case EVENT_CODE.space:
  34673. prevDef = true;
  34674. event.currentTarget.click();
  34675. break;
  34676. }
  34677. if (prevDef) event.preventDefault();
  34678. });
  34679. }
  34680. };
  34681. //#endregion
  34682. //#region ../../packages/components/menu/src/utils/menu-bar.ts
  34683. var Menu = class {
  34684. constructor(domNode, namespace) {
  34685. this.domNode = domNode;
  34686. this.init(namespace);
  34687. }
  34688. init(namespace) {
  34689. const menuChildren = this.domNode.childNodes;
  34690. Array.from(menuChildren).forEach((child) => {
  34691. if (child.nodeType === 1) new MenuItem(child, namespace);
  34692. });
  34693. }
  34694. };
  34695. //#endregion
  34696. //#region ../../packages/components/menu/src/menu-collapse-transition.vue?vue&type=script&setup=true&lang.ts
  34697. var menu_collapse_transition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34698. name: "ElMenuCollapseTransition",
  34699. __name: "menu-collapse-transition",
  34700. setup(__props) {
  34701. const ns = useNamespace("menu");
  34702. const listeners = {
  34703. onBeforeEnter: (el) => el.style.opacity = "0.2",
  34704. onEnter(el, done) {
  34705. addClass(el, `${ns.namespace.value}-opacity-transition`);
  34706. el.style.opacity = "1";
  34707. done();
  34708. },
  34709. onAfterEnter(el) {
  34710. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  34711. el.style.opacity = "";
  34712. },
  34713. onBeforeLeave(el) {
  34714. if (!el.dataset) el.dataset = {};
  34715. if (hasClass(el, ns.m("collapse"))) {
  34716. removeClass(el, ns.m("collapse"));
  34717. el.dataset.oldOverflow = el.style.overflow;
  34718. el.dataset.scrollWidth = el.clientWidth.toString();
  34719. addClass(el, ns.m("collapse"));
  34720. } else {
  34721. addClass(el, ns.m("collapse"));
  34722. el.dataset.oldOverflow = el.style.overflow;
  34723. el.dataset.scrollWidth = el.clientWidth.toString();
  34724. removeClass(el, ns.m("collapse"));
  34725. }
  34726. el.style.width = `${el.scrollWidth}px`;
  34727. el.style.overflow = "hidden";
  34728. },
  34729. onLeave(el) {
  34730. addClass(el, "horizontal-collapse-transition");
  34731. el.style.width = `${el.dataset.scrollWidth}px`;
  34732. }
  34733. };
  34734. return (_ctx, _cache) => {
  34735. return openBlock(), createBlock(Transition, mergeProps({ mode: "out-in" }, listeners), {
  34736. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  34737. _: 3
  34738. }, 16);
  34739. };
  34740. }
  34741. });
  34742. //#endregion
  34743. //#region ../../packages/components/menu/src/menu-collapse-transition.vue
  34744. var menu_collapse_transition_default = menu_collapse_transition_vue_vue_type_script_setup_true_lang_default;
  34745. //#endregion
  34746. //#region ../../packages/components/menu/src/use-menu.ts
  34747. function useMenu(instance, currentIndex) {
  34748. const indexPath = computed(() => {
  34749. let parent = instance.parent;
  34750. const path = [currentIndex.value];
  34751. while (parent.type.name !== "ElMenu") {
  34752. if (parent.props.index) path.unshift(parent.props.index);
  34753. parent = parent.parent;
  34754. }
  34755. return path;
  34756. });
  34757. return {
  34758. parentMenu: computed(() => {
  34759. let parent = instance.parent;
  34760. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) parent = parent.parent;
  34761. return parent;
  34762. }),
  34763. indexPath
  34764. };
  34765. }
  34766. //#endregion
  34767. //#region ../../packages/components/menu/src/use-menu-color.ts
  34768. function useMenuColor(props) {
  34769. return computed(() => {
  34770. const color = props.backgroundColor;
  34771. return color ? new TinyColor(color).shade(20).toString() : "";
  34772. });
  34773. }
  34774. //#endregion
  34775. //#region ../../packages/components/menu/src/use-menu-css-var.ts
  34776. const useMenuCssVar = (props, level) => {
  34777. const ns = useNamespace("menu");
  34778. return computed(() => ns.cssVarBlock({
  34779. "text-color": props.textColor || "",
  34780. "hover-text-color": props.textColor || "",
  34781. "bg-color": props.backgroundColor || "",
  34782. "hover-bg-color": useMenuColor(props).value || "",
  34783. "active-color": props.activeTextColor || "",
  34784. level: `${level}`
  34785. }));
  34786. };
  34787. //#endregion
  34788. //#region ../../packages/components/menu/src/tokens.ts
  34789. const MENU_INJECTION_KEY = "rootMenu";
  34790. const SUB_MENU_INJECTION_KEY = "subMenu:";
  34791. //#endregion
  34792. //#region ../../packages/components/menu/src/sub-menu.ts
  34793. const subMenuProps = buildProps({
  34794. index: {
  34795. type: String,
  34796. required: true
  34797. },
  34798. showTimeout: Number,
  34799. hideTimeout: Number,
  34800. popperClass: String,
  34801. popperStyle: { type: definePropType([String, Object]) },
  34802. disabled: Boolean,
  34803. teleported: {
  34804. type: Boolean,
  34805. default: void 0
  34806. },
  34807. popperOffset: Number,
  34808. expandCloseIcon: { type: iconPropType },
  34809. expandOpenIcon: { type: iconPropType },
  34810. collapseCloseIcon: { type: iconPropType },
  34811. collapseOpenIcon: { type: iconPropType }
  34812. });
  34813. const COMPONENT_NAME$8 = "ElSubMenu";
  34814. var sub_menu_default = defineComponent({
  34815. name: COMPONENT_NAME$8,
  34816. props: subMenuProps,
  34817. setup(props, { slots, expose }) {
  34818. const instance = getCurrentInstance();
  34819. const { indexPath, parentMenu } = useMenu(instance, computed(() => props.index));
  34820. const nsMenu = useNamespace("menu");
  34821. const nsSubMenu = useNamespace("sub-menu");
  34822. const rootMenu = inject(MENU_INJECTION_KEY);
  34823. if (!rootMenu) throwError(COMPONENT_NAME$8, "can not inject root menu");
  34824. const subMenu = inject(`${SUB_MENU_INJECTION_KEY}${parentMenu.value.uid}`);
  34825. if (!subMenu) throwError(COMPONENT_NAME$8, "can not inject sub menu");
  34826. const items = ref({});
  34827. const subMenus = ref({});
  34828. let timeout;
  34829. const mouseInChild = ref(false);
  34830. const verticalTitleRef = ref();
  34831. const vPopper = ref();
  34832. const isFirstLevel = computed(() => subMenu.level === 0);
  34833. const currentPlacement = computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  34834. const subMenuTitleIcon = computed(() => {
  34835. if (mode.value === "horizontal" && isFirstLevel.value || mode.value === "vertical" && !rootMenu.props.collapse) {
  34836. if (props.expandCloseIcon && props.expandOpenIcon) return opened.value ? props.expandOpenIcon : props.expandCloseIcon;
  34837. return arrow_down_default;
  34838. } else {
  34839. if (props.collapseCloseIcon && props.collapseOpenIcon) return opened.value ? props.collapseOpenIcon : props.collapseCloseIcon;
  34840. return arrow_right_default;
  34841. }
  34842. });
  34843. const appendToBody = computed(() => {
  34844. const value = props.teleported;
  34845. return isUndefined(value) ? isFirstLevel.value : value;
  34846. });
  34847. const menuTransitionName = computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  34848. const fallbackPlacements = computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  34849. "bottom-start",
  34850. "bottom-end",
  34851. "top-start",
  34852. "top-end",
  34853. "right-start",
  34854. "left-start"
  34855. ] : [
  34856. "right-start",
  34857. "right",
  34858. "right-end",
  34859. "left-start",
  34860. "bottom-start",
  34861. "bottom-end",
  34862. "top-start",
  34863. "top-end"
  34864. ]);
  34865. const opened = computed(() => rootMenu.openedMenus.includes(props.index));
  34866. const active = computed(() => [...Object.values(items.value), ...Object.values(subMenus.value)].some(({ active }) => active));
  34867. const mode = computed(() => rootMenu.props.mode);
  34868. const persistent = computed(() => rootMenu.props.persistent);
  34869. const item = reactive({
  34870. index: props.index,
  34871. indexPath,
  34872. active
  34873. });
  34874. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  34875. const subMenuPopperOffset = computed(() => props.popperOffset ?? rootMenu.props.popperOffset);
  34876. const subMenuPopperClass = computed(() => props.popperClass ?? rootMenu.props.popperClass);
  34877. const subMenuPopperStyle = computed(() => props.popperStyle ?? rootMenu.props.popperStyle);
  34878. const subMenuShowTimeout = computed(() => props.showTimeout ?? rootMenu.props.showTimeout);
  34879. const subMenuHideTimeout = computed(() => props.hideTimeout ?? rootMenu.props.hideTimeout);
  34880. const doDestroy = () => vPopper.value?.popperRef?.popperInstanceRef?.destroy();
  34881. const handleCollapseToggle = (value) => {
  34882. if (!value) doDestroy();
  34883. };
  34884. const handleClick = () => {
  34885. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) return;
  34886. rootMenu.handleSubMenuClick({
  34887. index: props.index,
  34888. indexPath: indexPath.value,
  34889. active: active.value
  34890. });
  34891. };
  34892. const handleMouseenter = (event, showTimeout = subMenuShowTimeout.value) => {
  34893. if (event.type === "focus") return;
  34894. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  34895. subMenu.mouseInChild.value = true;
  34896. return;
  34897. }
  34898. subMenu.mouseInChild.value = true;
  34899. timeout?.();
  34900. ({stop: timeout} = useTimeoutFn(() => {
  34901. rootMenu.openMenu(props.index, indexPath.value);
  34902. }, showTimeout));
  34903. if (appendToBody.value) parentMenu.value.vnode.el?.dispatchEvent(new MouseEvent("mouseenter"));
  34904. if (event.type === "mouseenter" && event.target) nextTick(() => {
  34905. focusElement(event.target, { preventScroll: true });
  34906. });
  34907. };
  34908. const handleMouseleave = (deepDispatch = false) => {
  34909. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  34910. subMenu.mouseInChild.value = false;
  34911. return;
  34912. }
  34913. timeout?.();
  34914. subMenu.mouseInChild.value = false;
  34915. ({stop: timeout} = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), subMenuHideTimeout.value));
  34916. if (appendToBody.value && deepDispatch) subMenu.handleMouseleave?.(true);
  34917. };
  34918. watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  34919. {
  34920. const addSubMenu = (item) => {
  34921. subMenus.value[item.index] = item;
  34922. };
  34923. const removeSubMenu = (item) => {
  34924. delete subMenus.value[item.index];
  34925. };
  34926. provide(`${SUB_MENU_INJECTION_KEY}${instance.uid}`, {
  34927. addSubMenu,
  34928. removeSubMenu,
  34929. handleMouseleave,
  34930. mouseInChild,
  34931. level: subMenu.level + 1
  34932. });
  34933. }
  34934. expose({ opened });
  34935. onMounted(() => {
  34936. rootMenu.addSubMenu(item);
  34937. subMenu.addSubMenu(item);
  34938. });
  34939. onBeforeUnmount(() => {
  34940. subMenu.removeSubMenu(item);
  34941. rootMenu.removeSubMenu(item);
  34942. });
  34943. return () => {
  34944. const titleTag = [slots.title?.(), h(ElIcon, {
  34945. class: nsSubMenu.e("icon-arrow"),
  34946. style: { transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none" }
  34947. }, { default: () => isString(subMenuTitleIcon.value) ? h(instance.appContext.components[subMenuTitleIcon.value]) : h(subMenuTitleIcon.value) })];
  34948. const child = rootMenu.isMenuPopup ? h(ElTooltip, {
  34949. ref: vPopper,
  34950. visible: opened.value,
  34951. effect: "light",
  34952. pure: true,
  34953. offset: subMenuPopperOffset.value,
  34954. showArrow: false,
  34955. persistent: persistent.value,
  34956. popperClass: subMenuPopperClass.value,
  34957. popperStyle: subMenuPopperStyle.value,
  34958. placement: currentPlacement.value,
  34959. teleported: appendToBody.value,
  34960. fallbackPlacements: fallbackPlacements.value,
  34961. transition: menuTransitionName.value,
  34962. gpuAcceleration: false
  34963. }, {
  34964. content: () => h("div", {
  34965. class: [
  34966. nsMenu.m(mode.value),
  34967. nsMenu.m("popup-container"),
  34968. subMenuPopperClass.value
  34969. ],
  34970. onMouseenter: (evt) => handleMouseenter(evt, 100),
  34971. onMouseleave: () => handleMouseleave(true),
  34972. onFocus: (evt) => handleMouseenter(evt, 100)
  34973. }, [h("ul", {
  34974. class: [
  34975. nsMenu.b(),
  34976. nsMenu.m("popup"),
  34977. nsMenu.m(`popup-${currentPlacement.value}`)
  34978. ],
  34979. style: ulStyle.value
  34980. }, [slots.default?.()])]),
  34981. default: () => h("div", {
  34982. class: nsSubMenu.e("title"),
  34983. onClick: handleClick
  34984. }, titleTag)
  34985. }) : h(Fragment, {}, [h("div", {
  34986. class: nsSubMenu.e("title"),
  34987. ref: verticalTitleRef,
  34988. onClick: handleClick
  34989. }, titleTag), h(ElCollapseTransition, {}, { default: () => withDirectives(h("ul", {
  34990. role: "menu",
  34991. class: [nsMenu.b(), nsMenu.m("inline")],
  34992. style: ulStyle.value
  34993. }, [slots.default?.()]), [[vShow, opened.value]]) })]);
  34994. return h("li", {
  34995. class: [
  34996. nsSubMenu.b(),
  34997. nsSubMenu.is("active", active.value),
  34998. nsSubMenu.is("opened", opened.value),
  34999. nsSubMenu.is("disabled", props.disabled)
  35000. ],
  35001. role: "menuitem",
  35002. ariaHaspopup: true,
  35003. ariaExpanded: opened.value,
  35004. onMouseenter: handleMouseenter,
  35005. onMouseleave: () => handleMouseleave(),
  35006. onFocus: handleMouseenter
  35007. }, [child]);
  35008. };
  35009. }
  35010. });
  35011. //#endregion
  35012. //#region ../../packages/components/menu/src/menu.ts
  35013. const menuProps = buildProps({
  35014. mode: {
  35015. type: String,
  35016. values: ["horizontal", "vertical"],
  35017. default: "vertical"
  35018. },
  35019. defaultActive: {
  35020. type: String,
  35021. default: ""
  35022. },
  35023. defaultOpeneds: {
  35024. type: definePropType(Array),
  35025. default: () => mutable([])
  35026. },
  35027. uniqueOpened: Boolean,
  35028. router: Boolean,
  35029. menuTrigger: {
  35030. type: String,
  35031. values: ["hover", "click"],
  35032. default: "hover"
  35033. },
  35034. collapse: Boolean,
  35035. backgroundColor: String,
  35036. textColor: String,
  35037. activeTextColor: String,
  35038. closeOnClickOutside: Boolean,
  35039. collapseTransition: {
  35040. type: Boolean,
  35041. default: true
  35042. },
  35043. ellipsis: {
  35044. type: Boolean,
  35045. default: true
  35046. },
  35047. popperOffset: {
  35048. type: Number,
  35049. default: 6
  35050. },
  35051. ellipsisIcon: {
  35052. type: iconPropType,
  35053. default: () => more_default
  35054. },
  35055. popperEffect: {
  35056. type: definePropType(String),
  35057. default: "dark"
  35058. },
  35059. popperClass: String,
  35060. popperStyle: { type: definePropType([String, Object]) },
  35061. showTimeout: {
  35062. type: Number,
  35063. default: 300
  35064. },
  35065. hideTimeout: {
  35066. type: Number,
  35067. default: 300
  35068. },
  35069. persistent: {
  35070. type: Boolean,
  35071. default: true
  35072. }
  35073. });
  35074. const checkIndexPath = (indexPath) => isArray$1(indexPath) && indexPath.every((path) => isString(path));
  35075. const menuEmits = {
  35076. close: (index, indexPath) => isString(index) && checkIndexPath(indexPath),
  35077. open: (index, indexPath) => isString(index) && checkIndexPath(indexPath),
  35078. select: (index, indexPath, item, routerResult) => isString(index) && checkIndexPath(indexPath) && isObject$1(item) && (isUndefined(routerResult) || routerResult instanceof Promise)
  35079. };
  35080. const DEFAULT_MORE_ITEM_WIDTH = 64;
  35081. var menu_default = defineComponent({
  35082. name: "ElMenu",
  35083. props: menuProps,
  35084. emits: menuEmits,
  35085. setup(props, { emit, slots, expose }) {
  35086. const instance = getCurrentInstance();
  35087. const router = instance.appContext.config.globalProperties.$router;
  35088. const menu = ref();
  35089. const subMenu = ref();
  35090. const nsMenu = useNamespace("menu");
  35091. const nsSubMenu = useNamespace("sub-menu");
  35092. let moreItemWidth = DEFAULT_MORE_ITEM_WIDTH;
  35093. const sliceIndex = ref(-1);
  35094. const openedMenus = ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  35095. const activeIndex = ref(props.defaultActive);
  35096. const items = ref({});
  35097. const subMenus = ref({});
  35098. const isMenuPopup = computed(() => props.mode === "horizontal" || props.mode === "vertical" && props.collapse);
  35099. const initMenu = () => {
  35100. const activeItem = activeIndex.value && items.value[activeIndex.value];
  35101. if (!activeItem || props.mode === "horizontal" || props.collapse) return;
  35102. activeItem.indexPath.forEach((index) => {
  35103. const subMenu = subMenus.value[index];
  35104. subMenu && openMenu(index, subMenu.indexPath);
  35105. });
  35106. };
  35107. const openMenu = (index, indexPath) => {
  35108. if (openedMenus.value.includes(index)) return;
  35109. if (props.uniqueOpened) openedMenus.value = openedMenus.value.filter((index) => indexPath.includes(index));
  35110. openedMenus.value.push(index);
  35111. emit("open", index, indexPath);
  35112. };
  35113. const close = (index) => {
  35114. const i = openedMenus.value.indexOf(index);
  35115. if (i !== -1) openedMenus.value.splice(i, 1);
  35116. };
  35117. const closeMenu = (index, indexPath) => {
  35118. close(index);
  35119. emit("close", index, indexPath);
  35120. };
  35121. const handleSubMenuClick = ({ index, indexPath }) => {
  35122. openedMenus.value.includes(index) ? closeMenu(index, indexPath) : openMenu(index, indexPath);
  35123. };
  35124. const handleMenuItemClick = (menuItem) => {
  35125. if (props.mode === "horizontal" || props.collapse) openedMenus.value = [];
  35126. const { index, indexPath } = menuItem;
  35127. if (isNil(index) || isNil(indexPath)) return;
  35128. if (props.router && router) {
  35129. const route = menuItem.route || index;
  35130. const routerResult = router.push(route).then((res) => {
  35131. if (!res) activeIndex.value = index;
  35132. return res;
  35133. });
  35134. emit("select", index, indexPath, {
  35135. index,
  35136. indexPath,
  35137. route
  35138. }, routerResult);
  35139. } else {
  35140. activeIndex.value = index;
  35141. emit("select", index, indexPath, {
  35142. index,
  35143. indexPath
  35144. });
  35145. }
  35146. };
  35147. const updateActiveIndex = (val) => {
  35148. const itemsInData = items.value;
  35149. activeIndex.value = (itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive])?.index ?? val;
  35150. };
  35151. const calcMenuItemWidth = (menuItem) => {
  35152. const computedStyle = getComputedStyle(menuItem);
  35153. const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
  35154. const marginRight = Number.parseInt(computedStyle.marginRight, 10);
  35155. return menuItem.offsetWidth + marginLeft + marginRight || 0;
  35156. };
  35157. const calcSliceIndex = () => {
  35158. if (!menu.value) return -1;
  35159. const items = Array.from(menu.value.childNodes).filter((item) => item.nodeName !== "#comment" && (item.nodeName !== "#text" || item.nodeValue));
  35160. const computedMenuStyle = getComputedStyle(menu.value);
  35161. const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
  35162. const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
  35163. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  35164. let calcWidth = 0;
  35165. let sliceIndex = 0;
  35166. items.forEach((item, index) => {
  35167. calcWidth += calcMenuItemWidth(item);
  35168. if (calcWidth <= menuWidth - moreItemWidth) sliceIndex = index + 1;
  35169. });
  35170. return sliceIndex === items.length ? -1 : sliceIndex;
  35171. };
  35172. const getIndexPath = (index) => subMenus.value[index].indexPath;
  35173. const debounce = (fn, wait = 33.34) => {
  35174. let timer;
  35175. return () => {
  35176. timer && clearTimeout(timer);
  35177. timer = setTimeout(() => {
  35178. fn();
  35179. }, wait);
  35180. };
  35181. };
  35182. let isFirstTimeRender = true;
  35183. const handleResize = () => {
  35184. const el = unrefElement(subMenu);
  35185. if (el) moreItemWidth = calcMenuItemWidth(el) || DEFAULT_MORE_ITEM_WIDTH;
  35186. if (sliceIndex.value === calcSliceIndex()) return;
  35187. const callback = () => {
  35188. sliceIndex.value = -1;
  35189. nextTick(() => {
  35190. sliceIndex.value = calcSliceIndex();
  35191. });
  35192. };
  35193. isFirstTimeRender ? callback() : debounce(callback)();
  35194. isFirstTimeRender = false;
  35195. };
  35196. watch(() => props.defaultActive, (currentActive) => {
  35197. if (!items.value[currentActive]) activeIndex.value = "";
  35198. updateActiveIndex(currentActive);
  35199. });
  35200. watch(() => props.collapse, (value) => {
  35201. if (value) openedMenus.value = [];
  35202. });
  35203. watch(items.value, initMenu);
  35204. let resizeStopper;
  35205. watchEffect(() => {
  35206. if (props.mode === "horizontal" && props.ellipsis) resizeStopper = useResizeObserver(menu, handleResize).stop;
  35207. else resizeStopper?.();
  35208. });
  35209. const mouseInChild = ref(false);
  35210. {
  35211. const addSubMenu = (item) => {
  35212. subMenus.value[item.index] = item;
  35213. };
  35214. const removeSubMenu = (item) => {
  35215. delete subMenus.value[item.index];
  35216. };
  35217. const addMenuItem = (item) => {
  35218. items.value[item.index] = item;
  35219. };
  35220. const removeMenuItem = (item) => {
  35221. delete items.value[item.index];
  35222. };
  35223. provide(MENU_INJECTION_KEY, reactive({
  35224. props,
  35225. openedMenus,
  35226. items,
  35227. subMenus,
  35228. activeIndex,
  35229. isMenuPopup,
  35230. addMenuItem,
  35231. removeMenuItem,
  35232. addSubMenu,
  35233. removeSubMenu,
  35234. openMenu,
  35235. closeMenu,
  35236. handleMenuItemClick,
  35237. handleSubMenuClick
  35238. }));
  35239. provide(`${SUB_MENU_INJECTION_KEY}${instance.uid}`, {
  35240. addSubMenu,
  35241. removeSubMenu,
  35242. mouseInChild,
  35243. level: 0
  35244. });
  35245. }
  35246. onMounted(() => {
  35247. if (props.mode === "horizontal") new Menu(instance.vnode.el, nsMenu.namespace.value);
  35248. });
  35249. {
  35250. const open = (index) => {
  35251. const { indexPath } = subMenus.value[index];
  35252. indexPath.forEach((i) => openMenu(i, indexPath));
  35253. };
  35254. expose({
  35255. open,
  35256. close,
  35257. updateActiveIndex,
  35258. handleResize
  35259. });
  35260. }
  35261. const ulStyle = useMenuCssVar(props, 0);
  35262. return () => {
  35263. let slot = slots.default?.() ?? [];
  35264. const vShowMore = [];
  35265. if (props.mode === "horizontal" && menu.value) {
  35266. const originalSlot = flattedChildren(slot).filter((vnode) => {
  35267. return vnode?.shapeFlag !== 8;
  35268. });
  35269. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  35270. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  35271. if (slotMore?.length && props.ellipsis) {
  35272. slot = slotDefault;
  35273. vShowMore.push(h(sub_menu_default, {
  35274. ref: subMenu,
  35275. index: "sub-menu-more",
  35276. class: nsSubMenu.e("hide-arrow"),
  35277. popperOffset: props.popperOffset
  35278. }, {
  35279. title: () => h(ElIcon, { class: nsSubMenu.e("icon-more") }, { default: () => h(props.ellipsisIcon) }),
  35280. default: () => slotMore
  35281. }));
  35282. }
  35283. }
  35284. const directives = props.closeOnClickOutside ? [[ClickOutside, () => {
  35285. if (!openedMenus.value.length) return;
  35286. if (!mouseInChild.value) {
  35287. openedMenus.value.forEach((openedMenu) => emit("close", openedMenu, getIndexPath(openedMenu)));
  35288. openedMenus.value = [];
  35289. }
  35290. }]] : [];
  35291. const vMenu = withDirectives(h("ul", {
  35292. key: String(props.collapse),
  35293. role: "menubar",
  35294. ref: menu,
  35295. style: ulStyle.value,
  35296. class: {
  35297. [nsMenu.b()]: true,
  35298. [nsMenu.m(props.mode)]: true,
  35299. [nsMenu.m("collapse")]: props.collapse
  35300. }
  35301. }, [...slot, ...vShowMore]), directives);
  35302. if (props.collapseTransition && props.mode === "vertical") return h(menu_collapse_transition_default, () => vMenu);
  35303. return vMenu;
  35304. };
  35305. }
  35306. });
  35307. //#endregion
  35308. //#region ../../packages/components/menu/src/menu-item.ts
  35309. /**
  35310. * @deprecated Removed after 3.0.0, Use `MenuItemProps` instead.
  35311. */
  35312. const menuItemProps = buildProps({
  35313. index: {
  35314. type: definePropType([String, null]),
  35315. default: null
  35316. },
  35317. route: { type: definePropType([String, Object]) },
  35318. disabled: Boolean
  35319. });
  35320. const menuItemEmits = { click: (item) => isString(item.index) && isArray$1(item.indexPath) };
  35321. //#endregion
  35322. //#region ../../packages/components/menu/src/menu-item.vue?vue&type=script&setup=true&lang.ts
  35323. const COMPONENT_NAME$7 = "ElMenuItem";
  35324. var menu_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35325. name: COMPONENT_NAME$7,
  35326. __name: "menu-item",
  35327. props: menuItemProps,
  35328. emits: menuItemEmits,
  35329. setup(__props, { expose: __expose, emit: __emit }) {
  35330. const props = __props;
  35331. const emit = __emit;
  35332. isPropAbsent(props.index) && /* @__PURE__ */ debugWarn(COMPONENT_NAME$7, "Missing required prop: \"index\"");
  35333. const instance = getCurrentInstance();
  35334. const rootMenu = inject(MENU_INJECTION_KEY);
  35335. const nsMenu = useNamespace("menu");
  35336. const nsMenuItem = useNamespace("menu-item");
  35337. if (!rootMenu) throwError(COMPONENT_NAME$7, "can not inject root menu");
  35338. const { parentMenu, indexPath } = useMenu(instance, toRef(props, "index"));
  35339. const subMenu = inject(`${SUB_MENU_INJECTION_KEY}${parentMenu.value.uid}`);
  35340. if (!subMenu) throwError(COMPONENT_NAME$7, "can not inject sub menu");
  35341. const active = computed(() => props.index === rootMenu.activeIndex);
  35342. const item = reactive({
  35343. index: props.index,
  35344. indexPath,
  35345. active
  35346. });
  35347. const handleClick = () => {
  35348. if (!props.disabled) {
  35349. rootMenu.handleMenuItemClick({
  35350. index: props.index,
  35351. indexPath: indexPath.value,
  35352. route: props.route
  35353. });
  35354. emit("click", item);
  35355. }
  35356. };
  35357. onMounted(() => {
  35358. subMenu.addSubMenu(item);
  35359. rootMenu.addMenuItem(item);
  35360. });
  35361. onBeforeUnmount(() => {
  35362. subMenu.removeSubMenu(item);
  35363. rootMenu.removeMenuItem(item);
  35364. });
  35365. __expose({
  35366. parentMenu,
  35367. rootMenu,
  35368. active,
  35369. nsMenu,
  35370. nsMenuItem,
  35371. handleClick
  35372. });
  35373. return (_ctx, _cache) => {
  35374. return openBlock(), createElementBlock("li", {
  35375. class: normalizeClass([
  35376. unref(nsMenuItem).b(),
  35377. unref(nsMenuItem).is("active", active.value),
  35378. unref(nsMenuItem).is("disabled", __props.disabled)
  35379. ]),
  35380. role: "menuitem",
  35381. tabindex: "-1",
  35382. onClick: handleClick
  35383. }, [unref(parentMenu).type.name === "ElMenu" && unref(rootMenu).props.collapse && _ctx.$slots.title ? (openBlock(), createBlock(unref(ElTooltip), {
  35384. key: 0,
  35385. effect: unref(rootMenu).props.popperEffect,
  35386. placement: "right",
  35387. "fallback-placements": ["left"],
  35388. "popper-class": unref(rootMenu).props.popperClass,
  35389. "popper-style": unref(rootMenu).props.popperStyle,
  35390. persistent: unref(rootMenu).props.persistent,
  35391. "focus-on-target": ""
  35392. }, {
  35393. content: withCtx(() => [renderSlot(_ctx.$slots, "title")]),
  35394. default: withCtx(() => [createElementVNode("div", { class: normalizeClass(unref(nsMenu).be("tooltip", "trigger")) }, [renderSlot(_ctx.$slots, "default")], 2)]),
  35395. _: 3
  35396. }, 8, [
  35397. "effect",
  35398. "popper-class",
  35399. "popper-style",
  35400. "persistent"
  35401. ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [renderSlot(_ctx.$slots, "default"), renderSlot(_ctx.$slots, "title")], 64))], 2);
  35402. };
  35403. }
  35404. });
  35405. //#endregion
  35406. //#region ../../packages/components/menu/src/menu-item.vue
  35407. var menu_item_default = menu_item_vue_vue_type_script_setup_true_lang_default;
  35408. //#endregion
  35409. //#region ../../packages/components/menu/src/menu-item-group.ts
  35410. /**
  35411. * @deprecated Removed after 3.0.0, Use `MenuItemGroupProps` instead.
  35412. */
  35413. const menuItemGroupProps = { title: String };
  35414. //#endregion
  35415. //#region ../../packages/components/menu/src/menu-item-group.vue?vue&type=script&setup=true&lang.ts
  35416. var menu_item_group_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35417. name: "ElMenuItemGroup",
  35418. __name: "menu-item-group",
  35419. props: menuItemGroupProps,
  35420. setup(__props) {
  35421. const ns = useNamespace("menu-item-group");
  35422. return (_ctx, _cache) => {
  35423. return openBlock(), createElementBlock("li", { class: normalizeClass(unref(ns).b()) }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("title")) }, [!_ctx.$slots.title ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(__props.title), 1)], 64)) : renderSlot(_ctx.$slots, "title", { key: 1 })], 2), createElementVNode("ul", null, [renderSlot(_ctx.$slots, "default")])], 2);
  35424. };
  35425. }
  35426. });
  35427. //#endregion
  35428. //#region ../../packages/components/menu/src/menu-item-group.vue
  35429. var menu_item_group_default = menu_item_group_vue_vue_type_script_setup_true_lang_default;
  35430. //#endregion
  35431. //#region ../../packages/components/menu/index.ts
  35432. const ElMenu = withInstall(menu_default, {
  35433. MenuItem: menu_item_default,
  35434. MenuItemGroup: menu_item_group_default,
  35435. SubMenu: sub_menu_default
  35436. });
  35437. const ElMenuItem = withNoopInstall(menu_item_default);
  35438. const ElMenuItemGroup = withNoopInstall(menu_item_group_default);
  35439. const ElSubMenu = withNoopInstall(sub_menu_default);
  35440. //#endregion
  35441. //#region ../../packages/components/page-header/src/page-header.ts
  35442. /**
  35443. * @deprecated Removed after 3.0.0, Use `PageHeaderProps` instead.
  35444. */
  35445. const pageHeaderProps = buildProps({
  35446. icon: {
  35447. type: iconPropType,
  35448. default: () => back_default
  35449. },
  35450. title: String,
  35451. content: {
  35452. type: String,
  35453. default: ""
  35454. }
  35455. });
  35456. const pageHeaderEmits = { back: () => true };
  35457. //#endregion
  35458. //#region ../../packages/components/page-header/src/page-header.vue?vue&type=script&setup=true&lang.ts
  35459. const _hoisted_1$30 = ["aria-label"];
  35460. var page_header_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35461. name: "ElPageHeader",
  35462. __name: "page-header",
  35463. props: pageHeaderProps,
  35464. emits: pageHeaderEmits,
  35465. setup(__props, { emit: __emit }) {
  35466. const emit = __emit;
  35467. const { t } = useLocale();
  35468. const ns = useNamespace("page-header");
  35469. function handleClick() {
  35470. emit("back");
  35471. }
  35472. return (_ctx, _cache) => {
  35473. return openBlock(), createElementBlock("div", { class: normalizeClass([
  35474. unref(ns).b(),
  35475. unref(ns).is("contentful", !!_ctx.$slots.default),
  35476. {
  35477. [unref(ns).m("has-breadcrumb")]: !!_ctx.$slots.breadcrumb,
  35478. [unref(ns).m("has-extra")]: !!_ctx.$slots.extra
  35479. }
  35480. ]) }, [
  35481. _ctx.$slots.breadcrumb ? (openBlock(), createElementBlock("div", {
  35482. key: 0,
  35483. class: normalizeClass(unref(ns).e("breadcrumb"))
  35484. }, [renderSlot(_ctx.$slots, "breadcrumb")], 2)) : createCommentVNode("v-if", true),
  35485. createElementVNode("div", { class: normalizeClass(unref(ns).e("header")) }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("left")) }, [
  35486. createElementVNode("div", {
  35487. class: normalizeClass(unref(ns).e("back")),
  35488. role: "button",
  35489. tabindex: "0",
  35490. onClick: handleClick
  35491. }, [__props.icon || _ctx.$slots.icon ? (openBlock(), createElementBlock("div", {
  35492. key: 0,
  35493. "aria-label": __props.title || unref(t)("el.pageHeader.title"),
  35494. class: normalizeClass(unref(ns).e("icon"))
  35495. }, [renderSlot(_ctx.$slots, "icon", {}, () => [__props.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  35496. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  35497. _: 1
  35498. })) : createCommentVNode("v-if", true)])], 10, _hoisted_1$30)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("title")) }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title || unref(t)("el.pageHeader.title")), 1)])], 2)], 2),
  35499. createVNode(unref(ElDivider), { direction: "vertical" }),
  35500. createElementVNode("div", { class: normalizeClass(unref(ns).e("content")) }, [renderSlot(_ctx.$slots, "content", {}, () => [createTextVNode(toDisplayString(__props.content), 1)])], 2)
  35501. ], 2), _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  35502. key: 0,
  35503. class: normalizeClass(unref(ns).e("extra"))
  35504. }, [renderSlot(_ctx.$slots, "extra")], 2)) : createCommentVNode("v-if", true)], 2),
  35505. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  35506. key: 1,
  35507. class: normalizeClass(unref(ns).e("main"))
  35508. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true)
  35509. ], 2);
  35510. };
  35511. }
  35512. });
  35513. //#endregion
  35514. //#region ../../packages/components/page-header/src/page-header.vue
  35515. var page_header_default = page_header_vue_vue_type_script_setup_true_lang_default;
  35516. //#endregion
  35517. //#region ../../packages/components/page-header/index.ts
  35518. const ElPageHeader = withInstall(page_header_default);
  35519. //#endregion
  35520. //#region ../../packages/components/pagination/src/constants.ts
  35521. const elPaginationKey = Symbol("elPaginationKey");
  35522. //#endregion
  35523. //#region ../../packages/components/pagination/src/components/prev.ts
  35524. const paginationPrevProps = buildProps({
  35525. disabled: Boolean,
  35526. currentPage: {
  35527. type: Number,
  35528. default: 1
  35529. },
  35530. prevText: { type: String },
  35531. prevIcon: { type: iconPropType }
  35532. });
  35533. const paginationPrevEmits = { click: (evt) => evt instanceof MouseEvent };
  35534. //#endregion
  35535. //#region ../../packages/components/pagination/src/components/prev.vue?vue&type=script&setup=true&lang.ts
  35536. const _hoisted_1$29 = [
  35537. "disabled",
  35538. "aria-label",
  35539. "aria-disabled"
  35540. ];
  35541. const _hoisted_2$18 = { key: 0 };
  35542. var prev_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35543. name: "ElPaginationPrev",
  35544. __name: "prev",
  35545. props: paginationPrevProps,
  35546. emits: paginationPrevEmits,
  35547. setup(__props) {
  35548. const props = __props;
  35549. const { t } = useLocale();
  35550. const internalDisabled = computed(() => props.disabled || props.currentPage <= 1);
  35551. return (_ctx, _cache) => {
  35552. return openBlock(), createElementBlock("button", {
  35553. type: "button",
  35554. class: "btn-prev",
  35555. disabled: internalDisabled.value,
  35556. "aria-label": _ctx.prevText || unref(t)("el.pagination.prev"),
  35557. "aria-disabled": internalDisabled.value,
  35558. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  35559. }, [_ctx.prevText ? (openBlock(), createElementBlock("span", _hoisted_2$18, toDisplayString(_ctx.prevText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  35560. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.prevIcon)))]),
  35561. _: 1
  35562. }))], 8, _hoisted_1$29);
  35563. };
  35564. }
  35565. });
  35566. //#endregion
  35567. //#region ../../packages/components/pagination/src/components/prev.vue
  35568. var prev_default = prev_vue_vue_type_script_setup_true_lang_default;
  35569. //#endregion
  35570. //#region ../../packages/components/pagination/src/components/next.ts
  35571. const paginationNextProps = buildProps({
  35572. disabled: Boolean,
  35573. currentPage: {
  35574. type: Number,
  35575. default: 1
  35576. },
  35577. pageCount: {
  35578. type: Number,
  35579. default: 50
  35580. },
  35581. nextText: { type: String },
  35582. nextIcon: { type: iconPropType }
  35583. });
  35584. //#endregion
  35585. //#region ../../packages/components/pagination/src/components/next.vue?vue&type=script&setup=true&lang.ts
  35586. const _hoisted_1$28 = [
  35587. "disabled",
  35588. "aria-label",
  35589. "aria-disabled"
  35590. ];
  35591. const _hoisted_2$17 = { key: 0 };
  35592. var next_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35593. name: "ElPaginationNext",
  35594. __name: "next",
  35595. props: paginationNextProps,
  35596. emits: ["click"],
  35597. setup(__props) {
  35598. const props = __props;
  35599. const { t } = useLocale();
  35600. const internalDisabled = computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  35601. return (_ctx, _cache) => {
  35602. return openBlock(), createElementBlock("button", {
  35603. type: "button",
  35604. class: "btn-next",
  35605. disabled: internalDisabled.value,
  35606. "aria-label": _ctx.nextText || unref(t)("el.pagination.next"),
  35607. "aria-disabled": internalDisabled.value,
  35608. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  35609. }, [_ctx.nextText ? (openBlock(), createElementBlock("span", _hoisted_2$17, toDisplayString(_ctx.nextText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  35610. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.nextIcon)))]),
  35611. _: 1
  35612. }))], 8, _hoisted_1$28);
  35613. };
  35614. }
  35615. });
  35616. //#endregion
  35617. //#region ../../packages/components/pagination/src/components/next.vue
  35618. var next_default = next_vue_vue_type_script_setup_true_lang_default;
  35619. //#endregion
  35620. //#region ../../packages/components/pagination/src/usePagination.ts
  35621. const usePagination = () => inject(elPaginationKey, {});
  35622. //#endregion
  35623. //#region ../../packages/components/pagination/src/components/sizes.ts
  35624. const paginationSizesProps = buildProps({
  35625. pageSize: {
  35626. type: Number,
  35627. required: true
  35628. },
  35629. pageSizes: {
  35630. type: definePropType(Array),
  35631. default: () => mutable([
  35632. 10,
  35633. 20,
  35634. 30,
  35635. 40,
  35636. 50,
  35637. 100
  35638. ])
  35639. },
  35640. popperClass: { type: String },
  35641. popperStyle: { type: definePropType([String, Object]) },
  35642. disabled: Boolean,
  35643. teleported: Boolean,
  35644. size: {
  35645. type: String,
  35646. values: componentSizes
  35647. },
  35648. appendSizeTo: String
  35649. });
  35650. //#endregion
  35651. //#region ../../packages/components/pagination/src/components/sizes.vue?vue&type=script&setup=true&lang.ts
  35652. var sizes_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35653. name: "ElPaginationSizes",
  35654. __name: "sizes",
  35655. props: paginationSizesProps,
  35656. emits: ["page-size-change"],
  35657. setup(__props, { emit: __emit }) {
  35658. const props = __props;
  35659. const emit = __emit;
  35660. const { t } = useLocale();
  35661. const ns = useNamespace("pagination");
  35662. const pagination = usePagination();
  35663. const innerPageSize = ref(props.pageSize);
  35664. watch(() => props.pageSizes, (newVal, oldVal) => {
  35665. if (isEqual$1(newVal, oldVal)) return;
  35666. if (isArray$1(newVal)) emit("page-size-change", newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0]);
  35667. });
  35668. watch(() => props.pageSize, (newVal) => {
  35669. innerPageSize.value = newVal;
  35670. });
  35671. const innerPageSizes = computed(() => props.pageSizes);
  35672. function handleChange(val) {
  35673. if (val !== innerPageSize.value) {
  35674. innerPageSize.value = val;
  35675. pagination.handleSizeChange?.(Number(val));
  35676. }
  35677. }
  35678. return (_ctx, _cache) => {
  35679. return openBlock(), createElementBlock("span", { class: normalizeClass(unref(ns).e("sizes")) }, [createVNode(unref(ElSelect), {
  35680. "model-value": innerPageSize.value,
  35681. disabled: _ctx.disabled,
  35682. "popper-class": _ctx.popperClass,
  35683. "popper-style": _ctx.popperStyle,
  35684. size: _ctx.size,
  35685. teleported: _ctx.teleported,
  35686. "validate-event": false,
  35687. "append-to": _ctx.appendSizeTo,
  35688. onChange: handleChange
  35689. }, {
  35690. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(innerPageSizes.value, (item) => {
  35691. return openBlock(), createBlock(unref(ElOption), {
  35692. key: item,
  35693. value: item,
  35694. label: item + unref(t)("el.pagination.pagesize")
  35695. }, null, 8, ["value", "label"]);
  35696. }), 128))]),
  35697. _: 1
  35698. }, 8, [
  35699. "model-value",
  35700. "disabled",
  35701. "popper-class",
  35702. "popper-style",
  35703. "size",
  35704. "teleported",
  35705. "append-to"
  35706. ])], 2);
  35707. };
  35708. }
  35709. });
  35710. //#endregion
  35711. //#region ../../packages/components/pagination/src/components/sizes.vue
  35712. var sizes_default = sizes_vue_vue_type_script_setup_true_lang_default;
  35713. //#endregion
  35714. //#region ../../packages/components/pagination/src/components/jumper.ts
  35715. const paginationJumperProps = buildProps({ size: {
  35716. type: String,
  35717. values: componentSizes
  35718. } });
  35719. //#endregion
  35720. //#region ../../packages/components/pagination/src/components/jumper.vue?vue&type=script&setup=true&lang.ts
  35721. const _hoisted_1$27 = ["disabled"];
  35722. var jumper_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35723. name: "ElPaginationJumper",
  35724. __name: "jumper",
  35725. props: paginationJumperProps,
  35726. setup(__props) {
  35727. const { t } = useLocale();
  35728. const ns = useNamespace("pagination");
  35729. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  35730. const userInput = ref();
  35731. const innerValue = computed(() => userInput.value ?? currentPage?.value);
  35732. function handleInput(val) {
  35733. userInput.value = val ? +val : "";
  35734. }
  35735. function handleChange(val) {
  35736. val = Math.trunc(+val);
  35737. changeEvent?.(val);
  35738. userInput.value = void 0;
  35739. }
  35740. return (_ctx, _cache) => {
  35741. return openBlock(), createElementBlock("span", {
  35742. class: normalizeClass(unref(ns).e("jump")),
  35743. disabled: unref(disabled)
  35744. }, [
  35745. createElementVNode("span", { class: normalizeClass([unref(ns).e("goto")]) }, toDisplayString(unref(t)("el.pagination.goto")), 3),
  35746. createVNode(unref(ElInput), {
  35747. size: _ctx.size,
  35748. class: normalizeClass([unref(ns).e("editor"), unref(ns).is("in-pagination")]),
  35749. min: 1,
  35750. max: unref(pageCount),
  35751. disabled: unref(disabled),
  35752. "model-value": innerValue.value,
  35753. "validate-event": false,
  35754. "aria-label": unref(t)("el.pagination.page"),
  35755. type: "number",
  35756. "onUpdate:modelValue": handleInput,
  35757. onChange: handleChange
  35758. }, null, 8, [
  35759. "size",
  35760. "class",
  35761. "max",
  35762. "disabled",
  35763. "model-value",
  35764. "aria-label"
  35765. ]),
  35766. createElementVNode("span", { class: normalizeClass([unref(ns).e("classifier")]) }, toDisplayString(unref(t)("el.pagination.pageClassifier")), 3)
  35767. ], 10, _hoisted_1$27);
  35768. };
  35769. }
  35770. });
  35771. //#endregion
  35772. //#region ../../packages/components/pagination/src/components/jumper.vue
  35773. var jumper_default = jumper_vue_vue_type_script_setup_true_lang_default;
  35774. //#endregion
  35775. //#region ../../packages/components/pagination/src/components/total.ts
  35776. const paginationTotalProps = buildProps({ total: {
  35777. type: Number,
  35778. default: 1e3
  35779. } });
  35780. //#endregion
  35781. //#region ../../packages/components/pagination/src/components/total.vue?vue&type=script&setup=true&lang.ts
  35782. const _hoisted_1$26 = ["disabled"];
  35783. var total_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35784. name: "ElPaginationTotal",
  35785. __name: "total",
  35786. props: paginationTotalProps,
  35787. setup(__props) {
  35788. const { t } = useLocale();
  35789. const ns = useNamespace("pagination");
  35790. const { disabled } = usePagination();
  35791. return (_ctx, _cache) => {
  35792. return openBlock(), createElementBlock("span", {
  35793. class: normalizeClass(unref(ns).e("total")),
  35794. disabled: unref(disabled)
  35795. }, toDisplayString(unref(t)("el.pagination.total", { total: _ctx.total })), 11, _hoisted_1$26);
  35796. };
  35797. }
  35798. });
  35799. //#endregion
  35800. //#region ../../packages/components/pagination/src/components/total.vue
  35801. var total_default = total_vue_vue_type_script_setup_true_lang_default;
  35802. //#endregion
  35803. //#region ../../packages/components/pagination/src/components/pager.ts
  35804. const paginationPagerProps = buildProps({
  35805. currentPage: {
  35806. type: Number,
  35807. default: 1
  35808. },
  35809. pageCount: {
  35810. type: Number,
  35811. required: true
  35812. },
  35813. pagerCount: {
  35814. type: Number,
  35815. default: 7
  35816. },
  35817. disabled: Boolean
  35818. });
  35819. //#endregion
  35820. //#region ../../packages/components/pagination/src/components/pager.vue?vue&type=script&setup=true&lang.ts
  35821. const _hoisted_1$25 = [
  35822. "aria-current",
  35823. "aria-label",
  35824. "tabindex"
  35825. ];
  35826. const _hoisted_2$16 = ["tabindex", "aria-label"];
  35827. const _hoisted_3$7 = [
  35828. "aria-current",
  35829. "aria-label",
  35830. "tabindex"
  35831. ];
  35832. const _hoisted_4$5 = ["tabindex", "aria-label"];
  35833. const _hoisted_5$3 = [
  35834. "aria-current",
  35835. "aria-label",
  35836. "tabindex"
  35837. ];
  35838. var pager_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35839. name: "ElPaginationPager",
  35840. __name: "pager",
  35841. props: paginationPagerProps,
  35842. emits: [CHANGE_EVENT],
  35843. setup(__props, { emit: __emit }) {
  35844. const props = __props;
  35845. const emit = __emit;
  35846. const nsPager = useNamespace("pager");
  35847. const nsIcon = useNamespace("icon");
  35848. const { t } = useLocale();
  35849. const showPrevMore = ref(false);
  35850. const showNextMore = ref(false);
  35851. const quickPrevHover = ref(false);
  35852. const quickNextHover = ref(false);
  35853. const quickPrevFocus = ref(false);
  35854. const quickNextFocus = ref(false);
  35855. const pagers = computed(() => {
  35856. const pagerCount = props.pagerCount;
  35857. const halfPagerCount = (pagerCount - 1) / 2;
  35858. const currentPage = Number(props.currentPage);
  35859. const pageCount = Number(props.pageCount);
  35860. let showPrevMore = false;
  35861. let showNextMore = false;
  35862. if (pageCount > pagerCount) {
  35863. if (currentPage > pagerCount - halfPagerCount) showPrevMore = true;
  35864. if (currentPage < pageCount - halfPagerCount) showNextMore = true;
  35865. }
  35866. const array = [];
  35867. if (showPrevMore && !showNextMore) {
  35868. const startPage = pageCount - (pagerCount - 2);
  35869. for (let i = startPage; i < pageCount; i++) array.push(i);
  35870. } else if (!showPrevMore && showNextMore) for (let i = 2; i < pagerCount; i++) array.push(i);
  35871. else if (showPrevMore && showNextMore) {
  35872. const offset = Math.floor(pagerCount / 2) - 1;
  35873. for (let i = currentPage - offset; i <= currentPage + offset; i++) array.push(i);
  35874. } else for (let i = 2; i < pageCount; i++) array.push(i);
  35875. return array;
  35876. });
  35877. const prevMoreKls = computed(() => [
  35878. "more",
  35879. "btn-quickprev",
  35880. nsIcon.b(),
  35881. nsPager.is("disabled", props.disabled)
  35882. ]);
  35883. const nextMoreKls = computed(() => [
  35884. "more",
  35885. "btn-quicknext",
  35886. nsIcon.b(),
  35887. nsPager.is("disabled", props.disabled)
  35888. ]);
  35889. const tabindex = computed(() => props.disabled ? -1 : 0);
  35890. watch(() => [
  35891. props.pageCount,
  35892. props.pagerCount,
  35893. props.currentPage
  35894. ], ([pageCount, pagerCount, currentPage]) => {
  35895. const halfPagerCount = (pagerCount - 1) / 2;
  35896. let showPrev = false;
  35897. let showNext = false;
  35898. if (pageCount > pagerCount) {
  35899. showPrev = currentPage > pagerCount - halfPagerCount;
  35900. showNext = currentPage < pageCount - halfPagerCount;
  35901. }
  35902. quickPrevHover.value &&= showPrev;
  35903. quickNextHover.value &&= showNext;
  35904. showPrevMore.value = showPrev;
  35905. showNextMore.value = showNext;
  35906. }, { immediate: true });
  35907. function onMouseEnter(forward = false) {
  35908. if (props.disabled) return;
  35909. if (forward) quickPrevHover.value = true;
  35910. else quickNextHover.value = true;
  35911. }
  35912. function onFocus(forward = false) {
  35913. if (forward) quickPrevFocus.value = true;
  35914. else quickNextFocus.value = true;
  35915. }
  35916. function onEnter(e) {
  35917. const target = e.target;
  35918. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  35919. const newPage = Number(target.textContent);
  35920. if (newPage !== props.currentPage) emit(CHANGE_EVENT, newPage);
  35921. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) onPagerClick(e);
  35922. }
  35923. function onPagerClick(event) {
  35924. const target = event.target;
  35925. if (target.tagName.toLowerCase() === "ul" || props.disabled) return;
  35926. let newPage = Number(target.textContent);
  35927. const pageCount = props.pageCount;
  35928. const currentPage = props.currentPage;
  35929. const pagerCountOffset = props.pagerCount - 2;
  35930. if (target.className.includes("more")) {
  35931. if (target.className.includes("quickprev")) newPage = currentPage - pagerCountOffset;
  35932. else if (target.className.includes("quicknext")) newPage = currentPage + pagerCountOffset;
  35933. }
  35934. if (!Number.isNaN(+newPage)) {
  35935. if (newPage < 1) newPage = 1;
  35936. if (newPage > pageCount) newPage = pageCount;
  35937. }
  35938. if (newPage !== currentPage) emit(CHANGE_EVENT, newPage);
  35939. }
  35940. return (_ctx, _cache) => {
  35941. return openBlock(), createElementBlock("ul", {
  35942. class: normalizeClass(unref(nsPager).b()),
  35943. onClick: onPagerClick,
  35944. onKeyup: withKeys(onEnter, ["enter"])
  35945. }, [
  35946. _ctx.pageCount > 0 ? (openBlock(), createElementBlock("li", {
  35947. key: 0,
  35948. class: normalizeClass([[unref(nsPager).is("active", _ctx.currentPage === 1), unref(nsPager).is("disabled", _ctx.disabled)], "number"]),
  35949. "aria-current": _ctx.currentPage === 1,
  35950. "aria-label": unref(t)("el.pagination.currentPage", { pager: 1 }),
  35951. tabindex: tabindex.value
  35952. }, " 1 ", 10, _hoisted_1$25)) : createCommentVNode("v-if", true),
  35953. showPrevMore.value ? (openBlock(), createElementBlock("li", {
  35954. key: 1,
  35955. class: normalizeClass(prevMoreKls.value),
  35956. tabindex: tabindex.value,
  35957. "aria-label": unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  35958. onMouseenter: _cache[0] || (_cache[0] = ($event) => onMouseEnter(true)),
  35959. onMouseleave: _cache[1] || (_cache[1] = ($event) => quickPrevHover.value = false),
  35960. onFocus: _cache[2] || (_cache[2] = ($event) => onFocus(true)),
  35961. onBlur: _cache[3] || (_cache[3] = ($event) => quickPrevFocus.value = false)
  35962. }, [(quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_left_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))], 42, _hoisted_2$16)) : createCommentVNode("v-if", true),
  35963. (openBlock(true), createElementBlock(Fragment, null, renderList(pagers.value, (pager) => {
  35964. return openBlock(), createElementBlock("li", {
  35965. key: pager,
  35966. class: normalizeClass([[unref(nsPager).is("active", _ctx.currentPage === pager), unref(nsPager).is("disabled", _ctx.disabled)], "number"]),
  35967. "aria-current": _ctx.currentPage === pager,
  35968. "aria-label": unref(t)("el.pagination.currentPage", { pager }),
  35969. tabindex: tabindex.value
  35970. }, toDisplayString(pager), 11, _hoisted_3$7);
  35971. }), 128)),
  35972. showNextMore.value ? (openBlock(), createElementBlock("li", {
  35973. key: 2,
  35974. class: normalizeClass(nextMoreKls.value),
  35975. tabindex: tabindex.value,
  35976. "aria-label": unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  35977. onMouseenter: _cache[4] || (_cache[4] = ($event) => onMouseEnter()),
  35978. onMouseleave: _cache[5] || (_cache[5] = ($event) => quickNextHover.value = false),
  35979. onFocus: _cache[6] || (_cache[6] = ($event) => onFocus()),
  35980. onBlur: _cache[7] || (_cache[7] = ($event) => quickNextFocus.value = false)
  35981. }, [(quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_right_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))], 42, _hoisted_4$5)) : createCommentVNode("v-if", true),
  35982. _ctx.pageCount > 1 ? (openBlock(), createElementBlock("li", {
  35983. key: 3,
  35984. class: normalizeClass([[unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount), unref(nsPager).is("disabled", _ctx.disabled)], "number"]),
  35985. "aria-current": _ctx.currentPage === _ctx.pageCount,
  35986. "aria-label": unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  35987. tabindex: tabindex.value
  35988. }, toDisplayString(_ctx.pageCount), 11, _hoisted_5$3)) : createCommentVNode("v-if", true)
  35989. ], 34);
  35990. };
  35991. }
  35992. });
  35993. //#endregion
  35994. //#region ../../packages/components/pagination/src/components/pager.vue
  35995. var pager_default = pager_vue_vue_type_script_setup_true_lang_default;
  35996. //#endregion
  35997. //#region ../../packages/components/pagination/src/pagination.ts
  35998. /**
  35999. * It it user's responsibility to guarantee that the value of props.total... is number
  36000. * (same as pageSize, defaultPageSize, currentPage, defaultCurrentPage, pageCount)
  36001. * Otherwise we can reasonable infer that the corresponding field is absent
  36002. */
  36003. const isAbsent = (v) => typeof v !== "number";
  36004. const paginationProps = buildProps({
  36005. pageSize: Number,
  36006. defaultPageSize: Number,
  36007. total: Number,
  36008. pageCount: Number,
  36009. pagerCount: {
  36010. type: Number,
  36011. validator: (value) => {
  36012. return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  36013. },
  36014. default: 7
  36015. },
  36016. currentPage: Number,
  36017. defaultCurrentPage: Number,
  36018. layout: {
  36019. type: String,
  36020. default: [
  36021. "prev",
  36022. "pager",
  36023. "next",
  36024. "jumper",
  36025. "->",
  36026. "total"
  36027. ].join(", ")
  36028. },
  36029. pageSizes: {
  36030. type: definePropType(Array),
  36031. default: () => mutable([
  36032. 10,
  36033. 20,
  36034. 30,
  36035. 40,
  36036. 50,
  36037. 100
  36038. ])
  36039. },
  36040. popperClass: {
  36041. type: String,
  36042. default: ""
  36043. },
  36044. popperStyle: { type: definePropType([String, Object]) },
  36045. prevText: {
  36046. type: String,
  36047. default: ""
  36048. },
  36049. prevIcon: {
  36050. type: iconPropType,
  36051. default: () => arrow_left_default
  36052. },
  36053. nextText: {
  36054. type: String,
  36055. default: ""
  36056. },
  36057. nextIcon: {
  36058. type: iconPropType,
  36059. default: () => arrow_right_default
  36060. },
  36061. teleported: {
  36062. type: Boolean,
  36063. default: true
  36064. },
  36065. small: Boolean,
  36066. size: useSizeProp,
  36067. background: Boolean,
  36068. disabled: Boolean,
  36069. hideOnSinglePage: Boolean,
  36070. appendSizeTo: String
  36071. });
  36072. const paginationEmits = {
  36073. "update:current-page": (val) => isNumber(val),
  36074. "update:page-size": (val) => isNumber(val),
  36075. "size-change": (val) => isNumber(val),
  36076. change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
  36077. "current-change": (val) => isNumber(val),
  36078. "prev-click": (val) => isNumber(val),
  36079. "next-click": (val) => isNumber(val)
  36080. };
  36081. const componentName = "ElPagination";
  36082. var pagination_default = defineComponent({
  36083. name: componentName,
  36084. props: paginationProps,
  36085. emits: paginationEmits,
  36086. setup(props, { emit, slots }) {
  36087. const { t } = useLocale();
  36088. const ns = useNamespace("pagination");
  36089. const vnodeProps = getCurrentInstance().vnode.props || {};
  36090. const _globalSize = useGlobalSize();
  36091. const _size = computed(() => props.small ? "small" : props.size ?? _globalSize.value);
  36092. useDeprecated({
  36093. from: "small",
  36094. replacement: "size",
  36095. version: "3.0.0",
  36096. scope: "el-pagination",
  36097. ref: "https://element-plus.org/zh-CN/component/pagination.html"
  36098. }, computed(() => !!props.small));
  36099. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  36100. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  36101. const assertValidUsage = computed(() => {
  36102. if (isAbsent(props.total) && isAbsent(props.pageCount)) return false;
  36103. if (!isAbsent(props.currentPage) && !hasCurrentPageListener) return false;
  36104. if (props.layout.includes("sizes")) {
  36105. if (!isAbsent(props.pageCount)) {
  36106. if (!hasPageSizeListener) return false;
  36107. } else if (!isAbsent(props.total)) {
  36108. if (!isAbsent(props.pageSize)) {
  36109. if (!hasPageSizeListener) return false;
  36110. }
  36111. }
  36112. }
  36113. return true;
  36114. });
  36115. const innerPageSize = ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  36116. const innerCurrentPage = ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  36117. const pageSizeBridge = computed({
  36118. get() {
  36119. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  36120. },
  36121. set(v) {
  36122. if (isAbsent(props.pageSize)) innerPageSize.value = v;
  36123. if (hasPageSizeListener) {
  36124. emit("update:page-size", v);
  36125. emit("size-change", v);
  36126. }
  36127. }
  36128. });
  36129. const pageCountBridge = computed(() => {
  36130. let pageCount = 0;
  36131. if (!isAbsent(props.pageCount)) pageCount = props.pageCount;
  36132. else if (!isAbsent(props.total)) pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  36133. return pageCount;
  36134. });
  36135. const currentPageBridge = computed({
  36136. get() {
  36137. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  36138. },
  36139. set(v) {
  36140. let newCurrentPage = v;
  36141. if (v < 1) newCurrentPage = 1;
  36142. else if (v > pageCountBridge.value) newCurrentPage = pageCountBridge.value;
  36143. if (isAbsent(props.currentPage)) innerCurrentPage.value = newCurrentPage;
  36144. if (hasCurrentPageListener) {
  36145. emit("update:current-page", newCurrentPage);
  36146. emit("current-change", newCurrentPage);
  36147. }
  36148. }
  36149. });
  36150. watch(pageCountBridge, (val) => {
  36151. if (currentPageBridge.value > val) currentPageBridge.value = val;
  36152. });
  36153. watch([currentPageBridge, pageSizeBridge], (value) => {
  36154. emit(CHANGE_EVENT, ...value);
  36155. }, { flush: "post" });
  36156. function handleCurrentChange(val) {
  36157. currentPageBridge.value = val;
  36158. }
  36159. function handleSizeChange(val) {
  36160. pageSizeBridge.value = val;
  36161. const newPageCount = pageCountBridge.value;
  36162. if (currentPageBridge.value > newPageCount) currentPageBridge.value = newPageCount;
  36163. }
  36164. function prev() {
  36165. if (props.disabled) return;
  36166. currentPageBridge.value -= 1;
  36167. emit("prev-click", currentPageBridge.value);
  36168. }
  36169. function next() {
  36170. if (props.disabled) return;
  36171. currentPageBridge.value += 1;
  36172. emit("next-click", currentPageBridge.value);
  36173. }
  36174. function addClass(element, cls) {
  36175. if (element) {
  36176. if (!element.props) element.props = {};
  36177. element.props.class = [element.props.class, cls].join(" ");
  36178. }
  36179. }
  36180. provide(elPaginationKey, {
  36181. pageCount: pageCountBridge,
  36182. disabled: computed(() => props.disabled),
  36183. currentPage: currentPageBridge,
  36184. changeEvent: handleCurrentChange,
  36185. handleSizeChange
  36186. });
  36187. return () => {
  36188. if (!assertValidUsage.value) {
  36189. /* @__PURE__ */ debugWarn(componentName, t("el.pagination.deprecationWarning"));
  36190. return null;
  36191. }
  36192. if (!props.layout) return null;
  36193. if (props.hideOnSinglePage && pageCountBridge.value <= 1) return null;
  36194. const rootChildren = [];
  36195. const rightWrapperChildren = [];
  36196. const rightWrapperRoot = h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  36197. const TEMPLATE_MAP = {
  36198. prev: h(prev_default, {
  36199. disabled: props.disabled,
  36200. currentPage: currentPageBridge.value,
  36201. prevText: props.prevText,
  36202. prevIcon: props.prevIcon,
  36203. onClick: prev
  36204. }),
  36205. jumper: h(jumper_default, { size: _size.value }),
  36206. pager: h(pager_default, {
  36207. currentPage: currentPageBridge.value,
  36208. pageCount: pageCountBridge.value,
  36209. pagerCount: props.pagerCount,
  36210. onChange: handleCurrentChange,
  36211. disabled: props.disabled
  36212. }),
  36213. next: h(next_default, {
  36214. disabled: props.disabled,
  36215. currentPage: currentPageBridge.value,
  36216. pageCount: pageCountBridge.value,
  36217. nextText: props.nextText,
  36218. nextIcon: props.nextIcon,
  36219. onClick: next
  36220. }),
  36221. sizes: h(sizes_default, {
  36222. pageSize: pageSizeBridge.value,
  36223. pageSizes: props.pageSizes,
  36224. popperClass: props.popperClass,
  36225. popperStyle: props.popperStyle,
  36226. disabled: props.disabled,
  36227. teleported: props.teleported,
  36228. size: _size.value,
  36229. appendSizeTo: props.appendSizeTo
  36230. }),
  36231. slot: slots?.default?.() ?? null,
  36232. total: h(total_default, { total: isAbsent(props.total) ? 0 : props.total })
  36233. };
  36234. const components = props.layout.split(",").map((item) => item.trim());
  36235. let haveRightWrapper = false;
  36236. components.forEach((c) => {
  36237. if (c === "->") {
  36238. haveRightWrapper = true;
  36239. return;
  36240. }
  36241. if (!haveRightWrapper) rootChildren.push(TEMPLATE_MAP[c]);
  36242. else rightWrapperChildren.push(TEMPLATE_MAP[c]);
  36243. });
  36244. addClass(rootChildren[0], ns.is("first"));
  36245. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  36246. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  36247. addClass(rightWrapperChildren[0], ns.is("first"));
  36248. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  36249. rootChildren.push(rightWrapperRoot);
  36250. }
  36251. return h("div", { class: [
  36252. ns.b(),
  36253. ns.is("background", props.background),
  36254. ns.m(_size.value)
  36255. ] }, rootChildren);
  36256. };
  36257. }
  36258. });
  36259. //#endregion
  36260. //#region ../../packages/components/pagination/index.ts
  36261. const ElPagination = withInstall(pagination_default);
  36262. //#endregion
  36263. //#region ../../packages/components/popconfirm/src/popconfirm.ts
  36264. /**
  36265. * @deprecated Removed after 3.0.0, Use `PopconfirmProps` instead.
  36266. */
  36267. const popconfirmProps = buildProps({
  36268. title: String,
  36269. confirmButtonText: String,
  36270. cancelButtonText: String,
  36271. confirmButtonType: {
  36272. type: String,
  36273. values: buttonTypes,
  36274. default: "primary"
  36275. },
  36276. cancelButtonType: {
  36277. type: String,
  36278. values: buttonTypes,
  36279. default: "text"
  36280. },
  36281. icon: {
  36282. type: iconPropType,
  36283. default: () => question_filled_default
  36284. },
  36285. iconColor: {
  36286. type: String,
  36287. default: "#f90"
  36288. },
  36289. hideIcon: Boolean,
  36290. hideAfter: {
  36291. type: Number,
  36292. default: 200
  36293. },
  36294. effect: {
  36295. ...useTooltipContentProps.effect,
  36296. default: "light"
  36297. },
  36298. teleported: useTooltipContentProps.teleported,
  36299. persistent: useTooltipContentProps.persistent,
  36300. width: {
  36301. type: [String, Number],
  36302. default: 150
  36303. },
  36304. virtualTriggering: useTooltipTriggerProps.virtualTriggering,
  36305. virtualRef: useTooltipTriggerProps.virtualRef
  36306. });
  36307. const popconfirmEmits = {
  36308. confirm: (e) => e instanceof MouseEvent,
  36309. cancel: (e) => e instanceof MouseEvent
  36310. };
  36311. //#endregion
  36312. //#region ../../packages/components/popconfirm/src/popconfirm.vue?vue&type=script&setup=true&lang.ts
  36313. var popconfirm_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  36314. name: "ElPopconfirm",
  36315. __name: "popconfirm",
  36316. props: popconfirmProps,
  36317. emits: popconfirmEmits,
  36318. setup(__props, { expose: __expose, emit: __emit }) {
  36319. const props = __props;
  36320. const emit = __emit;
  36321. const { t } = useLocale();
  36322. const ns = useNamespace("popconfirm");
  36323. const tooltipRef = ref();
  36324. const rootRef = ref();
  36325. const popperRef = computed(() => {
  36326. return unref(tooltipRef)?.popperRef;
  36327. });
  36328. const showPopper = () => {
  36329. rootRef.value?.focus?.();
  36330. };
  36331. const hidePopper = () => {
  36332. tooltipRef.value?.onClose?.();
  36333. };
  36334. const style = computed(() => {
  36335. return { width: addUnit(props.width) };
  36336. });
  36337. const confirm = (e) => {
  36338. emit("confirm", e);
  36339. hidePopper();
  36340. };
  36341. const cancel = (e) => {
  36342. emit("cancel", e);
  36343. hidePopper();
  36344. };
  36345. const finalConfirmButtonText = computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  36346. const finalCancelButtonText = computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  36347. __expose({
  36348. popperRef,
  36349. hide: hidePopper
  36350. });
  36351. return (_ctx, _cache) => {
  36352. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  36353. ref_key: "tooltipRef",
  36354. ref: tooltipRef,
  36355. trigger: "click",
  36356. effect: __props.effect
  36357. }, _ctx.$attrs, {
  36358. "virtual-triggering": __props.virtualTriggering,
  36359. "virtual-ref": __props.virtualRef,
  36360. "popper-class": `${unref(ns).namespace.value}-popover`,
  36361. "popper-style": style.value,
  36362. teleported: __props.teleported,
  36363. "fallback-placements": [
  36364. "bottom",
  36365. "top",
  36366. "right",
  36367. "left"
  36368. ],
  36369. "hide-after": __props.hideAfter,
  36370. persistent: __props.persistent,
  36371. loop: "",
  36372. onShow: showPopper
  36373. }), {
  36374. content: withCtx(() => [createElementVNode("div", {
  36375. ref_key: "rootRef",
  36376. ref: rootRef,
  36377. tabindex: "-1",
  36378. class: normalizeClass(unref(ns).b())
  36379. }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("main")) }, [!__props.hideIcon && __props.icon ? (openBlock(), createBlock(unref(ElIcon), {
  36380. key: 0,
  36381. class: normalizeClass(unref(ns).e("icon")),
  36382. style: normalizeStyle({ color: __props.iconColor })
  36383. }, {
  36384. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  36385. _: 1
  36386. }, 8, ["class", "style"])) : createCommentVNode("v-if", true), createTextVNode(" " + toDisplayString(__props.title), 1)], 2), createElementVNode("div", { class: normalizeClass(unref(ns).e("action")) }, [renderSlot(_ctx.$slots, "actions", {
  36387. confirm,
  36388. cancel
  36389. }, () => [createVNode(unref(ElButton), {
  36390. size: "small",
  36391. type: __props.cancelButtonType === "text" ? "" : __props.cancelButtonType,
  36392. text: __props.cancelButtonType === "text",
  36393. onClick: cancel
  36394. }, {
  36395. default: withCtx(() => [createTextVNode(toDisplayString(finalCancelButtonText.value), 1)]),
  36396. _: 1
  36397. }, 8, ["type", "text"]), createVNode(unref(ElButton), {
  36398. size: "small",
  36399. type: __props.confirmButtonType === "text" ? "" : __props.confirmButtonType,
  36400. text: __props.confirmButtonType === "text",
  36401. onClick: confirm
  36402. }, {
  36403. default: withCtx(() => [createTextVNode(toDisplayString(finalConfirmButtonText.value), 1)]),
  36404. _: 1
  36405. }, 8, ["type", "text"])])], 2)], 2)]),
  36406. default: withCtx(() => [_ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)]),
  36407. _: 3
  36408. }, 16, [
  36409. "effect",
  36410. "virtual-triggering",
  36411. "virtual-ref",
  36412. "popper-class",
  36413. "popper-style",
  36414. "teleported",
  36415. "hide-after",
  36416. "persistent"
  36417. ]);
  36418. };
  36419. }
  36420. });
  36421. //#endregion
  36422. //#region ../../packages/components/popconfirm/src/popconfirm.vue
  36423. var popconfirm_default = popconfirm_vue_vue_type_script_setup_true_lang_default;
  36424. //#endregion
  36425. //#region ../../packages/components/popconfirm/index.ts
  36426. const ElPopconfirm = withInstall(popconfirm_default);
  36427. //#endregion
  36428. //#region ../../packages/components/popover/src/popover.ts
  36429. /**
  36430. * @deprecated Removed after 3.0.0, Use `PopoverProps` instead.
  36431. */
  36432. const popoverProps = buildProps({
  36433. trigger: useTooltipTriggerProps.trigger,
  36434. triggerKeys: useTooltipTriggerProps.triggerKeys,
  36435. placement: dropdownProps.placement,
  36436. disabled: useTooltipTriggerProps.disabled,
  36437. visible: useTooltipContentProps.visible,
  36438. transition: useTooltipContentProps.transition,
  36439. popperOptions: dropdownProps.popperOptions,
  36440. tabindex: dropdownProps.tabindex,
  36441. content: useTooltipContentProps.content,
  36442. popperStyle: useTooltipContentProps.popperStyle,
  36443. popperClass: useTooltipContentProps.popperClass,
  36444. enterable: {
  36445. ...useTooltipContentProps.enterable,
  36446. default: true
  36447. },
  36448. effect: {
  36449. ...useTooltipContentProps.effect,
  36450. default: "light"
  36451. },
  36452. teleported: useTooltipContentProps.teleported,
  36453. appendTo: useTooltipContentProps.appendTo,
  36454. title: String,
  36455. width: {
  36456. type: [String, Number],
  36457. default: 150
  36458. },
  36459. offset: {
  36460. type: Number,
  36461. default: void 0
  36462. },
  36463. showAfter: {
  36464. type: Number,
  36465. default: 0
  36466. },
  36467. hideAfter: {
  36468. type: Number,
  36469. default: 200
  36470. },
  36471. autoClose: {
  36472. type: Number,
  36473. default: 0
  36474. },
  36475. showArrow: {
  36476. type: Boolean,
  36477. default: true
  36478. },
  36479. persistent: {
  36480. type: Boolean,
  36481. default: true
  36482. },
  36483. "onUpdate:visible": { type: Function }
  36484. });
  36485. const popoverEmits = {
  36486. "update:visible": (value) => isBoolean(value),
  36487. "before-enter": () => true,
  36488. "before-leave": () => true,
  36489. "after-enter": () => true,
  36490. "after-leave": () => true
  36491. };
  36492. /**
  36493. * @description default values for PopoverProps
  36494. */
  36495. const popoverPropsDefaults = {
  36496. trigger: "hover",
  36497. triggerKeys: () => [
  36498. EVENT_CODE.enter,
  36499. EVENT_CODE.numpadEnter,
  36500. EVENT_CODE.space
  36501. ],
  36502. placement: "bottom",
  36503. visible: null,
  36504. popperOptions: () => ({}),
  36505. tabindex: 0,
  36506. content: "",
  36507. popperStyle: void 0,
  36508. enterable: true,
  36509. effect: "light",
  36510. teleported: true,
  36511. width: 150,
  36512. offset: void 0,
  36513. showAfter: 0,
  36514. hideAfter: 200,
  36515. autoClose: 0,
  36516. showArrow: true,
  36517. persistent: true
  36518. };
  36519. //#endregion
  36520. //#region ../../packages/components/popover/src/popover.vue?vue&type=script&setup=true&lang.ts
  36521. const updateEventKeyRaw = `onUpdate:visible`;
  36522. var popover_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  36523. name: "ElPopover",
  36524. __name: "popover",
  36525. props: popoverProps,
  36526. emits: popoverEmits,
  36527. setup(__props, { expose: __expose, emit: __emit }) {
  36528. const props = __props;
  36529. const emit = __emit;
  36530. const onUpdateVisible = computed(() => {
  36531. return props[updateEventKeyRaw];
  36532. });
  36533. const ns = useNamespace("popover");
  36534. const tooltipRef = ref();
  36535. const popperRef = computed(() => {
  36536. return unref(tooltipRef)?.popperRef;
  36537. });
  36538. const style = computed(() => {
  36539. return [{ width: addUnit(props.width) }, props.popperStyle];
  36540. });
  36541. const kls = computed(() => {
  36542. return [
  36543. ns.b(),
  36544. props.popperClass,
  36545. { [ns.m("plain")]: !!props.content }
  36546. ];
  36547. });
  36548. const gpuAcceleration = computed(() => {
  36549. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  36550. });
  36551. const hide = () => {
  36552. tooltipRef.value?.hide();
  36553. };
  36554. const beforeEnter = () => {
  36555. emit("before-enter");
  36556. };
  36557. const beforeLeave = () => {
  36558. emit("before-leave");
  36559. };
  36560. const afterEnter = () => {
  36561. emit("after-enter");
  36562. };
  36563. const afterLeave = () => {
  36564. emit("update:visible", false);
  36565. emit("after-leave");
  36566. };
  36567. __expose({
  36568. popperRef,
  36569. hide
  36570. });
  36571. return (_ctx, _cache) => {
  36572. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  36573. ref_key: "tooltipRef",
  36574. ref: tooltipRef
  36575. }, _ctx.$attrs, {
  36576. trigger: __props.trigger,
  36577. "trigger-keys": __props.triggerKeys,
  36578. placement: __props.placement,
  36579. disabled: __props.disabled,
  36580. visible: __props.visible,
  36581. transition: __props.transition,
  36582. "popper-options": __props.popperOptions,
  36583. tabindex: __props.tabindex,
  36584. content: __props.content,
  36585. offset: __props.offset,
  36586. "show-after": __props.showAfter,
  36587. "hide-after": __props.hideAfter,
  36588. "auto-close": __props.autoClose,
  36589. "show-arrow": __props.showArrow,
  36590. "aria-label": __props.title,
  36591. effect: __props.effect,
  36592. enterable: __props.enterable,
  36593. "popper-class": kls.value,
  36594. "popper-style": style.value,
  36595. teleported: __props.teleported,
  36596. "append-to": __props.appendTo,
  36597. persistent: __props.persistent,
  36598. "gpu-acceleration": gpuAcceleration.value,
  36599. "onUpdate:visible": onUpdateVisible.value,
  36600. onBeforeShow: beforeEnter,
  36601. onBeforeHide: beforeLeave,
  36602. onShow: afterEnter,
  36603. onHide: afterLeave
  36604. }), {
  36605. content: withCtx(() => [__props.title ? (openBlock(), createElementBlock("div", {
  36606. key: 0,
  36607. class: normalizeClass(unref(ns).e("title")),
  36608. role: "title"
  36609. }, toDisplayString(__props.title), 3)) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", { hide }, () => [createTextVNode(toDisplayString(__props.content), 1)])]),
  36610. default: withCtx(() => [_ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)]),
  36611. _: 3
  36612. }, 16, [
  36613. "trigger",
  36614. "trigger-keys",
  36615. "placement",
  36616. "disabled",
  36617. "visible",
  36618. "transition",
  36619. "popper-options",
  36620. "tabindex",
  36621. "content",
  36622. "offset",
  36623. "show-after",
  36624. "hide-after",
  36625. "auto-close",
  36626. "show-arrow",
  36627. "aria-label",
  36628. "effect",
  36629. "enterable",
  36630. "popper-class",
  36631. "popper-style",
  36632. "teleported",
  36633. "append-to",
  36634. "persistent",
  36635. "gpu-acceleration",
  36636. "onUpdate:visible"
  36637. ]);
  36638. };
  36639. }
  36640. });
  36641. //#endregion
  36642. //#region ../../packages/components/popover/src/popover.vue
  36643. var popover_default = popover_vue_vue_type_script_setup_true_lang_default;
  36644. //#endregion
  36645. //#region ../../packages/components/popover/src/directive.ts
  36646. const attachEvents = (el, binding) => {
  36647. const popover = (binding.arg || binding.value)?.popperRef;
  36648. if (popover) popover.triggerRef = el;
  36649. };
  36650. var directive_default = {
  36651. mounted(el, binding) {
  36652. attachEvents(el, binding);
  36653. },
  36654. updated(el, binding) {
  36655. attachEvents(el, binding);
  36656. }
  36657. };
  36658. const VPopover = "popover";
  36659. //#endregion
  36660. //#region ../../packages/components/popover/index.ts
  36661. const ElPopoverDirective = withInstallDirective(directive_default, VPopover);
  36662. const ElPopover = withInstall(popover_default, { directive: ElPopoverDirective });
  36663. //#endregion
  36664. //#region ../../packages/components/progress/src/progress.ts
  36665. /**
  36666. * @deprecated Removed after 3.0.0, Use `ProgressProps` instead.
  36667. */
  36668. const progressProps = buildProps({
  36669. type: {
  36670. type: String,
  36671. default: "line",
  36672. values: [
  36673. "line",
  36674. "circle",
  36675. "dashboard"
  36676. ]
  36677. },
  36678. percentage: {
  36679. type: Number,
  36680. default: 0,
  36681. validator: (val) => val >= 0 && val <= 100
  36682. },
  36683. status: {
  36684. type: String,
  36685. default: "",
  36686. values: [
  36687. "",
  36688. "success",
  36689. "exception",
  36690. "warning"
  36691. ]
  36692. },
  36693. indeterminate: Boolean,
  36694. duration: {
  36695. type: Number,
  36696. default: 3
  36697. },
  36698. strokeWidth: {
  36699. type: Number,
  36700. default: 6
  36701. },
  36702. strokeLinecap: {
  36703. type: definePropType(String),
  36704. default: "round"
  36705. },
  36706. textInside: Boolean,
  36707. width: {
  36708. type: Number,
  36709. default: 126
  36710. },
  36711. showText: {
  36712. type: Boolean,
  36713. default: true
  36714. },
  36715. color: {
  36716. type: definePropType([
  36717. String,
  36718. Array,
  36719. Function
  36720. ]),
  36721. default: ""
  36722. },
  36723. striped: Boolean,
  36724. stripedFlow: Boolean,
  36725. format: {
  36726. type: definePropType(Function),
  36727. default: (percentage) => `${percentage}%`
  36728. }
  36729. });
  36730. //#endregion
  36731. //#region ../../packages/components/progress/src/progress.vue?vue&type=script&setup=true&lang.ts
  36732. const _hoisted_1$24 = ["aria-valuenow"];
  36733. const _hoisted_2$15 = { viewBox: "0 0 100 100" };
  36734. const _hoisted_3$6 = [
  36735. "d",
  36736. "stroke",
  36737. "stroke-linecap",
  36738. "stroke-width"
  36739. ];
  36740. const _hoisted_4$4 = [
  36741. "d",
  36742. "stroke",
  36743. "opacity",
  36744. "stroke-linecap",
  36745. "stroke-width"
  36746. ];
  36747. const _hoisted_5$2 = { key: 0 };
  36748. var progress_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  36749. name: "ElProgress",
  36750. __name: "progress",
  36751. props: progressProps,
  36752. setup(__props) {
  36753. const STATUS_COLOR_MAP = {
  36754. success: "#13ce66",
  36755. exception: "#ff4949",
  36756. warning: "#e6a23c",
  36757. default: "#20a0ff"
  36758. };
  36759. const props = __props;
  36760. const ns = useNamespace("progress");
  36761. const barStyle = computed(() => {
  36762. const barStyle = {
  36763. width: `${props.percentage}%`,
  36764. animationDuration: `${props.duration}s`
  36765. };
  36766. const color = getCurrentColor(props.percentage);
  36767. if (color.includes("gradient")) barStyle.background = color;
  36768. else barStyle.backgroundColor = color;
  36769. return barStyle;
  36770. });
  36771. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  36772. const radius = computed(() => {
  36773. if (["circle", "dashboard"].includes(props.type)) return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  36774. return 0;
  36775. });
  36776. const trackPath = computed(() => {
  36777. const r = radius.value;
  36778. const isDashboard = props.type === "dashboard";
  36779. return `
  36780. M 50 50
  36781. m 0 ${isDashboard ? "" : "-"}${r}
  36782. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  36783. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  36784. `;
  36785. });
  36786. const perimeter = computed(() => 2 * Math.PI * radius.value);
  36787. const rate = computed(() => props.type === "dashboard" ? .75 : 1);
  36788. const strokeDashoffset = computed(() => {
  36789. return `${-1 * perimeter.value * (1 - rate.value) / 2}px`;
  36790. });
  36791. const trailPathStyle = computed(() => ({
  36792. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  36793. strokeDashoffset: strokeDashoffset.value
  36794. }));
  36795. const circlePathStyle = computed(() => ({
  36796. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  36797. strokeDashoffset: strokeDashoffset.value,
  36798. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  36799. }));
  36800. const stroke = computed(() => {
  36801. let ret;
  36802. if (props.color) ret = getCurrentColor(props.percentage);
  36803. else ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  36804. return ret;
  36805. });
  36806. const statusIcon = computed(() => {
  36807. if (props.status === "warning") return warning_filled_default;
  36808. if (props.type === "line") return props.status === "success" ? circle_check_default : circle_close_default;
  36809. else return props.status === "success" ? check_default : close_default;
  36810. });
  36811. const progressTextSize = computed(() => {
  36812. return props.type === "line" ? 12 + props.strokeWidth * .4 : props.width * .111111 + 2;
  36813. });
  36814. const content = computed(() => props.format(props.percentage));
  36815. function getColors(color) {
  36816. const span = 100 / color.length;
  36817. return color.map((seriesColor, index) => {
  36818. if (isString(seriesColor)) return {
  36819. color: seriesColor,
  36820. percentage: (index + 1) * span
  36821. };
  36822. return seriesColor;
  36823. }).sort((a, b) => a.percentage - b.percentage);
  36824. }
  36825. const getCurrentColor = (percentage) => {
  36826. const { color } = props;
  36827. if (isFunction$1(color)) return color(percentage);
  36828. else if (isString(color)) return color;
  36829. else {
  36830. const colors = getColors(color);
  36831. for (const color of colors) if (color.percentage > percentage) return color.color;
  36832. return colors[colors.length - 1]?.color;
  36833. }
  36834. };
  36835. return (_ctx, _cache) => {
  36836. return openBlock(), createElementBlock("div", {
  36837. class: normalizeClass([
  36838. unref(ns).b(),
  36839. unref(ns).m(__props.type),
  36840. unref(ns).is(__props.status),
  36841. {
  36842. [unref(ns).m("without-text")]: !__props.showText,
  36843. [unref(ns).m("text-inside")]: __props.textInside
  36844. }
  36845. ]),
  36846. role: "progressbar",
  36847. "aria-valuenow": __props.percentage,
  36848. "aria-valuemin": "0",
  36849. "aria-valuemax": "100"
  36850. }, [__props.type === "line" ? (openBlock(), createElementBlock("div", {
  36851. key: 0,
  36852. class: normalizeClass(unref(ns).b("bar"))
  36853. }, [createElementVNode("div", {
  36854. class: normalizeClass(unref(ns).be("bar", "outer")),
  36855. style: normalizeStyle({ height: `${__props.strokeWidth}px` })
  36856. }, [createElementVNode("div", {
  36857. class: normalizeClass([
  36858. unref(ns).be("bar", "inner"),
  36859. { [unref(ns).bem("bar", "inner", "indeterminate")]: __props.indeterminate },
  36860. { [unref(ns).bem("bar", "inner", "striped")]: __props.striped },
  36861. { [unref(ns).bem("bar", "inner", "striped-flow")]: __props.stripedFlow }
  36862. ]),
  36863. style: normalizeStyle(barStyle.value)
  36864. }, [(__props.showText || _ctx.$slots.default) && __props.textInside ? (openBlock(), createElementBlock("div", {
  36865. key: 0,
  36866. class: normalizeClass(unref(ns).be("bar", "innerText"))
  36867. }, [renderSlot(_ctx.$slots, "default", { percentage: __props.percentage }, () => [createElementVNode("span", null, toDisplayString(content.value), 1)])], 2)) : createCommentVNode("v-if", true)], 6)], 6)], 2)) : (openBlock(), createElementBlock("div", {
  36868. key: 1,
  36869. class: normalizeClass(unref(ns).b("circle")),
  36870. style: normalizeStyle({
  36871. height: `${__props.width}px`,
  36872. width: `${__props.width}px`
  36873. })
  36874. }, [(openBlock(), createElementBlock("svg", _hoisted_2$15, [createElementVNode("path", {
  36875. class: normalizeClass(unref(ns).be("circle", "track")),
  36876. d: trackPath.value,
  36877. stroke: `var(${unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  36878. "stroke-linecap": __props.strokeLinecap,
  36879. "stroke-width": relativeStrokeWidth.value,
  36880. fill: "none",
  36881. style: normalizeStyle(trailPathStyle.value)
  36882. }, null, 14, _hoisted_3$6), createElementVNode("path", {
  36883. class: normalizeClass(unref(ns).be("circle", "path")),
  36884. d: trackPath.value,
  36885. stroke: stroke.value,
  36886. fill: "none",
  36887. opacity: __props.percentage ? 1 : 0,
  36888. "stroke-linecap": __props.strokeLinecap,
  36889. "stroke-width": relativeStrokeWidth.value,
  36890. style: normalizeStyle(circlePathStyle.value)
  36891. }, null, 14, _hoisted_4$4)]))], 6)), (__props.showText || _ctx.$slots.default) && !__props.textInside ? (openBlock(), createElementBlock("div", {
  36892. key: 2,
  36893. class: normalizeClass(unref(ns).e("text")),
  36894. style: normalizeStyle({ fontSize: `${progressTextSize.value}px` })
  36895. }, [renderSlot(_ctx.$slots, "default", { percentage: __props.percentage }, () => [!__props.status ? (openBlock(), createElementBlock("span", _hoisted_5$2, toDisplayString(content.value), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  36896. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(statusIcon.value)))]),
  36897. _: 1
  36898. }))])], 6)) : createCommentVNode("v-if", true)], 10, _hoisted_1$24);
  36899. };
  36900. }
  36901. });
  36902. //#endregion
  36903. //#region ../../packages/components/progress/src/progress.vue
  36904. var progress_default = progress_vue_vue_type_script_setup_true_lang_default;
  36905. //#endregion
  36906. //#region ../../packages/components/progress/index.ts
  36907. const ElProgress = withInstall(progress_default);
  36908. //#endregion
  36909. //#region ../../packages/components/rate/src/rate.ts
  36910. /**
  36911. * @deprecated Removed after 3.0.0, Use `RateProps` instead.
  36912. */
  36913. const rateProps = buildProps({
  36914. modelValue: {
  36915. type: Number,
  36916. default: 0
  36917. },
  36918. id: {
  36919. type: String,
  36920. default: void 0
  36921. },
  36922. lowThreshold: {
  36923. type: Number,
  36924. default: 2
  36925. },
  36926. highThreshold: {
  36927. type: Number,
  36928. default: 4
  36929. },
  36930. max: {
  36931. type: Number,
  36932. default: 5
  36933. },
  36934. colors: {
  36935. type: definePropType([Array, Object]),
  36936. default: () => mutable([
  36937. "",
  36938. "",
  36939. ""
  36940. ])
  36941. },
  36942. voidColor: {
  36943. type: String,
  36944. default: ""
  36945. },
  36946. disabledVoidColor: {
  36947. type: String,
  36948. default: ""
  36949. },
  36950. icons: {
  36951. type: definePropType([Array, Object]),
  36952. default: () => [
  36953. star_filled_default,
  36954. star_filled_default,
  36955. star_filled_default
  36956. ]
  36957. },
  36958. voidIcon: {
  36959. type: iconPropType,
  36960. default: () => star_default
  36961. },
  36962. disabledVoidIcon: {
  36963. type: iconPropType,
  36964. default: () => star_filled_default
  36965. },
  36966. disabled: {
  36967. type: Boolean,
  36968. default: void 0
  36969. },
  36970. allowHalf: Boolean,
  36971. showText: Boolean,
  36972. showScore: Boolean,
  36973. textColor: {
  36974. type: String,
  36975. default: ""
  36976. },
  36977. texts: {
  36978. type: definePropType(Array),
  36979. default: () => mutable([
  36980. "Extremely bad",
  36981. "Disappointed",
  36982. "Fair",
  36983. "Satisfied",
  36984. "Surprise"
  36985. ])
  36986. },
  36987. scoreTemplate: {
  36988. type: String,
  36989. default: "{value}"
  36990. },
  36991. size: useSizeProp,
  36992. clearable: Boolean,
  36993. ...useAriaProps(["ariaLabel"])
  36994. });
  36995. const rateEmits = {
  36996. [CHANGE_EVENT]: (value) => isNumber(value),
  36997. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  36998. };
  36999. //#endregion
  37000. //#region ../../packages/components/rate/src/rate.vue?vue&type=script&setup=true&lang.ts
  37001. const _hoisted_1$23 = [
  37002. "id",
  37003. "aria-label",
  37004. "aria-labelledby",
  37005. "aria-valuenow",
  37006. "aria-valuetext",
  37007. "aria-valuemax",
  37008. "tabindex",
  37009. "aria-disabled"
  37010. ];
  37011. const _hoisted_2$14 = ["onMousemove", "onClick"];
  37012. var rate_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  37013. name: "ElRate",
  37014. __name: "rate",
  37015. props: rateProps,
  37016. emits: rateEmits,
  37017. setup(__props, { expose: __expose, emit: __emit }) {
  37018. function getValueFromMap(value, map) {
  37019. const isExcludedObject = (val) => isObject$1(val);
  37020. const matchedValue = map[Object.keys(map).map((key) => +key).filter((key) => {
  37021. const val = map[key];
  37022. return (isExcludedObject(val) ? val.excluded : false) ? value < key : value <= key;
  37023. }).sort((a, b) => a - b)[0]];
  37024. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  37025. }
  37026. const props = __props;
  37027. const emit = __emit;
  37028. const formItemContext = inject(formItemContextKey, void 0);
  37029. const rateSize = useFormSize();
  37030. const ns = useNamespace("rate");
  37031. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext });
  37032. const currentValue = ref(clamp$1(props.modelValue, 0, props.max));
  37033. const hoverIndex = ref(-1);
  37034. const pointerAtLeftHalf = ref(true);
  37035. const iconRefs = ref([]);
  37036. const iconClientWidths = computed(() => iconRefs.value.map((icon) => icon.$el.clientWidth));
  37037. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  37038. const rateDisabled = useFormDisabled();
  37039. const rateStyles = computed(() => {
  37040. return ns.cssVarBlock({
  37041. "void-color": props.voidColor,
  37042. "disabled-void-color": props.disabledVoidColor,
  37043. "fill-color": activeColor.value
  37044. });
  37045. });
  37046. const text = computed(() => {
  37047. let result = "";
  37048. if (props.showScore) result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  37049. else if (props.showText) result = props.texts[Math.ceil(currentValue.value) - 1];
  37050. return result;
  37051. });
  37052. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  37053. const colorMap = computed(() => isArray$1(props.colors) ? {
  37054. [props.lowThreshold]: props.colors[0],
  37055. [props.highThreshold]: {
  37056. value: props.colors[1],
  37057. excluded: true
  37058. },
  37059. [props.max]: props.colors[2]
  37060. } : props.colors);
  37061. const activeColor = computed(() => {
  37062. const color = getValueFromMap(currentValue.value, colorMap.value);
  37063. return isObject$1(color) ? "" : color;
  37064. });
  37065. const decimalStyle = computed(() => {
  37066. let width = "";
  37067. if (rateDisabled.value) width = `${valueDecimal.value}%`;
  37068. else if (props.allowHalf) width = "50%";
  37069. return {
  37070. color: activeColor.value,
  37071. width
  37072. };
  37073. });
  37074. const componentMap = computed(() => {
  37075. let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons };
  37076. icons = markRaw(icons);
  37077. return isArray$1(icons) ? {
  37078. [props.lowThreshold]: icons[0],
  37079. [props.highThreshold]: {
  37080. value: icons[1],
  37081. excluded: true
  37082. },
  37083. [props.max]: icons[2]
  37084. } : icons;
  37085. });
  37086. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  37087. const voidComponent = computed(() => rateDisabled.value ? isString(props.disabledVoidIcon) ? props.disabledVoidIcon : markRaw(props.disabledVoidIcon) : isString(props.voidIcon) ? props.voidIcon : markRaw(props.voidIcon));
  37088. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  37089. function showDecimalIcon(item) {
  37090. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  37091. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - .5 <= currentValue.value && item > currentValue.value;
  37092. return showWhenDisabled || showWhenAllowHalf;
  37093. }
  37094. function emitValue(value) {
  37095. if (props.clearable && value === props.modelValue) value = 0;
  37096. emit(UPDATE_MODEL_EVENT, value);
  37097. if (props.modelValue !== value) emit(CHANGE_EVENT, value);
  37098. }
  37099. function selectValue(value) {
  37100. if (rateDisabled.value) return;
  37101. if (props.allowHalf && pointerAtLeftHalf.value) emitValue(currentValue.value);
  37102. else emitValue(value);
  37103. }
  37104. function handleKey(e) {
  37105. if (rateDisabled.value) return;
  37106. const code = getEventCode(e);
  37107. const step = props.allowHalf ? .5 : 1;
  37108. let _currentValue = currentValue.value;
  37109. switch (code) {
  37110. case EVENT_CODE.up:
  37111. case EVENT_CODE.right:
  37112. _currentValue += step;
  37113. break;
  37114. case EVENT_CODE.left:
  37115. case EVENT_CODE.down:
  37116. _currentValue -= step;
  37117. break;
  37118. }
  37119. _currentValue = clamp$1(_currentValue, 0, props.max);
  37120. if (_currentValue === currentValue.value) return;
  37121. e.stopPropagation();
  37122. e.preventDefault();
  37123. emit(UPDATE_MODEL_EVENT, _currentValue);
  37124. emit(CHANGE_EVENT, _currentValue);
  37125. return _currentValue;
  37126. }
  37127. function setCurrentValue(value, event) {
  37128. if (rateDisabled.value) return;
  37129. if (props.allowHalf && event) {
  37130. pointerAtLeftHalf.value = event.offsetX * 2 <= iconClientWidths.value[value - 1];
  37131. currentValue.value = pointerAtLeftHalf.value ? value - .5 : value;
  37132. } else currentValue.value = value;
  37133. hoverIndex.value = value;
  37134. }
  37135. function resetCurrentValue() {
  37136. if (rateDisabled.value) return;
  37137. if (props.allowHalf) pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  37138. currentValue.value = clamp$1(props.modelValue, 0, props.max);
  37139. hoverIndex.value = -1;
  37140. }
  37141. watch(() => props.modelValue, (val) => {
  37142. currentValue.value = clamp$1(val, 0, props.max);
  37143. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  37144. });
  37145. if (!props.modelValue) emit(UPDATE_MODEL_EVENT, 0);
  37146. __expose({
  37147. setCurrentValue,
  37148. resetCurrentValue
  37149. });
  37150. return (_ctx, _cache) => {
  37151. return openBlock(), createElementBlock("div", {
  37152. id: unref(inputId),
  37153. class: normalizeClass([rateClasses.value, unref(ns).is("disabled", unref(rateDisabled))]),
  37154. role: "slider",
  37155. "aria-label": !unref(isLabeledByFormItem) ? __props.ariaLabel || "rating" : void 0,
  37156. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItemContext)?.labelId : void 0,
  37157. "aria-valuenow": currentValue.value,
  37158. "aria-valuetext": text.value || void 0,
  37159. "aria-valuemin": "0",
  37160. "aria-valuemax": __props.max,
  37161. style: normalizeStyle(rateStyles.value),
  37162. tabindex: unref(rateDisabled) ? void 0 : 0,
  37163. "aria-disabled": unref(rateDisabled),
  37164. onKeydown: handleKey
  37165. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.max, (item, key) => {
  37166. return openBlock(), createElementBlock("span", {
  37167. key,
  37168. class: normalizeClass(unref(ns).e("item")),
  37169. onMousemove: ($event) => setCurrentValue(item, $event),
  37170. onMouseleave: resetCurrentValue,
  37171. onClick: ($event) => selectValue(item)
  37172. }, [createVNode(unref(ElIcon), {
  37173. ref_for: true,
  37174. ref_key: "iconRefs",
  37175. ref: iconRefs,
  37176. class: normalizeClass([
  37177. unref(ns).e("icon"),
  37178. { hover: hoverIndex.value === item },
  37179. unref(ns).is("active", item <= currentValue.value),
  37180. unref(ns).is("focus-visible", item === Math.ceil(currentValue.value || 1))
  37181. ])
  37182. }, {
  37183. default: withCtx(() => [
  37184. withDirectives((openBlock(), createBlock(resolveDynamicComponent(activeComponent.value), null, null, 512)), [[vShow, !showDecimalIcon(item) && item <= currentValue.value]]),
  37185. withDirectives((openBlock(), createBlock(resolveDynamicComponent(voidComponent.value), null, null, 512)), [[vShow, !showDecimalIcon(item) && item > currentValue.value]]),
  37186. withDirectives((openBlock(), createBlock(resolveDynamicComponent(voidComponent.value), { class: normalizeClass([unref(ns).em("decimal", "box")]) }, null, 8, ["class"])), [[vShow, showDecimalIcon(item)]]),
  37187. withDirectives(createVNode(unref(ElIcon), {
  37188. style: normalizeStyle(decimalStyle.value),
  37189. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  37190. }, {
  37191. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(decimalIconComponent.value)))]),
  37192. _: 1
  37193. }, 8, ["style", "class"]), [[vShow, showDecimalIcon(item)]])
  37194. ]),
  37195. _: 2
  37196. }, 1032, ["class"])], 42, _hoisted_2$14);
  37197. }), 128)), __props.showText || __props.showScore ? (openBlock(), createElementBlock("span", {
  37198. key: 0,
  37199. class: normalizeClass(unref(ns).e("text")),
  37200. style: normalizeStyle({ color: __props.textColor })
  37201. }, toDisplayString(text.value), 7)) : createCommentVNode("v-if", true)], 46, _hoisted_1$23);
  37202. };
  37203. }
  37204. });
  37205. //#endregion
  37206. //#region ../../packages/components/rate/src/rate.vue
  37207. var rate_default = rate_vue_vue_type_script_setup_true_lang_default;
  37208. //#endregion
  37209. //#region ../../packages/components/rate/index.ts
  37210. const ElRate = withInstall(rate_default);
  37211. //#endregion
  37212. //#region ../../packages/components/result/src/result.ts
  37213. const IconMap = {
  37214. primary: "icon-primary",
  37215. success: "icon-success",
  37216. warning: "icon-warning",
  37217. error: "icon-error",
  37218. info: "icon-info"
  37219. };
  37220. const IconComponentMap = {
  37221. [IconMap.primary]: info_filled_default,
  37222. [IconMap.success]: circle_check_filled_default,
  37223. [IconMap.warning]: warning_filled_default,
  37224. [IconMap.error]: circle_close_filled_default,
  37225. [IconMap.info]: info_filled_default
  37226. };
  37227. /**
  37228. * @deprecated Removed after 3.0.0, Use `ResultProps` instead.
  37229. */
  37230. const resultProps = buildProps({
  37231. title: {
  37232. type: String,
  37233. default: ""
  37234. },
  37235. subTitle: {
  37236. type: String,
  37237. default: ""
  37238. },
  37239. icon: {
  37240. type: String,
  37241. values: [
  37242. "primary",
  37243. "success",
  37244. "warning",
  37245. "info",
  37246. "error"
  37247. ],
  37248. default: "info"
  37249. }
  37250. });
  37251. //#endregion
  37252. //#region ../../packages/components/result/src/result.vue?vue&type=script&setup=true&lang.ts
  37253. var result_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  37254. name: "ElResult",
  37255. __name: "result",
  37256. props: resultProps,
  37257. setup(__props) {
  37258. const props = __props;
  37259. const ns = useNamespace("result");
  37260. const resultIcon = computed(() => {
  37261. const icon = props.icon;
  37262. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  37263. return {
  37264. class: iconClass,
  37265. component: IconComponentMap[iconClass] || IconComponentMap["icon-info"]
  37266. };
  37267. });
  37268. return (_ctx, _cache) => {
  37269. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [
  37270. createElementVNode("div", { class: normalizeClass(unref(ns).e("icon")) }, [renderSlot(_ctx.$slots, "icon", {}, () => [resultIcon.value.component ? (openBlock(), createBlock(resolveDynamicComponent(resultIcon.value.component), {
  37271. key: 0,
  37272. class: normalizeClass(resultIcon.value.class)
  37273. }, null, 8, ["class"])) : createCommentVNode("v-if", true)])], 2),
  37274. __props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
  37275. key: 0,
  37276. class: normalizeClass(unref(ns).e("title"))
  37277. }, [renderSlot(_ctx.$slots, "title", {}, () => [createElementVNode("p", null, toDisplayString(__props.title), 1)])], 2)) : createCommentVNode("v-if", true),
  37278. __props.subTitle || _ctx.$slots["sub-title"] ? (openBlock(), createElementBlock("div", {
  37279. key: 1,
  37280. class: normalizeClass(unref(ns).e("subtitle"))
  37281. }, [renderSlot(_ctx.$slots, "sub-title", {}, () => [createElementVNode("p", null, toDisplayString(__props.subTitle), 1)])], 2)) : createCommentVNode("v-if", true),
  37282. _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  37283. key: 2,
  37284. class: normalizeClass(unref(ns).e("extra"))
  37285. }, [renderSlot(_ctx.$slots, "extra")], 2)) : createCommentVNode("v-if", true)
  37286. ], 2);
  37287. };
  37288. }
  37289. });
  37290. //#endregion
  37291. //#region ../../packages/components/result/src/result.vue
  37292. var result_default = result_vue_vue_type_script_setup_true_lang_default;
  37293. //#endregion
  37294. //#region ../../packages/components/result/index.ts
  37295. const ElResult = withInstall(result_default);
  37296. //#endregion
  37297. //#region ../../node_modules/.pnpm/memoize-one@6.0.0/node_modules/memoize-one/dist/memoize-one.esm.js
  37298. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  37299. return typeof value === "number" && value !== value;
  37300. };
  37301. function isEqual(first, second) {
  37302. if (first === second) return true;
  37303. if (safeIsNaN(first) && safeIsNaN(second)) return true;
  37304. return false;
  37305. }
  37306. function areInputsEqual(newInputs, lastInputs) {
  37307. if (newInputs.length !== lastInputs.length) return false;
  37308. for (var i = 0; i < newInputs.length; i++) if (!isEqual(newInputs[i], lastInputs[i])) return false;
  37309. return true;
  37310. }
  37311. function memoizeOne(resultFn, isEqual) {
  37312. if (isEqual === void 0) isEqual = areInputsEqual;
  37313. var cache = null;
  37314. function memoized() {
  37315. var newArgs = [];
  37316. for (var _i = 0; _i < arguments.length; _i++) newArgs[_i] = arguments[_i];
  37317. if (cache && cache.lastThis === this && isEqual(newArgs, cache.lastArgs)) return cache.lastResult;
  37318. var lastResult = resultFn.apply(this, newArgs);
  37319. cache = {
  37320. lastResult,
  37321. lastArgs: newArgs,
  37322. lastThis: this
  37323. };
  37324. return lastResult;
  37325. }
  37326. memoized.clear = function clear() {
  37327. cache = null;
  37328. };
  37329. return memoized;
  37330. }
  37331. //#endregion
  37332. //#region ../../packages/components/virtual-list/src/hooks/use-cache.ts
  37333. const useCache = () => {
  37334. const props = getCurrentInstance().proxy.$props;
  37335. return computed(() => {
  37336. const _getItemStyleCache = (_, __, ___) => ({});
  37337. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  37338. });
  37339. };
  37340. //#endregion
  37341. //#region ../../packages/components/virtual-list/src/defaults.ts
  37342. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  37343. const ITEM_RENDER_EVT = "itemRendered";
  37344. const SCROLL_EVT = "scroll";
  37345. const FORWARD = "forward";
  37346. const BACKWARD = "backward";
  37347. const AUTO_ALIGNMENT = "auto";
  37348. const SMART_ALIGNMENT = "smart";
  37349. const START_ALIGNMENT = "start";
  37350. const CENTERED_ALIGNMENT = "center";
  37351. const END_ALIGNMENT = "end";
  37352. const HORIZONTAL = "horizontal";
  37353. const VERTICAL = "vertical";
  37354. const LTR = "ltr";
  37355. const RTL = "rtl";
  37356. const RTL_OFFSET_NAG = "negative";
  37357. const RTL_OFFSET_POS_ASC = "positive-ascending";
  37358. const RTL_OFFSET_POS_DESC = "positive-descending";
  37359. const ScrollbarSizeKey = {
  37360. [HORIZONTAL]: "height",
  37361. [VERTICAL]: "width"
  37362. };
  37363. const ScrollbarDirKey = {
  37364. [HORIZONTAL]: "left",
  37365. [VERTICAL]: "top"
  37366. };
  37367. const SCROLLBAR_MIN_SIZE = 20;
  37368. //#endregion
  37369. //#region ../../packages/components/virtual-list/src/hooks/use-wheel.ts
  37370. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  37371. let frameHandle;
  37372. let offset = 0;
  37373. const hasReachedEdge = (offset) => {
  37374. return offset < 0 && atStartEdge.value || offset > 0 && atEndEdge.value;
  37375. };
  37376. const onWheel = (e) => {
  37377. cAF(frameHandle);
  37378. let { deltaX, deltaY } = e;
  37379. if (e.shiftKey && deltaY !== 0) {
  37380. deltaX = deltaY;
  37381. deltaY = 0;
  37382. }
  37383. const newOffset = layout.value === HORIZONTAL ? deltaX : deltaY;
  37384. if (hasReachedEdge(newOffset)) return;
  37385. offset += newOffset;
  37386. if (!isFirefox() && newOffset !== 0) e.preventDefault();
  37387. frameHandle = rAF(() => {
  37388. onWheelDelta(offset);
  37389. offset = 0;
  37390. });
  37391. };
  37392. return {
  37393. hasReachedEdge,
  37394. onWheel
  37395. };
  37396. };
  37397. //#endregion
  37398. //#region ../../packages/components/virtual-list/src/props.ts
  37399. const itemSize$1 = buildProp({
  37400. type: definePropType([Number, Function]),
  37401. required: true
  37402. });
  37403. const estimatedItemSize = buildProp({ type: Number });
  37404. const cache = buildProp({
  37405. type: Number,
  37406. default: 2
  37407. });
  37408. const direction = buildProp({
  37409. type: String,
  37410. values: ["ltr", "rtl"],
  37411. default: "ltr"
  37412. });
  37413. const initScrollOffset = buildProp({
  37414. type: Number,
  37415. default: 0
  37416. });
  37417. const total = buildProp({
  37418. type: Number,
  37419. required: true
  37420. });
  37421. const layout = buildProp({
  37422. type: String,
  37423. values: ["horizontal", "vertical"],
  37424. default: VERTICAL
  37425. });
  37426. const virtualizedProps = buildProps({
  37427. className: {
  37428. type: String,
  37429. default: ""
  37430. },
  37431. containerElement: {
  37432. type: definePropType([String, Object]),
  37433. default: "div"
  37434. },
  37435. data: {
  37436. type: definePropType(Array),
  37437. default: () => mutable([])
  37438. },
  37439. direction,
  37440. height: {
  37441. type: [String, Number],
  37442. required: true
  37443. },
  37444. innerElement: {
  37445. type: [String, Object],
  37446. default: "div"
  37447. },
  37448. innerProps: {
  37449. type: definePropType(Object),
  37450. default: () => ({})
  37451. },
  37452. style: { type: definePropType([
  37453. Object,
  37454. String,
  37455. Array
  37456. ]) },
  37457. useIsScrolling: Boolean,
  37458. width: {
  37459. type: [Number, String],
  37460. required: false
  37461. },
  37462. perfMode: {
  37463. type: Boolean,
  37464. default: true
  37465. },
  37466. scrollbarAlwaysOn: Boolean
  37467. });
  37468. const virtualizedListProps = buildProps({
  37469. cache,
  37470. estimatedItemSize,
  37471. layout,
  37472. initScrollOffset,
  37473. total,
  37474. itemSize: itemSize$1,
  37475. ...virtualizedProps
  37476. });
  37477. const scrollbarSize = {
  37478. type: Number,
  37479. default: 6
  37480. };
  37481. const startGap = {
  37482. type: Number,
  37483. default: 0
  37484. };
  37485. const endGap = {
  37486. type: Number,
  37487. default: 2
  37488. };
  37489. const virtualizedGridProps = buildProps({
  37490. columnCache: cache,
  37491. columnWidth: itemSize$1,
  37492. estimatedColumnWidth: estimatedItemSize,
  37493. estimatedRowHeight: estimatedItemSize,
  37494. initScrollLeft: initScrollOffset,
  37495. initScrollTop: initScrollOffset,
  37496. itemKey: {
  37497. type: definePropType(Function),
  37498. default: ({ columnIndex, rowIndex }) => `${rowIndex}:${columnIndex}`
  37499. },
  37500. rowCache: cache,
  37501. rowHeight: itemSize$1,
  37502. totalColumn: total,
  37503. totalRow: total,
  37504. hScrollbarSize: scrollbarSize,
  37505. vScrollbarSize: scrollbarSize,
  37506. scrollbarStartGap: startGap,
  37507. scrollbarEndGap: endGap,
  37508. role: String,
  37509. ...virtualizedProps
  37510. });
  37511. const virtualizedScrollbarProps = buildProps({
  37512. alwaysOn: Boolean,
  37513. class: String,
  37514. layout,
  37515. total,
  37516. ratio: {
  37517. type: Number,
  37518. required: true
  37519. },
  37520. clientSize: {
  37521. type: Number,
  37522. required: true
  37523. },
  37524. scrollFrom: {
  37525. type: Number,
  37526. required: true
  37527. },
  37528. scrollbarSize,
  37529. startGap,
  37530. endGap,
  37531. visible: Boolean
  37532. });
  37533. //#endregion
  37534. //#region ../../packages/components/virtual-list/src/utils.ts
  37535. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  37536. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  37537. const isRTL = (dir) => dir === RTL;
  37538. let cachedRTLResult = null;
  37539. function getRTLOffsetType(recalculate = false) {
  37540. if (cachedRTLResult === null || recalculate) {
  37541. const outerDiv = document.createElement("div");
  37542. const outerStyle = outerDiv.style;
  37543. outerStyle.width = "50px";
  37544. outerStyle.height = "50px";
  37545. outerStyle.overflow = "scroll";
  37546. outerStyle.direction = "rtl";
  37547. const innerDiv = document.createElement("div");
  37548. const innerStyle = innerDiv.style;
  37549. innerStyle.width = "100px";
  37550. innerStyle.height = "100px";
  37551. outerDiv.appendChild(innerDiv);
  37552. document.body.appendChild(outerDiv);
  37553. if (outerDiv.scrollLeft > 0) cachedRTLResult = RTL_OFFSET_POS_DESC;
  37554. else {
  37555. outerDiv.scrollLeft = 1;
  37556. if (outerDiv.scrollLeft === 0) cachedRTLResult = RTL_OFFSET_NAG;
  37557. else cachedRTLResult = RTL_OFFSET_POS_ASC;
  37558. }
  37559. document.body.removeChild(outerDiv);
  37560. return cachedRTLResult;
  37561. }
  37562. return cachedRTLResult;
  37563. }
  37564. function renderThumbStyle$1({ move, size, bar }, layout) {
  37565. const style = {};
  37566. const translate = `translate${bar.axis}(${move}px)`;
  37567. style[bar.size] = size;
  37568. style.transform = translate;
  37569. if (layout === "horizontal") style.height = "100%";
  37570. else style.width = "100%";
  37571. return style;
  37572. }
  37573. //#endregion
  37574. //#region ../../packages/components/virtual-list/src/components/scrollbar.ts
  37575. const ScrollBar = defineComponent({
  37576. name: "ElVirtualScrollBar",
  37577. props: virtualizedScrollbarProps,
  37578. emits: [
  37579. "scroll",
  37580. "start-move",
  37581. "stop-move"
  37582. ],
  37583. setup(props, { emit }) {
  37584. const GAP = computed(() => props.startGap + props.endGap);
  37585. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  37586. const nsScrollbar = useNamespace("scrollbar");
  37587. const trackRef = ref();
  37588. const thumbRef = ref();
  37589. let frameHandle = null;
  37590. let onselectstartStore = null;
  37591. const state = reactive({
  37592. isDragging: false,
  37593. traveled: 0
  37594. });
  37595. const bar = computed(() => BAR_MAP[props.layout]);
  37596. const trackSize = computed(() => props.clientSize - unref(GAP));
  37597. const trackStyle = computed(() => ({
  37598. position: "absolute",
  37599. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  37600. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  37601. [ScrollbarDirKey[props.layout]]: "2px",
  37602. right: "2px",
  37603. bottom: "2px",
  37604. borderRadius: "4px"
  37605. }));
  37606. const thumbSize = computed(() => {
  37607. const ratio = props.ratio;
  37608. if (ratio >= 100) return Number.POSITIVE_INFINITY;
  37609. if (ratio >= 50) return ratio * trackSize.value / 100;
  37610. const SCROLLBAR_MAX_SIZE = trackSize.value / 3;
  37611. return Math.floor(Math.min(Math.max(ratio * trackSize.value / 100, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  37612. });
  37613. const thumbStyle = computed(() => {
  37614. if (!Number.isFinite(thumbSize.value)) return { display: "none" };
  37615. const thumb = `${thumbSize.value}px`;
  37616. return renderThumbStyle$1({
  37617. bar: bar.value,
  37618. size: thumb,
  37619. move: state.traveled
  37620. }, props.layout);
  37621. });
  37622. const totalSteps = computed(() => Math.ceil(props.clientSize - thumbSize.value - unref(GAP)));
  37623. const attachEvents = () => {
  37624. window.addEventListener("mousemove", onMouseMove);
  37625. window.addEventListener("mouseup", onMouseUp);
  37626. const thumbEl = unref(thumbRef);
  37627. if (!thumbEl) return;
  37628. onselectstartStore = document.onselectstart;
  37629. document.onselectstart = () => false;
  37630. thumbEl.addEventListener("touchmove", onMouseMove, { passive: true });
  37631. thumbEl.addEventListener("touchend", onMouseUp);
  37632. };
  37633. const detachEvents = () => {
  37634. window.removeEventListener("mousemove", onMouseMove);
  37635. window.removeEventListener("mouseup", onMouseUp);
  37636. document.onselectstart = onselectstartStore;
  37637. onselectstartStore = null;
  37638. const thumbEl = unref(thumbRef);
  37639. if (!thumbEl) return;
  37640. thumbEl.removeEventListener("touchmove", onMouseMove);
  37641. thumbEl.removeEventListener("touchend", onMouseUp);
  37642. };
  37643. const onThumbMouseDown = (e) => {
  37644. e.stopImmediatePropagation();
  37645. if (e.ctrlKey || [1, 2].includes(e.button)) return;
  37646. state.isDragging = true;
  37647. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  37648. emit("start-move");
  37649. attachEvents();
  37650. };
  37651. const onMouseUp = () => {
  37652. state.isDragging = false;
  37653. state[bar.value.axis] = 0;
  37654. emit("stop-move");
  37655. detachEvents();
  37656. };
  37657. const onMouseMove = (e) => {
  37658. const { isDragging } = state;
  37659. if (!isDragging) return;
  37660. if (!thumbRef.value || !trackRef.value) return;
  37661. const prevPage = state[bar.value.axis];
  37662. if (!prevPage) return;
  37663. cAF(frameHandle);
  37664. /**
  37665. * +--------------+ +--------------+
  37666. * | - <--------- thumb.offsetTop | |
  37667. * | |+| <--+ | |
  37668. * | - | | |
  37669. * | Content | | | |
  37670. * | | | | |
  37671. * | | | | |
  37672. * | | | | -
  37673. * | | +--> | |+|
  37674. * | | | -
  37675. * +--------------+ +--------------+
  37676. */
  37677. const distance = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1 - (thumbRef.value[bar.value.offset] - prevPage);
  37678. frameHandle = rAF(() => {
  37679. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  37680. emit("scroll", distance, totalSteps.value);
  37681. });
  37682. };
  37683. const clickTrackHandler = (e) => {
  37684. const distance = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) - thumbRef.value[bar.value.offset] / 2;
  37685. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  37686. emit("scroll", distance, totalSteps.value);
  37687. };
  37688. watch(() => props.scrollFrom, (v) => {
  37689. if (state.isDragging) return;
  37690. /**
  37691. * this is simply mapping the current scrollbar offset
  37692. *
  37693. * formula 1:
  37694. * v = scrollOffset / (estimatedTotalSize - clientSize)
  37695. * traveled = v * (clientSize - thumbSize - GAP) --> v * totalSteps
  37696. *
  37697. * formula 2:
  37698. * traveled = (v * clientSize) / (clientSize / totalSteps) --> (v * clientSize) * (totalSteps / clientSize) --> v * totalSteps
  37699. */
  37700. state.traveled = Math.ceil(v * totalSteps.value);
  37701. });
  37702. onBeforeUnmount(() => {
  37703. detachEvents();
  37704. });
  37705. return () => {
  37706. return h("div", {
  37707. role: "presentation",
  37708. ref: trackRef,
  37709. class: [
  37710. nsVirtualScrollbar.b(),
  37711. props.class,
  37712. (props.alwaysOn || state.isDragging) && "always-on"
  37713. ],
  37714. style: trackStyle.value,
  37715. onMousedown: withModifiers(clickTrackHandler, ["stop", "prevent"]),
  37716. onTouchstartPrevent: onThumbMouseDown
  37717. }, h("div", {
  37718. ref: thumbRef,
  37719. class: nsScrollbar.e("thumb"),
  37720. style: thumbStyle.value,
  37721. onMousedown: onThumbMouseDown
  37722. }, []));
  37723. };
  37724. }
  37725. });
  37726. //#endregion
  37727. //#region ../../packages/components/virtual-list/src/builders/build-list.ts
  37728. const createList = ({ name, getOffset, getItemSize, getItemOffset, getEstimatedTotalSize, getStartIndexForOffset, getStopIndexForStartIndex, initCache, clearCache, validateProps }) => {
  37729. return defineComponent({
  37730. name: name ?? "ElVirtualList",
  37731. props: virtualizedListProps,
  37732. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  37733. setup(props, { emit, expose }) {
  37734. validateProps(props);
  37735. const instance = getCurrentInstance();
  37736. const ns = useNamespace("vl");
  37737. const dynamicSizeCache = ref(initCache(props, instance));
  37738. const getItemStyleCache = useCache();
  37739. const windowRef = ref();
  37740. const innerRef = ref();
  37741. const scrollbarRef = ref();
  37742. const states = ref({
  37743. isScrolling: false,
  37744. scrollDir: "forward",
  37745. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  37746. updateRequested: false,
  37747. isScrollbarDragging: false,
  37748. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  37749. });
  37750. const itemsToRender = computed(() => {
  37751. const { total, cache } = props;
  37752. const { isScrolling, scrollDir, scrollOffset } = unref(states);
  37753. if (total === 0) return [
  37754. 0,
  37755. 0,
  37756. 0,
  37757. 0
  37758. ];
  37759. const startIndex = getStartIndexForOffset(props, scrollOffset, unref(dynamicSizeCache));
  37760. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, unref(dynamicSizeCache));
  37761. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  37762. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  37763. return [
  37764. Math.max(0, startIndex - cacheBackward),
  37765. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  37766. startIndex,
  37767. stopIndex
  37768. ];
  37769. });
  37770. const estimatedTotalSize = computed(() => getEstimatedTotalSize(props, unref(dynamicSizeCache)));
  37771. const _isHorizontal = computed(() => isHorizontal(props.layout));
  37772. const windowStyle = computed(() => [
  37773. {
  37774. position: "relative",
  37775. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  37776. WebkitOverflowScrolling: "touch",
  37777. willChange: "transform"
  37778. },
  37779. {
  37780. direction: props.direction,
  37781. height: isNumber(props.height) ? `${props.height}px` : props.height,
  37782. width: isNumber(props.width) ? `${props.width}px` : props.width
  37783. },
  37784. props.style
  37785. ]);
  37786. const innerStyle = computed(() => {
  37787. const size = unref(estimatedTotalSize);
  37788. const horizontal = unref(_isHorizontal);
  37789. return {
  37790. height: horizontal ? "100%" : `${size}px`,
  37791. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  37792. width: horizontal ? `${size}px` : "100%",
  37793. margin: 0,
  37794. boxSizing: "border-box"
  37795. };
  37796. });
  37797. const clientSize = computed(() => _isHorizontal.value ? props.width : props.height);
  37798. const { onWheel } = useWheel({
  37799. atStartEdge: computed(() => states.value.scrollOffset <= 0),
  37800. atEndEdge: computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  37801. layout: computed(() => props.layout)
  37802. }, (offset) => {
  37803. scrollbarRef.value.onMouseUp?.();
  37804. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  37805. });
  37806. useEventListener(windowRef, "wheel", onWheel, { passive: false });
  37807. const emitEvents = () => {
  37808. const { total } = props;
  37809. if (total > 0) {
  37810. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = unref(itemsToRender);
  37811. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  37812. }
  37813. const { scrollDir, scrollOffset, updateRequested } = unref(states);
  37814. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  37815. };
  37816. const scrollVertically = (e) => {
  37817. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  37818. const _states = unref(states);
  37819. if (_states.scrollOffset === scrollTop) return;
  37820. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  37821. states.value = {
  37822. ..._states,
  37823. isScrolling: true,
  37824. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  37825. scrollOffset,
  37826. updateRequested: false
  37827. };
  37828. nextTick(resetIsScrolling);
  37829. };
  37830. const scrollHorizontally = (e) => {
  37831. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  37832. const _states = unref(states);
  37833. if (_states.scrollOffset === scrollLeft) return;
  37834. const { direction } = props;
  37835. let scrollOffset = scrollLeft;
  37836. if (direction === RTL) switch (getRTLOffsetType()) {
  37837. case RTL_OFFSET_NAG:
  37838. scrollOffset = -scrollLeft;
  37839. break;
  37840. case RTL_OFFSET_POS_DESC:
  37841. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  37842. break;
  37843. }
  37844. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  37845. states.value = {
  37846. ..._states,
  37847. isScrolling: true,
  37848. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  37849. scrollOffset,
  37850. updateRequested: false
  37851. };
  37852. nextTick(resetIsScrolling);
  37853. };
  37854. const onScroll = (e) => {
  37855. unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  37856. emitEvents();
  37857. };
  37858. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  37859. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  37860. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  37861. };
  37862. const scrollTo = (offset) => {
  37863. offset = Math.max(offset, 0);
  37864. if (offset === unref(states).scrollOffset) return;
  37865. states.value = {
  37866. ...unref(states),
  37867. scrollOffset: offset,
  37868. scrollDir: getScrollDir(unref(states).scrollOffset, offset),
  37869. updateRequested: true
  37870. };
  37871. nextTick(resetIsScrolling);
  37872. };
  37873. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  37874. const { scrollOffset } = unref(states);
  37875. idx = Math.max(0, Math.min(idx, props.total - 1));
  37876. scrollTo(getOffset(props, idx, alignment, scrollOffset, unref(dynamicSizeCache)));
  37877. };
  37878. const getItemStyle = (idx) => {
  37879. const { direction, itemSize, layout } = props;
  37880. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  37881. let style;
  37882. if (hasOwn(itemStyleCache, String(idx))) style = itemStyleCache[idx];
  37883. else {
  37884. const offset = getItemOffset(props, idx, unref(dynamicSizeCache));
  37885. const size = getItemSize(props, idx, unref(dynamicSizeCache));
  37886. const horizontal = unref(_isHorizontal);
  37887. const isRtl = direction === RTL;
  37888. const offsetHorizontal = horizontal ? offset : 0;
  37889. itemStyleCache[idx] = style = {
  37890. position: "absolute",
  37891. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  37892. right: isRtl ? `${offsetHorizontal}px` : void 0,
  37893. top: !horizontal ? `${offset}px` : 0,
  37894. height: !horizontal ? `${size}px` : "100%",
  37895. width: horizontal ? `${size}px` : "100%"
  37896. };
  37897. }
  37898. return style;
  37899. };
  37900. const resetIsScrolling = () => {
  37901. states.value.isScrolling = false;
  37902. nextTick(() => {
  37903. getItemStyleCache.value(-1, null, null);
  37904. });
  37905. };
  37906. const resetScrollTop = () => {
  37907. const window = windowRef.value;
  37908. if (window) window.scrollTop = 0;
  37909. };
  37910. onMounted(() => {
  37911. if (!isClient) return;
  37912. const { initScrollOffset } = props;
  37913. const windowElement = unref(windowRef);
  37914. if (isNumber(initScrollOffset) && windowElement) if (unref(_isHorizontal)) windowElement.scrollLeft = initScrollOffset;
  37915. else windowElement.scrollTop = initScrollOffset;
  37916. emitEvents();
  37917. });
  37918. onUpdated(() => {
  37919. const { direction, layout } = props;
  37920. const { scrollOffset, updateRequested } = unref(states);
  37921. const windowElement = unref(windowRef);
  37922. if (updateRequested && windowElement) if (layout === HORIZONTAL) if (direction === RTL) switch (getRTLOffsetType()) {
  37923. case RTL_OFFSET_NAG:
  37924. windowElement.scrollLeft = -scrollOffset;
  37925. break;
  37926. case RTL_OFFSET_POS_ASC:
  37927. windowElement.scrollLeft = scrollOffset;
  37928. break;
  37929. default: {
  37930. const { clientWidth, scrollWidth } = windowElement;
  37931. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  37932. break;
  37933. }
  37934. }
  37935. else windowElement.scrollLeft = scrollOffset;
  37936. else windowElement.scrollTop = scrollOffset;
  37937. });
  37938. onActivated(() => {
  37939. unref(windowRef).scrollTop = unref(states).scrollOffset;
  37940. });
  37941. const api = {
  37942. ns,
  37943. clientSize,
  37944. estimatedTotalSize,
  37945. windowStyle,
  37946. windowRef,
  37947. innerRef,
  37948. innerStyle,
  37949. itemsToRender,
  37950. scrollbarRef,
  37951. states,
  37952. getItemStyle,
  37953. onScroll,
  37954. onScrollbarScroll,
  37955. onWheel,
  37956. scrollTo,
  37957. scrollToItem,
  37958. resetScrollTop
  37959. };
  37960. expose({
  37961. windowRef,
  37962. innerRef,
  37963. getItemStyleCache,
  37964. scrollTo,
  37965. scrollToItem,
  37966. resetScrollTop,
  37967. states
  37968. });
  37969. return api;
  37970. },
  37971. render(ctx) {
  37972. const { $slots, className, clientSize, containerElement, data, getItemStyle, innerElement, itemsToRender, innerStyle, layout, total, onScroll, onScrollbarScroll, states, useIsScrolling, windowStyle, ns } = ctx;
  37973. const [start, end] = itemsToRender;
  37974. const Container = resolveDynamicComponent(containerElement);
  37975. const Inner = resolveDynamicComponent(innerElement);
  37976. const children = [];
  37977. if (total > 0) for (let i = start; i <= end; i++) children.push(h(Fragment, { key: i }, $slots.default?.({
  37978. data,
  37979. index: i,
  37980. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  37981. style: getItemStyle(i)
  37982. })));
  37983. const InnerNode = [h(Inner, mergeProps(ctx.innerProps, {
  37984. style: innerStyle,
  37985. ref: "innerRef"
  37986. }), !isString(Inner) ? { default: () => children } : children)];
  37987. const scrollbar = h(ScrollBar, {
  37988. ref: "scrollbarRef",
  37989. clientSize,
  37990. layout,
  37991. onScroll: onScrollbarScroll,
  37992. ratio: clientSize * 100 / this.estimatedTotalSize,
  37993. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  37994. total,
  37995. alwaysOn: states.scrollbarAlwaysOn
  37996. });
  37997. const listContainer = h(Container, {
  37998. class: [ns.e("window"), className],
  37999. style: windowStyle,
  38000. onScroll,
  38001. ref: "windowRef",
  38002. key: 0
  38003. }, !isString(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  38004. return h("div", {
  38005. key: 0,
  38006. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  38007. }, [listContainer, scrollbar]);
  38008. }
  38009. });
  38010. };
  38011. //#endregion
  38012. //#region ../../packages/components/virtual-list/src/components/fixed-size-list.ts
  38013. const FixedSizeList = createList({
  38014. name: "ElFixedSizeList",
  38015. getItemOffset: ({ itemSize }, index) => index * itemSize,
  38016. getItemSize: ({ itemSize }) => itemSize,
  38017. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  38018. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  38019. const size = isHorizontal(layout) ? width : height;
  38020. const lastItemOffset = Math.max(0, total * itemSize - size);
  38021. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  38022. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  38023. if (alignment === SMART_ALIGNMENT) if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) alignment = AUTO_ALIGNMENT;
  38024. else alignment = CENTERED_ALIGNMENT;
  38025. switch (alignment) {
  38026. case START_ALIGNMENT: return maxOffset;
  38027. case END_ALIGNMENT: return minOffset;
  38028. case CENTERED_ALIGNMENT: {
  38029. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38030. if (middleOffset < Math.ceil(size / 2)) return 0;
  38031. else if (middleOffset > lastItemOffset + Math.floor(size / 2)) return lastItemOffset;
  38032. else return middleOffset;
  38033. }
  38034. case AUTO_ALIGNMENT:
  38035. default: if (scrollOffset >= minOffset && scrollOffset <= maxOffset) return scrollOffset;
  38036. else if (scrollOffset < minOffset) return minOffset;
  38037. else return maxOffset;
  38038. }
  38039. },
  38040. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  38041. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  38042. const offset = startIndex * itemSize;
  38043. const size = isHorizontal(layout) ? width : height;
  38044. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  38045. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  38046. },
  38047. initCache() {},
  38048. clearCache: true,
  38049. validateProps() {}
  38050. });
  38051. //#endregion
  38052. //#region ../../packages/components/virtual-list/src/components/dynamic-size-list.ts
  38053. const getItemFromCache$1 = (props, index, listCache) => {
  38054. const { itemSize } = props;
  38055. const { items, lastVisitedIndex } = listCache;
  38056. if (index > lastVisitedIndex) {
  38057. let offset = 0;
  38058. if (lastVisitedIndex >= 0) {
  38059. const item = items[lastVisitedIndex];
  38060. offset = item.offset + item.size;
  38061. }
  38062. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  38063. const size = itemSize(i);
  38064. items[i] = {
  38065. offset,
  38066. size
  38067. };
  38068. offset += size;
  38069. }
  38070. listCache.lastVisitedIndex = index;
  38071. }
  38072. return items[index];
  38073. };
  38074. const findItem$1 = (props, listCache, offset) => {
  38075. const { items, lastVisitedIndex } = listCache;
  38076. if ((lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0) >= offset) return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  38077. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  38078. };
  38079. const bs$1 = (props, listCache, low, high, offset) => {
  38080. while (low <= high) {
  38081. const mid = low + Math.floor((high - low) / 2);
  38082. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  38083. if (currentOffset === offset) return mid;
  38084. else if (currentOffset < offset) low = mid + 1;
  38085. else if (currentOffset > offset) high = mid - 1;
  38086. }
  38087. return Math.max(0, low - 1);
  38088. };
  38089. const es$1 = (props, listCache, index, offset) => {
  38090. const { total } = props;
  38091. let exponent = 1;
  38092. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  38093. index += exponent;
  38094. exponent *= 2;
  38095. }
  38096. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  38097. };
  38098. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  38099. let totalSizeOfMeasuredItems = 0;
  38100. if (lastVisitedIndex >= total) lastVisitedIndex = total - 1;
  38101. if (lastVisitedIndex >= 0) {
  38102. const item = items[lastVisitedIndex];
  38103. totalSizeOfMeasuredItems = item.offset + item.size;
  38104. }
  38105. const totalSizeOfUnmeasuredItems = (total - lastVisitedIndex - 1) * estimatedItemSize;
  38106. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  38107. };
  38108. const DynamicSizeList = createList({
  38109. name: "ElDynamicSizeList",
  38110. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  38111. getItemSize: (_, index, { items }) => items[index].size,
  38112. getEstimatedTotalSize,
  38113. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  38114. const { height, layout, width } = props;
  38115. const size = isHorizontal(layout) ? width : height;
  38116. const item = getItemFromCache$1(props, index, listCache);
  38117. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  38118. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  38119. const minOffset = Math.max(0, item.offset - size + item.size);
  38120. if (alignment === SMART_ALIGNMENT) if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) alignment = AUTO_ALIGNMENT;
  38121. else alignment = CENTERED_ALIGNMENT;
  38122. switch (alignment) {
  38123. case START_ALIGNMENT: return maxOffset;
  38124. case END_ALIGNMENT: return minOffset;
  38125. case CENTERED_ALIGNMENT: return Math.round(minOffset + (maxOffset - minOffset) / 2);
  38126. case AUTO_ALIGNMENT:
  38127. default: if (scrollOffset >= minOffset && scrollOffset <= maxOffset) return scrollOffset;
  38128. else if (scrollOffset < minOffset) return minOffset;
  38129. else return maxOffset;
  38130. }
  38131. },
  38132. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  38133. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  38134. const { height, total, layout, width } = props;
  38135. const size = isHorizontal(layout) ? width : height;
  38136. const item = getItemFromCache$1(props, startIndex, listCache);
  38137. const maxOffset = scrollOffset + size;
  38138. let offset = item.offset + item.size;
  38139. let stopIndex = startIndex;
  38140. while (stopIndex < total - 1 && offset < maxOffset) {
  38141. stopIndex++;
  38142. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  38143. }
  38144. return stopIndex;
  38145. },
  38146. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  38147. const cache = {
  38148. items: {},
  38149. estimatedItemSize,
  38150. lastVisitedIndex: -1
  38151. };
  38152. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  38153. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  38154. instance.exposed?.getItemStyleCache(-1);
  38155. if (forceUpdate) instance.proxy?.$forceUpdate();
  38156. };
  38157. return cache;
  38158. },
  38159. clearCache: false,
  38160. validateProps: ({ itemSize }) => {}
  38161. });
  38162. //#endregion
  38163. //#region ../../packages/components/virtual-list/src/hooks/use-grid-wheel.ts
  38164. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  38165. let frameHandle = null;
  38166. let xOffset = 0;
  38167. let yOffset = 0;
  38168. const hasReachedEdge = (x, y) => {
  38169. const xEdgeReached = x < 0 && atXStartEdge.value || x > 0 && atXEndEdge.value;
  38170. const yEdgeReached = y < 0 && atYStartEdge.value || y > 0 && atYEndEdge.value;
  38171. return xEdgeReached || yEdgeReached;
  38172. };
  38173. const onWheel = (e) => {
  38174. cAF(frameHandle);
  38175. let x = e.deltaX;
  38176. let y = e.deltaY;
  38177. if (Math.abs(x) > Math.abs(y)) y = 0;
  38178. else x = 0;
  38179. if (e.shiftKey && y !== 0) {
  38180. x = y;
  38181. y = 0;
  38182. }
  38183. if (hasReachedEdge(x, y)) {
  38184. if (e.deltaX !== 0 && x === 0) e.preventDefault();
  38185. return;
  38186. }
  38187. xOffset += x;
  38188. yOffset += y;
  38189. e.preventDefault();
  38190. frameHandle = rAF(() => {
  38191. onWheelDelta(xOffset, yOffset);
  38192. xOffset = 0;
  38193. yOffset = 0;
  38194. });
  38195. };
  38196. return {
  38197. hasReachedEdge,
  38198. onWheel
  38199. };
  38200. };
  38201. //#endregion
  38202. //#region ../../packages/components/virtual-list/src/hooks/use-grid-touch.ts
  38203. const useGridTouch = (windowRef, states, scrollTo, estimatedTotalWidth, estimatedTotalHeight, parsedWidth, parsedHeight) => {
  38204. const touchStartX = ref(0);
  38205. const touchStartY = ref(0);
  38206. let frameHandle;
  38207. let deltaX = 0;
  38208. let deltaY = 0;
  38209. const handleTouchStart = (event) => {
  38210. cAF(frameHandle);
  38211. touchStartX.value = event.touches[0].clientX;
  38212. touchStartY.value = event.touches[0].clientY;
  38213. deltaX = 0;
  38214. deltaY = 0;
  38215. };
  38216. const handleTouchMove = (event) => {
  38217. event.preventDefault();
  38218. cAF(frameHandle);
  38219. deltaX += touchStartX.value - event.touches[0].clientX;
  38220. deltaY += touchStartY.value - event.touches[0].clientY;
  38221. touchStartX.value = event.touches[0].clientX;
  38222. touchStartY.value = event.touches[0].clientY;
  38223. frameHandle = rAF(() => {
  38224. const maxScrollLeft = estimatedTotalWidth.value - unref(parsedWidth);
  38225. const maxScrollTop = estimatedTotalHeight.value - unref(parsedHeight);
  38226. scrollTo({
  38227. scrollLeft: Math.min(states.value.scrollLeft + deltaX, maxScrollLeft),
  38228. scrollTop: Math.min(states.value.scrollTop + deltaY, maxScrollTop)
  38229. });
  38230. deltaX = 0;
  38231. deltaY = 0;
  38232. });
  38233. };
  38234. useEventListener(windowRef, "touchstart", handleTouchStart, { passive: true });
  38235. useEventListener(windowRef, "touchmove", handleTouchMove, { passive: false });
  38236. return {
  38237. touchStartX,
  38238. touchStartY,
  38239. handleTouchStart,
  38240. handleTouchMove
  38241. };
  38242. };
  38243. //#endregion
  38244. //#region ../../packages/components/virtual-list/src/builders/build-grid.ts
  38245. const createGrid = ({ name, clearCache, getColumnPosition, getColumnStartIndexForOffset, getColumnStopIndexForStartIndex, getEstimatedTotalHeight, getEstimatedTotalWidth, getColumnOffset, getRowOffset, getRowPosition, getRowStartIndexForOffset, getRowStopIndexForStartIndex, initCache, injectToInstance, validateProps }) => {
  38246. return defineComponent({
  38247. name: name ?? "ElVirtualList",
  38248. props: virtualizedGridProps,
  38249. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  38250. setup(props, { emit, expose, slots }) {
  38251. const ns = useNamespace("vl");
  38252. validateProps(props);
  38253. const instance = getCurrentInstance();
  38254. const cache = ref(initCache(props, instance));
  38255. injectToInstance?.(instance, cache);
  38256. const windowRef = ref();
  38257. const hScrollbar = ref();
  38258. const vScrollbar = ref();
  38259. const innerRef = ref();
  38260. const states = ref({
  38261. isScrolling: false,
  38262. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  38263. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  38264. updateRequested: false,
  38265. xAxisScrollDir: FORWARD,
  38266. yAxisScrollDir: FORWARD
  38267. });
  38268. const getItemStyleCache = useCache();
  38269. const parsedHeight = computed(() => Number.parseInt(`${props.height}`, 10));
  38270. const parsedWidth = computed(() => Number.parseInt(`${props.width}`, 10));
  38271. const columnsToRender = computed(() => {
  38272. const { totalColumn, totalRow, columnCache } = props;
  38273. const { isScrolling, xAxisScrollDir, scrollLeft } = unref(states);
  38274. if (totalColumn === 0 || totalRow === 0) return [
  38275. 0,
  38276. 0,
  38277. 0,
  38278. 0
  38279. ];
  38280. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, unref(cache));
  38281. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, unref(cache));
  38282. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  38283. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  38284. return [
  38285. Math.max(0, startIndex - cacheBackward),
  38286. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  38287. startIndex,
  38288. stopIndex
  38289. ];
  38290. });
  38291. const rowsToRender = computed(() => {
  38292. const { totalColumn, totalRow, rowCache } = props;
  38293. const { isScrolling, yAxisScrollDir, scrollTop } = unref(states);
  38294. if (totalColumn === 0 || totalRow === 0) return [
  38295. 0,
  38296. 0,
  38297. 0,
  38298. 0
  38299. ];
  38300. const startIndex = getRowStartIndexForOffset(props, scrollTop, unref(cache));
  38301. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, unref(cache));
  38302. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  38303. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  38304. return [
  38305. Math.max(0, startIndex - cacheBackward),
  38306. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  38307. startIndex,
  38308. stopIndex
  38309. ];
  38310. });
  38311. const estimatedTotalHeight = computed(() => getEstimatedTotalHeight(props, unref(cache)));
  38312. const estimatedTotalWidth = computed(() => getEstimatedTotalWidth(props, unref(cache)));
  38313. const windowStyle = computed(() => [
  38314. {
  38315. position: "relative",
  38316. overflow: "hidden",
  38317. WebkitOverflowScrolling: "touch",
  38318. willChange: "transform"
  38319. },
  38320. {
  38321. direction: props.direction,
  38322. height: isNumber(props.height) ? `${props.height}px` : props.height,
  38323. width: isNumber(props.width) ? `${props.width}px` : props.width
  38324. },
  38325. props.style ?? {}
  38326. ]);
  38327. const innerStyle = computed(() => {
  38328. const width = `${unref(estimatedTotalWidth)}px`;
  38329. return {
  38330. height: `${unref(estimatedTotalHeight)}px`,
  38331. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  38332. width,
  38333. margin: 0,
  38334. boxSizing: "border-box"
  38335. };
  38336. });
  38337. const emitEvents = () => {
  38338. const { totalColumn, totalRow } = props;
  38339. if (totalColumn > 0 && totalRow > 0) {
  38340. const [columnCacheStart, columnCacheEnd, columnVisibleStart, columnVisibleEnd] = unref(columnsToRender);
  38341. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = unref(rowsToRender);
  38342. emit(ITEM_RENDER_EVT, {
  38343. columnCacheStart,
  38344. columnCacheEnd,
  38345. rowCacheStart,
  38346. rowCacheEnd,
  38347. columnVisibleStart,
  38348. columnVisibleEnd,
  38349. rowVisibleStart,
  38350. rowVisibleEnd
  38351. });
  38352. }
  38353. const { scrollLeft, scrollTop, updateRequested, xAxisScrollDir, yAxisScrollDir } = unref(states);
  38354. emit(SCROLL_EVT, {
  38355. xAxisScrollDir,
  38356. scrollLeft,
  38357. yAxisScrollDir,
  38358. scrollTop,
  38359. updateRequested
  38360. });
  38361. };
  38362. const onScroll = (e) => {
  38363. const { clientHeight, clientWidth, scrollHeight, scrollLeft, scrollTop, scrollWidth } = e.currentTarget;
  38364. const _states = unref(states);
  38365. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) return;
  38366. let _scrollLeft = scrollLeft;
  38367. if (isRTL(props.direction)) switch (getRTLOffsetType()) {
  38368. case RTL_OFFSET_NAG:
  38369. _scrollLeft = -scrollLeft;
  38370. break;
  38371. case RTL_OFFSET_POS_DESC:
  38372. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  38373. break;
  38374. }
  38375. states.value = {
  38376. ..._states,
  38377. isScrolling: true,
  38378. scrollLeft: _scrollLeft,
  38379. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  38380. updateRequested: true,
  38381. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  38382. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  38383. };
  38384. nextTick(() => resetIsScrolling());
  38385. onUpdated();
  38386. emitEvents();
  38387. };
  38388. const onVerticalScroll = (distance, totalSteps) => {
  38389. const height = unref(parsedHeight);
  38390. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  38391. scrollTo({ scrollTop: Math.min(estimatedTotalHeight.value - height, offset) });
  38392. };
  38393. const onHorizontalScroll = (distance, totalSteps) => {
  38394. const width = unref(parsedWidth);
  38395. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  38396. scrollTo({ scrollLeft: Math.min(estimatedTotalWidth.value - width, offset) });
  38397. };
  38398. const { onWheel } = useGridWheel({
  38399. atXStartEdge: computed(() => states.value.scrollLeft <= 0),
  38400. atXEndEdge: computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - unref(parsedWidth)),
  38401. atYStartEdge: computed(() => states.value.scrollTop <= 0),
  38402. atYEndEdge: computed(() => states.value.scrollTop >= estimatedTotalHeight.value - unref(parsedHeight))
  38403. }, (x, y) => {
  38404. hScrollbar.value?.onMouseUp?.();
  38405. vScrollbar.value?.onMouseUp?.();
  38406. const width = unref(parsedWidth);
  38407. const height = unref(parsedHeight);
  38408. scrollTo({
  38409. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  38410. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  38411. });
  38412. });
  38413. useEventListener(windowRef, "wheel", onWheel, { passive: false });
  38414. const scrollTo = ({ scrollLeft = states.value.scrollLeft, scrollTop = states.value.scrollTop }) => {
  38415. scrollLeft = Math.max(scrollLeft, 0);
  38416. scrollTop = Math.max(scrollTop, 0);
  38417. const _states = unref(states);
  38418. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) return;
  38419. states.value = {
  38420. ..._states,
  38421. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  38422. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  38423. scrollLeft,
  38424. scrollTop,
  38425. updateRequested: true
  38426. };
  38427. nextTick(() => resetIsScrolling());
  38428. onUpdated();
  38429. emitEvents();
  38430. };
  38431. const { touchStartX, touchStartY, handleTouchStart, handleTouchMove } = useGridTouch(windowRef, states, scrollTo, estimatedTotalWidth, estimatedTotalHeight, parsedWidth, parsedHeight);
  38432. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  38433. const _states = unref(states);
  38434. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  38435. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  38436. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  38437. const _cache = unref(cache);
  38438. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  38439. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  38440. scrollTo({
  38441. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  38442. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  38443. });
  38444. };
  38445. const getItemStyle = (rowIndex, columnIndex) => {
  38446. const { columnWidth, direction, rowHeight } = props;
  38447. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  38448. const key = `${rowIndex},${columnIndex}`;
  38449. if (hasOwn(itemStyleCache, key)) return itemStyleCache[key];
  38450. else {
  38451. const [, left] = getColumnPosition(props, columnIndex, unref(cache));
  38452. const _cache = unref(cache);
  38453. const rtl = isRTL(direction);
  38454. const [height, top] = getRowPosition(props, rowIndex, _cache);
  38455. const [width] = getColumnPosition(props, columnIndex, _cache);
  38456. itemStyleCache[key] = {
  38457. position: "absolute",
  38458. left: rtl ? void 0 : `${left}px`,
  38459. right: rtl ? `${left}px` : void 0,
  38460. top: `${top}px`,
  38461. height: `${height}px`,
  38462. width: `${width}px`
  38463. };
  38464. return itemStyleCache[key];
  38465. }
  38466. };
  38467. const resetIsScrolling = () => {
  38468. states.value.isScrolling = false;
  38469. nextTick(() => {
  38470. getItemStyleCache.value(-1, null, null);
  38471. });
  38472. };
  38473. onMounted(() => {
  38474. if (!isClient) return;
  38475. const { initScrollLeft, initScrollTop } = props;
  38476. const windowElement = unref(windowRef);
  38477. if (windowElement) {
  38478. if (isNumber(initScrollLeft)) windowElement.scrollLeft = initScrollLeft;
  38479. if (isNumber(initScrollTop)) windowElement.scrollTop = initScrollTop;
  38480. }
  38481. emitEvents();
  38482. });
  38483. const onUpdated = () => {
  38484. const { direction } = props;
  38485. const { scrollLeft, scrollTop, updateRequested } = unref(states);
  38486. const windowElement = unref(windowRef);
  38487. if (updateRequested && windowElement) {
  38488. if (direction === RTL) switch (getRTLOffsetType()) {
  38489. case RTL_OFFSET_NAG:
  38490. windowElement.scrollLeft = -scrollLeft;
  38491. break;
  38492. case RTL_OFFSET_POS_ASC:
  38493. windowElement.scrollLeft = scrollLeft;
  38494. break;
  38495. default: {
  38496. const { clientWidth, scrollWidth } = windowElement;
  38497. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  38498. break;
  38499. }
  38500. }
  38501. else windowElement.scrollLeft = Math.max(0, scrollLeft);
  38502. windowElement.scrollTop = Math.max(0, scrollTop);
  38503. }
  38504. };
  38505. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  38506. expose({
  38507. windowRef,
  38508. innerRef,
  38509. getItemStyleCache,
  38510. touchStartX,
  38511. touchStartY,
  38512. handleTouchStart,
  38513. handleTouchMove,
  38514. scrollTo,
  38515. scrollToItem,
  38516. states,
  38517. resetAfterColumnIndex,
  38518. resetAfterRowIndex,
  38519. resetAfter
  38520. });
  38521. const renderScrollbars = () => {
  38522. const { scrollbarAlwaysOn, scrollbarStartGap, scrollbarEndGap, totalColumn, totalRow } = props;
  38523. const width = unref(parsedWidth);
  38524. const height = unref(parsedHeight);
  38525. const estimatedWidth = unref(estimatedTotalWidth);
  38526. const estimatedHeight = unref(estimatedTotalHeight);
  38527. const { scrollLeft, scrollTop } = unref(states);
  38528. return {
  38529. horizontalScrollbar: h(ScrollBar, {
  38530. ref: hScrollbar,
  38531. alwaysOn: scrollbarAlwaysOn,
  38532. startGap: scrollbarStartGap,
  38533. endGap: scrollbarEndGap,
  38534. class: ns.e("horizontal"),
  38535. clientSize: width,
  38536. layout: "horizontal",
  38537. onScroll: onHorizontalScroll,
  38538. ratio: width * 100 / estimatedWidth,
  38539. scrollFrom: scrollLeft / (estimatedWidth - width),
  38540. total: totalRow,
  38541. visible: true
  38542. }),
  38543. verticalScrollbar: h(ScrollBar, {
  38544. ref: vScrollbar,
  38545. alwaysOn: scrollbarAlwaysOn,
  38546. startGap: scrollbarStartGap,
  38547. endGap: scrollbarEndGap,
  38548. class: ns.e("vertical"),
  38549. clientSize: height,
  38550. layout: "vertical",
  38551. onScroll: onVerticalScroll,
  38552. ratio: height * 100 / estimatedHeight,
  38553. scrollFrom: scrollTop / (estimatedHeight - height),
  38554. total: totalColumn,
  38555. visible: true
  38556. })
  38557. };
  38558. };
  38559. const renderItems = () => {
  38560. const [columnStart, columnEnd] = unref(columnsToRender);
  38561. const [rowStart, rowEnd] = unref(rowsToRender);
  38562. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  38563. const children = [];
  38564. if (totalRow > 0 && totalColumn > 0) for (let row = rowStart; row <= rowEnd; row++) for (let column = columnStart; column <= columnEnd; column++) {
  38565. const key = itemKey({
  38566. columnIndex: column,
  38567. data,
  38568. rowIndex: row
  38569. });
  38570. children.push(h(Fragment, { key }, slots.default?.({
  38571. columnIndex: column,
  38572. data,
  38573. isScrolling: useIsScrolling ? unref(states).isScrolling : void 0,
  38574. style: getItemStyle(row, column),
  38575. rowIndex: row
  38576. })));
  38577. }
  38578. return children;
  38579. };
  38580. const renderInner = () => {
  38581. const Inner = resolveDynamicComponent(props.innerElement);
  38582. const children = renderItems();
  38583. return [h(Inner, mergeProps(props.innerProps, {
  38584. style: unref(innerStyle),
  38585. ref: innerRef
  38586. }), !isString(Inner) ? { default: () => children } : children)];
  38587. };
  38588. const renderWindow = () => {
  38589. const Container = resolveDynamicComponent(props.containerElement);
  38590. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  38591. const Inner = renderInner();
  38592. return h("div", {
  38593. key: 0,
  38594. class: ns.e("wrapper"),
  38595. role: props.role
  38596. }, [
  38597. h(Container, {
  38598. class: props.className,
  38599. style: unref(windowStyle),
  38600. onScroll,
  38601. ref: windowRef
  38602. }, !isString(Container) ? { default: () => Inner } : Inner),
  38603. horizontalScrollbar,
  38604. verticalScrollbar
  38605. ]);
  38606. };
  38607. return renderWindow;
  38608. }
  38609. });
  38610. };
  38611. //#endregion
  38612. //#region ../../packages/components/virtual-list/src/components/fixed-size-grid.ts
  38613. const FixedSizeGrid = createGrid({
  38614. name: "ElFixedSizeGrid",
  38615. getColumnPosition: ({ columnWidth }, index) => [columnWidth, index * columnWidth],
  38616. getRowPosition: ({ rowHeight }, index) => [rowHeight, index * rowHeight],
  38617. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  38618. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  38619. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  38620. width = Number(width);
  38621. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  38622. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  38623. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  38624. if (alignment === "smart") if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) alignment = AUTO_ALIGNMENT;
  38625. else alignment = CENTERED_ALIGNMENT;
  38626. switch (alignment) {
  38627. case START_ALIGNMENT: return maxOffset;
  38628. case END_ALIGNMENT: return minOffset;
  38629. case CENTERED_ALIGNMENT: {
  38630. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38631. if (middleOffset < Math.ceil(width / 2)) return 0;
  38632. else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) return lastColumnOffset;
  38633. else return middleOffset;
  38634. }
  38635. case AUTO_ALIGNMENT:
  38636. default: if (scrollLeft >= minOffset && scrollLeft <= maxOffset) return scrollLeft;
  38637. else if (minOffset > maxOffset) return minOffset;
  38638. else if (scrollLeft < minOffset) return minOffset;
  38639. else return maxOffset;
  38640. }
  38641. },
  38642. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  38643. height = Number(height);
  38644. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  38645. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  38646. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  38647. if (align === SMART_ALIGNMENT) if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) align = AUTO_ALIGNMENT;
  38648. else align = CENTERED_ALIGNMENT;
  38649. switch (align) {
  38650. case START_ALIGNMENT: return maxOffset;
  38651. case END_ALIGNMENT: return minOffset;
  38652. case CENTERED_ALIGNMENT: {
  38653. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38654. if (middleOffset < Math.ceil(height / 2)) return 0;
  38655. else if (middleOffset > lastRowOffset + Math.floor(height / 2)) return lastRowOffset;
  38656. else return middleOffset;
  38657. }
  38658. case AUTO_ALIGNMENT:
  38659. default: if (scrollTop >= minOffset && scrollTop <= maxOffset) return scrollTop;
  38660. else if (minOffset > maxOffset) return minOffset;
  38661. else if (scrollTop < minOffset) return minOffset;
  38662. else return maxOffset;
  38663. }
  38664. },
  38665. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  38666. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  38667. const left = startIndex * columnWidth;
  38668. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  38669. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  38670. },
  38671. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  38672. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  38673. const top = startIndex * rowHeight;
  38674. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  38675. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  38676. },
  38677. initCache: () => void 0,
  38678. clearCache: true,
  38679. validateProps: ({ columnWidth, rowHeight }) => {}
  38680. });
  38681. //#endregion
  38682. //#region ../../packages/components/virtual-list/src/components/dynamic-size-grid.ts
  38683. const { max, min, floor } = Math;
  38684. const ACCESS_SIZER_KEY_MAP = {
  38685. column: "columnWidth",
  38686. row: "rowHeight"
  38687. };
  38688. const ACCESS_LAST_VISITED_KEY_MAP = {
  38689. column: "lastVisitedColumnIndex",
  38690. row: "lastVisitedRowIndex"
  38691. };
  38692. const getItemFromCache = (props, index, gridCache, type) => {
  38693. const [cachedItems, sizer, lastVisited] = [
  38694. gridCache[type],
  38695. props[ACCESS_SIZER_KEY_MAP[type]],
  38696. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  38697. ];
  38698. if (index > lastVisited) {
  38699. let offset = 0;
  38700. if (lastVisited >= 0) {
  38701. const item = cachedItems[lastVisited];
  38702. offset = item.offset + item.size;
  38703. }
  38704. for (let i = lastVisited + 1; i <= index; i++) {
  38705. const size = sizer(i);
  38706. cachedItems[i] = {
  38707. offset,
  38708. size
  38709. };
  38710. offset += size;
  38711. }
  38712. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  38713. }
  38714. return cachedItems[index];
  38715. };
  38716. const bs = (props, gridCache, low, high, offset, type) => {
  38717. while (low <= high) {
  38718. const mid = low + floor((high - low) / 2);
  38719. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  38720. if (currentOffset === offset) return mid;
  38721. else if (currentOffset < offset) low = mid + 1;
  38722. else high = mid - 1;
  38723. }
  38724. return max(0, low - 1);
  38725. };
  38726. const es = (props, gridCache, idx, offset, type) => {
  38727. const total = type === "column" ? props.totalColumn : props.totalRow;
  38728. let exponent = 1;
  38729. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  38730. idx += exponent;
  38731. exponent *= 2;
  38732. }
  38733. return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type);
  38734. };
  38735. const findItem = (props, gridCache, offset, type) => {
  38736. const [cache, lastVisitedIndex] = [gridCache[type], gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]];
  38737. if ((lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0) >= offset) return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  38738. return es(props, gridCache, max(0, lastVisitedIndex), offset, type);
  38739. };
  38740. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  38741. let sizeOfVisitedRows = 0;
  38742. if (lastVisitedRowIndex >= totalRow) lastVisitedRowIndex = totalRow - 1;
  38743. if (lastVisitedRowIndex >= 0) {
  38744. const item = row[lastVisitedRowIndex];
  38745. sizeOfVisitedRows = item.offset + item.size;
  38746. }
  38747. const sizeOfUnvisitedItems = (totalRow - lastVisitedRowIndex - 1) * estimatedRowHeight;
  38748. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  38749. };
  38750. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  38751. let sizeOfVisitedColumns = 0;
  38752. if (lastVisitedColumnIndex > totalColumn) lastVisitedColumnIndex = totalColumn - 1;
  38753. if (lastVisitedColumnIndex >= 0) {
  38754. const item = column[lastVisitedColumnIndex];
  38755. sizeOfVisitedColumns = item.offset + item.size;
  38756. }
  38757. const sizeOfUnvisitedItems = (totalColumn - lastVisitedColumnIndex - 1) * estimatedColumnWidth;
  38758. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  38759. };
  38760. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  38761. column: getEstimatedTotalWidth,
  38762. row: getEstimatedTotalHeight
  38763. };
  38764. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  38765. const [size, estimatedSizeAssociates] = [type === "row" ? props.height : props.width, ACCESS_ESTIMATED_SIZE_KEY_MAP[type]];
  38766. const item = getItemFromCache(props, index, cache, type);
  38767. const maxOffset = max(0, min(estimatedSizeAssociates(props, cache) - size, item.offset));
  38768. const minOffset = max(0, item.offset - size + scrollBarWidth + item.size);
  38769. if (alignment === SMART_ALIGNMENT) if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) alignment = AUTO_ALIGNMENT;
  38770. else alignment = CENTERED_ALIGNMENT;
  38771. switch (alignment) {
  38772. case START_ALIGNMENT: return maxOffset;
  38773. case END_ALIGNMENT: return minOffset;
  38774. case CENTERED_ALIGNMENT: return Math.round(minOffset + (maxOffset - minOffset) / 2);
  38775. case AUTO_ALIGNMENT:
  38776. default: if (scrollOffset >= minOffset && scrollOffset <= maxOffset) return scrollOffset;
  38777. else if (minOffset > maxOffset) return minOffset;
  38778. else if (scrollOffset < minOffset) return minOffset;
  38779. else return maxOffset;
  38780. }
  38781. };
  38782. const DynamicSizeGrid = createGrid({
  38783. name: "ElDynamicSizeGrid",
  38784. getColumnPosition: (props, idx, cache) => {
  38785. const item = getItemFromCache(props, idx, cache, "column");
  38786. return [item.size, item.offset];
  38787. },
  38788. getRowPosition: (props, idx, cache) => {
  38789. const item = getItemFromCache(props, idx, cache, "row");
  38790. return [item.size, item.offset];
  38791. },
  38792. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  38793. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  38794. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  38795. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  38796. const item = getItemFromCache(props, startIndex, cache, "column");
  38797. const maxOffset = scrollLeft + props.width;
  38798. let offset = item.offset + item.size;
  38799. let stopIndex = startIndex;
  38800. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  38801. stopIndex++;
  38802. offset += getItemFromCache(props, startIndex, cache, "column").size;
  38803. }
  38804. return stopIndex;
  38805. },
  38806. getEstimatedTotalHeight,
  38807. getEstimatedTotalWidth,
  38808. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  38809. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  38810. const { totalRow, height } = props;
  38811. const item = getItemFromCache(props, startIndex, cache, "row");
  38812. const maxOffset = scrollTop + height;
  38813. let offset = item.size + item.offset;
  38814. let stopIndex = startIndex;
  38815. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  38816. stopIndex++;
  38817. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  38818. }
  38819. return stopIndex;
  38820. },
  38821. injectToInstance: (instance, cache) => {
  38822. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  38823. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  38824. if (isNumber(columnIndex)) cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  38825. if (isNumber(rowIndex)) cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  38826. instance.exposed?.getItemStyleCache.value(-1, null, null);
  38827. if (forceUpdate) instance.proxy?.$forceUpdate();
  38828. };
  38829. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  38830. resetAfter({ columnIndex }, forceUpdate);
  38831. };
  38832. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  38833. resetAfter({ rowIndex }, forceUpdate);
  38834. };
  38835. Object.assign(instance.proxy, {
  38836. resetAfterColumnIndex,
  38837. resetAfterRowIndex,
  38838. resetAfter
  38839. });
  38840. },
  38841. initCache: ({ estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE, estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }) => {
  38842. return {
  38843. column: {},
  38844. estimatedColumnWidth,
  38845. estimatedRowHeight,
  38846. lastVisitedColumnIndex: -1,
  38847. lastVisitedRowIndex: -1,
  38848. row: {}
  38849. };
  38850. },
  38851. clearCache: false,
  38852. validateProps: ({ columnWidth, rowHeight }) => {}
  38853. });
  38854. //#endregion
  38855. //#region ../../packages/components/select-v2/src/group-item.vue?vue&type=script&lang.ts
  38856. var group_item_vue_vue_type_script_lang_default = defineComponent({
  38857. props: {
  38858. item: {
  38859. type: Object,
  38860. required: true
  38861. },
  38862. style: { type: Object },
  38863. height: Number
  38864. },
  38865. setup() {
  38866. return { ns: useNamespace("select") };
  38867. }
  38868. });
  38869. //#endregion
  38870. //#region ../../packages/components/select-v2/src/group-item.vue
  38871. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  38872. return openBlock(), createElementBlock("div", {
  38873. class: normalizeClass(_ctx.ns.be("group", "title")),
  38874. style: normalizeStyle({
  38875. ..._ctx.style,
  38876. lineHeight: `${_ctx.height}px`
  38877. })
  38878. }, toDisplayString(_ctx.item.label), 7);
  38879. }
  38880. var group_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(group_item_vue_vue_type_script_lang_default, [["render", _sfc_render$7]]);
  38881. //#endregion
  38882. //#region ../../packages/components/select-v2/src/useOption.ts
  38883. function useOption(props, { emit }) {
  38884. return {
  38885. hoverItem: () => {
  38886. if (!props.disabled) emit("hover", props.index);
  38887. },
  38888. selectOptionClick: () => {
  38889. if (!props.disabled) emit("select", props.item, props.index);
  38890. }
  38891. };
  38892. }
  38893. //#endregion
  38894. //#region ../../packages/components/select-v2/src/defaults.ts
  38895. const selectV2Props = buildProps({
  38896. allowCreate: Boolean,
  38897. autocomplete: {
  38898. type: definePropType(String),
  38899. default: "none"
  38900. },
  38901. automaticDropdown: Boolean,
  38902. clearable: Boolean,
  38903. clearIcon: {
  38904. type: iconPropType,
  38905. default: circle_close_default
  38906. },
  38907. effect: {
  38908. type: definePropType(String),
  38909. default: "light"
  38910. },
  38911. collapseTags: Boolean,
  38912. collapseTagsTooltip: Boolean,
  38913. tagTooltip: {
  38914. type: definePropType(Object),
  38915. default: () => ({})
  38916. },
  38917. maxCollapseTags: {
  38918. type: Number,
  38919. default: 1
  38920. },
  38921. defaultFirstOption: Boolean,
  38922. disabled: {
  38923. type: Boolean,
  38924. default: void 0
  38925. },
  38926. estimatedOptionHeight: {
  38927. type: Number,
  38928. default: void 0
  38929. },
  38930. filterable: Boolean,
  38931. filterMethod: { type: definePropType(Function) },
  38932. height: {
  38933. type: Number,
  38934. default: 274
  38935. },
  38936. itemHeight: {
  38937. type: Number,
  38938. default: 34
  38939. },
  38940. id: String,
  38941. loading: Boolean,
  38942. loadingText: String,
  38943. modelValue: {
  38944. type: definePropType([
  38945. Array,
  38946. String,
  38947. Number,
  38948. Boolean,
  38949. Object
  38950. ]),
  38951. default: void 0
  38952. },
  38953. multiple: Boolean,
  38954. multipleLimit: {
  38955. type: Number,
  38956. default: 0
  38957. },
  38958. name: String,
  38959. noDataText: String,
  38960. noMatchText: String,
  38961. remoteMethod: { type: definePropType(Function) },
  38962. reserveKeyword: {
  38963. type: Boolean,
  38964. default: true
  38965. },
  38966. options: {
  38967. type: definePropType(Array),
  38968. required: true
  38969. },
  38970. placeholder: { type: String },
  38971. teleported: useTooltipContentProps.teleported,
  38972. persistent: {
  38973. type: Boolean,
  38974. default: true
  38975. },
  38976. popperClass: useTooltipContentProps.popperClass,
  38977. popperStyle: useTooltipContentProps.popperStyle,
  38978. popperOptions: {
  38979. type: definePropType(Object),
  38980. default: () => ({})
  38981. },
  38982. remote: Boolean,
  38983. debounce: {
  38984. type: Number,
  38985. default: 300
  38986. },
  38987. size: useSizeProp,
  38988. props: {
  38989. type: definePropType(Object),
  38990. default: () => defaultProps$2
  38991. },
  38992. valueKey: {
  38993. type: String,
  38994. default: "value"
  38995. },
  38996. scrollbarAlwaysOn: Boolean,
  38997. validateEvent: {
  38998. type: Boolean,
  38999. default: true
  39000. },
  39001. offset: {
  39002. type: Number,
  39003. default: 12
  39004. },
  39005. remoteShowSuffix: Boolean,
  39006. showArrow: {
  39007. type: Boolean,
  39008. default: true
  39009. },
  39010. placement: {
  39011. type: definePropType(String),
  39012. values: Ee,
  39013. default: "bottom-start"
  39014. },
  39015. fallbackPlacements: {
  39016. type: definePropType(Array),
  39017. default: [
  39018. "bottom-start",
  39019. "top-start",
  39020. "right",
  39021. "left"
  39022. ]
  39023. },
  39024. tagType: {
  39025. ...tagProps.type,
  39026. default: "info"
  39027. },
  39028. tagEffect: {
  39029. ...tagProps.effect,
  39030. default: "light"
  39031. },
  39032. tabindex: {
  39033. type: [String, Number],
  39034. default: 0
  39035. },
  39036. appendTo: useTooltipContentProps.appendTo,
  39037. fitInputWidth: {
  39038. type: [Boolean, Number],
  39039. default: true,
  39040. validator(val) {
  39041. return isBoolean(val) || isNumber(val);
  39042. }
  39043. },
  39044. suffixIcon: {
  39045. type: iconPropType,
  39046. default: arrow_down_default
  39047. },
  39048. ...useEmptyValuesProps,
  39049. ...useAriaProps(["ariaLabel"])
  39050. });
  39051. const optionV2Props = buildProps({
  39052. data: Array,
  39053. disabled: Boolean,
  39054. hovering: Boolean,
  39055. item: {
  39056. type: definePropType(Object),
  39057. required: true
  39058. },
  39059. index: Number,
  39060. style: Object,
  39061. selected: Boolean,
  39062. created: Boolean
  39063. });
  39064. const selectV2Emits = {
  39065. [UPDATE_MODEL_EVENT]: (val) => true,
  39066. [CHANGE_EVENT]: (val) => true,
  39067. "remove-tag": (val) => true,
  39068. "visible-change": (visible) => true,
  39069. focus: (evt) => evt instanceof FocusEvent,
  39070. blur: (evt) => evt instanceof FocusEvent,
  39071. clear: () => true
  39072. };
  39073. const optionV2Emits = {
  39074. hover: (index) => isNumber(index),
  39075. select: (val, index) => true
  39076. };
  39077. //#endregion
  39078. //#region ../../packages/components/select-v2/src/token.ts
  39079. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  39080. //#endregion
  39081. //#region ../../packages/components/select-v2/src/option-item.vue?vue&type=script&lang.ts
  39082. var option_item_vue_vue_type_script_lang_default = defineComponent({
  39083. props: optionV2Props,
  39084. emits: optionV2Emits,
  39085. setup(props, { emit }) {
  39086. const select = inject(selectV2InjectionKey);
  39087. const ns = useNamespace("select");
  39088. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  39089. const { getLabel } = useProps(select.props);
  39090. return {
  39091. ns,
  39092. contentId: select.contentId,
  39093. hoverItem,
  39094. selectOptionClick,
  39095. getLabel
  39096. };
  39097. }
  39098. });
  39099. //#endregion
  39100. //#region ../../packages/components/select-v2/src/option-item.vue
  39101. const _hoisted_1$22 = [
  39102. "id",
  39103. "aria-selected",
  39104. "aria-disabled"
  39105. ];
  39106. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  39107. return openBlock(), createElementBlock("li", {
  39108. id: `${_ctx.contentId}-${_ctx.index}`,
  39109. role: "option",
  39110. "aria-selected": _ctx.selected,
  39111. "aria-disabled": _ctx.disabled || void 0,
  39112. style: normalizeStyle(_ctx.style),
  39113. class: normalizeClass([
  39114. _ctx.ns.be("dropdown", "item"),
  39115. _ctx.ns.is("selected", _ctx.selected),
  39116. _ctx.ns.is("disabled", _ctx.disabled),
  39117. _ctx.ns.is("created", _ctx.created),
  39118. _ctx.ns.is("hovering", _ctx.hovering)
  39119. ]),
  39120. onMousemove: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  39121. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  39122. }, [renderSlot(_ctx.$slots, "default", {
  39123. item: _ctx.item,
  39124. index: _ctx.index,
  39125. disabled: _ctx.disabled
  39126. }, () => [createElementVNode("span", null, toDisplayString(_ctx.getLabel(_ctx.item)), 1)])], 46, _hoisted_1$22);
  39127. }
  39128. var option_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(option_item_vue_vue_type_script_lang_default, [["render", _sfc_render$6]]);
  39129. //#endregion
  39130. //#region ../../packages/components/select-v2/src/select-dropdown.tsx
  39131. const props = {
  39132. loading: Boolean,
  39133. data: {
  39134. type: Array,
  39135. required: true
  39136. },
  39137. hoveringIndex: Number,
  39138. width: Number,
  39139. id: String,
  39140. ariaLabel: String
  39141. };
  39142. var select_dropdown_default = /* @__PURE__ */ defineComponent({
  39143. name: "ElSelectDropdown",
  39144. props,
  39145. setup(props, { slots, expose }) {
  39146. const select = inject(selectV2InjectionKey);
  39147. const ns = useNamespace("select");
  39148. const { getLabel, getValue, getDisabled } = useProps(select.props);
  39149. const cachedHeights = ref([]);
  39150. const listRef = ref();
  39151. const size = computed(() => props.data.length);
  39152. watch(() => size.value, () => {
  39153. select.tooltipRef.value?.updatePopper?.();
  39154. });
  39155. const isSized = computed(() => isUndefined(select.props.estimatedOptionHeight));
  39156. const listProps = computed(() => {
  39157. if (isSized.value) return { itemSize: select.props.itemHeight };
  39158. return {
  39159. estimatedSize: select.props.estimatedOptionHeight,
  39160. itemSize: (idx) => cachedHeights.value[idx]
  39161. };
  39162. });
  39163. const contains = (arr = [], target) => {
  39164. const { props: { valueKey } } = select;
  39165. if (!isObject$1(target)) return arr.includes(target);
  39166. return arr && arr.some((item) => {
  39167. return toRaw(get(item, valueKey)) === get(target, valueKey);
  39168. });
  39169. };
  39170. const isEqual = (selected, target) => {
  39171. if (!isObject$1(target)) return selected === target;
  39172. else {
  39173. const { valueKey } = select.props;
  39174. return get(selected, valueKey) === get(target, valueKey);
  39175. }
  39176. };
  39177. const isItemSelected = (modelValue, target) => {
  39178. if (select.props.multiple) return contains(modelValue, getValue(target));
  39179. return isEqual(modelValue, getValue(target));
  39180. };
  39181. const isItemDisabled = (modelValue, selected) => {
  39182. const { disabled, multiple, multipleLimit } = select.props;
  39183. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  39184. };
  39185. const isItemHovering = (target) => props.hoveringIndex === target;
  39186. const scrollToItem = (index) => {
  39187. const list = listRef.value;
  39188. if (list) list.scrollToItem(index);
  39189. };
  39190. const resetScrollTop = () => {
  39191. const list = listRef.value;
  39192. if (list) list.resetScrollTop();
  39193. };
  39194. expose({
  39195. listRef,
  39196. isSized,
  39197. isItemDisabled,
  39198. isItemHovering,
  39199. isItemSelected,
  39200. scrollToItem,
  39201. resetScrollTop
  39202. });
  39203. const Item = (itemProps) => {
  39204. const { index, data, style } = itemProps;
  39205. const sized = unref(isSized);
  39206. const { itemSize, estimatedSize } = unref(listProps);
  39207. const { modelValue } = select.props;
  39208. const { onSelect, onHover } = select;
  39209. const item = data[index];
  39210. if (item.type === "Group") return createVNode(group_item_default, {
  39211. "item": item,
  39212. "style": style,
  39213. "height": sized ? itemSize : estimatedSize
  39214. }, null);
  39215. const isSelected = isItemSelected(modelValue, item);
  39216. const isDisabled = isItemDisabled(modelValue, isSelected);
  39217. const isHovering = isItemHovering(index);
  39218. return createVNode(option_item_default, mergeProps(itemProps, {
  39219. "selected": isSelected,
  39220. "disabled": getDisabled(item) || isDisabled,
  39221. "created": !!item.created,
  39222. "hovering": isHovering,
  39223. "item": item,
  39224. "onSelect": onSelect,
  39225. "onHover": onHover
  39226. }), { default: (props) => slots.default?.(props) || createVNode("span", null, [getLabel(item)]) });
  39227. };
  39228. const { onKeyboardNavigate, onKeyboardSelect } = select;
  39229. const onForward = () => {
  39230. onKeyboardNavigate("forward");
  39231. };
  39232. const onBackward = () => {
  39233. onKeyboardNavigate("backward");
  39234. };
  39235. const onEscOrTab = () => {};
  39236. const onKeydown = (e) => {
  39237. const code = getEventCode(e);
  39238. const { tab, esc, down, up, enter, numpadEnter } = EVENT_CODE;
  39239. if ([
  39240. esc,
  39241. down,
  39242. up,
  39243. enter,
  39244. numpadEnter
  39245. ].includes(code)) {
  39246. e.preventDefault();
  39247. e.stopPropagation();
  39248. }
  39249. switch (code) {
  39250. case tab:
  39251. case esc:
  39252. onEscOrTab();
  39253. break;
  39254. case down:
  39255. onForward();
  39256. break;
  39257. case up:
  39258. onBackward();
  39259. break;
  39260. case enter:
  39261. case numpadEnter:
  39262. onKeyboardSelect();
  39263. break;
  39264. }
  39265. };
  39266. return () => {
  39267. const { data, width } = props;
  39268. const { height, multiple, scrollbarAlwaysOn } = select.props;
  39269. const isScrollbarAlwaysOn = computed(() => {
  39270. return isIOS ? true : scrollbarAlwaysOn;
  39271. });
  39272. const List = unref(isSized) ? FixedSizeList : DynamicSizeList;
  39273. return createVNode("div", {
  39274. "class": [ns.b("dropdown"), ns.is("multiple", multiple)],
  39275. "style": { width: `${width}px` }
  39276. }, [
  39277. slots.header?.(),
  39278. slots.loading?.() || slots.empty?.() || createVNode(List, mergeProps({ "ref": listRef }, unref(listProps), {
  39279. "className": ns.be("dropdown", "list"),
  39280. "scrollbarAlwaysOn": isScrollbarAlwaysOn.value,
  39281. "data": data,
  39282. "height": height,
  39283. "width": width,
  39284. "total": data.length,
  39285. "innerElement": "ul",
  39286. "innerProps": {
  39287. id: props.id,
  39288. role: "listbox",
  39289. "aria-label": props.ariaLabel,
  39290. "aria-orientation": "vertical"
  39291. },
  39292. "onKeydown": onKeydown
  39293. }), { default: (props) => createVNode(Item, props, null) }),
  39294. slots.footer?.()
  39295. ]);
  39296. };
  39297. }
  39298. });
  39299. //#endregion
  39300. //#region ../../packages/components/select-v2/src/useAllowCreate.ts
  39301. function useAllowCreate(props, states) {
  39302. const { aliasProps, getLabel, getValue } = useProps(props);
  39303. const createOptionCount = ref(0);
  39304. const cachedSelectedOption = ref();
  39305. const enableAllowCreateMode = computed(() => {
  39306. return props.allowCreate && props.filterable;
  39307. });
  39308. watch(() => props.options, (options) => {
  39309. const optionLabelsSet = new Set(options.map((option) => getLabel(option)));
  39310. states.createdOptions = states.createdOptions.filter((createdOption) => !optionLabelsSet.has(getLabel(createdOption)));
  39311. });
  39312. function hasExistingOption(query) {
  39313. const hasOption = (option) => getLabel(option) === query;
  39314. return props.options && props.options.some(hasOption) || states.createdOptions.some(hasOption);
  39315. }
  39316. function selectNewOption(option) {
  39317. if (!enableAllowCreateMode.value) return;
  39318. if (props.multiple && option.created) createOptionCount.value++;
  39319. else cachedSelectedOption.value = option;
  39320. }
  39321. function createNewOption(query) {
  39322. if (enableAllowCreateMode.value) if (query && query.length > 0) {
  39323. if (hasExistingOption(query)) {
  39324. states.createdOptions = states.createdOptions.filter((createdOption) => getLabel(createdOption) !== states.previousQuery);
  39325. return;
  39326. }
  39327. const newOption = {
  39328. [aliasProps.value.value]: query,
  39329. [aliasProps.value.label]: query,
  39330. created: true,
  39331. [aliasProps.value.disabled]: false
  39332. };
  39333. if (states.createdOptions.length >= createOptionCount.value) states.createdOptions[createOptionCount.value] = newOption;
  39334. else states.createdOptions.push(newOption);
  39335. } else if (props.multiple) states.createdOptions.length = createOptionCount.value;
  39336. else {
  39337. const selectedOption = cachedSelectedOption.value;
  39338. states.createdOptions.length = 0;
  39339. if (selectedOption && selectedOption.created) states.createdOptions.push(selectedOption);
  39340. }
  39341. }
  39342. function removeNewOption(option) {
  39343. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) return;
  39344. const idx = states.createdOptions.findIndex((it) => getValue(it) === getValue(option));
  39345. if (~idx) {
  39346. states.createdOptions.splice(idx, 1);
  39347. createOptionCount.value--;
  39348. }
  39349. }
  39350. function clearAllNewOption() {
  39351. if (enableAllowCreateMode.value) {
  39352. states.createdOptions.length = 0;
  39353. createOptionCount.value = 0;
  39354. }
  39355. }
  39356. return {
  39357. createNewOption,
  39358. removeNewOption,
  39359. selectNewOption,
  39360. clearAllNewOption
  39361. };
  39362. }
  39363. //#endregion
  39364. //#region ../../packages/components/select-v2/src/useSelect.ts
  39365. const useSelect$1 = (props, emit) => {
  39366. const { t } = useLocale();
  39367. const slots = useSlots();
  39368. const nsSelect = useNamespace("select");
  39369. const nsInput = useNamespace("input");
  39370. const { form: elForm, formItem: elFormItem } = useFormItem();
  39371. const { inputId } = useFormItemInputId(props, { formItemContext: elFormItem });
  39372. const { aliasProps, getLabel, getValue, getDisabled, getOptions } = useProps(props);
  39373. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  39374. const states = reactive({
  39375. inputValue: "",
  39376. cachedOptions: [],
  39377. createdOptions: [],
  39378. hoveringIndex: -1,
  39379. inputHovering: false,
  39380. selectionWidth: 0,
  39381. collapseItemWidth: 0,
  39382. previousQuery: null,
  39383. previousValue: void 0,
  39384. selectedLabel: "",
  39385. menuVisibleOnFocus: false,
  39386. isBeforeHide: false
  39387. });
  39388. const popperSize = ref(-1);
  39389. const debouncing = ref(false);
  39390. const selectRef = ref();
  39391. const selectionRef = ref();
  39392. const tooltipRef = ref();
  39393. const tagTooltipRef = ref();
  39394. const inputRef = ref();
  39395. const prefixRef = ref();
  39396. const suffixRef = ref();
  39397. const menuRef = ref();
  39398. const tagMenuRef = ref();
  39399. const collapseItemRef = ref();
  39400. const { isComposing, handleCompositionStart, handleCompositionEnd, handleCompositionUpdate } = useComposition({ afterComposition: (e) => onInput(e) });
  39401. const selectDisabled = useFormDisabled();
  39402. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  39403. disabled: selectDisabled,
  39404. afterFocus() {
  39405. if (props.automaticDropdown && !expanded.value) {
  39406. expanded.value = true;
  39407. states.menuVisibleOnFocus = true;
  39408. }
  39409. },
  39410. beforeBlur(event) {
  39411. return tooltipRef.value?.isFocusInsideContent(event) || tagTooltipRef.value?.isFocusInsideContent(event);
  39412. },
  39413. afterBlur() {
  39414. expanded.value = false;
  39415. states.menuVisibleOnFocus = false;
  39416. if (props.validateEvent) elFormItem?.validate?.("blur").catch((err) => /* @__PURE__ */ debugWarn(err));
  39417. }
  39418. });
  39419. const allOptions = computed(() => filterOptions(""));
  39420. const hasOptions = computed(() => {
  39421. if (props.loading) return false;
  39422. return props.options.length > 0 || states.createdOptions.length > 0;
  39423. });
  39424. const filteredOptions = ref([]);
  39425. const expanded = ref(false);
  39426. const needStatusIcon = computed(() => elForm?.statusIcon ?? false);
  39427. const popupHeight = computed(() => {
  39428. const totalHeight = filteredOptions.value.length * props.itemHeight;
  39429. return totalHeight > props.height ? props.height : totalHeight;
  39430. });
  39431. const hasModelValue = computed(() => {
  39432. return props.multiple ? isArray$1(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  39433. });
  39434. const showClearBtn = computed(() => {
  39435. return props.clearable && !selectDisabled.value && hasModelValue.value && (isFocused.value || states.inputHovering);
  39436. });
  39437. const iconComponent = computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  39438. const iconReverse = computed(() => iconComponent.value && nsSelect.is("reverse", expanded.value));
  39439. const validateState = computed(() => elFormItem?.validateState || "");
  39440. const validateIcon = computed(() => {
  39441. if (!validateState.value) return;
  39442. return ValidateComponentsMap[validateState.value];
  39443. });
  39444. const debounce = computed(() => props.remote ? props.debounce : 0);
  39445. const isRemoteSearchEmpty = computed(() => props.remote && !states.inputValue && !hasOptions.value);
  39446. const emptyText = computed(() => {
  39447. if (props.loading) return props.loadingText || t("el.select.loading");
  39448. else {
  39449. if (props.filterable && states.inputValue && hasOptions.value && filteredOptions.value.length === 0) return props.noMatchText || t("el.select.noMatch");
  39450. if (!hasOptions.value) return props.noDataText || t("el.select.noData");
  39451. }
  39452. return null;
  39453. });
  39454. const isFilterMethodValid = computed(() => props.filterable && isFunction$1(props.filterMethod));
  39455. const isRemoteMethodValid = computed(() => props.filterable && props.remote && isFunction$1(props.remoteMethod));
  39456. const filterOptions = (query) => {
  39457. const regexp = new RegExp(escapeStringRegexp(query), "i");
  39458. const isValidOption = (o) => {
  39459. if (isFilterMethodValid.value || isRemoteMethodValid.value) return true;
  39460. return query ? regexp.test(getLabel(o) || "") : true;
  39461. };
  39462. if (props.loading) return [];
  39463. return [...states.createdOptions, ...props.options].reduce((all, item) => {
  39464. const options = getOptions(item);
  39465. if (isArray$1(options)) {
  39466. const filtered = options.filter(isValidOption);
  39467. if (filtered.length > 0) all.push({
  39468. label: getLabel(item),
  39469. type: "Group"
  39470. }, ...filtered);
  39471. } else if (props.remote || isValidOption(item)) all.push(item);
  39472. return all;
  39473. }, []);
  39474. };
  39475. const updateOptions = () => {
  39476. filteredOptions.value = filterOptions(states.inputValue);
  39477. };
  39478. const allOptionsValueMap = computed(() => {
  39479. const valueMap = /* @__PURE__ */ new Map();
  39480. allOptions.value.forEach((option, index) => {
  39481. valueMap.set(getValueKey(getValue(option)), {
  39482. option,
  39483. index
  39484. });
  39485. });
  39486. return valueMap;
  39487. });
  39488. const filteredOptionsValueMap = computed(() => {
  39489. const valueMap = /* @__PURE__ */ new Map();
  39490. filteredOptions.value.forEach((option, index) => {
  39491. valueMap.set(getValueKey(getValue(option)), {
  39492. option,
  39493. index
  39494. });
  39495. });
  39496. return valueMap;
  39497. });
  39498. const optionsAllDisabled = computed(() => filteredOptions.value.every((option) => getDisabled(option)));
  39499. const selectSize = useFormSize();
  39500. const collapseTagSize = computed(() => "small" === selectSize.value ? "small" : "default");
  39501. const calculatePopperSize = () => {
  39502. if (isNumber(props.fitInputWidth)) {
  39503. popperSize.value = props.fitInputWidth;
  39504. return;
  39505. }
  39506. const width = selectRef.value?.offsetWidth || 200;
  39507. if (!props.fitInputWidth && hasOptions.value) nextTick(() => {
  39508. popperSize.value = Math.max(width, calculateLabelMaxWidth());
  39509. });
  39510. else popperSize.value = width;
  39511. };
  39512. const calculateLabelMaxWidth = () => {
  39513. const ctx = document.createElement("canvas").getContext("2d");
  39514. const selector = nsSelect.be("dropdown", "item");
  39515. const dropdownItemEl = (menuRef.value?.listRef?.innerRef || document).querySelector(`.${selector}`);
  39516. if (dropdownItemEl === null || ctx === null) return 0;
  39517. const style = getComputedStyle(dropdownItemEl);
  39518. const padding = Number.parseFloat(style.paddingLeft) + Number.parseFloat(style.paddingRight);
  39519. ctx.font = `bold ${style.font.replace(new RegExp(`\\b${style.fontWeight}\\b`), "")}`;
  39520. return filteredOptions.value.reduce((max, option) => {
  39521. const metrics = ctx.measureText(getLabel(option));
  39522. return Math.max(metrics.width, max);
  39523. }, 0) + padding;
  39524. };
  39525. const getGapWidth = () => {
  39526. if (!selectionRef.value) return 0;
  39527. const style = window.getComputedStyle(selectionRef.value);
  39528. return Number.parseFloat(style.gap || "6px");
  39529. };
  39530. const tagStyle = computed(() => {
  39531. const gapWidth = getGapWidth();
  39532. const inputSlotWidth = props.filterable ? gapWidth + MINIMUM_INPUT_WIDTH : 0;
  39533. return { maxWidth: `${collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.selectionWidth - inputSlotWidth}px` };
  39534. });
  39535. const collapseTagStyle = computed(() => {
  39536. return { maxWidth: `${states.selectionWidth}px` };
  39537. });
  39538. const shouldShowPlaceholder = computed(() => {
  39539. if (isArray$1(props.modelValue)) return props.modelValue.length === 0 && !states.inputValue;
  39540. return props.filterable ? !states.inputValue : true;
  39541. });
  39542. const currentPlaceholder = computed(() => {
  39543. const _placeholder = props.placeholder ?? t("el.select.placeholder");
  39544. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  39545. });
  39546. const popperRef = computed(() => tooltipRef.value?.popperRef?.contentRef);
  39547. const indexRef = computed(() => {
  39548. if (props.multiple) {
  39549. const len = props.modelValue.length;
  39550. if (len > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
  39551. const { index } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
  39552. return index;
  39553. }
  39554. } else if (!isEmptyValue(props.modelValue) && filteredOptionsValueMap.value.has(props.modelValue)) {
  39555. const { index } = filteredOptionsValueMap.value.get(props.modelValue);
  39556. return index;
  39557. }
  39558. return -1;
  39559. });
  39560. const dropdownMenuVisible = computed({
  39561. get() {
  39562. return expanded.value && (props.loading || !isRemoteSearchEmpty.value || props.remote && !!slots.empty) && (!debouncing.value || !isEmpty(states.previousQuery) || hasOptions.value);
  39563. },
  39564. set(val) {
  39565. expanded.value = val;
  39566. }
  39567. });
  39568. const showTagList = computed(() => {
  39569. if (!props.multiple) return [];
  39570. return props.collapseTags ? states.cachedOptions.slice(0, props.maxCollapseTags) : states.cachedOptions;
  39571. });
  39572. const collapseTagList = computed(() => {
  39573. if (!props.multiple) return [];
  39574. return props.collapseTags ? states.cachedOptions.slice(props.maxCollapseTags) : [];
  39575. });
  39576. const { createNewOption, removeNewOption, selectNewOption, clearAllNewOption } = useAllowCreate(props, states);
  39577. const toggleMenu = (event) => {
  39578. if (selectDisabled.value || props.filterable && expanded.value && event && !suffixRef.value?.contains(event.target)) return;
  39579. if (states.menuVisibleOnFocus) states.menuVisibleOnFocus = false;
  39580. else expanded.value = !expanded.value;
  39581. };
  39582. const onInputChange = () => {
  39583. if (states.inputValue.length > 0 && !expanded.value) expanded.value = true;
  39584. createNewOption(states.inputValue);
  39585. nextTick(() => {
  39586. handleQueryChange(states.inputValue);
  39587. });
  39588. };
  39589. const debouncedOnInputChange = useDebounceFn(() => {
  39590. onInputChange();
  39591. debouncing.value = false;
  39592. }, debounce);
  39593. const handleQueryChange = (val) => {
  39594. if (states.previousQuery === val || isComposing.value) return;
  39595. states.previousQuery = val;
  39596. if (props.filterable && isFunction$1(props.filterMethod)) props.filterMethod(val);
  39597. else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) props.remoteMethod(val);
  39598. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptions.value.length) nextTick(checkDefaultFirstOption);
  39599. else nextTick(updateHoveringIndex);
  39600. };
  39601. /**
  39602. * find and highlight first option as default selected
  39603. * @remark
  39604. * - if the first option in dropdown list is user-created,
  39605. * it would be at the end of the optionsArray
  39606. * so find it and set hover.
  39607. * (NOTE: there must be only one user-created option in dropdown list with query)
  39608. * - if there's no user-created option in list, just find the first one as usual
  39609. * (NOTE: exclude options that are disabled or in disabled-group)
  39610. */
  39611. const checkDefaultFirstOption = () => {
  39612. const optionsInDropdown = filteredOptions.value.filter((n) => !n.disabled && n.type !== "Group");
  39613. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  39614. const firstOriginOption = optionsInDropdown[0];
  39615. states.hoveringIndex = getValueIndex(filteredOptions.value, userCreatedOption || firstOriginOption);
  39616. };
  39617. const emitChange = (val) => {
  39618. if (!isEqual$1(props.modelValue, val)) emit(CHANGE_EVENT, val);
  39619. };
  39620. const update = (val) => {
  39621. emit(UPDATE_MODEL_EVENT, val);
  39622. emitChange(val);
  39623. states.previousValue = props.multiple ? String(val) : val;
  39624. nextTick(() => {
  39625. if (props.multiple && isArray$1(props.modelValue)) {
  39626. const cachedOptions = states.cachedOptions.slice();
  39627. const selectedOptions = props.modelValue.map((value) => getOption(value, cachedOptions));
  39628. if (!isEqual$1(states.cachedOptions, selectedOptions)) states.cachedOptions = selectedOptions;
  39629. } else initStates(true);
  39630. });
  39631. };
  39632. const getValueIndex = (arr = [], value) => {
  39633. if (!isObject$1(value)) return arr.indexOf(value);
  39634. const valueKey = props.valueKey;
  39635. let index = -1;
  39636. arr.some((item, i) => {
  39637. if (get(item, valueKey) === get(value, valueKey)) {
  39638. index = i;
  39639. return true;
  39640. }
  39641. return false;
  39642. });
  39643. return index;
  39644. };
  39645. const getValueKey = (item) => {
  39646. return isObject$1(item) ? get(item, props.valueKey) : item;
  39647. };
  39648. const handleResize = () => {
  39649. calculatePopperSize();
  39650. };
  39651. const resetSelectionWidth = () => {
  39652. states.selectionWidth = Number.parseFloat(window.getComputedStyle(selectionRef.value).width);
  39653. };
  39654. const resetCollapseItemWidth = () => {
  39655. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  39656. };
  39657. const updateTooltip = () => {
  39658. tooltipRef.value?.updatePopper?.();
  39659. };
  39660. const updateTagTooltip = () => {
  39661. tagTooltipRef.value?.updatePopper?.();
  39662. };
  39663. const onSelect = (option) => {
  39664. const optionValue = getValue(option);
  39665. if (props.multiple) {
  39666. let selectedOptions = props.modelValue.slice();
  39667. const index = getValueIndex(selectedOptions, optionValue);
  39668. if (index > -1) {
  39669. selectedOptions = [...selectedOptions.slice(0, index), ...selectedOptions.slice(index + 1)];
  39670. states.cachedOptions.splice(index, 1);
  39671. removeNewOption(option);
  39672. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  39673. selectedOptions = [...selectedOptions, optionValue];
  39674. states.cachedOptions.push(option);
  39675. selectNewOption(option);
  39676. }
  39677. update(selectedOptions);
  39678. if (option.created) handleQueryChange("");
  39679. if (props.filterable && (option.created || !props.reserveKeyword)) states.inputValue = "";
  39680. } else {
  39681. states.selectedLabel = getLabel(option);
  39682. !isEqual$1(props.modelValue, optionValue) && update(optionValue);
  39683. expanded.value = false;
  39684. selectNewOption(option);
  39685. if (!option.created) clearAllNewOption();
  39686. }
  39687. focus();
  39688. };
  39689. const deleteTag = (event, option) => {
  39690. let selectedOptions = props.modelValue.slice();
  39691. const index = getValueIndex(selectedOptions, getValue(option));
  39692. if (index > -1 && !selectDisabled.value) {
  39693. selectedOptions = [...props.modelValue.slice(0, index), ...props.modelValue.slice(index + 1)];
  39694. states.cachedOptions.splice(index, 1);
  39695. update(selectedOptions);
  39696. emit("remove-tag", getValue(option));
  39697. removeNewOption(option);
  39698. }
  39699. event.stopPropagation();
  39700. focus();
  39701. };
  39702. const focus = () => {
  39703. inputRef.value?.focus();
  39704. };
  39705. const blur = () => {
  39706. if (expanded.value) {
  39707. expanded.value = false;
  39708. nextTick(() => inputRef.value?.blur());
  39709. return;
  39710. }
  39711. inputRef.value?.blur();
  39712. };
  39713. const handleEsc = () => {
  39714. if (states.inputValue.length > 0) states.inputValue = "";
  39715. else expanded.value = false;
  39716. };
  39717. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.cachedOptions.some((option) => getValue(option) === it && getDisabled(option)));
  39718. const handleDel = (e) => {
  39719. const code = getEventCode(e);
  39720. if (!props.multiple) return;
  39721. if (code === EVENT_CODE.delete) return;
  39722. if (states.inputValue.length === 0) {
  39723. e.preventDefault();
  39724. const selected = props.modelValue.slice();
  39725. const lastNotDisabledIndex = getLastNotDisabledIndex(selected);
  39726. if (lastNotDisabledIndex < 0) return;
  39727. const removeTagValue = selected[lastNotDisabledIndex];
  39728. selected.splice(lastNotDisabledIndex, 1);
  39729. const option = states.cachedOptions[lastNotDisabledIndex];
  39730. states.cachedOptions.splice(lastNotDisabledIndex, 1);
  39731. removeNewOption(option);
  39732. update(selected);
  39733. emit("remove-tag", removeTagValue);
  39734. }
  39735. };
  39736. const handleClear = () => {
  39737. let emptyValue;
  39738. if (isArray$1(props.modelValue)) emptyValue = [];
  39739. else emptyValue = valueOnClear.value;
  39740. states.selectedLabel = "";
  39741. expanded.value = false;
  39742. update(emptyValue);
  39743. emit("clear");
  39744. clearAllNewOption();
  39745. focus();
  39746. };
  39747. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  39748. const options = filteredOptions.value;
  39749. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value || isComposing.value) return;
  39750. if (!expanded.value) return toggleMenu();
  39751. if (isUndefined(hoveringIndex)) hoveringIndex = states.hoveringIndex;
  39752. let newIndex = -1;
  39753. if (direction === "forward") {
  39754. newIndex = hoveringIndex + 1;
  39755. if (newIndex >= options.length) newIndex = 0;
  39756. } else if (direction === "backward") {
  39757. newIndex = hoveringIndex - 1;
  39758. if (newIndex < 0 || newIndex >= options.length) newIndex = options.length - 1;
  39759. }
  39760. const option = options[newIndex];
  39761. if (getDisabled(option) || option.type === "Group") return onKeyboardNavigate(direction, newIndex);
  39762. else {
  39763. states.hoveringIndex = newIndex;
  39764. scrollToItem(newIndex);
  39765. }
  39766. };
  39767. const onKeyboardSelect = () => {
  39768. if (!expanded.value) return toggleMenu();
  39769. else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) onSelect(filteredOptions.value[states.hoveringIndex]);
  39770. };
  39771. const onHoverOption = (idx) => {
  39772. states.hoveringIndex = idx ?? -1;
  39773. };
  39774. const updateHoveringIndex = () => {
  39775. if (!props.multiple) states.hoveringIndex = filteredOptions.value.findIndex((item) => {
  39776. return getValueKey(getValue(item)) === getValueKey(props.modelValue);
  39777. });
  39778. else {
  39779. const length = props.modelValue.length;
  39780. if (length > 0) {
  39781. const lastValue = props.modelValue[length - 1];
  39782. states.hoveringIndex = filteredOptions.value.findIndex((item) => getValueKey(lastValue) === getValueKey(getValue(item)));
  39783. } else states.hoveringIndex = -1;
  39784. }
  39785. };
  39786. const onInput = (event) => {
  39787. states.inputValue = event.target.value;
  39788. if (props.remote) {
  39789. debouncing.value = true;
  39790. debouncedOnInputChange();
  39791. } else return onInputChange();
  39792. };
  39793. const handleClickOutside = (event) => {
  39794. expanded.value = false;
  39795. if (isFocused.value) handleBlur(new FocusEvent("blur", event));
  39796. };
  39797. const handleMenuEnter = () => {
  39798. states.isBeforeHide = false;
  39799. return nextTick(() => {
  39800. if (~indexRef.value) scrollToItem(indexRef.value);
  39801. });
  39802. };
  39803. const scrollToItem = (index) => {
  39804. menuRef.value.scrollToItem(index);
  39805. };
  39806. const getOption = (value, cachedOptions) => {
  39807. const selectValue = getValueKey(value);
  39808. if (allOptionsValueMap.value.has(selectValue)) {
  39809. const { option } = allOptionsValueMap.value.get(selectValue);
  39810. return option;
  39811. }
  39812. if (cachedOptions && cachedOptions.length) {
  39813. const option = cachedOptions.find((option) => getValueKey(getValue(option)) === selectValue);
  39814. if (option) return option;
  39815. }
  39816. return {
  39817. [aliasProps.value.value]: value,
  39818. [aliasProps.value.label]: value
  39819. };
  39820. };
  39821. const getIndex = (option) => allOptionsValueMap.value.get(getValue(option))?.index ?? -1;
  39822. const initStates = (needUpdateSelectedLabel = false) => {
  39823. if (props.multiple) if (props.modelValue.length > 0) {
  39824. const cachedOptions = states.cachedOptions.slice();
  39825. states.cachedOptions.length = 0;
  39826. states.previousValue = props.modelValue.toString();
  39827. for (const value of props.modelValue) {
  39828. const option = getOption(value, cachedOptions);
  39829. states.cachedOptions.push(option);
  39830. }
  39831. } else {
  39832. states.cachedOptions = [];
  39833. states.previousValue = void 0;
  39834. }
  39835. else if (hasModelValue.value) {
  39836. states.previousValue = props.modelValue;
  39837. const options = filteredOptions.value;
  39838. const selectedItemIndex = options.findIndex((option) => getValueKey(getValue(option)) === getValueKey(props.modelValue));
  39839. if (~selectedItemIndex) states.selectedLabel = getLabel(options[selectedItemIndex]);
  39840. else if (!states.selectedLabel || needUpdateSelectedLabel) states.selectedLabel = getValueKey(props.modelValue);
  39841. } else {
  39842. states.selectedLabel = "";
  39843. states.previousValue = void 0;
  39844. }
  39845. clearAllNewOption();
  39846. calculatePopperSize();
  39847. };
  39848. watch(() => props.fitInputWidth, () => {
  39849. calculatePopperSize();
  39850. });
  39851. watch(expanded, (val) => {
  39852. if (val) {
  39853. if (!props.persistent) calculatePopperSize();
  39854. handleQueryChange("");
  39855. } else {
  39856. states.inputValue = "";
  39857. states.previousQuery = null;
  39858. states.isBeforeHide = true;
  39859. states.menuVisibleOnFocus = false;
  39860. createNewOption("");
  39861. }
  39862. });
  39863. watch(() => props.modelValue, (val, oldVal) => {
  39864. if (!val || isArray$1(val) && val.length === 0 || props.multiple && !isEqual$1(val.toString(), states.previousValue) || !props.multiple && getValueKey(val) !== getValueKey(states.previousValue)) initStates(true);
  39865. if (!isEqual$1(val, oldVal) && props.validateEvent) elFormItem?.validate?.("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  39866. }, { deep: true });
  39867. watch(() => props.options, () => {
  39868. const input = inputRef.value;
  39869. if (!input || input && document.activeElement !== input) initStates();
  39870. }, {
  39871. deep: true,
  39872. flush: "post"
  39873. });
  39874. watch(() => filteredOptions.value, () => {
  39875. calculatePopperSize();
  39876. return menuRef.value && nextTick(menuRef.value.resetScrollTop);
  39877. });
  39878. watchEffect(() => {
  39879. if (states.isBeforeHide) return;
  39880. updateOptions();
  39881. });
  39882. watchEffect(() => {
  39883. const { valueKey, options } = props;
  39884. const duplicateValue = /* @__PURE__ */ new Map();
  39885. for (const item of options) {
  39886. const optionValue = getValue(item);
  39887. let v = optionValue;
  39888. if (isObject$1(v)) v = get(optionValue, valueKey);
  39889. if (duplicateValue.get(v)) {
  39890. /* @__PURE__ */ debugWarn("ElSelectV2", `The option values you provided seem to be duplicated, which may cause some problems, please check.`);
  39891. break;
  39892. } else duplicateValue.set(v, true);
  39893. }
  39894. });
  39895. onMounted(() => {
  39896. initStates();
  39897. });
  39898. useResizeObserver(selectRef, handleResize);
  39899. useResizeObserver(selectionRef, resetSelectionWidth);
  39900. useResizeObserver(wrapperRef, updateTooltip);
  39901. useResizeObserver(tagMenuRef, updateTagTooltip);
  39902. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  39903. let stop;
  39904. watch(() => dropdownMenuVisible.value, (newVal) => {
  39905. if (newVal) stop = useResizeObserver(menuRef, updateTooltip).stop;
  39906. else {
  39907. stop?.();
  39908. stop = void 0;
  39909. }
  39910. emit("visible-change", newVal);
  39911. });
  39912. return {
  39913. inputId,
  39914. collapseTagSize,
  39915. currentPlaceholder,
  39916. expanded,
  39917. emptyText,
  39918. popupHeight,
  39919. debounce,
  39920. allOptions,
  39921. allOptionsValueMap,
  39922. filteredOptions,
  39923. iconComponent,
  39924. iconReverse,
  39925. tagStyle,
  39926. collapseTagStyle,
  39927. popperSize,
  39928. dropdownMenuVisible,
  39929. hasModelValue,
  39930. shouldShowPlaceholder,
  39931. selectDisabled,
  39932. selectSize,
  39933. needStatusIcon,
  39934. showClearBtn,
  39935. states,
  39936. isFocused,
  39937. nsSelect,
  39938. nsInput,
  39939. inputRef,
  39940. menuRef,
  39941. tagMenuRef,
  39942. tooltipRef,
  39943. tagTooltipRef,
  39944. selectRef,
  39945. wrapperRef,
  39946. selectionRef,
  39947. prefixRef,
  39948. suffixRef,
  39949. collapseItemRef,
  39950. popperRef,
  39951. validateState,
  39952. validateIcon,
  39953. showTagList,
  39954. collapseTagList,
  39955. debouncedOnInputChange,
  39956. deleteTag,
  39957. getLabel,
  39958. getValue,
  39959. getDisabled,
  39960. getValueKey,
  39961. getIndex,
  39962. handleClear,
  39963. handleClickOutside,
  39964. handleDel,
  39965. handleEsc,
  39966. focus,
  39967. blur,
  39968. handleMenuEnter,
  39969. handleResize,
  39970. resetSelectionWidth,
  39971. updateTooltip,
  39972. updateTagTooltip,
  39973. updateOptions,
  39974. toggleMenu,
  39975. scrollTo: scrollToItem,
  39976. onInput,
  39977. onKeyboardNavigate,
  39978. onKeyboardSelect,
  39979. onSelect,
  39980. onHover: onHoverOption,
  39981. handleCompositionStart,
  39982. handleCompositionEnd,
  39983. handleCompositionUpdate
  39984. };
  39985. };
  39986. //#endregion
  39987. //#region ../../packages/components/select-v2/src/select.vue?vue&type=script&lang.ts
  39988. var select_vue_vue_type_script_lang_default = defineComponent({
  39989. name: "ElSelectV2",
  39990. components: {
  39991. ElSelectMenu: select_dropdown_default,
  39992. ElTag,
  39993. ElTooltip,
  39994. ElIcon
  39995. },
  39996. directives: { ClickOutside },
  39997. props: selectV2Props,
  39998. emits: selectV2Emits,
  39999. setup(props, { emit }) {
  40000. const modelValue = computed(() => {
  40001. const { modelValue: rawModelValue, multiple } = props;
  40002. const fallback = multiple ? [] : void 0;
  40003. if (isArray$1(rawModelValue)) return multiple ? rawModelValue : fallback;
  40004. return multiple ? fallback : rawModelValue;
  40005. });
  40006. const API = useSelect$1(reactive({
  40007. ...toRefs(props),
  40008. modelValue
  40009. }), emit);
  40010. const { calculatorRef, inputStyle } = useCalcInputWidth();
  40011. const contentId = useId();
  40012. provide(selectV2InjectionKey, {
  40013. props: reactive({
  40014. ...toRefs(props),
  40015. height: API.popupHeight,
  40016. modelValue
  40017. }),
  40018. expanded: API.expanded,
  40019. tooltipRef: API.tooltipRef,
  40020. contentId,
  40021. onSelect: API.onSelect,
  40022. onHover: API.onHover,
  40023. onKeyboardNavigate: API.onKeyboardNavigate,
  40024. onKeyboardSelect: API.onKeyboardSelect
  40025. });
  40026. const selectedLabel = computed(() => {
  40027. if (!props.multiple) return API.states.selectedLabel;
  40028. return API.states.cachedOptions.map((i) => API.getLabel(i));
  40029. });
  40030. return {
  40031. ...API,
  40032. modelValue,
  40033. selectedLabel,
  40034. calculatorRef,
  40035. inputStyle,
  40036. contentId,
  40037. BORDER_HORIZONTAL_WIDTH
  40038. };
  40039. }
  40040. });
  40041. //#endregion
  40042. //#region ../../packages/components/select-v2/src/select.vue
  40043. const _hoisted_1$21 = [
  40044. "id",
  40045. "value",
  40046. "autocomplete",
  40047. "tabindex",
  40048. "aria-expanded",
  40049. "aria-label",
  40050. "disabled",
  40051. "aria-controls",
  40052. "aria-activedescendant",
  40053. "readonly",
  40054. "name"
  40055. ];
  40056. const _hoisted_2$13 = ["textContent"];
  40057. const _hoisted_3$5 = { key: 1 };
  40058. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  40059. const _component_el_tag = resolveComponent("el-tag");
  40060. const _component_el_tooltip = resolveComponent("el-tooltip");
  40061. const _component_el_icon = resolveComponent("el-icon");
  40062. const _component_el_select_menu = resolveComponent("el-select-menu");
  40063. const _directive_click_outside = resolveDirective("click-outside");
  40064. return withDirectives((openBlock(), createElementBlock("div", {
  40065. ref: "selectRef",
  40066. class: normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  40067. onMouseenter: _cache[15] || (_cache[15] = ($event) => _ctx.states.inputHovering = true),
  40068. onMouseleave: _cache[16] || (_cache[16] = ($event) => _ctx.states.inputHovering = false)
  40069. }, [createVNode(_component_el_tooltip, {
  40070. ref: "tooltipRef",
  40071. visible: _ctx.dropdownMenuVisible,
  40072. teleported: _ctx.teleported,
  40073. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  40074. "popper-style": _ctx.popperStyle,
  40075. "gpu-acceleration": false,
  40076. "stop-popper-mouse-event": false,
  40077. "popper-options": _ctx.popperOptions,
  40078. "fallback-placements": _ctx.fallbackPlacements,
  40079. effect: _ctx.effect,
  40080. placement: _ctx.placement,
  40081. pure: "",
  40082. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  40083. trigger: "click",
  40084. persistent: _ctx.persistent,
  40085. "append-to": _ctx.appendTo,
  40086. "show-arrow": _ctx.showArrow,
  40087. offset: _ctx.offset,
  40088. onBeforeShow: _ctx.handleMenuEnter,
  40089. onHide: _cache[14] || (_cache[14] = ($event) => _ctx.states.isBeforeHide = false)
  40090. }, {
  40091. default: withCtx(() => [createElementVNode("div", {
  40092. ref: "wrapperRef",
  40093. class: normalizeClass([
  40094. _ctx.nsSelect.e("wrapper"),
  40095. _ctx.nsSelect.is("focused", _ctx.isFocused),
  40096. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  40097. _ctx.nsSelect.is("filterable", _ctx.filterable),
  40098. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  40099. ]),
  40100. onClick: _cache[11] || (_cache[11] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["prevent"]))
  40101. }, [
  40102. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
  40103. key: 0,
  40104. ref: "prefixRef",
  40105. class: normalizeClass(_ctx.nsSelect.e("prefix"))
  40106. }, [renderSlot(_ctx.$slots, "prefix")], 2)) : createCommentVNode("v-if", true),
  40107. createElementVNode("div", {
  40108. ref: "selectionRef",
  40109. class: normalizeClass([_ctx.nsSelect.e("selection"), _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.modelValue.length)])
  40110. }, [
  40111. _ctx.multiple ? renderSlot(_ctx.$slots, "tag", {
  40112. key: 0,
  40113. data: _ctx.states.cachedOptions,
  40114. deleteTag: _ctx.deleteTag,
  40115. selectDisabled: _ctx.selectDisabled
  40116. }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  40117. return openBlock(), createElementBlock("div", {
  40118. key: _ctx.getValueKey(_ctx.getValue(item)),
  40119. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  40120. }, [createVNode(_component_el_tag, {
  40121. closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
  40122. size: _ctx.collapseTagSize,
  40123. type: _ctx.tagType,
  40124. effect: _ctx.tagEffect,
  40125. "disable-transitions": "",
  40126. style: normalizeStyle(_ctx.tagStyle),
  40127. onClose: ($event) => _ctx.deleteTag($event, item)
  40128. }, {
  40129. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, [renderSlot(_ctx.$slots, "label", {
  40130. index: _ctx.getIndex(item),
  40131. label: _ctx.getLabel(item),
  40132. value: _ctx.getValue(item)
  40133. }, () => [createTextVNode(toDisplayString(_ctx.getLabel(item)), 1)])], 2)]),
  40134. _: 2
  40135. }, 1032, [
  40136. "closable",
  40137. "size",
  40138. "type",
  40139. "effect",
  40140. "style",
  40141. "onClose"
  40142. ])], 2);
  40143. }), 128)), _ctx.collapseTags && _ctx.states.cachedOptions.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
  40144. key: 0,
  40145. ref: "tagTooltipRef",
  40146. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  40147. "fallback-placements": _ctx.tagTooltip?.fallbackPlacements ?? [
  40148. "bottom",
  40149. "top",
  40150. "right",
  40151. "left"
  40152. ],
  40153. effect: _ctx.tagTooltip?.effect ?? _ctx.effect,
  40154. placement: _ctx.tagTooltip?.placement ?? "bottom",
  40155. "popper-class": _ctx.tagTooltip?.popperClass ?? _ctx.popperClass,
  40156. "popper-style": _ctx.tagTooltip?.popperStyle ?? _ctx.popperStyle,
  40157. teleported: _ctx.tagTooltip?.teleported ?? _ctx.teleported,
  40158. "append-to": _ctx.tagTooltip?.appendTo ?? _ctx.appendTo,
  40159. "popper-options": _ctx.tagTooltip?.popperOptions ?? _ctx.popperOptions,
  40160. transition: _ctx.tagTooltip?.transition,
  40161. "show-after": _ctx.tagTooltip?.showAfter,
  40162. "hide-after": _ctx.tagTooltip?.hideAfter,
  40163. "auto-close": _ctx.tagTooltip?.autoClose,
  40164. offset: _ctx.tagTooltip?.offset
  40165. }, {
  40166. default: withCtx(() => [createElementVNode("div", {
  40167. ref: "collapseItemRef",
  40168. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  40169. }, [createVNode(_component_el_tag, {
  40170. closable: false,
  40171. size: _ctx.collapseTagSize,
  40172. type: _ctx.tagType,
  40173. effect: _ctx.tagEffect,
  40174. style: normalizeStyle(_ctx.collapseTagStyle),
  40175. "disable-transitions": ""
  40176. }, {
  40177. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, " + " + toDisplayString(_ctx.states.cachedOptions.length - _ctx.maxCollapseTags), 3)]),
  40178. _: 1
  40179. }, 8, [
  40180. "size",
  40181. "type",
  40182. "effect",
  40183. "style"
  40184. ])], 2)]),
  40185. content: withCtx(() => [createElementVNode("div", {
  40186. ref: "tagMenuRef",
  40187. class: normalizeClass(_ctx.nsSelect.e("selection"))
  40188. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (selected) => {
  40189. return openBlock(), createElementBlock("div", {
  40190. key: _ctx.getValueKey(_ctx.getValue(selected)),
  40191. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  40192. }, [createVNode(_component_el_tag, {
  40193. class: "in-tooltip",
  40194. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  40195. size: _ctx.collapseTagSize,
  40196. type: _ctx.tagType,
  40197. effect: _ctx.tagEffect,
  40198. "disable-transitions": "",
  40199. onClose: ($event) => _ctx.deleteTag($event, selected)
  40200. }, {
  40201. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, [renderSlot(_ctx.$slots, "label", {
  40202. index: _ctx.getIndex(selected),
  40203. label: _ctx.getLabel(selected),
  40204. value: _ctx.getValue(selected)
  40205. }, () => [createTextVNode(toDisplayString(_ctx.getLabel(selected)), 1)])], 2)]),
  40206. _: 2
  40207. }, 1032, [
  40208. "closable",
  40209. "size",
  40210. "type",
  40211. "effect",
  40212. "onClose"
  40213. ])], 2);
  40214. }), 128))], 2)]),
  40215. _: 3
  40216. }, 8, [
  40217. "disabled",
  40218. "fallback-placements",
  40219. "effect",
  40220. "placement",
  40221. "popper-class",
  40222. "popper-style",
  40223. "teleported",
  40224. "append-to",
  40225. "popper-options",
  40226. "transition",
  40227. "show-after",
  40228. "hide-after",
  40229. "auto-close",
  40230. "offset"
  40231. ])) : createCommentVNode("v-if", true)]) : createCommentVNode("v-if", true),
  40232. createElementVNode("div", { class: normalizeClass([
  40233. _ctx.nsSelect.e("selected-item"),
  40234. _ctx.nsSelect.e("input-wrapper"),
  40235. _ctx.nsSelect.is("hidden", !_ctx.filterable || _ctx.selectDisabled || !_ctx.states.inputValue && !_ctx.isFocused)
  40236. ]) }, [createElementVNode("input", {
  40237. id: _ctx.inputId,
  40238. ref: "inputRef",
  40239. value: _ctx.states.inputValue,
  40240. style: normalizeStyle(_ctx.inputStyle),
  40241. autocomplete: _ctx.autocomplete,
  40242. tabindex: _ctx.tabindex,
  40243. "aria-autocomplete": "none",
  40244. "aria-haspopup": "listbox",
  40245. autocapitalize: "off",
  40246. "aria-expanded": _ctx.expanded,
  40247. "aria-label": _ctx.ariaLabel,
  40248. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  40249. disabled: _ctx.selectDisabled,
  40250. role: "combobox",
  40251. "aria-controls": _ctx.contentId,
  40252. "aria-activedescendant": _ctx.states.hoveringIndex >= 0 ? `${_ctx.contentId}-${_ctx.states.hoveringIndex}` : "",
  40253. readonly: !_ctx.filterable,
  40254. spellcheck: "false",
  40255. type: "text",
  40256. name: _ctx.name,
  40257. onInput: _cache[0] || (_cache[0] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  40258. onChange: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])),
  40259. onCompositionstart: _cache[2] || (_cache[2] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  40260. onCompositionupdate: _cache[3] || (_cache[3] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  40261. onCompositionend: _cache[4] || (_cache[4] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  40262. onKeydown: [
  40263. _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  40264. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  40265. _cache[7] || (_cache[7] = withKeys(withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  40266. _cache[8] || (_cache[8] = withKeys(withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])),
  40267. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.handleDel && _ctx.handleDel(...args), ["stop"]), ["delete"]))
  40268. ],
  40269. onClick: _cache[10] || (_cache[10] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  40270. }, null, 46, _hoisted_1$21), _ctx.filterable ? (openBlock(), createElementBlock("span", {
  40271. key: 0,
  40272. ref: "calculatorRef",
  40273. "aria-hidden": "true",
  40274. class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
  40275. textContent: toDisplayString(_ctx.states.inputValue)
  40276. }, null, 10, _hoisted_2$13)) : createCommentVNode("v-if", true)], 2),
  40277. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
  40278. key: 1,
  40279. class: normalizeClass([
  40280. _ctx.nsSelect.e("selected-item"),
  40281. _ctx.nsSelect.e("placeholder"),
  40282. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  40283. ])
  40284. }, [_ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
  40285. key: 0,
  40286. index: _ctx.allOptionsValueMap.get(_ctx.modelValue)?.index ?? -1,
  40287. label: _ctx.currentPlaceholder,
  40288. value: _ctx.modelValue
  40289. }, () => [createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)]) : (openBlock(), createElementBlock("span", _hoisted_3$5, toDisplayString(_ctx.currentPlaceholder), 1))], 2)) : createCommentVNode("v-if", true)
  40290. ], 2),
  40291. createElementVNode("div", {
  40292. ref: "suffixRef",
  40293. class: normalizeClass(_ctx.nsSelect.e("suffix"))
  40294. }, [
  40295. _ctx.iconComponent ? withDirectives((openBlock(), createBlock(_component_el_icon, {
  40296. key: 0,
  40297. class: normalizeClass([
  40298. _ctx.nsSelect.e("caret"),
  40299. _ctx.nsInput.e("icon"),
  40300. _ctx.iconReverse
  40301. ])
  40302. }, {
  40303. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))]),
  40304. _: 1
  40305. }, 8, ["class"])), [[vShow, !_ctx.showClearBtn]]) : createCommentVNode("v-if", true),
  40306. _ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  40307. key: 1,
  40308. class: normalizeClass([
  40309. _ctx.nsSelect.e("caret"),
  40310. _ctx.nsInput.e("icon"),
  40311. _ctx.nsSelect.e("clear")
  40312. ]),
  40313. onClick: withModifiers(_ctx.handleClear, ["prevent", "stop"])
  40314. }, {
  40315. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))]),
  40316. _: 1
  40317. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  40318. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
  40319. key: 2,
  40320. class: normalizeClass([
  40321. _ctx.nsInput.e("icon"),
  40322. _ctx.nsInput.e("validateIcon"),
  40323. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  40324. ])
  40325. }, {
  40326. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))]),
  40327. _: 1
  40328. }, 8, ["class"])) : createCommentVNode("v-if", true)
  40329. ], 2)
  40330. ], 2)]),
  40331. content: withCtx(() => [createVNode(_component_el_select_menu, {
  40332. id: _ctx.contentId,
  40333. ref: "menuRef",
  40334. data: _ctx.filteredOptions,
  40335. width: _ctx.popperSize - _ctx.BORDER_HORIZONTAL_WIDTH,
  40336. "hovering-index": _ctx.states.hoveringIndex,
  40337. "scrollbar-always-on": _ctx.scrollbarAlwaysOn,
  40338. "aria-label": _ctx.ariaLabel
  40339. }, createSlots({
  40340. default: withCtx((scope) => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(scope)))]),
  40341. _: 2
  40342. }, [
  40343. _ctx.$slots.header ? {
  40344. name: "header",
  40345. fn: withCtx(() => [createElementVNode("div", {
  40346. class: normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  40347. onClick: _cache[12] || (_cache[12] = withModifiers(() => {}, ["stop"]))
  40348. }, [renderSlot(_ctx.$slots, "header")], 2)]),
  40349. key: "0"
  40350. } : void 0,
  40351. _ctx.$slots.loading && _ctx.loading ? {
  40352. name: "loading",
  40353. fn: withCtx(() => [createElementVNode("div", { class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading")) }, [renderSlot(_ctx.$slots, "loading")], 2)]),
  40354. key: "1"
  40355. } : _ctx.loading || _ctx.filteredOptions.length === 0 ? {
  40356. name: "empty",
  40357. fn: withCtx(() => [createElementVNode("div", { class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty")) }, [renderSlot(_ctx.$slots, "empty", {}, () => [createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)])], 2)]),
  40358. key: "2"
  40359. } : void 0,
  40360. _ctx.$slots.footer ? {
  40361. name: "footer",
  40362. fn: withCtx(() => [createElementVNode("div", {
  40363. class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  40364. onClick: _cache[13] || (_cache[13] = withModifiers(() => {}, ["stop"]))
  40365. }, [renderSlot(_ctx.$slots, "footer")], 2)]),
  40366. key: "3"
  40367. } : void 0
  40368. ]), 1032, [
  40369. "id",
  40370. "data",
  40371. "width",
  40372. "hovering-index",
  40373. "scrollbar-always-on",
  40374. "aria-label"
  40375. ])]),
  40376. _: 3
  40377. }, 8, [
  40378. "visible",
  40379. "teleported",
  40380. "popper-class",
  40381. "popper-style",
  40382. "popper-options",
  40383. "fallback-placements",
  40384. "effect",
  40385. "placement",
  40386. "transition",
  40387. "persistent",
  40388. "append-to",
  40389. "show-arrow",
  40390. "offset",
  40391. "onBeforeShow"
  40392. ])], 34)), [[
  40393. _directive_click_outside,
  40394. _ctx.handleClickOutside,
  40395. _ctx.popperRef
  40396. ]]);
  40397. }
  40398. var select_default = /* @__PURE__ */ _plugin_vue_export_helper_default(select_vue_vue_type_script_lang_default, [["render", _sfc_render$5]]);
  40399. //#endregion
  40400. //#region ../../packages/components/select-v2/index.ts
  40401. const ElSelectV2 = withInstall(select_default);
  40402. //#endregion
  40403. //#region ../../packages/components/skeleton/src/skeleton.ts
  40404. /**
  40405. * @deprecated Removed after 3.0.0, Use `SkeletonProps` instead.
  40406. */
  40407. const skeletonProps = buildProps({
  40408. animated: Boolean,
  40409. count: {
  40410. type: Number,
  40411. default: 1
  40412. },
  40413. rows: {
  40414. type: Number,
  40415. default: 3
  40416. },
  40417. loading: {
  40418. type: Boolean,
  40419. default: true
  40420. },
  40421. throttle: { type: definePropType([Number, Object]) }
  40422. });
  40423. //#endregion
  40424. //#region ../../packages/components/skeleton/src/skeleton-item.ts
  40425. /**
  40426. * @deprecated Removed after 3.0.0, Use `SkeletonItemProps` instead.
  40427. */
  40428. const skeletonItemProps = buildProps({ variant: {
  40429. type: String,
  40430. values: [
  40431. "circle",
  40432. "rect",
  40433. "h1",
  40434. "h3",
  40435. "text",
  40436. "caption",
  40437. "p",
  40438. "image",
  40439. "button"
  40440. ],
  40441. default: "text"
  40442. } });
  40443. //#endregion
  40444. //#region ../../packages/components/skeleton/src/skeleton-item.vue?vue&type=script&setup=true&lang.ts
  40445. var skeleton_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  40446. name: "ElSkeletonItem",
  40447. __name: "skeleton-item",
  40448. props: skeletonItemProps,
  40449. setup(__props) {
  40450. const ns = useNamespace("skeleton");
  40451. return (_ctx, _cache) => {
  40452. return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).e("item"), unref(ns).e(__props.variant)]) }, [__props.variant === "image" ? (openBlock(), createBlock(unref(picture_filled_default), { key: 0 })) : createCommentVNode("v-if", true)], 2);
  40453. };
  40454. }
  40455. });
  40456. //#endregion
  40457. //#region ../../packages/components/skeleton/src/skeleton-item.vue
  40458. var skeleton_item_default = skeleton_item_vue_vue_type_script_setup_true_lang_default;
  40459. //#endregion
  40460. //#region ../../packages/components/skeleton/src/skeleton.vue?vue&type=script&setup=true&lang.ts
  40461. var skeleton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  40462. name: "ElSkeleton",
  40463. __name: "skeleton",
  40464. props: skeletonProps,
  40465. setup(__props, { expose: __expose }) {
  40466. const props = __props;
  40467. const ns = useNamespace("skeleton");
  40468. const uiLoading = useThrottleRender(toRef(props, "loading"), props.throttle);
  40469. __expose({ uiLoading });
  40470. return (_ctx, _cache) => {
  40471. return unref(uiLoading) ? (openBlock(), createElementBlock("div", mergeProps({
  40472. key: 0,
  40473. class: [unref(ns).b(), unref(ns).is("animated", __props.animated)]
  40474. }, _ctx.$attrs), [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.count, (i) => {
  40475. return openBlock(), createElementBlock(Fragment, { key: i }, [unref(uiLoading) ? renderSlot(_ctx.$slots, "template", { key: i }, () => [createVNode(skeleton_item_default, {
  40476. class: normalizeClass(unref(ns).is("first")),
  40477. variant: "p"
  40478. }, null, 8, ["class"]), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.rows, (item) => {
  40479. return openBlock(), createBlock(skeleton_item_default, {
  40480. key: item,
  40481. class: normalizeClass([unref(ns).e("paragraph"), unref(ns).is("last", item === __props.rows && __props.rows > 1)]),
  40482. variant: "p"
  40483. }, null, 8, ["class"]);
  40484. }), 128))]) : createCommentVNode("v-if", true)], 64);
  40485. }), 128))], 16)) : renderSlot(_ctx.$slots, "default", normalizeProps(mergeProps({ key: 1 }, _ctx.$attrs)));
  40486. };
  40487. }
  40488. });
  40489. //#endregion
  40490. //#region ../../packages/components/skeleton/src/skeleton.vue
  40491. var skeleton_default = skeleton_vue_vue_type_script_setup_true_lang_default;
  40492. //#endregion
  40493. //#region ../../packages/components/skeleton/index.ts
  40494. const ElSkeleton = withInstall(skeleton_default, { SkeletonItem: skeleton_item_default });
  40495. const ElSkeletonItem = withNoopInstall(skeleton_item_default);
  40496. //#endregion
  40497. //#region ../../packages/components/slider/src/constants.ts
  40498. const sliderContextKey = Symbol("sliderContextKey");
  40499. //#endregion
  40500. //#region ../../packages/components/slider/src/slider.ts
  40501. const sliderProps = buildProps({
  40502. modelValue: {
  40503. type: definePropType([Number, Array]),
  40504. default: 0
  40505. },
  40506. id: {
  40507. type: String,
  40508. default: void 0
  40509. },
  40510. min: {
  40511. type: Number,
  40512. default: 0
  40513. },
  40514. max: {
  40515. type: Number,
  40516. default: 100
  40517. },
  40518. step: {
  40519. type: definePropType([Number, String]),
  40520. default: 1
  40521. },
  40522. showInput: Boolean,
  40523. showInputControls: {
  40524. type: Boolean,
  40525. default: true
  40526. },
  40527. size: useSizeProp,
  40528. inputSize: useSizeProp,
  40529. showStops: Boolean,
  40530. showTooltip: {
  40531. type: Boolean,
  40532. default: true
  40533. },
  40534. formatTooltip: {
  40535. type: definePropType(Function),
  40536. default: void 0
  40537. },
  40538. disabled: {
  40539. type: Boolean,
  40540. default: void 0
  40541. },
  40542. range: Boolean,
  40543. vertical: Boolean,
  40544. height: String,
  40545. rangeStartLabel: {
  40546. type: String,
  40547. default: void 0
  40548. },
  40549. rangeEndLabel: {
  40550. type: String,
  40551. default: void 0
  40552. },
  40553. formatValueText: {
  40554. type: definePropType(Function),
  40555. default: void 0
  40556. },
  40557. tooltipClass: {
  40558. type: String,
  40559. default: void 0
  40560. },
  40561. placement: {
  40562. type: String,
  40563. values: Ee,
  40564. default: "top"
  40565. },
  40566. marks: { type: definePropType(Object) },
  40567. validateEvent: {
  40568. type: Boolean,
  40569. default: true
  40570. },
  40571. persistent: {
  40572. type: Boolean,
  40573. default: true
  40574. },
  40575. ...useAriaProps(["ariaLabel"])
  40576. });
  40577. const isValidValue$1 = (value) => isNumber(value) || isArray$1(value) && value.every(isNumber);
  40578. const sliderEmits = {
  40579. [UPDATE_MODEL_EVENT]: isValidValue$1,
  40580. [INPUT_EVENT]: isValidValue$1,
  40581. [CHANGE_EVENT]: isValidValue$1
  40582. };
  40583. //#endregion
  40584. //#region ../../packages/components/slider/src/composables/use-lifecycle.ts
  40585. const useLifecycle = (props, initData, resetSize) => {
  40586. const sliderWrapper = ref();
  40587. onMounted(async () => {
  40588. if (props.range) {
  40589. if (isArray$1(props.modelValue)) {
  40590. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  40591. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  40592. } else {
  40593. initData.firstValue = props.min;
  40594. initData.secondValue = props.max;
  40595. }
  40596. initData.oldValue = [initData.firstValue, initData.secondValue];
  40597. } else {
  40598. if (!isNumber(props.modelValue) || Number.isNaN(props.modelValue)) initData.firstValue = props.min;
  40599. else initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  40600. initData.oldValue = initData.firstValue;
  40601. }
  40602. useEventListener(window, "resize", resetSize);
  40603. await nextTick();
  40604. resetSize();
  40605. });
  40606. return { sliderWrapper };
  40607. };
  40608. //#endregion
  40609. //#region ../../packages/components/slider/src/composables/use-marks.ts
  40610. const useMarks = (props) => {
  40611. const markList = computed(() => {
  40612. if (!props.marks) return [];
  40613. return Object.keys(props.marks).map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  40614. point,
  40615. position: (point - props.min) * 100 / (props.max - props.min),
  40616. mark: props.marks[point]
  40617. }));
  40618. });
  40619. watchEffect(() => {
  40620. if (props.step === "mark" && !props.marks) /* @__PURE__ */ debugWarn("ElSlider", "marks prop must be provided when step is mark");
  40621. if (props.marks) {
  40622. const keys = Object.keys(props.marks);
  40623. const validPoints = markList.value.map((m) => m.point);
  40624. const invalidKeys = keys.filter((key) => {
  40625. const parsed = Number.parseFloat(key);
  40626. return Number.isNaN(parsed) || !validPoints.includes(parsed);
  40627. });
  40628. if (invalidKeys.length > 0) /* @__PURE__ */ debugWarn("ElSlider", `Some marks keys are invalid (not a number or out of [min, max]): [${invalidKeys.map((k) => `'${k}'`).join(", ")}] and will be ignored.`);
  40629. }
  40630. });
  40631. return markList;
  40632. };
  40633. //#endregion
  40634. //#region ../../packages/components/slider/src/composables/use-slide.ts
  40635. const useSlide = (props, initData, emit) => {
  40636. const { formItem: elFormItem } = useFormItem();
  40637. const slider = shallowRef();
  40638. const firstButton = ref();
  40639. const secondButton = ref();
  40640. const buttonRefs = {
  40641. firstButton,
  40642. secondButton
  40643. };
  40644. const sliderDisabled = useFormDisabled();
  40645. const minValue = computed(() => {
  40646. return Math.min(initData.firstValue, initData.secondValue);
  40647. });
  40648. const maxValue = computed(() => {
  40649. return Math.max(initData.firstValue, initData.secondValue);
  40650. });
  40651. const barSize = computed(() => {
  40652. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  40653. });
  40654. const barStart = computed(() => {
  40655. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  40656. });
  40657. const runwayStyle = computed(() => {
  40658. return props.vertical ? { height: props.height } : {};
  40659. });
  40660. const barStyle = computed(() => {
  40661. return props.vertical ? {
  40662. height: barSize.value,
  40663. bottom: barStart.value
  40664. } : {
  40665. width: barSize.value,
  40666. left: barStart.value
  40667. };
  40668. });
  40669. const resetSize = () => {
  40670. if (slider.value) initData.sliderSize = slider.value.getBoundingClientRect()[props.vertical ? "height" : "width"];
  40671. };
  40672. const getButtonRefByPercent = (percent) => {
  40673. const targetValue = props.min + percent * (props.max - props.min) / 100;
  40674. if (!props.range) return firstButton;
  40675. let buttonRefName;
  40676. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  40677. else buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  40678. return buttonRefs[buttonRefName];
  40679. };
  40680. const setPosition = (percent) => {
  40681. const buttonRef = getButtonRefByPercent(percent);
  40682. buttonRef.value.setPosition(percent);
  40683. return buttonRef;
  40684. };
  40685. const setFirstValue = (firstValue) => {
  40686. initData.firstValue = firstValue ?? props.min;
  40687. _emit(props.range ? [minValue.value, maxValue.value] : firstValue ?? props.min);
  40688. };
  40689. const setSecondValue = (secondValue) => {
  40690. initData.secondValue = secondValue;
  40691. if (props.range) _emit([minValue.value, maxValue.value]);
  40692. };
  40693. const _emit = (val) => {
  40694. emit(UPDATE_MODEL_EVENT, val);
  40695. emit(INPUT_EVENT, val);
  40696. };
  40697. const emitChange = async () => {
  40698. await nextTick();
  40699. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  40700. };
  40701. const handleSliderPointerEvent = (event) => {
  40702. if (sliderDisabled.value || initData.dragging) return;
  40703. resetSize();
  40704. let newPercent = 0;
  40705. if (props.vertical) {
  40706. const clientY = event.touches?.item(0)?.clientY ?? event.clientY;
  40707. newPercent = (slider.value.getBoundingClientRect().bottom - clientY) / initData.sliderSize * 100;
  40708. } else newPercent = ((event.touches?.item(0)?.clientX ?? event.clientX) - slider.value.getBoundingClientRect().left) / initData.sliderSize * 100;
  40709. if (newPercent < 0 || newPercent > 100) return;
  40710. return setPosition(newPercent);
  40711. };
  40712. const onSliderWrapperPrevent = (event) => {
  40713. if (buttonRefs["firstButton"].value?.dragging || buttonRefs["secondButton"].value?.dragging) event.preventDefault();
  40714. };
  40715. const onSliderDown = async (event) => {
  40716. const buttonRef = handleSliderPointerEvent(event);
  40717. if (buttonRef) {
  40718. await nextTick();
  40719. buttonRef.value.onButtonDown(event);
  40720. }
  40721. };
  40722. const onSliderClick = (event) => {
  40723. if (handleSliderPointerEvent(event)) emitChange();
  40724. };
  40725. const onSliderMarkerDown = (position) => {
  40726. if (sliderDisabled.value || initData.dragging) return;
  40727. if (setPosition(position)) emitChange();
  40728. };
  40729. return {
  40730. elFormItem,
  40731. slider,
  40732. firstButton,
  40733. secondButton,
  40734. sliderDisabled,
  40735. minValue,
  40736. maxValue,
  40737. runwayStyle,
  40738. barStyle,
  40739. resetSize,
  40740. setPosition,
  40741. emitChange,
  40742. onSliderWrapperPrevent,
  40743. onSliderClick,
  40744. onSliderDown,
  40745. onSliderMarkerDown,
  40746. setFirstValue,
  40747. setSecondValue
  40748. };
  40749. };
  40750. //#endregion
  40751. //#region ../../packages/components/slider/src/composables/use-slider-button.ts
  40752. const useTooltip = (props, formatTooltip, showTooltip) => {
  40753. const tooltip = ref();
  40754. const tooltipVisible = ref(false);
  40755. const enableFormat = computed(() => {
  40756. return formatTooltip.value instanceof Function;
  40757. });
  40758. return {
  40759. tooltip,
  40760. tooltipVisible,
  40761. formatValue: computed(() => {
  40762. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  40763. }),
  40764. displayTooltip: debounce(() => {
  40765. showTooltip.value && (tooltipVisible.value = true);
  40766. }, 50),
  40767. hideTooltip: debounce(() => {
  40768. showTooltip.value && (tooltipVisible.value = false);
  40769. }, 50)
  40770. };
  40771. };
  40772. const useSliderButton = (props, initData, emit) => {
  40773. const { disabled, min, max, step, showTooltip, persistent, precision, sliderSize, formatTooltip, emitChange, resetSize, updateDragging, markList } = inject(sliderContextKey);
  40774. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  40775. const button = ref();
  40776. const currentPosition = computed(() => {
  40777. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  40778. });
  40779. const wrapperStyle = computed(() => {
  40780. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  40781. });
  40782. const shouldMoveToMark = computed(() => {
  40783. return step.value === "mark" && markList.value.length > 0;
  40784. });
  40785. const handleMouseEnter = () => {
  40786. initData.hovering = true;
  40787. displayTooltip();
  40788. };
  40789. const handleMouseLeave = () => {
  40790. initData.hovering = false;
  40791. if (!initData.dragging) hideTooltip();
  40792. };
  40793. const onButtonDown = (event) => {
  40794. if (disabled.value) return;
  40795. event.preventDefault();
  40796. onDragStart(event);
  40797. window.addEventListener("mousemove", onDragging);
  40798. window.addEventListener("touchmove", onDragging);
  40799. window.addEventListener("mouseup", onDragEnd);
  40800. window.addEventListener("touchend", onDragEnd);
  40801. window.addEventListener("contextmenu", onDragEnd);
  40802. button.value.focus();
  40803. };
  40804. const incrementPosition = (amount) => {
  40805. if (disabled.value) return;
  40806. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  40807. setPosition(initData.newPosition);
  40808. emitChange();
  40809. };
  40810. const moveToMark = (amount) => {
  40811. if (disabled.value || !markList.value.length) return;
  40812. const current = props.modelValue;
  40813. const epsilon = Number.EPSILON;
  40814. const stride = Math.abs(amount);
  40815. let target;
  40816. if (amount > 0) {
  40817. const startIndex = markList.value.findIndex((m) => m.point > current + epsilon);
  40818. if (startIndex !== -1) {
  40819. const targetIndex = Math.min(startIndex + stride - 1, markList.value.length - 1);
  40820. target = markList.value[targetIndex].point;
  40821. }
  40822. } else {
  40823. let startIndex = -1;
  40824. for (let i = markList.value.length - 1; i >= 0; i--) if (markList.value[i].point < current - epsilon) {
  40825. startIndex = i;
  40826. break;
  40827. }
  40828. if (startIndex !== -1) {
  40829. const targetIndex = Math.max(startIndex - (stride - 1), 0);
  40830. target = markList.value[targetIndex].point;
  40831. }
  40832. }
  40833. if (target !== void 0 && target !== current) {
  40834. setPosition((target - min.value) / (max.value - min.value) * 100);
  40835. emitChange();
  40836. }
  40837. };
  40838. const onLeftKeyDown = () => {
  40839. if (shouldMoveToMark.value) moveToMark(-1);
  40840. else if (isNumber(step.value)) incrementPosition(-step.value);
  40841. };
  40842. const onRightKeyDown = () => {
  40843. if (shouldMoveToMark.value) moveToMark(1);
  40844. else if (isNumber(step.value)) incrementPosition(step.value);
  40845. };
  40846. const onPageDownKeyDown = () => {
  40847. if (shouldMoveToMark.value) moveToMark(-4);
  40848. else if (isNumber(step.value)) incrementPosition(-step.value * 4);
  40849. };
  40850. const onPageUpKeyDown = () => {
  40851. if (shouldMoveToMark.value) moveToMark(4);
  40852. else if (isNumber(step.value)) incrementPosition(step.value * 4);
  40853. };
  40854. const onHomeKeyDown = () => {
  40855. if (disabled.value) return;
  40856. setPosition(0);
  40857. emitChange();
  40858. };
  40859. const onEndKeyDown = () => {
  40860. if (disabled.value) return;
  40861. setPosition(100);
  40862. emitChange();
  40863. };
  40864. const onKeyDown = (event) => {
  40865. const code = getEventCode(event);
  40866. let isPreventDefault = true;
  40867. switch (code) {
  40868. case EVENT_CODE.left:
  40869. case EVENT_CODE.down:
  40870. onLeftKeyDown();
  40871. break;
  40872. case EVENT_CODE.right:
  40873. case EVENT_CODE.up:
  40874. onRightKeyDown();
  40875. break;
  40876. case EVENT_CODE.home:
  40877. onHomeKeyDown();
  40878. break;
  40879. case EVENT_CODE.end:
  40880. onEndKeyDown();
  40881. break;
  40882. case EVENT_CODE.pageDown:
  40883. onPageDownKeyDown();
  40884. break;
  40885. case EVENT_CODE.pageUp:
  40886. onPageUpKeyDown();
  40887. break;
  40888. default:
  40889. isPreventDefault = false;
  40890. break;
  40891. }
  40892. isPreventDefault && event.preventDefault();
  40893. };
  40894. const getClientXY = (event) => {
  40895. let clientX;
  40896. let clientY;
  40897. if (event.type.startsWith("touch")) {
  40898. clientY = event.touches[0].clientY;
  40899. clientX = event.touches[0].clientX;
  40900. } else {
  40901. clientY = event.clientY;
  40902. clientX = event.clientX;
  40903. }
  40904. return {
  40905. clientX,
  40906. clientY
  40907. };
  40908. };
  40909. const onDragStart = (event) => {
  40910. initData.dragging = true;
  40911. initData.isClick = true;
  40912. const { clientX, clientY } = getClientXY(event);
  40913. if (props.vertical) initData.startY = clientY;
  40914. else initData.startX = clientX;
  40915. initData.startPosition = Number.parseFloat(currentPosition.value);
  40916. initData.newPosition = initData.startPosition;
  40917. };
  40918. const onDragging = (event) => {
  40919. if (initData.dragging) {
  40920. initData.isClick = false;
  40921. displayTooltip();
  40922. resetSize();
  40923. let diff;
  40924. const { clientX, clientY } = getClientXY(event);
  40925. if (props.vertical) {
  40926. initData.currentY = clientY;
  40927. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  40928. } else {
  40929. initData.currentX = clientX;
  40930. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  40931. }
  40932. initData.newPosition = initData.startPosition + diff;
  40933. setPosition(initData.newPosition);
  40934. }
  40935. };
  40936. const onDragEnd = () => {
  40937. if (initData.dragging) {
  40938. setTimeout(() => {
  40939. initData.dragging = false;
  40940. if (!initData.hovering) hideTooltip();
  40941. if (!initData.isClick) setPosition(initData.newPosition);
  40942. emitChange();
  40943. }, 0);
  40944. window.removeEventListener("mousemove", onDragging);
  40945. window.removeEventListener("touchmove", onDragging);
  40946. window.removeEventListener("mouseup", onDragEnd);
  40947. window.removeEventListener("touchend", onDragEnd);
  40948. window.removeEventListener("contextmenu", onDragEnd);
  40949. }
  40950. };
  40951. const setPosition = async (newPosition) => {
  40952. if (newPosition === null || Number.isNaN(+newPosition)) return;
  40953. newPosition = clamp$1(newPosition, 0, 100);
  40954. let value;
  40955. if (step.value === "mark") if (markList.value.length === 0) value = newPosition <= 50 ? min.value : max.value;
  40956. else value = markList.value.reduce((prev, curr) => {
  40957. return Math.abs(curr.position - newPosition) < Math.abs(prev.position - newPosition) ? curr : prev;
  40958. }).point;
  40959. else {
  40960. const fullSteps = Math.floor((max.value - min.value) / step.value);
  40961. const fullRangePercentage = fullSteps * step.value / (max.value - min.value) * 100;
  40962. const threshold = fullRangePercentage + (100 - fullRangePercentage) / 2;
  40963. if (newPosition < fullRangePercentage) {
  40964. const valueBetween = fullRangePercentage / fullSteps;
  40965. const steps = Math.round(newPosition / valueBetween);
  40966. value = min.value + steps * step.value;
  40967. } else if (newPosition < threshold) value = min.value + fullSteps * step.value;
  40968. else value = max.value;
  40969. value = Number.parseFloat(value.toFixed(precision.value));
  40970. }
  40971. if (value !== props.modelValue) emit(UPDATE_MODEL_EVENT, value);
  40972. if (!initData.dragging && props.modelValue !== initData.oldValue) initData.oldValue = props.modelValue;
  40973. await nextTick();
  40974. initData.dragging && displayTooltip();
  40975. tooltip.value.updatePopper();
  40976. };
  40977. watch(() => initData.dragging, (val) => {
  40978. updateDragging(val);
  40979. });
  40980. useEventListener(button, "touchstart", onButtonDown, { passive: false });
  40981. return {
  40982. disabled,
  40983. button,
  40984. tooltip,
  40985. tooltipVisible,
  40986. showTooltip,
  40987. persistent,
  40988. wrapperStyle,
  40989. formatValue,
  40990. handleMouseEnter,
  40991. handleMouseLeave,
  40992. onButtonDown,
  40993. onKeyDown,
  40994. setPosition
  40995. };
  40996. };
  40997. //#endregion
  40998. //#region ../../packages/components/slider/src/composables/use-stops.ts
  40999. const useStops = (props, initData, minValue, maxValue) => {
  41000. const stops = computed(() => {
  41001. if (!props.showStops || props.min > props.max) return [];
  41002. if (props.step === "mark" || props.step === 0) {
  41003. if (props.step === 0) /* @__PURE__ */ debugWarn("ElSlider", "step should not be 0.");
  41004. return [];
  41005. }
  41006. const stopCount = Math.ceil((props.max - props.min) / props.step);
  41007. const stepWidth = 100 * props.step / (props.max - props.min);
  41008. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  41009. if (props.range) return result.filter((step) => {
  41010. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  41011. });
  41012. else return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  41013. });
  41014. const getStopStyle = (position) => {
  41015. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  41016. };
  41017. return {
  41018. stops,
  41019. getStopStyle
  41020. };
  41021. };
  41022. //#endregion
  41023. //#region ../../packages/components/slider/src/composables/use-watch.ts
  41024. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  41025. const _emit = (val) => {
  41026. emit(UPDATE_MODEL_EVENT, val);
  41027. emit(INPUT_EVENT, val);
  41028. };
  41029. const valueChanged = () => {
  41030. if (props.range) return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  41031. else return props.modelValue !== initData.oldValue;
  41032. };
  41033. const setValues = () => {
  41034. if (props.min > props.max) throwError("Slider", "min should not be greater than max.");
  41035. const val = props.modelValue;
  41036. if (props.range && isArray$1(val)) if (val[1] < props.min) _emit([props.min, props.min]);
  41037. else if (val[0] > props.max) _emit([props.max, props.max]);
  41038. else if (val[0] < props.min) _emit([props.min, val[1]]);
  41039. else if (val[1] > props.max) _emit([val[0], props.max]);
  41040. else {
  41041. initData.firstValue = val[0];
  41042. initData.secondValue = val[1];
  41043. if (valueChanged()) {
  41044. if (props.validateEvent) elFormItem?.validate?.("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  41045. initData.oldValue = val.slice();
  41046. }
  41047. }
  41048. else if (!props.range && isNumber(val) && !Number.isNaN(val)) if (val < props.min) _emit(props.min);
  41049. else if (val > props.max) _emit(props.max);
  41050. else {
  41051. initData.firstValue = val;
  41052. if (valueChanged()) {
  41053. if (props.validateEvent) elFormItem?.validate?.("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  41054. initData.oldValue = val;
  41055. }
  41056. }
  41057. };
  41058. setValues();
  41059. watch(() => initData.dragging, (val) => {
  41060. if (!val) setValues();
  41061. });
  41062. watch(() => props.modelValue, (val, oldVal) => {
  41063. if (initData.dragging || isArray$1(val) && isArray$1(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) return;
  41064. setValues();
  41065. }, { deep: true });
  41066. watch(() => [props.min, props.max], () => {
  41067. setValues();
  41068. });
  41069. };
  41070. //#endregion
  41071. //#region ../../packages/components/slider/src/button.ts
  41072. const sliderButtonProps = buildProps({
  41073. modelValue: {
  41074. type: Number,
  41075. default: 0
  41076. },
  41077. vertical: Boolean,
  41078. tooltipClass: String,
  41079. placement: {
  41080. type: String,
  41081. values: Ee,
  41082. default: "top"
  41083. }
  41084. });
  41085. const sliderButtonEmits = { [UPDATE_MODEL_EVENT]: (value) => isNumber(value) };
  41086. //#endregion
  41087. //#region ../../packages/components/slider/src/button.vue?vue&type=script&setup=true&lang.ts
  41088. const _hoisted_1$20 = ["tabindex"];
  41089. var button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  41090. name: "ElSliderButton",
  41091. __name: "button",
  41092. props: sliderButtonProps,
  41093. emits: sliderButtonEmits,
  41094. setup(__props, { expose: __expose, emit: __emit }) {
  41095. const props = __props;
  41096. const emit = __emit;
  41097. const ns = useNamespace("slider");
  41098. const initData = reactive({
  41099. hovering: false,
  41100. dragging: false,
  41101. isClick: false,
  41102. startX: 0,
  41103. currentX: 0,
  41104. startY: 0,
  41105. currentY: 0,
  41106. startPosition: 0,
  41107. newPosition: 0,
  41108. oldValue: props.modelValue
  41109. });
  41110. const tooltipPersistent = computed(() => !showTooltip.value ? false : persistent.value);
  41111. const { disabled, button, tooltip, showTooltip, persistent, tooltipVisible, wrapperStyle, formatValue, handleMouseEnter, handleMouseLeave, onButtonDown, onKeyDown, setPosition } = useSliderButton(props, initData, emit);
  41112. const { hovering, dragging } = toRefs(initData);
  41113. __expose({
  41114. onButtonDown,
  41115. onKeyDown,
  41116. setPosition,
  41117. hovering,
  41118. dragging
  41119. });
  41120. return (_ctx, _cache) => {
  41121. return openBlock(), createElementBlock("div", {
  41122. ref_key: "button",
  41123. ref: button,
  41124. class: normalizeClass([unref(ns).e("button-wrapper"), {
  41125. hover: unref(hovering),
  41126. dragging: unref(dragging)
  41127. }]),
  41128. style: normalizeStyle(unref(wrapperStyle)),
  41129. tabindex: unref(disabled) ? void 0 : 0,
  41130. onMouseenter: _cache[0] || (_cache[0] = (...args) => unref(handleMouseEnter) && unref(handleMouseEnter)(...args)),
  41131. onMouseleave: _cache[1] || (_cache[1] = (...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args)),
  41132. onMousedown: _cache[2] || (_cache[2] = (...args) => unref(onButtonDown) && unref(onButtonDown)(...args)),
  41133. onFocus: _cache[3] || (_cache[3] = (...args) => unref(handleMouseEnter) && unref(handleMouseEnter)(...args)),
  41134. onBlur: _cache[4] || (_cache[4] = (...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args)),
  41135. onKeydown: _cache[5] || (_cache[5] = (...args) => unref(onKeyDown) && unref(onKeyDown)(...args))
  41136. }, [createVNode(unref(ElTooltip), {
  41137. ref_key: "tooltip",
  41138. ref: tooltip,
  41139. visible: unref(tooltipVisible),
  41140. placement: _ctx.placement,
  41141. "fallback-placements": [
  41142. "top",
  41143. "bottom",
  41144. "right",
  41145. "left"
  41146. ],
  41147. "stop-popper-mouse-event": false,
  41148. "popper-class": _ctx.tooltipClass,
  41149. disabled: !unref(showTooltip),
  41150. persistent: tooltipPersistent.value
  41151. }, {
  41152. content: withCtx(() => [createElementVNode("span", null, toDisplayString(unref(formatValue)), 1)]),
  41153. default: withCtx(() => [createElementVNode("div", { class: normalizeClass([unref(ns).e("button"), {
  41154. hover: unref(hovering),
  41155. dragging: unref(dragging)
  41156. }]) }, null, 2)]),
  41157. _: 1
  41158. }, 8, [
  41159. "visible",
  41160. "placement",
  41161. "popper-class",
  41162. "disabled",
  41163. "persistent"
  41164. ])], 46, _hoisted_1$20);
  41165. };
  41166. }
  41167. });
  41168. //#endregion
  41169. //#region ../../packages/components/slider/src/button.vue
  41170. var button_default = button_vue_vue_type_script_setup_true_lang_default;
  41171. //#endregion
  41172. //#region ../../packages/components/slider/src/marker.ts
  41173. const sliderMarkerProps = buildProps({ mark: {
  41174. type: definePropType([String, Object]),
  41175. default: void 0
  41176. } });
  41177. var marker_default = defineComponent({
  41178. name: "ElSliderMarker",
  41179. props: sliderMarkerProps,
  41180. setup(props) {
  41181. const ns = useNamespace("slider");
  41182. const label = computed(() => {
  41183. return isString(props.mark) ? props.mark : props.mark.label;
  41184. });
  41185. const style = computed(() => isString(props.mark) ? void 0 : props.mark.style);
  41186. return () => h("div", {
  41187. class: ns.e("marks-text"),
  41188. style: style.value
  41189. }, label.value);
  41190. }
  41191. });
  41192. //#endregion
  41193. //#region ../../packages/components/slider/src/slider.vue?vue&type=script&setup=true&lang.ts
  41194. const _hoisted_1$19 = [
  41195. "id",
  41196. "role",
  41197. "aria-label",
  41198. "aria-labelledby"
  41199. ];
  41200. const _hoisted_2$12 = { key: 1 };
  41201. var slider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  41202. name: "ElSlider",
  41203. __name: "slider",
  41204. props: sliderProps,
  41205. emits: sliderEmits,
  41206. setup(__props, { expose: __expose, emit: __emit }) {
  41207. const props = __props;
  41208. const emit = __emit;
  41209. const ns = useNamespace("slider");
  41210. const { t } = useLocale();
  41211. const initData = reactive({
  41212. firstValue: 0,
  41213. secondValue: 0,
  41214. oldValue: 0,
  41215. dragging: false,
  41216. sliderSize: 1
  41217. });
  41218. const { elFormItem, slider, firstButton, secondButton, sliderDisabled, minValue, maxValue, runwayStyle, barStyle, resetSize, emitChange, onSliderWrapperPrevent, onSliderClick, onSliderDown, onSliderMarkerDown, setFirstValue, setSecondValue } = useSlide(props, initData, emit);
  41219. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  41220. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: elFormItem });
  41221. const sliderWrapperSize = useFormSize();
  41222. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  41223. const renderInput = computed(() => {
  41224. return props.showInput && !props.range && props.step !== "mark";
  41225. });
  41226. const groupLabel = computed(() => {
  41227. return props.ariaLabel || t("el.slider.defaultLabel", {
  41228. min: props.min,
  41229. max: props.max
  41230. });
  41231. });
  41232. const firstButtonLabel = computed(() => {
  41233. if (props.range) return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  41234. else return groupLabel.value;
  41235. });
  41236. const firstValueText = computed(() => {
  41237. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  41238. });
  41239. const secondButtonLabel = computed(() => {
  41240. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  41241. });
  41242. const secondValueText = computed(() => {
  41243. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  41244. });
  41245. const sliderKls = computed(() => [
  41246. ns.b(),
  41247. ns.m(sliderWrapperSize.value),
  41248. ns.is("vertical", props.vertical),
  41249. { [ns.m("with-input")]: renderInput.value }
  41250. ]);
  41251. const markList = useMarks(props);
  41252. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  41253. const sliderInputStep = computed(() => {
  41254. return isNumber(props.step) ? props.step : 1;
  41255. });
  41256. const precision = computed(() => {
  41257. const stepValue = isNumber(props.step) ? props.step : 1;
  41258. const precisions = [
  41259. props.min,
  41260. props.max,
  41261. stepValue
  41262. ].map((item) => {
  41263. const decimal = `${item}`.split(".")[1];
  41264. return decimal ? decimal.length : 0;
  41265. });
  41266. return Math.max.apply(null, precisions);
  41267. });
  41268. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  41269. const { firstValue, secondValue, sliderSize } = toRefs(initData);
  41270. const updateDragging = (val) => {
  41271. initData.dragging = val;
  41272. };
  41273. useEventListener(sliderWrapper, "touchstart", onSliderWrapperPrevent, { passive: false });
  41274. useEventListener(sliderWrapper, "touchmove", onSliderWrapperPrevent, { passive: false });
  41275. provide(sliderContextKey, {
  41276. ...toRefs(props),
  41277. sliderSize,
  41278. disabled: sliderDisabled,
  41279. precision,
  41280. markList,
  41281. emitChange,
  41282. resetSize,
  41283. updateDragging
  41284. });
  41285. __expose({ onSliderClick });
  41286. return (_ctx, _cache) => {
  41287. return openBlock(), createElementBlock("div", {
  41288. id: _ctx.range ? unref(inputId) : void 0,
  41289. ref_key: "sliderWrapper",
  41290. ref: sliderWrapper,
  41291. class: normalizeClass(sliderKls.value),
  41292. role: _ctx.range ? "group" : void 0,
  41293. "aria-label": _ctx.range && !unref(isLabeledByFormItem) ? groupLabel.value : void 0,
  41294. "aria-labelledby": _ctx.range && unref(isLabeledByFormItem) ? unref(elFormItem)?.labelId : void 0
  41295. }, [createElementVNode("div", {
  41296. ref_key: "slider",
  41297. ref: slider,
  41298. class: normalizeClass([
  41299. unref(ns).e("runway"),
  41300. { "show-input": renderInput.value },
  41301. unref(ns).is("disabled", unref(sliderDisabled))
  41302. ]),
  41303. style: normalizeStyle(unref(runwayStyle)),
  41304. onMousedown: _cache[0] || (_cache[0] = (...args) => unref(onSliderDown) && unref(onSliderDown)(...args)),
  41305. onTouchstartPassive: _cache[1] || (_cache[1] = (...args) => unref(onSliderDown) && unref(onSliderDown)(...args))
  41306. }, [
  41307. createElementVNode("div", {
  41308. class: normalizeClass(unref(ns).e("bar")),
  41309. style: normalizeStyle(unref(barStyle))
  41310. }, null, 6),
  41311. createVNode(button_default, {
  41312. id: !_ctx.range ? unref(inputId) : void 0,
  41313. ref_key: "firstButton",
  41314. ref: firstButton,
  41315. "model-value": unref(firstValue),
  41316. vertical: _ctx.vertical,
  41317. "tooltip-class": _ctx.tooltipClass,
  41318. placement: _ctx.placement,
  41319. role: "slider",
  41320. "aria-label": _ctx.range || !unref(isLabeledByFormItem) ? firstButtonLabel.value : void 0,
  41321. "aria-labelledby": !_ctx.range && unref(isLabeledByFormItem) ? unref(elFormItem)?.labelId : void 0,
  41322. "aria-valuemin": _ctx.min,
  41323. "aria-valuemax": _ctx.range ? unref(secondValue) : _ctx.max,
  41324. "aria-valuenow": unref(firstValue),
  41325. "aria-valuetext": firstValueText.value,
  41326. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  41327. "aria-disabled": unref(sliderDisabled),
  41328. "onUpdate:modelValue": unref(setFirstValue)
  41329. }, null, 8, [
  41330. "id",
  41331. "model-value",
  41332. "vertical",
  41333. "tooltip-class",
  41334. "placement",
  41335. "aria-label",
  41336. "aria-labelledby",
  41337. "aria-valuemin",
  41338. "aria-valuemax",
  41339. "aria-valuenow",
  41340. "aria-valuetext",
  41341. "aria-orientation",
  41342. "aria-disabled",
  41343. "onUpdate:modelValue"
  41344. ]),
  41345. _ctx.range ? (openBlock(), createBlock(button_default, {
  41346. key: 0,
  41347. ref_key: "secondButton",
  41348. ref: secondButton,
  41349. "model-value": unref(secondValue),
  41350. vertical: _ctx.vertical,
  41351. "tooltip-class": _ctx.tooltipClass,
  41352. placement: _ctx.placement,
  41353. role: "slider",
  41354. "aria-label": secondButtonLabel.value,
  41355. "aria-valuemin": unref(firstValue),
  41356. "aria-valuemax": _ctx.max,
  41357. "aria-valuenow": unref(secondValue),
  41358. "aria-valuetext": secondValueText.value,
  41359. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  41360. "aria-disabled": unref(sliderDisabled),
  41361. "onUpdate:modelValue": unref(setSecondValue)
  41362. }, null, 8, [
  41363. "model-value",
  41364. "vertical",
  41365. "tooltip-class",
  41366. "placement",
  41367. "aria-label",
  41368. "aria-valuemin",
  41369. "aria-valuemax",
  41370. "aria-valuenow",
  41371. "aria-valuetext",
  41372. "aria-orientation",
  41373. "aria-disabled",
  41374. "onUpdate:modelValue"
  41375. ])) : createCommentVNode("v-if", true),
  41376. _ctx.showStops ? (openBlock(), createElementBlock("div", _hoisted_2$12, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(stops), (item, key) => {
  41377. return openBlock(), createElementBlock("div", {
  41378. key,
  41379. class: normalizeClass(unref(ns).e("stop")),
  41380. style: normalizeStyle(unref(getStopStyle)(item))
  41381. }, null, 6);
  41382. }), 128))])) : createCommentVNode("v-if", true),
  41383. unref(markList).length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createElementVNode("div", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  41384. return openBlock(), createElementBlock("div", {
  41385. key,
  41386. style: normalizeStyle(unref(getStopStyle)(item.position)),
  41387. class: normalizeClass([unref(ns).e("stop"), unref(ns).e("marks-stop")])
  41388. }, null, 6);
  41389. }), 128))]), createElementVNode("div", { class: normalizeClass(unref(ns).e("marks")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  41390. return openBlock(), createBlock(unref(marker_default), {
  41391. key,
  41392. mark: item.mark,
  41393. style: normalizeStyle(unref(getStopStyle)(item.position)),
  41394. onMousedown: withModifiers(($event) => unref(onSliderMarkerDown)(item.position), ["stop"])
  41395. }, null, 8, [
  41396. "mark",
  41397. "style",
  41398. "onMousedown"
  41399. ]);
  41400. }), 128))], 2)], 64)) : createCommentVNode("v-if", true)
  41401. ], 38), renderInput.value ? (openBlock(), createBlock(unref(ElInputNumber), {
  41402. key: 0,
  41403. ref: "input",
  41404. "model-value": unref(firstValue),
  41405. class: normalizeClass(unref(ns).e("input")),
  41406. step: sliderInputStep.value,
  41407. disabled: unref(sliderDisabled),
  41408. controls: _ctx.showInputControls,
  41409. min: _ctx.min,
  41410. max: _ctx.max,
  41411. precision: precision.value,
  41412. size: sliderInputSize.value,
  41413. "onUpdate:modelValue": unref(setFirstValue),
  41414. onChange: unref(emitChange)
  41415. }, null, 8, [
  41416. "model-value",
  41417. "class",
  41418. "step",
  41419. "disabled",
  41420. "controls",
  41421. "min",
  41422. "max",
  41423. "precision",
  41424. "size",
  41425. "onUpdate:modelValue",
  41426. "onChange"
  41427. ])) : createCommentVNode("v-if", true)], 10, _hoisted_1$19);
  41428. };
  41429. }
  41430. });
  41431. //#endregion
  41432. //#region ../../packages/components/slider/src/slider.vue
  41433. var slider_default = slider_vue_vue_type_script_setup_true_lang_default;
  41434. //#endregion
  41435. //#region ../../packages/components/slider/index.ts
  41436. const ElSlider = withInstall(slider_default);
  41437. //#endregion
  41438. //#region ../../packages/components/space/src/item.ts
  41439. const spaceItemProps = buildProps({ prefixCls: { type: String } });
  41440. const SpaceItem = defineComponent({
  41441. name: "ElSpaceItem",
  41442. props: spaceItemProps,
  41443. setup(props, { slots }) {
  41444. const ns = useNamespace("space");
  41445. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  41446. return () => h("div", { class: classes.value }, renderSlot(slots, "default"));
  41447. }
  41448. });
  41449. //#endregion
  41450. //#region ../../packages/components/space/src/use-space.ts
  41451. const SIZE_MAP = {
  41452. small: 8,
  41453. default: 12,
  41454. large: 16
  41455. };
  41456. function useSpace(props) {
  41457. const ns = useNamespace("space");
  41458. const classes = computed(() => [
  41459. ns.b(),
  41460. ns.m(props.direction),
  41461. props.class
  41462. ]);
  41463. const horizontalSize = ref(0);
  41464. const verticalSize = ref(0);
  41465. const containerStyle = computed(() => {
  41466. return [
  41467. props.wrap || props.fill ? { flexWrap: "wrap" } : {},
  41468. { alignItems: props.alignment },
  41469. {
  41470. rowGap: `${verticalSize.value}px`,
  41471. columnGap: `${horizontalSize.value}px`
  41472. },
  41473. props.style
  41474. ];
  41475. });
  41476. const itemStyle = computed(() => {
  41477. return props.fill ? {
  41478. flexGrow: 1,
  41479. minWidth: `${props.fillRatio}%`
  41480. } : {};
  41481. });
  41482. watchEffect(() => {
  41483. const { size = "small", wrap, direction: dir, fill } = props;
  41484. if (isArray$1(size)) {
  41485. const [h = 0, v = 0] = size;
  41486. horizontalSize.value = h;
  41487. verticalSize.value = v;
  41488. } else {
  41489. let val;
  41490. if (isNumber(size)) val = size;
  41491. else val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  41492. if ((wrap || fill) && dir === "horizontal") horizontalSize.value = verticalSize.value = val;
  41493. else if (dir === "horizontal") {
  41494. horizontalSize.value = val;
  41495. verticalSize.value = 0;
  41496. } else {
  41497. verticalSize.value = val;
  41498. horizontalSize.value = 0;
  41499. }
  41500. }
  41501. });
  41502. return {
  41503. classes,
  41504. containerStyle,
  41505. itemStyle
  41506. };
  41507. }
  41508. //#endregion
  41509. //#region ../../packages/components/space/src/space.ts
  41510. const spaceProps = buildProps({
  41511. direction: {
  41512. type: String,
  41513. values: ["horizontal", "vertical"],
  41514. default: "horizontal"
  41515. },
  41516. class: {
  41517. type: definePropType([
  41518. String,
  41519. Object,
  41520. Array
  41521. ]),
  41522. default: ""
  41523. },
  41524. style: {
  41525. type: definePropType([
  41526. String,
  41527. Array,
  41528. Object
  41529. ]),
  41530. default: ""
  41531. },
  41532. alignment: {
  41533. type: definePropType(String),
  41534. default: "center"
  41535. },
  41536. prefixCls: { type: String },
  41537. spacer: {
  41538. type: definePropType([
  41539. Object,
  41540. String,
  41541. Number,
  41542. Array
  41543. ]),
  41544. default: null,
  41545. validator: (val) => isVNode(val) || isNumber(val) || isString(val)
  41546. },
  41547. wrap: Boolean,
  41548. fill: Boolean,
  41549. fillRatio: {
  41550. type: Number,
  41551. default: 100
  41552. },
  41553. size: {
  41554. type: [
  41555. String,
  41556. Array,
  41557. Number
  41558. ],
  41559. values: componentSizes,
  41560. validator: (val) => {
  41561. return isNumber(val) || isArray$1(val) && val.length === 2 && val.every(isNumber);
  41562. }
  41563. }
  41564. });
  41565. const Space = defineComponent({
  41566. name: "ElSpace",
  41567. props: spaceProps,
  41568. setup(props, { slots }) {
  41569. const { classes, containerStyle, itemStyle } = useSpace(props);
  41570. function extractChildren(children, parentKey = "", extractedChildren = []) {
  41571. const { prefixCls } = props;
  41572. children.forEach((child, loopKey) => {
  41573. if (isFragment(child)) {
  41574. if (isArray$1(child.children)) child.children.forEach((nested, key) => {
  41575. if (isFragment(nested) && isArray$1(nested.children)) extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  41576. else if (isVNode(nested) && nested?.type === Comment) extractedChildren.push(nested);
  41577. else extractedChildren.push(createVNode(SpaceItem, {
  41578. style: itemStyle.value,
  41579. prefixCls,
  41580. key: `nested-${parentKey + key}`
  41581. }, { default: () => [nested] }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  41582. });
  41583. } else if (isValidElementNode(child)) extractedChildren.push(createVNode(SpaceItem, {
  41584. style: itemStyle.value,
  41585. prefixCls,
  41586. key: `LoopKey${parentKey + loopKey}`
  41587. }, { default: () => [child] }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  41588. });
  41589. return extractedChildren;
  41590. }
  41591. return () => {
  41592. const { spacer, direction } = props;
  41593. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  41594. if ((children.children ?? []).length === 0) return null;
  41595. if (isArray$1(children.children)) {
  41596. let extractedChildren = extractChildren(children.children);
  41597. if (spacer) {
  41598. const len = extractedChildren.length - 1;
  41599. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  41600. const children = [...acc, child];
  41601. if (idx !== len) children.push(createVNode("span", {
  41602. style: [itemStyle.value, direction === "vertical" ? "width: 100%" : null],
  41603. key: idx
  41604. }, [isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)], PatchFlags.STYLE));
  41605. return children;
  41606. }, []);
  41607. }
  41608. return createVNode("div", {
  41609. class: classes.value,
  41610. style: containerStyle.value
  41611. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  41612. }
  41613. return children.children;
  41614. };
  41615. }
  41616. });
  41617. //#endregion
  41618. //#region ../../packages/components/space/index.ts
  41619. const ElSpace = withInstall(Space);
  41620. //#endregion
  41621. //#region ../../packages/components/statistic/src/statistic.ts
  41622. /**
  41623. * @deprecated Removed after 3.0.0, Use `StatisticProps` instead.
  41624. */
  41625. const statisticProps = buildProps({
  41626. decimalSeparator: {
  41627. type: String,
  41628. default: "."
  41629. },
  41630. groupSeparator: {
  41631. type: String,
  41632. default: ","
  41633. },
  41634. precision: {
  41635. type: Number,
  41636. default: 0
  41637. },
  41638. formatter: Function,
  41639. value: {
  41640. type: definePropType([Number, Object]),
  41641. default: 0
  41642. },
  41643. prefix: String,
  41644. suffix: String,
  41645. title: String,
  41646. valueStyle: { type: definePropType([
  41647. String,
  41648. Object,
  41649. Array
  41650. ]) }
  41651. });
  41652. //#endregion
  41653. //#region ../../packages/components/statistic/src/statistic.vue?vue&type=script&setup=true&lang.ts
  41654. var statistic_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  41655. name: "ElStatistic",
  41656. __name: "statistic",
  41657. props: statisticProps,
  41658. setup(__props, { expose: __expose }) {
  41659. const props = __props;
  41660. const ns = useNamespace("statistic");
  41661. const displayValue = computed(() => {
  41662. const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
  41663. if (isFunction$1(formatter)) return formatter(value);
  41664. if (!isNumber(value) || Number.isNaN(value)) return value;
  41665. let [integer, decimal = ""] = String(value).split(".");
  41666. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  41667. integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  41668. return [integer, decimal].join(decimal ? decimalSeparator : "");
  41669. });
  41670. __expose({ displayValue });
  41671. return (_ctx, _cache) => {
  41672. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [_ctx.$slots.title || __props.title ? (openBlock(), createElementBlock("div", {
  41673. key: 0,
  41674. class: normalizeClass(unref(ns).e("head"))
  41675. }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("content")) }, [
  41676. _ctx.$slots.prefix || __props.prefix ? (openBlock(), createElementBlock("div", {
  41677. key: 0,
  41678. class: normalizeClass(unref(ns).e("prefix"))
  41679. }, [renderSlot(_ctx.$slots, "prefix", {}, () => [createElementVNode("span", null, toDisplayString(__props.prefix), 1)])], 2)) : createCommentVNode("v-if", true),
  41680. createElementVNode("span", {
  41681. class: normalizeClass(unref(ns).e("number")),
  41682. style: normalizeStyle(__props.valueStyle)
  41683. }, toDisplayString(displayValue.value), 7),
  41684. _ctx.$slots.suffix || __props.suffix ? (openBlock(), createElementBlock("div", {
  41685. key: 1,
  41686. class: normalizeClass(unref(ns).e("suffix"))
  41687. }, [renderSlot(_ctx.$slots, "suffix", {}, () => [createElementVNode("span", null, toDisplayString(__props.suffix), 1)])], 2)) : createCommentVNode("v-if", true)
  41688. ], 2)], 2);
  41689. };
  41690. }
  41691. });
  41692. //#endregion
  41693. //#region ../../packages/components/statistic/src/statistic.vue
  41694. var statistic_default = statistic_vue_vue_type_script_setup_true_lang_default;
  41695. //#endregion
  41696. //#region ../../packages/components/statistic/index.ts
  41697. const ElStatistic = withInstall(statistic_default);
  41698. //#endregion
  41699. //#region ../../packages/components/countdown/src/countdown.ts
  41700. /**
  41701. * @deprecated Removed after 3.0.0, Use `CountdownProps` instead.
  41702. */
  41703. const countdownProps = buildProps({
  41704. format: {
  41705. type: String,
  41706. default: "HH:mm:ss"
  41707. },
  41708. prefix: String,
  41709. suffix: String,
  41710. title: String,
  41711. value: {
  41712. type: definePropType([Number, Object]),
  41713. default: 0
  41714. },
  41715. valueStyle: { type: definePropType([
  41716. String,
  41717. Object,
  41718. Array
  41719. ]) }
  41720. });
  41721. const countdownEmits = {
  41722. finish: () => true,
  41723. [CHANGE_EVENT]: (value) => isNumber(value)
  41724. };
  41725. //#endregion
  41726. //#region ../../packages/components/countdown/src/utils.ts
  41727. const timeUnits$1 = [
  41728. ["Y", 1e3 * 60 * 60 * 24 * 365],
  41729. ["M", 1e3 * 60 * 60 * 24 * 30],
  41730. ["D", 1e3 * 60 * 60 * 24],
  41731. ["H", 1e3 * 60 * 60],
  41732. ["m", 1e3 * 60],
  41733. ["s", 1e3],
  41734. ["S", 1]
  41735. ];
  41736. const getTime = (value) => {
  41737. return isNumber(value) ? new Date(value).getTime() : value.valueOf();
  41738. };
  41739. const formatTime$1 = (timestamp, format) => {
  41740. let timeLeft = timestamp;
  41741. return timeUnits$1.reduce((current, [name, unit]) => {
  41742. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  41743. if (replaceRegex.test(current)) {
  41744. const value = Math.floor(timeLeft / unit);
  41745. timeLeft -= value * unit;
  41746. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  41747. }
  41748. return current;
  41749. }, format).replace(/\[([^\]]*)]/g, "$1");
  41750. };
  41751. //#endregion
  41752. //#region ../../packages/components/countdown/src/countdown.vue?vue&type=script&setup=true&lang.ts
  41753. var countdown_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  41754. name: "ElCountdown",
  41755. __name: "countdown",
  41756. props: countdownProps,
  41757. emits: countdownEmits,
  41758. setup(__props, { expose: __expose, emit: __emit }) {
  41759. const props = __props;
  41760. const emit = __emit;
  41761. let timer;
  41762. const rawValue = ref(0);
  41763. const displayValue = computed(() => formatTime$1(rawValue.value, props.format));
  41764. const formatter = (val) => formatTime$1(val, props.format);
  41765. const stopTimer = () => {
  41766. if (timer) {
  41767. cAF(timer);
  41768. timer = void 0;
  41769. }
  41770. };
  41771. const startTimer = () => {
  41772. const timestamp = getTime(props.value);
  41773. const frameFunc = () => {
  41774. let diff = timestamp - Date.now();
  41775. emit(CHANGE_EVENT, diff);
  41776. if (diff <= 0) {
  41777. diff = 0;
  41778. stopTimer();
  41779. emit("finish");
  41780. } else timer = rAF(frameFunc);
  41781. rawValue.value = diff;
  41782. };
  41783. timer = rAF(frameFunc);
  41784. };
  41785. onMounted(() => {
  41786. rawValue.value = getTime(props.value) - Date.now();
  41787. watch(() => [props.value, props.format], () => {
  41788. stopTimer();
  41789. startTimer();
  41790. }, { immediate: true });
  41791. });
  41792. onBeforeUnmount(() => {
  41793. stopTimer();
  41794. });
  41795. __expose({ displayValue });
  41796. return (_ctx, _cache) => {
  41797. return openBlock(), createBlock(unref(ElStatistic), {
  41798. value: rawValue.value,
  41799. title: __props.title,
  41800. prefix: __props.prefix,
  41801. suffix: __props.suffix,
  41802. "value-style": __props.valueStyle,
  41803. formatter
  41804. }, createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, name) => {
  41805. return {
  41806. name,
  41807. fn: withCtx(() => [renderSlot(_ctx.$slots, name)])
  41808. };
  41809. })]), 1032, [
  41810. "value",
  41811. "title",
  41812. "prefix",
  41813. "suffix",
  41814. "value-style"
  41815. ]);
  41816. };
  41817. }
  41818. });
  41819. //#endregion
  41820. //#region ../../packages/components/countdown/src/countdown.vue
  41821. var countdown_default = countdown_vue_vue_type_script_setup_true_lang_default;
  41822. //#endregion
  41823. //#region ../../packages/components/countdown/index.ts
  41824. const ElCountdown = withInstall(countdown_default);
  41825. //#endregion
  41826. //#region ../../packages/components/steps/src/steps.ts
  41827. /**
  41828. * @deprecated Removed after 3.0.0, Use `StepsProps` instead.
  41829. */
  41830. const stepsProps = buildProps({
  41831. space: {
  41832. type: [Number, String],
  41833. default: ""
  41834. },
  41835. active: {
  41836. type: Number,
  41837. default: 0
  41838. },
  41839. direction: {
  41840. type: String,
  41841. default: "horizontal",
  41842. values: ["horizontal", "vertical"]
  41843. },
  41844. alignCenter: { type: Boolean },
  41845. simple: { type: Boolean },
  41846. finishStatus: {
  41847. type: String,
  41848. values: [
  41849. "wait",
  41850. "process",
  41851. "finish",
  41852. "error",
  41853. "success"
  41854. ],
  41855. default: "finish"
  41856. },
  41857. processStatus: {
  41858. type: String,
  41859. values: [
  41860. "wait",
  41861. "process",
  41862. "finish",
  41863. "error",
  41864. "success"
  41865. ],
  41866. default: "process"
  41867. }
  41868. });
  41869. const stepsEmits = { [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber) };
  41870. //#endregion
  41871. //#region ../../packages/components/steps/src/tokens.ts
  41872. const STEPS_INJECTION_KEY = "ElSteps";
  41873. //#endregion
  41874. //#region ../../packages/components/steps/src/steps.vue?vue&type=script&setup=true&lang.ts
  41875. var steps_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  41876. name: "ElSteps",
  41877. __name: "steps",
  41878. props: stepsProps,
  41879. emits: stepsEmits,
  41880. setup(__props, { emit: __emit }) {
  41881. const props = __props;
  41882. const emit = __emit;
  41883. const ns = useNamespace("steps");
  41884. const { children: steps, addChild: addStep, removeChild: removeStep, ChildrenSorter: StepsSorter } = useOrderedChildren(getCurrentInstance(), "ElStep");
  41885. watch(steps, () => {
  41886. steps.value.forEach((instance, index) => {
  41887. instance.setIndex(index);
  41888. });
  41889. });
  41890. provide(STEPS_INJECTION_KEY, {
  41891. props,
  41892. steps,
  41893. addStep,
  41894. removeStep
  41895. });
  41896. watch(() => props.active, (newVal, oldVal) => {
  41897. emit(CHANGE_EVENT, newVal, oldVal);
  41898. });
  41899. return (_ctx, _cache) => {
  41900. return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b(), unref(ns).m(__props.simple ? "simple" : __props.direction)]) }, [renderSlot(_ctx.$slots, "default"), createVNode(unref(StepsSorter))], 2);
  41901. };
  41902. }
  41903. });
  41904. //#endregion
  41905. //#region ../../packages/components/steps/src/steps.vue
  41906. var steps_default$1 = steps_vue_vue_type_script_setup_true_lang_default;
  41907. //#endregion
  41908. //#region ../../packages/components/steps/src/item.ts
  41909. /**
  41910. * @deprecated Removed after 3.0.0, Use `StepProps` instead.
  41911. */
  41912. const stepProps = buildProps({
  41913. title: {
  41914. type: String,
  41915. default: ""
  41916. },
  41917. icon: { type: iconPropType },
  41918. description: {
  41919. type: String,
  41920. default: ""
  41921. },
  41922. status: {
  41923. type: String,
  41924. values: [
  41925. "",
  41926. "wait",
  41927. "process",
  41928. "finish",
  41929. "error",
  41930. "success"
  41931. ],
  41932. default: ""
  41933. }
  41934. });
  41935. //#endregion
  41936. //#region ../../packages/components/steps/src/item.vue?vue&type=script&setup=true&lang.ts
  41937. var item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  41938. name: "ElStep",
  41939. __name: "item",
  41940. props: stepProps,
  41941. setup(__props) {
  41942. const props = __props;
  41943. const ns = useNamespace("step");
  41944. const index = ref(-1);
  41945. const lineStyle = ref({});
  41946. const internalStatus = ref("");
  41947. const parent = inject(STEPS_INJECTION_KEY);
  41948. const currentInstance = getCurrentInstance();
  41949. let stepDiff = 0;
  41950. let beforeActive = 0;
  41951. onMounted(() => {
  41952. watch([
  41953. () => parent.props.active,
  41954. () => parent.props.processStatus,
  41955. () => parent.props.finishStatus
  41956. ], ([active], [oldActive]) => {
  41957. beforeActive = oldActive || 0;
  41958. stepDiff = active - beforeActive;
  41959. updateStatus(active);
  41960. }, { immediate: true });
  41961. });
  41962. const currentStatus = computed(() => {
  41963. return props.status || internalStatus.value;
  41964. });
  41965. const prevInternalStatus = computed(() => {
  41966. const prevStep = parent.steps.value[index.value - 1];
  41967. return prevStep ? prevStep.internalStatus.value : "wait";
  41968. });
  41969. const isCenter = computed(() => {
  41970. return parent.props.alignCenter;
  41971. });
  41972. const isVertical = computed(() => {
  41973. return parent.props.direction === "vertical";
  41974. });
  41975. const isSimple = computed(() => {
  41976. return parent.props.simple;
  41977. });
  41978. const stepsCount = computed(() => {
  41979. return parent.steps.value.length;
  41980. });
  41981. const isLast = computed(() => {
  41982. return parent.steps.value[stepsCount.value - 1]?.uid === currentInstance.uid;
  41983. });
  41984. const space = computed(() => {
  41985. return isSimple.value ? "" : parent.props.space;
  41986. });
  41987. const containerKls = computed(() => {
  41988. return [
  41989. ns.b(),
  41990. ns.is(isSimple.value ? "simple" : parent.props.direction),
  41991. ns.is("flex", isLast.value && !space.value && !isCenter.value),
  41992. ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
  41993. ];
  41994. });
  41995. const style = computed(() => {
  41996. const style = { flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%` };
  41997. if (isVertical.value) return style;
  41998. if (isLast.value) style.maxWidth = `${100 / stepsCount.value}%`;
  41999. return style;
  42000. });
  42001. const setIndex = (val) => {
  42002. index.value = val;
  42003. };
  42004. const calcProgress = (status) => {
  42005. const isWait = status === "wait";
  42006. const style = { transitionDelay: `${Math.abs(stepDiff) === 1 ? 0 : stepDiff > 0 ? (index.value + 1 - beforeActive) * 150 : -(index.value + 1 - parent.props.active) * 150}ms` };
  42007. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  42008. style.borderWidth = step && !isSimple.value ? "1px" : 0;
  42009. style[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  42010. lineStyle.value = style;
  42011. };
  42012. const updateStatus = (activeIndex) => {
  42013. if (activeIndex > index.value) internalStatus.value = parent.props.finishStatus;
  42014. else if (activeIndex === index.value && prevInternalStatus.value !== "error") internalStatus.value = parent.props.processStatus;
  42015. else internalStatus.value = "wait";
  42016. const prevChild = parent.steps.value[index.value - 1];
  42017. if (prevChild) prevChild.calcProgress(internalStatus.value);
  42018. };
  42019. const stepItemState = {
  42020. uid: currentInstance.uid,
  42021. getVnode: () => currentInstance.vnode,
  42022. currentStatus,
  42023. internalStatus,
  42024. setIndex,
  42025. calcProgress
  42026. };
  42027. parent.addStep(stepItemState);
  42028. onBeforeUnmount(() => {
  42029. parent.removeStep(stepItemState);
  42030. });
  42031. return (_ctx, _cache) => {
  42032. return openBlock(), createElementBlock("div", {
  42033. style: normalizeStyle(style.value),
  42034. class: normalizeClass(containerKls.value)
  42035. }, [
  42036. createCommentVNode(" icon & line "),
  42037. createElementVNode("div", { class: normalizeClass([unref(ns).e("head"), unref(ns).is(currentStatus.value)]) }, [!isSimple.value ? (openBlock(), createElementBlock("div", {
  42038. key: 0,
  42039. class: normalizeClass(unref(ns).e("line"))
  42040. }, [createElementVNode("i", {
  42041. class: normalizeClass(unref(ns).e("line-inner")),
  42042. style: normalizeStyle(lineStyle.value)
  42043. }, null, 6)], 2)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass([unref(ns).e("icon"), unref(ns).is(__props.icon || _ctx.$slots.icon ? "icon" : "text")]) }, [renderSlot(_ctx.$slots, "icon", {}, () => [__props.icon ? (openBlock(), createBlock(unref(ElIcon), {
  42044. key: 0,
  42045. class: normalizeClass(unref(ns).e("icon-inner"))
  42046. }, {
  42047. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  42048. _: 1
  42049. }, 8, ["class"])) : currentStatus.value === "success" ? (openBlock(), createBlock(unref(ElIcon), {
  42050. key: 1,
  42051. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  42052. }, {
  42053. default: withCtx(() => [createVNode(unref(check_default))]),
  42054. _: 1
  42055. }, 8, ["class"])) : currentStatus.value === "error" ? (openBlock(), createBlock(unref(ElIcon), {
  42056. key: 2,
  42057. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  42058. }, {
  42059. default: withCtx(() => [createVNode(unref(close_default))]),
  42060. _: 1
  42061. }, 8, ["class"])) : !isSimple.value ? (openBlock(), createElementBlock("div", {
  42062. key: 3,
  42063. class: normalizeClass(unref(ns).e("icon-inner"))
  42064. }, toDisplayString(index.value + 1), 3)) : createCommentVNode("v-if", true)])], 2)], 2),
  42065. createCommentVNode(" title & description "),
  42066. createElementVNode("div", { class: normalizeClass(unref(ns).e("main")) }, [createElementVNode("div", { class: normalizeClass([unref(ns).e("title"), unref(ns).is(currentStatus.value)]) }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2), isSimple.value ? (openBlock(), createElementBlock("div", {
  42067. key: 0,
  42068. class: normalizeClass(unref(ns).e("arrow"))
  42069. }, null, 2)) : (openBlock(), createElementBlock("div", {
  42070. key: 1,
  42071. class: normalizeClass([unref(ns).e("description"), unref(ns).is(currentStatus.value)])
  42072. }, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])], 2))], 2)
  42073. ], 6);
  42074. };
  42075. }
  42076. });
  42077. //#endregion
  42078. //#region ../../packages/components/steps/src/item.vue
  42079. var item_default = item_vue_vue_type_script_setup_true_lang_default;
  42080. //#endregion
  42081. //#region ../../packages/components/steps/index.ts
  42082. const ElSteps = withInstall(steps_default$1, { Step: item_default });
  42083. const ElStep = withNoopInstall(item_default);
  42084. //#endregion
  42085. //#region ../../packages/components/switch/src/switch.ts
  42086. /**
  42087. * @deprecated Removed after 3.0.0, Use `SwitchProps` instead.
  42088. */
  42089. const switchProps = buildProps({
  42090. modelValue: {
  42091. type: [
  42092. Boolean,
  42093. String,
  42094. Number
  42095. ],
  42096. default: false
  42097. },
  42098. disabled: {
  42099. type: Boolean,
  42100. default: void 0
  42101. },
  42102. loading: Boolean,
  42103. size: {
  42104. type: String,
  42105. validator: isValidComponentSize
  42106. },
  42107. width: {
  42108. type: [String, Number],
  42109. default: ""
  42110. },
  42111. inlinePrompt: Boolean,
  42112. inactiveActionIcon: { type: iconPropType },
  42113. activeActionIcon: { type: iconPropType },
  42114. activeIcon: { type: iconPropType },
  42115. inactiveIcon: { type: iconPropType },
  42116. activeText: {
  42117. type: String,
  42118. default: ""
  42119. },
  42120. inactiveText: {
  42121. type: String,
  42122. default: ""
  42123. },
  42124. activeValue: {
  42125. type: [
  42126. Boolean,
  42127. String,
  42128. Number
  42129. ],
  42130. default: true
  42131. },
  42132. inactiveValue: {
  42133. type: [
  42134. Boolean,
  42135. String,
  42136. Number
  42137. ],
  42138. default: false
  42139. },
  42140. name: {
  42141. type: String,
  42142. default: ""
  42143. },
  42144. validateEvent: {
  42145. type: Boolean,
  42146. default: true
  42147. },
  42148. beforeChange: { type: definePropType(Function) },
  42149. id: String,
  42150. tabindex: { type: [String, Number] },
  42151. ...useAriaProps(["ariaLabel"])
  42152. });
  42153. const switchEmits = {
  42154. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  42155. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  42156. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  42157. };
  42158. //#endregion
  42159. //#region ../../packages/components/switch/src/switch.vue?vue&type=script&setup=true&lang.ts
  42160. const _hoisted_1$18 = [
  42161. "id",
  42162. "aria-checked",
  42163. "aria-disabled",
  42164. "aria-label",
  42165. "name",
  42166. "true-value",
  42167. "false-value",
  42168. "disabled",
  42169. "tabindex"
  42170. ];
  42171. const _hoisted_2$11 = ["aria-hidden"];
  42172. const _hoisted_3$4 = { key: 1 };
  42173. const _hoisted_4$3 = { key: 1 };
  42174. const _hoisted_5$1 = ["aria-hidden"];
  42175. const COMPONENT_NAME$6 = "ElSwitch";
  42176. var switch_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  42177. name: COMPONENT_NAME$6,
  42178. __name: "switch",
  42179. props: switchProps,
  42180. emits: switchEmits,
  42181. setup(__props, { expose: __expose, emit: __emit }) {
  42182. const props = __props;
  42183. const emit = __emit;
  42184. const { formItem } = useFormItem();
  42185. const switchSize = useFormSize();
  42186. const ns = useNamespace("switch");
  42187. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  42188. const switchDisabled = useFormDisabled(computed(() => {
  42189. if (props.loading) return true;
  42190. }));
  42191. const isControlled = ref(props.modelValue !== false);
  42192. const input = shallowRef();
  42193. const switchKls = computed(() => [
  42194. ns.b(),
  42195. ns.m(switchSize.value),
  42196. ns.is("disabled", switchDisabled.value),
  42197. ns.is("checked", checked.value)
  42198. ]);
  42199. const labelLeftKls = computed(() => [
  42200. ns.e("label"),
  42201. ns.em("label", "left"),
  42202. ns.is("active", !checked.value)
  42203. ]);
  42204. const labelRightKls = computed(() => [
  42205. ns.e("label"),
  42206. ns.em("label", "right"),
  42207. ns.is("active", checked.value)
  42208. ]);
  42209. const coreStyle = computed(() => ({ width: addUnit(props.width) }));
  42210. watch(() => props.modelValue, () => {
  42211. isControlled.value = true;
  42212. });
  42213. const actualValue = computed(() => {
  42214. return isControlled.value ? props.modelValue : false;
  42215. });
  42216. const checked = computed(() => actualValue.value === props.activeValue);
  42217. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  42218. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  42219. emit(CHANGE_EVENT, props.inactiveValue);
  42220. emit(INPUT_EVENT, props.inactiveValue);
  42221. }
  42222. watch(checked, (val) => {
  42223. input.value.checked = val;
  42224. if (props.validateEvent) formItem?.validate?.("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  42225. });
  42226. const handleChange = () => {
  42227. const val = checked.value ? props.inactiveValue : props.activeValue;
  42228. emit(UPDATE_MODEL_EVENT, val);
  42229. emit(CHANGE_EVENT, val);
  42230. emit(INPUT_EVENT, val);
  42231. nextTick(() => {
  42232. input.value.checked = checked.value;
  42233. });
  42234. };
  42235. const switchValue = () => {
  42236. if (switchDisabled.value) return;
  42237. const { beforeChange } = props;
  42238. if (!beforeChange) {
  42239. handleChange();
  42240. return;
  42241. }
  42242. const shouldChange = beforeChange();
  42243. if (![isPromise(shouldChange), isBoolean(shouldChange)].includes(true)) throwError(COMPONENT_NAME$6, "beforeChange must return type `Promise<boolean>` or `boolean`");
  42244. if (isPromise(shouldChange)) shouldChange.then((result) => {
  42245. if (result) handleChange();
  42246. }).catch((e) => {
  42247. /* @__PURE__ */ debugWarn(COMPONENT_NAME$6, `some error occurred: ${e}`);
  42248. });
  42249. else if (shouldChange) handleChange();
  42250. };
  42251. const focus = () => {
  42252. input.value?.focus?.();
  42253. };
  42254. onMounted(() => {
  42255. input.value.checked = checked.value;
  42256. });
  42257. __expose({
  42258. focus,
  42259. checked
  42260. });
  42261. return (_ctx, _cache) => {
  42262. return openBlock(), createElementBlock("div", {
  42263. class: normalizeClass(switchKls.value),
  42264. onClick: withModifiers(switchValue, ["prevent"])
  42265. }, [
  42266. createElementVNode("input", {
  42267. id: unref(inputId),
  42268. ref_key: "input",
  42269. ref: input,
  42270. class: normalizeClass(unref(ns).e("input")),
  42271. type: "checkbox",
  42272. role: "switch",
  42273. "aria-checked": checked.value,
  42274. "aria-disabled": unref(switchDisabled),
  42275. "aria-label": __props.ariaLabel,
  42276. name: __props.name,
  42277. "true-value": __props.activeValue,
  42278. "false-value": __props.inactiveValue,
  42279. disabled: unref(switchDisabled),
  42280. tabindex: __props.tabindex,
  42281. onChange: handleChange,
  42282. onKeydown: withKeys(switchValue, ["enter"])
  42283. }, null, 42, _hoisted_1$18),
  42284. !__props.inlinePrompt && (__props.inactiveIcon || __props.inactiveText || _ctx.$slots.inactive) ? (openBlock(), createElementBlock("span", {
  42285. key: 0,
  42286. class: normalizeClass(labelLeftKls.value)
  42287. }, [renderSlot(_ctx.$slots, "inactive", {}, () => [__props.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42288. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.inactiveIcon)))]),
  42289. _: 1
  42290. })) : createCommentVNode("v-if", true), !__props.inactiveIcon && __props.inactiveText ? (openBlock(), createElementBlock("span", {
  42291. key: 1,
  42292. "aria-hidden": checked.value
  42293. }, toDisplayString(__props.inactiveText), 9, _hoisted_2$11)) : createCommentVNode("v-if", true)])], 2)) : createCommentVNode("v-if", true),
  42294. createElementVNode("span", {
  42295. class: normalizeClass(unref(ns).e("core")),
  42296. style: normalizeStyle(coreStyle.value)
  42297. }, [__props.inlinePrompt ? (openBlock(), createElementBlock("div", {
  42298. key: 0,
  42299. class: normalizeClass(unref(ns).e("inner"))
  42300. }, [!checked.value ? (openBlock(), createElementBlock("div", {
  42301. key: 0,
  42302. class: normalizeClass(unref(ns).e("inner-wrapper"))
  42303. }, [renderSlot(_ctx.$slots, "inactive", {}, () => [__props.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42304. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.inactiveIcon)))]),
  42305. _: 1
  42306. })) : createCommentVNode("v-if", true), !__props.inactiveIcon && __props.inactiveText ? (openBlock(), createElementBlock("span", _hoisted_3$4, toDisplayString(__props.inactiveText), 1)) : createCommentVNode("v-if", true)])], 2)) : (openBlock(), createElementBlock("div", {
  42307. key: 1,
  42308. class: normalizeClass(unref(ns).e("inner-wrapper"))
  42309. }, [renderSlot(_ctx.$slots, "active", {}, () => [__props.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42310. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.activeIcon)))]),
  42311. _: 1
  42312. })) : createCommentVNode("v-if", true), !__props.activeIcon && __props.activeText ? (openBlock(), createElementBlock("span", _hoisted_4$3, toDisplayString(__props.activeText), 1)) : createCommentVNode("v-if", true)])], 2))], 2)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("action")) }, [__props.loading ? (openBlock(), createBlock(unref(ElIcon), {
  42313. key: 0,
  42314. class: normalizeClass(unref(ns).is("loading"))
  42315. }, {
  42316. default: withCtx(() => [createVNode(unref(loading_default))]),
  42317. _: 1
  42318. }, 8, ["class"])) : checked.value ? renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [__props.activeActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42319. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.activeActionIcon)))]),
  42320. _: 1
  42321. })) : createCommentVNode("v-if", true)]) : !checked.value ? renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [__props.inactiveActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42322. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.inactiveActionIcon)))]),
  42323. _: 1
  42324. })) : createCommentVNode("v-if", true)]) : createCommentVNode("v-if", true)], 2)], 6),
  42325. !__props.inlinePrompt && (__props.activeIcon || __props.activeText || _ctx.$slots.active) ? (openBlock(), createElementBlock("span", {
  42326. key: 1,
  42327. class: normalizeClass(labelRightKls.value)
  42328. }, [renderSlot(_ctx.$slots, "active", {}, () => [__props.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42329. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.activeIcon)))]),
  42330. _: 1
  42331. })) : createCommentVNode("v-if", true), !__props.activeIcon && __props.activeText ? (openBlock(), createElementBlock("span", {
  42332. key: 1,
  42333. "aria-hidden": !checked.value
  42334. }, toDisplayString(__props.activeText), 9, _hoisted_5$1)) : createCommentVNode("v-if", true)])], 2)) : createCommentVNode("v-if", true)
  42335. ], 2);
  42336. };
  42337. }
  42338. });
  42339. //#endregion
  42340. //#region ../../packages/components/switch/src/switch.vue
  42341. var switch_default = switch_vue_vue_type_script_setup_true_lang_default;
  42342. //#endregion
  42343. //#region ../../packages/components/switch/index.ts
  42344. const ElSwitch = withInstall(switch_default);
  42345. //#endregion
  42346. //#region ../../packages/components/table/src/util.ts
  42347. const getCell = function(event) {
  42348. return event.target?.closest("td");
  42349. };
  42350. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  42351. if (!sortKey && !sortMethod && (!sortBy || isArray$1(sortBy) && !sortBy.length)) return array;
  42352. if (isString(reverse)) reverse = reverse === "descending" ? -1 : 1;
  42353. else reverse = reverse && reverse < 0 ? -1 : 1;
  42354. const getKey = sortMethod ? null : function(value, index) {
  42355. if (sortBy) return flatMap(castArray$1(sortBy), (by) => {
  42356. if (isString(by)) return get(value, by);
  42357. else return by(value, index, array);
  42358. });
  42359. if (sortKey !== "$key") {
  42360. if (isObject$1(value) && "$value" in value) value = value.$value;
  42361. }
  42362. return [isObject$1(value) ? sortKey ? get(value, sortKey) : null : value];
  42363. };
  42364. const compare = function(a, b) {
  42365. if (sortMethod) return sortMethod(a.value, b.value);
  42366. for (let i = 0, len = a.key?.length ?? 0; i < len; i++) {
  42367. if (a.key?.[i] < b.key?.[i]) return -1;
  42368. if (a.key?.[i] > b.key?.[i]) return 1;
  42369. }
  42370. return 0;
  42371. };
  42372. return array.map((value, index) => {
  42373. return {
  42374. value,
  42375. index,
  42376. key: getKey ? getKey(value, index) : null
  42377. };
  42378. }).sort((a, b) => {
  42379. let order = compare(a, b);
  42380. if (!order) order = a.index - b.index;
  42381. return order * +reverse;
  42382. }).map((item) => item.value);
  42383. };
  42384. const getColumnById = function(table, columnId) {
  42385. let column = null;
  42386. table.columns.forEach((item) => {
  42387. if (item.id === columnId) column = item;
  42388. });
  42389. return column;
  42390. };
  42391. const getColumnByKey = function(table, columnKey) {
  42392. let column = null;
  42393. for (let i = 0; i < table.columns.length; i++) {
  42394. const item = table.columns[i];
  42395. if (item.columnKey === columnKey) {
  42396. column = item;
  42397. break;
  42398. }
  42399. }
  42400. if (!column) throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  42401. return column;
  42402. };
  42403. const getColumnByCell = function(table, cell, namespace) {
  42404. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  42405. if (matches) return getColumnById(table, matches[0]);
  42406. return null;
  42407. };
  42408. const getRowIdentity = (row, rowKey) => {
  42409. if (!row) throw new Error("Row is required when get row identity");
  42410. if (isString(rowKey)) {
  42411. if (!rowKey.includes(".")) return `${row[rowKey]}`;
  42412. const key = rowKey.split(".");
  42413. let current = row;
  42414. for (const element of key) current = current[element];
  42415. return `${current}`;
  42416. } else if (isFunction$1(rowKey)) return rowKey.call(null, row);
  42417. return "";
  42418. };
  42419. const getKeysMap = function(array, rowKey, flatten = false, childrenKey = "children") {
  42420. const data = array || [];
  42421. const arrayMap = {};
  42422. data.forEach((row, index) => {
  42423. arrayMap[getRowIdentity(row, rowKey)] = {
  42424. row,
  42425. index
  42426. };
  42427. if (flatten) {
  42428. const children = row[childrenKey];
  42429. if (isArray$1(children)) Object.assign(arrayMap, getKeysMap(children, rowKey, true, childrenKey));
  42430. }
  42431. });
  42432. return arrayMap;
  42433. };
  42434. function mergeOptions(defaults, config) {
  42435. const options = {};
  42436. let key;
  42437. for (key in defaults) options[key] = defaults[key];
  42438. for (key in config) if (hasOwn(config, key)) {
  42439. const value = config[key];
  42440. if (!isUndefined(value)) options[key] = value;
  42441. }
  42442. return options;
  42443. }
  42444. function parseWidth(width) {
  42445. if (width === "") return width;
  42446. if (!isUndefined(width)) {
  42447. width = Number.parseInt(width, 10);
  42448. if (Number.isNaN(width)) width = "";
  42449. }
  42450. return width;
  42451. }
  42452. function parseMinWidth(minWidth) {
  42453. if (minWidth === "") return minWidth;
  42454. if (!isUndefined(minWidth)) {
  42455. minWidth = parseWidth(minWidth);
  42456. if (Number.isNaN(minWidth)) minWidth = 80;
  42457. }
  42458. return minWidth;
  42459. }
  42460. function parseHeight(height) {
  42461. if (isNumber(height)) return height;
  42462. if (isString(height)) if (/^\d+(?:px)?$/.test(height)) return Number.parseInt(height, 10);
  42463. else return height;
  42464. return null;
  42465. }
  42466. function compose(...funcs) {
  42467. if (funcs.length === 0) return (arg) => arg;
  42468. if (funcs.length === 1) return funcs[0];
  42469. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  42470. }
  42471. function toggleRowStatus(statusArr, row, newVal, tableTreeProps, selectable, rowIndex, rowKey) {
  42472. let _rowIndex = rowIndex ?? 0;
  42473. let changed = false;
  42474. const getIndex = () => {
  42475. if (!rowKey) return statusArr.indexOf(row);
  42476. const id = getRowIdentity(row, rowKey);
  42477. return statusArr.findIndex((item) => getRowIdentity(item, rowKey) === id);
  42478. };
  42479. const index = getIndex();
  42480. const included = index !== -1;
  42481. const isRowSelectable = selectable?.call(null, row, _rowIndex);
  42482. const toggleStatus = (type) => {
  42483. if (type === "add") statusArr.push(row);
  42484. else statusArr.splice(index, 1);
  42485. changed = true;
  42486. };
  42487. const getChildrenCount = (row) => {
  42488. let count = 0;
  42489. const children = tableTreeProps?.children && row[tableTreeProps.children];
  42490. if (children && isArray$1(children)) {
  42491. count += children.length;
  42492. children.forEach((item) => {
  42493. count += getChildrenCount(item);
  42494. });
  42495. }
  42496. return count;
  42497. };
  42498. if (!selectable || isRowSelectable) if (isBoolean(newVal)) {
  42499. if (newVal && !included) toggleStatus("add");
  42500. else if (!newVal && included) toggleStatus("remove");
  42501. } else included ? toggleStatus("remove") : toggleStatus("add");
  42502. if (!tableTreeProps?.checkStrictly && tableTreeProps?.children && isArray$1(row[tableTreeProps.children])) row[tableTreeProps.children].forEach((item) => {
  42503. const childChanged = toggleRowStatus(statusArr, item, newVal ?? !included, tableTreeProps, selectable, _rowIndex + 1, rowKey);
  42504. _rowIndex += getChildrenCount(item) + 1;
  42505. if (childChanged) changed = childChanged;
  42506. });
  42507. return changed;
  42508. }
  42509. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren", lazy = false) {
  42510. const isNil = (array) => !(isArray$1(array) && array.length);
  42511. function _walker(parent, children, level) {
  42512. cb(parent, children, level);
  42513. children.forEach((item) => {
  42514. if (item[lazyKey] && lazy) {
  42515. cb(item, null, level + 1);
  42516. return;
  42517. }
  42518. const children = item[childrenKey];
  42519. if (!isNil(children)) _walker(item, children, level + 1);
  42520. });
  42521. }
  42522. root.forEach((item) => {
  42523. if (item[lazyKey] && lazy) {
  42524. cb(item, null, 0);
  42525. return;
  42526. }
  42527. const children = item[childrenKey];
  42528. if (!isNil(children)) _walker(item, children, 0);
  42529. });
  42530. }
  42531. const getTableOverflowTooltipProps = (props, innerText, row, column) => {
  42532. const popperOptions = {
  42533. strategy: "fixed",
  42534. ...props.popperOptions
  42535. };
  42536. const tooltipFormatterContent = isFunction$1(column?.tooltipFormatter) ? column.tooltipFormatter({
  42537. row,
  42538. column,
  42539. cellValue: getProp(row, column.property).value
  42540. }) : void 0;
  42541. if (isVNode(tooltipFormatterContent)) return {
  42542. slotContent: tooltipFormatterContent,
  42543. content: null,
  42544. ...props,
  42545. popperOptions
  42546. };
  42547. return {
  42548. slotContent: null,
  42549. content: tooltipFormatterContent ?? innerText,
  42550. ...props,
  42551. popperOptions
  42552. };
  42553. };
  42554. let removePopper = null;
  42555. function createTablePopper(props, popperContent, row, column, trigger, table) {
  42556. const tableOverflowTooltipProps = getTableOverflowTooltipProps(props, popperContent, row, column);
  42557. const mergedProps = {
  42558. ...tableOverflowTooltipProps,
  42559. slotContent: void 0
  42560. };
  42561. if (removePopper?.trigger === trigger) {
  42562. const comp = removePopper.vm?.component;
  42563. merge(comp?.props, mergedProps);
  42564. if (comp && tableOverflowTooltipProps.slotContent) comp.slots.content = () => [tableOverflowTooltipProps.slotContent];
  42565. return;
  42566. }
  42567. removePopper?.();
  42568. const parentNode = table?.refs.tableWrapper;
  42569. const ns = parentNode?.dataset.prefix;
  42570. const vm = createVNode(ElTooltip, {
  42571. virtualTriggering: true,
  42572. virtualRef: trigger,
  42573. appendTo: parentNode,
  42574. placement: "top",
  42575. transition: "none",
  42576. offset: 0,
  42577. hideAfter: 0,
  42578. ...mergedProps
  42579. }, tableOverflowTooltipProps.slotContent ? { content: () => tableOverflowTooltipProps.slotContent } : void 0);
  42580. vm.appContext = {
  42581. ...table.appContext,
  42582. ...table
  42583. };
  42584. const container = document.createElement("div");
  42585. render(vm, container);
  42586. vm.component.exposed.onOpen();
  42587. const scrollContainer = parentNode?.querySelector(`.${ns}-scrollbar__wrap`);
  42588. removePopper = () => {
  42589. if (vm.component?.exposed?.onClose) vm.component.exposed.onClose();
  42590. render(null, container);
  42591. const currentRemovePopper = removePopper;
  42592. scrollContainer?.removeEventListener("scroll", currentRemovePopper);
  42593. currentRemovePopper.trigger = void 0;
  42594. currentRemovePopper.vm = void 0;
  42595. removePopper = null;
  42596. };
  42597. removePopper.trigger = trigger ?? void 0;
  42598. removePopper.vm = vm;
  42599. scrollContainer?.addEventListener("scroll", removePopper);
  42600. }
  42601. function getCurrentColumns(column) {
  42602. if (column.children) return flatMap(column.children, getCurrentColumns);
  42603. else return [column];
  42604. }
  42605. function getColSpan(colSpan, column) {
  42606. return colSpan + column.colSpan;
  42607. }
  42608. const isFixedColumn = (index, fixed, store, realColumns) => {
  42609. let start = 0;
  42610. let after = index;
  42611. const columns = store.states.columns.value;
  42612. if (realColumns) {
  42613. const curColumns = getCurrentColumns(realColumns[index]);
  42614. start = columns.slice(0, columns.indexOf(curColumns[0])).reduce(getColSpan, 0);
  42615. after = start + curColumns.reduce(getColSpan, 0) - 1;
  42616. } else start = index;
  42617. let fixedLayout;
  42618. switch (fixed) {
  42619. case "left":
  42620. if (after < store.states.fixedLeafColumnsLength.value) fixedLayout = "left";
  42621. break;
  42622. case "right":
  42623. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) fixedLayout = "right";
  42624. break;
  42625. default: if (after < store.states.fixedLeafColumnsLength.value) fixedLayout = "left";
  42626. else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) fixedLayout = "right";
  42627. }
  42628. return fixedLayout ? {
  42629. direction: fixedLayout,
  42630. start,
  42631. after
  42632. } : {};
  42633. };
  42634. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  42635. const classes = [];
  42636. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  42637. if (direction) {
  42638. const isLeft = direction === "left";
  42639. classes.push(`${namespace}-fixed-column--${direction}`);
  42640. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) classes.push("is-last-column");
  42641. else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) classes.push("is-first-column");
  42642. }
  42643. return classes;
  42644. };
  42645. function getOffset(offset, column) {
  42646. return offset + (isNull(column.realWidth) || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  42647. }
  42648. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  42649. const { direction, start = 0, after = 0 } = isFixedColumn(index, fixed, store, realColumns);
  42650. if (!direction) return;
  42651. const styles = {};
  42652. const isLeft = direction === "left";
  42653. const columns = store.states.columns.value;
  42654. if (isLeft) styles.left = columns.slice(0, start).reduce(getOffset, 0);
  42655. else styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  42656. return styles;
  42657. };
  42658. const ensurePosition = (style, key) => {
  42659. if (!style) return;
  42660. if (!Number.isNaN(style[key])) style[key] = `${style[key]}px`;
  42661. };
  42662. function ensureValidVNode(vnodes) {
  42663. return vnodes.some((child) => {
  42664. if (!isVNode(child)) return true;
  42665. if (child.type === Comment) return false;
  42666. if (child.type === Fragment && !ensureValidVNode(child.children)) return false;
  42667. return true;
  42668. }) ? vnodes : null;
  42669. }
  42670. //#endregion
  42671. //#region ../../packages/components/table/src/store/expand.ts
  42672. function useExpand(watcherData) {
  42673. const instance = getCurrentInstance();
  42674. const defaultExpandAll = ref(false);
  42675. const expandRows = ref([]);
  42676. const canRowExpand = (row, index) => {
  42677. const expandableFn = instance.store.states.rowExpandable.value;
  42678. return expandableFn?.(row, index) ?? true;
  42679. };
  42680. const updateExpandRows = () => {
  42681. const data = watcherData.data.value || [];
  42682. const rowKey = watcherData.rowKey.value;
  42683. if (defaultExpandAll.value) expandRows.value = instance.store.states.rowExpandable.value ? data.filter(canRowExpand) : data.slice();
  42684. else if (rowKey) {
  42685. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  42686. expandRows.value = data.filter((row, index) => {
  42687. return !!expandRowsMap[getRowIdentity(row, rowKey)] && canRowExpand(row, index);
  42688. });
  42689. } else expandRows.value = [];
  42690. };
  42691. const toggleRowExpansion = (row, expanded) => {
  42692. const rowIndex = (watcherData.data.value || []).indexOf(row);
  42693. if (rowIndex > -1 && !canRowExpand(row, rowIndex)) return;
  42694. if (toggleRowStatus(expandRows.value, row, expanded, void 0, void 0, void 0, watcherData.rowKey.value)) instance.emit("expand-change", row, expandRows.value.slice());
  42695. };
  42696. const setExpandRowKeys = (rowKeys) => {
  42697. instance.store.assertRowKey();
  42698. const data = watcherData.data.value || [];
  42699. const rowKey = watcherData.rowKey.value;
  42700. const keysMap = getKeysMap(data, rowKey);
  42701. expandRows.value = rowKeys.reduce((prev, cur) => {
  42702. const info = keysMap[cur];
  42703. if (info && canRowExpand(info.row, info.index)) prev.push(info.row);
  42704. return prev;
  42705. }, []);
  42706. };
  42707. const isRowExpanded = (row) => {
  42708. const rowKey = watcherData.rowKey.value;
  42709. if (rowKey) return !!getKeysMap(expandRows.value, rowKey)[getRowIdentity(row, rowKey)];
  42710. return expandRows.value.includes(row);
  42711. };
  42712. return {
  42713. updateExpandRows,
  42714. toggleRowExpansion,
  42715. setExpandRowKeys,
  42716. isRowExpanded,
  42717. states: {
  42718. expandRows,
  42719. defaultExpandAll
  42720. }
  42721. };
  42722. }
  42723. //#endregion
  42724. //#region ../../packages/components/table/src/store/current.ts
  42725. function useCurrent(watcherData) {
  42726. const instance = getCurrentInstance();
  42727. const _currentRowKey = ref(null);
  42728. const currentRow = ref(null);
  42729. const setCurrentRowKey = (key) => {
  42730. instance.store.assertRowKey();
  42731. _currentRowKey.value = key;
  42732. setCurrentRowByKey(key);
  42733. };
  42734. const restoreCurrentRowKey = () => {
  42735. _currentRowKey.value = null;
  42736. };
  42737. const setCurrentRowByKey = (key) => {
  42738. const { data, rowKey } = watcherData;
  42739. const oldCurrentRow = currentRow.value;
  42740. let _currentRow = null;
  42741. if (rowKey.value) _currentRow = (unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key) ?? null;
  42742. currentRow.value = _currentRow ?? null;
  42743. instance.emit("current-change", currentRow.value, oldCurrentRow);
  42744. };
  42745. const updateCurrentRow = (_currentRow) => {
  42746. const oldCurrentRow = currentRow.value;
  42747. if (_currentRow && _currentRow !== oldCurrentRow) {
  42748. currentRow.value = _currentRow;
  42749. instance.emit("current-change", currentRow.value, oldCurrentRow);
  42750. return;
  42751. }
  42752. if (!_currentRow && oldCurrentRow) {
  42753. currentRow.value = null;
  42754. instance.emit("current-change", null, oldCurrentRow);
  42755. }
  42756. };
  42757. const updateCurrentRowData = () => {
  42758. const rowKey = watcherData.rowKey.value;
  42759. const data = watcherData.data.value || [];
  42760. const oldCurrentRow = currentRow.value;
  42761. if (oldCurrentRow && !data.includes(oldCurrentRow)) if (rowKey) setCurrentRowByKey(getRowIdentity(oldCurrentRow, rowKey));
  42762. else {
  42763. currentRow.value = null;
  42764. instance.emit("current-change", null, oldCurrentRow);
  42765. }
  42766. else if (_currentRowKey.value) {
  42767. setCurrentRowByKey(_currentRowKey.value);
  42768. restoreCurrentRowKey();
  42769. }
  42770. };
  42771. return {
  42772. setCurrentRowKey,
  42773. restoreCurrentRowKey,
  42774. setCurrentRowByKey,
  42775. updateCurrentRow,
  42776. updateCurrentRowData,
  42777. states: {
  42778. _currentRowKey,
  42779. currentRow
  42780. }
  42781. };
  42782. }
  42783. //#endregion
  42784. //#region ../../packages/components/table/src/store/tree.ts
  42785. function useTree$2(watcherData) {
  42786. const expandRowKeys = ref([]);
  42787. const treeData = ref({});
  42788. const indent = ref(16);
  42789. const lazy = ref(false);
  42790. const lazyTreeNodeMap = ref({});
  42791. const lazyColumnIdentifier = ref("hasChildren");
  42792. const childrenColumnName = ref("children");
  42793. const checkStrictly = ref(false);
  42794. const instance = getCurrentInstance();
  42795. const normalizedData = computed(() => {
  42796. if (!watcherData.rowKey.value) return {};
  42797. return normalize(watcherData.data.value || []);
  42798. });
  42799. const normalizedLazyNode = computed(() => {
  42800. const rowKey = watcherData.rowKey.value;
  42801. const keys = Object.keys(lazyTreeNodeMap.value);
  42802. const res = {};
  42803. if (!keys.length) return res;
  42804. keys.forEach((key) => {
  42805. if (lazyTreeNodeMap.value[key].length) {
  42806. const item = { children: [] };
  42807. lazyTreeNodeMap.value[key].forEach((row) => {
  42808. const currentRowKey = getRowIdentity(row, rowKey);
  42809. item.children.push(currentRowKey);
  42810. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) res[currentRowKey] = { children: [] };
  42811. });
  42812. res[key] = item;
  42813. }
  42814. });
  42815. return res;
  42816. });
  42817. const normalize = (data) => {
  42818. const rowKey = watcherData.rowKey.value;
  42819. const res = {};
  42820. walkTreeNode(data, (parent, children, level) => {
  42821. const parentId = getRowIdentity(parent, rowKey);
  42822. if (isArray$1(children)) res[parentId] = {
  42823. children: children.map((row) => getRowIdentity(row, rowKey)),
  42824. level
  42825. };
  42826. else if (lazy.value) res[parentId] = {
  42827. children: [],
  42828. lazy: true,
  42829. level
  42830. };
  42831. }, childrenColumnName.value, lazyColumnIdentifier.value, lazy.value);
  42832. return res;
  42833. };
  42834. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll) => {
  42835. ifExpandAll ||= instance.store?.states.defaultExpandAll.value;
  42836. const nested = normalizedData.value;
  42837. const normalizedLazyNode_ = normalizedLazyNode.value;
  42838. const keys = Object.keys(nested);
  42839. const newTreeData = {};
  42840. if (keys.length) {
  42841. const oldTreeData = unref(treeData);
  42842. const rootLazyRowKeys = [];
  42843. const getExpanded = (oldValue, key) => {
  42844. if (ifChangeExpandRowKeys) if (expandRowKeys.value) return ifExpandAll || expandRowKeys.value.includes(key);
  42845. else return !!(ifExpandAll || oldValue?.expanded);
  42846. else {
  42847. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  42848. return !!(oldValue?.expanded || included);
  42849. }
  42850. };
  42851. keys.forEach((key) => {
  42852. const oldValue = oldTreeData[key];
  42853. const newValue = { ...nested[key] };
  42854. newValue.expanded = getExpanded(oldValue, key);
  42855. if (newValue.lazy) {
  42856. const { loaded = false, loading = false } = oldValue || {};
  42857. newValue.loaded = !!loaded;
  42858. newValue.loading = !!loading;
  42859. rootLazyRowKeys.push(key);
  42860. }
  42861. newTreeData[key] = newValue;
  42862. });
  42863. const lazyKeys = Object.keys(normalizedLazyNode_);
  42864. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) lazyKeys.forEach((key) => {
  42865. const oldValue = oldTreeData[key];
  42866. const lazyNodeChildren = normalizedLazyNode_[key].children;
  42867. if (rootLazyRowKeys.includes(key)) {
  42868. if (newTreeData[key].children?.length !== 0) throw new Error("[ElTable]children must be an empty array.");
  42869. newTreeData[key].children = lazyNodeChildren;
  42870. } else {
  42871. const { loaded = false, loading = false } = oldValue || {};
  42872. newTreeData[key] = {
  42873. lazy: true,
  42874. loaded: !!loaded,
  42875. loading: !!loading,
  42876. expanded: getExpanded(oldValue, key),
  42877. children: lazyNodeChildren,
  42878. level: void 0
  42879. };
  42880. }
  42881. });
  42882. }
  42883. treeData.value = newTreeData;
  42884. instance.store?.updateTableScrollY();
  42885. };
  42886. watch(() => expandRowKeys.value, () => {
  42887. updateTreeData(true);
  42888. }, { deep: true });
  42889. watch(() => normalizedData.value, () => {
  42890. updateTreeData();
  42891. });
  42892. watch(() => normalizedLazyNode.value, () => {
  42893. updateTreeData();
  42894. });
  42895. const updateTreeExpandKeys = (value) => {
  42896. expandRowKeys.value = value;
  42897. updateTreeData();
  42898. };
  42899. const isUseLazy = (data) => {
  42900. return lazy.value && data && "loaded" in data && !data.loaded;
  42901. };
  42902. const toggleTreeExpansion = (row, expanded) => {
  42903. instance.store.assertRowKey();
  42904. const rowKey = watcherData.rowKey.value;
  42905. const id = getRowIdentity(row, rowKey);
  42906. const data = id && treeData.value[id];
  42907. if (id && data && "expanded" in data) {
  42908. const oldExpanded = data.expanded;
  42909. expanded = isUndefined(expanded) ? !data.expanded : expanded;
  42910. treeData.value[id].expanded = expanded;
  42911. if (oldExpanded !== expanded) instance.emit("expand-change", row, expanded);
  42912. expanded && isUseLazy(data) && loadData(row, id, data);
  42913. instance.store.updateTableScrollY();
  42914. }
  42915. };
  42916. const loadOrToggle = (row) => {
  42917. instance.store.assertRowKey();
  42918. const rowKey = watcherData.rowKey.value;
  42919. const id = getRowIdentity(row, rowKey);
  42920. const data = treeData.value[id];
  42921. if (isUseLazy(data)) loadData(row, id, data);
  42922. else toggleTreeExpansion(row, void 0);
  42923. };
  42924. const loadData = (row, key, treeNode) => {
  42925. const { load } = instance.props;
  42926. if (load && !treeData.value[key].loaded) {
  42927. treeData.value[key].loading = true;
  42928. load(row, treeNode, (data) => {
  42929. if (!isArray$1(data)) throw new TypeError("[ElTable] data must be an array");
  42930. treeData.value[key].loading = false;
  42931. treeData.value[key].loaded = true;
  42932. treeData.value[key].expanded = true;
  42933. if (data.length) lazyTreeNodeMap.value[key] = data;
  42934. instance.emit("expand-change", row, true);
  42935. });
  42936. }
  42937. };
  42938. const updateKeyChildren = (key, data) => {
  42939. const { lazy, rowKey } = instance.props;
  42940. if (!lazy) return;
  42941. if (!rowKey) throw new Error("[Table] rowKey is required in updateKeyChild");
  42942. if (lazyTreeNodeMap.value[key]) lazyTreeNodeMap.value[key] = data;
  42943. };
  42944. return {
  42945. loadData,
  42946. loadOrToggle,
  42947. toggleTreeExpansion,
  42948. updateTreeExpandKeys,
  42949. updateTreeData,
  42950. updateKeyChildren,
  42951. normalize,
  42952. states: {
  42953. expandRowKeys,
  42954. treeData,
  42955. indent,
  42956. lazy,
  42957. lazyTreeNodeMap,
  42958. lazyColumnIdentifier,
  42959. childrenColumnName,
  42960. checkStrictly
  42961. }
  42962. };
  42963. }
  42964. //#endregion
  42965. //#region ../../packages/components/table/src/store/watcher.ts
  42966. const sortData = (data, states) => {
  42967. const sortingColumn = states.sortingColumn;
  42968. if (!sortingColumn || isString(sortingColumn.sortable)) return data;
  42969. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  42970. };
  42971. const doFlattenColumns = (columns) => {
  42972. const result = [];
  42973. columns.forEach((column) => {
  42974. if (column.children && column.children.length > 0) result.push.apply(result, doFlattenColumns(column.children));
  42975. else result.push(column);
  42976. });
  42977. return result;
  42978. };
  42979. function useWatcher$1() {
  42980. const instance = getCurrentInstance();
  42981. const { size: tableSize } = toRefs(instance.proxy?.$props);
  42982. const rowKey = ref(null);
  42983. const data = ref([]);
  42984. const _data = ref([]);
  42985. const isComplex = ref(false);
  42986. const _columns = ref([]);
  42987. const originColumns = ref([]);
  42988. const columns = ref([]);
  42989. const fixedColumns = ref([]);
  42990. const rightFixedColumns = ref([]);
  42991. const leafColumns = ref([]);
  42992. const fixedLeafColumns = ref([]);
  42993. const rightFixedLeafColumns = ref([]);
  42994. const updateOrderFns = [];
  42995. const leafColumnsLength = ref(0);
  42996. const fixedLeafColumnsLength = ref(0);
  42997. const rightFixedLeafColumnsLength = ref(0);
  42998. const isAllSelected = ref(false);
  42999. const selection = ref([]);
  43000. const reserveSelection = ref(false);
  43001. const selectOnIndeterminate = ref(false);
  43002. const selectable = ref(null);
  43003. const rowExpandable = ref(null);
  43004. const filters = ref({});
  43005. const filteredData = ref(null);
  43006. const sortingColumn = ref(null);
  43007. const sortProp = ref(null);
  43008. const sortOrder = ref(null);
  43009. const hoverRow = ref(null);
  43010. const selectedMap = computed(() => {
  43011. return rowKey.value ? getKeysMap(selection.value, rowKey.value) : void 0;
  43012. });
  43013. watch(data, () => {
  43014. if (instance.state) {
  43015. scheduleLayout(false);
  43016. if (instance.props.tableLayout === "auto") instance.refs.tableHeaderRef?.updateFixedColumnStyle();
  43017. }
  43018. }, { deep: true });
  43019. const assertRowKey = () => {
  43020. if (!rowKey.value) throw new Error("[ElTable] prop row-key is required");
  43021. };
  43022. const updateChildFixed = (column) => {
  43023. column.children?.forEach((childColumn) => {
  43024. childColumn.fixed = column.fixed;
  43025. updateChildFixed(childColumn);
  43026. });
  43027. };
  43028. const updateColumns = () => {
  43029. _columns.value.forEach((column) => {
  43030. updateChildFixed(column);
  43031. });
  43032. fixedColumns.value = _columns.value.filter((column) => [true, "left"].includes(column.fixed));
  43033. const selectColumn = _columns.value.find((column) => column.type === "selection");
  43034. let selectColFixLeft;
  43035. if (selectColumn && selectColumn.fixed !== "right" && !fixedColumns.value.includes(selectColumn)) {
  43036. if (_columns.value.indexOf(selectColumn) === 0 && fixedColumns.value.length) {
  43037. fixedColumns.value.unshift(selectColumn);
  43038. selectColFixLeft = true;
  43039. }
  43040. }
  43041. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  43042. const notFixedColumns = _columns.value.filter((column) => (selectColFixLeft ? column.type !== "selection" : true) && !column.fixed);
  43043. originColumns.value = Array.from(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  43044. const leafColumns = doFlattenColumns(notFixedColumns);
  43045. const fixedLeafColumns = doFlattenColumns(fixedColumns.value);
  43046. const rightFixedLeafColumns = doFlattenColumns(rightFixedColumns.value);
  43047. leafColumnsLength.value = leafColumns.length;
  43048. fixedLeafColumnsLength.value = fixedLeafColumns.length;
  43049. rightFixedLeafColumnsLength.value = rightFixedLeafColumns.length;
  43050. columns.value = Array.from(fixedLeafColumns).concat(leafColumns).concat(rightFixedLeafColumns);
  43051. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  43052. };
  43053. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  43054. if (needUpdateColumns) updateColumns();
  43055. if (immediate) instance.state.doLayout();
  43056. else instance.state.debouncedUpdateLayout();
  43057. };
  43058. const isSelected = (row) => {
  43059. if (selectedMap.value) return !!selectedMap.value[getRowIdentity(row, rowKey.value)];
  43060. else return selection.value.includes(row);
  43061. };
  43062. const clearSelection = () => {
  43063. isAllSelected.value = false;
  43064. const oldSelection = selection.value;
  43065. selection.value = [];
  43066. if (oldSelection.length) instance.emit("selection-change", []);
  43067. };
  43068. const cleanSelection = () => {
  43069. let deleted;
  43070. if (rowKey.value) {
  43071. deleted = [];
  43072. const childrenKey = instance?.store?.states?.childrenColumnName.value;
  43073. const dataMap = getKeysMap(data.value, rowKey.value, true, childrenKey);
  43074. for (const key in selectedMap.value) if (hasOwn(selectedMap.value, key) && !dataMap[key]) deleted.push(selectedMap.value[key].row);
  43075. } else deleted = selection.value.filter((item) => !data.value.includes(item));
  43076. if (deleted.length) {
  43077. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  43078. selection.value = newSelection;
  43079. instance.emit("selection-change", newSelection.slice());
  43080. }
  43081. };
  43082. const getSelectionRows = () => {
  43083. return (selection.value || []).slice();
  43084. };
  43085. const toggleRowSelection = (row, selected, emitChange = true, ignoreSelectable = false) => {
  43086. const treeProps = {
  43087. children: instance?.store?.states?.childrenColumnName.value,
  43088. checkStrictly: instance?.store?.states?.checkStrictly.value
  43089. };
  43090. if (toggleRowStatus(selection.value, row, selected, treeProps, ignoreSelectable ? void 0 : selectable.value, data.value.indexOf(row), rowKey.value)) {
  43091. const newSelection = (selection.value || []).slice();
  43092. if (emitChange) instance.emit("select", newSelection, row);
  43093. instance.emit("selection-change", newSelection);
  43094. }
  43095. };
  43096. const _toggleAllSelection = () => {
  43097. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  43098. isAllSelected.value = value;
  43099. let selectionChanged = false;
  43100. let childrenCount = 0;
  43101. const rowKey = instance?.store?.states?.rowKey.value;
  43102. const { childrenColumnName } = instance.store.states;
  43103. const treeProps = {
  43104. children: childrenColumnName.value,
  43105. checkStrictly: false
  43106. };
  43107. data.value.forEach((row, index) => {
  43108. const rowIndex = index + childrenCount;
  43109. if (toggleRowStatus(selection.value, row, value, treeProps, selectable.value, rowIndex, rowKey)) selectionChanged = true;
  43110. childrenCount += getChildrenCount(getRowIdentity(row, rowKey));
  43111. });
  43112. if (selectionChanged) instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  43113. instance.emit("select-all", (selection.value || []).slice());
  43114. };
  43115. const updateAllSelected = () => {
  43116. if (data.value?.length === 0) {
  43117. isAllSelected.value = false;
  43118. return;
  43119. }
  43120. const { childrenColumnName } = instance.store.states;
  43121. let rowIndex = 0;
  43122. let selectedCount = 0;
  43123. const checkSelectedStatus = (data) => {
  43124. for (const row of data) {
  43125. const isRowSelectable = selectable.value && selectable.value.call(null, row, rowIndex);
  43126. if (!isSelected(row)) {
  43127. if (!selectable.value || isRowSelectable) return false;
  43128. } else selectedCount++;
  43129. rowIndex++;
  43130. if (row[childrenColumnName.value]?.length && !checkSelectedStatus(row[childrenColumnName.value])) return false;
  43131. }
  43132. return true;
  43133. };
  43134. const isAllSelected_ = checkSelectedStatus(data.value || []);
  43135. isAllSelected.value = selectedCount === 0 ? false : isAllSelected_;
  43136. };
  43137. const getChildrenCount = (rowKey) => {
  43138. if (!instance || !instance.store) return 0;
  43139. const { treeData } = instance.store.states;
  43140. let count = 0;
  43141. const children = treeData.value[rowKey]?.children;
  43142. if (children) {
  43143. count += children.length;
  43144. children.forEach((childKey) => {
  43145. count += getChildrenCount(childKey);
  43146. });
  43147. }
  43148. return count;
  43149. };
  43150. const updateFilters = (column, values) => {
  43151. const filters_ = {};
  43152. castArray$1(column).forEach((col) => {
  43153. filters.value[col.id] = values;
  43154. filters_[col.columnKey || col.id] = values;
  43155. });
  43156. return filters_;
  43157. };
  43158. const updateSort = (column, prop, order) => {
  43159. if (sortingColumn.value && sortingColumn.value !== column) sortingColumn.value.order = null;
  43160. sortingColumn.value = column;
  43161. sortProp.value = prop;
  43162. sortOrder.value = order;
  43163. };
  43164. const execFilter = () => {
  43165. let sourceData = unref(_data);
  43166. Object.keys(filters.value).forEach((columnId) => {
  43167. const values = filters.value[columnId];
  43168. if (!values || values.length === 0) return;
  43169. const column = getColumnById({ columns: columns.value }, columnId);
  43170. if (column && column.filterMethod) sourceData = sourceData.filter((row) => {
  43171. return values.some((value) => column.filterMethod.call(null, value, row, column));
  43172. });
  43173. });
  43174. filteredData.value = sourceData;
  43175. };
  43176. const execSort = () => {
  43177. data.value = sortData(filteredData.value ?? [], {
  43178. sortingColumn: sortingColumn.value,
  43179. sortProp: sortProp.value,
  43180. sortOrder: sortOrder.value
  43181. });
  43182. };
  43183. const execQuery = (ignore = void 0) => {
  43184. if (!ignore?.filter) execFilter();
  43185. execSort();
  43186. };
  43187. const clearFilter = (columnKeys) => {
  43188. const { tableHeaderRef } = instance.refs;
  43189. if (!tableHeaderRef) return;
  43190. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  43191. const keys = Object.keys(panels);
  43192. if (!keys.length) return;
  43193. if (isString(columnKeys)) columnKeys = [columnKeys];
  43194. if (isArray$1(columnKeys)) {
  43195. const columns_ = columnKeys.map((key) => getColumnByKey({ columns: columns.value }, key));
  43196. keys.forEach((key) => {
  43197. const column = columns_.find((col) => col.id === key);
  43198. if (column) column.filteredValue = [];
  43199. });
  43200. instance.store.commit("filterChange", {
  43201. column: columns_,
  43202. values: [],
  43203. silent: true,
  43204. multi: true
  43205. });
  43206. } else {
  43207. keys.forEach((key) => {
  43208. const column = columns.value.find((col) => col.id === key);
  43209. if (column) column.filteredValue = [];
  43210. });
  43211. filters.value = {};
  43212. instance.store.commit("filterChange", {
  43213. column: {},
  43214. values: [],
  43215. silent: true
  43216. });
  43217. }
  43218. };
  43219. const clearSort = () => {
  43220. if (!sortingColumn.value) return;
  43221. updateSort(null, null, null);
  43222. instance.store.commit("changeSortCondition", { silent: true });
  43223. };
  43224. const { setExpandRowKeys, toggleRowExpansion, updateExpandRows, states: expandStates, isRowExpanded } = useExpand({
  43225. data,
  43226. rowKey
  43227. });
  43228. const { updateTreeExpandKeys, toggleTreeExpansion, updateTreeData, updateKeyChildren, loadOrToggle, states: treeStates } = useTree$2({
  43229. data,
  43230. rowKey
  43231. });
  43232. const { updateCurrentRowData, updateCurrentRow, setCurrentRowKey, states: currentData } = useCurrent({
  43233. data,
  43234. rowKey
  43235. });
  43236. const setExpandRowKeysAdapter = (val) => {
  43237. setExpandRowKeys(val);
  43238. updateTreeExpandKeys(val);
  43239. };
  43240. const toggleRowExpansionAdapter = (row, expanded) => {
  43241. if (columns.value.some(({ type }) => type === "expand")) toggleRowExpansion(row, expanded);
  43242. else toggleTreeExpansion(row, expanded);
  43243. };
  43244. return {
  43245. assertRowKey,
  43246. updateColumns,
  43247. scheduleLayout,
  43248. isSelected,
  43249. clearSelection,
  43250. cleanSelection,
  43251. getSelectionRows,
  43252. toggleRowSelection,
  43253. _toggleAllSelection,
  43254. toggleAllSelection: null,
  43255. updateAllSelected,
  43256. updateFilters,
  43257. updateCurrentRow,
  43258. updateSort,
  43259. execFilter,
  43260. execSort,
  43261. execQuery,
  43262. clearFilter,
  43263. clearSort,
  43264. toggleRowExpansion,
  43265. setExpandRowKeysAdapter,
  43266. setCurrentRowKey,
  43267. toggleRowExpansionAdapter,
  43268. isRowExpanded,
  43269. updateExpandRows,
  43270. updateCurrentRowData,
  43271. loadOrToggle,
  43272. updateTreeData,
  43273. updateKeyChildren,
  43274. states: {
  43275. tableSize,
  43276. rowKey,
  43277. data,
  43278. _data,
  43279. isComplex,
  43280. _columns,
  43281. originColumns,
  43282. columns,
  43283. fixedColumns,
  43284. rightFixedColumns,
  43285. leafColumns,
  43286. fixedLeafColumns,
  43287. rightFixedLeafColumns,
  43288. updateOrderFns,
  43289. leafColumnsLength,
  43290. fixedLeafColumnsLength,
  43291. rightFixedLeafColumnsLength,
  43292. isAllSelected,
  43293. selection,
  43294. reserveSelection,
  43295. selectOnIndeterminate,
  43296. selectable,
  43297. rowExpandable,
  43298. filters,
  43299. filteredData,
  43300. sortingColumn,
  43301. sortProp,
  43302. sortOrder,
  43303. hoverRow,
  43304. ...expandStates,
  43305. ...treeStates,
  43306. ...currentData
  43307. }
  43308. };
  43309. }
  43310. //#endregion
  43311. //#region ../../packages/components/table/src/store/index.ts
  43312. function replaceColumn(array, column) {
  43313. return array.map((item) => {
  43314. if (item.id === column.id) return column;
  43315. else if (item.children?.length) item.children = replaceColumn(item.children, column);
  43316. return item;
  43317. });
  43318. }
  43319. function sortColumn(array) {
  43320. array.forEach((item) => {
  43321. item.no = item.getColumnIndex?.();
  43322. if (item.children?.length) sortColumn(item.children);
  43323. });
  43324. array.sort((cur, pre) => cur.no - pre.no);
  43325. }
  43326. function useStore() {
  43327. const instance = getCurrentInstance();
  43328. const watcher = useWatcher$1();
  43329. const ns = useNamespace("table");
  43330. const { t } = useLocale();
  43331. const mutations = {
  43332. setData(states, data) {
  43333. const dataInstanceChanged = unref(states._data) !== data;
  43334. states.data.value = data;
  43335. states._data.value = data;
  43336. instance.store.execQuery();
  43337. instance.store.updateCurrentRowData();
  43338. instance.store.updateExpandRows();
  43339. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  43340. if (unref(states.reserveSelection)) instance.store.assertRowKey();
  43341. else if (dataInstanceChanged) instance.store.clearSelection();
  43342. else instance.store.cleanSelection();
  43343. instance.store.updateAllSelected();
  43344. if (instance.$ready) instance.store.scheduleLayout();
  43345. },
  43346. insertColumn(states, column, parent, updateColumnOrder) {
  43347. const array = unref(states._columns);
  43348. let newColumns = [];
  43349. if (!parent) {
  43350. array.push(column);
  43351. newColumns = array;
  43352. } else {
  43353. if (parent && !parent.children) parent.children = [];
  43354. parent.children?.push(column);
  43355. newColumns = replaceColumn(array, parent);
  43356. }
  43357. sortColumn(newColumns);
  43358. states._columns.value = newColumns;
  43359. states.updateOrderFns.push(updateColumnOrder);
  43360. if (column.type === "selection") {
  43361. states.selectable.value = column.selectable;
  43362. states.reserveSelection.value = column.reserveSelection;
  43363. }
  43364. if (instance.$ready) {
  43365. instance.store.updateColumns();
  43366. instance.store.scheduleLayout();
  43367. }
  43368. },
  43369. updateColumnOrder(states, column) {
  43370. if (column.getColumnIndex?.() === column.no) return;
  43371. sortColumn(states._columns.value);
  43372. if (instance.$ready) instance.store.updateColumns();
  43373. },
  43374. removeColumn(states, column, parent, updateColumnOrder) {
  43375. const array = unref(states._columns) || [];
  43376. if (parent) {
  43377. parent.children?.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  43378. nextTick(() => {
  43379. if (parent.children?.length === 0) delete parent.children;
  43380. });
  43381. states._columns.value = replaceColumn(array, parent);
  43382. } else {
  43383. const index = array.indexOf(column);
  43384. if (index > -1) {
  43385. array.splice(index, 1);
  43386. states._columns.value = array;
  43387. }
  43388. }
  43389. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  43390. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  43391. if (instance.$ready) {
  43392. instance.store.updateColumns();
  43393. instance.store.scheduleLayout();
  43394. }
  43395. },
  43396. sort(states, options) {
  43397. const { prop, order, init } = options;
  43398. if (prop) {
  43399. const column = unref(states.columns).find((column) => column.property === prop);
  43400. if (column) {
  43401. column.order = order;
  43402. instance.store.updateSort(column, prop, order);
  43403. instance.store.commit("changeSortCondition", { init });
  43404. }
  43405. }
  43406. },
  43407. changeSortCondition(states, options) {
  43408. const { sortingColumn, sortProp, sortOrder } = states;
  43409. const columnValue = unref(sortingColumn), propValue = unref(sortProp), orderValue = unref(sortOrder);
  43410. if (isNull(orderValue)) {
  43411. states.sortingColumn.value = null;
  43412. states.sortProp.value = null;
  43413. }
  43414. instance.store.execQuery({ filter: true });
  43415. if (!options || !(options.silent || options.init)) instance.emit("sort-change", {
  43416. column: columnValue,
  43417. prop: propValue,
  43418. order: orderValue
  43419. });
  43420. instance.store.updateTableScrollY();
  43421. },
  43422. filterChange(_states, options) {
  43423. const { column, values, silent } = options;
  43424. const newFilters = instance.store.updateFilters(column, values);
  43425. instance.store.execQuery();
  43426. if (!silent) instance.emit("filter-change", newFilters);
  43427. instance.store.updateTableScrollY();
  43428. },
  43429. toggleAllSelection() {
  43430. instance.store.toggleAllSelection?.();
  43431. },
  43432. rowSelectedChanged(_states, row) {
  43433. instance.store.toggleRowSelection(row);
  43434. instance.store.updateAllSelected();
  43435. },
  43436. setHoverRow(states, row) {
  43437. states.hoverRow.value = row;
  43438. },
  43439. setCurrentRow(_states, row) {
  43440. instance.store.updateCurrentRow(row);
  43441. }
  43442. };
  43443. const commit = function(name, ...args) {
  43444. const mutations = instance.store.mutations;
  43445. if (mutations[name]) mutations[name].apply(instance, [instance.store.states, ...args]);
  43446. else throw new Error(`Action not found: ${name}`);
  43447. };
  43448. const updateTableScrollY = function() {
  43449. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  43450. };
  43451. return {
  43452. ns,
  43453. t,
  43454. ...watcher,
  43455. mutations,
  43456. commit,
  43457. updateTableScrollY
  43458. };
  43459. }
  43460. //#endregion
  43461. //#region ../../packages/components/table/src/store/helper.ts
  43462. const InitialStateMap = {
  43463. rowKey: "rowKey",
  43464. defaultExpandAll: "defaultExpandAll",
  43465. rowExpandable: "rowExpandable",
  43466. selectOnIndeterminate: "selectOnIndeterminate",
  43467. indent: "indent",
  43468. lazy: "lazy",
  43469. ["treeProps.hasChildren"]: {
  43470. key: "lazyColumnIdentifier",
  43471. default: "hasChildren"
  43472. },
  43473. ["treeProps.children"]: {
  43474. key: "childrenColumnName",
  43475. default: "children"
  43476. },
  43477. ["treeProps.checkStrictly"]: {
  43478. key: "checkStrictly",
  43479. default: false
  43480. }
  43481. };
  43482. function createStore(table, props) {
  43483. if (!table) throw new Error("Table is required.");
  43484. const store = useStore();
  43485. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  43486. Object.keys(InitialStateMap).forEach((key) => {
  43487. handleValue(getArrKeysValue(props, key), key, store);
  43488. });
  43489. proxyTableProps(store, props);
  43490. return store;
  43491. }
  43492. function proxyTableProps(store, props) {
  43493. Object.keys(InitialStateMap).forEach((key) => {
  43494. watch(() => getArrKeysValue(props, key), (value) => {
  43495. handleValue(value, key, store);
  43496. });
  43497. });
  43498. }
  43499. function handleValue(value, propsKey, store) {
  43500. let newVal = value;
  43501. let storeKey = InitialStateMap[propsKey];
  43502. if (isObject$1(storeKey)) {
  43503. newVal = newVal || storeKey.default;
  43504. storeKey = storeKey.key;
  43505. }
  43506. store.states[storeKey].value = newVal;
  43507. }
  43508. function getArrKeysValue(props, key) {
  43509. if (key.includes(".")) {
  43510. const keyList = key.split(".");
  43511. let value = props;
  43512. keyList.forEach((k) => {
  43513. value = value[k];
  43514. });
  43515. return value;
  43516. } else return props[key];
  43517. }
  43518. //#endregion
  43519. //#region ../../packages/components/table/src/table-layout.ts
  43520. var TableLayout = class {
  43521. constructor(options) {
  43522. this.observers = [];
  43523. this.table = null;
  43524. this.store = null;
  43525. this.columns = [];
  43526. this.fit = true;
  43527. this.showHeader = true;
  43528. this.height = ref(null);
  43529. this.scrollX = ref(false);
  43530. this.scrollY = ref(false);
  43531. this.bodyWidth = ref(null);
  43532. this.fixedWidth = ref(null);
  43533. this.rightFixedWidth = ref(null);
  43534. this.gutterWidth = 0;
  43535. for (const name in options) if (hasOwn(options, name)) if (isRef(this[name])) this[name].value = options[name];
  43536. else this[name] = options[name];
  43537. if (!this.table) throw new Error("Table is required for Table Layout");
  43538. if (!this.store) throw new Error("Store is required for Table Layout");
  43539. }
  43540. updateScrollY() {
  43541. const height = this.height.value;
  43542. /**
  43543. * When the height is not initialized, it is null.
  43544. * After the table is initialized, when the height is not configured, the height is 0.
  43545. */
  43546. if (isNull(height)) return false;
  43547. const scrollBarRef = this.table.refs.scrollBarRef;
  43548. if (this.table.vnode.el && scrollBarRef?.wrapRef) {
  43549. let scrollY = true;
  43550. const prevScrollY = this.scrollY.value;
  43551. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  43552. this.scrollY.value = scrollY;
  43553. return prevScrollY !== scrollY;
  43554. }
  43555. return false;
  43556. }
  43557. setHeight(value, prop = "height") {
  43558. if (!isClient) return;
  43559. const el = this.table.vnode.el;
  43560. value = parseHeight(value);
  43561. this.height.value = Number(value);
  43562. if (!el && (value || value === 0)) {
  43563. nextTick(() => this.setHeight(value, prop));
  43564. return;
  43565. }
  43566. if (el && isNumber(value)) {
  43567. el.style[prop] = `${value}px`;
  43568. this.updateElsHeight();
  43569. } else if (el && isString(value)) {
  43570. el.style[prop] = value;
  43571. this.updateElsHeight();
  43572. }
  43573. }
  43574. setMaxHeight(value) {
  43575. this.setHeight(value, "max-height");
  43576. }
  43577. getFlattenColumns() {
  43578. const flattenColumns = [];
  43579. this.table.store.states.columns.value.forEach((column) => {
  43580. if (column.isColumnGroup) flattenColumns.push.apply(flattenColumns, column.columns);
  43581. else flattenColumns.push(column);
  43582. });
  43583. return flattenColumns;
  43584. }
  43585. updateElsHeight() {
  43586. this.updateScrollY();
  43587. this.notifyObservers("scrollable");
  43588. }
  43589. headerDisplayNone(elm) {
  43590. if (!elm) return true;
  43591. let headerChild = elm;
  43592. while (headerChild.tagName !== "DIV") {
  43593. if (getComputedStyle(headerChild).display === "none") return true;
  43594. headerChild = headerChild.parentElement;
  43595. }
  43596. return false;
  43597. }
  43598. updateColumnsWidth() {
  43599. if (!isClient) return;
  43600. const fit = this.fit;
  43601. const bodyWidth = this.table.vnode.el?.clientWidth;
  43602. let bodyMinWidth = 0;
  43603. const flattenColumns = this.getFlattenColumns();
  43604. const flexColumns = flattenColumns.filter((column) => !isNumber(column.width));
  43605. flattenColumns.forEach((column) => {
  43606. if (isNumber(column.width) && column.realWidth) column.realWidth = null;
  43607. });
  43608. if (flexColumns.length > 0 && fit) {
  43609. flattenColumns.forEach((column) => {
  43610. bodyMinWidth += Number(column.width || column.minWidth || 80);
  43611. });
  43612. if (bodyMinWidth <= bodyWidth) {
  43613. this.scrollX.value = false;
  43614. const totalFlexWidth = bodyWidth - bodyMinWidth;
  43615. if (flexColumns.length === 1) flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  43616. else {
  43617. const flexWidthPerPixel = totalFlexWidth / flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  43618. let noneFirstWidth = 0;
  43619. flexColumns.forEach((column, index) => {
  43620. if (index === 0) return;
  43621. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  43622. noneFirstWidth += flexWidth;
  43623. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  43624. });
  43625. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  43626. }
  43627. } else {
  43628. this.scrollX.value = true;
  43629. flexColumns.forEach((column) => {
  43630. column.realWidth = Number(column.minWidth);
  43631. });
  43632. }
  43633. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  43634. this.table.state.resizeState.value.width = this.bodyWidth.value;
  43635. } else {
  43636. flattenColumns.forEach((column) => {
  43637. if (!column.width && !column.minWidth) column.realWidth = 80;
  43638. else column.realWidth = Number(column.width || column.minWidth);
  43639. bodyMinWidth += column.realWidth;
  43640. });
  43641. this.scrollX.value = bodyMinWidth > bodyWidth;
  43642. this.bodyWidth.value = bodyMinWidth;
  43643. }
  43644. const fixedColumns = this.store.states.fixedColumns.value;
  43645. if (fixedColumns.length > 0) {
  43646. let fixedWidth = 0;
  43647. fixedColumns.forEach((column) => {
  43648. fixedWidth += Number(column.realWidth || column.width);
  43649. });
  43650. this.fixedWidth.value = fixedWidth;
  43651. }
  43652. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  43653. if (rightFixedColumns.length > 0) {
  43654. let rightFixedWidth = 0;
  43655. rightFixedColumns.forEach((column) => {
  43656. rightFixedWidth += Number(column.realWidth || column.width);
  43657. });
  43658. this.rightFixedWidth.value = rightFixedWidth;
  43659. }
  43660. this.notifyObservers("columns");
  43661. }
  43662. addObserver(observer) {
  43663. this.observers.push(observer);
  43664. }
  43665. removeObserver(observer) {
  43666. const index = this.observers.indexOf(observer);
  43667. if (index !== -1) this.observers.splice(index, 1);
  43668. }
  43669. notifyObservers(event) {
  43670. this.observers.forEach((observer) => {
  43671. switch (event) {
  43672. case "columns":
  43673. observer.state?.onColumnsChange(this);
  43674. break;
  43675. case "scrollable":
  43676. observer.state?.onScrollableChange(this);
  43677. break;
  43678. default: throw new Error(`Table Layout don't have event ${event}.`);
  43679. }
  43680. });
  43681. }
  43682. };
  43683. //#endregion
  43684. //#region ../../packages/components/table/src/filter-panel.vue?vue&type=script&lang.ts
  43685. var filter_panel_vue_vue_type_script_lang_default = defineComponent({
  43686. name: "ElTableFilterPanel",
  43687. components: {
  43688. ElCheckbox,
  43689. ElCheckboxGroup,
  43690. ElScrollbar,
  43691. ElTooltip,
  43692. ElIcon,
  43693. ArrowDown: arrow_down_default,
  43694. ArrowUp: arrow_up_default
  43695. },
  43696. props: {
  43697. placement: {
  43698. type: String,
  43699. default: "bottom-start"
  43700. },
  43701. store: { type: Object },
  43702. column: { type: Object },
  43703. upDataColumn: { type: Function },
  43704. appendTo: useTooltipContentProps.appendTo
  43705. },
  43706. setup(props) {
  43707. const instance = getCurrentInstance();
  43708. const { t } = useLocale();
  43709. const ns = useNamespace("table-filter");
  43710. const parent = instance?.parent;
  43711. if (props.column && !parent.filterPanels.value[props.column.id]) parent.filterPanels.value[props.column.id] = instance;
  43712. const tooltipRef = ref(null);
  43713. const rootRef = ref(null);
  43714. const checkedIndex = ref(0);
  43715. const filters = computed(() => {
  43716. return props.column && props.column.filters;
  43717. });
  43718. const filterClassName = computed(() => {
  43719. if (props.column && props.column.filterClassName) return `${ns.b()} ${props.column.filterClassName}`;
  43720. return ns.b();
  43721. });
  43722. const filterValue = computed({
  43723. get: () => (props.column?.filteredValue || [])[0],
  43724. set: (value) => {
  43725. if (filteredValue.value) if (!isPropAbsent(value)) filteredValue.value.splice(0, 1, value);
  43726. else filteredValue.value.splice(0, 1);
  43727. }
  43728. });
  43729. const filteredValue = computed({
  43730. get() {
  43731. if (props.column) return props.column.filteredValue || [];
  43732. return [];
  43733. },
  43734. set(value) {
  43735. if (props.column) props.upDataColumn?.("filteredValue", value);
  43736. }
  43737. });
  43738. const multiple = computed(() => {
  43739. if (props.column) return props.column.filterMultiple;
  43740. return true;
  43741. });
  43742. const isActive = (filter) => {
  43743. return filter.value === filterValue.value;
  43744. };
  43745. const hidden = () => {
  43746. tooltipRef.value?.onClose();
  43747. };
  43748. const handleConfirm = () => {
  43749. confirmFilter(filteredValue.value);
  43750. hidden();
  43751. };
  43752. const handleReset = () => {
  43753. filteredValue.value = [];
  43754. confirmFilter(filteredValue.value);
  43755. hidden();
  43756. };
  43757. const handleSelect = (_filterValue, index) => {
  43758. filterValue.value = _filterValue;
  43759. checkedIndex.value = index;
  43760. if (!isPropAbsent(_filterValue)) confirmFilter(filteredValue.value);
  43761. else confirmFilter([]);
  43762. hidden();
  43763. };
  43764. const confirmFilter = (filteredValue) => {
  43765. props.store?.commit("filterChange", {
  43766. column: props.column,
  43767. values: filteredValue
  43768. });
  43769. props.store?.updateAllSelected();
  43770. };
  43771. const handleShowTooltip = () => {
  43772. rootRef.value?.focus();
  43773. !multiple.value && initCheckedIndex();
  43774. if (props.column) props.upDataColumn?.("filterOpened", true);
  43775. };
  43776. const handleHideTooltip = () => {
  43777. if (props.column) props.upDataColumn?.("filterOpened", false);
  43778. };
  43779. const initCheckedIndex = () => {
  43780. if (isPropAbsent(filterValue)) {
  43781. checkedIndex.value = 0;
  43782. return;
  43783. }
  43784. const idx = (filters.value || []).findIndex((item) => {
  43785. return item.value === filterValue.value;
  43786. });
  43787. checkedIndex.value = idx >= 0 ? idx + 1 : 0;
  43788. };
  43789. const handleKeydown = (event) => {
  43790. const code = getEventCode(event);
  43791. const len = (filters.value ? filters.value.length : 0) + 1;
  43792. let index = checkedIndex.value;
  43793. let isPreventDefault = true;
  43794. switch (code) {
  43795. case EVENT_CODE.down:
  43796. case EVENT_CODE.right:
  43797. index = (index + 1) % len;
  43798. break;
  43799. case EVENT_CODE.up:
  43800. case EVENT_CODE.left:
  43801. index = (index - 1 + len) % len;
  43802. break;
  43803. case EVENT_CODE.tab:
  43804. hidden();
  43805. isPreventDefault = false;
  43806. break;
  43807. case EVENT_CODE.enter:
  43808. case EVENT_CODE.space:
  43809. if (index === 0) handleSelect(null, 0);
  43810. else {
  43811. const item = (filters.value || [])[index - 1];
  43812. item.value && handleSelect(item.value, index);
  43813. }
  43814. break;
  43815. default:
  43816. isPreventDefault = false;
  43817. break;
  43818. }
  43819. isPreventDefault && event.preventDefault();
  43820. checkedIndex.value = index;
  43821. rootRef.value?.querySelector(`.${ns.e("list-item")}:nth-child(${index + 1})`)?.focus();
  43822. };
  43823. return {
  43824. multiple,
  43825. filterClassName,
  43826. filteredValue,
  43827. filterValue,
  43828. filters,
  43829. handleConfirm,
  43830. handleReset,
  43831. handleSelect,
  43832. isPropAbsent,
  43833. isActive,
  43834. t,
  43835. ns,
  43836. tooltipRef,
  43837. rootRef,
  43838. checkedIndex,
  43839. handleShowTooltip,
  43840. handleHideTooltip,
  43841. handleKeydown
  43842. };
  43843. }
  43844. });
  43845. //#endregion
  43846. //#region ../../packages/components/table/src/filter-panel.vue
  43847. const _hoisted_1$17 = ["disabled"];
  43848. const _hoisted_2$10 = ["tabindex", "aria-checked"];
  43849. const _hoisted_3$3 = [
  43850. "tabindex",
  43851. "aria-checked",
  43852. "onClick"
  43853. ];
  43854. const _hoisted_4$2 = ["aria-label"];
  43855. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  43856. const _component_el_checkbox = resolveComponent("el-checkbox");
  43857. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  43858. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  43859. const _component_arrow_up = resolveComponent("arrow-up");
  43860. const _component_arrow_down = resolveComponent("arrow-down");
  43861. const _component_el_icon = resolveComponent("el-icon");
  43862. const _component_el_tooltip = resolveComponent("el-tooltip");
  43863. return openBlock(), createBlock(_component_el_tooltip, {
  43864. ref: "tooltipRef",
  43865. offset: 0,
  43866. placement: _ctx.placement,
  43867. "show-arrow": false,
  43868. trigger: "click",
  43869. role: "dialog",
  43870. teleported: "",
  43871. effect: "light",
  43872. pure: "",
  43873. loop: "",
  43874. "popper-class": _ctx.filterClassName,
  43875. persistent: "",
  43876. "append-to": _ctx.appendTo,
  43877. onShow: _ctx.handleShowTooltip,
  43878. onHide: _ctx.handleHideTooltip
  43879. }, {
  43880. content: withCtx(() => [_ctx.multiple ? (openBlock(), createElementBlock("div", {
  43881. key: 0,
  43882. ref: "rootRef",
  43883. tabindex: "-1",
  43884. class: normalizeClass(_ctx.ns.e("multiple"))
  43885. }, [createElementVNode("div", { class: normalizeClass(_ctx.ns.e("content")) }, [createVNode(_component_el_scrollbar, { "wrap-class": _ctx.ns.e("wrap") }, {
  43886. default: withCtx(() => [createVNode(_component_el_checkbox_group, {
  43887. modelValue: _ctx.filteredValue,
  43888. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  43889. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  43890. }, {
  43891. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  43892. return openBlock(), createBlock(_component_el_checkbox, {
  43893. key: filter.value,
  43894. value: filter.value
  43895. }, {
  43896. default: withCtx(() => [createTextVNode(toDisplayString(filter.text), 1)]),
  43897. _: 2
  43898. }, 1032, ["value"]);
  43899. }), 128))]),
  43900. _: 1
  43901. }, 8, ["modelValue", "class"])]),
  43902. _: 1
  43903. }, 8, ["wrap-class"])], 2), createElementVNode("div", { class: normalizeClass(_ctx.ns.e("bottom")) }, [createElementVNode("button", {
  43904. class: normalizeClass(_ctx.ns.is("disabled", _ctx.filteredValue.length === 0)),
  43905. disabled: _ctx.filteredValue.length === 0,
  43906. type: "button",
  43907. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  43908. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_1$17), createElementVNode("button", {
  43909. type: "button",
  43910. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  43911. }, toDisplayString(_ctx.t("el.table.resetFilter")), 1)], 2)], 2)) : (openBlock(), createElementBlock("ul", {
  43912. key: 1,
  43913. ref: "rootRef",
  43914. tabindex: "-1",
  43915. role: "radiogroup",
  43916. class: normalizeClass(_ctx.ns.e("list")),
  43917. onKeydown: _cache[4] || (_cache[4] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  43918. }, [createElementVNode("li", {
  43919. role: "radio",
  43920. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isPropAbsent(_ctx.filterValue))]),
  43921. tabindex: _ctx.checkedIndex === 0 ? 0 : -1,
  43922. "aria-checked": _ctx.isPropAbsent(_ctx.filterValue),
  43923. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null, 0))
  43924. }, toDisplayString(_ctx.t("el.table.clearFilter")), 11, _hoisted_2$10), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter, idx) => {
  43925. return openBlock(), createElementBlock("li", {
  43926. key: filter.value,
  43927. role: "radio",
  43928. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  43929. tabindex: _ctx.checkedIndex === idx + 1 ? 0 : -1,
  43930. "aria-checked": _ctx.isActive(filter),
  43931. onClick: ($event) => _ctx.handleSelect(filter.value, idx + 1)
  43932. }, toDisplayString(filter.text), 11, _hoisted_3$3);
  43933. }), 128))], 34))]),
  43934. default: withCtx(() => [createElementVNode("button", {
  43935. type: "button",
  43936. class: normalizeClass(`${_ctx.ns.namespace.value}-table__column-filter-trigger`),
  43937. "aria-label": _ctx.t("el.table.filterLabel", { column: _ctx.column?.label || "" })
  43938. }, [createVNode(_component_el_icon, null, {
  43939. default: withCtx(() => [renderSlot(_ctx.$slots, "filter-icon", {}, () => [_ctx.column?.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))])]),
  43940. _: 3
  43941. })], 10, _hoisted_4$2)]),
  43942. _: 3
  43943. }, 8, [
  43944. "placement",
  43945. "popper-class",
  43946. "append-to",
  43947. "onShow",
  43948. "onHide"
  43949. ]);
  43950. }
  43951. var filter_panel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(filter_panel_vue_vue_type_script_lang_default, [["render", _sfc_render$4]]);
  43952. //#endregion
  43953. //#region ../../packages/components/table/src/layout-observer.ts
  43954. function useLayoutObserver(root) {
  43955. const instance = getCurrentInstance();
  43956. onBeforeMount(() => {
  43957. tableLayout.value.addObserver(instance);
  43958. });
  43959. onMounted(() => {
  43960. onColumnsChange(tableLayout.value);
  43961. onScrollableChange(tableLayout.value);
  43962. });
  43963. onUpdated(() => {
  43964. onColumnsChange(tableLayout.value);
  43965. onScrollableChange(tableLayout.value);
  43966. });
  43967. onUnmounted(() => {
  43968. tableLayout.value.removeObserver(instance);
  43969. });
  43970. const tableLayout = computed(() => {
  43971. const layout = root.layout;
  43972. if (!layout) throw new Error("Can not find table layout.");
  43973. return layout;
  43974. });
  43975. const onColumnsChange = (layout) => {
  43976. const cols = root.vnode.el?.querySelectorAll("colgroup > col") || [];
  43977. if (!cols.length) return;
  43978. const flattenColumns = layout.getFlattenColumns();
  43979. const columnsMap = {};
  43980. flattenColumns.forEach((column) => {
  43981. columnsMap[column.id] = column;
  43982. });
  43983. for (let i = 0, j = cols.length; i < j; i++) {
  43984. const col = cols[i];
  43985. const column = columnsMap[col.getAttribute("name")];
  43986. if (column) col.setAttribute("width", column.realWidth || column.width);
  43987. }
  43988. };
  43989. const onScrollableChange = (layout) => {
  43990. const cols = root.vnode.el?.querySelectorAll("colgroup > col[name=gutter]") || [];
  43991. for (let i = 0, j = cols.length; i < j; i++) cols[i].setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  43992. const ths = root.vnode.el?.querySelectorAll("th.gutter") || [];
  43993. for (let i = 0, j = ths.length; i < j; i++) {
  43994. const th = ths[i];
  43995. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  43996. th.style.display = layout.scrollY.value ? "" : "none";
  43997. }
  43998. };
  43999. return {
  44000. tableLayout: tableLayout.value,
  44001. onColumnsChange,
  44002. onScrollableChange
  44003. };
  44004. }
  44005. //#endregion
  44006. //#region ../../packages/components/table/src/tokens.ts
  44007. const TABLE_INJECTION_KEY = Symbol("ElTable");
  44008. //#endregion
  44009. //#region ../../packages/components/table/src/table-header/event-helper.ts
  44010. function useEvent(props, emit) {
  44011. const instance = getCurrentInstance();
  44012. const parent = inject(TABLE_INJECTION_KEY);
  44013. const handleFilterClick = (event) => {
  44014. event.stopPropagation();
  44015. };
  44016. const handleHeaderClick = (event, column) => {
  44017. if (!column.filters && column.sortable) handleSortClick(event, column, false);
  44018. else if (column.filterable && !column.sortable) handleFilterClick(event);
  44019. parent?.emit("header-click", column, event);
  44020. };
  44021. const handleHeaderContextMenu = (event, column) => {
  44022. parent?.emit("header-contextmenu", column, event);
  44023. };
  44024. const draggingColumn = ref(null);
  44025. const dragging = ref(false);
  44026. const dragState = ref();
  44027. const handleMouseDown = (event, column) => {
  44028. if (!isClient) return;
  44029. if (column.children && column.children.length > 0) return;
  44030. /* istanbul ignore if */
  44031. if (draggingColumn.value && props.border && draggingColumn.value.id === column.id) {
  44032. dragging.value = true;
  44033. const table = parent;
  44034. emit("set-drag-visible", true);
  44035. const tableLeft = (table?.vnode.el)?.getBoundingClientRect().left;
  44036. const columnEl = instance?.vnode?.el?.querySelector(`th.${column.id}`);
  44037. const columnRect = columnEl.getBoundingClientRect();
  44038. const minLeft = columnRect.left - tableLeft + 30;
  44039. addClass(columnEl, "noclick");
  44040. dragState.value = {
  44041. startMouseLeft: event.clientX,
  44042. startLeft: columnRect.right - tableLeft,
  44043. startColumnLeft: columnRect.left - tableLeft,
  44044. tableLeft
  44045. };
  44046. const resizeProxy = table?.refs.resizeProxy;
  44047. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  44048. document.onselectstart = function() {
  44049. return false;
  44050. };
  44051. document.ondragstart = function() {
  44052. return false;
  44053. };
  44054. const handleMouseMove = (event) => {
  44055. const deltaLeft = event.clientX - dragState.value.startMouseLeft;
  44056. const proxyLeft = dragState.value.startLeft + deltaLeft;
  44057. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  44058. };
  44059. const handleMouseUp = () => {
  44060. if (dragging.value) {
  44061. const { startColumnLeft, startLeft } = dragState.value;
  44062. column.width = column.realWidth = Number.parseInt(resizeProxy.style.left, 10) - startColumnLeft;
  44063. table?.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  44064. requestAnimationFrame(() => {
  44065. props.store.scheduleLayout(false, true);
  44066. });
  44067. document.body.style.cursor = "";
  44068. dragging.value = false;
  44069. draggingColumn.value = null;
  44070. dragState.value = void 0;
  44071. emit("set-drag-visible", false);
  44072. }
  44073. document.removeEventListener("mousemove", handleMouseMove);
  44074. document.removeEventListener("mouseup", handleMouseUp);
  44075. document.onselectstart = null;
  44076. document.ondragstart = null;
  44077. setTimeout(() => {
  44078. removeClass(columnEl, "noclick");
  44079. }, 0);
  44080. };
  44081. document.addEventListener("mousemove", handleMouseMove);
  44082. document.addEventListener("mouseup", handleMouseUp);
  44083. }
  44084. };
  44085. const handleMouseMove = (event, column) => {
  44086. if (!props.border || column.children && column.children.length > 0) return;
  44087. const el = event.target;
  44088. const target = isElement$1(el) ? el.closest("th") : null;
  44089. if (!target) return;
  44090. const isSortable = hasClass(target, "is-sortable");
  44091. if (isSortable) {
  44092. const cursor = dragging.value ? "col-resize" : "";
  44093. target.style.cursor = cursor;
  44094. const caret = target.querySelector(".caret-wrapper");
  44095. if (caret) caret.style.cursor = cursor;
  44096. }
  44097. if (!column.resizable || dragging.value) {
  44098. draggingColumn.value = null;
  44099. return;
  44100. }
  44101. const rect = target.getBoundingClientRect();
  44102. const isLastTh = target.parentNode?.lastElementChild === target;
  44103. const allowDrag = props.allowDragLastColumn || !isLastTh;
  44104. const isResizeHandleActive = rect.width > 12 && rect.right - event.clientX < 8 && allowDrag;
  44105. const cursor = isResizeHandleActive ? "col-resize" : "";
  44106. document.body.style.cursor = cursor;
  44107. draggingColumn.value = isResizeHandleActive ? column : null;
  44108. if (isSortable) target.style.cursor = cursor;
  44109. };
  44110. const handleMouseOut = () => {
  44111. if (!isClient || dragging.value) return;
  44112. document.body.style.cursor = "";
  44113. };
  44114. const toggleOrder = ({ order, sortOrders }) => {
  44115. if (order === "") return sortOrders[0];
  44116. const index = sortOrders.indexOf(order || null);
  44117. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  44118. };
  44119. const handleSortClick = (event, column, givenOrder) => {
  44120. event.stopPropagation();
  44121. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  44122. const target = event.target?.closest("th");
  44123. if (target) {
  44124. if (hasClass(target, "noclick")) {
  44125. removeClass(target, "noclick");
  44126. return;
  44127. }
  44128. }
  44129. if (!column.sortable) return;
  44130. const clickTarget = event.currentTarget;
  44131. if (["ascending", "descending"].some((str) => hasClass(clickTarget, str) && !column.sortOrders.includes(str))) return;
  44132. const states = props.store.states;
  44133. let sortProp = states.sortProp.value;
  44134. let sortOrder;
  44135. const sortingColumn = states.sortingColumn.value;
  44136. if (sortingColumn !== column || sortingColumn === column && isNull(sortingColumn.order)) {
  44137. if (sortingColumn) sortingColumn.order = null;
  44138. states.sortingColumn.value = column;
  44139. sortProp = column.property;
  44140. }
  44141. if (!order) sortOrder = column.order = null;
  44142. else sortOrder = column.order = order;
  44143. states.sortProp.value = sortProp;
  44144. states.sortOrder.value = sortOrder;
  44145. parent?.store.commit("changeSortCondition");
  44146. };
  44147. return {
  44148. handleHeaderClick,
  44149. handleHeaderContextMenu,
  44150. handleMouseDown,
  44151. handleMouseMove,
  44152. handleMouseOut,
  44153. handleSortClick,
  44154. handleFilterClick
  44155. };
  44156. }
  44157. //#endregion
  44158. //#region ../../packages/components/table/src/table-header/style.helper.ts
  44159. function useStyle$2(props) {
  44160. const parent = inject(TABLE_INJECTION_KEY);
  44161. const ns = useNamespace("table");
  44162. const getHeaderRowStyle = (rowIndex) => {
  44163. const headerRowStyle = parent?.props.headerRowStyle;
  44164. if (isFunction$1(headerRowStyle)) return headerRowStyle.call(null, { rowIndex });
  44165. return headerRowStyle;
  44166. };
  44167. const getHeaderRowClass = (rowIndex) => {
  44168. const classes = [];
  44169. const headerRowClassName = parent?.props.headerRowClassName;
  44170. if (isString(headerRowClassName)) classes.push(headerRowClassName);
  44171. else if (isFunction$1(headerRowClassName)) classes.push(headerRowClassName.call(null, { rowIndex }));
  44172. return classes.join(" ");
  44173. };
  44174. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  44175. let headerCellStyles = parent?.props.headerCellStyle ?? {};
  44176. if (isFunction$1(headerCellStyles)) headerCellStyles = headerCellStyles.call(null, {
  44177. rowIndex,
  44178. columnIndex,
  44179. row,
  44180. column
  44181. });
  44182. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  44183. ensurePosition(fixedStyle, "left");
  44184. ensurePosition(fixedStyle, "right");
  44185. return Object.assign({}, headerCellStyles, fixedStyle);
  44186. };
  44187. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  44188. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  44189. const classes = [
  44190. column.id,
  44191. column.order,
  44192. column.headerAlign,
  44193. column.className,
  44194. column.labelClassName,
  44195. ...fixedClasses
  44196. ];
  44197. if (!column.children) classes.push("is-leaf");
  44198. if (column.sortable) classes.push("is-sortable");
  44199. const headerCellClassName = parent?.props.headerCellClassName;
  44200. if (isString(headerCellClassName)) classes.push(headerCellClassName);
  44201. else if (isFunction$1(headerCellClassName)) classes.push(headerCellClassName.call(null, {
  44202. rowIndex,
  44203. columnIndex,
  44204. row,
  44205. column
  44206. }));
  44207. classes.push(ns.e("cell"));
  44208. return classes.filter((className) => Boolean(className)).join(" ");
  44209. };
  44210. return {
  44211. getHeaderRowStyle,
  44212. getHeaderRowClass,
  44213. getHeaderCellStyle,
  44214. getHeaderCellClass
  44215. };
  44216. }
  44217. //#endregion
  44218. //#region ../../packages/components/table/src/table-header/utils-helper.ts
  44219. const getAllColumns = (columns) => {
  44220. const result = [];
  44221. columns.forEach((column) => {
  44222. if (column.children) {
  44223. result.push(column);
  44224. result.push.apply(result, getAllColumns(column.children));
  44225. } else result.push(column);
  44226. });
  44227. return result;
  44228. };
  44229. const convertToRows = (originColumns) => {
  44230. let maxLevel = 1;
  44231. const traverse = (column, parent) => {
  44232. if (parent) {
  44233. column.level = parent.level + 1;
  44234. if (maxLevel < column.level) maxLevel = column.level;
  44235. }
  44236. if (column.children) {
  44237. let colSpan = 0;
  44238. column.children.forEach((subColumn) => {
  44239. traverse(subColumn, column);
  44240. colSpan += subColumn.colSpan;
  44241. });
  44242. column.colSpan = colSpan;
  44243. } else column.colSpan = 1;
  44244. };
  44245. originColumns.forEach((column) => {
  44246. column.level = 1;
  44247. traverse(column, void 0);
  44248. });
  44249. const rows = [];
  44250. for (let i = 0; i < maxLevel; i++) rows.push([]);
  44251. getAllColumns(originColumns).forEach((column) => {
  44252. if (!column.children) column.rowSpan = maxLevel - column.level + 1;
  44253. else {
  44254. column.rowSpan = 1;
  44255. column.children.forEach((col) => col.isSubColumn = true);
  44256. }
  44257. rows[column.level - 1].push(column);
  44258. });
  44259. return rows;
  44260. };
  44261. function useUtils$1(props) {
  44262. const parent = inject(TABLE_INJECTION_KEY);
  44263. const columnRows = computed(() => {
  44264. return convertToRows(props.store.states.originColumns.value);
  44265. });
  44266. const isGroup = computed(() => {
  44267. const result = columnRows.value.length > 1;
  44268. if (result && parent) parent.state.isGroup.value = true;
  44269. return result;
  44270. });
  44271. const toggleAllSelection = (event) => {
  44272. event.stopPropagation();
  44273. parent?.store.commit("toggleAllSelection");
  44274. };
  44275. return {
  44276. isGroup,
  44277. toggleAllSelection,
  44278. columnRows
  44279. };
  44280. }
  44281. //#endregion
  44282. //#region ../../packages/components/table/src/table-header/index.ts
  44283. var table_header_default = defineComponent({
  44284. name: "ElTableHeader",
  44285. components: { ElCheckbox },
  44286. props: {
  44287. fixed: {
  44288. type: String,
  44289. default: ""
  44290. },
  44291. store: {
  44292. required: true,
  44293. type: Object
  44294. },
  44295. border: Boolean,
  44296. defaultSort: {
  44297. type: Object,
  44298. default: () => {
  44299. return {
  44300. prop: "",
  44301. order: ""
  44302. };
  44303. }
  44304. },
  44305. appendFilterPanelTo: { type: String },
  44306. allowDragLastColumn: { type: Boolean }
  44307. },
  44308. setup(props, { emit }) {
  44309. const instance = getCurrentInstance();
  44310. const parent = inject(TABLE_INJECTION_KEY);
  44311. const ns = useNamespace("table");
  44312. const filterPanels = ref({});
  44313. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  44314. const isTableLayoutAuto = parent?.props.tableLayout === "auto";
  44315. const saveIndexSelection = reactive(/* @__PURE__ */ new Map());
  44316. const theadRef = ref();
  44317. let delayId;
  44318. const updateFixedColumnStyle = () => {
  44319. delayId = setTimeout(() => {
  44320. if (saveIndexSelection.size > 0) {
  44321. saveIndexSelection.forEach((column, key) => {
  44322. const el = theadRef.value.querySelector(`.${key.replace(/\s/g, ".")}`);
  44323. if (el) column.width = el.getBoundingClientRect().width || column.width;
  44324. });
  44325. saveIndexSelection.clear();
  44326. }
  44327. });
  44328. };
  44329. watch(saveIndexSelection, updateFixedColumnStyle);
  44330. onBeforeUnmount(() => {
  44331. if (delayId) {
  44332. clearTimeout(delayId);
  44333. delayId = void 0;
  44334. }
  44335. });
  44336. onMounted(async () => {
  44337. await nextTick();
  44338. await nextTick();
  44339. const { prop, order } = props.defaultSort;
  44340. parent?.store.commit("sort", {
  44341. prop,
  44342. order,
  44343. init: true
  44344. });
  44345. updateFixedColumnStyle();
  44346. });
  44347. const { handleHeaderClick, handleHeaderContextMenu, handleMouseDown, handleMouseMove, handleMouseOut, handleSortClick, handleFilterClick } = useEvent(props, emit);
  44348. const { getHeaderRowStyle, getHeaderRowClass, getHeaderCellStyle, getHeaderCellClass } = useStyle$2(props);
  44349. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  44350. const { t } = useLocale();
  44351. instance.state = {
  44352. onColumnsChange,
  44353. onScrollableChange
  44354. };
  44355. instance.filterPanels = filterPanels;
  44356. return {
  44357. ns,
  44358. t,
  44359. filterPanels,
  44360. onColumnsChange,
  44361. onScrollableChange,
  44362. columnRows,
  44363. getHeaderRowClass,
  44364. getHeaderRowStyle,
  44365. getHeaderCellClass,
  44366. getHeaderCellStyle,
  44367. handleHeaderClick,
  44368. handleHeaderContextMenu,
  44369. handleMouseDown,
  44370. handleMouseMove,
  44371. handleMouseOut,
  44372. handleSortClick,
  44373. handleFilterClick,
  44374. isGroup,
  44375. toggleAllSelection,
  44376. saveIndexSelection,
  44377. isTableLayoutAuto,
  44378. theadRef,
  44379. updateFixedColumnStyle
  44380. };
  44381. },
  44382. render() {
  44383. const { ns, t, isGroup, columnRows, getHeaderCellStyle, getHeaderCellClass, getHeaderRowClass, getHeaderRowStyle, handleHeaderClick, handleHeaderContextMenu, handleMouseDown, handleMouseMove, handleSortClick, handleMouseOut, store, $parent, saveIndexSelection, isTableLayoutAuto } = this;
  44384. let rowSpan = 1;
  44385. return h("thead", {
  44386. ref: "theadRef",
  44387. class: ns.is("group", isGroup)
  44388. }, columnRows.map((subColumns, rowIndex) => h("tr", {
  44389. class: getHeaderRowClass(rowIndex),
  44390. key: rowIndex,
  44391. style: getHeaderRowStyle(rowIndex)
  44392. }, subColumns.map((column, cellIndex) => {
  44393. if (column.rowSpan > rowSpan) rowSpan = column.rowSpan;
  44394. const _class = getHeaderCellClass(rowIndex, cellIndex, subColumns, column);
  44395. if (isTableLayoutAuto && column.fixed) saveIndexSelection.set(_class, column);
  44396. return h("th", {
  44397. class: _class,
  44398. colspan: column.colSpan,
  44399. key: `${column.id}-thead`,
  44400. rowspan: column.rowSpan,
  44401. scope: column.colSpan > 1 ? "colgroup" : "col",
  44402. ariaSort: column.sortable ? column.order : void 0,
  44403. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  44404. onClick: ($event) => {
  44405. if ($event.currentTarget?.classList.contains("noclick")) return;
  44406. handleHeaderClick($event, column);
  44407. },
  44408. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  44409. onMousedown: ($event) => handleMouseDown($event, column),
  44410. onMousemove: ($event) => handleMouseMove($event, column),
  44411. onMouseout: handleMouseOut
  44412. }, [h("div", { class: ["cell", column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""] }, [
  44413. column.renderHeader ? column.renderHeader({
  44414. column,
  44415. $index: cellIndex,
  44416. store,
  44417. _self: $parent
  44418. }) : column.label,
  44419. column.sortable && h("button", {
  44420. type: "button",
  44421. class: "caret-wrapper",
  44422. "aria-label": t("el.table.sortLabel", { column: column.label || "" }),
  44423. onClick: ($event) => handleSortClick($event, column)
  44424. }, [h("i", {
  44425. onClick: ($event) => handleSortClick($event, column, "ascending"),
  44426. class: "sort-caret ascending"
  44427. }), h("i", {
  44428. onClick: ($event) => handleSortClick($event, column, "descending"),
  44429. class: "sort-caret descending"
  44430. })]),
  44431. column.filterable && h(filter_panel_default, {
  44432. store,
  44433. placement: column.filterPlacement || "bottom-start",
  44434. appendTo: $parent?.appendFilterPanelTo,
  44435. column,
  44436. upDataColumn: (key, value) => {
  44437. column[key] = value;
  44438. }
  44439. }, { "filter-icon": () => column.renderFilterIcon ? column.renderFilterIcon({ filterOpened: column.filterOpened }) : null })
  44440. ])]);
  44441. }))));
  44442. }
  44443. });
  44444. //#endregion
  44445. //#region ../../packages/components/table/src/table-body/events-helper.ts
  44446. function useEvents(props) {
  44447. const parent = inject(TABLE_INJECTION_KEY);
  44448. const tooltipContent = ref("");
  44449. const tooltipTrigger = ref(h("div"));
  44450. const handleEvent = (event, row, name) => {
  44451. const table = parent;
  44452. const cell = getCell(event);
  44453. let column = null;
  44454. const namespace = table?.vnode.el?.dataset.prefix;
  44455. if (cell) {
  44456. column = getColumnByCell({ columns: props.store?.states.columns.value ?? [] }, cell, namespace);
  44457. if (column) table?.emit(`cell-${name}`, row, column, cell, event);
  44458. }
  44459. table?.emit(`row-${name}`, row, column, event);
  44460. };
  44461. const handleDoubleClick = (event, row) => {
  44462. handleEvent(event, row, "dblclick");
  44463. };
  44464. const handleClick = (event, row) => {
  44465. props.store?.commit("setCurrentRow", row);
  44466. handleEvent(event, row, "click");
  44467. };
  44468. const handleContextMenu = (event, row) => {
  44469. handleEvent(event, row, "contextmenu");
  44470. };
  44471. const handleMouseEnter = debounce((index) => {
  44472. props.store?.commit("setHoverRow", index);
  44473. }, 30);
  44474. const handleMouseLeave = debounce(() => {
  44475. props.store?.commit("setHoverRow", null);
  44476. }, 30);
  44477. const getPadding = (el) => {
  44478. const style = window.getComputedStyle(el, null);
  44479. return {
  44480. left: Number.parseInt(style.paddingLeft, 10) || 0,
  44481. right: Number.parseInt(style.paddingRight, 10) || 0,
  44482. top: Number.parseInt(style.paddingTop, 10) || 0,
  44483. bottom: Number.parseInt(style.paddingBottom, 10) || 0
  44484. };
  44485. };
  44486. const toggleRowClassByCell = (rowSpan, event, toggle) => {
  44487. let node = (event?.target)?.parentNode;
  44488. while (rowSpan > 1) {
  44489. node = node?.nextSibling;
  44490. if (!node || node.nodeName !== "TR") break;
  44491. toggle(node, "hover-row hover-fixed-row");
  44492. rowSpan--;
  44493. }
  44494. };
  44495. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  44496. if (!parent) return;
  44497. const table = parent;
  44498. const cell = getCell(event);
  44499. const namespace = table?.vnode.el?.dataset.prefix;
  44500. let column = null;
  44501. if (cell) {
  44502. column = getColumnByCell({ columns: props.store?.states.columns.value ?? [] }, cell, namespace);
  44503. if (!column) return;
  44504. if (cell.rowSpan > 1) toggleRowClassByCell(cell.rowSpan, event, addClass);
  44505. const hoverState = table.hoverState = {
  44506. cell,
  44507. column,
  44508. row
  44509. };
  44510. table?.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  44511. }
  44512. if (!tooltipOptions) {
  44513. if (removePopper?.trigger === cell) removePopper?.();
  44514. return;
  44515. }
  44516. const cellChild = event.target.querySelector(".cell");
  44517. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length && cellChild.textContent?.trim())) return;
  44518. const range = document.createRange();
  44519. range.setStart(cellChild, 0);
  44520. range.setEnd(cellChild, cellChild.childNodes.length);
  44521. /** detail: https://github.com/element-plus/element-plus/issues/10790
  44522. * What went wrong?
  44523. * UI > Browser > Zoom, In Blink/WebKit, getBoundingClientRect() sometimes returns inexact values, probably due to lost precision during internal calculations. In the example above:
  44524. * - Expected: 188
  44525. * - Actual: 188.00000762939453
  44526. */
  44527. const { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
  44528. const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
  44529. const { top, left, right, bottom } = getPadding(cellChild);
  44530. const horizontalPadding = left + right;
  44531. const verticalPadding = top + bottom;
  44532. if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) createTablePopper(tooltipOptions, (cell?.innerText || cell?.textContent) ?? "", row, column, cell, table);
  44533. else if (removePopper?.trigger === cell) removePopper?.();
  44534. };
  44535. const handleCellMouseLeave = (event) => {
  44536. const cell = getCell(event);
  44537. if (!cell) return;
  44538. if (cell.rowSpan > 1) toggleRowClassByCell(cell.rowSpan, event, removeClass);
  44539. const oldHoverState = parent?.hoverState;
  44540. parent?.emit("cell-mouse-leave", oldHoverState?.row, oldHoverState?.column, oldHoverState?.cell, event);
  44541. };
  44542. return {
  44543. handleDoubleClick,
  44544. handleClick,
  44545. handleContextMenu,
  44546. handleMouseEnter,
  44547. handleMouseLeave,
  44548. handleCellMouseEnter,
  44549. handleCellMouseLeave,
  44550. tooltipContent,
  44551. tooltipTrigger
  44552. };
  44553. }
  44554. //#endregion
  44555. //#region ../../packages/components/table/src/table-body/styles-helper.ts
  44556. function useStyles$1(props) {
  44557. const parent = inject(TABLE_INJECTION_KEY);
  44558. const ns = useNamespace("table");
  44559. const getRowStyle = (row, rowIndex) => {
  44560. const rowStyle = parent?.props.rowStyle;
  44561. if (isFunction$1(rowStyle)) return rowStyle.call(null, {
  44562. row,
  44563. rowIndex
  44564. });
  44565. return rowStyle || null;
  44566. };
  44567. const getRowClass = (row, rowIndex, displayIndex) => {
  44568. const classes = [ns.e("row")];
  44569. if (parent?.props.highlightCurrentRow && row === props.store?.states.currentRow.value) classes.push("current-row");
  44570. if (props.stripe && displayIndex % 2 === 1) classes.push(ns.em("row", "striped"));
  44571. const rowClassName = parent?.props.rowClassName;
  44572. if (isString(rowClassName)) classes.push(rowClassName);
  44573. else if (isFunction$1(rowClassName)) classes.push(rowClassName.call(null, {
  44574. row,
  44575. rowIndex
  44576. }));
  44577. return classes;
  44578. };
  44579. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  44580. const cellStyle = parent?.props.cellStyle;
  44581. let cellStyles = cellStyle ?? {};
  44582. if (isFunction$1(cellStyle)) cellStyles = cellStyle.call(null, {
  44583. rowIndex,
  44584. columnIndex,
  44585. row,
  44586. column
  44587. });
  44588. const fixedStyle = getFixedColumnOffset(columnIndex, props?.fixed, props.store);
  44589. ensurePosition(fixedStyle, "left");
  44590. ensurePosition(fixedStyle, "right");
  44591. return Object.assign({}, cellStyles, fixedStyle);
  44592. };
  44593. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  44594. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props?.fixed, props.store, void 0, offset);
  44595. const classes = [
  44596. column.id,
  44597. column.align,
  44598. column.className,
  44599. ...fixedClasses
  44600. ];
  44601. const cellClassName = parent?.props.cellClassName;
  44602. if (isString(cellClassName)) classes.push(cellClassName);
  44603. else if (isFunction$1(cellClassName)) classes.push(cellClassName.call(null, {
  44604. rowIndex,
  44605. columnIndex,
  44606. row,
  44607. column
  44608. }));
  44609. classes.push(ns.e("cell"));
  44610. return classes.filter((className) => Boolean(className)).join(" ");
  44611. };
  44612. const getSpan = (row, column, rowIndex, columnIndex) => {
  44613. let rowspan = 1;
  44614. let colspan = 1;
  44615. const fn = parent?.props.spanMethod;
  44616. if (isFunction$1(fn)) {
  44617. const result = fn({
  44618. row,
  44619. column,
  44620. rowIndex,
  44621. columnIndex
  44622. });
  44623. if (isArray$1(result)) {
  44624. rowspan = result[0];
  44625. colspan = result[1];
  44626. } else if (isObject$1(result)) {
  44627. rowspan = result.rowspan;
  44628. colspan = result.colspan;
  44629. }
  44630. }
  44631. return {
  44632. rowspan,
  44633. colspan
  44634. };
  44635. };
  44636. const getColspanRealWidth = (columns, colspan, index) => {
  44637. if (colspan < 1) return columns[index].realWidth;
  44638. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  44639. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  44640. };
  44641. return {
  44642. getRowStyle,
  44643. getRowClass,
  44644. getCellStyle,
  44645. getCellClass,
  44646. getSpan,
  44647. getColspanRealWidth
  44648. };
  44649. }
  44650. //#endregion
  44651. //#region ../../packages/components/table/src/table-body/td-wrapper.vue?vue&type=script&setup=true&lang.ts
  44652. const _hoisted_1$16 = ["colspan", "rowspan"];
  44653. var td_wrapper_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  44654. name: "TableTdWrapper",
  44655. __name: "td-wrapper",
  44656. props: {
  44657. colspan: {
  44658. type: Number,
  44659. default: 1
  44660. },
  44661. rowspan: {
  44662. type: Number,
  44663. default: 1
  44664. }
  44665. },
  44666. setup(__props) {
  44667. return (_ctx, _cache) => {
  44668. return openBlock(), createElementBlock("td", {
  44669. colspan: __props.colspan,
  44670. rowspan: __props.rowspan
  44671. }, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_1$16);
  44672. };
  44673. }
  44674. });
  44675. //#endregion
  44676. //#region ../../packages/components/table/src/table-body/td-wrapper.vue
  44677. var td_wrapper_default = td_wrapper_vue_vue_type_script_setup_true_lang_default;
  44678. //#endregion
  44679. //#region ../../packages/components/table/src/table-body/render-helper.ts
  44680. function useRender$1(props) {
  44681. const parent = inject(TABLE_INJECTION_KEY);
  44682. const ns = useNamespace("table");
  44683. const { handleDoubleClick, handleClick, handleContextMenu, handleMouseEnter, handleMouseLeave, handleCellMouseEnter, handleCellMouseLeave, tooltipContent, tooltipTrigger } = useEvents(props);
  44684. const { getRowStyle, getRowClass, getCellStyle, getCellClass, getSpan, getColspanRealWidth } = useStyles$1(props);
  44685. let displayIndex = -1;
  44686. const firstDefaultColumnIndex = computed(() => {
  44687. return props.store?.states.columns.value.findIndex(({ type }) => type === "default");
  44688. });
  44689. const getKeyOfRow = (row, index) => {
  44690. const rowKey = (parent?.props)?.rowKey;
  44691. if (rowKey) return getRowIdentity(row, rowKey);
  44692. return index;
  44693. };
  44694. const rowRender = (row, $index, treeRowData, expanded = false) => {
  44695. const { tooltipEffect, tooltipOptions, store } = props;
  44696. const { indent, columns } = store.states;
  44697. const rowClasses = [];
  44698. let display = true;
  44699. if (treeRowData) {
  44700. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  44701. display = !!treeRowData.display;
  44702. }
  44703. if ($index === 0) displayIndex = -1;
  44704. if (props.stripe && display) displayIndex++;
  44705. rowClasses.push(...getRowClass(row, $index, displayIndex));
  44706. return h("tr", {
  44707. style: [display ? null : { display: "none" }, getRowStyle(row, $index)],
  44708. class: rowClasses,
  44709. key: getKeyOfRow(row, $index),
  44710. onDblclick: ($event) => handleDoubleClick($event, row),
  44711. onClick: ($event) => handleClick($event, row),
  44712. onContextmenu: ($event) => handleContextMenu($event, row),
  44713. onMouseenter: () => handleMouseEnter($index),
  44714. onMouseleave: handleMouseLeave
  44715. }, columns.value.map((column, cellIndex) => {
  44716. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  44717. if (!rowspan || !colspan) return null;
  44718. const columnData = Object.assign({}, column);
  44719. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  44720. const data = {
  44721. store,
  44722. _self: props.context || parent,
  44723. column: columnData,
  44724. row,
  44725. $index,
  44726. cellIndex,
  44727. expanded
  44728. };
  44729. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  44730. data.treeNode = {
  44731. indent: treeRowData.level && treeRowData.level * indent.value,
  44732. level: treeRowData.level
  44733. };
  44734. if (isBoolean(treeRowData.expanded)) {
  44735. data.treeNode.expanded = treeRowData.expanded;
  44736. if ("loading" in treeRowData) data.treeNode.loading = treeRowData.loading;
  44737. if ("noLazyChildren" in treeRowData) data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  44738. }
  44739. }
  44740. const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`;
  44741. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  44742. const mergedTooltipOptions = column.showOverflowTooltip && merge({ effect: tooltipEffect }, tooltipOptions, column.showOverflowTooltip);
  44743. return h(td_wrapper_default, {
  44744. style: getCellStyle($index, cellIndex, row, column),
  44745. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  44746. key: `${patchKey}${baseKey}`,
  44747. rowspan,
  44748. colspan,
  44749. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  44750. onMouseleave: handleCellMouseLeave
  44751. }, { default: () => cellChildren(cellIndex, column, data) });
  44752. }));
  44753. };
  44754. const cellChildren = (_cellIndex, column, data) => {
  44755. return column.renderCell(data);
  44756. };
  44757. const wrappedRowRender = (row, $index) => {
  44758. const store = props.store;
  44759. const { isRowExpanded, assertRowKey } = store;
  44760. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  44761. const columns = store.states.columns.value;
  44762. if (columns.some(({ type }) => type === "expand")) {
  44763. const expanded = isRowExpanded(row);
  44764. const tr = rowRender(row, $index, void 0, expanded);
  44765. const renderExpanded = parent?.renderExpanded;
  44766. if (!renderExpanded) {
  44767. console.error("[Element Error]renderExpanded is required.");
  44768. return tr;
  44769. }
  44770. const rows = [[tr]];
  44771. if (parent.props.preserveExpandedContent || expanded) rows[0].push(h("tr", {
  44772. key: `expanded-row__${tr.key}`,
  44773. style: { display: expanded ? "" : "none" }
  44774. }, [h("td", {
  44775. colspan: columns.length,
  44776. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  44777. }, [renderExpanded({
  44778. row,
  44779. $index,
  44780. store,
  44781. expanded
  44782. })])]));
  44783. return rows;
  44784. } else if (Object.keys(treeData.value).length) {
  44785. assertRowKey();
  44786. const key = getRowIdentity(row, rowKey.value);
  44787. let cur = treeData.value[key];
  44788. let treeRowData = null;
  44789. if (cur) {
  44790. treeRowData = {
  44791. expanded: cur.expanded,
  44792. level: cur.level,
  44793. display: true,
  44794. noLazyChildren: void 0,
  44795. loading: void 0
  44796. };
  44797. if (isBoolean(cur.lazy)) {
  44798. if (treeRowData && isBoolean(cur.loaded) && cur.loaded) treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  44799. treeRowData.loading = cur.loading;
  44800. }
  44801. }
  44802. const tmp = [rowRender(row, $index, treeRowData ?? void 0)];
  44803. if (cur) {
  44804. let i = 0;
  44805. const traverse = (children, parent) => {
  44806. if (!(children && children.length && parent)) return;
  44807. children.forEach((node) => {
  44808. const innerTreeRowData = {
  44809. display: parent.display && parent.expanded,
  44810. level: parent.level + 1,
  44811. expanded: false,
  44812. noLazyChildren: false,
  44813. loading: false
  44814. };
  44815. const childKey = getRowIdentity(node, rowKey.value);
  44816. if (isPropAbsent(childKey)) throw new Error("For nested data item, row-key is required.");
  44817. cur = { ...treeData.value[childKey] };
  44818. if (cur) {
  44819. innerTreeRowData.expanded = cur.expanded;
  44820. cur.level = cur.level || innerTreeRowData.level;
  44821. cur.display = !!(cur.expanded && innerTreeRowData.display);
  44822. if (isBoolean(cur.lazy)) {
  44823. if (isBoolean(cur.loaded) && cur.loaded) innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  44824. innerTreeRowData.loading = cur.loading;
  44825. }
  44826. }
  44827. i++;
  44828. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  44829. if (cur) traverse(lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value], cur);
  44830. });
  44831. };
  44832. cur.display = true;
  44833. traverse(lazyTreeNodeMap.value[key] || row[childrenColumnName.value], cur);
  44834. }
  44835. return tmp;
  44836. } else return rowRender(row, $index, void 0);
  44837. };
  44838. return {
  44839. wrappedRowRender,
  44840. tooltipContent,
  44841. tooltipTrigger
  44842. };
  44843. }
  44844. //#endregion
  44845. //#region ../../packages/components/table/src/table-body/defaults.ts
  44846. const defaultProps$1 = {
  44847. store: {
  44848. required: true,
  44849. type: Object
  44850. },
  44851. stripe: Boolean,
  44852. tooltipEffect: String,
  44853. tooltipOptions: { type: Object },
  44854. context: {
  44855. default: () => ({}),
  44856. type: Object
  44857. },
  44858. rowClassName: [String, Function],
  44859. rowStyle: [Object, Function],
  44860. fixed: {
  44861. type: String,
  44862. default: ""
  44863. },
  44864. highlight: Boolean
  44865. };
  44866. //#endregion
  44867. //#region ../../packages/components/table/src/table-body/index.ts
  44868. var table_body_default = defineComponent({
  44869. name: "ElTableBody",
  44870. props: defaultProps$1,
  44871. setup(props) {
  44872. const instance = getCurrentInstance();
  44873. const parent = inject(TABLE_INJECTION_KEY);
  44874. const ns = useNamespace("table");
  44875. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  44876. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  44877. const hoveredCellList = [];
  44878. watch(props.store?.states.hoverRow, (newVal, oldVal) => {
  44879. const el = instance?.vnode.el;
  44880. const rows = Array.from(el?.children || []).filter((e) => e?.classList.contains(`${ns.e("row")}`));
  44881. let rowNum = newVal;
  44882. const childNodes = rows[rowNum]?.childNodes;
  44883. if (childNodes?.length) {
  44884. let control = 0;
  44885. Array.from(childNodes).reduce((acc, item, index) => {
  44886. if (childNodes[index]?.colSpan > 1) control = childNodes[index]?.colSpan;
  44887. if (item.nodeName !== "TD" && control === 0) acc.push(index);
  44888. control > 0 && control--;
  44889. return acc;
  44890. }, []).forEach((rowIndex) => {
  44891. rowNum = newVal;
  44892. while (rowNum > 0) {
  44893. const preChildNodes = rows[rowNum - 1]?.childNodes;
  44894. if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
  44895. addClass(preChildNodes[rowIndex], "hover-cell");
  44896. hoveredCellList.push(preChildNodes[rowIndex]);
  44897. break;
  44898. }
  44899. rowNum--;
  44900. }
  44901. });
  44902. } else {
  44903. hoveredCellList.forEach((item) => removeClass(item, "hover-cell"));
  44904. hoveredCellList.length = 0;
  44905. }
  44906. if (!props.store?.states.isComplex.value || !isClient) return;
  44907. rAF(() => {
  44908. const oldRow = rows[oldVal];
  44909. const newRow = rows[newVal];
  44910. if (oldRow && !oldRow.classList.contains("hover-fixed-row")) removeClass(oldRow, "hover-row");
  44911. if (newRow) addClass(newRow, "hover-row");
  44912. });
  44913. });
  44914. onUnmounted(() => {
  44915. removePopper?.();
  44916. });
  44917. return {
  44918. ns,
  44919. onColumnsChange,
  44920. onScrollableChange,
  44921. wrappedRowRender,
  44922. tooltipContent,
  44923. tooltipTrigger
  44924. };
  44925. },
  44926. render() {
  44927. const { wrappedRowRender, store } = this;
  44928. return h("tbody", { tabIndex: -1 }, [(store?.states.data.value || []).reduce((acc, row) => {
  44929. return acc.concat(wrappedRowRender(row, acc.length));
  44930. }, [])]);
  44931. }
  44932. });
  44933. //#endregion
  44934. //#region ../../packages/components/table/src/table-footer/mapState-helper.ts
  44935. function useMapState() {
  44936. const store = inject(TABLE_INJECTION_KEY)?.store;
  44937. return {
  44938. leftFixedLeafCount: computed(() => {
  44939. return store?.states.fixedLeafColumnsLength.value ?? 0;
  44940. }),
  44941. rightFixedLeafCount: computed(() => {
  44942. return store?.states.rightFixedColumns.value.length ?? 0;
  44943. }),
  44944. columnsCount: computed(() => {
  44945. return store?.states.columns.value.length ?? 0;
  44946. }),
  44947. leftFixedCount: computed(() => {
  44948. return store?.states.fixedColumns.value.length ?? 0;
  44949. }),
  44950. rightFixedCount: computed(() => {
  44951. return store?.states.rightFixedColumns.value.length ?? 0;
  44952. }),
  44953. columns: computed(() => store?.states.columns.value ?? [])
  44954. };
  44955. }
  44956. //#endregion
  44957. //#region ../../packages/components/table/src/table-footer/style-helper.ts
  44958. function useStyle$1(props) {
  44959. const { columns } = useMapState();
  44960. const ns = useNamespace("table");
  44961. const getCellClasses = (columns, cellIndex) => {
  44962. const column = columns[cellIndex];
  44963. const classes = [
  44964. ns.e("cell"),
  44965. column.id,
  44966. column.align,
  44967. column.labelClassName,
  44968. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  44969. ];
  44970. if (column.className) classes.push(column.className);
  44971. if (!column.children) classes.push(ns.is("leaf"));
  44972. return classes;
  44973. };
  44974. const getCellStyles = (column, cellIndex) => {
  44975. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  44976. ensurePosition(fixedStyle, "left");
  44977. ensurePosition(fixedStyle, "right");
  44978. return fixedStyle;
  44979. };
  44980. return {
  44981. getCellClasses,
  44982. getCellStyles,
  44983. columns
  44984. };
  44985. }
  44986. //#endregion
  44987. //#region ../../packages/components/table/src/table-footer/index.ts
  44988. var table_footer_default = defineComponent({
  44989. name: "ElTableFooter",
  44990. props: {
  44991. fixed: {
  44992. type: String,
  44993. default: ""
  44994. },
  44995. store: {
  44996. required: true,
  44997. type: Object
  44998. },
  44999. summaryMethod: Function,
  45000. sumText: String,
  45001. border: Boolean,
  45002. defaultSort: {
  45003. type: Object,
  45004. default: () => {
  45005. return {
  45006. prop: "",
  45007. order: ""
  45008. };
  45009. }
  45010. }
  45011. },
  45012. setup(props) {
  45013. const parent = inject(TABLE_INJECTION_KEY);
  45014. const ns = useNamespace("table");
  45015. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  45016. const { onScrollableChange, onColumnsChange } = useLayoutObserver(parent);
  45017. return {
  45018. ns,
  45019. onScrollableChange,
  45020. onColumnsChange,
  45021. getCellClasses,
  45022. getCellStyles,
  45023. columns
  45024. };
  45025. },
  45026. render() {
  45027. const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  45028. const data = this.store.states.data.value;
  45029. let sums = [];
  45030. if (summaryMethod) sums = summaryMethod({
  45031. columns,
  45032. data
  45033. });
  45034. else columns.forEach((column, index) => {
  45035. if (index === 0) {
  45036. sums[index] = sumText;
  45037. return;
  45038. }
  45039. const values = data.map((item) => Number(item[column.property]));
  45040. const precisions = [];
  45041. let notNumber = true;
  45042. values.forEach((value) => {
  45043. if (!Number.isNaN(+value)) {
  45044. notNumber = false;
  45045. const decimal = `${value}`.split(".")[1];
  45046. precisions.push(decimal ? decimal.length : 0);
  45047. }
  45048. });
  45049. const precision = Math.max.apply(null, precisions);
  45050. if (!notNumber) sums[index] = values.reduce((prev, curr) => {
  45051. const value = Number(curr);
  45052. if (!Number.isNaN(+value)) return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  45053. else return prev;
  45054. }, 0);
  45055. else sums[index] = "";
  45056. });
  45057. return h(h("tfoot", [h("tr", {}, [...columns.map((column, cellIndex) => h("td", {
  45058. key: cellIndex,
  45059. colspan: column.colSpan,
  45060. rowspan: column.rowSpan,
  45061. class: getCellClasses(columns, cellIndex),
  45062. style: getCellStyles(column, cellIndex)
  45063. }, [h("div", { class: ["cell", column.labelClassName] }, [sums[cellIndex]])]))])]));
  45064. }
  45065. });
  45066. //#endregion
  45067. //#region ../../packages/components/table/src/table/utils-helper.ts
  45068. function useUtils(store) {
  45069. const setCurrentRow = (row) => {
  45070. store.commit("setCurrentRow", row);
  45071. };
  45072. const getSelectionRows = () => {
  45073. return store.getSelectionRows();
  45074. };
  45075. const toggleRowSelection = (row, selected, ignoreSelectable = true) => {
  45076. store.toggleRowSelection(row, selected, false, ignoreSelectable);
  45077. store.updateAllSelected();
  45078. };
  45079. const clearSelection = () => {
  45080. store.clearSelection();
  45081. };
  45082. const clearFilter = (columnKeys) => {
  45083. store.clearFilter(columnKeys);
  45084. };
  45085. const toggleAllSelection = () => {
  45086. store.commit("toggleAllSelection");
  45087. };
  45088. const toggleRowExpansion = (row, expanded) => {
  45089. store.toggleRowExpansionAdapter(row, expanded);
  45090. };
  45091. const clearSort = () => {
  45092. store.clearSort();
  45093. };
  45094. const sort = (prop, order) => {
  45095. store.commit("sort", {
  45096. prop,
  45097. order
  45098. });
  45099. };
  45100. const updateKeyChildren = (key, data) => {
  45101. store.updateKeyChildren(key, data);
  45102. };
  45103. return {
  45104. setCurrentRow,
  45105. getSelectionRows,
  45106. toggleRowSelection,
  45107. clearSelection,
  45108. clearFilter,
  45109. toggleAllSelection,
  45110. toggleRowExpansion,
  45111. clearSort,
  45112. sort,
  45113. updateKeyChildren
  45114. };
  45115. }
  45116. //#endregion
  45117. //#region ../../packages/components/table/src/table/style-helper.ts
  45118. function useStyle(props, layout, store, table) {
  45119. const isHidden = ref(false);
  45120. const renderExpanded = ref(null);
  45121. const resizeProxyVisible = ref(false);
  45122. const setDragVisible = (visible) => {
  45123. resizeProxyVisible.value = visible;
  45124. };
  45125. const resizeState = ref({
  45126. width: null,
  45127. height: null,
  45128. headerHeight: null
  45129. });
  45130. const isGroup = ref(false);
  45131. const scrollbarViewStyle = {
  45132. display: "inline-block",
  45133. verticalAlign: "middle"
  45134. };
  45135. const tableWidth = ref();
  45136. const tableScrollHeight = ref(0);
  45137. const bodyScrollHeight = ref(0);
  45138. const headerScrollHeight = ref(0);
  45139. const footerScrollHeight = ref(0);
  45140. const appendScrollHeight = ref(0);
  45141. watch(() => props.height, (value) => {
  45142. layout.setHeight(value ?? null);
  45143. }, { immediate: true });
  45144. watch(() => props.maxHeight, (value) => {
  45145. layout.setMaxHeight(value ?? null);
  45146. }, { immediate: true });
  45147. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  45148. if (!unref(rowKey) || !unref(currentRowKey)) return;
  45149. store.setCurrentRowKey(`${currentRowKey}`);
  45150. }, { immediate: true });
  45151. watch(() => props.data, (data) => {
  45152. table.store.commit("setData", data);
  45153. }, {
  45154. immediate: true,
  45155. deep: true
  45156. });
  45157. watchEffect(() => {
  45158. if (props.expandRowKeys) store.setExpandRowKeysAdapter(props.expandRowKeys);
  45159. });
  45160. const handleMouseLeave = () => {
  45161. table.store.commit("setHoverRow", null);
  45162. if (table.hoverState) table.hoverState = null;
  45163. };
  45164. const handleHeaderFooterMousewheel = (_event, data) => {
  45165. const { pixelX, pixelY } = data;
  45166. if (Math.abs(pixelX) >= Math.abs(pixelY)) table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  45167. };
  45168. const shouldUpdateHeight = computed(() => {
  45169. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  45170. });
  45171. const tableBodyStyles = computed(() => {
  45172. return { width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : "" };
  45173. });
  45174. const doLayout = () => {
  45175. if (shouldUpdateHeight.value) layout.updateElsHeight();
  45176. layout.updateColumnsWidth();
  45177. if (typeof window === "undefined") return;
  45178. requestAnimationFrame(syncPosition);
  45179. };
  45180. onMounted(async () => {
  45181. await nextTick();
  45182. store.updateColumns();
  45183. bindEvents();
  45184. requestAnimationFrame(doLayout);
  45185. const el = table.vnode.el;
  45186. const tableHeader = table.refs.headerWrapper;
  45187. if (props.flexible && el && el.parentElement) el.parentElement.style.minWidth = "0";
  45188. resizeState.value = {
  45189. width: tableWidth.value = el.offsetWidth,
  45190. height: el.offsetHeight,
  45191. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  45192. };
  45193. store.states.columns.value.forEach((column) => {
  45194. if (column.filteredValue && column.filteredValue.length) table.store.commit("filterChange", {
  45195. column,
  45196. values: column.filteredValue,
  45197. silent: true
  45198. });
  45199. });
  45200. table.$ready = true;
  45201. });
  45202. const setScrollClassByEl = (el, className) => {
  45203. if (!el) return;
  45204. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  45205. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  45206. el.className = classList.join(" ");
  45207. };
  45208. const setScrollClass = (className) => {
  45209. const { tableWrapper } = table.refs;
  45210. setScrollClassByEl(tableWrapper, className);
  45211. };
  45212. const hasScrollClass = (className) => {
  45213. const { tableWrapper } = table.refs;
  45214. return !!(tableWrapper && tableWrapper.classList.contains(className));
  45215. };
  45216. const syncPosition = function() {
  45217. if (!table.refs.scrollBarRef) return;
  45218. if (!layout.scrollX.value) {
  45219. const scrollingNoneClass = "is-scrolling-none";
  45220. if (!hasScrollClass(scrollingNoneClass)) setScrollClass(scrollingNoneClass);
  45221. return;
  45222. }
  45223. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  45224. if (!scrollContainer) return;
  45225. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  45226. const { headerWrapper, footerWrapper } = table.refs;
  45227. if (headerWrapper) headerWrapper.scrollLeft = scrollLeft;
  45228. if (footerWrapper) footerWrapper.scrollLeft = scrollLeft;
  45229. if (scrollLeft >= scrollWidth - offsetWidth - 1) setScrollClass("is-scrolling-right");
  45230. else if (scrollLeft === 0) setScrollClass("is-scrolling-left");
  45231. else setScrollClass("is-scrolling-middle");
  45232. };
  45233. const bindEvents = () => {
  45234. if (!table.refs.scrollBarRef) return;
  45235. if (table.refs.scrollBarRef.wrapRef) useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, { passive: true });
  45236. if (props.fit) useResizeObserver(table.vnode.el, resizeListener);
  45237. else useEventListener(window, "resize", resizeListener);
  45238. useResizeObserver(table.refs.tableInnerWrapper, () => {
  45239. resizeListener();
  45240. table.refs?.scrollBarRef?.update();
  45241. });
  45242. };
  45243. const resizeListener = () => {
  45244. const el = table.vnode.el;
  45245. if (!table.$ready || !el) return;
  45246. let shouldUpdateLayout = false;
  45247. const { width: oldWidth, height: oldHeight, headerHeight: oldHeaderHeight } = resizeState.value;
  45248. const width = tableWidth.value = el.offsetWidth;
  45249. if (oldWidth !== width) shouldUpdateLayout = true;
  45250. const height = el.offsetHeight;
  45251. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) shouldUpdateLayout = true;
  45252. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : table.refs.tableHeaderRef?.$el;
  45253. if (props.showHeader && tableHeader?.offsetHeight !== oldHeaderHeight) shouldUpdateLayout = true;
  45254. tableScrollHeight.value = table.refs.tableWrapper?.scrollHeight || 0;
  45255. headerScrollHeight.value = tableHeader?.scrollHeight || 0;
  45256. footerScrollHeight.value = table.refs.footerWrapper?.offsetHeight || 0;
  45257. appendScrollHeight.value = table.refs.appendWrapper?.offsetHeight || 0;
  45258. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  45259. if (shouldUpdateLayout) {
  45260. resizeState.value = {
  45261. width,
  45262. height,
  45263. headerHeight: props.showHeader && tableHeader?.offsetHeight || 0
  45264. };
  45265. doLayout();
  45266. }
  45267. };
  45268. const tableSize = useFormSize();
  45269. const bodyWidth = computed(() => {
  45270. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  45271. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  45272. });
  45273. const tableLayout = computed(() => {
  45274. if (props.maxHeight) return "fixed";
  45275. return props.tableLayout;
  45276. });
  45277. return {
  45278. isHidden,
  45279. renderExpanded,
  45280. setDragVisible,
  45281. isGroup,
  45282. handleMouseLeave,
  45283. handleHeaderFooterMousewheel,
  45284. tableSize,
  45285. emptyBlockStyle: computed(() => {
  45286. if (props.data && props.data.length) return;
  45287. let height = "100%";
  45288. if (props.height && bodyScrollHeight.value) height = `${bodyScrollHeight.value}px`;
  45289. const width = tableWidth.value;
  45290. return {
  45291. width: width ? `${width}px` : "",
  45292. height
  45293. };
  45294. }),
  45295. resizeProxyVisible,
  45296. bodyWidth,
  45297. resizeState,
  45298. doLayout,
  45299. tableBodyStyles,
  45300. tableLayout,
  45301. scrollbarViewStyle,
  45302. scrollbarStyle: computed(() => {
  45303. if (props.height) return { height: "100%" };
  45304. if (props.maxHeight) if (!Number.isNaN(Number(props.maxHeight))) return { maxHeight: `${+props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px` };
  45305. else return { maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)` };
  45306. return {};
  45307. })
  45308. };
  45309. }
  45310. //#endregion
  45311. //#region ../../packages/components/table/src/table/key-render-helper.ts
  45312. function useKeyRender(table) {
  45313. let observer;
  45314. const initWatchDom = () => {
  45315. const columnsWrapper = table.vnode.el.querySelector(".hidden-columns");
  45316. const config = {
  45317. childList: true,
  45318. subtree: true
  45319. };
  45320. const updateOrderFns = table.store.states.updateOrderFns;
  45321. observer = new MutationObserver(() => {
  45322. updateOrderFns.forEach((fn) => fn());
  45323. });
  45324. observer.observe(columnsWrapper, config);
  45325. };
  45326. onMounted(() => {
  45327. initWatchDom();
  45328. });
  45329. onUnmounted(() => {
  45330. observer?.disconnect();
  45331. });
  45332. }
  45333. //#endregion
  45334. //#region ../../packages/components/table/src/table/defaults.ts
  45335. var defaults_default$2 = {
  45336. data: {
  45337. type: Array,
  45338. default: () => []
  45339. },
  45340. size: useSizeProp,
  45341. width: [String, Number],
  45342. height: [String, Number],
  45343. maxHeight: [String, Number],
  45344. fit: {
  45345. type: Boolean,
  45346. default: true
  45347. },
  45348. stripe: Boolean,
  45349. border: Boolean,
  45350. rowKey: [String, Function],
  45351. showHeader: {
  45352. type: Boolean,
  45353. default: true
  45354. },
  45355. showSummary: Boolean,
  45356. sumText: String,
  45357. summaryMethod: Function,
  45358. rowClassName: [String, Function],
  45359. rowStyle: [Object, Function],
  45360. cellClassName: [String, Function],
  45361. cellStyle: [Object, Function],
  45362. headerRowClassName: [String, Function],
  45363. headerRowStyle: [Object, Function],
  45364. headerCellClassName: [String, Function],
  45365. headerCellStyle: [Object, Function],
  45366. highlightCurrentRow: Boolean,
  45367. currentRowKey: [String, Number],
  45368. emptyText: String,
  45369. expandRowKeys: Array,
  45370. defaultExpandAll: Boolean,
  45371. rowExpandable: { type: Function },
  45372. defaultSort: Object,
  45373. tooltipEffect: String,
  45374. tooltipOptions: Object,
  45375. spanMethod: Function,
  45376. selectOnIndeterminate: {
  45377. type: Boolean,
  45378. default: true
  45379. },
  45380. indent: {
  45381. type: Number,
  45382. default: 16
  45383. },
  45384. treeProps: {
  45385. type: Object,
  45386. default: () => {
  45387. return {
  45388. hasChildren: "hasChildren",
  45389. children: "children",
  45390. checkStrictly: false
  45391. };
  45392. }
  45393. },
  45394. lazy: Boolean,
  45395. load: Function,
  45396. style: {
  45397. type: [
  45398. String,
  45399. Object,
  45400. Array
  45401. ],
  45402. default: () => ({})
  45403. },
  45404. className: {
  45405. type: String,
  45406. default: ""
  45407. },
  45408. tableLayout: {
  45409. type: String,
  45410. default: "fixed"
  45411. },
  45412. scrollbarAlwaysOn: Boolean,
  45413. flexible: Boolean,
  45414. showOverflowTooltip: {
  45415. type: [Boolean, Object],
  45416. default: void 0
  45417. },
  45418. tooltipFormatter: Function,
  45419. appendFilterPanelTo: String,
  45420. scrollbarTabindex: {
  45421. type: [Number, String],
  45422. default: void 0
  45423. },
  45424. allowDragLastColumn: {
  45425. type: Boolean,
  45426. default: true
  45427. },
  45428. preserveExpandedContent: Boolean,
  45429. nativeScrollbar: Boolean
  45430. };
  45431. //#endregion
  45432. //#region ../../packages/components/table/src/h-helper.ts
  45433. function hColgroup(props) {
  45434. const isAuto = props.tableLayout === "auto";
  45435. let columns = props.columns || [];
  45436. if (isAuto) {
  45437. if (columns.every(({ width }) => isUndefined(width))) columns = [];
  45438. }
  45439. const getPropsData = (column) => {
  45440. const propsData = {
  45441. key: `${props.tableLayout}_${column.id}`,
  45442. style: {},
  45443. name: void 0
  45444. };
  45445. if (isAuto) propsData.style = { width: `${column.width}px` };
  45446. else propsData.name = column.id;
  45447. return propsData;
  45448. };
  45449. return h("colgroup", {}, columns.map((column) => h("col", getPropsData(column))));
  45450. }
  45451. hColgroup.props = ["columns", "tableLayout"];
  45452. //#endregion
  45453. //#region ../../packages/components/table/src/composables/use-scrollbar.ts
  45454. const useScrollbar$1 = () => {
  45455. const scrollBarRef = ref();
  45456. const scrollTo = (options, yCoord) => {
  45457. const scrollbar = scrollBarRef.value;
  45458. if (scrollbar) scrollbar.scrollTo(options, yCoord);
  45459. };
  45460. const setScrollPosition = (position, offset) => {
  45461. const scrollbar = scrollBarRef.value;
  45462. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) scrollbar[`setScroll${position}`](offset);
  45463. };
  45464. const setScrollTop = (top) => setScrollPosition("Top", top);
  45465. const setScrollLeft = (left) => setScrollPosition("Left", left);
  45466. return {
  45467. scrollBarRef,
  45468. scrollTo,
  45469. setScrollTop,
  45470. setScrollLeft
  45471. };
  45472. };
  45473. //#endregion
  45474. //#region ../../packages/components/table/src/table.vue?vue&type=script&lang.ts
  45475. let tableIdSeed = 1;
  45476. var table_vue_vue_type_script_lang_default = defineComponent({
  45477. name: "ElTable",
  45478. directives: { Mousewheel },
  45479. components: {
  45480. TableHeader: table_header_default,
  45481. TableBody: table_body_default,
  45482. TableFooter: table_footer_default,
  45483. ElScrollbar,
  45484. hColgroup
  45485. },
  45486. props: defaults_default$2,
  45487. emits: [
  45488. "select",
  45489. "select-all",
  45490. "selection-change",
  45491. "cell-mouse-enter",
  45492. "cell-mouse-leave",
  45493. "cell-contextmenu",
  45494. "cell-click",
  45495. "cell-dblclick",
  45496. "row-click",
  45497. "row-contextmenu",
  45498. "row-dblclick",
  45499. "header-click",
  45500. "header-contextmenu",
  45501. "sort-change",
  45502. "filter-change",
  45503. "current-change",
  45504. "header-dragend",
  45505. "expand-change",
  45506. "scroll"
  45507. ],
  45508. setup(props) {
  45509. const { t } = useLocale();
  45510. const ns = useNamespace("table");
  45511. const globalConfig = useGlobalConfig("table");
  45512. const table = getCurrentInstance();
  45513. provide(TABLE_INJECTION_KEY, table);
  45514. const store = createStore(table, props);
  45515. table.store = store;
  45516. const layout = new TableLayout({
  45517. store: table.store,
  45518. table,
  45519. fit: props.fit,
  45520. showHeader: props.showHeader
  45521. });
  45522. table.layout = layout;
  45523. const isEmpty = computed(() => (store.states.data.value || []).length === 0);
  45524. /**
  45525. * open functions
  45526. */
  45527. const { setCurrentRow, getSelectionRows, toggleRowSelection, clearSelection, clearFilter, toggleAllSelection, toggleRowExpansion, clearSort, sort, updateKeyChildren } = useUtils(store);
  45528. const { isHidden, renderExpanded, setDragVisible, isGroup, handleMouseLeave, handleHeaderFooterMousewheel, tableSize, emptyBlockStyle, resizeProxyVisible, bodyWidth, resizeState, doLayout, tableBodyStyles, tableLayout, scrollbarViewStyle, scrollbarStyle } = useStyle(props, layout, store, table);
  45529. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  45530. const debouncedUpdateLayout = debounce(doLayout, 50);
  45531. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  45532. table.tableId = tableId;
  45533. table.state = {
  45534. isGroup,
  45535. resizeState,
  45536. doLayout,
  45537. debouncedUpdateLayout
  45538. };
  45539. const computedSumText = computed(() => props.sumText ?? t("el.table.sumText"));
  45540. const computedEmptyText = computed(() => {
  45541. return props.emptyText ?? t("el.table.emptyText");
  45542. });
  45543. const computedTooltipEffect = computed(() => props.tooltipEffect ?? globalConfig.value?.tooltipEffect);
  45544. const computedTooltipOptions = computed(() => props.tooltipOptions ?? globalConfig.value?.tooltipOptions);
  45545. const columns = computed(() => {
  45546. return convertToRows(store.states.originColumns.value)[0];
  45547. });
  45548. useKeyRender(table);
  45549. onBeforeUnmount(() => {
  45550. debouncedUpdateLayout.cancel();
  45551. });
  45552. return {
  45553. ns,
  45554. layout,
  45555. store,
  45556. columns,
  45557. handleHeaderFooterMousewheel,
  45558. handleMouseLeave,
  45559. tableId,
  45560. tableSize,
  45561. isHidden,
  45562. isEmpty,
  45563. renderExpanded,
  45564. resizeProxyVisible,
  45565. resizeState,
  45566. isGroup,
  45567. bodyWidth,
  45568. tableBodyStyles,
  45569. emptyBlockStyle,
  45570. debouncedUpdateLayout,
  45571. setCurrentRow,
  45572. getSelectionRows,
  45573. toggleRowSelection,
  45574. clearSelection,
  45575. clearFilter,
  45576. toggleAllSelection,
  45577. toggleRowExpansion,
  45578. clearSort,
  45579. doLayout,
  45580. sort,
  45581. updateKeyChildren,
  45582. t,
  45583. setDragVisible,
  45584. context: table,
  45585. computedSumText,
  45586. computedEmptyText,
  45587. computedTooltipEffect,
  45588. computedTooltipOptions,
  45589. tableLayout,
  45590. scrollbarViewStyle,
  45591. scrollbarStyle,
  45592. scrollBarRef,
  45593. scrollTo,
  45594. setScrollLeft,
  45595. setScrollTop,
  45596. allowDragLastColumn: props.allowDragLastColumn
  45597. };
  45598. }
  45599. });
  45600. //#endregion
  45601. //#region ../../packages/components/table/src/table.vue
  45602. const _hoisted_1$15 = ["data-prefix"];
  45603. const _hoisted_2$9 = {
  45604. ref: "hiddenColumns",
  45605. class: "hidden-columns"
  45606. };
  45607. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  45608. const _component_hColgroup = resolveComponent("hColgroup");
  45609. const _component_table_header = resolveComponent("table-header");
  45610. const _component_table_body = resolveComponent("table-body");
  45611. const _component_table_footer = resolveComponent("table-footer");
  45612. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  45613. const _directive_mousewheel = resolveDirective("mousewheel");
  45614. return openBlock(), createElementBlock("div", {
  45615. ref: "tableWrapper",
  45616. class: normalizeClass([
  45617. {
  45618. [_ctx.ns.m("fit")]: _ctx.fit,
  45619. [_ctx.ns.m("striped")]: _ctx.stripe,
  45620. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  45621. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  45622. [_ctx.ns.m("group")]: _ctx.isGroup,
  45623. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  45624. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  45625. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  45626. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  45627. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  45628. "has-footer": _ctx.showSummary
  45629. },
  45630. _ctx.ns.m(_ctx.tableSize),
  45631. _ctx.className,
  45632. _ctx.ns.b(),
  45633. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  45634. ]),
  45635. style: normalizeStyle(_ctx.style),
  45636. "data-prefix": _ctx.ns.namespace.value,
  45637. onMouseleave: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args))
  45638. }, [createElementVNode("div", {
  45639. ref: "tableInnerWrapper",
  45640. class: normalizeClass(_ctx.ns.e("inner-wrapper"))
  45641. }, [
  45642. createElementVNode("div", _hoisted_2$9, [renderSlot(_ctx.$slots, "default")], 512),
  45643. _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  45644. key: 0,
  45645. ref: "headerWrapper",
  45646. class: normalizeClass(_ctx.ns.e("header-wrapper"))
  45647. }, [createElementVNode("table", {
  45648. ref: "tableHeader",
  45649. class: normalizeClass(_ctx.ns.e("header")),
  45650. style: normalizeStyle(_ctx.tableBodyStyles),
  45651. border: "0",
  45652. cellpadding: "0",
  45653. cellspacing: "0"
  45654. }, [createVNode(_component_hColgroup, {
  45655. columns: _ctx.store.states.columns.value,
  45656. "table-layout": _ctx.tableLayout
  45657. }, null, 8, ["columns", "table-layout"]), createVNode(_component_table_header, {
  45658. ref: "tableHeaderRef",
  45659. border: _ctx.border,
  45660. "default-sort": _ctx.defaultSort,
  45661. store: _ctx.store,
  45662. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  45663. "allow-drag-last-column": _ctx.allowDragLastColumn,
  45664. onSetDragVisible: _ctx.setDragVisible
  45665. }, null, 8, [
  45666. "border",
  45667. "default-sort",
  45668. "store",
  45669. "append-filter-panel-to",
  45670. "allow-drag-last-column",
  45671. "onSetDragVisible"
  45672. ])], 6)], 2)), [[_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]]) : createCommentVNode("v-if", true),
  45673. createElementVNode("div", {
  45674. ref: "bodyWrapper",
  45675. class: normalizeClass(_ctx.ns.e("body-wrapper"))
  45676. }, [createVNode(_component_el_scrollbar, {
  45677. ref: "scrollBarRef",
  45678. "view-style": _ctx.scrollbarViewStyle,
  45679. "wrap-style": _ctx.scrollbarStyle,
  45680. always: _ctx.scrollbarAlwaysOn,
  45681. tabindex: _ctx.scrollbarTabindex,
  45682. native: _ctx.nativeScrollbar,
  45683. onScroll: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("scroll", $event))
  45684. }, {
  45685. default: withCtx(() => [
  45686. createElementVNode("table", {
  45687. ref: "tableBody",
  45688. class: normalizeClass(_ctx.ns.e("body")),
  45689. cellspacing: "0",
  45690. cellpadding: "0",
  45691. border: "0",
  45692. style: normalizeStyle({
  45693. width: _ctx.bodyWidth,
  45694. tableLayout: _ctx.tableLayout
  45695. })
  45696. }, [
  45697. createVNode(_component_hColgroup, {
  45698. columns: _ctx.store.states.columns.value,
  45699. "table-layout": _ctx.tableLayout
  45700. }, null, 8, ["columns", "table-layout"]),
  45701. _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
  45702. key: 0,
  45703. ref: "tableHeaderRef",
  45704. class: normalizeClass(_ctx.ns.e("body-header")),
  45705. border: _ctx.border,
  45706. "default-sort": _ctx.defaultSort,
  45707. store: _ctx.store,
  45708. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  45709. onSetDragVisible: _ctx.setDragVisible
  45710. }, null, 8, [
  45711. "class",
  45712. "border",
  45713. "default-sort",
  45714. "store",
  45715. "append-filter-panel-to",
  45716. "onSetDragVisible"
  45717. ])) : createCommentVNode("v-if", true),
  45718. createVNode(_component_table_body, {
  45719. context: _ctx.context,
  45720. highlight: _ctx.highlightCurrentRow,
  45721. "row-class-name": _ctx.rowClassName,
  45722. "tooltip-effect": _ctx.computedTooltipEffect,
  45723. "tooltip-options": _ctx.computedTooltipOptions,
  45724. "row-style": _ctx.rowStyle,
  45725. store: _ctx.store,
  45726. stripe: _ctx.stripe
  45727. }, null, 8, [
  45728. "context",
  45729. "highlight",
  45730. "row-class-name",
  45731. "tooltip-effect",
  45732. "tooltip-options",
  45733. "row-style",
  45734. "store",
  45735. "stripe"
  45736. ]),
  45737. _ctx.showSummary && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_footer, {
  45738. key: 1,
  45739. class: normalizeClass(_ctx.ns.e("body-footer")),
  45740. border: _ctx.border,
  45741. "default-sort": _ctx.defaultSort,
  45742. store: _ctx.store,
  45743. "sum-text": _ctx.computedSumText,
  45744. "summary-method": _ctx.summaryMethod
  45745. }, null, 8, [
  45746. "class",
  45747. "border",
  45748. "default-sort",
  45749. "store",
  45750. "sum-text",
  45751. "summary-method"
  45752. ])) : createCommentVNode("v-if", true)
  45753. ], 6),
  45754. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  45755. key: 0,
  45756. ref: "emptyBlock",
  45757. style: normalizeStyle(_ctx.emptyBlockStyle),
  45758. class: normalizeClass(_ctx.ns.e("empty-block"))
  45759. }, [createElementVNode("span", { class: normalizeClass(_ctx.ns.e("empty-text")) }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)])], 2)], 6)) : createCommentVNode("v-if", true),
  45760. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  45761. key: 1,
  45762. ref: "appendWrapper",
  45763. class: normalizeClass(_ctx.ns.e("append-wrapper"))
  45764. }, [renderSlot(_ctx.$slots, "append")], 2)) : createCommentVNode("v-if", true)
  45765. ]),
  45766. _: 3
  45767. }, 8, [
  45768. "view-style",
  45769. "wrap-style",
  45770. "always",
  45771. "tabindex",
  45772. "native"
  45773. ])], 2),
  45774. _ctx.showSummary && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  45775. key: 1,
  45776. ref: "footerWrapper",
  45777. class: normalizeClass(_ctx.ns.e("footer-wrapper"))
  45778. }, [createElementVNode("table", {
  45779. class: normalizeClass(_ctx.ns.e("footer")),
  45780. cellspacing: "0",
  45781. cellpadding: "0",
  45782. border: "0",
  45783. style: normalizeStyle(_ctx.tableBodyStyles)
  45784. }, [createVNode(_component_hColgroup, {
  45785. columns: _ctx.store.states.columns.value,
  45786. "table-layout": _ctx.tableLayout
  45787. }, null, 8, ["columns", "table-layout"]), createVNode(_component_table_footer, {
  45788. border: _ctx.border,
  45789. "default-sort": _ctx.defaultSort,
  45790. store: _ctx.store,
  45791. "sum-text": _ctx.computedSumText,
  45792. "summary-method": _ctx.summaryMethod
  45793. }, null, 8, [
  45794. "border",
  45795. "default-sort",
  45796. "store",
  45797. "sum-text",
  45798. "summary-method"
  45799. ])], 6)], 2)), [[vShow, !_ctx.isEmpty], [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]]) : createCommentVNode("v-if", true),
  45800. _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
  45801. key: 2,
  45802. class: normalizeClass(_ctx.ns.e("border-left-patch"))
  45803. }, null, 2)) : createCommentVNode("v-if", true)
  45804. ], 2), withDirectives(createElementVNode("div", {
  45805. ref: "resizeProxy",
  45806. class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
  45807. }, null, 2), [[vShow, _ctx.resizeProxyVisible]])], 46, _hoisted_1$15);
  45808. }
  45809. var table_default = /* @__PURE__ */ _plugin_vue_export_helper_default(table_vue_vue_type_script_lang_default, [["render", _sfc_render$3]]);
  45810. //#endregion
  45811. //#region ../../packages/components/table/src/config.ts
  45812. const defaultClassNames = {
  45813. selection: "table-column--selection",
  45814. expand: "table__expand-column"
  45815. };
  45816. const cellStarts = {
  45817. default: { order: "" },
  45818. selection: {
  45819. width: 48,
  45820. minWidth: 48,
  45821. realWidth: 48,
  45822. order: ""
  45823. },
  45824. expand: {
  45825. width: 48,
  45826. minWidth: 48,
  45827. realWidth: 48,
  45828. order: ""
  45829. },
  45830. index: {
  45831. width: 48,
  45832. minWidth: 48,
  45833. realWidth: 48,
  45834. order: ""
  45835. }
  45836. };
  45837. const getDefaultClassName = (type) => {
  45838. return defaultClassNames[type] || "";
  45839. };
  45840. const cellForced = {
  45841. selection: {
  45842. renderHeader({ store }) {
  45843. function isDisabled() {
  45844. return store.states.data.value && store.states.data.value.length === 0;
  45845. }
  45846. return h(ElCheckbox, {
  45847. disabled: isDisabled(),
  45848. size: store.states.tableSize.value,
  45849. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  45850. "onUpdate:modelValue": store.toggleAllSelection ?? void 0,
  45851. modelValue: store.states.isAllSelected.value,
  45852. ariaLabel: store.t("el.table.selectAllLabel")
  45853. });
  45854. },
  45855. renderCell({ row, column, store, $index }) {
  45856. return h(ElCheckbox, {
  45857. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  45858. size: store.states.tableSize.value,
  45859. onChange: () => {
  45860. store.commit("rowSelectedChanged", row);
  45861. },
  45862. onClick: (event) => event.stopPropagation(),
  45863. modelValue: store.isSelected(row),
  45864. ariaLabel: store.t("el.table.selectRowLabel")
  45865. });
  45866. },
  45867. sortable: false,
  45868. resizable: false
  45869. },
  45870. index: {
  45871. renderHeader({ column }) {
  45872. return column.label || "#";
  45873. },
  45874. renderCell({ column, $index }) {
  45875. let i = $index + 1;
  45876. const index = column.index;
  45877. if (isNumber(index)) i = $index + index;
  45878. else if (isFunction$1(index)) i = index($index);
  45879. return h("div", {}, [i]);
  45880. },
  45881. sortable: false
  45882. },
  45883. expand: {
  45884. renderHeader({ column }) {
  45885. return column.label || "";
  45886. },
  45887. renderCell({ column, row, store, expanded, $index }) {
  45888. const { ns } = store;
  45889. const classes = [ns.e("expand-icon")];
  45890. if (!column.renderExpand && expanded) classes.push(ns.em("expand-icon", "expanded"));
  45891. const callback = function(e) {
  45892. e.stopPropagation();
  45893. store.toggleRowExpansion(row);
  45894. };
  45895. const isRowExpandable = store.states.rowExpandable.value?.(row, $index) ?? true;
  45896. if (!isRowExpandable) classes.push(ns.is("disabled"));
  45897. return h("button", {
  45898. type: "button",
  45899. disabled: !isRowExpandable,
  45900. "aria-label": store.t(expanded ? "el.table.collapseRowLabel" : "el.table.expandRowLabel"),
  45901. "aria-expanded": expanded,
  45902. class: classes,
  45903. onClick: callback
  45904. }, { default: () => {
  45905. if (column.renderExpand) return [column.renderExpand({
  45906. expanded,
  45907. expandable: isRowExpandable
  45908. })];
  45909. return [h(ElIcon, null, { default: () => {
  45910. return [h(arrow_right_default)];
  45911. } })];
  45912. } });
  45913. },
  45914. sortable: false,
  45915. resizable: false
  45916. }
  45917. };
  45918. function defaultRenderCell({ row, column, $index }) {
  45919. const property = column.property;
  45920. const value = property && getProp(row, property).value;
  45921. if (column && column.formatter) return column.formatter(row, column, value, $index);
  45922. return value?.toString?.() || "";
  45923. }
  45924. function treeCellPrefix({ row, treeNode, store }, createPlaceholder = false) {
  45925. const { ns } = store;
  45926. if (!treeNode) {
  45927. if (createPlaceholder) return [h("span", { class: ns.e("placeholder") })];
  45928. return null;
  45929. }
  45930. const ele = [];
  45931. const callback = function(e) {
  45932. e.stopPropagation();
  45933. if (treeNode.loading) return;
  45934. store.loadOrToggle(row);
  45935. };
  45936. if (treeNode.indent) ele.push(h("span", {
  45937. class: ns.e("indent"),
  45938. style: { "padding-left": `${treeNode.indent}px` }
  45939. }));
  45940. if (isBoolean(treeNode.expanded) && !treeNode.noLazyChildren) {
  45941. const expandClasses = [ns.e("expand-icon"), treeNode.expanded ? ns.em("expand-icon", "expanded") : ""];
  45942. let icon = arrow_right_default;
  45943. if (treeNode.loading) icon = loading_default;
  45944. ele.push(h("button", {
  45945. type: "button",
  45946. "aria-label": store.t(treeNode.expanded ? "el.table.collapseRowLabel" : "el.table.expandRowLabel"),
  45947. "aria-expanded": treeNode.expanded,
  45948. class: expandClasses,
  45949. onClick: callback
  45950. }, { default: () => {
  45951. return [h(ElIcon, { class: ns.is("loading", treeNode.loading) }, { default: () => [h(icon)] })];
  45952. } }));
  45953. } else ele.push(h("span", { class: ns.e("placeholder") }));
  45954. return ele;
  45955. }
  45956. //#endregion
  45957. //#region ../../packages/components/table/src/table-column/watcher-helper.ts
  45958. function getAllAliases(props, aliases) {
  45959. return props.reduce((prev, cur) => {
  45960. prev[cur] = cur;
  45961. return prev;
  45962. }, aliases);
  45963. }
  45964. function useWatcher(owner, props_) {
  45965. const instance = getCurrentInstance();
  45966. const registerComplexWatchers = () => {
  45967. const props = ["fixed"];
  45968. const aliases = {
  45969. realWidth: "width",
  45970. realMinWidth: "minWidth"
  45971. };
  45972. const allAliases = getAllAliases(props, aliases);
  45973. Object.keys(allAliases).forEach((key) => {
  45974. const columnKey = aliases[key];
  45975. if (hasOwn(props_, columnKey)) watch(() => props_[columnKey], (newVal) => {
  45976. let value = newVal;
  45977. if (columnKey === "width" && key === "realWidth") value = parseWidth(newVal);
  45978. if (columnKey === "minWidth" && key === "realMinWidth") value = parseMinWidth(newVal);
  45979. instance.columnConfig.value[columnKey] = value;
  45980. instance.columnConfig.value[key] = value;
  45981. const updateColumns = columnKey === "fixed";
  45982. owner.value.store.scheduleLayout(updateColumns);
  45983. });
  45984. });
  45985. };
  45986. const registerNormalWatchers = () => {
  45987. const props = [
  45988. "label",
  45989. "filters",
  45990. "filterMultiple",
  45991. "filteredValue",
  45992. "sortable",
  45993. "index",
  45994. "formatter",
  45995. "className",
  45996. "labelClassName",
  45997. "filterClassName",
  45998. "showOverflowTooltip",
  45999. "tooltipFormatter",
  46000. "resizable"
  46001. ];
  46002. const parentProps = ["showOverflowTooltip"];
  46003. const aliases = {
  46004. property: "prop",
  46005. align: "realAlign",
  46006. headerAlign: "realHeaderAlign"
  46007. };
  46008. const allAliases = getAllAliases(props, aliases);
  46009. Object.keys(allAliases).forEach((key) => {
  46010. const columnKey = aliases[key];
  46011. if (hasOwn(props_, columnKey)) watch(() => props_[columnKey], (newVal) => {
  46012. instance.columnConfig.value[key] = newVal;
  46013. if (key === "filters" || key === "filterMethod") instance.columnConfig.value["filterable"] = !!(instance.columnConfig.value["filters"] || instance.columnConfig.value["filterMethod"]);
  46014. });
  46015. });
  46016. parentProps.forEach((key) => {
  46017. if (hasOwn(owner.value.props, key)) watch(() => owner.value.props[key], (newVal) => {
  46018. if (instance.columnConfig.value.type === "selection") return;
  46019. if (!isUndefined(props_[key])) return;
  46020. instance.columnConfig.value[key] = newVal;
  46021. });
  46022. });
  46023. const globalConfig = useGlobalConfig("table");
  46024. if (globalConfig.value && hasOwn(globalConfig.value, "showOverflowTooltip")) watch(() => globalConfig.value?.showOverflowTooltip, (newVal) => {
  46025. if (instance.columnConfig.value.type === "selection") return;
  46026. if (!isUndefined(props_.showOverflowTooltip) || !isUndefined(owner.value.props.showOverflowTooltip)) return;
  46027. instance.columnConfig.value.showOverflowTooltip = newVal;
  46028. });
  46029. };
  46030. return {
  46031. registerComplexWatchers,
  46032. registerNormalWatchers
  46033. };
  46034. }
  46035. //#endregion
  46036. //#region ../../packages/components/table/src/table-column/render-helper.ts
  46037. function useRender(props, slots, owner) {
  46038. const instance = getCurrentInstance();
  46039. const columnId = ref("");
  46040. const isSubColumn = ref(false);
  46041. const realAlign = ref();
  46042. const realHeaderAlign = ref();
  46043. const ns = useNamespace("table");
  46044. watchEffect(() => {
  46045. realAlign.value = props.align ? `is-${props.align}` : null;
  46046. realAlign.value;
  46047. });
  46048. watchEffect(() => {
  46049. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  46050. realHeaderAlign.value;
  46051. });
  46052. const columnOrTableParent = computed(() => {
  46053. let parent = instance.vnode.vParent || instance.parent;
  46054. while (parent && !parent.tableId && !parent.columnId) parent = parent.vnode.vParent || parent.parent;
  46055. return parent;
  46056. });
  46057. const hasTreeColumn = computed(() => {
  46058. const { store } = instance.parent;
  46059. if (!store) return false;
  46060. const { treeData } = store.states;
  46061. const treeDataValue = treeData.value;
  46062. return treeDataValue && Object.keys(treeDataValue).length > 0;
  46063. });
  46064. const realWidth = ref(parseWidth(props.width));
  46065. const realMinWidth = ref(parseMinWidth(props.minWidth));
  46066. const setColumnWidth = (column) => {
  46067. if (realWidth.value) column.width = realWidth.value;
  46068. if (realMinWidth.value) column.minWidth = realMinWidth.value;
  46069. if (!realWidth.value && realMinWidth.value) column.width = void 0;
  46070. if (!column.minWidth) column.minWidth = 80;
  46071. column.realWidth = Number(isUndefined(column.width) ? column.minWidth : column.width);
  46072. return column;
  46073. };
  46074. const setColumnForcedProps = (column) => {
  46075. const type = column.type;
  46076. const source = cellForced[type] || {};
  46077. Object.keys(source).forEach((prop) => {
  46078. const value = source[prop];
  46079. if (prop !== "className" && !isUndefined(value)) column[prop] = value;
  46080. });
  46081. const className = getDefaultClassName(type);
  46082. if (className) {
  46083. const forceClass = `${unref(ns.namespace)}-${className}`;
  46084. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  46085. }
  46086. return column;
  46087. };
  46088. const checkSubColumn = (children) => {
  46089. if (isArray$1(children)) children.forEach((child) => check(child));
  46090. else check(children);
  46091. function check(item) {
  46092. if (item?.type?.name === "ElTableColumn") item.vParent = instance;
  46093. }
  46094. };
  46095. const setColumnRenders = (column) => {
  46096. if (props.renderHeader) /* @__PURE__ */ debugWarn("TableColumn", "Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header.");
  46097. else if (column.type !== "selection") column.renderHeader = (scope) => {
  46098. instance.columnConfig.value["label"];
  46099. if (slots.header) {
  46100. const slotResult = slots.header(scope);
  46101. if (ensureValidVNode(slotResult)) return h(Fragment, slotResult);
  46102. }
  46103. return createTextVNode(column.label);
  46104. };
  46105. if (slots["filter-icon"]) column.renderFilterIcon = (scope) => {
  46106. return renderSlot(slots, "filter-icon", scope);
  46107. };
  46108. if (slots.expand) column.renderExpand = (scope) => {
  46109. return renderSlot(slots, "expand", scope);
  46110. };
  46111. let originRenderCell = column.renderCell;
  46112. if (column.type === "expand") {
  46113. column.renderCell = (data) => h("div", { class: "cell" }, [originRenderCell(data)]);
  46114. owner.value.renderExpanded = (row) => {
  46115. return slots.default ? slots.default(row) : slots.default;
  46116. };
  46117. } else {
  46118. originRenderCell = originRenderCell || defaultRenderCell;
  46119. column.renderCell = (data) => {
  46120. let children = null;
  46121. if (slots.default) {
  46122. const vnodes = slots.default(data);
  46123. children = vnodes.some((v) => v.type !== Comment) ? vnodes : originRenderCell(data);
  46124. } else children = originRenderCell(data);
  46125. const { columns } = owner.value.store.states;
  46126. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  46127. const prefix = treeCellPrefix(data, hasTreeColumn.value && data.cellIndex === firstUserColumnIndex);
  46128. const props = {
  46129. class: "cell",
  46130. style: {}
  46131. };
  46132. if (column.showOverflowTooltip) {
  46133. props.class = `${props.class} ${unref(ns.namespace)}-tooltip`;
  46134. props.style = { width: `${(data.column.realWidth || Number(data.column.width)) - 1}px` };
  46135. }
  46136. checkSubColumn(children);
  46137. return h("div", props, [prefix, children]);
  46138. };
  46139. }
  46140. return column;
  46141. };
  46142. const getPropsData = (...propsKey) => {
  46143. return propsKey.reduce((prev, cur) => {
  46144. if (isArray$1(cur)) cur.forEach((key) => {
  46145. prev[key] = props[key];
  46146. });
  46147. return prev;
  46148. }, {});
  46149. };
  46150. const getColumnElIndex = (children, child) => {
  46151. return Array.prototype.indexOf.call(children, child);
  46152. };
  46153. const updateColumnOrder = () => {
  46154. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  46155. };
  46156. return {
  46157. columnId,
  46158. realAlign,
  46159. isSubColumn,
  46160. realHeaderAlign,
  46161. columnOrTableParent,
  46162. setColumnWidth,
  46163. setColumnForcedProps,
  46164. setColumnRenders,
  46165. getPropsData,
  46166. getColumnElIndex,
  46167. updateColumnOrder
  46168. };
  46169. }
  46170. //#endregion
  46171. //#region ../../packages/components/table/src/table-column/defaults.ts
  46172. var defaults_default$1 = {
  46173. type: {
  46174. type: String,
  46175. default: "default"
  46176. },
  46177. label: String,
  46178. className: String,
  46179. labelClassName: String,
  46180. property: String,
  46181. prop: String,
  46182. width: {
  46183. type: [String, Number],
  46184. default: ""
  46185. },
  46186. minWidth: {
  46187. type: [String, Number],
  46188. default: ""
  46189. },
  46190. renderHeader: Function,
  46191. sortable: {
  46192. type: [Boolean, String],
  46193. default: false
  46194. },
  46195. sortMethod: Function,
  46196. sortBy: [
  46197. String,
  46198. Function,
  46199. Array
  46200. ],
  46201. resizable: {
  46202. type: Boolean,
  46203. default: true
  46204. },
  46205. columnKey: String,
  46206. align: String,
  46207. headerAlign: String,
  46208. showOverflowTooltip: {
  46209. type: [Boolean, Object],
  46210. default: void 0
  46211. },
  46212. tooltipFormatter: Function,
  46213. fixed: [Boolean, String],
  46214. formatter: Function,
  46215. selectable: Function,
  46216. reserveSelection: Boolean,
  46217. filterMethod: Function,
  46218. filteredValue: Array,
  46219. filters: Array,
  46220. filterPlacement: String,
  46221. filterMultiple: {
  46222. type: Boolean,
  46223. default: true
  46224. },
  46225. filterClassName: String,
  46226. index: [Number, Function],
  46227. sortOrders: {
  46228. type: Array,
  46229. default: () => {
  46230. return [
  46231. "ascending",
  46232. "descending",
  46233. null
  46234. ];
  46235. },
  46236. validator: (val) => {
  46237. return val.every((order) => [
  46238. "ascending",
  46239. "descending",
  46240. null
  46241. ].includes(order));
  46242. }
  46243. }
  46244. };
  46245. //#endregion
  46246. //#region ../../packages/components/table/src/table-column/index.ts
  46247. let columnIdSeed = 1;
  46248. var table_column_default = defineComponent({
  46249. name: "ElTableColumn",
  46250. components: { ElCheckbox },
  46251. props: defaults_default$1,
  46252. setup(props, { slots }) {
  46253. const instance = getCurrentInstance();
  46254. const globalConfig = useGlobalConfig("table");
  46255. const columnConfig = ref({});
  46256. const owner = computed(() => {
  46257. let parent = instance.parent;
  46258. while (parent && !parent.tableId) parent = parent.parent;
  46259. return parent;
  46260. });
  46261. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  46262. const { columnId, isSubColumn, realHeaderAlign, columnOrTableParent, setColumnWidth, setColumnForcedProps, setColumnRenders, getPropsData, getColumnElIndex, realAlign, updateColumnOrder } = useRender(props, slots, owner);
  46263. const parent = columnOrTableParent.value;
  46264. columnId.value = `${"tableId" in parent && parent.tableId || "columnId" in parent && parent.columnId}_column_${columnIdSeed++}`;
  46265. onBeforeMount(() => {
  46266. isSubColumn.value = owner.value !== parent;
  46267. const type = props.type || "default";
  46268. const sortable = props.sortable === "" ? true : props.sortable;
  46269. const showOverflowTooltip = type === "selection" ? false : isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip ?? globalConfig.value?.showOverflowTooltip : props.showOverflowTooltip;
  46270. const tooltipFormatter = isUndefined(props.tooltipFormatter) ? parent.props.tooltipFormatter ?? globalConfig.value?.tooltipFormatter : props.tooltipFormatter;
  46271. const defaults = {
  46272. ...cellStarts[type],
  46273. id: columnId.value,
  46274. type,
  46275. property: props.prop || props.property,
  46276. align: realAlign,
  46277. headerAlign: realHeaderAlign,
  46278. showOverflowTooltip,
  46279. tooltipFormatter,
  46280. filterable: props.filters || props.filterMethod,
  46281. filteredValue: [],
  46282. filterPlacement: "",
  46283. filterClassName: "",
  46284. isColumnGroup: false,
  46285. isSubColumn: false,
  46286. filterOpened: false,
  46287. sortable,
  46288. index: props.index,
  46289. rawColumnKey: instance.vnode.key
  46290. };
  46291. let column = getPropsData([
  46292. "columnKey",
  46293. "label",
  46294. "className",
  46295. "labelClassName",
  46296. "type",
  46297. "renderHeader",
  46298. "formatter",
  46299. "fixed",
  46300. "resizable"
  46301. ], [
  46302. "sortMethod",
  46303. "sortBy",
  46304. "sortOrders"
  46305. ], ["selectable", "reserveSelection"], [
  46306. "filterMethod",
  46307. "filters",
  46308. "filterMultiple",
  46309. "filterOpened",
  46310. "filteredValue",
  46311. "filterPlacement",
  46312. "filterClassName"
  46313. ]);
  46314. column = mergeOptions(defaults, column);
  46315. column = compose(setColumnRenders, setColumnWidth, setColumnForcedProps)(column);
  46316. columnConfig.value = column;
  46317. registerNormalWatchers();
  46318. registerComplexWatchers();
  46319. });
  46320. onMounted(() => {
  46321. const parent = columnOrTableParent.value;
  46322. const children = isSubColumn.value ? parent.vnode.el?.children : parent.refs.hiddenColumns?.children;
  46323. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  46324. columnConfig.value.getColumnIndex = getColumnIndex;
  46325. getColumnIndex() > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? "columnConfig" in parent && parent.columnConfig.value : null, updateColumnOrder);
  46326. });
  46327. onBeforeUnmount(() => {
  46328. const getColumnIndex = columnConfig.value.getColumnIndex;
  46329. (getColumnIndex ? getColumnIndex() : -1) > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? "columnConfig" in parent && parent.columnConfig.value : null, updateColumnOrder);
  46330. });
  46331. instance.columnId = columnId.value;
  46332. instance.columnConfig = columnConfig;
  46333. },
  46334. render() {
  46335. try {
  46336. const renderDefault = this.$slots.default?.({
  46337. row: {},
  46338. column: {},
  46339. $index: -1
  46340. });
  46341. const children = [];
  46342. if (isArray$1(renderDefault)) {
  46343. for (const childNode of renderDefault) if (childNode.type?.name === "ElTableColumn" || childNode.shapeFlag & 2) children.push(childNode);
  46344. else if (childNode.type === Fragment && isArray$1(childNode.children)) childNode.children.forEach((vnode) => {
  46345. if (vnode?.patchFlag !== 1024 && !isString(vnode?.children)) children.push(vnode);
  46346. });
  46347. }
  46348. return h("div", children);
  46349. } catch {
  46350. return h("div", []);
  46351. }
  46352. }
  46353. });
  46354. //#endregion
  46355. //#region ../../packages/components/table/src/tableColumn.ts
  46356. var tableColumn_default = table_column_default;
  46357. //#endregion
  46358. //#region ../../packages/components/table/index.ts
  46359. const ElTable = withInstall(table_default, { TableColumn: tableColumn_default });
  46360. const ElTableColumn = withNoopInstall(tableColumn_default);
  46361. //#endregion
  46362. //#region ../../packages/components/table-v2/src/constants.ts
  46363. let SortOrder = /* @__PURE__ */ function(SortOrder) {
  46364. SortOrder["ASC"] = "asc";
  46365. SortOrder["DESC"] = "desc";
  46366. return SortOrder;
  46367. }({});
  46368. let Alignment = /* @__PURE__ */ function(Alignment) {
  46369. Alignment["LEFT"] = "left";
  46370. Alignment["CENTER"] = "center";
  46371. Alignment["RIGHT"] = "right";
  46372. return Alignment;
  46373. }({});
  46374. let FixedDir = /* @__PURE__ */ function(FixedDir) {
  46375. FixedDir["LEFT"] = "left";
  46376. FixedDir["RIGHT"] = "right";
  46377. return FixedDir;
  46378. }({});
  46379. const oppositeOrderMap = {
  46380. [SortOrder.ASC]: SortOrder.DESC,
  46381. [SortOrder.DESC]: SortOrder.ASC
  46382. };
  46383. const sortOrders = [SortOrder.ASC, SortOrder.DESC];
  46384. //#endregion
  46385. //#region ../../packages/components/table-v2/src/private.ts
  46386. const placeholderSign = Symbol("placeholder");
  46387. //#endregion
  46388. //#region ../../packages/components/table-v2/src/composables/utils.ts
  46389. const calcColumnStyle = (column, fixedColumn, fixed) => {
  46390. const flex = {
  46391. flexGrow: 0,
  46392. flexShrink: 0,
  46393. ...fixed ? {} : {
  46394. flexGrow: column.flexGrow ?? 0,
  46395. flexShrink: column.flexShrink ?? 1
  46396. }
  46397. };
  46398. const style = {
  46399. ...column.style ?? {},
  46400. ...flex,
  46401. flexBasis: "auto",
  46402. width: column.width
  46403. };
  46404. if (!fixedColumn) {
  46405. if (column.maxWidth) style.maxWidth = column.maxWidth;
  46406. if (column.minWidth) style.minWidth = column.minWidth;
  46407. }
  46408. return style;
  46409. };
  46410. //#endregion
  46411. //#region ../../packages/components/table-v2/src/composables/use-columns.ts
  46412. function useColumns(props, columns, fixed) {
  46413. const _columns = computed(() => unref(columns).map((column, index) => ({
  46414. ...column,
  46415. key: column.key ?? column.dataKey ?? index
  46416. })));
  46417. const visibleColumns = computed(() => {
  46418. return unref(_columns).filter((column) => !column.hidden);
  46419. });
  46420. const fixedColumnsOnLeft = computed(() => unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  46421. const fixedColumnsOnRight = computed(() => unref(visibleColumns).filter((column) => column.fixed === "right"));
  46422. const normalColumns = computed(() => unref(visibleColumns).filter((column) => !column.fixed));
  46423. const mainColumns = computed(() => {
  46424. const ret = [];
  46425. unref(fixedColumnsOnLeft).forEach((column) => {
  46426. ret.push({
  46427. ...column,
  46428. placeholderSign
  46429. });
  46430. });
  46431. unref(normalColumns).forEach((column) => {
  46432. ret.push(column);
  46433. });
  46434. unref(fixedColumnsOnRight).forEach((column) => {
  46435. ret.push({
  46436. ...column,
  46437. placeholderSign
  46438. });
  46439. });
  46440. return ret;
  46441. });
  46442. const hasFixedColumns = computed(() => {
  46443. return unref(fixedColumnsOnLeft).length || unref(fixedColumnsOnRight).length;
  46444. });
  46445. const columnsStyles = computed(() => {
  46446. return unref(_columns).reduce((style, column) => {
  46447. style[column.key] = calcColumnStyle(column, unref(fixed), props.fixed);
  46448. return style;
  46449. }, {});
  46450. });
  46451. const columnsTotalWidth = computed(() => {
  46452. return unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  46453. });
  46454. const getColumn = (key) => {
  46455. return unref(_columns).find((column) => column.key === key);
  46456. };
  46457. const getColumnStyle = (key) => {
  46458. return unref(columnsStyles)[key];
  46459. };
  46460. const updateColumnWidth = (column, width) => {
  46461. column.width = width;
  46462. };
  46463. function onColumnSorted(e) {
  46464. const { key } = e.currentTarget.dataset;
  46465. if (!key) return;
  46466. const { sortState, sortBy } = props;
  46467. let order = SortOrder.ASC;
  46468. if (isObject$1(sortState)) order = oppositeOrderMap[sortState[key]];
  46469. else order = oppositeOrderMap[sortBy.order];
  46470. props.onColumnSort?.({
  46471. column: getColumn(key),
  46472. key,
  46473. order
  46474. });
  46475. }
  46476. return {
  46477. columns: _columns,
  46478. columnsStyles,
  46479. columnsTotalWidth,
  46480. fixedColumnsOnLeft,
  46481. fixedColumnsOnRight,
  46482. hasFixedColumns,
  46483. mainColumns,
  46484. normalColumns,
  46485. visibleColumns,
  46486. getColumn,
  46487. getColumnStyle,
  46488. updateColumnWidth,
  46489. onColumnSorted
  46490. };
  46491. }
  46492. //#endregion
  46493. //#region ../../packages/components/table-v2/src/composables/use-scrollbar.ts
  46494. const useScrollbar = (props, { mainTableRef, leftTableRef, rightTableRef, onMaybeEndReached }) => {
  46495. const scrollPos = ref({
  46496. scrollLeft: 0,
  46497. scrollTop: 0
  46498. });
  46499. function doScroll(params) {
  46500. const { scrollTop } = params;
  46501. mainTableRef.value?.scrollTo(params);
  46502. leftTableRef.value?.scrollToTop(scrollTop);
  46503. rightTableRef.value?.scrollToTop(scrollTop);
  46504. }
  46505. function scrollTo(params) {
  46506. scrollPos.value = params;
  46507. doScroll(params);
  46508. }
  46509. function scrollToTop(scrollTop) {
  46510. scrollPos.value.scrollTop = scrollTop;
  46511. doScroll(unref(scrollPos));
  46512. }
  46513. function scrollToLeft(scrollLeft) {
  46514. scrollPos.value.scrollLeft = scrollLeft;
  46515. mainTableRef.value?.scrollTo?.(unref(scrollPos));
  46516. }
  46517. function onScroll(params) {
  46518. scrollTo(params);
  46519. props.onScroll?.(params);
  46520. }
  46521. function onVerticalScroll({ scrollTop }) {
  46522. const { scrollTop: currentScrollTop } = unref(scrollPos);
  46523. if (scrollTop !== currentScrollTop) scrollToTop(scrollTop);
  46524. }
  46525. function scrollToRow(row, strategy = "auto") {
  46526. mainTableRef.value?.scrollToRow(row, strategy);
  46527. }
  46528. watch(() => unref(scrollPos).scrollTop, (cur, prev) => {
  46529. if (cur > prev) onMaybeEndReached();
  46530. });
  46531. return {
  46532. scrollPos,
  46533. scrollTo,
  46534. scrollToLeft,
  46535. scrollToTop,
  46536. scrollToRow,
  46537. onScroll,
  46538. onVerticalScroll
  46539. };
  46540. };
  46541. //#endregion
  46542. //#region ../../packages/components/table-v2/src/composables/use-row.ts
  46543. const useRow = (props, { mainTableRef, leftTableRef, rightTableRef, tableInstance, ns, isScrolling }) => {
  46544. const vm = getCurrentInstance();
  46545. const { emit } = vm;
  46546. const isResetting = shallowRef(false);
  46547. const expandedRowKeys = ref(props.defaultExpandedRowKeys || []);
  46548. const lastRenderedRowIndex = ref(-1);
  46549. const resetIndex = shallowRef(null);
  46550. const rowHeights = ref({});
  46551. const pendingRowHeights = ref({});
  46552. const leftTableHeights = shallowRef({});
  46553. const mainTableHeights = shallowRef({});
  46554. const rightTableHeights = shallowRef({});
  46555. const isDynamic = computed(() => isNumber(props.estimatedRowHeight));
  46556. function onRowsRendered(params) {
  46557. props.onRowsRendered?.(params);
  46558. if (params.rowCacheEnd > unref(lastRenderedRowIndex)) lastRenderedRowIndex.value = params.rowCacheEnd;
  46559. }
  46560. function onRowHovered({ hovered, rowKey }) {
  46561. if (isScrolling.value) return;
  46562. tableInstance.vnode.el.querySelectorAll(`[rowkey="${String(rowKey)}"]`).forEach((row) => {
  46563. if (hovered) row.classList.add(ns.is("hovered"));
  46564. else row.classList.remove(ns.is("hovered"));
  46565. });
  46566. }
  46567. function onRowExpanded({ expanded, rowData, rowIndex, rowKey }) {
  46568. const _expandedRowKeys = [...unref(expandedRowKeys)];
  46569. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  46570. if (expanded) {
  46571. if (currentKeyIndex === -1) _expandedRowKeys.push(rowKey);
  46572. } else if (currentKeyIndex > -1) _expandedRowKeys.splice(currentKeyIndex, 1);
  46573. expandedRowKeys.value = _expandedRowKeys;
  46574. emit("update:expandedRowKeys", _expandedRowKeys);
  46575. props.onRowExpand?.({
  46576. expanded,
  46577. rowData,
  46578. rowIndex,
  46579. rowKey
  46580. });
  46581. props.onExpandedRowsChange?.(_expandedRowKeys);
  46582. if (tableInstance.vnode.el.querySelector(`.${ns.is("hovered")}[rowkey="${String(rowKey)}"]`)) nextTick(() => onRowHovered({
  46583. hovered: true,
  46584. rowKey
  46585. }));
  46586. }
  46587. const flushingRowHeights = debounce(() => {
  46588. isResetting.value = true;
  46589. rowHeights.value = {
  46590. ...unref(rowHeights),
  46591. ...unref(pendingRowHeights)
  46592. };
  46593. resetAfterIndex(unref(resetIndex), false);
  46594. pendingRowHeights.value = {};
  46595. resetIndex.value = null;
  46596. mainTableRef.value?.forceUpdate();
  46597. leftTableRef.value?.forceUpdate();
  46598. rightTableRef.value?.forceUpdate();
  46599. vm.proxy?.$forceUpdate();
  46600. isResetting.value = false;
  46601. }, 0);
  46602. function resetAfterIndex(index, forceUpdate = false) {
  46603. if (!unref(isDynamic)) return;
  46604. [
  46605. mainTableRef,
  46606. leftTableRef,
  46607. rightTableRef
  46608. ].forEach((tableRef) => {
  46609. const table = unref(tableRef);
  46610. if (table) table.resetAfterRowIndex(index, forceUpdate);
  46611. });
  46612. }
  46613. function resetHeights(rowKey, height, rowIdx) {
  46614. const resetIdx = unref(resetIndex);
  46615. if (resetIdx === null) resetIndex.value = rowIdx;
  46616. else if (resetIdx > rowIdx) resetIndex.value = rowIdx;
  46617. pendingRowHeights.value[rowKey] = height;
  46618. }
  46619. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  46620. if (!fixedDir) mainTableHeights.value[rowKey] = height;
  46621. else if (fixedDir === FixedDir.RIGHT) rightTableHeights.value[rowKey] = height;
  46622. else leftTableHeights.value[rowKey] = height;
  46623. const maximumHeight = Math.max(...[
  46624. leftTableHeights,
  46625. rightTableHeights,
  46626. mainTableHeights
  46627. ].map((records) => records.value[rowKey] || 0));
  46628. if (unref(rowHeights)[rowKey] !== maximumHeight) {
  46629. resetHeights(rowKey, maximumHeight, rowIndex);
  46630. flushingRowHeights();
  46631. }
  46632. }
  46633. return {
  46634. expandedRowKeys,
  46635. lastRenderedRowIndex,
  46636. isDynamic,
  46637. isResetting,
  46638. rowHeights,
  46639. resetAfterIndex,
  46640. onRowExpanded,
  46641. onRowHovered,
  46642. onRowsRendered,
  46643. onRowHeightChange
  46644. };
  46645. };
  46646. //#endregion
  46647. //#region ../../packages/components/table-v2/src/composables/use-data.ts
  46648. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  46649. const depthMap = ref({});
  46650. const flattenedData = computed(() => {
  46651. const depths = {};
  46652. const { data, rowKey } = props;
  46653. const _expandedRowKeys = unref(expandedRowKeys);
  46654. if (!_expandedRowKeys || !_expandedRowKeys.length) return data;
  46655. const array = [];
  46656. const keysSet = /* @__PURE__ */ new Set();
  46657. _expandedRowKeys.forEach((x) => keysSet.add(x));
  46658. let copy = data.slice();
  46659. copy.forEach((x) => depths[x[rowKey]] = 0);
  46660. while (copy.length > 0) {
  46661. const item = copy.shift();
  46662. array.push(item);
  46663. if (keysSet.has(item[rowKey]) && isArray$1(item.children) && item.children.length > 0) {
  46664. copy = [...item.children, ...copy];
  46665. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  46666. }
  46667. }
  46668. depthMap.value = depths;
  46669. return array;
  46670. });
  46671. const data = computed(() => {
  46672. const { data, expandColumnKey } = props;
  46673. return expandColumnKey ? unref(flattenedData) : data;
  46674. });
  46675. watch(data, (val, prev) => {
  46676. if (val !== prev) {
  46677. lastRenderedRowIndex.value = -1;
  46678. resetAfterIndex(0, true);
  46679. }
  46680. });
  46681. return {
  46682. data,
  46683. depthMap
  46684. };
  46685. };
  46686. //#endregion
  46687. //#region ../../packages/components/table-v2/src/utils.ts
  46688. const sumReducer = (sum, num) => sum + num;
  46689. const sum = (listLike) => {
  46690. return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  46691. };
  46692. const tryCall = (fLike, params, defaultRet = {}) => {
  46693. return isFunction$1(fLike) ? fLike(params) : fLike ?? defaultRet;
  46694. };
  46695. const enforceUnit = (style) => {
  46696. [
  46697. "width",
  46698. "maxWidth",
  46699. "minWidth",
  46700. "height"
  46701. ].forEach((key) => {
  46702. style[key] = addUnit(style[key]);
  46703. });
  46704. return style;
  46705. };
  46706. const componentToSlot = (ComponentLike) => isVNode(ComponentLike) ? (props) => h(ComponentLike, props) : ComponentLike;
  46707. //#endregion
  46708. //#region ../../packages/components/table-v2/src/composables/use-styles.ts
  46709. const useStyles = (props, { columnsTotalWidth, rowsHeight, fixedColumnsOnLeft, fixedColumnsOnRight }) => {
  46710. const bodyWidth = computed(() => {
  46711. const { fixed, width, vScrollbarSize } = props;
  46712. const ret = width - vScrollbarSize;
  46713. return fixed ? Math.max(Math.round(unref(columnsTotalWidth)), ret) : ret;
  46714. });
  46715. const mainTableHeight = computed(() => {
  46716. const { height = 0, maxHeight = 0, footerHeight, hScrollbarSize } = props;
  46717. if (maxHeight > 0) {
  46718. const _fixedRowsHeight = unref(fixedRowsHeight);
  46719. const _rowsHeight = unref(rowsHeight);
  46720. const total = unref(headerHeight) + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  46721. return Math.min(total, maxHeight - footerHeight);
  46722. }
  46723. return height - footerHeight;
  46724. });
  46725. const fixedTableHeight = computed(() => {
  46726. const { maxHeight } = props;
  46727. const tableHeight = unref(mainTableHeight);
  46728. if (isNumber(maxHeight) && maxHeight > 0) return tableHeight;
  46729. const totalHeight = unref(rowsHeight) + unref(headerHeight) + unref(fixedRowsHeight);
  46730. return Math.min(tableHeight, totalHeight);
  46731. });
  46732. const mapColumn = (column) => column.width;
  46733. const leftTableWidth = computed(() => sum(unref(fixedColumnsOnLeft).map(mapColumn)));
  46734. const rightTableWidth = computed(() => sum(unref(fixedColumnsOnRight).map(mapColumn)));
  46735. const headerHeight = computed(() => sum(props.headerHeight));
  46736. const fixedRowsHeight = computed(() => {
  46737. return (props.fixedData?.length || 0) * props.rowHeight;
  46738. });
  46739. const windowHeight = computed(() => {
  46740. return unref(mainTableHeight) - unref(headerHeight) - unref(fixedRowsHeight);
  46741. });
  46742. const rootStyle = computed(() => {
  46743. const { style = {}, height, width } = props;
  46744. return enforceUnit({
  46745. ...style,
  46746. height,
  46747. width
  46748. });
  46749. });
  46750. return {
  46751. bodyWidth,
  46752. fixedTableHeight,
  46753. mainTableHeight,
  46754. leftTableWidth,
  46755. rightTableWidth,
  46756. windowHeight,
  46757. footerHeight: computed(() => enforceUnit({ height: props.footerHeight })),
  46758. emptyStyle: computed(() => ({
  46759. top: addUnit(unref(headerHeight)),
  46760. bottom: addUnit(props.footerHeight),
  46761. width: addUnit(props.width)
  46762. })),
  46763. rootStyle,
  46764. headerHeight
  46765. };
  46766. };
  46767. //#endregion
  46768. //#region ../../packages/components/table-v2/src/composables/use-auto-resize.ts
  46769. const useAutoResize = (props) => {
  46770. const sizer = ref();
  46771. const width$ = ref(0);
  46772. const height$ = ref(0);
  46773. let resizerStopper;
  46774. onMounted(() => {
  46775. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  46776. const { width, height } = entry.contentRect;
  46777. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  46778. const left = Number.parseInt(paddingLeft) || 0;
  46779. const right = Number.parseInt(paddingRight) || 0;
  46780. const top = Number.parseInt(paddingTop) || 0;
  46781. const bottom = Number.parseInt(paddingBottom) || 0;
  46782. width$.value = width - left - right;
  46783. height$.value = height - top - bottom;
  46784. }).stop;
  46785. });
  46786. onBeforeUnmount(() => {
  46787. resizerStopper?.();
  46788. });
  46789. watch([width$, height$], ([width, height]) => {
  46790. props.onResize?.({
  46791. width,
  46792. height
  46793. });
  46794. });
  46795. return {
  46796. sizer,
  46797. width: width$,
  46798. height: height$
  46799. };
  46800. };
  46801. //#endregion
  46802. //#region ../../packages/components/table-v2/src/use-table.ts
  46803. function useTable(props) {
  46804. const mainTableRef = ref();
  46805. const leftTableRef = ref();
  46806. const rightTableRef = ref();
  46807. const { columns, columnsStyles, columnsTotalWidth, fixedColumnsOnLeft, fixedColumnsOnRight, hasFixedColumns, mainColumns, onColumnSorted } = useColumns(props, toRef(props, "columns"), toRef(props, "fixed"));
  46808. const { scrollTo, scrollToLeft, scrollToTop, scrollToRow, onScroll, onVerticalScroll, scrollPos } = useScrollbar(props, {
  46809. mainTableRef,
  46810. leftTableRef,
  46811. rightTableRef,
  46812. onMaybeEndReached
  46813. });
  46814. const ns = useNamespace("table-v2");
  46815. const instance = getCurrentInstance();
  46816. const isScrolling = shallowRef(false);
  46817. const { expandedRowKeys, lastRenderedRowIndex, isDynamic, isResetting, rowHeights, resetAfterIndex, onRowExpanded, onRowHeightChange, onRowHovered, onRowsRendered } = useRow(props, {
  46818. mainTableRef,
  46819. leftTableRef,
  46820. rightTableRef,
  46821. tableInstance: instance,
  46822. ns,
  46823. isScrolling
  46824. });
  46825. const { data, depthMap } = useData(props, {
  46826. expandedRowKeys,
  46827. lastRenderedRowIndex,
  46828. resetAfterIndex
  46829. });
  46830. const rowsHeight = computed(() => {
  46831. const { estimatedRowHeight, rowHeight } = props;
  46832. const _data = unref(data);
  46833. if (isNumber(estimatedRowHeight)) return Object.values(unref(rowHeights)).reduce((acc, curr) => acc + curr, 0);
  46834. return _data.length * rowHeight;
  46835. });
  46836. const { bodyWidth, fixedTableHeight, mainTableHeight, leftTableWidth, rightTableWidth, windowHeight, footerHeight, emptyStyle, rootStyle, headerHeight } = useStyles(props, {
  46837. columnsTotalWidth,
  46838. fixedColumnsOnLeft,
  46839. fixedColumnsOnRight,
  46840. rowsHeight
  46841. });
  46842. const containerRef = ref();
  46843. const showEmpty = computed(() => {
  46844. const noData = unref(data).length === 0;
  46845. return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  46846. });
  46847. function getRowHeight(rowIndex) {
  46848. const { estimatedRowHeight, rowHeight, rowKey } = props;
  46849. if (!estimatedRowHeight) return rowHeight;
  46850. return unref(rowHeights)[unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  46851. }
  46852. const isEndReached = ref(false);
  46853. function onMaybeEndReached() {
  46854. const { onEndReached } = props;
  46855. if (!onEndReached) return;
  46856. const { scrollTop } = unref(scrollPos);
  46857. const _totalHeight = unref(rowsHeight);
  46858. const remainDistance = _totalHeight - (scrollTop + unref(windowHeight)) + props.hScrollbarSize;
  46859. if (!isEndReached.value && unref(lastRenderedRowIndex) >= 0 && _totalHeight <= scrollTop + unref(mainTableHeight) - unref(headerHeight)) {
  46860. isEndReached.value = true;
  46861. onEndReached(remainDistance);
  46862. } else isEndReached.value = false;
  46863. }
  46864. watch(() => unref(rowsHeight), () => isEndReached.value = false);
  46865. watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, { deep: true });
  46866. return {
  46867. columns,
  46868. containerRef,
  46869. mainTableRef,
  46870. leftTableRef,
  46871. rightTableRef,
  46872. isDynamic,
  46873. isResetting,
  46874. isScrolling,
  46875. hasFixedColumns,
  46876. columnsStyles,
  46877. columnsTotalWidth,
  46878. data,
  46879. expandedRowKeys,
  46880. depthMap,
  46881. fixedColumnsOnLeft,
  46882. fixedColumnsOnRight,
  46883. mainColumns,
  46884. bodyWidth,
  46885. emptyStyle,
  46886. rootStyle,
  46887. footerHeight,
  46888. mainTableHeight,
  46889. fixedTableHeight,
  46890. leftTableWidth,
  46891. rightTableWidth,
  46892. showEmpty,
  46893. getRowHeight,
  46894. onColumnSorted,
  46895. onRowHovered,
  46896. onRowExpanded,
  46897. onRowsRendered,
  46898. onRowHeightChange,
  46899. scrollTo,
  46900. scrollToLeft,
  46901. scrollToTop,
  46902. scrollToRow,
  46903. onScroll,
  46904. onVerticalScroll
  46905. };
  46906. }
  46907. //#endregion
  46908. //#region ../../packages/components/table-v2/src/tokens.ts
  46909. const TableV2InjectionKey = Symbol("tableV2");
  46910. const TABLE_V2_GRID_INJECTION_KEY = "tableV2GridScrollLeft";
  46911. //#endregion
  46912. //#region ../../packages/components/table-v2/src/common.ts
  46913. /**
  46914. * @Note even though we can use `string[] | string` as the type but for
  46915. * convenience here we only use `string` as the acceptable value here.
  46916. */
  46917. const classType = String;
  46918. const columns = {
  46919. type: definePropType(Array),
  46920. required: true
  46921. };
  46922. const column = { type: definePropType(Object) };
  46923. const fixedDataType = { type: definePropType(Array) };
  46924. const dataType = {
  46925. ...fixedDataType,
  46926. required: true
  46927. };
  46928. const expandColumnKey = String;
  46929. const expandKeys = {
  46930. type: definePropType(Array),
  46931. default: () => mutable([])
  46932. };
  46933. const requiredNumber = {
  46934. type: Number,
  46935. required: true
  46936. };
  46937. const rowKey = {
  46938. type: definePropType([
  46939. String,
  46940. Number,
  46941. Symbol
  46942. ]),
  46943. default: "id"
  46944. };
  46945. /**
  46946. * @note even though we can use `StyleValue` but that would be difficult for us to mapping them,
  46947. * so we only use `CSSProperties` as the acceptable value here.
  46948. */
  46949. const styleType = { type: definePropType(Object) };
  46950. //#endregion
  46951. //#region ../../packages/components/table-v2/src/row.ts
  46952. const tableV2RowProps = buildProps({
  46953. class: String,
  46954. columns,
  46955. columnsStyles: {
  46956. type: definePropType(Object),
  46957. required: true
  46958. },
  46959. depth: Number,
  46960. expandColumnKey,
  46961. estimatedRowHeight: {
  46962. ...virtualizedGridProps.estimatedRowHeight,
  46963. default: void 0
  46964. },
  46965. isScrolling: Boolean,
  46966. onRowExpand: { type: definePropType(Function) },
  46967. onRowHover: { type: definePropType(Function) },
  46968. onRowHeightChange: { type: definePropType(Function) },
  46969. rowData: {
  46970. type: definePropType(Object),
  46971. required: true
  46972. },
  46973. rowEventHandlers: { type: definePropType(Object) },
  46974. rowIndex: {
  46975. type: Number,
  46976. required: true
  46977. },
  46978. rowKey,
  46979. style: { type: definePropType(Object) }
  46980. });
  46981. //#endregion
  46982. //#region ../../packages/components/table-v2/src/header.ts
  46983. const requiredNumberType = {
  46984. type: Number,
  46985. required: true
  46986. };
  46987. const tableV2HeaderProps = buildProps({
  46988. class: String,
  46989. columns,
  46990. fixedHeaderData: { type: definePropType(Array) },
  46991. headerData: {
  46992. type: definePropType(Array),
  46993. required: true
  46994. },
  46995. headerHeight: {
  46996. type: definePropType([Number, Array]),
  46997. default: 50
  46998. },
  46999. rowWidth: requiredNumberType,
  47000. rowHeight: {
  47001. type: Number,
  47002. default: 50
  47003. },
  47004. height: requiredNumberType,
  47005. width: requiredNumberType
  47006. });
  47007. //#endregion
  47008. //#region ../../packages/components/table-v2/src/grid.ts
  47009. const tableV2GridProps = buildProps({
  47010. columns,
  47011. data: dataType,
  47012. fixedData: fixedDataType,
  47013. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  47014. width: requiredNumber,
  47015. height: requiredNumber,
  47016. headerWidth: requiredNumber,
  47017. headerHeight: tableV2HeaderProps.headerHeight,
  47018. bodyWidth: requiredNumber,
  47019. rowHeight: requiredNumber,
  47020. cache: virtualizedListProps.cache,
  47021. useIsScrolling: Boolean,
  47022. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  47023. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  47024. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  47025. class: classType,
  47026. style: styleType,
  47027. containerStyle: styleType,
  47028. getRowHeight: {
  47029. type: definePropType(Function),
  47030. required: true
  47031. },
  47032. rowKey: tableV2RowProps.rowKey,
  47033. onRowsRendered: { type: definePropType(Function) },
  47034. onScroll: { type: definePropType(Function) }
  47035. });
  47036. //#endregion
  47037. //#region ../../packages/components/table-v2/src/table.ts
  47038. const tableV2Props = buildProps({
  47039. cache: tableV2GridProps.cache,
  47040. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  47041. rowKey,
  47042. headerClass: { type: definePropType([String, Function]) },
  47043. headerProps: { type: definePropType([Object, Function]) },
  47044. headerCellProps: { type: definePropType([Object, Function]) },
  47045. headerHeight: tableV2HeaderProps.headerHeight,
  47046. footerHeight: {
  47047. type: Number,
  47048. default: 0
  47049. },
  47050. rowClass: { type: definePropType([String, Function]) },
  47051. rowProps: { type: definePropType([Object, Function]) },
  47052. rowHeight: {
  47053. type: Number,
  47054. default: 50
  47055. },
  47056. cellProps: { type: definePropType([Object, Function]) },
  47057. columns,
  47058. data: dataType,
  47059. dataGetter: { type: definePropType(Function) },
  47060. fixedData: fixedDataType,
  47061. expandColumnKey: tableV2RowProps.expandColumnKey,
  47062. expandedRowKeys: expandKeys,
  47063. defaultExpandedRowKeys: expandKeys,
  47064. class: classType,
  47065. fixed: Boolean,
  47066. style: { type: definePropType(Object) },
  47067. width: requiredNumber,
  47068. height: requiredNumber,
  47069. maxHeight: Number,
  47070. useIsScrolling: Boolean,
  47071. indentSize: {
  47072. type: Number,
  47073. default: 12
  47074. },
  47075. iconSize: {
  47076. type: Number,
  47077. default: 12
  47078. },
  47079. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  47080. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  47081. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  47082. sortBy: {
  47083. type: definePropType(Object),
  47084. default: () => ({})
  47085. },
  47086. sortState: {
  47087. type: definePropType(Object),
  47088. default: void 0
  47089. },
  47090. onColumnSort: { type: definePropType(Function) },
  47091. onExpandedRowsChange: { type: definePropType(Function) },
  47092. onEndReached: { type: definePropType(Function) },
  47093. onRowExpand: tableV2RowProps.onRowExpand,
  47094. onScroll: tableV2GridProps.onScroll,
  47095. onRowsRendered: tableV2GridProps.onRowsRendered,
  47096. rowEventHandlers: tableV2RowProps.rowEventHandlers
  47097. });
  47098. //#endregion
  47099. //#region ../../packages/components/table-v2/src/components/cell.tsx
  47100. const TableV2Cell = (props, { slots }) => {
  47101. const { cellData, style } = props;
  47102. const displayText = cellData?.toString?.() || "";
  47103. const defaultSlot = renderSlot(slots, "default", props, () => [displayText]);
  47104. return createVNode("div", {
  47105. "class": props.class,
  47106. "title": displayText,
  47107. "style": style
  47108. }, [defaultSlot]);
  47109. };
  47110. TableV2Cell.displayName = "ElTableV2Cell";
  47111. TableV2Cell.inheritAttrs = false;
  47112. //#endregion
  47113. //#region ../../packages/components/table-v2/src/components/header-cell.tsx
  47114. const HeaderCell = (props, { slots }) => renderSlot(slots, "default", props, () => [createVNode("div", {
  47115. "class": props.class,
  47116. "title": props.column?.title
  47117. }, [props.column?.title])]);
  47118. HeaderCell.displayName = "ElTableV2HeaderCell";
  47119. HeaderCell.inheritAttrs = false;
  47120. //#endregion
  47121. //#region ../../packages/components/table-v2/src/header-row.ts
  47122. const tableV2HeaderRowProps = buildProps({
  47123. class: String,
  47124. columns,
  47125. columnsStyles: {
  47126. type: definePropType(Object),
  47127. required: true
  47128. },
  47129. headerIndex: Number,
  47130. style: { type: definePropType(Object) }
  47131. });
  47132. //#endregion
  47133. //#region ../../packages/components/table-v2/src/components/header-row.tsx
  47134. const TableV2HeaderRow = /* @__PURE__ */ defineComponent({
  47135. name: "ElTableV2HeaderRow",
  47136. props: tableV2HeaderRowProps,
  47137. setup(props, { slots }) {
  47138. return () => {
  47139. const { columns, columnsStyles, headerIndex, style } = props;
  47140. let Cells = columns.map((column, columnIndex) => {
  47141. return slots.cell({
  47142. columns,
  47143. column,
  47144. columnIndex,
  47145. headerIndex,
  47146. style: columnsStyles[column.key]
  47147. });
  47148. });
  47149. if (slots.header) Cells = slots.header({
  47150. cells: Cells.map((node) => {
  47151. if (isArray$1(node) && node.length === 1) return node[0];
  47152. return node;
  47153. }),
  47154. columns,
  47155. headerIndex
  47156. });
  47157. return createVNode("div", {
  47158. "class": props.class,
  47159. "style": style,
  47160. "role": "row"
  47161. }, [Cells]);
  47162. };
  47163. }
  47164. });
  47165. //#endregion
  47166. //#region ../../packages/components/table-v2/src/components/header.tsx
  47167. const TableV2Header = /* @__PURE__ */ defineComponent({
  47168. name: "ElTableV2Header",
  47169. props: tableV2HeaderProps,
  47170. setup(props, { slots, expose }) {
  47171. const ns = useNamespace("table-v2");
  47172. const scrollLeftInfo = inject(TABLE_V2_GRID_INJECTION_KEY);
  47173. const headerRef = ref();
  47174. const headerStyle = computed(() => enforceUnit({
  47175. width: props.width,
  47176. height: props.height
  47177. }));
  47178. const rowStyle = computed(() => enforceUnit({
  47179. width: props.rowWidth,
  47180. height: props.height
  47181. }));
  47182. const headerHeights = computed(() => castArray$1(unref(props.headerHeight)));
  47183. const scrollToLeft = (left) => {
  47184. const headerEl = unref(headerRef);
  47185. nextTick(() => {
  47186. headerEl?.scroll && headerEl.scroll({ left });
  47187. });
  47188. };
  47189. const renderFixedRows = () => {
  47190. const fixedRowClassName = ns.e("fixed-header-row");
  47191. const { columns, fixedHeaderData, rowHeight } = props;
  47192. return fixedHeaderData?.map((fixedRowData, fixedRowIndex) => {
  47193. const style = enforceUnit({
  47194. height: rowHeight,
  47195. width: "100%"
  47196. });
  47197. return slots.fixed?.({
  47198. class: fixedRowClassName,
  47199. columns,
  47200. rowData: fixedRowData,
  47201. rowIndex: -(fixedRowIndex + 1),
  47202. style
  47203. });
  47204. });
  47205. };
  47206. const renderDynamicRows = () => {
  47207. const dynamicRowClassName = ns.e("dynamic-header-row");
  47208. const { columns } = props;
  47209. return unref(headerHeights).map((rowHeight, rowIndex) => {
  47210. const style = enforceUnit({
  47211. width: "100%",
  47212. height: rowHeight
  47213. });
  47214. return slots.dynamic?.({
  47215. class: dynamicRowClassName,
  47216. columns,
  47217. headerIndex: rowIndex,
  47218. style
  47219. });
  47220. });
  47221. };
  47222. onUpdated(() => {
  47223. if (scrollLeftInfo?.value) scrollToLeft(scrollLeftInfo.value);
  47224. });
  47225. expose({ scrollToLeft });
  47226. return () => {
  47227. if (props.height <= 0) return;
  47228. return createVNode("div", {
  47229. "ref": headerRef,
  47230. "class": props.class,
  47231. "style": unref(headerStyle),
  47232. "role": "rowgroup"
  47233. }, [createVNode("div", {
  47234. "style": unref(rowStyle),
  47235. "class": ns.e("header")
  47236. }, [renderDynamicRows(), renderFixedRows()])]);
  47237. };
  47238. }
  47239. });
  47240. //#endregion
  47241. //#region ../../packages/components/table-v2/src/components/row.tsx
  47242. const useTableRow = (props) => {
  47243. const { isScrolling } = inject(TableV2InjectionKey);
  47244. const measured = ref(false);
  47245. const rowRef = ref();
  47246. const measurable = computed(() => {
  47247. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  47248. });
  47249. const doMeasure = (isInit = false) => {
  47250. const $rowRef = unref(rowRef);
  47251. if (!$rowRef) return;
  47252. const { columns, onRowHeightChange, rowKey, rowIndex, style } = props;
  47253. const { height } = $rowRef.getBoundingClientRect();
  47254. measured.value = true;
  47255. nextTick(() => {
  47256. if (isInit || height !== Number.parseInt(style.height)) {
  47257. const firstColumn = columns[0];
  47258. const isPlaceholder = firstColumn?.placeholderSign === placeholderSign;
  47259. onRowHeightChange?.({
  47260. rowKey,
  47261. height,
  47262. rowIndex
  47263. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  47264. }
  47265. });
  47266. };
  47267. const eventHandlers = computed(() => {
  47268. const { rowData, rowIndex, rowKey, onRowHover } = props;
  47269. const handlers = props.rowEventHandlers || {};
  47270. const eventHandlers = {};
  47271. Object.entries(handlers).forEach(([eventName, handler]) => {
  47272. if (isFunction$1(handler)) eventHandlers[eventName] = (event) => {
  47273. handler({
  47274. event,
  47275. rowData,
  47276. rowIndex,
  47277. rowKey
  47278. });
  47279. };
  47280. });
  47281. if (onRowHover) [{
  47282. name: "onMouseleave",
  47283. hovered: false
  47284. }, {
  47285. name: "onMouseenter",
  47286. hovered: true
  47287. }].forEach(({ name, hovered }) => {
  47288. const existedHandler = eventHandlers[name];
  47289. eventHandlers[name] = (event) => {
  47290. onRowHover({
  47291. event,
  47292. hovered,
  47293. rowData,
  47294. rowIndex,
  47295. rowKey
  47296. });
  47297. existedHandler?.(event);
  47298. };
  47299. });
  47300. return eventHandlers;
  47301. });
  47302. const onExpand = (expanded) => {
  47303. const { onRowExpand, rowData, rowIndex, rowKey } = props;
  47304. onRowExpand?.({
  47305. expanded,
  47306. rowData,
  47307. rowIndex,
  47308. rowKey
  47309. });
  47310. };
  47311. onMounted(() => {
  47312. if (unref(measurable)) doMeasure(true);
  47313. });
  47314. return {
  47315. isScrolling,
  47316. measurable,
  47317. measured,
  47318. rowRef,
  47319. eventHandlers,
  47320. onExpand
  47321. };
  47322. };
  47323. const TableV2Row = /* @__PURE__ */ defineComponent({
  47324. name: "ElTableV2TableRow",
  47325. props: tableV2RowProps,
  47326. setup(props, { expose, slots, attrs }) {
  47327. const { eventHandlers, isScrolling, measurable, measured, rowRef, onExpand } = useTableRow(props);
  47328. expose({ onExpand });
  47329. return () => {
  47330. const { columns, columnsStyles, expandColumnKey, depth, rowData, rowIndex, style } = props;
  47331. let ColumnCells = columns.map((column, columnIndex) => {
  47332. const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  47333. return slots.cell({
  47334. column,
  47335. columns,
  47336. columnIndex,
  47337. depth,
  47338. style: columnsStyles[column.key],
  47339. rowData,
  47340. rowIndex,
  47341. isScrolling: unref(isScrolling),
  47342. expandIconProps: expandable ? {
  47343. rowData,
  47344. rowIndex,
  47345. onExpand
  47346. } : void 0
  47347. });
  47348. });
  47349. if (slots.row) ColumnCells = slots.row({
  47350. cells: ColumnCells.map((node) => {
  47351. if (isArray$1(node) && node.length === 1) return node[0];
  47352. return node;
  47353. }),
  47354. style,
  47355. columns,
  47356. depth,
  47357. rowData,
  47358. rowIndex,
  47359. isScrolling: unref(isScrolling)
  47360. });
  47361. if (unref(measurable)) {
  47362. const { height, ...exceptHeightStyle } = style || {};
  47363. const _measured = unref(measured);
  47364. return createVNode("div", mergeProps({
  47365. "ref": rowRef,
  47366. "class": props.class,
  47367. "style": _measured ? style : exceptHeightStyle,
  47368. "role": "row"
  47369. }, attrs, unref(eventHandlers)), [ColumnCells]);
  47370. }
  47371. return createVNode("div", mergeProps(attrs, {
  47372. "ref": rowRef,
  47373. "class": props.class,
  47374. "style": style,
  47375. "role": "row"
  47376. }, unref(eventHandlers)), [ColumnCells]);
  47377. };
  47378. }
  47379. });
  47380. //#endregion
  47381. //#region ../../packages/components/table-v2/src/components/sort-icon.tsx
  47382. const SortIcon = (props) => {
  47383. const { sortOrder } = props;
  47384. return createVNode("button", {
  47385. "type": "button",
  47386. "aria-label": props.ariaLabel,
  47387. "class": props.class
  47388. }, [createVNode(ElIcon, { "size": 14 }, { default: () => [sortOrder === SortOrder.ASC ? createVNode(sort_up_default, null, null) : createVNode(sort_down_default, null, null)] })]);
  47389. };
  47390. //#endregion
  47391. //#region ../../packages/components/table-v2/src/components/expand-icon.tsx
  47392. const ExpandIcon = (props) => {
  47393. const { expanded, expandable, onExpand, style, size, ariaLabel } = props;
  47394. return createVNode("button", mergeProps({
  47395. onClick: expandable ? () => onExpand(!expanded) : void 0,
  47396. ariaLabel,
  47397. ariaExpanded: expanded,
  47398. class: props.class
  47399. }, { "type": "button" }), [createVNode(ElIcon, {
  47400. "size": size,
  47401. "style": style
  47402. }, { default: () => [createVNode(arrow_right_default, null, null)] })]);
  47403. };
  47404. ExpandIcon.inheritAttrs = false;
  47405. //#endregion
  47406. //#region ../../packages/components/table-v2/src/table-grid.tsx
  47407. const COMPONENT_NAME$5 = "ElTableV2Grid";
  47408. const useTableGrid = (props) => {
  47409. const headerRef = ref();
  47410. const bodyRef = ref();
  47411. const scrollLeft = ref(0);
  47412. const totalHeight = computed(() => {
  47413. const { data, rowHeight, estimatedRowHeight } = props;
  47414. if (estimatedRowHeight) return;
  47415. return data.length * rowHeight;
  47416. });
  47417. const fixedRowHeight = computed(() => {
  47418. const { fixedData, rowHeight } = props;
  47419. return (fixedData?.length || 0) * rowHeight;
  47420. });
  47421. const headerHeight = computed(() => sum(props.headerHeight));
  47422. const gridHeight = computed(() => {
  47423. const { height } = props;
  47424. return Math.max(0, height - unref(headerHeight) - unref(fixedRowHeight));
  47425. });
  47426. const hasHeader = computed(() => {
  47427. return unref(headerHeight) + unref(fixedRowHeight) > 0;
  47428. });
  47429. const itemKey = ({ data, rowIndex }) => data[rowIndex][props.rowKey];
  47430. function onItemRendered({ rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd }) {
  47431. props.onRowsRendered?.({
  47432. rowCacheStart,
  47433. rowCacheEnd,
  47434. rowVisibleStart,
  47435. rowVisibleEnd
  47436. });
  47437. }
  47438. function resetAfterRowIndex(index, forceUpdate) {
  47439. bodyRef.value?.resetAfterRowIndex(index, forceUpdate);
  47440. }
  47441. function scrollTo(leftOrOptions, top) {
  47442. const header$ = unref(headerRef);
  47443. const body$ = unref(bodyRef);
  47444. if (isObject$1(leftOrOptions)) {
  47445. header$?.scrollToLeft(leftOrOptions.scrollLeft);
  47446. scrollLeft.value = leftOrOptions.scrollLeft;
  47447. body$?.scrollTo(leftOrOptions);
  47448. } else {
  47449. header$?.scrollToLeft(leftOrOptions);
  47450. scrollLeft.value = leftOrOptions;
  47451. body$?.scrollTo({
  47452. scrollLeft: leftOrOptions,
  47453. scrollTop: top
  47454. });
  47455. }
  47456. }
  47457. function scrollToTop(scrollTop) {
  47458. unref(bodyRef)?.scrollTo({ scrollTop });
  47459. }
  47460. function scrollToRow(row, strategy) {
  47461. const body = unref(bodyRef);
  47462. if (!body) return;
  47463. const prevScrollLeft = scrollLeft.value;
  47464. body.scrollToItem(row, 0, strategy);
  47465. if (prevScrollLeft) scrollTo({ scrollLeft: prevScrollLeft });
  47466. }
  47467. function forceUpdate() {
  47468. unref(bodyRef)?.$forceUpdate();
  47469. unref(headerRef)?.$forceUpdate();
  47470. }
  47471. watch(() => props.bodyWidth, () => {
  47472. if (isNumber(props.estimatedRowHeight)) bodyRef.value?.resetAfter({ columnIndex: 0 }, false);
  47473. });
  47474. return {
  47475. bodyRef,
  47476. forceUpdate,
  47477. fixedRowHeight,
  47478. gridHeight,
  47479. hasHeader,
  47480. headerHeight,
  47481. headerRef,
  47482. totalHeight,
  47483. itemKey,
  47484. onItemRendered,
  47485. resetAfterRowIndex,
  47486. scrollTo,
  47487. scrollToTop,
  47488. scrollToRow,
  47489. scrollLeft
  47490. };
  47491. };
  47492. const TableGrid = /* @__PURE__ */ defineComponent({
  47493. name: COMPONENT_NAME$5,
  47494. props: tableV2GridProps,
  47495. setup(props, { slots, expose }) {
  47496. const { ns } = inject(TableV2InjectionKey);
  47497. const { bodyRef, fixedRowHeight, gridHeight, hasHeader, headerRef, headerHeight, totalHeight, forceUpdate, itemKey, onItemRendered, resetAfterRowIndex, scrollTo, scrollToTop, scrollToRow, scrollLeft } = useTableGrid(props);
  47498. provide(TABLE_V2_GRID_INJECTION_KEY, scrollLeft);
  47499. onActivated(async () => {
  47500. await nextTick();
  47501. const scrollTop = bodyRef.value?.states.scrollTop;
  47502. scrollTop && scrollToTop(Math.round(scrollTop) + 1);
  47503. });
  47504. expose({
  47505. forceUpdate,
  47506. totalHeight,
  47507. scrollTo,
  47508. scrollToTop,
  47509. scrollToRow,
  47510. resetAfterRowIndex
  47511. });
  47512. const getColumnWidth = () => props.bodyWidth;
  47513. return () => {
  47514. const { cache, columns, data, fixedData, useIsScrolling, scrollbarAlwaysOn, scrollbarEndGap, scrollbarStartGap, style, rowHeight, bodyWidth, estimatedRowHeight, headerWidth, height, width, getRowHeight, onScroll } = props;
  47515. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  47516. const Grid = isDynamicRowEnabled ? DynamicSizeGrid : FixedSizeGrid;
  47517. const _headerHeight = unref(headerHeight);
  47518. return createVNode("div", {
  47519. "role": "table",
  47520. "class": [ns.e("table"), props.class],
  47521. "style": style
  47522. }, [createVNode(Grid, {
  47523. "ref": bodyRef,
  47524. "data": data,
  47525. "useIsScrolling": useIsScrolling,
  47526. "itemKey": itemKey,
  47527. "columnCache": 0,
  47528. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  47529. "totalColumn": 1,
  47530. "totalRow": data.length,
  47531. "rowCache": cache,
  47532. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  47533. "width": width,
  47534. "height": unref(gridHeight),
  47535. "class": ns.e("body"),
  47536. "role": "rowgroup",
  47537. "scrollbarStartGap": scrollbarStartGap,
  47538. "scrollbarEndGap": scrollbarEndGap,
  47539. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  47540. "onScroll": onScroll,
  47541. "onItemRendered": onItemRendered,
  47542. "perfMode": false
  47543. }, { default: (params) => {
  47544. const rowData = data[params.rowIndex];
  47545. return slots.row?.({
  47546. ...params,
  47547. columns,
  47548. rowData
  47549. });
  47550. } }), unref(hasHeader) && createVNode(TableV2Header, {
  47551. "ref": headerRef,
  47552. "class": ns.e("header-wrapper"),
  47553. "columns": columns,
  47554. "headerData": data,
  47555. "headerHeight": props.headerHeight,
  47556. "fixedHeaderData": fixedData,
  47557. "rowWidth": headerWidth,
  47558. "rowHeight": rowHeight,
  47559. "width": width,
  47560. "height": Math.min(_headerHeight + unref(fixedRowHeight), height)
  47561. }, {
  47562. dynamic: slots.header,
  47563. fixed: slots.row
  47564. })]);
  47565. };
  47566. }
  47567. });
  47568. //#endregion
  47569. //#region ../../packages/components/table-v2/src/renderers/main-table.tsx
  47570. function _isSlot$5(s) {
  47571. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  47572. }
  47573. const MainTable = (props, { slots }) => {
  47574. const { mainTableRef, ...rest } = props;
  47575. return createVNode(TableGrid, mergeProps({ "ref": mainTableRef }, rest), _isSlot$5(slots) ? slots : { default: () => [slots] });
  47576. };
  47577. //#endregion
  47578. //#region ../../packages/components/table-v2/src/renderers/left-table.tsx
  47579. function _isSlot$4(s) {
  47580. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  47581. }
  47582. const LeftTable = (props, { slots }) => {
  47583. if (!props.columns.length) return;
  47584. const { leftTableRef, ...rest } = props;
  47585. return createVNode(TableGrid, mergeProps({ "ref": leftTableRef }, rest), _isSlot$4(slots) ? slots : { default: () => [slots] });
  47586. };
  47587. //#endregion
  47588. //#region ../../packages/components/table-v2/src/renderers/right-table.tsx
  47589. function _isSlot$3(s) {
  47590. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  47591. }
  47592. const RightTable = (props, { slots }) => {
  47593. if (!props.columns.length) return;
  47594. const { rightTableRef, ...rest } = props;
  47595. return createVNode(TableGrid, mergeProps({ "ref": rightTableRef }, rest), _isSlot$3(slots) ? slots : { default: () => [slots] });
  47596. };
  47597. //#endregion
  47598. //#region ../../packages/components/table-v2/src/renderers/row.tsx
  47599. function _isSlot$2(s) {
  47600. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  47601. }
  47602. const RowRenderer = (props, { slots }) => {
  47603. const { columns, columnsStyles, depthMap, expandColumnKey, expandedRowKeys, estimatedRowHeight, hasFixedColumns, rowData, rowIndex, style, isScrolling, rowProps, rowClass, rowKey, rowEventHandlers, ns, onRowHovered, onRowExpanded } = props;
  47604. const rowKls = tryCall(rowClass, {
  47605. columns,
  47606. rowData,
  47607. rowIndex
  47608. }, "");
  47609. const additionalProps = tryCall(rowProps, {
  47610. columns,
  47611. rowData,
  47612. rowIndex
  47613. });
  47614. const _rowKey = rowData[rowKey];
  47615. const depth = depthMap[_rowKey] || 0;
  47616. const canExpand = Boolean(expandColumnKey);
  47617. const isFixedRow = rowIndex < 0;
  47618. const kls = [
  47619. ns.e("row"),
  47620. rowKls,
  47621. ns.is("expanded", canExpand && expandedRowKeys.includes(_rowKey)),
  47622. ns.is("fixed", !depth && isFixedRow),
  47623. ns.is("customized", Boolean(slots.row)),
  47624. { [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0 }
  47625. ];
  47626. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  47627. const _rowProps = {
  47628. ...additionalProps,
  47629. columns,
  47630. columnsStyles,
  47631. class: kls,
  47632. depth,
  47633. expandColumnKey,
  47634. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  47635. isScrolling,
  47636. rowIndex,
  47637. rowData,
  47638. rowKey: _rowKey,
  47639. rowEventHandlers,
  47640. style
  47641. };
  47642. const handlerMouseEnter = (e) => {
  47643. onRowHover?.({
  47644. hovered: true,
  47645. rowKey: _rowKey,
  47646. event: e,
  47647. rowData,
  47648. rowIndex
  47649. });
  47650. };
  47651. const handlerMouseLeave = (e) => {
  47652. onRowHover?.({
  47653. hovered: false,
  47654. rowKey: _rowKey,
  47655. event: e,
  47656. rowData,
  47657. rowIndex
  47658. });
  47659. };
  47660. return createVNode(TableV2Row, mergeProps(_rowProps, {
  47661. "onRowExpand": onRowExpanded,
  47662. "onMouseenter": handlerMouseEnter,
  47663. "onMouseleave": handlerMouseLeave,
  47664. "rowkey": _rowKey
  47665. }), _isSlot$2(slots) ? slots : { default: () => [slots] });
  47666. };
  47667. //#endregion
  47668. //#region ../../packages/components/table-v2/src/renderers/cell.tsx
  47669. const CellRenderer = ({ columns, column, columnIndex, depth, expandIconProps, isScrolling, rowData, rowIndex, style, expandedRowKeys, ns, t, cellProps: _cellProps, expandColumnKey, indentSize, iconSize, rowKey }, { slots }) => {
  47670. const cellStyle = enforceUnit(style);
  47671. if (column.placeholderSign === placeholderSign) return createVNode("div", {
  47672. "class": ns.em("row-cell", "placeholder"),
  47673. "style": cellStyle
  47674. }, null);
  47675. const { cellRenderer, dataKey, dataGetter } = column;
  47676. const cellData = isFunction$1(dataGetter) ? dataGetter({
  47677. columns,
  47678. column,
  47679. columnIndex,
  47680. rowData,
  47681. rowIndex
  47682. }) : get(rowData, dataKey ?? "");
  47683. const extraCellProps = tryCall(_cellProps, {
  47684. cellData,
  47685. columns,
  47686. column,
  47687. columnIndex,
  47688. rowIndex,
  47689. rowData
  47690. });
  47691. const cellProps = {
  47692. class: ns.e("cell-text"),
  47693. columns,
  47694. column,
  47695. columnIndex,
  47696. cellData,
  47697. isScrolling,
  47698. rowData,
  47699. rowIndex
  47700. };
  47701. const columnCellRenderer = componentToSlot(cellRenderer);
  47702. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : renderSlot(slots, "default", cellProps, () => [createVNode(TableV2Cell, cellProps, null)]);
  47703. const kls = [
  47704. ns.e("row-cell"),
  47705. column.class,
  47706. column.align === Alignment.CENTER && ns.is("align-center"),
  47707. column.align === Alignment.RIGHT && ns.is("align-right")
  47708. ];
  47709. const expandable = rowIndex >= 0 && expandColumnKey && column.key === expandColumnKey;
  47710. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  47711. let IconOrPlaceholder;
  47712. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  47713. if (expandable) if (isObject$1(expandIconProps)) IconOrPlaceholder = createVNode(ExpandIcon, mergeProps(expandIconProps, {
  47714. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  47715. "size": iconSize,
  47716. "expanded": expanded,
  47717. "ariaLabel": t(expanded ? "el.table.collapseRowLabel" : "el.table.expandRowLabel"),
  47718. "style": iconStyle,
  47719. "expandable": true
  47720. }), null);
  47721. else IconOrPlaceholder = createVNode("div", { "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ") }, null);
  47722. return createVNode("div", mergeProps({
  47723. "class": kls,
  47724. "style": cellStyle
  47725. }, extraCellProps, { "role": "cell" }), [IconOrPlaceholder, Cell]);
  47726. };
  47727. CellRenderer.inheritAttrs = false;
  47728. //#endregion
  47729. //#region ../../packages/components/table-v2/src/renderers/header.tsx
  47730. function _isSlot$1(s) {
  47731. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  47732. }
  47733. const HeaderRenderer = ({ columns, columnsStyles, headerIndex, style, headerClass, headerProps, ns }, { slots }) => {
  47734. const param = {
  47735. columns,
  47736. headerIndex
  47737. };
  47738. const kls = [
  47739. ns.e("header-row"),
  47740. tryCall(headerClass, param, ""),
  47741. ns.is("customized", Boolean(slots.header))
  47742. ];
  47743. return createVNode(TableV2HeaderRow, {
  47744. ...tryCall(headerProps, param),
  47745. columnsStyles,
  47746. class: kls,
  47747. columns,
  47748. headerIndex,
  47749. style
  47750. }, _isSlot$1(slots) ? slots : { default: () => [slots] });
  47751. };
  47752. //#endregion
  47753. //#region ../../packages/components/table-v2/src/renderers/header-cell.tsx
  47754. const HeaderCellRenderer = (props, { slots }) => {
  47755. const { column, ns, t, style, onColumnSorted } = props;
  47756. const cellStyle = enforceUnit(style);
  47757. if (column.placeholderSign === placeholderSign) return createVNode("div", {
  47758. "class": ns.em("header-row-cell", "placeholder"),
  47759. "style": cellStyle
  47760. }, null);
  47761. const { headerCellRenderer, headerClass, sortable } = column;
  47762. /**
  47763. * render Cell children
  47764. */
  47765. const cellProps = {
  47766. ...props,
  47767. class: ns.e("header-cell-text")
  47768. };
  47769. const columnCellRenderer = componentToSlot(headerCellRenderer);
  47770. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : renderSlot(slots, "default", cellProps, () => [createVNode(HeaderCell, cellProps, null)]);
  47771. /**
  47772. * Render cell container and sort indicator
  47773. */
  47774. const { sortBy, sortState, headerCellProps } = props;
  47775. let sorting, sortOrder, ariaSort;
  47776. if (sortState) {
  47777. const order = sortState[column.key];
  47778. sorting = Boolean(oppositeOrderMap[order]);
  47779. sortOrder = sorting ? order : SortOrder.ASC;
  47780. } else {
  47781. sorting = column.key === sortBy.key;
  47782. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  47783. }
  47784. if (sortOrder === SortOrder.ASC) ariaSort = "ascending";
  47785. else if (sortOrder === SortOrder.DESC) ariaSort = "descending";
  47786. else ariaSort = void 0;
  47787. const cellKls = [
  47788. ns.e("header-cell"),
  47789. tryCall(headerClass, props, ""),
  47790. column.align === Alignment.CENTER && ns.is("align-center"),
  47791. column.align === Alignment.RIGHT && ns.is("align-right"),
  47792. sortable && ns.is("sortable")
  47793. ];
  47794. return createVNode("div", mergeProps({
  47795. ...tryCall(headerCellProps, props),
  47796. onClick: column.sortable ? onColumnSorted : void 0,
  47797. ariaSort: sortable ? ariaSort : void 0,
  47798. class: cellKls,
  47799. style: cellStyle,
  47800. ["data-key"]: column.key
  47801. }, { "role": "columnheader" }), [Cell, sortable && createVNode(SortIcon, {
  47802. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  47803. "sortOrder": sortOrder,
  47804. "ariaLabel": t("el.table.sortLabel", { column: column.title || "" })
  47805. }, null)]);
  47806. };
  47807. //#endregion
  47808. //#region ../../packages/components/table-v2/src/renderers/footer.tsx
  47809. const Footer$1 = (props, { slots }) => {
  47810. return createVNode("div", {
  47811. "class": props.class,
  47812. "style": props.style
  47813. }, [slots.default?.()]);
  47814. };
  47815. Footer$1.displayName = "ElTableV2Footer";
  47816. //#endregion
  47817. //#region ../../packages/components/table-v2/src/renderers/empty.tsx
  47818. const Footer = (props, { slots }) => {
  47819. const defaultSlot = renderSlot(slots, "default", {}, () => [createVNode(ElEmpty, null, null)]);
  47820. return createVNode("div", {
  47821. "class": props.class,
  47822. "style": props.style
  47823. }, [defaultSlot]);
  47824. };
  47825. Footer.displayName = "ElTableV2Empty";
  47826. //#endregion
  47827. //#region ../../packages/components/table-v2/src/renderers/overlay.tsx
  47828. const Overlay = (props, { slots }) => {
  47829. return createVNode("div", {
  47830. "class": props.class,
  47831. "style": props.style
  47832. }, [slots.default?.()]);
  47833. };
  47834. Overlay.displayName = "ElTableV2Overlay";
  47835. //#endregion
  47836. //#region ../../packages/components/table-v2/src/table-v2.tsx
  47837. function _isSlot(s) {
  47838. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  47839. }
  47840. const TableV2 = /* @__PURE__ */ defineComponent({
  47841. name: "ElTableV2",
  47842. props: tableV2Props,
  47843. setup(props, { slots, expose }) {
  47844. const ns = useNamespace("table-v2");
  47845. const { t } = useLocale();
  47846. const { columnsStyles, fixedColumnsOnLeft, fixedColumnsOnRight, mainColumns, mainTableHeight, fixedTableHeight, leftTableWidth, rightTableWidth, data, depthMap, expandedRowKeys, hasFixedColumns, mainTableRef, leftTableRef, rightTableRef, isDynamic, isResetting, isScrolling, bodyWidth, emptyStyle, rootStyle, footerHeight, showEmpty, scrollTo, scrollToLeft, scrollToTop, scrollToRow, getRowHeight, onColumnSorted, onRowHeightChange, onRowHovered, onRowExpanded, onRowsRendered, onScroll, onVerticalScroll } = useTable(props);
  47847. expose({
  47848. scrollTo,
  47849. scrollToLeft,
  47850. scrollToTop,
  47851. scrollToRow
  47852. });
  47853. provide(TableV2InjectionKey, {
  47854. ns,
  47855. isResetting,
  47856. isScrolling
  47857. });
  47858. return () => {
  47859. const { cache, cellProps, estimatedRowHeight, expandColumnKey, fixedData, headerHeight, headerClass, headerProps, headerCellProps, sortBy, sortState, rowHeight, rowClass, rowEventHandlers, rowKey, rowProps, scrollbarAlwaysOn, indentSize, iconSize, useIsScrolling, vScrollbarSize, width } = props;
  47860. const _data = unref(data);
  47861. const mainTableProps = {
  47862. cache,
  47863. class: ns.e("main"),
  47864. columns: unref(mainColumns),
  47865. data: _data,
  47866. fixedData,
  47867. estimatedRowHeight,
  47868. bodyWidth: unref(bodyWidth),
  47869. headerHeight,
  47870. headerWidth: unref(bodyWidth),
  47871. height: unref(mainTableHeight),
  47872. mainTableRef,
  47873. rowKey,
  47874. rowHeight,
  47875. scrollbarAlwaysOn,
  47876. scrollbarStartGap: 2,
  47877. scrollbarEndGap: vScrollbarSize,
  47878. useIsScrolling,
  47879. width,
  47880. getRowHeight,
  47881. onRowsRendered,
  47882. onScroll
  47883. };
  47884. const leftColumnsWidth = unref(leftTableWidth);
  47885. const _fixedTableHeight = unref(fixedTableHeight);
  47886. const leftTableProps = {
  47887. cache,
  47888. class: ns.e("left"),
  47889. columns: unref(fixedColumnsOnLeft),
  47890. data: _data,
  47891. fixedData,
  47892. estimatedRowHeight,
  47893. leftTableRef,
  47894. rowHeight,
  47895. bodyWidth: leftColumnsWidth,
  47896. headerWidth: leftColumnsWidth,
  47897. headerHeight,
  47898. height: _fixedTableHeight,
  47899. rowKey,
  47900. scrollbarAlwaysOn,
  47901. scrollbarStartGap: 2,
  47902. scrollbarEndGap: vScrollbarSize,
  47903. useIsScrolling,
  47904. width: leftColumnsWidth,
  47905. getRowHeight,
  47906. onScroll: onVerticalScroll
  47907. };
  47908. const rightColumnsWidth = unref(rightTableWidth);
  47909. const rightTableProps = {
  47910. cache,
  47911. class: ns.e("right"),
  47912. columns: unref(fixedColumnsOnRight),
  47913. data: _data,
  47914. fixedData,
  47915. estimatedRowHeight,
  47916. rightTableRef,
  47917. rowHeight,
  47918. bodyWidth: rightColumnsWidth,
  47919. headerWidth: rightColumnsWidth,
  47920. headerHeight,
  47921. height: _fixedTableHeight,
  47922. rowKey,
  47923. scrollbarAlwaysOn,
  47924. scrollbarStartGap: 2,
  47925. scrollbarEndGap: vScrollbarSize,
  47926. width: rightColumnsWidth,
  47927. style: `${ns.cssVarName("table-scrollbar-size")}: ${vScrollbarSize}px`,
  47928. useIsScrolling,
  47929. getRowHeight,
  47930. onScroll: onVerticalScroll
  47931. };
  47932. const _columnsStyles = unref(columnsStyles);
  47933. const tableRowProps = {
  47934. ns,
  47935. depthMap: unref(depthMap),
  47936. columnsStyles: _columnsStyles,
  47937. expandColumnKey,
  47938. expandedRowKeys: unref(expandedRowKeys),
  47939. estimatedRowHeight,
  47940. hasFixedColumns: unref(hasFixedColumns),
  47941. rowProps,
  47942. rowClass,
  47943. rowKey,
  47944. rowEventHandlers,
  47945. onRowHovered,
  47946. onRowExpanded,
  47947. onRowHeightChange
  47948. };
  47949. const tableCellProps = {
  47950. cellProps,
  47951. expandColumnKey,
  47952. indentSize,
  47953. iconSize,
  47954. rowKey,
  47955. expandedRowKeys: unref(expandedRowKeys),
  47956. ns,
  47957. t
  47958. };
  47959. const tableHeaderProps = {
  47960. ns,
  47961. headerClass,
  47962. headerProps,
  47963. columnsStyles: _columnsStyles
  47964. };
  47965. const tableHeaderCellProps = {
  47966. ns,
  47967. t,
  47968. sortBy,
  47969. sortState,
  47970. headerCellProps,
  47971. onColumnSorted
  47972. };
  47973. const tableSlots = {
  47974. row: (props) => createVNode(RowRenderer, mergeProps(props, tableRowProps), {
  47975. row: slots.row,
  47976. cell: (props) => {
  47977. let _slot;
  47978. return slots.cell ? createVNode(CellRenderer, mergeProps(props, tableCellProps, { "style": _columnsStyles[props.column.key] }), _isSlot(_slot = slots.cell(props)) ? _slot : { default: () => [_slot] }) : createVNode(CellRenderer, mergeProps(props, tableCellProps, { "style": _columnsStyles[props.column.key] }), null);
  47979. }
  47980. }),
  47981. header: (props) => createVNode(HeaderRenderer, mergeProps(props, tableHeaderProps), {
  47982. header: slots.header,
  47983. cell: (props) => {
  47984. let _slot2;
  47985. return slots["header-cell"] ? createVNode(HeaderCellRenderer, mergeProps(props, tableHeaderCellProps, { "style": _columnsStyles[props.column.key] }), _isSlot(_slot2 = slots["header-cell"](props)) ? _slot2 : { default: () => [_slot2] }) : createVNode(HeaderCellRenderer, mergeProps(props, tableHeaderCellProps, { "style": _columnsStyles[props.column.key] }), null);
  47986. }
  47987. })
  47988. };
  47989. const rootKls = [
  47990. props.class,
  47991. ns.b(),
  47992. ns.e("root"),
  47993. ns.is("dynamic", unref(isDynamic))
  47994. ];
  47995. const footerProps = {
  47996. class: ns.e("footer"),
  47997. style: unref(footerHeight)
  47998. };
  47999. return createVNode("div", {
  48000. "class": rootKls,
  48001. "style": unref(rootStyle)
  48002. }, [
  48003. createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : { default: () => [tableSlots] }),
  48004. createVNode(LeftTable, leftTableProps, _isSlot(tableSlots) ? tableSlots : { default: () => [tableSlots] }),
  48005. createVNode(RightTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : { default: () => [tableSlots] }),
  48006. slots.footer && createVNode(Footer$1, footerProps, { default: slots.footer }),
  48007. unref(showEmpty) && createVNode(Footer, {
  48008. "class": ns.e("empty"),
  48009. "style": unref(emptyStyle)
  48010. }, { default: slots.empty }),
  48011. slots.overlay && createVNode(Overlay, { "class": ns.e("overlay") }, { default: slots.overlay })
  48012. ]);
  48013. };
  48014. }
  48015. });
  48016. //#endregion
  48017. //#region ../../packages/components/table-v2/src/auto-resizer.ts
  48018. const autoResizerProps = buildProps({
  48019. disableWidth: Boolean,
  48020. disableHeight: Boolean,
  48021. onResize: { type: definePropType(Function) }
  48022. });
  48023. //#endregion
  48024. //#region ../../packages/components/table-v2/src/components/auto-resizer.tsx
  48025. const AutoResizer = /* @__PURE__ */ defineComponent({
  48026. name: "ElAutoResizer",
  48027. props: autoResizerProps,
  48028. setup(props, { slots }) {
  48029. const ns = useNamespace("auto-resizer");
  48030. const { height, width, sizer } = useAutoResize(props);
  48031. const style = {
  48032. width: "100%",
  48033. height: "100%"
  48034. };
  48035. return () => {
  48036. return createVNode("div", {
  48037. "ref": sizer,
  48038. "class": ns.b(),
  48039. "style": style
  48040. }, [slots.default?.({
  48041. height: height.value,
  48042. width: width.value
  48043. })]);
  48044. };
  48045. }
  48046. });
  48047. //#endregion
  48048. //#region ../../packages/components/table-v2/index.ts
  48049. const ElTableV2 = withInstall(TableV2);
  48050. const ElAutoResizer = withInstall(AutoResizer);
  48051. //#endregion
  48052. //#region ../../packages/components/tabs/src/constants.ts
  48053. const tabsRootContextKey = Symbol("tabsRootContextKey");
  48054. //#endregion
  48055. //#region ../../packages/components/tabs/src/tab-bar.ts
  48056. /**
  48057. * @deprecated Removed after 3.0.0, Use `TabBarProps` instead.
  48058. */
  48059. const tabBarProps = buildProps({
  48060. tabs: {
  48061. type: definePropType(Array),
  48062. default: () => mutable([])
  48063. },
  48064. tabRefs: {
  48065. type: definePropType(Object),
  48066. default: () => mutable({})
  48067. }
  48068. });
  48069. //#endregion
  48070. //#region ../../packages/components/tabs/src/tab-bar.vue?vue&type=script&setup=true&lang.ts
  48071. const COMPONENT_NAME$4 = "ElTabBar";
  48072. var tab_bar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  48073. name: COMPONENT_NAME$4,
  48074. __name: "tab-bar",
  48075. props: tabBarProps,
  48076. setup(__props, { expose: __expose }) {
  48077. const props = __props;
  48078. const rootTabs = inject(tabsRootContextKey);
  48079. if (!rootTabs) throwError(COMPONENT_NAME$4, "<el-tabs><el-tab-bar /></el-tabs>");
  48080. const ns = useNamespace("tabs");
  48081. const barRef = ref();
  48082. const barStyle = ref();
  48083. /**
  48084. * when defaultValue is not set, the bar is always shown.
  48085. *
  48086. * when defaultValue is set, the bar will be hidden until style is calculated
  48087. * to avoid the bar showing in the wrong position on initial render.
  48088. */
  48089. const renderActiveBar = computed(() => isUndefined(rootTabs.props.defaultValue) || Boolean(barStyle.value?.transform));
  48090. const getBarStyle = () => {
  48091. let offset = 0;
  48092. let tabSize = 0;
  48093. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  48094. const sizeDir = sizeName === "width" ? "x" : "y";
  48095. const position = sizeDir === "x" ? "left" : "top";
  48096. props.tabs.every((tab) => {
  48097. if (isUndefined(tab.paneName)) return false;
  48098. const $el = props.tabRefs[tab.paneName];
  48099. if (!$el) return false;
  48100. if (!tab.active) return true;
  48101. offset = $el[`offset${capitalize(position)}`];
  48102. tabSize = $el[`client${capitalize(sizeName)}`];
  48103. const tabStyles = window.getComputedStyle($el);
  48104. if (sizeName === "width") {
  48105. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  48106. offset += Number.parseFloat(tabStyles.paddingLeft);
  48107. }
  48108. return false;
  48109. });
  48110. return {
  48111. [sizeName]: `${tabSize}px`,
  48112. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  48113. };
  48114. };
  48115. const update = () => barStyle.value = getBarStyle();
  48116. const tabObservers = [];
  48117. const observerTabs = () => {
  48118. tabObservers.forEach((observer) => observer.stop());
  48119. tabObservers.length = 0;
  48120. Object.values(props.tabRefs).forEach((tab) => {
  48121. tabObservers.push(useResizeObserver(tab, update));
  48122. });
  48123. };
  48124. watch(() => props.tabs, async () => {
  48125. await nextTick();
  48126. update();
  48127. observerTabs();
  48128. }, { immediate: true });
  48129. const barObserver = useResizeObserver(barRef, () => update());
  48130. onBeforeUnmount(() => {
  48131. tabObservers.forEach((observer) => observer.stop());
  48132. tabObservers.length = 0;
  48133. barObserver.stop();
  48134. });
  48135. __expose({
  48136. ref: barRef,
  48137. update
  48138. });
  48139. return (_ctx, _cache) => {
  48140. return renderActiveBar.value ? (openBlock(), createElementBlock("div", {
  48141. key: 0,
  48142. ref_key: "barRef",
  48143. ref: barRef,
  48144. class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
  48145. style: normalizeStyle(barStyle.value)
  48146. }, null, 6)) : createCommentVNode("v-if", true);
  48147. };
  48148. }
  48149. });
  48150. //#endregion
  48151. //#region ../../packages/components/tabs/src/tab-bar.vue
  48152. var tab_bar_default = tab_bar_vue_vue_type_script_setup_true_lang_default;
  48153. //#endregion
  48154. //#region ../../packages/components/tabs/src/tab-nav.tsx
  48155. const tabNavProps = buildProps({
  48156. panes: {
  48157. type: definePropType(Array),
  48158. default: () => mutable([])
  48159. },
  48160. currentName: {
  48161. type: [String, Number],
  48162. default: ""
  48163. },
  48164. editable: Boolean,
  48165. type: {
  48166. type: String,
  48167. values: [
  48168. "card",
  48169. "border-card",
  48170. ""
  48171. ],
  48172. default: ""
  48173. },
  48174. stretch: Boolean,
  48175. tabindex: {
  48176. type: [String, Number],
  48177. default: void 0
  48178. }
  48179. });
  48180. const tabNavEmits = {
  48181. tabClick: (tab, tabName, ev) => ev instanceof Event,
  48182. tabRemove: (tab, ev) => ev instanceof Event
  48183. };
  48184. const COMPONENT_NAME$3 = "ElTabNav";
  48185. const TabNav = /* @__PURE__ */ defineComponent({
  48186. name: COMPONENT_NAME$3,
  48187. props: tabNavProps,
  48188. emits: tabNavEmits,
  48189. setup(props, { expose, emit }) {
  48190. const rootTabs = inject(tabsRootContextKey);
  48191. if (!rootTabs) throwError(COMPONENT_NAME$3, `<el-tabs><tab-nav /></el-tabs>`);
  48192. const ns = useNamespace("tabs");
  48193. const visibility = useDocumentVisibility();
  48194. const focused = useWindowFocus();
  48195. const navScroll$ = ref();
  48196. const nav$ = ref();
  48197. const el$ = ref();
  48198. const tabRefsMap = ref({});
  48199. const tabBarRef = ref();
  48200. const scrollable = ref(false);
  48201. const navOffset = ref(0);
  48202. const isFocus = ref(false);
  48203. const focusable = ref(true);
  48204. const isWheelScrolling = ref(false);
  48205. const tracker = shallowRef();
  48206. const isHorizontal = computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition));
  48207. const sizeName = computed(() => isHorizontal.value ? "width" : "height");
  48208. const navStyle = computed(() => {
  48209. const dir = sizeName.value === "width" ? "X" : "Y";
  48210. return {
  48211. transition: isWheelScrolling.value ? "none" : void 0,
  48212. transform: `translate${dir}(-${navOffset.value}px)`
  48213. };
  48214. });
  48215. const { width: navContainerWidth, height: navContainerHeight } = useElementSize(navScroll$);
  48216. const { width: navWidth, height: navHeight } = useElementSize(nav$, {
  48217. width: 0,
  48218. height: 0
  48219. }, { box: "border-box" });
  48220. const navContainerSize = computed(() => isHorizontal.value ? navContainerWidth.value : navContainerHeight.value);
  48221. const navSize = computed(() => isHorizontal.value ? navWidth.value : navHeight.value);
  48222. const { onWheel } = useWheel({
  48223. atStartEdge: computed(() => navOffset.value <= 0),
  48224. atEndEdge: computed(() => navSize.value - navOffset.value <= navContainerSize.value),
  48225. layout: computed(() => isHorizontal.value ? "horizontal" : "vertical")
  48226. }, (offset) => {
  48227. navOffset.value = clamp$1(navOffset.value + offset, 0, navSize.value - navContainerSize.value);
  48228. });
  48229. const handleWheel = (event) => {
  48230. isWheelScrolling.value = true;
  48231. onWheel(event);
  48232. rAF(() => {
  48233. isWheelScrolling.value = false;
  48234. });
  48235. };
  48236. const scrollPrev = () => {
  48237. if (!navScroll$.value) return;
  48238. const containerSize = navScroll$.value.getBoundingClientRect()[sizeName.value];
  48239. const currentOffset = navOffset.value;
  48240. if (!currentOffset) return;
  48241. navOffset.value = currentOffset > containerSize ? currentOffset - containerSize : 0;
  48242. };
  48243. const scrollNext = () => {
  48244. if (!navScroll$.value || !nav$.value) return;
  48245. const navSize = nav$.value.getBoundingClientRect()[sizeName.value];
  48246. const containerSize = navScroll$.value.getBoundingClientRect()[sizeName.value];
  48247. const currentOffset = navOffset.value;
  48248. if (!isGreaterThan(navSize - currentOffset, containerSize)) return;
  48249. navOffset.value = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  48250. };
  48251. const scrollToActiveTab = async () => {
  48252. const nav = nav$.value;
  48253. if (!scrollable.value || !el$.value || !navScroll$.value || !nav) return;
  48254. await nextTick();
  48255. const activeTab = tabRefsMap.value[props.currentName];
  48256. if (!activeTab) return;
  48257. const navScroll = navScroll$.value;
  48258. const activeTabBounding = activeTab.getBoundingClientRect();
  48259. const navScrollBounding = navScroll.getBoundingClientRect();
  48260. const navScrollLeft = navScrollBounding.left + 1;
  48261. const navScrollRight = navScrollBounding.right - 1;
  48262. const navBounding = nav.getBoundingClientRect();
  48263. const maxOffset = isHorizontal.value ? navBounding.width - navScrollBounding.width : navBounding.height - navScrollBounding.height;
  48264. const currentOffset = navOffset.value;
  48265. let newOffset = currentOffset;
  48266. if (isHorizontal.value) {
  48267. if (activeTabBounding.left < navScrollLeft) newOffset = currentOffset - (navScrollLeft - activeTabBounding.left);
  48268. if (activeTabBounding.right > navScrollRight) newOffset = currentOffset + activeTabBounding.right - navScrollRight;
  48269. } else {
  48270. if (activeTabBounding.top < navScrollBounding.top) newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  48271. if (activeTabBounding.bottom > navScrollBounding.bottom) newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  48272. }
  48273. newOffset = Math.max(newOffset, 0);
  48274. navOffset.value = Math.min(newOffset, maxOffset);
  48275. };
  48276. const update = () => {
  48277. if (!nav$.value || !navScroll$.value) return;
  48278. props.stretch && tabBarRef.value?.update();
  48279. const navSize = nav$.value.getBoundingClientRect()[sizeName.value];
  48280. const containerSize = navScroll$.value.getBoundingClientRect()[sizeName.value];
  48281. const currentOffset = navOffset.value;
  48282. if (containerSize < navSize) {
  48283. scrollable.value = scrollable.value || {};
  48284. scrollable.value.prev = currentOffset;
  48285. scrollable.value.next = isGreaterThan(navSize, currentOffset + containerSize);
  48286. if (isGreaterThan(containerSize, navSize - currentOffset)) navOffset.value = navSize - containerSize;
  48287. } else {
  48288. scrollable.value = false;
  48289. if (currentOffset > 0) navOffset.value = 0;
  48290. }
  48291. };
  48292. const changeTab = (event) => {
  48293. const code = getEventCode(event);
  48294. let step = 0;
  48295. switch (code) {
  48296. case EVENT_CODE.left:
  48297. case EVENT_CODE.up:
  48298. step = -1;
  48299. break;
  48300. case EVENT_CODE.right:
  48301. case EVENT_CODE.down:
  48302. step = 1;
  48303. break;
  48304. default: return;
  48305. }
  48306. const tabList = Array.from(event.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  48307. let nextIndex = tabList.indexOf(event.target) + step;
  48308. if (nextIndex < 0) nextIndex = tabList.length - 1;
  48309. else if (nextIndex >= tabList.length) nextIndex = 0;
  48310. tabList[nextIndex].focus({ preventScroll: true });
  48311. tabList[nextIndex].click();
  48312. setFocus();
  48313. };
  48314. const setFocus = () => {
  48315. if (focusable.value) isFocus.value = true;
  48316. };
  48317. const removeFocus = () => isFocus.value = false;
  48318. const setRefs = (el, key) => {
  48319. tabRefsMap.value[key] = el;
  48320. };
  48321. const focusActiveTab = async () => {
  48322. await nextTick();
  48323. tabRefsMap.value[props.currentName]?.focus({ preventScroll: true });
  48324. };
  48325. watch(visibility, (visibility) => {
  48326. if (visibility === "hidden") focusable.value = false;
  48327. else if (visibility === "visible") setTimeout(() => focusable.value = true, 50);
  48328. });
  48329. watch(focused, (focused) => {
  48330. if (focused) setTimeout(() => focusable.value = true, 50);
  48331. else focusable.value = false;
  48332. });
  48333. useResizeObserver(el$, () => {
  48334. rAF(update);
  48335. });
  48336. onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  48337. onUpdated(() => update());
  48338. expose({
  48339. scrollToActiveTab,
  48340. removeFocus,
  48341. focusActiveTab,
  48342. tabListRef: nav$,
  48343. tabBarRef,
  48344. scheduleRender: () => triggerRef(tracker)
  48345. });
  48346. return () => {
  48347. const scrollBtn = scrollable.value ? [createVNode("span", {
  48348. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  48349. "onClick": scrollPrev
  48350. }, [createVNode(ElIcon, null, { default: () => [createVNode(arrow_left_default, null, null)] })]), createVNode("span", {
  48351. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  48352. "onClick": scrollNext
  48353. }, [createVNode(ElIcon, null, { default: () => [createVNode(arrow_right_default, null, null)] })])] : null;
  48354. const tabs = props.panes.map((pane, index) => {
  48355. const uid = pane.uid;
  48356. const disabled = pane.props.disabled;
  48357. const tabName = pane.props.name ?? pane.index ?? `${index}`;
  48358. const closable = !disabled && (pane.isClosable || pane.props.closable !== false && props.editable);
  48359. pane.index = `${index}`;
  48360. const btnClose = closable ? createVNode(ElIcon, {
  48361. "class": "is-icon-close",
  48362. "onClick": (ev) => emit("tabRemove", pane, ev)
  48363. }, { default: () => [createVNode(close_default, null, null)] }) : null;
  48364. const tabLabelContent = pane.slots.label?.() || pane.props.label;
  48365. const tabindex = !disabled && pane.active ? props.tabindex ?? rootTabs.props.tabindex : -1;
  48366. return createVNode("div", {
  48367. "ref": (el) => setRefs(el, tabName),
  48368. "class": [
  48369. ns.e("item"),
  48370. ns.is(rootTabs.props.tabPosition),
  48371. ns.is("active", pane.active),
  48372. ns.is("disabled", disabled),
  48373. ns.is("closable", closable),
  48374. ns.is("focus", isFocus.value)
  48375. ],
  48376. "id": `tab-${tabName}`,
  48377. "key": `tab-${uid}`,
  48378. "aria-controls": `pane-${tabName}`,
  48379. "role": "tab",
  48380. "aria-selected": pane.active,
  48381. "tabindex": tabindex,
  48382. "onFocus": () => setFocus(),
  48383. "onBlur": () => removeFocus(),
  48384. "onClick": (ev) => {
  48385. removeFocus();
  48386. emit("tabClick", pane, tabName, ev);
  48387. },
  48388. "onKeydown": (ev) => {
  48389. const code = getEventCode(ev);
  48390. if (closable && (code === EVENT_CODE.delete || code === EVENT_CODE.backspace)) emit("tabRemove", pane, ev);
  48391. }
  48392. }, [...[tabLabelContent, btnClose]]);
  48393. });
  48394. tracker.value;
  48395. return createVNode("div", {
  48396. "ref": el$,
  48397. "class": [
  48398. ns.e("nav-wrap"),
  48399. ns.is("scrollable", !!scrollable.value),
  48400. ns.is(rootTabs.props.tabPosition)
  48401. ]
  48402. }, [scrollBtn, createVNode("div", {
  48403. "class": ns.e("nav-scroll"),
  48404. "ref": navScroll$
  48405. }, [props.panes.length > 0 ? createVNode("div", {
  48406. "class": [
  48407. ns.e("nav"),
  48408. ns.is(rootTabs.props.tabPosition),
  48409. ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))
  48410. ],
  48411. "ref": nav$,
  48412. "style": navStyle.value,
  48413. "role": "tablist",
  48414. "onKeydown": changeTab,
  48415. "onWheel": handleWheel
  48416. }, [...[!props.type ? createVNode(tab_bar_default, {
  48417. "ref": tabBarRef,
  48418. "tabs": [...props.panes],
  48419. "tabRefs": tabRefsMap.value
  48420. }, null) : null, tabs]]) : null])]);
  48421. };
  48422. }
  48423. });
  48424. //#endregion
  48425. //#region ../../packages/components/tabs/src/tabs.tsx
  48426. const tabsProps = buildProps({
  48427. type: {
  48428. type: String,
  48429. values: [
  48430. "card",
  48431. "border-card",
  48432. ""
  48433. ],
  48434. default: ""
  48435. },
  48436. closable: Boolean,
  48437. addable: Boolean,
  48438. modelValue: { type: [String, Number] },
  48439. defaultValue: { type: [String, Number] },
  48440. editable: Boolean,
  48441. tabPosition: {
  48442. type: String,
  48443. values: [
  48444. "top",
  48445. "right",
  48446. "bottom",
  48447. "left"
  48448. ],
  48449. default: "top"
  48450. },
  48451. beforeLeave: {
  48452. type: definePropType(Function),
  48453. default: () => true
  48454. },
  48455. stretch: Boolean,
  48456. tabindex: {
  48457. type: [String, Number],
  48458. default: 0
  48459. }
  48460. });
  48461. const isPaneName = (value) => isString(value) || isNumber(value);
  48462. const tabsEmits = {
  48463. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  48464. tabClick: (pane, ev) => ev instanceof Event,
  48465. tabChange: (name) => isPaneName(name),
  48466. edit: (paneName, action) => ["remove", "add"].includes(action),
  48467. tabRemove: (name) => isPaneName(name),
  48468. tabAdd: () => true
  48469. };
  48470. const Tabs = /* @__PURE__ */ defineComponent({
  48471. name: "ElTabs",
  48472. props: tabsProps,
  48473. emits: tabsEmits,
  48474. setup(props, { emit, slots, expose }) {
  48475. const ns = useNamespace("tabs");
  48476. const isVertical = computed(() => ["left", "right"].includes(props.tabPosition));
  48477. const { children: panes, addChild: registerPane, removeChild: unregisterPane, ChildrenSorter: PanesSorter } = useOrderedChildren(getCurrentInstance(), "ElTabPane");
  48478. const nav$ = ref();
  48479. const currentName = ref((isUndefined(props.modelValue) ? props.defaultValue : props.modelValue) ?? "0");
  48480. const setCurrentName = async (value, trigger = false) => {
  48481. if (currentName.value === value || isUndefined(value)) return;
  48482. try {
  48483. let canLeave;
  48484. if (props.beforeLeave) {
  48485. const result = props.beforeLeave(value, currentName.value);
  48486. canLeave = result instanceof Promise ? await result : result;
  48487. } else canLeave = true;
  48488. if (canLeave !== false) {
  48489. const isFocusInsidePane = panes.value.find((item) => item.paneName === currentName.value)?.isFocusInsidePane();
  48490. currentName.value = value;
  48491. if (trigger) {
  48492. emit(UPDATE_MODEL_EVENT, value);
  48493. emit("tabChange", value);
  48494. }
  48495. nav$.value?.removeFocus?.();
  48496. if (isFocusInsidePane) nav$.value?.focusActiveTab();
  48497. }
  48498. } catch {}
  48499. };
  48500. const handleTabClick = (tab, tabName, event) => {
  48501. if (tab.props.disabled) return;
  48502. emit("tabClick", tab, event);
  48503. setCurrentName(tabName, true);
  48504. };
  48505. const handleTabRemove = (pane, ev) => {
  48506. if (pane.props.disabled || isUndefined(pane.props.name)) return;
  48507. ev.stopPropagation();
  48508. emit("edit", pane.props.name, "remove");
  48509. emit("tabRemove", pane.props.name);
  48510. };
  48511. const handleTabAdd = () => {
  48512. emit("edit", void 0, "add");
  48513. emit("tabAdd");
  48514. };
  48515. const handleKeydown = (event) => {
  48516. const code = getEventCode(event);
  48517. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter].includes(code)) handleTabAdd();
  48518. };
  48519. const swapChildren = (vnode) => {
  48520. const actualFirstChild = vnode.el.firstChild;
  48521. const firstChild = ["bottom", "right"].includes(props.tabPosition) ? vnode.children[0].el : vnode.children[1].el;
  48522. if (actualFirstChild !== firstChild) actualFirstChild.before(firstChild);
  48523. };
  48524. watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  48525. watch(currentName, async () => {
  48526. await nextTick();
  48527. nav$.value?.scrollToActiveTab();
  48528. });
  48529. provide(tabsRootContextKey, {
  48530. props,
  48531. currentName,
  48532. registerPane,
  48533. unregisterPane,
  48534. nav$
  48535. });
  48536. expose({
  48537. currentName,
  48538. get tabNavRef() {
  48539. return omit(nav$.value, ["scheduleRender"]);
  48540. }
  48541. });
  48542. return () => {
  48543. const addSlot = slots["add-icon"];
  48544. const newButton = props.editable || props.addable ? createVNode("div", {
  48545. "class": [ns.e("new-tab"), isVertical.value && ns.e("new-tab-vertical")],
  48546. "tabindex": props.tabindex,
  48547. "onClick": handleTabAdd,
  48548. "onKeydown": handleKeydown
  48549. }, [addSlot ? renderSlot(slots, "add-icon") : createVNode(ElIcon, { "class": ns.is("icon-plus") }, { default: () => [createVNode(plus_default, null, null)] })]) : null;
  48550. const tabNav = () => createVNode(TabNav, {
  48551. "ref": nav$,
  48552. "currentName": currentName.value,
  48553. "editable": props.editable,
  48554. "type": props.type,
  48555. "panes": panes.value,
  48556. "stretch": props.stretch,
  48557. "onTabClick": handleTabClick,
  48558. "onTabRemove": handleTabRemove
  48559. }, null);
  48560. const header = createVNode("div", { "class": [
  48561. ns.e("header"),
  48562. isVertical.value && ns.e("header-vertical"),
  48563. ns.is(props.tabPosition)
  48564. ] }, [createVNode(PanesSorter, null, {
  48565. default: tabNav,
  48566. $stable: true
  48567. }), newButton]);
  48568. const panels = createVNode("div", { "class": ns.e("content") }, [renderSlot(slots, "default")]);
  48569. return createVNode("div", {
  48570. "class": [
  48571. ns.b(),
  48572. ns.m(props.tabPosition),
  48573. {
  48574. [ns.m("card")]: props.type === "card",
  48575. [ns.m("border-card")]: props.type === "border-card"
  48576. }
  48577. ],
  48578. "onVnodeMounted": swapChildren,
  48579. "onVnodeUpdated": swapChildren
  48580. }, [panels, header]);
  48581. };
  48582. }
  48583. });
  48584. //#endregion
  48585. //#region ../../packages/components/tabs/src/tab-pane.ts
  48586. /**
  48587. * @deprecated Removed after 3.0.0, Use `TabPaneProps` instead.
  48588. */
  48589. const tabPaneProps = buildProps({
  48590. label: {
  48591. type: String,
  48592. default: ""
  48593. },
  48594. name: { type: [String, Number] },
  48595. closable: {
  48596. type: Boolean,
  48597. default: void 0
  48598. },
  48599. disabled: Boolean,
  48600. lazy: Boolean
  48601. });
  48602. //#endregion
  48603. //#region ../../packages/components/tabs/src/tab-pane.vue?vue&type=script&setup=true&lang.ts
  48604. const _hoisted_1$14 = [
  48605. "id",
  48606. "aria-hidden",
  48607. "aria-labelledby"
  48608. ];
  48609. const COMPONENT_NAME$2 = "ElTabPane";
  48610. var tab_pane_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  48611. name: COMPONENT_NAME$2,
  48612. __name: "tab-pane",
  48613. props: tabPaneProps,
  48614. setup(__props) {
  48615. const props = __props;
  48616. const instance = getCurrentInstance();
  48617. const slots = useSlots();
  48618. const tabsRoot = inject(tabsRootContextKey);
  48619. if (!tabsRoot) throwError(COMPONENT_NAME$2, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  48620. const ns = useNamespace("tab-pane");
  48621. const paneRef = ref();
  48622. const index = ref();
  48623. const isClosable = computed(() => props.closable ?? tabsRoot.props.closable);
  48624. const active = computed(() => tabsRoot.currentName.value === (props.name ?? index.value));
  48625. const loaded = ref(active.value);
  48626. const paneName = computed(() => props.name ?? index.value);
  48627. const shouldBeRender = computed(() => !props.lazy || loaded.value || active.value);
  48628. const isFocusInsidePane = () => {
  48629. return paneRef.value?.contains(document.activeElement);
  48630. };
  48631. watch(active, (val) => {
  48632. if (val) loaded.value = true;
  48633. });
  48634. const pane = reactive({
  48635. uid: instance.uid,
  48636. getVnode: () => instance.vnode,
  48637. slots,
  48638. props,
  48639. paneName,
  48640. active,
  48641. index,
  48642. isClosable,
  48643. isFocusInsidePane
  48644. });
  48645. tabsRoot.registerPane(pane);
  48646. onBeforeUnmount(() => {
  48647. tabsRoot.unregisterPane(pane);
  48648. });
  48649. onBeforeUpdate(() => {
  48650. if (slots.label) tabsRoot.nav$.value?.scheduleRender();
  48651. });
  48652. return (_ctx, _cache) => {
  48653. return shouldBeRender.value ? withDirectives((openBlock(), createElementBlock("div", {
  48654. key: 0,
  48655. id: `pane-${paneName.value}`,
  48656. ref_key: "paneRef",
  48657. ref: paneRef,
  48658. class: normalizeClass(unref(ns).b()),
  48659. role: "tabpanel",
  48660. "aria-hidden": !active.value,
  48661. "aria-labelledby": `tab-${paneName.value}`
  48662. }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$14)), [[vShow, active.value]]) : createCommentVNode("v-if", true);
  48663. };
  48664. }
  48665. });
  48666. //#endregion
  48667. //#region ../../packages/components/tabs/src/tab-pane.vue
  48668. var tab_pane_default = tab_pane_vue_vue_type_script_setup_true_lang_default;
  48669. //#endregion
  48670. //#region ../../packages/components/tabs/index.ts
  48671. const ElTabs = withInstall(Tabs, { TabPane: tab_pane_default });
  48672. const ElTabPane = withNoopInstall(tab_pane_default);
  48673. //#endregion
  48674. //#region ../../packages/components/text/src/text.ts
  48675. /**
  48676. * @deprecated Removed after 3.0.0, Use `TextProps` instead.
  48677. */
  48678. const textProps = buildProps({
  48679. type: {
  48680. type: String,
  48681. values: [
  48682. "primary",
  48683. "success",
  48684. "info",
  48685. "warning",
  48686. "danger",
  48687. ""
  48688. ],
  48689. default: ""
  48690. },
  48691. size: {
  48692. type: String,
  48693. values: componentSizes,
  48694. default: ""
  48695. },
  48696. truncated: Boolean,
  48697. lineClamp: { type: [String, Number] },
  48698. tag: {
  48699. type: String,
  48700. default: "span"
  48701. }
  48702. });
  48703. //#endregion
  48704. //#region ../../packages/components/text/src/text.vue?vue&type=script&setup=true&lang.ts
  48705. var text_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  48706. name: "ElText",
  48707. __name: "text",
  48708. props: textProps,
  48709. setup(__props) {
  48710. const props = __props;
  48711. const textRef = ref();
  48712. const textSize = useFormSize();
  48713. const ns = useNamespace("text");
  48714. const textKls = computed(() => [
  48715. ns.b(),
  48716. ns.m(props.type),
  48717. ns.m(textSize.value),
  48718. ns.is("truncated", props.truncated),
  48719. ns.is("line-clamp", !isUndefined(props.lineClamp))
  48720. ]);
  48721. const bindTitle = () => {
  48722. if (useAttrs$1().title) return;
  48723. let shouldAddTitle = false;
  48724. const text = textRef.value?.textContent || "";
  48725. if (props.truncated) {
  48726. const width = textRef.value?.offsetWidth;
  48727. const scrollWidth = textRef.value?.scrollWidth;
  48728. if (width && scrollWidth && scrollWidth > width) shouldAddTitle = true;
  48729. } else if (!isUndefined(props.lineClamp)) {
  48730. const height = textRef.value?.offsetHeight;
  48731. const scrollHeight = textRef.value?.scrollHeight;
  48732. if (height && scrollHeight && scrollHeight > height) shouldAddTitle = true;
  48733. }
  48734. if (shouldAddTitle) textRef.value?.setAttribute("title", text);
  48735. else textRef.value?.removeAttribute("title");
  48736. };
  48737. onMounted(bindTitle);
  48738. onUpdated(bindTitle);
  48739. return (_ctx, _cache) => {
  48740. return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
  48741. ref_key: "textRef",
  48742. ref: textRef,
  48743. class: normalizeClass(textKls.value),
  48744. style: normalizeStyle({ "-webkit-line-clamp": __props.lineClamp })
  48745. }, {
  48746. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  48747. _: 3
  48748. }, 8, ["class", "style"]);
  48749. };
  48750. }
  48751. });
  48752. //#endregion
  48753. //#region ../../packages/components/text/src/text.vue
  48754. var text_default = text_vue_vue_type_script_setup_true_lang_default;
  48755. //#endregion
  48756. //#region ../../packages/components/text/index.ts
  48757. const ElText = withInstall(text_default);
  48758. //#endregion
  48759. //#region ../../packages/components/time-select/src/time-select.ts
  48760. const DEFAULT_STEP = "00:30";
  48761. /**
  48762. * @deprecated Removed after 3.0.0, Use `TimeSelectProps` instead.
  48763. */
  48764. const timeSelectProps = buildProps({
  48765. format: {
  48766. type: String,
  48767. default: "HH:mm"
  48768. },
  48769. modelValue: { type: definePropType(String) },
  48770. disabled: {
  48771. type: Boolean,
  48772. default: void 0
  48773. },
  48774. editable: {
  48775. type: Boolean,
  48776. default: true
  48777. },
  48778. effect: {
  48779. type: definePropType(String),
  48780. default: "light"
  48781. },
  48782. clearable: {
  48783. type: Boolean,
  48784. default: true
  48785. },
  48786. size: useSizeProp,
  48787. placeholder: String,
  48788. start: {
  48789. type: String,
  48790. default: "09:00"
  48791. },
  48792. end: {
  48793. type: String,
  48794. default: "18:00"
  48795. },
  48796. step: {
  48797. type: String,
  48798. default: DEFAULT_STEP
  48799. },
  48800. minTime: { type: definePropType(String) },
  48801. maxTime: { type: definePropType(String) },
  48802. includeEndTime: Boolean,
  48803. name: String,
  48804. prefixIcon: {
  48805. type: definePropType([String, Object]),
  48806. default: () => clock_default
  48807. },
  48808. clearIcon: {
  48809. type: definePropType([String, Object]),
  48810. default: () => circle_close_default
  48811. },
  48812. popperClass: {
  48813. type: String,
  48814. default: ""
  48815. },
  48816. popperStyle: { type: definePropType([String, Object]) },
  48817. ...useEmptyValuesProps
  48818. });
  48819. //#endregion
  48820. //#region ../../packages/components/time-select/src/utils.ts
  48821. const parseTime = (time) => {
  48822. const values = (time || "").split(":");
  48823. if (values.length >= 2) {
  48824. let hours = Number.parseInt(values[0], 10);
  48825. const minutes = Number.parseInt(values[1], 10);
  48826. const timeUpper = time.toUpperCase();
  48827. if (timeUpper.includes("AM") && hours === 12) hours = 0;
  48828. else if (timeUpper.includes("PM") && hours !== 12) hours += 12;
  48829. return {
  48830. hours,
  48831. minutes
  48832. };
  48833. }
  48834. return null;
  48835. };
  48836. const compareTime = (time1, time2) => {
  48837. const value1 = parseTime(time1);
  48838. if (!value1) return -1;
  48839. const value2 = parseTime(time2);
  48840. if (!value2) return -1;
  48841. const minutes1 = value1.minutes + value1.hours * 60;
  48842. const minutes2 = value2.minutes + value2.hours * 60;
  48843. if (minutes1 === minutes2) return 0;
  48844. return minutes1 > minutes2 ? 1 : -1;
  48845. };
  48846. const padTime = (time) => {
  48847. return `${time}`.padStart(2, "0");
  48848. };
  48849. const formatTime = (time) => {
  48850. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  48851. };
  48852. const nextTime = (time, step) => {
  48853. const timeValue = parseTime(time);
  48854. if (!timeValue) return "";
  48855. const stepValue = parseTime(step);
  48856. if (!stepValue) return "";
  48857. const next = {
  48858. hours: timeValue.hours,
  48859. minutes: timeValue.minutes
  48860. };
  48861. next.minutes += stepValue.minutes;
  48862. next.hours += stepValue.hours;
  48863. next.hours += Math.floor(next.minutes / 60);
  48864. next.minutes = next.minutes % 60;
  48865. return formatTime(next);
  48866. };
  48867. //#endregion
  48868. //#region ../../packages/components/time-select/src/time-select.vue?vue&type=script&setup=true&lang.ts
  48869. var time_select_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  48870. name: "ElTimeSelect",
  48871. __name: "time-select",
  48872. props: timeSelectProps,
  48873. emits: [
  48874. CHANGE_EVENT,
  48875. "blur",
  48876. "focus",
  48877. "clear",
  48878. UPDATE_MODEL_EVENT
  48879. ],
  48880. setup(__props, { expose: __expose }) {
  48881. import_dayjs_min.default.extend(import_customParseFormat.default);
  48882. const { Option: ElOption } = ElSelect;
  48883. const props = __props;
  48884. const nsInput = useNamespace("input");
  48885. const select = ref();
  48886. const _disabled = useFormDisabled();
  48887. const { lang } = useLocale();
  48888. const value = computed(() => props.modelValue);
  48889. const start = computed(() => {
  48890. const time = parseTime(props.start);
  48891. return time ? formatTime(time) : null;
  48892. });
  48893. const end = computed(() => {
  48894. const time = parseTime(props.end);
  48895. return time ? formatTime(time) : null;
  48896. });
  48897. const minTime = computed(() => {
  48898. const time = parseTime(props.minTime || "");
  48899. return time ? formatTime(time) : null;
  48900. });
  48901. const maxTime = computed(() => {
  48902. const time = parseTime(props.maxTime || "");
  48903. return time ? formatTime(time) : null;
  48904. });
  48905. const step = computed(() => {
  48906. const time = parseTime(props.step);
  48907. const isInvalidStep = !time || time.hours < 0 || time.minutes < 0 || Number.isNaN(time.hours) || Number.isNaN(time.minutes) || time.hours === 0 && time.minutes === 0;
  48908. if (isInvalidStep) /* @__PURE__ */ debugWarn("ElTimeSelect", `invalid step, fallback to default step (${DEFAULT_STEP}).`);
  48909. return !isInvalidStep ? formatTime(time) : DEFAULT_STEP;
  48910. });
  48911. const items = computed(() => {
  48912. const result = [];
  48913. const push = (formattedValue, rawValue) => {
  48914. result.push({
  48915. value: formattedValue,
  48916. rawValue,
  48917. disabled: compareTime(rawValue, minTime.value || "-1:-1") <= 0 || compareTime(rawValue, maxTime.value || "100:100") >= 0
  48918. });
  48919. };
  48920. if (props.start && props.end && props.step) {
  48921. let current = start.value;
  48922. let currentTime;
  48923. while (current && end.value && compareTime(current, end.value) <= 0) {
  48924. currentTime = (0, import_dayjs_min.default)(current, "HH:mm").locale(lang.value).format(props.format);
  48925. push(currentTime, current);
  48926. current = nextTime(current, step.value);
  48927. }
  48928. if (props.includeEndTime && end.value && result[result.length - 1]?.rawValue !== end.value) push((0, import_dayjs_min.default)(end.value, "HH:mm").locale(lang.value).format(props.format), end.value);
  48929. }
  48930. return result;
  48931. });
  48932. const blur = () => {
  48933. select.value?.blur?.();
  48934. };
  48935. const focus = () => {
  48936. select.value?.focus?.();
  48937. };
  48938. __expose({
  48939. blur,
  48940. focus
  48941. });
  48942. return (_ctx, _cache) => {
  48943. return openBlock(), createBlock(unref(ElSelect), {
  48944. ref_key: "select",
  48945. ref: select,
  48946. name: __props.name,
  48947. "model-value": value.value,
  48948. disabled: unref(_disabled),
  48949. clearable: __props.clearable,
  48950. "clear-icon": __props.clearIcon,
  48951. size: __props.size,
  48952. effect: __props.effect,
  48953. placeholder: __props.placeholder,
  48954. "default-first-option": "",
  48955. filterable: __props.editable,
  48956. "empty-values": __props.emptyValues,
  48957. "value-on-clear": __props.valueOnClear,
  48958. "popper-class": __props.popperClass,
  48959. "popper-style": __props.popperStyle,
  48960. "onUpdate:modelValue": _cache[0] || (_cache[0] = (event) => _ctx.$emit(unref(UPDATE_MODEL_EVENT), event)),
  48961. onChange: _cache[1] || (_cache[1] = (event) => _ctx.$emit(unref(CHANGE_EVENT), event)),
  48962. onBlur: _cache[2] || (_cache[2] = (event) => _ctx.$emit("blur", event)),
  48963. onFocus: _cache[3] || (_cache[3] = (event) => _ctx.$emit("focus", event)),
  48964. onClear: _cache[4] || (_cache[4] = () => _ctx.$emit("clear"))
  48965. }, {
  48966. prefix: withCtx(() => [__props.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  48967. key: 0,
  48968. class: normalizeClass(unref(nsInput).e("prefix-icon"))
  48969. }, {
  48970. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.prefixIcon)))]),
  48971. _: 1
  48972. }, 8, ["class"])) : createCommentVNode("v-if", true)]),
  48973. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item) => {
  48974. return openBlock(), createBlock(unref(ElOption), {
  48975. key: item.value,
  48976. label: item.value,
  48977. value: item.value,
  48978. disabled: item.disabled
  48979. }, null, 8, [
  48980. "label",
  48981. "value",
  48982. "disabled"
  48983. ]);
  48984. }), 128))]),
  48985. _: 1
  48986. }, 8, [
  48987. "name",
  48988. "model-value",
  48989. "disabled",
  48990. "clearable",
  48991. "clear-icon",
  48992. "size",
  48993. "effect",
  48994. "placeholder",
  48995. "filterable",
  48996. "empty-values",
  48997. "value-on-clear",
  48998. "popper-class",
  48999. "popper-style"
  49000. ]);
  49001. };
  49002. }
  49003. });
  49004. //#endregion
  49005. //#region ../../packages/components/time-select/src/time-select.vue
  49006. var time_select_default = time_select_vue_vue_type_script_setup_true_lang_default;
  49007. //#endregion
  49008. //#region ../../packages/components/time-select/index.ts
  49009. const ElTimeSelect = withInstall(time_select_default);
  49010. //#endregion
  49011. //#region ../../packages/components/timeline/src/tokens.ts
  49012. const TIMELINE_INJECTION_KEY = "timeline";
  49013. //#endregion
  49014. //#region ../../packages/components/timeline/src/timeline.ts
  49015. const timelineProps = buildProps({
  49016. mode: {
  49017. type: String,
  49018. values: [
  49019. "start",
  49020. "alternate",
  49021. "alternate-reverse",
  49022. "end"
  49023. ],
  49024. default: "start"
  49025. },
  49026. reverse: Boolean
  49027. });
  49028. const Timeline = defineComponent({
  49029. name: "ElTimeline",
  49030. props: timelineProps,
  49031. setup(props, { slots }) {
  49032. const ns = useNamespace("timeline");
  49033. provide(TIMELINE_INJECTION_KEY, {
  49034. props,
  49035. slots
  49036. });
  49037. const timelineKls = computed(() => [ns.b(), ns.is(props.mode)]);
  49038. return () => {
  49039. const children = flattedChildren(slots.default?.() ?? []);
  49040. return h("ul", { class: timelineKls.value }, props.reverse ? children.reverse() : children);
  49041. };
  49042. }
  49043. });
  49044. //#endregion
  49045. //#region ../../packages/components/timeline/src/timeline-item.ts
  49046. /**
  49047. * @deprecated Removed after 3.0.0, Use `TimelineItemProps` instead.
  49048. */
  49049. const timelineItemProps = buildProps({
  49050. timestamp: {
  49051. type: String,
  49052. default: ""
  49053. },
  49054. hideTimestamp: Boolean,
  49055. center: Boolean,
  49056. placement: {
  49057. type: String,
  49058. values: ["top", "bottom"],
  49059. default: "bottom"
  49060. },
  49061. type: {
  49062. type: String,
  49063. values: [
  49064. "primary",
  49065. "success",
  49066. "warning",
  49067. "danger",
  49068. "info"
  49069. ],
  49070. default: ""
  49071. },
  49072. color: {
  49073. type: String,
  49074. default: ""
  49075. },
  49076. size: {
  49077. type: String,
  49078. values: ["normal", "large"],
  49079. default: "normal"
  49080. },
  49081. icon: { type: iconPropType },
  49082. hollow: Boolean
  49083. });
  49084. //#endregion
  49085. //#region ../../packages/components/timeline/src/timeline-item.vue?vue&type=script&setup=true&lang.ts
  49086. var timeline_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  49087. name: "ElTimelineItem",
  49088. __name: "timeline-item",
  49089. props: timelineItemProps,
  49090. setup(__props) {
  49091. const props = __props;
  49092. const { props: timelineProps } = inject(TIMELINE_INJECTION_KEY);
  49093. const ns = useNamespace("timeline-item");
  49094. const defaultNodeKls = computed(() => [
  49095. ns.e("node"),
  49096. ns.em("node", props.size || ""),
  49097. ns.em("node", props.type || ""),
  49098. ns.is("hollow", props.hollow)
  49099. ]);
  49100. const timelineItemKls = computed(() => [
  49101. ns.b(),
  49102. { [ns.e("center")]: props.center },
  49103. ns.is(timelineProps.mode)
  49104. ]);
  49105. return (_ctx, _cache) => {
  49106. return openBlock(), createElementBlock("li", { class: normalizeClass(timelineItemKls.value) }, [
  49107. createElementVNode("div", { class: normalizeClass(unref(ns).e("tail")) }, null, 2),
  49108. !_ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  49109. key: 0,
  49110. class: normalizeClass(defaultNodeKls.value),
  49111. style: normalizeStyle({ backgroundColor: __props.color })
  49112. }, [__props.icon ? (openBlock(), createBlock(unref(ElIcon), {
  49113. key: 0,
  49114. class: normalizeClass(unref(ns).e("icon"))
  49115. }, {
  49116. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  49117. _: 1
  49118. }, 8, ["class"])) : createCommentVNode("v-if", true)], 6)) : createCommentVNode("v-if", true),
  49119. _ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  49120. key: 1,
  49121. class: normalizeClass(unref(ns).e("dot"))
  49122. }, [renderSlot(_ctx.$slots, "dot")], 2)) : createCommentVNode("v-if", true),
  49123. createElementVNode("div", { class: normalizeClass(unref(ns).e("wrapper")) }, [
  49124. !__props.hideTimestamp && __props.placement === "top" ? (openBlock(), createElementBlock("div", {
  49125. key: 0,
  49126. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("top")])
  49127. }, toDisplayString(__props.timestamp), 3)) : createCommentVNode("v-if", true),
  49128. createElementVNode("div", { class: normalizeClass(unref(ns).e("content")) }, [renderSlot(_ctx.$slots, "default")], 2),
  49129. !__props.hideTimestamp && __props.placement === "bottom" ? (openBlock(), createElementBlock("div", {
  49130. key: 1,
  49131. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("bottom")])
  49132. }, toDisplayString(__props.timestamp), 3)) : createCommentVNode("v-if", true)
  49133. ], 2)
  49134. ], 2);
  49135. };
  49136. }
  49137. });
  49138. //#endregion
  49139. //#region ../../packages/components/timeline/src/timeline-item.vue
  49140. var timeline_item_default = timeline_item_vue_vue_type_script_setup_true_lang_default;
  49141. //#endregion
  49142. //#region ../../packages/components/timeline/index.ts
  49143. const ElTimeline = withInstall(Timeline, { TimelineItem: timeline_item_default });
  49144. const ElTimelineItem = withNoopInstall(timeline_item_default);
  49145. //#endregion
  49146. //#region ../../packages/components/transfer/src/transfer.ts
  49147. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  49148. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  49149. /**
  49150. * @deprecated Removed after 3.0.0, Use `TransferProps` instead.
  49151. */
  49152. const transferProps = buildProps({
  49153. data: {
  49154. type: definePropType(Array),
  49155. default: () => []
  49156. },
  49157. titles: {
  49158. type: definePropType(Array),
  49159. default: () => []
  49160. },
  49161. buttonTexts: {
  49162. type: definePropType(Array),
  49163. default: () => []
  49164. },
  49165. filterPlaceholder: String,
  49166. filterMethod: { type: definePropType(Function) },
  49167. leftDefaultChecked: {
  49168. type: definePropType(Array),
  49169. default: () => []
  49170. },
  49171. rightDefaultChecked: {
  49172. type: definePropType(Array),
  49173. default: () => []
  49174. },
  49175. renderContent: { type: definePropType(Function) },
  49176. modelValue: {
  49177. type: definePropType(Array),
  49178. default: () => []
  49179. },
  49180. format: {
  49181. type: definePropType(Object),
  49182. default: () => ({})
  49183. },
  49184. filterable: Boolean,
  49185. props: {
  49186. type: definePropType(Object),
  49187. default: () => mutable({
  49188. label: "label",
  49189. key: "key",
  49190. disabled: "disabled"
  49191. })
  49192. },
  49193. targetOrder: {
  49194. type: String,
  49195. values: [
  49196. "original",
  49197. "push",
  49198. "unshift"
  49199. ],
  49200. default: "original"
  49201. },
  49202. validateEvent: {
  49203. type: Boolean,
  49204. default: true
  49205. }
  49206. });
  49207. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys);
  49208. const transferEmits = {
  49209. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction),
  49210. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value),
  49211. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  49212. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  49213. };
  49214. //#endregion
  49215. //#region ../../packages/components/transfer/src/transfer-panel.ts
  49216. const CHECKED_CHANGE_EVENT = "checked-change";
  49217. /**
  49218. * @deprecated Removed after 3.0.0, Use `TransferPanelProps` instead.
  49219. */
  49220. const transferPanelProps = buildProps({
  49221. data: transferProps.data,
  49222. optionRender: { type: definePropType(Function) },
  49223. placeholder: String,
  49224. title: String,
  49225. filterable: Boolean,
  49226. format: transferProps.format,
  49227. filterMethod: transferProps.filterMethod,
  49228. defaultChecked: transferProps.leftDefaultChecked,
  49229. props: transferProps.props
  49230. });
  49231. const transferPanelEmits = { [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn };
  49232. //#endregion
  49233. //#region ../../packages/components/transfer/src/composables/use-props-alias.ts
  49234. const usePropsAlias = (props) => {
  49235. const initProps = {
  49236. label: "label",
  49237. key: "key",
  49238. disabled: "disabled"
  49239. };
  49240. return computed(() => ({
  49241. ...initProps,
  49242. ...props.props
  49243. }));
  49244. };
  49245. //#endregion
  49246. //#region ../../packages/components/transfer/src/composables/use-check.ts
  49247. const useCheck$1 = (props, panelState, emit) => {
  49248. const propsAlias = usePropsAlias(props);
  49249. const filteredData = computed(() => {
  49250. return props.data.filter((item) => {
  49251. if (isFunction$1(props.filterMethod)) return props.filterMethod(panelState.query, item);
  49252. else return String(item[propsAlias.value.label] || item[propsAlias.value.key]).toLowerCase().includes(panelState.query.toLowerCase());
  49253. });
  49254. });
  49255. const checkableData = computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  49256. const checkedSummary = computed(() => {
  49257. const checkedLength = panelState.checked.length;
  49258. const dataLength = props.data.length;
  49259. const { noChecked, hasChecked } = props.format;
  49260. if (noChecked && hasChecked) return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  49261. else return `${checkedLength}/${dataLength}`;
  49262. });
  49263. const isIndeterminate = computed(() => {
  49264. const checkedLength = panelState.checked.length;
  49265. return checkedLength > 0 && checkedLength < checkableData.value.length;
  49266. });
  49267. const updateAllChecked = () => {
  49268. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  49269. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  49270. };
  49271. const handleAllCheckedChange = (value) => {
  49272. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  49273. };
  49274. watch(() => panelState.checked, (val, oldVal) => {
  49275. updateAllChecked();
  49276. if (panelState.checkChangeByUser) emit(CHECKED_CHANGE_EVENT, val, val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v)));
  49277. else {
  49278. emit(CHECKED_CHANGE_EVENT, val);
  49279. panelState.checkChangeByUser = true;
  49280. }
  49281. });
  49282. watch(checkableData, () => {
  49283. updateAllChecked();
  49284. });
  49285. watch(() => props.data, () => {
  49286. const checked = [];
  49287. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  49288. panelState.checked.forEach((item) => {
  49289. if (filteredDataKeys.includes(item)) checked.push(item);
  49290. });
  49291. panelState.checkChangeByUser = false;
  49292. panelState.checked = checked;
  49293. });
  49294. watch(() => props.defaultChecked, (val, oldVal) => {
  49295. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item))) return;
  49296. const checked = [];
  49297. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  49298. val.forEach((item) => {
  49299. if (checkableDataKeys.includes(item)) checked.push(item);
  49300. });
  49301. panelState.checkChangeByUser = false;
  49302. panelState.checked = checked;
  49303. }, { immediate: true });
  49304. return {
  49305. filteredData,
  49306. checkableData,
  49307. checkedSummary,
  49308. isIndeterminate,
  49309. updateAllChecked,
  49310. handleAllCheckedChange
  49311. };
  49312. };
  49313. //#endregion
  49314. //#region ../../packages/components/transfer/src/composables/use-checked-change.ts
  49315. const useCheckedChange = (checkedState, emit) => {
  49316. const onSourceCheckedChange = (val, movedKeys) => {
  49317. checkedState.leftChecked = val;
  49318. if (!movedKeys) return;
  49319. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  49320. };
  49321. const onTargetCheckedChange = (val, movedKeys) => {
  49322. checkedState.rightChecked = val;
  49323. if (!movedKeys) return;
  49324. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  49325. };
  49326. return {
  49327. onSourceCheckedChange,
  49328. onTargetCheckedChange
  49329. };
  49330. };
  49331. //#endregion
  49332. //#region ../../packages/components/transfer/src/composables/use-computed-data.ts
  49333. const useComputedData = (props) => {
  49334. const propsAlias = usePropsAlias(props);
  49335. const dataObj = computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  49336. return {
  49337. sourceData: computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key]))),
  49338. targetData: computed(() => {
  49339. if (props.targetOrder === "original") return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  49340. else return props.modelValue.reduce((arr, cur) => {
  49341. const val = dataObj.value[cur];
  49342. if (val) arr.push(val);
  49343. return arr;
  49344. }, []);
  49345. })
  49346. };
  49347. };
  49348. //#endregion
  49349. //#region ../../packages/components/transfer/src/composables/use-move.ts
  49350. const useMove = (props, checkedState, emit) => {
  49351. const propsAlias = usePropsAlias(props);
  49352. const _emit = (value, direction, movedKeys) => {
  49353. emit(UPDATE_MODEL_EVENT, value);
  49354. emit(CHANGE_EVENT, value, direction, movedKeys);
  49355. };
  49356. const addToLeft = () => {
  49357. const currentValue = props.modelValue.slice();
  49358. checkedState.rightChecked.forEach((item) => {
  49359. const index = currentValue.indexOf(item);
  49360. if (index > -1) currentValue.splice(index, 1);
  49361. });
  49362. _emit(currentValue, "left", checkedState.rightChecked);
  49363. };
  49364. const addToRight = () => {
  49365. let currentValue = props.modelValue.slice();
  49366. const itemsToBeMoved = props.data.filter((item) => {
  49367. const itemKey = item[propsAlias.value.key];
  49368. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  49369. }).map((item) => item[propsAlias.value.key]);
  49370. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  49371. if (props.targetOrder === "original") currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  49372. _emit(currentValue, "right", checkedState.leftChecked);
  49373. };
  49374. return {
  49375. addToLeft,
  49376. addToRight
  49377. };
  49378. };
  49379. //#endregion
  49380. //#region ../../packages/components/transfer/src/transfer-panel.vue?vue&type=script&setup=true&lang.ts
  49381. var transfer_panel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  49382. name: "ElTransferPanel",
  49383. __name: "transfer-panel",
  49384. props: transferPanelProps,
  49385. emits: transferPanelEmits,
  49386. setup(__props, { expose: __expose, emit: __emit }) {
  49387. const props = __props;
  49388. const emit = __emit;
  49389. const slots = useSlots();
  49390. const OptionContent = ({ option }) => option;
  49391. const { t } = useLocale();
  49392. const ns = useNamespace("transfer");
  49393. const panelState = reactive({
  49394. checked: [],
  49395. allChecked: false,
  49396. query: "",
  49397. checkChangeByUser: true
  49398. });
  49399. const propsAlias = usePropsAlias(props);
  49400. const { filteredData, checkedSummary, isIndeterminate, handleAllCheckedChange } = useCheck$1(props, panelState, emit);
  49401. const hasNoMatch = computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  49402. const hasFooter = computed(() => !isEmpty(slots.default()[0].children));
  49403. const { checked, allChecked, query } = toRefs(panelState);
  49404. __expose({ query });
  49405. return (_ctx, _cache) => {
  49406. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b("panel")) }, [
  49407. createElementVNode("p", { class: normalizeClass(unref(ns).be("panel", "header")) }, [createVNode(unref(ElCheckbox), {
  49408. modelValue: unref(allChecked),
  49409. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(allChecked) ? allChecked.value = $event : null),
  49410. indeterminate: unref(isIndeterminate),
  49411. "validate-event": false,
  49412. onChange: unref(handleAllCheckedChange)
  49413. }, {
  49414. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(unref(ns).be("panel", "header-title")) }, toDisplayString(__props.title), 3), createElementVNode("span", { class: normalizeClass(unref(ns).be("panel", "header-count")) }, toDisplayString(unref(checkedSummary)), 3)]),
  49415. _: 1
  49416. }, 8, [
  49417. "modelValue",
  49418. "indeterminate",
  49419. "onChange"
  49420. ])], 2),
  49421. createElementVNode("div", { class: normalizeClass([unref(ns).be("panel", "body"), unref(ns).is("with-footer", hasFooter.value)]) }, [
  49422. __props.filterable ? (openBlock(), createBlock(unref(ElInput), {
  49423. key: 0,
  49424. modelValue: unref(query),
  49425. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(query) ? query.value = $event : null),
  49426. class: normalizeClass(unref(ns).be("panel", "filter")),
  49427. size: "default",
  49428. placeholder: __props.placeholder,
  49429. "prefix-icon": unref(search_default),
  49430. clearable: "",
  49431. "validate-event": false
  49432. }, null, 8, [
  49433. "modelValue",
  49434. "class",
  49435. "placeholder",
  49436. "prefix-icon"
  49437. ])) : createCommentVNode("v-if", true),
  49438. withDirectives(createVNode(unref(ElCheckboxGroup), {
  49439. modelValue: unref(checked),
  49440. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(checked) ? checked.value = $event : null),
  49441. "validate-event": false,
  49442. class: normalizeClass([unref(ns).is("filterable", __props.filterable), unref(ns).be("panel", "list")])
  49443. }, {
  49444. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(filteredData), (item) => {
  49445. return openBlock(), createBlock(unref(ElCheckbox), {
  49446. key: item[unref(propsAlias).key],
  49447. class: normalizeClass(unref(ns).be("panel", "item")),
  49448. value: item[unref(propsAlias).key],
  49449. disabled: item[unref(propsAlias).disabled],
  49450. "validate-event": false
  49451. }, {
  49452. default: withCtx(() => [createVNode(OptionContent, { option: __props.optionRender?.(item) }, null, 8, ["option"])]),
  49453. _: 2
  49454. }, 1032, [
  49455. "class",
  49456. "value",
  49457. "disabled"
  49458. ]);
  49459. }), 128))]),
  49460. _: 1
  49461. }, 8, ["modelValue", "class"]), [[vShow, !hasNoMatch.value && !unref(isEmpty)(__props.data)]]),
  49462. withDirectives(createElementVNode("div", { class: normalizeClass(unref(ns).be("panel", "empty")) }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(hasNoMatch.value ? unref(t)("el.transfer.noMatch") : unref(t)("el.transfer.noData")), 1)])], 2), [[vShow, hasNoMatch.value || unref(isEmpty)(__props.data)]])
  49463. ], 2),
  49464. hasFooter.value ? (openBlock(), createElementBlock("p", {
  49465. key: 0,
  49466. class: normalizeClass(unref(ns).be("panel", "footer"))
  49467. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true)
  49468. ], 2);
  49469. };
  49470. }
  49471. });
  49472. //#endregion
  49473. //#region ../../packages/components/transfer/src/transfer-panel.vue
  49474. var transfer_panel_default = transfer_panel_vue_vue_type_script_setup_true_lang_default;
  49475. //#endregion
  49476. //#region ../../packages/components/transfer/src/transfer.vue?vue&type=script&setup=true&lang.ts
  49477. const _hoisted_1$13 = { key: 0 };
  49478. const _hoisted_2$8 = { key: 0 };
  49479. var transfer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  49480. name: "ElTransfer",
  49481. __name: "transfer",
  49482. props: transferProps,
  49483. emits: transferEmits,
  49484. setup(__props, { expose: __expose, emit: __emit }) {
  49485. const props = __props;
  49486. const emit = __emit;
  49487. const slots = useSlots();
  49488. const { t } = useLocale();
  49489. const ns = useNamespace("transfer");
  49490. const { formItem } = useFormItem();
  49491. const checkedState = reactive({
  49492. leftChecked: [],
  49493. rightChecked: []
  49494. });
  49495. const propsAlias = usePropsAlias(props);
  49496. const { sourceData, targetData } = useComputedData(props);
  49497. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  49498. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  49499. const leftPanel = ref();
  49500. const rightPanel = ref();
  49501. const clearQuery = (which) => {
  49502. switch (which) {
  49503. case "left":
  49504. leftPanel.value.query = "";
  49505. break;
  49506. case "right":
  49507. rightPanel.value.query = "";
  49508. break;
  49509. }
  49510. };
  49511. const hasButtonTexts = computed(() => props.buttonTexts.length === 2);
  49512. const leftPanelTitle = computed(() => props.titles[0] || t("el.transfer.titles.0"));
  49513. const rightPanelTitle = computed(() => props.titles[1] || t("el.transfer.titles.1"));
  49514. const panelFilterPlaceholder = computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  49515. watch(() => props.modelValue, () => {
  49516. if (props.validateEvent) formItem?.validate?.("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  49517. });
  49518. const optionRender = computed(() => (option) => {
  49519. if (props.renderContent) return props.renderContent(h, option);
  49520. const defaultSlotVNodes = (slots.default?.({ option }) || []).filter((node) => node.type !== Comment);
  49521. if (defaultSlotVNodes.length) return defaultSlotVNodes;
  49522. return h("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  49523. });
  49524. __expose({
  49525. clearQuery,
  49526. leftPanel,
  49527. rightPanel
  49528. });
  49529. return (_ctx, _cache) => {
  49530. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [
  49531. createVNode(transfer_panel_default, {
  49532. ref_key: "leftPanel",
  49533. ref: leftPanel,
  49534. data: unref(sourceData),
  49535. "option-render": optionRender.value,
  49536. placeholder: panelFilterPlaceholder.value,
  49537. title: leftPanelTitle.value,
  49538. filterable: __props.filterable,
  49539. format: __props.format,
  49540. "filter-method": __props.filterMethod,
  49541. "default-checked": __props.leftDefaultChecked,
  49542. props: props.props,
  49543. onCheckedChange: unref(onSourceCheckedChange)
  49544. }, {
  49545. empty: withCtx(() => [renderSlot(_ctx.$slots, "left-empty")]),
  49546. default: withCtx(() => [renderSlot(_ctx.$slots, "left-footer")]),
  49547. _: 3
  49548. }, 8, [
  49549. "data",
  49550. "option-render",
  49551. "placeholder",
  49552. "title",
  49553. "filterable",
  49554. "format",
  49555. "filter-method",
  49556. "default-checked",
  49557. "props",
  49558. "onCheckedChange"
  49559. ]),
  49560. createElementVNode("div", { class: normalizeClass(unref(ns).e("buttons")) }, [createVNode(unref(ElButton), {
  49561. type: "primary",
  49562. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", hasButtonTexts.value)]),
  49563. disabled: unref(isEmpty)(checkedState.rightChecked),
  49564. onClick: unref(addToLeft)
  49565. }, {
  49566. default: withCtx(() => [createVNode(unref(ElIcon), null, {
  49567. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  49568. _: 1
  49569. }), !unref(isUndefined)(__props.buttonTexts[0]) ? (openBlock(), createElementBlock("span", _hoisted_1$13, toDisplayString(__props.buttonTexts[0]), 1)) : createCommentVNode("v-if", true)]),
  49570. _: 1
  49571. }, 8, [
  49572. "class",
  49573. "disabled",
  49574. "onClick"
  49575. ]), createVNode(unref(ElButton), {
  49576. type: "primary",
  49577. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", hasButtonTexts.value)]),
  49578. disabled: unref(isEmpty)(checkedState.leftChecked),
  49579. onClick: unref(addToRight)
  49580. }, {
  49581. default: withCtx(() => [!unref(isUndefined)(__props.buttonTexts[1]) ? (openBlock(), createElementBlock("span", _hoisted_2$8, toDisplayString(__props.buttonTexts[1]), 1)) : createCommentVNode("v-if", true), createVNode(unref(ElIcon), null, {
  49582. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  49583. _: 1
  49584. })]),
  49585. _: 1
  49586. }, 8, [
  49587. "class",
  49588. "disabled",
  49589. "onClick"
  49590. ])], 2),
  49591. createVNode(transfer_panel_default, {
  49592. ref_key: "rightPanel",
  49593. ref: rightPanel,
  49594. data: unref(targetData),
  49595. "option-render": optionRender.value,
  49596. placeholder: panelFilterPlaceholder.value,
  49597. filterable: __props.filterable,
  49598. format: __props.format,
  49599. "filter-method": __props.filterMethod,
  49600. title: rightPanelTitle.value,
  49601. "default-checked": __props.rightDefaultChecked,
  49602. props: props.props,
  49603. onCheckedChange: unref(onTargetCheckedChange)
  49604. }, {
  49605. empty: withCtx(() => [renderSlot(_ctx.$slots, "right-empty")]),
  49606. default: withCtx(() => [renderSlot(_ctx.$slots, "right-footer")]),
  49607. _: 3
  49608. }, 8, [
  49609. "data",
  49610. "option-render",
  49611. "placeholder",
  49612. "filterable",
  49613. "format",
  49614. "filter-method",
  49615. "title",
  49616. "default-checked",
  49617. "props",
  49618. "onCheckedChange"
  49619. ])
  49620. ], 2);
  49621. };
  49622. }
  49623. });
  49624. //#endregion
  49625. //#region ../../packages/components/transfer/src/transfer.vue
  49626. var transfer_default = transfer_vue_vue_type_script_setup_true_lang_default;
  49627. //#endregion
  49628. //#region ../../packages/components/transfer/index.ts
  49629. const ElTransfer = withInstall(transfer_default);
  49630. //#endregion
  49631. //#region ../../packages/components/tree/src/model/util.ts
  49632. const NODE_KEY = "$treeNodeId";
  49633. const markNodeData = function(node, data) {
  49634. if (!data || data[NODE_KEY]) return;
  49635. Object.defineProperty(data, NODE_KEY, {
  49636. value: node.id,
  49637. enumerable: false,
  49638. configurable: false,
  49639. writable: false
  49640. });
  49641. };
  49642. const getNodeKey = (key, data) => data?.[key || NODE_KEY];
  49643. const handleCurrentChange = (store, emit, setCurrent) => {
  49644. const preCurrentNode = store.value.currentNode;
  49645. setCurrent();
  49646. const currentNode = store.value.currentNode;
  49647. if (preCurrentNode === currentNode) return;
  49648. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  49649. };
  49650. //#endregion
  49651. //#region ../../packages/components/tree/src/model/node.ts
  49652. const getChildState = (node) => {
  49653. let all = true;
  49654. let none = true;
  49655. let allWithoutDisable = true;
  49656. let isEffectivelyChecked = true;
  49657. for (let i = 0, j = node.length; i < j; i++) {
  49658. const n = node[i];
  49659. if (n.checked !== true || n.indeterminate) {
  49660. all = false;
  49661. if (!n.disabled) allWithoutDisable = false;
  49662. }
  49663. if (n.checked !== false || n.indeterminate) none = false;
  49664. if (!n.isEffectivelyChecked) isEffectivelyChecked = false;
  49665. }
  49666. return {
  49667. all,
  49668. none,
  49669. allWithoutDisable,
  49670. half: !all && !none,
  49671. isEffectivelyChecked
  49672. };
  49673. };
  49674. const reInitChecked = function(node) {
  49675. if (node.childNodes.length === 0 || node.loading) {
  49676. node.isEffectivelyChecked = node.disabled || node.checked;
  49677. return;
  49678. }
  49679. const { all, none, half, isEffectivelyChecked } = getChildState(node.childNodes);
  49680. node.isEffectivelyChecked = isEffectivelyChecked;
  49681. if (all) {
  49682. node.checked = true;
  49683. node.indeterminate = false;
  49684. } else if (half) {
  49685. node.checked = false;
  49686. node.indeterminate = true;
  49687. } else if (none) {
  49688. node.checked = false;
  49689. node.indeterminate = false;
  49690. }
  49691. const parent = node.parent;
  49692. if (!parent || parent.level === 0) return;
  49693. if (!node.store.checkStrictly) reInitChecked(parent);
  49694. };
  49695. const getPropertyFromData = function(node, prop) {
  49696. const props = node.store.props;
  49697. const data = node.data || {};
  49698. const config = props[prop];
  49699. if (isFunction$1(config)) return config(data, node);
  49700. else if (isString(config)) return data[config];
  49701. else if (isUndefined(config)) {
  49702. const dataProp = data[prop];
  49703. return isUndefined(dataProp) ? "" : dataProp;
  49704. }
  49705. };
  49706. const setCanFocus = function(childNodes, focus) {
  49707. childNodes.forEach((item) => {
  49708. item.canFocus = focus;
  49709. setCanFocus(item.childNodes, focus);
  49710. });
  49711. };
  49712. let nodeIdSeed = 0;
  49713. var Node$1 = class Node$1 {
  49714. constructor(options) {
  49715. this.isLeafByUser = void 0;
  49716. this.isLeaf = void 0;
  49717. this.isEffectivelyChecked = false;
  49718. this.id = nodeIdSeed++;
  49719. this.text = null;
  49720. this.checked = false;
  49721. this.indeterminate = false;
  49722. this.data = null;
  49723. this.expanded = false;
  49724. this.parent = null;
  49725. this.visible = true;
  49726. this.isCurrent = false;
  49727. this.canFocus = false;
  49728. for (const name in options) if (hasOwn(options, name)) this[name] = options[name];
  49729. this.level = 0;
  49730. this.loaded = false;
  49731. this.childNodes = [];
  49732. this.loading = false;
  49733. if (this.parent) this.level = this.parent.level + 1;
  49734. }
  49735. initialize() {
  49736. const store = this.store;
  49737. if (!store) throw new Error("[Node]store is required!");
  49738. store.registerNode(this);
  49739. const props = store.props;
  49740. if (props && typeof props.isLeaf !== "undefined") {
  49741. const isLeaf = getPropertyFromData(this, "isLeaf");
  49742. if (isBoolean(isLeaf)) this.isLeafByUser = isLeaf;
  49743. }
  49744. if (store.lazy !== true && this.data) {
  49745. this.setData(this.data);
  49746. if (store.defaultExpandAll) {
  49747. this.expanded = true;
  49748. this.canFocus = true;
  49749. }
  49750. } else if (this.level > 0 && store.lazy && store.defaultExpandAll && !this.isLeafByUser) this.expand();
  49751. if (!isArray$1(this.data)) markNodeData(this, this.data);
  49752. if (!this.data) return;
  49753. const defaultExpandedKeys = store.defaultExpandedKeys;
  49754. const key = store.key;
  49755. if (key && !isNil(this.key) && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) this.expand(null, store.autoExpandParent);
  49756. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  49757. store.currentNode && (store.currentNode.isCurrent = false);
  49758. store.currentNode = this;
  49759. store.currentNode.isCurrent = true;
  49760. }
  49761. if (store.lazy) store._initDefaultCheckedNode(this);
  49762. this.updateLeafState();
  49763. if (this.level === 1 || this.parent?.expanded === true) this.canFocus = true;
  49764. }
  49765. setData(data) {
  49766. if (!isArray$1(data)) markNodeData(this, data);
  49767. this.data = data;
  49768. this.childNodes = [];
  49769. let children;
  49770. if (this.level === 0 && isArray$1(this.data)) children = this.data;
  49771. else children = getPropertyFromData(this, "children") || [];
  49772. for (let i = 0, j = children.length; i < j; i++) this.insertChild({ data: children[i] });
  49773. }
  49774. get label() {
  49775. return getPropertyFromData(this, "label");
  49776. }
  49777. get key() {
  49778. const nodeKey = this.store.key;
  49779. if (this.data) return this.data[nodeKey];
  49780. return null;
  49781. }
  49782. get disabled() {
  49783. return getPropertyFromData(this, "disabled");
  49784. }
  49785. get nextSibling() {
  49786. const parent = this.parent;
  49787. if (parent) {
  49788. const index = parent.childNodes.indexOf(this);
  49789. if (index > -1) return parent.childNodes[index + 1];
  49790. }
  49791. return null;
  49792. }
  49793. get previousSibling() {
  49794. const parent = this.parent;
  49795. if (parent) {
  49796. const index = parent.childNodes.indexOf(this);
  49797. if (index > -1) return index > 0 ? parent.childNodes[index - 1] : null;
  49798. }
  49799. return null;
  49800. }
  49801. contains(target, deep = true) {
  49802. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  49803. }
  49804. remove() {
  49805. const parent = this.parent;
  49806. if (parent) parent.removeChild(this);
  49807. }
  49808. insertChild(child, index, batch) {
  49809. if (!child) throw new Error("InsertChild error: child is required.");
  49810. if (!(child instanceof Node$1)) {
  49811. if (!batch) {
  49812. const children = this.getChildren(true);
  49813. if (!children?.includes(child.data)) if (isUndefined(index) || index < 0) children?.push(child.data);
  49814. else children?.splice(index, 0, child.data);
  49815. }
  49816. Object.assign(child, {
  49817. parent: this,
  49818. store: this.store
  49819. });
  49820. child = reactive(new Node$1(child));
  49821. if (child instanceof Node$1) child.initialize();
  49822. }
  49823. child.level = this.level + 1;
  49824. if (isUndefined(index) || index < 0) this.childNodes.push(child);
  49825. else this.childNodes.splice(index, 0, child);
  49826. this.updateLeafState();
  49827. }
  49828. insertBefore(child, ref) {
  49829. let index;
  49830. if (ref) index = this.childNodes.indexOf(ref);
  49831. this.insertChild(child, index);
  49832. }
  49833. insertAfter(child, ref) {
  49834. let index;
  49835. if (ref) {
  49836. index = this.childNodes.indexOf(ref);
  49837. if (index !== -1) index += 1;
  49838. }
  49839. this.insertChild(child, index);
  49840. }
  49841. removeChild(child) {
  49842. const children = this.getChildren() || [];
  49843. const dataIndex = children.indexOf(child.data);
  49844. if (dataIndex > -1) children.splice(dataIndex, 1);
  49845. const index = this.childNodes.indexOf(child);
  49846. if (index > -1) {
  49847. this.store && this.store.deregisterNode(child);
  49848. child.parent = null;
  49849. this.childNodes.splice(index, 1);
  49850. }
  49851. this.updateLeafState();
  49852. }
  49853. removeChildByData(data) {
  49854. const targetNode = this.childNodes.find((child) => child.data === data);
  49855. if (targetNode) this.removeChild(targetNode);
  49856. }
  49857. expand(callback, expandParent) {
  49858. const done = () => {
  49859. if (expandParent) {
  49860. let parent = this.parent;
  49861. while (parent && parent.level > 0) {
  49862. parent.expanded = true;
  49863. parent = parent.parent;
  49864. }
  49865. }
  49866. this.expanded = true;
  49867. if (callback) callback();
  49868. setCanFocus(this.childNodes, true);
  49869. };
  49870. if (this.shouldLoadData()) this.loadData((data) => {
  49871. if (isArray$1(data)) {
  49872. if (this.checked) this.setChecked(true, true);
  49873. else if (!this.store.checkStrictly) reInitChecked(this);
  49874. done();
  49875. }
  49876. });
  49877. else done();
  49878. }
  49879. doCreateChildren(array, defaultProps = {}) {
  49880. array.forEach((item) => {
  49881. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  49882. });
  49883. }
  49884. collapse() {
  49885. this.expanded = false;
  49886. setCanFocus(this.childNodes, false);
  49887. }
  49888. shouldLoadData() {
  49889. return Boolean(this.store.lazy === true && this.store.load && !this.loaded);
  49890. }
  49891. updateLeafState() {
  49892. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  49893. this.isLeaf = this.isLeafByUser;
  49894. this.isEffectivelyChecked = this.isLeaf && this.disabled;
  49895. return;
  49896. }
  49897. const childNodes = this.childNodes;
  49898. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  49899. this.isLeaf = !childNodes || childNodes.length === 0;
  49900. this.isEffectivelyChecked = this.isLeaf && this.disabled;
  49901. return;
  49902. }
  49903. this.isLeaf = false;
  49904. }
  49905. setChecked(value, deep, recursion, passValue) {
  49906. this.indeterminate = value === "half";
  49907. this.checked = value === true;
  49908. this.isEffectivelyChecked = !this.childNodes.length && (this.disabled || this.checked);
  49909. if (this.store.checkStrictly) return;
  49910. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  49911. const handleDescendants = () => {
  49912. if (deep) {
  49913. const childNodes = this.childNodes;
  49914. for (let i = 0, j = childNodes.length; i < j; i++) {
  49915. const child = childNodes[i];
  49916. passValue = passValue || value !== false;
  49917. const isCheck = child.disabled && child.isLeaf ? child.checked : passValue;
  49918. child.setChecked(isCheck, deep, true, passValue);
  49919. }
  49920. const { half, all, isEffectivelyChecked } = getChildState(childNodes);
  49921. if (!all) {
  49922. this.checked = all;
  49923. this.indeterminate = half;
  49924. }
  49925. this.isEffectivelyChecked = !this.childNodes.length ? this.disabled || this.checked : isEffectivelyChecked;
  49926. }
  49927. };
  49928. if (this.shouldLoadData()) {
  49929. this.loadData(() => {
  49930. handleDescendants();
  49931. reInitChecked(this);
  49932. }, { checked: value !== false });
  49933. return;
  49934. } else handleDescendants();
  49935. }
  49936. const parent = this.parent;
  49937. if (!parent || parent.level === 0) return;
  49938. if (!recursion) reInitChecked(parent);
  49939. }
  49940. getChildren(forceInit = false) {
  49941. if (this.level === 0) return this.data;
  49942. const data = this.data;
  49943. if (!data) return null;
  49944. const props = this.store.props;
  49945. let children = "children";
  49946. if (props) children = props.children || "children";
  49947. if (isUndefined(data[children])) data[children] = null;
  49948. if (forceInit && !data[children]) data[children] = [];
  49949. return data[children];
  49950. }
  49951. updateChildren() {
  49952. const newData = this.getChildren() || [];
  49953. const oldData = this.childNodes.map((node) => node.data);
  49954. const newDataMap = {};
  49955. const newNodes = [];
  49956. newData.forEach((item, index) => {
  49957. const key = item[NODE_KEY];
  49958. if (!!key && oldData.some((data) => data?.[NODE_KEY] === key)) newDataMap[key] = {
  49959. index,
  49960. data: item
  49961. };
  49962. else newNodes.push({
  49963. index,
  49964. data: item
  49965. });
  49966. });
  49967. if (!this.store.lazy) oldData.forEach((item) => {
  49968. if (!newDataMap[item?.[NODE_KEY]]) this.removeChildByData(item);
  49969. });
  49970. newNodes.forEach(({ index, data }) => {
  49971. this.insertChild({ data }, index);
  49972. });
  49973. this.updateLeafState();
  49974. }
  49975. loadData(callback, defaultProps = {}) {
  49976. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  49977. this.loading = true;
  49978. const resolve = (children) => {
  49979. this.childNodes = [];
  49980. this.doCreateChildren(children, defaultProps);
  49981. this.loaded = true;
  49982. this.loading = false;
  49983. this.updateLeafState();
  49984. if (callback) callback.call(this, children);
  49985. };
  49986. const reject = () => {
  49987. this.loading = false;
  49988. };
  49989. this.store.load(this, resolve, reject);
  49990. } else if (callback) callback.call(this);
  49991. }
  49992. eachNode(callback) {
  49993. const arr = [this];
  49994. while (arr.length) {
  49995. const node = arr.shift();
  49996. arr.unshift(...node.childNodes);
  49997. callback(node);
  49998. }
  49999. }
  50000. reInitChecked() {
  50001. if (this.store.checkStrictly) return;
  50002. reInitChecked(this);
  50003. }
  50004. };
  50005. //#endregion
  50006. //#region ../../packages/components/tree/src/model/tree-store.ts
  50007. var TreeStore = class {
  50008. constructor(options) {
  50009. this.lazy = false;
  50010. this.checkStrictly = false;
  50011. this.autoExpandParent = false;
  50012. this.defaultExpandAll = false;
  50013. this.checkDescendants = false;
  50014. this.currentNode = null;
  50015. this.currentNodeKey = null;
  50016. for (const option in options) if (hasOwn(options, option)) this[option] = options[option];
  50017. this.nodesMap = {};
  50018. }
  50019. initialize() {
  50020. this.root = new Node$1({
  50021. data: this.data,
  50022. store: this
  50023. });
  50024. this.root.initialize();
  50025. if (this.lazy && this.load) {
  50026. const loadFn = this.load;
  50027. loadFn(this.root, (data) => {
  50028. this.root.doCreateChildren(data);
  50029. this._initDefaultCheckedNodes();
  50030. }, NOOP);
  50031. } else this._initDefaultCheckedNodes();
  50032. }
  50033. filter(value) {
  50034. const filterNodeMethod = this.filterNodeMethod;
  50035. const lazy = this.lazy;
  50036. const traverse = async function(node) {
  50037. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  50038. for (const [index, child] of childNodes.entries()) {
  50039. child.visible = !!filterNodeMethod?.call(child, value, child.data, child);
  50040. if (index % 80 === 0 && index > 0) await nextTick();
  50041. await traverse(child);
  50042. }
  50043. if (!node.visible && childNodes.length) {
  50044. let allHidden = true;
  50045. allHidden = !childNodes.some((child) => child.visible);
  50046. if (node.root) node.root.visible = allHidden === false;
  50047. else node.visible = allHidden === false;
  50048. }
  50049. if (!value) return;
  50050. if (node.visible && !node.isLeaf) {
  50051. if (!lazy || node.loaded) node.expand();
  50052. }
  50053. };
  50054. traverse(this);
  50055. }
  50056. setData(newVal) {
  50057. if (newVal !== this.root.data) {
  50058. this.nodesMap = {};
  50059. this.root.setData(newVal);
  50060. this._initDefaultCheckedNodes();
  50061. this.setCurrentNodeKey(this.currentNodeKey);
  50062. } else this.root.updateChildren();
  50063. }
  50064. getNode(data) {
  50065. if (data instanceof Node$1) return data;
  50066. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  50067. return this.nodesMap[key] || null;
  50068. }
  50069. insertBefore(data, refData) {
  50070. const refNode = this.getNode(refData);
  50071. refNode.parent?.insertBefore({ data }, refNode);
  50072. }
  50073. insertAfter(data, refData) {
  50074. const refNode = this.getNode(refData);
  50075. refNode.parent?.insertAfter({ data }, refNode);
  50076. }
  50077. remove(data) {
  50078. const node = this.getNode(data);
  50079. if (node && node.parent) {
  50080. if (node === this.currentNode) this.currentNode = null;
  50081. node.parent.removeChild(node);
  50082. }
  50083. }
  50084. append(data, parentData) {
  50085. const parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
  50086. if (parentNode) parentNode.insertChild({ data });
  50087. }
  50088. _initDefaultCheckedNodes() {
  50089. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  50090. const nodesMap = this.nodesMap;
  50091. defaultCheckedKeys.forEach((checkedKey) => {
  50092. const node = nodesMap[checkedKey];
  50093. if (node) node.setChecked(true, !this.checkStrictly);
  50094. });
  50095. }
  50096. _initDefaultCheckedNode(node) {
  50097. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  50098. if (!isNil(node.key) && defaultCheckedKeys.includes(node.key)) node.setChecked(true, !this.checkStrictly);
  50099. }
  50100. setDefaultCheckedKey(newVal) {
  50101. if (newVal !== this.defaultCheckedKeys) {
  50102. this.defaultCheckedKeys = newVal;
  50103. this._initDefaultCheckedNodes();
  50104. }
  50105. }
  50106. registerNode(node) {
  50107. const key = this.key;
  50108. if (!node || !node.data) return;
  50109. if (!key) this.nodesMap[node.id] = node;
  50110. else {
  50111. const nodeKey = node.key;
  50112. if (!isNil(nodeKey)) this.nodesMap[nodeKey] = node;
  50113. }
  50114. }
  50115. deregisterNode(node) {
  50116. if (!this.key || !node || !node.data) return;
  50117. node.childNodes.forEach((child) => {
  50118. this.deregisterNode(child);
  50119. });
  50120. delete this.nodesMap[node.key];
  50121. }
  50122. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  50123. const checkedNodes = [];
  50124. const traverse = function(node) {
  50125. (node.root ? node.root.childNodes : node.childNodes).forEach((child) => {
  50126. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) checkedNodes.push(child.data);
  50127. traverse(child);
  50128. });
  50129. };
  50130. traverse(this);
  50131. return checkedNodes;
  50132. }
  50133. getCheckedKeys(leafOnly = false) {
  50134. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  50135. }
  50136. getHalfCheckedNodes() {
  50137. const nodes = [];
  50138. const traverse = function(node) {
  50139. (node.root ? node.root.childNodes : node.childNodes).forEach((child) => {
  50140. if (child.indeterminate) nodes.push(child.data);
  50141. traverse(child);
  50142. });
  50143. };
  50144. traverse(this);
  50145. return nodes;
  50146. }
  50147. getHalfCheckedKeys() {
  50148. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  50149. }
  50150. _getAllNodes() {
  50151. const allNodes = [];
  50152. const nodesMap = this.nodesMap;
  50153. for (const nodeKey in nodesMap) if (hasOwn(nodesMap, nodeKey)) allNodes.push(nodesMap[nodeKey]);
  50154. return allNodes;
  50155. }
  50156. updateChildren(key, data) {
  50157. const node = this.nodesMap[key];
  50158. if (!node) return;
  50159. const childNodes = node.childNodes;
  50160. for (let i = childNodes.length - 1; i >= 0; i--) {
  50161. const child = childNodes[i];
  50162. this.remove(child.data);
  50163. }
  50164. for (let i = 0, j = data.length; i < j; i++) {
  50165. const child = data[i];
  50166. this.append(child, node.data);
  50167. }
  50168. }
  50169. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  50170. const allNodes = this._getAllNodes().sort((a, b) => a.level - b.level);
  50171. const cache = Object.create(null);
  50172. const keys = Object.keys(checkedKeys);
  50173. allNodes.forEach((node) => node.setChecked(false, false));
  50174. const cacheCheckedChild = (node) => {
  50175. node.childNodes.forEach((child) => {
  50176. cache[child.data[key]] = true;
  50177. if (child.childNodes?.length) cacheCheckedChild(child);
  50178. });
  50179. };
  50180. for (let i = 0, j = allNodes.length; i < j; i++) {
  50181. const node = allNodes[i];
  50182. const nodeKey = node.data[key].toString();
  50183. if (!keys.includes(nodeKey)) {
  50184. if (node.checked && !cache[nodeKey]) node.setChecked(false, false);
  50185. continue;
  50186. }
  50187. if (node.childNodes.length) cacheCheckedChild(node);
  50188. if (node.isLeaf || this.checkStrictly) {
  50189. node.setChecked(true, false);
  50190. continue;
  50191. }
  50192. node.setChecked(true, true);
  50193. if (leafOnly) {
  50194. node.setChecked(false, false, true);
  50195. const traverse = function(node) {
  50196. node.childNodes.forEach((child) => {
  50197. if (!child.isLeaf) child.setChecked(false, false, true);
  50198. traverse(child);
  50199. });
  50200. node.reInitChecked();
  50201. };
  50202. traverse(node);
  50203. }
  50204. }
  50205. }
  50206. setCheckedNodes(array, leafOnly = false) {
  50207. const key = this.key;
  50208. const checkedKeys = {};
  50209. array.forEach((item) => {
  50210. checkedKeys[(item || {})[key]] = true;
  50211. });
  50212. this._setCheckedKeys(key, leafOnly, checkedKeys);
  50213. }
  50214. setCheckedKeys(keys, leafOnly = false) {
  50215. this.defaultCheckedKeys = keys;
  50216. const key = this.key;
  50217. const checkedKeys = {};
  50218. keys.forEach((key) => {
  50219. checkedKeys[key] = true;
  50220. });
  50221. this._setCheckedKeys(key, leafOnly, checkedKeys);
  50222. }
  50223. setDefaultExpandedKeys(keys) {
  50224. keys = keys || [];
  50225. this.defaultExpandedKeys = keys;
  50226. keys.forEach((key) => {
  50227. const node = this.getNode(key);
  50228. if (node) node.expand(null, this.autoExpandParent);
  50229. });
  50230. }
  50231. setChecked(data, checked, deep) {
  50232. const node = this.getNode(data);
  50233. if (node) node.setChecked(!!checked, deep);
  50234. }
  50235. getCurrentNode() {
  50236. return this.currentNode;
  50237. }
  50238. setCurrentNode(currentNode) {
  50239. const prevCurrentNode = this.currentNode;
  50240. if (prevCurrentNode) prevCurrentNode.isCurrent = false;
  50241. this.currentNode = currentNode;
  50242. this.currentNode.isCurrent = true;
  50243. }
  50244. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  50245. const key = node[this.key];
  50246. const currNode = this.nodesMap[key];
  50247. this.setCurrentNode(currNode);
  50248. if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) this.currentNode.parent?.expand(null, true);
  50249. }
  50250. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  50251. this.currentNodeKey = key;
  50252. if (isPropAbsent(key)) {
  50253. this.currentNode && (this.currentNode.isCurrent = false);
  50254. this.currentNode = null;
  50255. return;
  50256. }
  50257. const node = this.getNode(key);
  50258. if (node) {
  50259. this.setCurrentNode(node);
  50260. if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) this.currentNode.parent?.expand(null, true);
  50261. }
  50262. }
  50263. };
  50264. //#endregion
  50265. //#region ../../packages/components/tree/src/tokens.ts
  50266. const ROOT_TREE_INJECTION_KEY = "RootTree";
  50267. const NODE_INSTANCE_INJECTION_KEY = "NodeInstance";
  50268. const TREE_NODE_MAP_INJECTION_KEY = "TreeNodeMap";
  50269. //#endregion
  50270. //#region ../../packages/components/tree/src/tree-node-content.vue?vue&type=script&lang.ts
  50271. var tree_node_content_vue_vue_type_script_lang_default = defineComponent({
  50272. name: "ElTreeNodeContent",
  50273. props: {
  50274. node: {
  50275. type: Object,
  50276. required: true
  50277. },
  50278. renderContent: Function
  50279. },
  50280. setup(props) {
  50281. const ns = useNamespace("tree");
  50282. const nodeInstance = inject(NODE_INSTANCE_INJECTION_KEY);
  50283. const tree = inject(ROOT_TREE_INJECTION_KEY);
  50284. return () => {
  50285. const node = props.node;
  50286. const { data, store } = node;
  50287. return props.renderContent ? props.renderContent(h, {
  50288. _self: nodeInstance,
  50289. node,
  50290. data,
  50291. store
  50292. }) : renderSlot(tree.ctx.slots, "default", {
  50293. node,
  50294. data
  50295. }, () => [h(ElText, {
  50296. tag: "span",
  50297. truncated: true,
  50298. class: ns.be("node", "label")
  50299. }, () => [node.label])]);
  50300. };
  50301. }
  50302. });
  50303. //#endregion
  50304. //#region ../../packages/components/tree/src/tree-node-content.vue
  50305. var tree_node_content_default$1 = tree_node_content_vue_vue_type_script_lang_default;
  50306. //#endregion
  50307. //#region ../../packages/components/tree/src/model/useNodeExpandEventBroadcast.ts
  50308. function useNodeExpandEventBroadcast(props) {
  50309. const parentNodeMap = inject(TREE_NODE_MAP_INJECTION_KEY, null);
  50310. let currentNodeMap = {
  50311. treeNodeExpand: (node) => {
  50312. if (props.node !== node) props.node?.collapse();
  50313. },
  50314. children: /* @__PURE__ */ new Set()
  50315. };
  50316. if (parentNodeMap) parentNodeMap.children.add(currentNodeMap);
  50317. onBeforeUnmount(() => {
  50318. if (parentNodeMap) parentNodeMap.children.delete(currentNodeMap);
  50319. currentNodeMap = null;
  50320. });
  50321. provide(TREE_NODE_MAP_INJECTION_KEY, currentNodeMap);
  50322. return { broadcastExpanded: (node) => {
  50323. if (!props.accordion) return;
  50324. for (const childNode of currentNodeMap.children) childNode.treeNodeExpand(node);
  50325. } };
  50326. }
  50327. //#endregion
  50328. //#region ../../packages/components/tree/src/model/useDragNode.ts
  50329. const dragEventsKey = Symbol("dragEvents");
  50330. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  50331. const ns = useNamespace("tree");
  50332. const dragState = ref({
  50333. showDropIndicator: false,
  50334. draggingNode: null,
  50335. dropNode: null,
  50336. allowDrop: true,
  50337. dropType: null
  50338. });
  50339. const treeNodeDragStart = ({ event, treeNode }) => {
  50340. if (!event.dataTransfer) return;
  50341. if (isFunction$1(props.allowDrag) && !props.allowDrag(treeNode.node)) {
  50342. event.preventDefault();
  50343. return false;
  50344. }
  50345. event.dataTransfer.effectAllowed = "move";
  50346. try {
  50347. event.dataTransfer.setData("text/plain", "");
  50348. } catch {}
  50349. dragState.value.draggingNode = treeNode;
  50350. ctx.emit("node-drag-start", treeNode.node, event);
  50351. };
  50352. const treeNodeDragOver = ({ event, treeNode }) => {
  50353. if (!event.dataTransfer) return;
  50354. const dropNode = treeNode;
  50355. const oldDropNode = dragState.value.dropNode;
  50356. if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) removeClass(oldDropNode.$el, ns.is("drop-inner"));
  50357. const draggingNode = dragState.value.draggingNode;
  50358. if (!draggingNode || !dropNode) return;
  50359. let dropPrev = true;
  50360. let dropInner = true;
  50361. let dropNext = true;
  50362. let userAllowDropInner = true;
  50363. if (isFunction$1(props.allowDrop)) {
  50364. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  50365. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  50366. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  50367. }
  50368. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  50369. if ((dropPrev || dropInner || dropNext) && oldDropNode?.node.id !== dropNode.node.id) {
  50370. if (oldDropNode) ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  50371. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  50372. }
  50373. if (dropPrev || dropInner || dropNext) dragState.value.dropNode = dropNode;
  50374. else dragState.value.dropNode = null;
  50375. if (dropNode.node.nextSibling === draggingNode.node) dropNext = false;
  50376. if (dropNode.node.previousSibling === draggingNode.node) dropPrev = false;
  50377. if (dropNode.node.contains(draggingNode.node, false)) dropInner = false;
  50378. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  50379. dropPrev = false;
  50380. dropInner = false;
  50381. dropNext = false;
  50382. }
  50383. const dropEl = dropNode.$el;
  50384. const targetPosition = dropEl.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
  50385. const treePosition = el$.value.getBoundingClientRect();
  50386. const treeScrollTop = el$.value.scrollTop;
  50387. let dropType;
  50388. const prevPercent = dropPrev ? dropInner ? .25 : dropNext ? .45 : 1 : Number.NEGATIVE_INFINITY;
  50389. const nextPercent = dropNext ? dropInner ? .75 : dropPrev ? .55 : 0 : Number.POSITIVE_INFINITY;
  50390. let indicatorTop = -9999;
  50391. const distance = event.clientY - targetPosition.top;
  50392. if (distance < targetPosition.height * prevPercent) dropType = "before";
  50393. else if (distance > targetPosition.height * nextPercent) dropType = "after";
  50394. else if (dropInner) dropType = "inner";
  50395. else dropType = "none";
  50396. const iconPosition = dropEl.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  50397. const dropIndicator = dropIndicator$.value;
  50398. if (dropType === "before") indicatorTop = iconPosition.top - treePosition.top + treeScrollTop;
  50399. else if (dropType === "after") indicatorTop = iconPosition.bottom - treePosition.top + treeScrollTop;
  50400. dropIndicator.style.top = `${indicatorTop}px`;
  50401. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  50402. if (dropType === "inner") addClass(dropEl, ns.is("drop-inner"));
  50403. else removeClass(dropEl, ns.is("drop-inner"));
  50404. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  50405. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  50406. dragState.value.dropType = dropType;
  50407. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  50408. };
  50409. const treeNodeDragEnd = (event) => {
  50410. const { draggingNode, dropType, dropNode } = dragState.value;
  50411. event.preventDefault();
  50412. if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
  50413. if (draggingNode?.node.data && dropNode) {
  50414. const draggingNodeCopy = { data: draggingNode.node.data };
  50415. if (dropType !== "none") draggingNode.node.remove();
  50416. if (dropType === "before") dropNode.node.parent?.insertBefore(draggingNodeCopy, dropNode.node);
  50417. else if (dropType === "after") dropNode.node.parent?.insertAfter(draggingNodeCopy, dropNode.node);
  50418. else if (dropType === "inner") dropNode.node.insertChild(draggingNodeCopy);
  50419. if (dropType !== "none") {
  50420. store.value.registerNode(draggingNodeCopy);
  50421. if (store.value.key) draggingNode.node.eachNode((node) => {
  50422. store.value.nodesMap[node.data[store.value.key]]?.setChecked(node.checked, !store.value.checkStrictly);
  50423. });
  50424. }
  50425. removeClass(dropNode.$el, ns.is("drop-inner"));
  50426. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  50427. if (dropType !== "none") ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  50428. }
  50429. if (draggingNode && !dropNode) ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  50430. dragState.value.showDropIndicator = false;
  50431. dragState.value.draggingNode = null;
  50432. dragState.value.dropNode = null;
  50433. dragState.value.allowDrop = true;
  50434. };
  50435. provide(dragEventsKey, {
  50436. treeNodeDragStart,
  50437. treeNodeDragOver,
  50438. treeNodeDragEnd
  50439. });
  50440. return { dragState };
  50441. }
  50442. //#endregion
  50443. //#region ../../packages/components/tree/src/tree-node.vue?vue&type=script&lang.ts
  50444. var tree_node_vue_vue_type_script_lang_default = defineComponent({
  50445. name: "ElTreeNode",
  50446. components: {
  50447. ElCollapseTransition,
  50448. ElCheckbox,
  50449. NodeContent: tree_node_content_default$1,
  50450. ElIcon,
  50451. Loading: loading_default
  50452. },
  50453. props: {
  50454. node: {
  50455. type: Node$1,
  50456. default: () => ({})
  50457. },
  50458. props: {
  50459. type: Object,
  50460. default: () => ({})
  50461. },
  50462. accordion: Boolean,
  50463. renderContent: Function,
  50464. renderAfterExpand: Boolean,
  50465. showCheckbox: Boolean
  50466. },
  50467. emits: ["node-expand"],
  50468. setup(props, ctx) {
  50469. const ns = useNamespace("tree");
  50470. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  50471. const tree = inject(ROOT_TREE_INJECTION_KEY);
  50472. const expanded = ref(false);
  50473. const childNodeRendered = ref(false);
  50474. const oldChecked = ref();
  50475. const oldIndeterminate = ref();
  50476. const node$ = ref();
  50477. const dragEvents = inject(dragEventsKey);
  50478. const instance = getCurrentInstance();
  50479. provide(NODE_INSTANCE_INJECTION_KEY, instance);
  50480. if (!tree) /* @__PURE__ */ debugWarn("Tree", "Can not find node's tree.");
  50481. if (props.node.expanded) {
  50482. expanded.value = true;
  50483. childNodeRendered.value = true;
  50484. }
  50485. const childrenKey = tree.props.props["children"] || "children";
  50486. watch(() => {
  50487. const children = props.node.data?.[childrenKey];
  50488. return children && [...children];
  50489. }, () => {
  50490. props.node.updateChildren();
  50491. });
  50492. watch(() => props.node.indeterminate, (val) => {
  50493. handleSelectChange(props.node.checked, val);
  50494. });
  50495. watch(() => props.node.checked, (val) => {
  50496. handleSelectChange(val, props.node.indeterminate);
  50497. });
  50498. watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
  50499. watch(() => props.node.expanded, (val) => {
  50500. nextTick(() => expanded.value = val);
  50501. if (val) childNodeRendered.value = true;
  50502. });
  50503. const getNodeKey$2 = (node) => {
  50504. return tree.props.nodeKey ? getNodeKey(tree.props.nodeKey, node.data) : node.id;
  50505. };
  50506. const getNodeClass = (node) => {
  50507. const nodeClassFunc = props.props.class;
  50508. if (!nodeClassFunc) return {};
  50509. let className;
  50510. if (isFunction$1(nodeClassFunc)) {
  50511. const { data } = node;
  50512. className = nodeClassFunc(data, node);
  50513. } else className = nodeClassFunc;
  50514. if (isString(className)) return { [className]: true };
  50515. else return className;
  50516. };
  50517. const handleSelectChange = (checked, indeterminate) => {
  50518. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  50519. oldChecked.value = checked;
  50520. oldIndeterminate.value = indeterminate;
  50521. };
  50522. const handleClick = (e) => {
  50523. handleCurrentChange(tree.store, tree.ctx.emit, () => {
  50524. if (tree?.props?.nodeKey) {
  50525. const curNodeKey = getNodeKey$2(props.node);
  50526. tree.store.value.setCurrentNodeKey(curNodeKey);
  50527. } else tree.store.value.setCurrentNode(props.node);
  50528. });
  50529. tree.currentNode.value = props.node;
  50530. if (tree.props.expandOnClickNode) handleExpandIconClick();
  50531. if ((tree.props.checkOnClickNode || props.node.isLeaf && tree.props.checkOnClickLeaf && props.showCheckbox) && !props.node.disabled) handleCheckChange(!props.node.checked);
  50532. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  50533. };
  50534. const handleContextMenu = (event) => {
  50535. if (tree.instance.vnode.props?.["onNodeContextmenu"]) {
  50536. event.stopPropagation();
  50537. event.preventDefault();
  50538. }
  50539. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  50540. };
  50541. const handleExpandIconClick = () => {
  50542. if (props.node.isLeaf) return;
  50543. if (expanded.value) {
  50544. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  50545. props.node.collapse();
  50546. } else props.node.expand(() => {
  50547. ctx.emit("node-expand", props.node.data, props.node, instance);
  50548. });
  50549. };
  50550. const handleCheckChange = (value) => {
  50551. const checkStrictly = tree?.props.checkStrictly;
  50552. const childNodes = props.node.childNodes;
  50553. if (!checkStrictly && childNodes.length) value = childNodes.some((node) => !node.isEffectivelyChecked);
  50554. props.node.setChecked(value, !checkStrictly);
  50555. nextTick(() => {
  50556. const store = tree.store.value;
  50557. tree.ctx.emit("check", props.node.data, {
  50558. checkedNodes: store.getCheckedNodes(),
  50559. checkedKeys: store.getCheckedKeys(),
  50560. halfCheckedNodes: store.getHalfCheckedNodes(),
  50561. halfCheckedKeys: store.getHalfCheckedKeys()
  50562. });
  50563. });
  50564. };
  50565. const handleChildNodeExpand = (nodeData, node, instance) => {
  50566. broadcastExpanded(node);
  50567. tree.ctx.emit("node-expand", nodeData, node, instance);
  50568. };
  50569. const handleDragStart = (event) => {
  50570. if (!tree.props.draggable) return;
  50571. dragEvents.treeNodeDragStart({
  50572. event,
  50573. treeNode: props
  50574. });
  50575. };
  50576. const handleDragOver = (event) => {
  50577. event.preventDefault();
  50578. if (!tree.props.draggable) return;
  50579. dragEvents.treeNodeDragOver({
  50580. event,
  50581. treeNode: {
  50582. $el: node$.value,
  50583. node: props.node
  50584. }
  50585. });
  50586. };
  50587. const handleDrop = (event) => {
  50588. event.preventDefault();
  50589. };
  50590. const handleDragEnd = (event) => {
  50591. if (!tree.props.draggable) return;
  50592. dragEvents.treeNodeDragEnd(event);
  50593. };
  50594. return {
  50595. ns,
  50596. node$,
  50597. tree,
  50598. expanded,
  50599. childNodeRendered,
  50600. oldChecked,
  50601. oldIndeterminate,
  50602. getNodeKey: getNodeKey$2,
  50603. getNodeClass,
  50604. handleSelectChange,
  50605. handleClick,
  50606. handleContextMenu,
  50607. handleExpandIconClick,
  50608. handleCheckChange,
  50609. handleChildNodeExpand,
  50610. handleDragStart,
  50611. handleDragOver,
  50612. handleDrop,
  50613. handleDragEnd,
  50614. CaretRight: caret_right_default
  50615. };
  50616. }
  50617. });
  50618. //#endregion
  50619. //#region ../../packages/components/tree/src/tree-node.vue
  50620. const _hoisted_1$12 = [
  50621. "aria-expanded",
  50622. "aria-disabled",
  50623. "aria-checked",
  50624. "draggable",
  50625. "data-key"
  50626. ];
  50627. const _hoisted_2$7 = ["aria-expanded"];
  50628. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  50629. const _component_el_icon = resolveComponent("el-icon");
  50630. const _component_el_checkbox = resolveComponent("el-checkbox");
  50631. const _component_loading = resolveComponent("loading");
  50632. const _component_node_content = resolveComponent("node-content");
  50633. const _component_el_tree_node = resolveComponent("el-tree-node");
  50634. const _component_el_collapse_transition = resolveComponent("el-collapse-transition");
  50635. return withDirectives((openBlock(), createElementBlock("div", {
  50636. ref: "node$",
  50637. class: normalizeClass([
  50638. _ctx.ns.b("node"),
  50639. _ctx.ns.is("expanded", _ctx.expanded),
  50640. _ctx.ns.is("current", _ctx.node.isCurrent),
  50641. _ctx.ns.is("hidden", !_ctx.node.visible),
  50642. _ctx.ns.is("focusable", !_ctx.node.disabled),
  50643. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  50644. _ctx.getNodeClass(_ctx.node)
  50645. ]),
  50646. role: "treeitem",
  50647. tabindex: "-1",
  50648. "aria-expanded": _ctx.expanded,
  50649. "aria-disabled": _ctx.node.disabled,
  50650. "aria-checked": _ctx.node.checked,
  50651. draggable: _ctx.tree.props.draggable,
  50652. "data-key": _ctx.getNodeKey(_ctx.node),
  50653. onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"])),
  50654. onContextmenu: _cache[3] || (_cache[3] = (...args) => _ctx.handleContextMenu && _ctx.handleContextMenu(...args)),
  50655. onDragstart: _cache[4] || (_cache[4] = withModifiers((...args) => _ctx.handleDragStart && _ctx.handleDragStart(...args), ["stop"])),
  50656. onDragover: _cache[5] || (_cache[5] = withModifiers((...args) => _ctx.handleDragOver && _ctx.handleDragOver(...args), ["stop"])),
  50657. onDragend: _cache[6] || (_cache[6] = withModifiers((...args) => _ctx.handleDragEnd && _ctx.handleDragEnd(...args), ["stop"])),
  50658. onDrop: _cache[7] || (_cache[7] = withModifiers((...args) => _ctx.handleDrop && _ctx.handleDrop(...args), ["stop"]))
  50659. }, [createElementVNode("div", {
  50660. class: normalizeClass(_ctx.ns.be("node", "content")),
  50661. style: normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  50662. }, [
  50663. _ctx.tree.props.icon || _ctx.CaretRight ? (openBlock(), createBlock(_component_el_icon, {
  50664. key: 0,
  50665. class: normalizeClass([
  50666. _ctx.ns.be("node", "expand-icon"),
  50667. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  50668. { expanded: !_ctx.node.isLeaf && _ctx.expanded }
  50669. ]),
  50670. onClick: withModifiers(_ctx.handleExpandIconClick, ["stop"])
  50671. }, {
  50672. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))]),
  50673. _: 1
  50674. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  50675. _ctx.showCheckbox ? (openBlock(), createBlock(_component_el_checkbox, {
  50676. key: 1,
  50677. "model-value": _ctx.node.checked,
  50678. indeterminate: _ctx.node.indeterminate,
  50679. disabled: !!_ctx.node.disabled,
  50680. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"])),
  50681. onChange: _ctx.handleCheckChange
  50682. }, null, 8, [
  50683. "model-value",
  50684. "indeterminate",
  50685. "disabled",
  50686. "onChange"
  50687. ])) : createCommentVNode("v-if", true),
  50688. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  50689. key: 2,
  50690. class: normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  50691. }, {
  50692. default: withCtx(() => [createVNode(_component_loading)]),
  50693. _: 1
  50694. }, 8, ["class"])) : createCommentVNode("v-if", true),
  50695. createVNode(_component_node_content, {
  50696. node: _ctx.node,
  50697. "render-content": _ctx.renderContent
  50698. }, null, 8, ["node", "render-content"])
  50699. ], 6), createVNode(_component_el_collapse_transition, null, {
  50700. default: withCtx(() => [!_ctx.renderAfterExpand || _ctx.childNodeRendered ? withDirectives((openBlock(), createElementBlock("div", {
  50701. key: 0,
  50702. class: normalizeClass(_ctx.ns.be("node", "children")),
  50703. role: "group",
  50704. "aria-expanded": _ctx.expanded,
  50705. onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
  50706. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.node.childNodes, (child) => {
  50707. return openBlock(), createBlock(_component_el_tree_node, {
  50708. key: _ctx.getNodeKey(child),
  50709. "render-content": _ctx.renderContent,
  50710. "render-after-expand": _ctx.renderAfterExpand,
  50711. "show-checkbox": _ctx.showCheckbox,
  50712. node: child,
  50713. accordion: _ctx.accordion,
  50714. props: _ctx.props,
  50715. onNodeExpand: _ctx.handleChildNodeExpand
  50716. }, null, 8, [
  50717. "render-content",
  50718. "render-after-expand",
  50719. "show-checkbox",
  50720. "node",
  50721. "accordion",
  50722. "props",
  50723. "onNodeExpand"
  50724. ]);
  50725. }), 128))], 10, _hoisted_2$7)), [[vShow, _ctx.expanded]]) : createCommentVNode("v-if", true)]),
  50726. _: 1
  50727. })], 42, _hoisted_1$12)), [[vShow, _ctx.node.visible]]);
  50728. }
  50729. var tree_node_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(tree_node_vue_vue_type_script_lang_default, [["render", _sfc_render$2]]);
  50730. //#endregion
  50731. //#region ../../packages/components/tree/src/model/useKeydown.ts
  50732. function useKeydown({ el$ }, store) {
  50733. const ns = useNamespace("tree");
  50734. onMounted(() => {
  50735. initTabIndex();
  50736. });
  50737. onUpdated(() => {
  50738. el$.value?.querySelectorAll("input[type=checkbox]").forEach((checkbox) => {
  50739. checkbox.setAttribute("tabindex", "-1");
  50740. });
  50741. });
  50742. function canNodeFocus(treeItems, nextIndex) {
  50743. const currentNode = store.value.getNode(treeItems[nextIndex].dataset.key);
  50744. return currentNode.canFocus && currentNode.visible && (currentNode.parent?.expanded || currentNode.parent?.level === 0);
  50745. }
  50746. const handleKeydown = (ev) => {
  50747. const currentItem = ev.target;
  50748. if (!currentItem.className.includes(ns.b("node"))) return;
  50749. const code = getEventCode(ev);
  50750. const treeItems = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  50751. const currentIndex = treeItems.indexOf(currentItem);
  50752. let nextIndex;
  50753. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  50754. ev.preventDefault();
  50755. if (code === EVENT_CODE.up) {
  50756. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.length - 1;
  50757. const startIndex = nextIndex;
  50758. while (true) {
  50759. if (canNodeFocus(treeItems, nextIndex)) break;
  50760. nextIndex--;
  50761. if (nextIndex === startIndex) {
  50762. nextIndex = -1;
  50763. break;
  50764. }
  50765. if (nextIndex < 0) nextIndex = treeItems.length - 1;
  50766. }
  50767. } else {
  50768. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.length - 1 ? currentIndex + 1 : 0;
  50769. const startIndex = nextIndex;
  50770. while (true) {
  50771. if (canNodeFocus(treeItems, nextIndex)) break;
  50772. nextIndex++;
  50773. if (nextIndex === startIndex) {
  50774. nextIndex = -1;
  50775. break;
  50776. }
  50777. if (nextIndex >= treeItems.length) nextIndex = 0;
  50778. }
  50779. }
  50780. nextIndex !== -1 && treeItems[nextIndex].focus();
  50781. }
  50782. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  50783. ev.preventDefault();
  50784. currentItem.click();
  50785. }
  50786. const hasInput = currentItem.querySelector("[type=\"checkbox\"]");
  50787. if ([
  50788. EVENT_CODE.enter,
  50789. EVENT_CODE.numpadEnter,
  50790. EVENT_CODE.space
  50791. ].includes(code) && hasInput) {
  50792. ev.preventDefault();
  50793. hasInput.click();
  50794. }
  50795. };
  50796. useEventListener(el$, "keydown", handleKeydown);
  50797. const initTabIndex = () => {
  50798. if (!el$.value) return;
  50799. const treeItems = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  50800. Array.from(el$.value.querySelectorAll("input[type=checkbox]")).forEach((checkbox) => {
  50801. checkbox.setAttribute("tabindex", "-1");
  50802. });
  50803. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  50804. if (checkedItem.length) {
  50805. checkedItem[0].setAttribute("tabindex", "0");
  50806. return;
  50807. }
  50808. treeItems[0]?.setAttribute("tabindex", "0");
  50809. };
  50810. }
  50811. //#endregion
  50812. //#region ../../packages/components/tree/src/tree.ts
  50813. const treeProps = buildProps({
  50814. data: {
  50815. type: definePropType(Array),
  50816. default: () => []
  50817. },
  50818. emptyText: { type: String },
  50819. renderAfterExpand: {
  50820. type: Boolean,
  50821. default: true
  50822. },
  50823. nodeKey: String,
  50824. checkStrictly: Boolean,
  50825. defaultExpandAll: Boolean,
  50826. expandOnClickNode: {
  50827. type: Boolean,
  50828. default: true
  50829. },
  50830. checkOnClickNode: Boolean,
  50831. checkOnClickLeaf: {
  50832. type: Boolean,
  50833. default: true
  50834. },
  50835. checkDescendants: Boolean,
  50836. autoExpandParent: {
  50837. type: Boolean,
  50838. default: true
  50839. },
  50840. defaultCheckedKeys: { type: Array },
  50841. defaultExpandedKeys: { type: Array },
  50842. currentNodeKey: { type: [String, Number] },
  50843. renderContent: { type: definePropType(Function) },
  50844. showCheckbox: Boolean,
  50845. draggable: Boolean,
  50846. allowDrag: { type: definePropType(Function) },
  50847. allowDrop: { type: definePropType(Function) },
  50848. props: {
  50849. type: Object,
  50850. default: () => ({
  50851. children: "children",
  50852. label: "label",
  50853. disabled: "disabled"
  50854. })
  50855. },
  50856. lazy: Boolean,
  50857. highlightCurrent: Boolean,
  50858. load: { type: Function },
  50859. filterNodeMethod: { type: Function },
  50860. accordion: Boolean,
  50861. indent: {
  50862. type: Number,
  50863. default: 18
  50864. },
  50865. icon: { type: iconPropType }
  50866. });
  50867. const treeEmits = {
  50868. "check-change": (data, checked, indeterminate) => data && isBoolean(checked) && isBoolean(indeterminate),
  50869. "current-change": (data, node) => true,
  50870. "node-click": (data, node, nodeInstance, evt) => data && node && evt instanceof Event,
  50871. "node-contextmenu": (evt, data, node, nodeInstance) => evt instanceof Event && data && node,
  50872. "node-collapse": (data, node, nodeInstance) => data && node,
  50873. "node-expand": (data, node, nodeInstance) => data && node,
  50874. check: (data, checkedInfo) => data && checkedInfo,
  50875. "node-drag-start": (node, evt) => node && evt,
  50876. "node-drag-end": (draggingNode, dropNode, dropType, evt) => draggingNode && evt,
  50877. "node-drop": (draggingNode, dropNode, dropType, evt) => draggingNode && dropNode && evt,
  50878. "node-drag-leave": (draggingNode, oldDropNode, evt) => draggingNode && oldDropNode && evt,
  50879. "node-drag-enter": (draggingNode, dropNode, evt) => draggingNode && dropNode && evt,
  50880. "node-drag-over": (draggingNode, dropNode, evt) => draggingNode && dropNode && evt
  50881. };
  50882. //#endregion
  50883. //#region ../../packages/components/tree/src/tree.vue?vue&type=script&lang.ts
  50884. var tree_vue_vue_type_script_lang_default = defineComponent({
  50885. name: "ElTree",
  50886. components: { ElTreeNode: tree_node_default$1 },
  50887. props: treeProps,
  50888. emits: treeEmits,
  50889. setup(props, ctx) {
  50890. const { t } = useLocale();
  50891. const ns = useNamespace("tree");
  50892. const store = ref(new TreeStore({
  50893. key: props.nodeKey,
  50894. data: props.data,
  50895. lazy: props.lazy,
  50896. props: props.props,
  50897. load: props.load,
  50898. currentNodeKey: props.currentNodeKey,
  50899. checkStrictly: props.checkStrictly,
  50900. checkDescendants: props.checkDescendants,
  50901. defaultCheckedKeys: props.defaultCheckedKeys,
  50902. defaultExpandedKeys: props.defaultExpandedKeys,
  50903. autoExpandParent: props.autoExpandParent,
  50904. defaultExpandAll: props.defaultExpandAll,
  50905. filterNodeMethod: props.filterNodeMethod
  50906. }));
  50907. store.value.initialize();
  50908. const root = ref(store.value.root);
  50909. const currentNode = ref(null);
  50910. const el$ = ref(null);
  50911. const dropIndicator$ = ref(null);
  50912. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  50913. const { dragState } = useDragNodeHandler({
  50914. props,
  50915. ctx,
  50916. el$,
  50917. dropIndicator$,
  50918. store
  50919. });
  50920. useKeydown({ el$ }, store);
  50921. const instance = getCurrentInstance();
  50922. const isSelectTree = computed(() => {
  50923. let parent = instance?.parent;
  50924. while (parent) {
  50925. if (parent.type.name === "ElTreeSelect") return true;
  50926. parent = parent.parent;
  50927. }
  50928. return false;
  50929. });
  50930. const isEmpty = computed(() => {
  50931. const { childNodes } = root.value;
  50932. return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !isSelectTree.value;
  50933. });
  50934. watch(() => props.currentNodeKey, (newVal) => {
  50935. store.value.setCurrentNodeKey(newVal ?? null);
  50936. });
  50937. watch(() => props.defaultCheckedKeys, (newVal, oldVal) => {
  50938. if (isEqual$1(newVal, oldVal)) return;
  50939. store.value.setDefaultCheckedKey(newVal ?? []);
  50940. });
  50941. watch(() => props.defaultExpandedKeys, (newVal) => {
  50942. store.value.setDefaultExpandedKeys(newVal ?? []);
  50943. });
  50944. watch(() => props.data, (newVal) => {
  50945. store.value.setData(newVal);
  50946. }, { deep: true });
  50947. watch(() => props.checkStrictly, (newVal) => {
  50948. store.value.checkStrictly = newVal;
  50949. });
  50950. const filter = (value) => {
  50951. if (!props.filterNodeMethod) throw new Error("[Tree] filterNodeMethod is required when filter");
  50952. store.value.filter(value);
  50953. };
  50954. const getNodeKey$1 = (node) => {
  50955. return props.nodeKey ? getNodeKey(props.nodeKey, node.data) : node.id;
  50956. };
  50957. const requireNodeKey = (methodName) => {
  50958. if (!props.nodeKey) throw new Error(`[Tree] nodeKey is required in ${methodName}`);
  50959. };
  50960. const getNodePath = (data) => {
  50961. requireNodeKey("getNodePath");
  50962. const node = store.value.getNode(data);
  50963. if (!node) return [];
  50964. const path = [node.data];
  50965. let parent = node.parent;
  50966. while (parent && parent !== root.value) {
  50967. path.push(parent.data);
  50968. parent = parent.parent;
  50969. }
  50970. return path.reverse();
  50971. };
  50972. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  50973. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  50974. };
  50975. const getCheckedKeys = (leafOnly) => {
  50976. return store.value.getCheckedKeys(leafOnly);
  50977. };
  50978. const getCurrentNode = () => {
  50979. const currentNode = store.value.getCurrentNode();
  50980. return currentNode ? currentNode.data : null;
  50981. };
  50982. const getCurrentKey = () => {
  50983. requireNodeKey("getCurrentKey");
  50984. const currentNode = getCurrentNode();
  50985. return currentNode ? currentNode[props.nodeKey] : null;
  50986. };
  50987. const setCheckedNodes = (nodes, leafOnly) => {
  50988. requireNodeKey("setCheckedNodes");
  50989. store.value.setCheckedNodes(nodes, leafOnly);
  50990. };
  50991. const setCheckedKeys = (keys, leafOnly) => {
  50992. requireNodeKey("setCheckedKeys");
  50993. store.value.setCheckedKeys(keys, leafOnly);
  50994. };
  50995. const setChecked = (data, checked, deep) => {
  50996. store.value.setChecked(data, checked, deep);
  50997. };
  50998. const getHalfCheckedNodes = () => {
  50999. return store.value.getHalfCheckedNodes();
  51000. };
  51001. const getHalfCheckedKeys = () => {
  51002. return store.value.getHalfCheckedKeys();
  51003. };
  51004. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  51005. requireNodeKey("setCurrentNode");
  51006. handleCurrentChange(store, ctx.emit, () => {
  51007. broadcastExpanded(node);
  51008. store.value.setUserCurrentNode(node, shouldAutoExpandParent);
  51009. });
  51010. };
  51011. const setCurrentKey = (key = null, shouldAutoExpandParent = true) => {
  51012. requireNodeKey("setCurrentKey");
  51013. handleCurrentChange(store, ctx.emit, () => {
  51014. broadcastExpanded();
  51015. store.value.setCurrentNodeKey(key, shouldAutoExpandParent);
  51016. });
  51017. };
  51018. const getNode = (data) => {
  51019. return store.value.getNode(data);
  51020. };
  51021. const remove = (data) => {
  51022. store.value.remove(data);
  51023. };
  51024. const append = (data, parentNode) => {
  51025. store.value.append(data, parentNode);
  51026. };
  51027. const insertBefore = (data, refNode) => {
  51028. store.value.insertBefore(data, refNode);
  51029. };
  51030. const insertAfter = (data, refNode) => {
  51031. store.value.insertAfter(data, refNode);
  51032. };
  51033. const handleNodeExpand = (nodeData, node, instance) => {
  51034. broadcastExpanded(node);
  51035. ctx.emit("node-expand", nodeData, node, instance);
  51036. };
  51037. const updateKeyChildren = (key, data) => {
  51038. requireNodeKey("updateKeyChildren");
  51039. store.value.updateChildren(key, data);
  51040. };
  51041. provide(ROOT_TREE_INJECTION_KEY, {
  51042. ctx,
  51043. props,
  51044. store,
  51045. root,
  51046. currentNode,
  51047. instance
  51048. });
  51049. provide(formItemContextKey, void 0);
  51050. return {
  51051. ns,
  51052. store,
  51053. root,
  51054. currentNode,
  51055. dragState,
  51056. el$,
  51057. dropIndicator$,
  51058. isEmpty,
  51059. filter,
  51060. getNodeKey: getNodeKey$1,
  51061. getNodePath,
  51062. getCheckedNodes,
  51063. getCheckedKeys,
  51064. getCurrentNode,
  51065. getCurrentKey,
  51066. setCheckedNodes,
  51067. setCheckedKeys,
  51068. setChecked,
  51069. getHalfCheckedNodes,
  51070. getHalfCheckedKeys,
  51071. setCurrentNode,
  51072. setCurrentKey,
  51073. t,
  51074. getNode,
  51075. remove,
  51076. append,
  51077. insertBefore,
  51078. insertAfter,
  51079. handleNodeExpand,
  51080. updateKeyChildren
  51081. };
  51082. }
  51083. });
  51084. //#endregion
  51085. //#region ../../packages/components/tree/src/tree.vue
  51086. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  51087. const _component_el_tree_node = resolveComponent("el-tree-node");
  51088. return openBlock(), createElementBlock("div", {
  51089. ref: "el$",
  51090. class: normalizeClass([
  51091. _ctx.ns.b(),
  51092. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  51093. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  51094. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  51095. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  51096. ]),
  51097. role: "tree"
  51098. }, [
  51099. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.root.childNodes, (child) => {
  51100. return openBlock(), createBlock(_component_el_tree_node, {
  51101. key: _ctx.getNodeKey(child),
  51102. node: child,
  51103. props: _ctx.props,
  51104. accordion: _ctx.accordion,
  51105. "render-after-expand": _ctx.renderAfterExpand,
  51106. "show-checkbox": _ctx.showCheckbox,
  51107. "render-content": _ctx.renderContent,
  51108. onNodeExpand: _ctx.handleNodeExpand
  51109. }, null, 8, [
  51110. "node",
  51111. "props",
  51112. "accordion",
  51113. "render-after-expand",
  51114. "show-checkbox",
  51115. "render-content",
  51116. "onNodeExpand"
  51117. ]);
  51118. }), 128)),
  51119. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  51120. key: 0,
  51121. class: normalizeClass(_ctx.ns.e("empty-block"))
  51122. }, [renderSlot(_ctx.$slots, "empty", {}, () => [createElementVNode("span", { class: normalizeClass(_ctx.ns.e("empty-text")) }, toDisplayString(_ctx.emptyText ?? _ctx.t("el.tree.emptyText")), 3)])], 2)) : createCommentVNode("v-if", true),
  51123. withDirectives(createElementVNode("div", {
  51124. ref: "dropIndicator$",
  51125. class: normalizeClass(_ctx.ns.e("drop-indicator"))
  51126. }, null, 2), [[vShow, _ctx.dragState.showDropIndicator]])
  51127. ], 2);
  51128. }
  51129. var tree_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(tree_vue_vue_type_script_lang_default, [["render", _sfc_render$1]]);
  51130. //#endregion
  51131. //#region ../../packages/components/tree/index.ts
  51132. const ElTree = withInstall(tree_default$1);
  51133. //#endregion
  51134. //#region ../../packages/components/tree-select/src/select.ts
  51135. const useSelect = (props, { attrs, emit }, { select, tree, key }) => {
  51136. const ns = useNamespace("tree-select");
  51137. watch(() => props.data, () => {
  51138. if (props.filterable) nextTick(() => {
  51139. tree.value?.filter(select.value?.states.inputValue);
  51140. });
  51141. }, { flush: "post" });
  51142. const focusLastNode = (listNode) => {
  51143. const lastNode = listNode.at(-1);
  51144. if (lastNode.expanded && lastNode.childNodes.at(-1)) focusLastNode([lastNode.childNodes.at(-1)]);
  51145. else {
  51146. (tree.value.el$?.querySelector(`[data-key="${listNode.at(-1).key}"]`))?.focus({ preventScroll: true });
  51147. return;
  51148. }
  51149. };
  51150. onMounted(() => {
  51151. useEventListener(() => select.value?.$el, "keydown", async (evt) => {
  51152. const code = getEventCode(evt);
  51153. const { dropdownMenuVisible } = select.value;
  51154. if ([EVENT_CODE.down, EVENT_CODE.up].includes(code) && dropdownMenuVisible) {
  51155. await nextTick();
  51156. setTimeout(() => {
  51157. if (EVENT_CODE.up === code) {
  51158. const listNode = tree.value.store.root.childNodes;
  51159. focusLastNode(listNode);
  51160. return;
  51161. }
  51162. select.value.optionsArray[select.value.states.hoveringIndex].$el?.parentNode?.parentNode?.focus({ preventScroll: true });
  51163. });
  51164. }
  51165. }, { capture: true });
  51166. });
  51167. return {
  51168. ...pick(toRefs(props), Object.keys(ElSelect.props)),
  51169. ...attrs,
  51170. class: computed(() => attrs.class),
  51171. style: computed(() => attrs.style),
  51172. "onUpdate:modelValue": (value) => emit(UPDATE_MODEL_EVENT, value),
  51173. valueKey: key,
  51174. popperClass: computed(() => {
  51175. const classes = [ns.e("popper")];
  51176. if (props.popperClass) classes.push(props.popperClass);
  51177. return classes.join(" ");
  51178. }),
  51179. filterMethod: (keyword = "") => {
  51180. if (props.filterMethod) props.filterMethod(keyword);
  51181. else if (props.remoteMethod) props.remoteMethod(keyword);
  51182. else tree.value?.filter(keyword);
  51183. }
  51184. };
  51185. };
  51186. //#endregion
  51187. //#region ../../packages/components/tree-select/src/tree-select-option.ts
  51188. const component = defineComponent({
  51189. extends: ElOption,
  51190. setup(props, ctx) {
  51191. const result = ElOption.setup(props, ctx);
  51192. delete result.selectOptionClick;
  51193. const vm = getCurrentInstance().proxy;
  51194. nextTick(() => {
  51195. if (!result.select.states.cachedOptions.get(vm.value)) result.select.onOptionCreate(vm);
  51196. });
  51197. watch(() => ctx.attrs.visible, (val) => {
  51198. nextTick(() => {
  51199. result.states.visible = val;
  51200. });
  51201. }, { immediate: true });
  51202. return result;
  51203. },
  51204. methods: { selectOptionClick() {
  51205. this.$el.parentElement.click();
  51206. } }
  51207. });
  51208. //#endregion
  51209. //#region ../../packages/components/tree-select/src/utils.ts
  51210. function isValidValue(val) {
  51211. return val || val === 0;
  51212. }
  51213. function isValidArray(val) {
  51214. return isArray$1(val) && val.length;
  51215. }
  51216. function toValidArray(val) {
  51217. return isArray$1(val) ? val : isValidValue(val) ? [val] : [];
  51218. }
  51219. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  51220. for (let i = 0; i < treeData.length; i++) {
  51221. const data = treeData[i];
  51222. if (findCallback(data, i, treeData, parent)) return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  51223. else {
  51224. const children = getChildren(data);
  51225. if (isValidArray(children)) {
  51226. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  51227. if (find) return find;
  51228. }
  51229. }
  51230. }
  51231. }
  51232. function treeEach(treeData, callback, getChildren, parent) {
  51233. for (let i = 0; i < treeData.length; i++) {
  51234. const data = treeData[i];
  51235. callback(data, i, treeData, parent);
  51236. const children = getChildren(data);
  51237. if (isValidArray(children)) treeEach(children, callback, getChildren, data);
  51238. }
  51239. }
  51240. //#endregion
  51241. //#region ../../packages/components/tree-select/src/tree.ts
  51242. const useTree$1 = (props, { attrs, slots, emit }, { select, tree, key }) => {
  51243. watch([() => props.modelValue, tree], () => {
  51244. if (props.showCheckbox) nextTick(() => {
  51245. const treeInstance = tree.value;
  51246. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  51247. });
  51248. }, {
  51249. immediate: true,
  51250. deep: true
  51251. });
  51252. const propsMap = computed(() => ({
  51253. value: key.value,
  51254. label: "label",
  51255. children: "children",
  51256. disabled: "disabled",
  51257. isLeaf: "isLeaf",
  51258. ...props.props
  51259. }));
  51260. const getNodeValByProp = (prop, data) => {
  51261. const propVal = propsMap.value[prop];
  51262. if (isFunction$1(propVal)) return propVal(data, tree.value?.getNode(getNodeValByProp("value", data)));
  51263. else return data[propVal];
  51264. };
  51265. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  51266. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  51267. }).filter((item) => isValidValue(item));
  51268. const cacheOptions = computed(() => {
  51269. if (!props.renderAfterExpand && !props.lazy) return [];
  51270. const options = [];
  51271. treeEach(props.data.concat(props.cacheData), (node) => {
  51272. const value = getNodeValByProp("value", node);
  51273. options.push({
  51274. value,
  51275. currentLabel: getNodeValByProp("label", node),
  51276. isDisabled: getNodeValByProp("disabled", node)
  51277. });
  51278. }, (data) => getNodeValByProp("children", data));
  51279. return options;
  51280. });
  51281. const getChildCheckedKeys = () => {
  51282. return tree.value?.getCheckedKeys().filter((checkedKey) => {
  51283. const node = tree.value?.getNode(checkedKey);
  51284. return !isNil(node) && isEmpty(node.childNodes);
  51285. });
  51286. };
  51287. const emitChange = (val) => {
  51288. if (!isEqual$1(props.modelValue, val)) emit(CHANGE_EVENT, val);
  51289. };
  51290. function update(val) {
  51291. emit(UPDATE_MODEL_EVENT, val);
  51292. emitChange(val);
  51293. }
  51294. return {
  51295. ...pick(toRefs(props), Object.keys(ElTree.props)),
  51296. ...attrs,
  51297. nodeKey: key,
  51298. expandOnClickNode: computed(() => {
  51299. return !props.checkStrictly && props.expandOnClickNode;
  51300. }),
  51301. defaultExpandedKeys: computed(() => {
  51302. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  51303. }),
  51304. renderContent: (h, { node, data, store }) => {
  51305. return h(component, {
  51306. value: getNodeValByProp("value", data),
  51307. label: getNodeValByProp("label", data),
  51308. disabled: getNodeValByProp("disabled", data),
  51309. visible: node.visible
  51310. }, props.renderContent ? () => props.renderContent(h, {
  51311. node,
  51312. data,
  51313. store
  51314. }) : slots.default ? () => slots.default({
  51315. node,
  51316. data,
  51317. store
  51318. }) : void 0);
  51319. },
  51320. filterNodeMethod: (value, data, node) => {
  51321. if (props.filterNodeMethod) return props.filterNodeMethod(value, data, node);
  51322. if (!value) return true;
  51323. return new RegExp(escapeStringRegexp(value), "i").test(getNodeValByProp("label", data) || "");
  51324. },
  51325. onNodeClick: (data, node, e) => {
  51326. attrs.onNodeClick?.(data, node, e);
  51327. if (props.showCheckbox && props.checkOnClickNode) return;
  51328. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  51329. if (!getNodeValByProp("disabled", data)) {
  51330. const option = select.value?.states.options.get(getNodeValByProp("value", data));
  51331. select.value?.handleOptionSelect(option);
  51332. }
  51333. } else if (props.expandOnClickNode) e.proxy.handleExpandIconClick();
  51334. },
  51335. onCheck: (data, params) => {
  51336. if (!props.showCheckbox) return;
  51337. const dataValue = getNodeValByProp("value", data);
  51338. const dataMap = {};
  51339. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  51340. const uncachedCheckedKeys = params.checkedKeys;
  51341. const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item)) : [];
  51342. const checkedKeys = cachedKeys.concat(uncachedCheckedKeys);
  51343. if (props.checkStrictly) update(props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
  51344. else if (props.multiple) {
  51345. const childKeys = getChildCheckedKeys();
  51346. update(cachedKeys.concat(childKeys));
  51347. } else {
  51348. const firstLeaf = treeFind([data], (data) => !isValidArray(getNodeValByProp("children", data)) && !getNodeValByProp("disabled", data), (data) => getNodeValByProp("children", data));
  51349. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  51350. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data) => getNodeValByProp("value", data) === props.modelValue, (data) => getNodeValByProp("children", data));
  51351. update(firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  51352. }
  51353. nextTick(() => {
  51354. const checkedKeys = toValidArray(props.modelValue);
  51355. tree.value.setCheckedKeys(checkedKeys);
  51356. attrs.onCheck?.(data, {
  51357. checkedKeys: tree.value.getCheckedKeys(),
  51358. checkedNodes: tree.value.getCheckedNodes(),
  51359. halfCheckedKeys: tree.value.getHalfCheckedKeys(),
  51360. halfCheckedNodes: tree.value.getHalfCheckedNodes()
  51361. });
  51362. });
  51363. select.value?.focus();
  51364. },
  51365. onNodeExpand: (data, node, e) => {
  51366. attrs.onNodeExpand?.(data, node, e);
  51367. nextTick(() => {
  51368. if (!props.checkStrictly && props.lazy && props.multiple && node.checked) {
  51369. const dataMap = {};
  51370. const uncachedCheckedKeys = tree.value.getCheckedKeys();
  51371. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  51372. const cachedKeys = toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item));
  51373. const childKeys = getChildCheckedKeys();
  51374. update(cachedKeys.concat(childKeys));
  51375. }
  51376. });
  51377. },
  51378. cacheOptions
  51379. };
  51380. };
  51381. //#endregion
  51382. //#region ../../packages/components/tree-select/src/cache-options.ts
  51383. var cache_options_default = defineComponent({
  51384. props: { data: {
  51385. type: Array,
  51386. default: () => []
  51387. } },
  51388. setup(props) {
  51389. const select = inject(selectKey);
  51390. watch(() => props.data, () => {
  51391. props.data.forEach((item) => {
  51392. if (!select.states.cachedOptions.has(item.value)) select.states.cachedOptions.set(item.value, item);
  51393. });
  51394. const inputs = select.selectRef?.querySelectorAll("input") || [];
  51395. if (isClient && !Array.from(inputs).includes(document.activeElement)) select.setSelected();
  51396. }, {
  51397. flush: "post",
  51398. immediate: true
  51399. });
  51400. return () => void 0;
  51401. }
  51402. });
  51403. //#endregion
  51404. //#region ../../packages/components/tree-select/src/tree-select.vue?vue&type=script&lang.ts
  51405. var tree_select_vue_vue_type_script_lang_default = defineComponent({
  51406. name: "ElTreeSelect",
  51407. inheritAttrs: false,
  51408. props: {
  51409. ...selectProps,
  51410. ...treeProps,
  51411. cacheData: {
  51412. type: Array,
  51413. default: () => []
  51414. }
  51415. },
  51416. setup(props, context) {
  51417. const { slots, expose, emit, attrs } = context;
  51418. const childAttrs = {
  51419. ...attrs,
  51420. onChange: void 0
  51421. };
  51422. const select = ref();
  51423. const tree = ref();
  51424. const key = computed(() => props.nodeKey || props.valueKey || "value");
  51425. const selectProps = useSelect(props, {
  51426. attrs,
  51427. emit
  51428. }, {
  51429. select,
  51430. tree,
  51431. key
  51432. });
  51433. const { cacheOptions, ...treeProps } = useTree$1(props, {
  51434. attrs: childAttrs,
  51435. slots,
  51436. emit
  51437. }, {
  51438. select,
  51439. tree,
  51440. key
  51441. });
  51442. const methods = reactive({});
  51443. expose(methods);
  51444. onMounted(() => {
  51445. Object.assign(methods, {
  51446. ...pick(tree.value, [
  51447. "filter",
  51448. "updateKeyChildren",
  51449. "getCheckedNodes",
  51450. "setCheckedNodes",
  51451. "getCheckedKeys",
  51452. "setCheckedKeys",
  51453. "setChecked",
  51454. "getHalfCheckedNodes",
  51455. "getHalfCheckedKeys",
  51456. "getCurrentKey",
  51457. "getCurrentNode",
  51458. "setCurrentKey",
  51459. "setCurrentNode",
  51460. "getNode",
  51461. "remove",
  51462. "append",
  51463. "insertBefore",
  51464. "insertAfter"
  51465. ]),
  51466. ...pick(select.value, [
  51467. "focus",
  51468. "blur",
  51469. "selectedLabel"
  51470. ]),
  51471. treeRef: tree.value,
  51472. selectRef: select.value
  51473. });
  51474. });
  51475. return () => h(
  51476. ElSelect,
  51477. /**
  51478. * 1. The `props` is processed into `Refs`, but `v-bind` and
  51479. * render function props cannot read `Refs`, so use `reactive`
  51480. * unwrap the `Refs` and keep reactive.
  51481. * 2. The keyword `ref` requires `Ref`, but `reactive` broke it,
  51482. * so use function.
  51483. */
  51484. reactive({
  51485. ...selectProps,
  51486. ref: (ref) => select.value = ref
  51487. }),
  51488. {
  51489. ...slots,
  51490. default: () => [h(cache_options_default, { data: cacheOptions.value }), h(ElTree, reactive({
  51491. ...treeProps,
  51492. ref: (ref) => tree.value = ref
  51493. }))]
  51494. }
  51495. );
  51496. }
  51497. });
  51498. //#endregion
  51499. //#region ../../packages/components/tree-select/src/tree-select.vue
  51500. var tree_select_default = tree_select_vue_vue_type_script_lang_default;
  51501. //#endregion
  51502. //#region ../../packages/components/tree-select/index.ts
  51503. const ElTreeSelect = withInstall(tree_select_default);
  51504. //#endregion
  51505. //#region ../../packages/components/tree-v2/src/virtual-tree.ts
  51506. const ROOT_TREE_INJECTION_KEY$1 = Symbol();
  51507. const EMPTY_NODE = {
  51508. key: -1,
  51509. level: -1,
  51510. data: {}
  51511. };
  51512. let TreeOptionsEnum = /* @__PURE__ */ function(TreeOptionsEnum) {
  51513. TreeOptionsEnum["KEY"] = "id";
  51514. TreeOptionsEnum["LABEL"] = "label";
  51515. TreeOptionsEnum["CHILDREN"] = "children";
  51516. TreeOptionsEnum["DISABLED"] = "disabled";
  51517. TreeOptionsEnum["CLASS"] = "";
  51518. return TreeOptionsEnum;
  51519. }({});
  51520. let SetOperationEnum = /* @__PURE__ */ function(SetOperationEnum) {
  51521. SetOperationEnum["ADD"] = "add";
  51522. SetOperationEnum["DELETE"] = "delete";
  51523. return SetOperationEnum;
  51524. }({});
  51525. const itemSize = {
  51526. type: Number,
  51527. default: 26
  51528. };
  51529. /**
  51530. * @deprecated Removed after 3.0.0, Use `TreeProps` instead.
  51531. */
  51532. const treeProps$1 = buildProps({
  51533. data: {
  51534. type: definePropType(Array),
  51535. default: () => mutable([])
  51536. },
  51537. emptyText: { type: String },
  51538. height: {
  51539. type: Number,
  51540. default: 200
  51541. },
  51542. props: {
  51543. type: definePropType(Object),
  51544. default: () => mutable({
  51545. children: TreeOptionsEnum.CHILDREN,
  51546. label: TreeOptionsEnum.LABEL,
  51547. disabled: TreeOptionsEnum.DISABLED,
  51548. value: TreeOptionsEnum.KEY,
  51549. class: TreeOptionsEnum.CLASS
  51550. })
  51551. },
  51552. highlightCurrent: Boolean,
  51553. showCheckbox: Boolean,
  51554. defaultCheckedKeys: {
  51555. type: definePropType(Array),
  51556. default: () => mutable([])
  51557. },
  51558. checkStrictly: Boolean,
  51559. defaultExpandedKeys: {
  51560. type: definePropType(Array),
  51561. default: () => mutable([])
  51562. },
  51563. indent: {
  51564. type: Number,
  51565. default: 16
  51566. },
  51567. itemSize,
  51568. icon: { type: iconPropType },
  51569. expandOnClickNode: {
  51570. type: Boolean,
  51571. default: true
  51572. },
  51573. checkOnClickNode: Boolean,
  51574. checkOnClickLeaf: {
  51575. type: Boolean,
  51576. default: true
  51577. },
  51578. currentNodeKey: { type: definePropType([String, Number]) },
  51579. accordion: Boolean,
  51580. filterMethod: { type: definePropType(Function) },
  51581. perfMode: {
  51582. type: Boolean,
  51583. default: true
  51584. },
  51585. scrollbarAlwaysOn: Boolean
  51586. });
  51587. /**
  51588. * @deprecated Removed after 3.0.0, Use `TreeNodeProps` instead.
  51589. */
  51590. const treeNodeProps = buildProps({
  51591. node: {
  51592. type: definePropType(Object),
  51593. default: () => mutable(EMPTY_NODE)
  51594. },
  51595. expanded: Boolean,
  51596. checked: Boolean,
  51597. indeterminate: Boolean,
  51598. showCheckbox: Boolean,
  51599. disabled: Boolean,
  51600. current: Boolean,
  51601. hiddenExpandIcon: Boolean,
  51602. itemSize
  51603. });
  51604. const treeNodeContentProps = buildProps({ node: {
  51605. type: definePropType(Object),
  51606. required: true
  51607. } });
  51608. const NODE_CLICK = "node-click";
  51609. const NODE_DROP = "node-drop";
  51610. const NODE_EXPAND = "node-expand";
  51611. const NODE_COLLAPSE = "node-collapse";
  51612. const CURRENT_CHANGE = "current-change";
  51613. const NODE_CHECK = "check";
  51614. const NODE_CHECK_CHANGE = "check-change";
  51615. const NODE_CONTEXTMENU = "node-contextmenu";
  51616. const treeEmits$1 = {
  51617. [NODE_CLICK]: (data, node, e) => data && node && e,
  51618. [NODE_DROP]: (data, node, e) => data && node && e,
  51619. [NODE_EXPAND]: (data, node) => data && node,
  51620. [NODE_COLLAPSE]: (data, node) => data && node,
  51621. [CURRENT_CHANGE]: (data, node) => data && node,
  51622. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  51623. [NODE_CHECK_CHANGE]: (data, checked) => data && isBoolean(checked),
  51624. [NODE_CONTEXTMENU]: (evt, data, node) => evt && data && node
  51625. };
  51626. const treeNodeEmits = {
  51627. click: (node, e) => !!(node && e),
  51628. drop: (node, e) => !!(node && e),
  51629. toggle: (node) => !!node,
  51630. check: (node, checked) => node && isBoolean(checked)
  51631. };
  51632. //#endregion
  51633. //#region ../../packages/components/tree-v2/src/composables/useCheck.ts
  51634. function useCheck(props, tree) {
  51635. const checkedKeys = ref(/* @__PURE__ */ new Set());
  51636. const indeterminateKeys = ref(/* @__PURE__ */ new Set());
  51637. const { emit } = getCurrentInstance();
  51638. watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  51639. return nextTick(() => {
  51640. _setCheckedKeys(props.defaultCheckedKeys);
  51641. });
  51642. }, { immediate: true });
  51643. const updateCheckedKeys = () => {
  51644. if (!tree.value || !props.showCheckbox || props.checkStrictly) return;
  51645. const { levelTreeNodeMap, maxLevel } = tree.value;
  51646. const checkedKeySet = checkedKeys.value;
  51647. const indeterminateKeySet = /* @__PURE__ */ new Set();
  51648. for (let level = maxLevel; level >= 1; --level) {
  51649. const nodes = levelTreeNodeMap.get(level);
  51650. if (!nodes) continue;
  51651. nodes.forEach((node) => {
  51652. const children = node.children;
  51653. let isEffectivelyChecked = !node.isLeaf || node.disabled || checkedKeySet.has(node.key);
  51654. if (children) {
  51655. let allChecked = true;
  51656. let hasChecked = false;
  51657. for (const childNode of children) {
  51658. const key = childNode.key;
  51659. if (!childNode.isEffectivelyChecked) isEffectivelyChecked = false;
  51660. if (checkedKeySet.has(key)) hasChecked = true;
  51661. else if (indeterminateKeySet.has(key)) {
  51662. allChecked = false;
  51663. hasChecked = true;
  51664. break;
  51665. } else allChecked = false;
  51666. }
  51667. if (allChecked) checkedKeySet.add(node.key);
  51668. else if (hasChecked) {
  51669. indeterminateKeySet.add(node.key);
  51670. checkedKeySet.delete(node.key);
  51671. } else {
  51672. checkedKeySet.delete(node.key);
  51673. indeterminateKeySet.delete(node.key);
  51674. }
  51675. }
  51676. node.isEffectivelyChecked = isEffectivelyChecked;
  51677. });
  51678. }
  51679. indeterminateKeys.value = indeterminateKeySet;
  51680. };
  51681. const isChecked = (node) => checkedKeys.value.has(node.key);
  51682. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  51683. const toggleCheckbox = (node, isChecked, nodeClick = true, immediateUpdate = true) => {
  51684. const checkedKeySet = checkedKeys.value;
  51685. const children = node.children;
  51686. if (!props.checkStrictly && nodeClick && children?.length) isChecked = children.some((node) => !node.isEffectivelyChecked);
  51687. const toggle = (node, checked) => {
  51688. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node.key);
  51689. const children = node.children;
  51690. if (!props.checkStrictly && children) children.forEach((childNode) => {
  51691. if (!childNode.disabled || childNode.children) toggle(childNode, checked);
  51692. });
  51693. };
  51694. toggle(node, isChecked);
  51695. if (immediateUpdate) updateCheckedKeys();
  51696. if (nodeClick) afterNodeCheck(node, isChecked);
  51697. };
  51698. const afterNodeCheck = (node, checked) => {
  51699. const { checkedNodes, checkedKeys } = getChecked();
  51700. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  51701. emit(NODE_CHECK, node.data, {
  51702. checkedKeys,
  51703. checkedNodes,
  51704. halfCheckedKeys,
  51705. halfCheckedNodes
  51706. });
  51707. emit(NODE_CHECK_CHANGE, node.data, checked);
  51708. };
  51709. function getCheckedKeys(leafOnly = false) {
  51710. return getChecked(leafOnly).checkedKeys;
  51711. }
  51712. function getCheckedNodes(leafOnly = false) {
  51713. return getChecked(leafOnly).checkedNodes;
  51714. }
  51715. function getHalfCheckedKeys() {
  51716. return getHalfChecked().halfCheckedKeys;
  51717. }
  51718. function getHalfCheckedNodes() {
  51719. return getHalfChecked().halfCheckedNodes;
  51720. }
  51721. function getChecked(leafOnly = false) {
  51722. const checkedNodes = [];
  51723. const keys = [];
  51724. if (tree?.value && props.showCheckbox) {
  51725. const { treeNodeMap } = tree.value;
  51726. checkedKeys.value.forEach((key) => {
  51727. const node = treeNodeMap.get(key);
  51728. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  51729. keys.push(key);
  51730. checkedNodes.push(node.data);
  51731. }
  51732. });
  51733. }
  51734. return {
  51735. checkedKeys: keys,
  51736. checkedNodes
  51737. };
  51738. }
  51739. function getHalfChecked() {
  51740. const halfCheckedNodes = [];
  51741. const halfCheckedKeys = [];
  51742. if (tree?.value && props.showCheckbox) {
  51743. const { treeNodeMap } = tree.value;
  51744. indeterminateKeys.value.forEach((key) => {
  51745. const node = treeNodeMap.get(key);
  51746. if (node) {
  51747. halfCheckedKeys.push(key);
  51748. halfCheckedNodes.push(node.data);
  51749. }
  51750. });
  51751. }
  51752. return {
  51753. halfCheckedNodes,
  51754. halfCheckedKeys
  51755. };
  51756. }
  51757. function setCheckedKeys(keys) {
  51758. checkedKeys.value.clear();
  51759. indeterminateKeys.value.clear();
  51760. nextTick(() => {
  51761. _setCheckedKeys(keys);
  51762. });
  51763. }
  51764. function setChecked(key, isChecked) {
  51765. if (tree?.value && props.showCheckbox) {
  51766. const node = tree.value.treeNodeMap.get(key);
  51767. if (node) toggleCheckbox(node, isChecked, false);
  51768. }
  51769. }
  51770. function _setCheckedKeys(keys) {
  51771. if (tree?.value) {
  51772. const { treeNodeMap } = tree.value;
  51773. if (props.showCheckbox && treeNodeMap && keys?.length > 0) {
  51774. for (const key of keys) {
  51775. const node = treeNodeMap.get(key);
  51776. if (node && !isChecked(node)) toggleCheckbox(node, true, false, false);
  51777. }
  51778. updateCheckedKeys();
  51779. }
  51780. }
  51781. }
  51782. return {
  51783. updateCheckedKeys,
  51784. toggleCheckbox,
  51785. isChecked,
  51786. isIndeterminate,
  51787. getCheckedKeys,
  51788. getCheckedNodes,
  51789. getHalfCheckedKeys,
  51790. getHalfCheckedNodes,
  51791. setChecked,
  51792. setCheckedKeys
  51793. };
  51794. }
  51795. //#endregion
  51796. //#region ../../packages/components/tree-v2/src/composables/useFilter.ts
  51797. function useFilter(props, tree) {
  51798. const hiddenNodeKeySet = ref(/* @__PURE__ */ new Set([]));
  51799. const hiddenExpandIconKeySet = ref(/* @__PURE__ */ new Set([]));
  51800. const filterable = computed(() => {
  51801. return isFunction$1(props.filterMethod);
  51802. });
  51803. function doFilter(query) {
  51804. if (!filterable.value) return;
  51805. const expandKeySet = /* @__PURE__ */ new Set();
  51806. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  51807. const hiddenKeys = hiddenNodeKeySet.value;
  51808. const family = [];
  51809. const nodes = tree.value?.treeNodes || [];
  51810. const filter = props.filterMethod;
  51811. hiddenKeys.clear();
  51812. function traverse(nodes) {
  51813. nodes.forEach((node) => {
  51814. family.push(node);
  51815. if (filter?.(query, node.data, node)) family.forEach((member) => {
  51816. expandKeySet.add(member.key);
  51817. member.expanded = true;
  51818. });
  51819. else {
  51820. node.expanded = false;
  51821. if (node.isLeaf) hiddenKeys.add(node.key);
  51822. }
  51823. const children = node.children;
  51824. if (children) traverse(children);
  51825. if (!node.isLeaf) {
  51826. if (!expandKeySet.has(node.key)) hiddenKeys.add(node.key);
  51827. else if (children) {
  51828. let allHidden = true;
  51829. for (const childNode of children) if (!hiddenKeys.has(childNode.key)) {
  51830. allHidden = false;
  51831. break;
  51832. }
  51833. if (allHidden) hiddenExpandIconKeys.add(node.key);
  51834. else hiddenExpandIconKeys.delete(node.key);
  51835. }
  51836. }
  51837. family.pop();
  51838. });
  51839. }
  51840. traverse(nodes);
  51841. return expandKeySet;
  51842. }
  51843. function isForceHiddenExpandIcon(node) {
  51844. return hiddenExpandIconKeySet.value.has(node.key);
  51845. }
  51846. return {
  51847. hiddenExpandIconKeySet,
  51848. hiddenNodeKeySet,
  51849. doFilter,
  51850. isForceHiddenExpandIcon
  51851. };
  51852. }
  51853. //#endregion
  51854. //#region ../../packages/components/tree-v2/src/composables/useTree.ts
  51855. function useTree(props, emit) {
  51856. const expandedKeySet = ref(/* @__PURE__ */ new Set());
  51857. const currentKey = ref();
  51858. const tree = shallowRef();
  51859. const listRef = ref();
  51860. const { isIndeterminate, isChecked, toggleCheckbox, getCheckedKeys, getCheckedNodes, getHalfCheckedKeys, getHalfCheckedNodes, setChecked, setCheckedKeys } = useCheck(props, tree);
  51861. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  51862. const valueKey = computed(() => {
  51863. return props.props?.value || TreeOptionsEnum.KEY;
  51864. });
  51865. const childrenKey = computed(() => {
  51866. return props.props?.children || TreeOptionsEnum.CHILDREN;
  51867. });
  51868. const disabledKey = computed(() => {
  51869. return props.props?.disabled || TreeOptionsEnum.DISABLED;
  51870. });
  51871. const labelKey = computed(() => {
  51872. return props.props?.label || TreeOptionsEnum.LABEL;
  51873. });
  51874. const flattenTree = computed(() => {
  51875. const expandedKeys = expandedKeySet.value;
  51876. const hiddenKeys = hiddenNodeKeySet.value;
  51877. const flattenNodes = [];
  51878. const nodes = tree.value?.treeNodes || [];
  51879. const stack = [];
  51880. for (let i = nodes.length - 1; i >= 0; --i) stack.push(nodes[i]);
  51881. while (stack.length) {
  51882. const node = stack.pop();
  51883. if (hiddenKeys.has(node.key)) continue;
  51884. flattenNodes.push(node);
  51885. if (node.children && expandedKeys.has(node.key)) for (let i = node.children.length - 1; i >= 0; --i) stack.push(node.children[i]);
  51886. }
  51887. return flattenNodes;
  51888. });
  51889. const isNotEmpty = computed(() => {
  51890. return flattenTree.value.length > 0;
  51891. });
  51892. function createTree(data) {
  51893. const treeNodeMap = /* @__PURE__ */ new Map();
  51894. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  51895. let maxLevel = 1;
  51896. function traverse(nodes, level = 1, parent = void 0) {
  51897. const siblings = [];
  51898. for (const rawNode of nodes) {
  51899. const value = getKey(rawNode);
  51900. const node = {
  51901. level,
  51902. key: value,
  51903. data: rawNode
  51904. };
  51905. node.label = getLabel(rawNode);
  51906. node.parent = parent;
  51907. const children = getChildren(rawNode);
  51908. node.disabled = getDisabled(rawNode);
  51909. node.isLeaf = !children || children.length === 0;
  51910. node.expanded = expandedKeySet.value.has(value);
  51911. if (children && children.length) node.children = traverse(children, level + 1, node);
  51912. siblings.push(node);
  51913. treeNodeMap.set(value, node);
  51914. if (!levelTreeNodeMap.has(level)) levelTreeNodeMap.set(level, []);
  51915. levelTreeNodeMap.get(level)?.push(node);
  51916. }
  51917. if (level > maxLevel) maxLevel = level;
  51918. return siblings;
  51919. }
  51920. const treeNodes = traverse(data);
  51921. return {
  51922. treeNodeMap,
  51923. levelTreeNodeMap,
  51924. maxLevel,
  51925. treeNodes
  51926. };
  51927. }
  51928. function filter(query) {
  51929. const keys = doFilter(query);
  51930. if (keys) expandedKeySet.value = keys;
  51931. }
  51932. function getChildren(node) {
  51933. return node[childrenKey.value];
  51934. }
  51935. function getKey(node) {
  51936. if (!node) return "";
  51937. return node[valueKey.value];
  51938. }
  51939. function getDisabled(node) {
  51940. return node[disabledKey.value];
  51941. }
  51942. function getLabel(node) {
  51943. return node[labelKey.value];
  51944. }
  51945. function toggleExpand(node) {
  51946. if (expandedKeySet.value.has(node.key)) collapseNode(node);
  51947. else expandNode(node);
  51948. }
  51949. function setExpandedKeys(keys) {
  51950. const expandedKeys = /* @__PURE__ */ new Set();
  51951. const nodeMap = tree.value.treeNodeMap;
  51952. expandedKeySet.value.forEach((key) => {
  51953. const node = nodeMap.get(key);
  51954. if (node) node.expanded = false;
  51955. });
  51956. keys.forEach((k) => {
  51957. let node = nodeMap.get(k);
  51958. while (node && !expandedKeys.has(node.key)) {
  51959. expandedKeys.add(node.key);
  51960. node.expanded = true;
  51961. node = node.parent;
  51962. }
  51963. });
  51964. expandedKeySet.value = expandedKeys;
  51965. }
  51966. function handleNodeClick(node, e) {
  51967. emit(NODE_CLICK, node.data, node, e);
  51968. handleCurrentChange(node);
  51969. if (props.expandOnClickNode) toggleExpand(node);
  51970. if (props.showCheckbox && (props.checkOnClickNode || node.isLeaf && props.checkOnClickLeaf) && !node.disabled) toggleCheckbox(node, !isChecked(node), true);
  51971. }
  51972. function handleNodeDrop(node, e) {
  51973. emit(NODE_DROP, node.data, node, e);
  51974. }
  51975. function handleCurrentChange(node) {
  51976. if (!isCurrent(node)) {
  51977. currentKey.value = node.key;
  51978. emit(CURRENT_CHANGE, node.data, node);
  51979. }
  51980. }
  51981. function handleNodeCheck(node, checked) {
  51982. toggleCheckbox(node, checked);
  51983. }
  51984. function expandNode(node) {
  51985. const keySet = expandedKeySet.value;
  51986. if (tree.value && props.accordion) {
  51987. const { treeNodeMap } = tree.value;
  51988. keySet.forEach((key) => {
  51989. const treeNode = treeNodeMap.get(key);
  51990. if (node && node.level === treeNode?.level) {
  51991. keySet.delete(key);
  51992. treeNode.expanded = false;
  51993. }
  51994. });
  51995. }
  51996. keySet.add(node.key);
  51997. const _node = getNode(node.key);
  51998. if (_node) {
  51999. _node.expanded = true;
  52000. emit(NODE_EXPAND, _node.data, _node);
  52001. }
  52002. }
  52003. function collapseNode(node) {
  52004. expandedKeySet.value.delete(node.key);
  52005. const _node = getNode(node.key);
  52006. if (_node) {
  52007. _node.expanded = false;
  52008. emit(NODE_COLLAPSE, _node.data, _node);
  52009. }
  52010. }
  52011. function isDisabled(node) {
  52012. return !!node.disabled;
  52013. }
  52014. function isCurrent(node) {
  52015. const current = currentKey.value;
  52016. return current !== void 0 && current === node.key;
  52017. }
  52018. function getCurrentNode() {
  52019. if (!currentKey.value) return void 0;
  52020. return tree.value?.treeNodeMap.get(currentKey.value)?.data;
  52021. }
  52022. function getCurrentKey() {
  52023. return currentKey.value;
  52024. }
  52025. function setCurrentKey(key) {
  52026. currentKey.value = key;
  52027. }
  52028. function setData(data) {
  52029. tree.value = createTree(data);
  52030. }
  52031. function getNode(data) {
  52032. const key = isObject$1(data) ? getKey(data) : data;
  52033. return tree.value?.treeNodeMap.get(key);
  52034. }
  52035. function scrollToNode(key, strategy = "auto") {
  52036. const node = getNode(key);
  52037. if (node && listRef.value) listRef.value.scrollToItem(flattenTree.value.indexOf(node), strategy);
  52038. }
  52039. function scrollTo(offset) {
  52040. listRef.value?.scrollTo(offset);
  52041. }
  52042. watch(() => props.currentNodeKey, (key) => {
  52043. currentKey.value = key;
  52044. }, { immediate: true });
  52045. watch(() => props.defaultExpandedKeys, (keys) => {
  52046. setExpandedKeys(keys || []);
  52047. });
  52048. watch(() => props.data, (data) => {
  52049. setData(data);
  52050. setExpandedKeys(props.defaultExpandedKeys || []);
  52051. }, { immediate: true });
  52052. return {
  52053. tree,
  52054. flattenTree,
  52055. isNotEmpty,
  52056. listRef,
  52057. getKey,
  52058. getChildren,
  52059. toggleExpand,
  52060. toggleCheckbox,
  52061. isChecked,
  52062. isIndeterminate,
  52063. isDisabled,
  52064. isCurrent,
  52065. isForceHiddenExpandIcon,
  52066. handleNodeClick,
  52067. handleNodeDrop,
  52068. handleNodeCheck,
  52069. getCurrentNode,
  52070. getCurrentKey,
  52071. setCurrentKey,
  52072. getCheckedKeys,
  52073. getCheckedNodes,
  52074. getHalfCheckedKeys,
  52075. getHalfCheckedNodes,
  52076. setChecked,
  52077. setCheckedKeys,
  52078. filter,
  52079. setData,
  52080. getNode,
  52081. expandNode,
  52082. collapseNode,
  52083. setExpandedKeys,
  52084. scrollToNode,
  52085. scrollTo
  52086. };
  52087. }
  52088. //#endregion
  52089. //#region ../../packages/components/tree-v2/src/tree-node-content.ts
  52090. var tree_node_content_default = defineComponent({
  52091. name: "ElTreeNodeContent",
  52092. props: treeNodeContentProps,
  52093. setup(props) {
  52094. const tree = inject(ROOT_TREE_INJECTION_KEY$1);
  52095. const ns = useNamespace("tree");
  52096. return () => {
  52097. const node = props.node;
  52098. const { data } = node;
  52099. return tree?.ctx.slots.default ? tree.ctx.slots.default({
  52100. node,
  52101. data
  52102. }) : h(ElText, {
  52103. tag: "span",
  52104. truncated: true,
  52105. class: ns.be("node", "label")
  52106. }, () => [node?.label]);
  52107. };
  52108. }
  52109. });
  52110. //#endregion
  52111. //#region ../../packages/components/tree-v2/src/tree-node.vue?vue&type=script&setup=true&lang.ts
  52112. const _hoisted_1$11 = [
  52113. "aria-expanded",
  52114. "aria-disabled",
  52115. "aria-checked",
  52116. "data-key"
  52117. ];
  52118. var tree_node_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  52119. name: "ElTreeNode",
  52120. __name: "tree-node",
  52121. props: treeNodeProps,
  52122. emits: treeNodeEmits,
  52123. setup(__props, { emit: __emit }) {
  52124. const props = __props;
  52125. const emit = __emit;
  52126. const tree = inject(ROOT_TREE_INJECTION_KEY$1);
  52127. const ns = useNamespace("tree");
  52128. const indent = computed(() => tree?.props.indent ?? 16);
  52129. const icon = computed(() => tree?.props.icon ?? caret_right_default);
  52130. const getNodeClass = (node) => {
  52131. const nodeClassFunc = tree?.props.props?.class;
  52132. if (!nodeClassFunc) return {};
  52133. let className;
  52134. if (isFunction$1(nodeClassFunc)) {
  52135. const { data } = node;
  52136. className = nodeClassFunc(data, node);
  52137. } else className = nodeClassFunc;
  52138. return isString(className) ? { [className]: true } : className;
  52139. };
  52140. const handleClick = (e) => {
  52141. emit("click", props.node, e);
  52142. };
  52143. const handleDrop = (e) => {
  52144. emit("drop", props.node, e);
  52145. };
  52146. const handleExpandIconClick = () => {
  52147. emit("toggle", props.node);
  52148. };
  52149. const handleCheckChange = (value) => {
  52150. emit("check", props.node, value);
  52151. };
  52152. const handleContextMenu = (event) => {
  52153. if (tree?.instance?.vnode?.props?.["onNodeContextmenu"]) {
  52154. event.stopPropagation();
  52155. event.preventDefault();
  52156. }
  52157. tree?.ctx.emit(NODE_CONTEXTMENU, event, props.node?.data, props.node);
  52158. };
  52159. return (_ctx, _cache) => {
  52160. return openBlock(), createElementBlock("div", {
  52161. ref: "node$",
  52162. class: normalizeClass([
  52163. unref(ns).b("node"),
  52164. unref(ns).is("expanded", __props.expanded),
  52165. unref(ns).is("current", __props.current),
  52166. unref(ns).is("focusable", !__props.disabled),
  52167. unref(ns).is("checked", !__props.disabled && __props.checked),
  52168. getNodeClass(__props.node)
  52169. ]),
  52170. role: "treeitem",
  52171. tabindex: "-1",
  52172. "aria-expanded": __props.expanded,
  52173. "aria-disabled": __props.disabled,
  52174. "aria-checked": __props.checked,
  52175. "data-key": __props.node?.key,
  52176. onClick: withModifiers(handleClick, ["stop"]),
  52177. onContextmenu: handleContextMenu,
  52178. onDragover: _cache[1] || (_cache[1] = withModifiers(() => {}, ["prevent"])),
  52179. onDragenter: _cache[2] || (_cache[2] = withModifiers(() => {}, ["prevent"])),
  52180. onDrop: withModifiers(handleDrop, ["stop"])
  52181. }, [createElementVNode("div", {
  52182. class: normalizeClass(unref(ns).be("node", "content")),
  52183. style: normalizeStyle({
  52184. paddingLeft: `${(__props.node.level - 1) * indent.value}px`,
  52185. height: __props.itemSize + "px"
  52186. })
  52187. }, [
  52188. icon.value ? (openBlock(), createBlock(unref(ElIcon), {
  52189. key: 0,
  52190. class: normalizeClass([
  52191. unref(ns).is("leaf", !!__props.node?.isLeaf),
  52192. unref(ns).is("hidden", __props.hiddenExpandIcon),
  52193. { expanded: !__props.node?.isLeaf && __props.expanded },
  52194. unref(ns).be("node", "expand-icon")
  52195. ]),
  52196. onClick: withModifiers(handleExpandIconClick, ["stop"])
  52197. }, {
  52198. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(icon.value)))]),
  52199. _: 1
  52200. }, 8, ["class"])) : createCommentVNode("v-if", true),
  52201. __props.showCheckbox ? (openBlock(), createBlock(unref(ElCheckbox), {
  52202. key: 1,
  52203. "model-value": __props.checked,
  52204. indeterminate: __props.indeterminate,
  52205. disabled: __props.disabled,
  52206. onChange: handleCheckChange,
  52207. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  52208. }, null, 8, [
  52209. "model-value",
  52210. "indeterminate",
  52211. "disabled"
  52212. ])) : createCommentVNode("v-if", true),
  52213. createVNode(unref(tree_node_content_default), { node: {
  52214. ...__props.node,
  52215. expanded: __props.expanded
  52216. } }, null, 8, ["node"])
  52217. ], 6)], 42, _hoisted_1$11);
  52218. };
  52219. }
  52220. });
  52221. //#endregion
  52222. //#region ../../packages/components/tree-v2/src/tree-node.vue
  52223. var tree_node_default = tree_node_vue_vue_type_script_setup_true_lang_default;
  52224. //#endregion
  52225. //#region ../../packages/components/tree-v2/src/tree.vue?vue&type=script&setup=true&lang.ts
  52226. var tree_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  52227. name: "ElTreeV2",
  52228. __name: "tree",
  52229. props: treeProps$1,
  52230. emits: treeEmits$1,
  52231. setup(__props, { expose: __expose, emit: __emit }) {
  52232. const props = __props;
  52233. const emit = __emit;
  52234. const slots = useSlots();
  52235. const treeNodeSize = computed(() => props.itemSize);
  52236. provide(ROOT_TREE_INJECTION_KEY$1, {
  52237. ctx: {
  52238. emit,
  52239. slots
  52240. },
  52241. props,
  52242. instance: getCurrentInstance()
  52243. });
  52244. provide(formItemContextKey, void 0);
  52245. const { t } = useLocale();
  52246. const ns = useNamespace("tree");
  52247. const { flattenTree, isNotEmpty, listRef, toggleExpand, isIndeterminate, isChecked, isDisabled, isCurrent, isForceHiddenExpandIcon, handleNodeClick, handleNodeDrop, handleNodeCheck, toggleCheckbox, getCurrentNode, getCurrentKey, setCurrentKey, getCheckedKeys, getCheckedNodes, getHalfCheckedKeys, getHalfCheckedNodes, setChecked, setCheckedKeys, filter, setData, getNode, expandNode, collapseNode, setExpandedKeys, scrollToNode, scrollTo } = useTree(props, emit);
  52248. __expose({
  52249. toggleCheckbox,
  52250. getCurrentNode,
  52251. getCurrentKey,
  52252. setCurrentKey,
  52253. getCheckedKeys,
  52254. getCheckedNodes,
  52255. getHalfCheckedKeys,
  52256. getHalfCheckedNodes,
  52257. setChecked,
  52258. setCheckedKeys,
  52259. filter,
  52260. setData,
  52261. getNode,
  52262. expandNode,
  52263. collapseNode,
  52264. setExpandedKeys,
  52265. scrollToNode,
  52266. scrollTo
  52267. });
  52268. return (_ctx, _cache) => {
  52269. return openBlock(), createElementBlock("div", {
  52270. class: normalizeClass([unref(ns).b(), { [unref(ns).m("highlight-current")]: __props.highlightCurrent }]),
  52271. role: "tree"
  52272. }, [unref(isNotEmpty) ? (openBlock(), createBlock(unref(FixedSizeList), {
  52273. key: 0,
  52274. ref_key: "listRef",
  52275. ref: listRef,
  52276. "class-name": unref(ns).b("virtual-list"),
  52277. data: unref(flattenTree),
  52278. total: unref(flattenTree).length,
  52279. height: __props.height,
  52280. "item-size": treeNodeSize.value,
  52281. "perf-mode": __props.perfMode,
  52282. "scrollbar-always-on": __props.scrollbarAlwaysOn
  52283. }, {
  52284. default: withCtx(({ data, index, style }) => [(openBlock(), createBlock(tree_node_default, {
  52285. key: data[index].key,
  52286. style: normalizeStyle(style),
  52287. node: data[index],
  52288. expanded: data[index].expanded,
  52289. "show-checkbox": __props.showCheckbox,
  52290. checked: unref(isChecked)(data[index]),
  52291. indeterminate: unref(isIndeterminate)(data[index]),
  52292. "item-size": treeNodeSize.value,
  52293. disabled: unref(isDisabled)(data[index]),
  52294. current: unref(isCurrent)(data[index]),
  52295. "hidden-expand-icon": unref(isForceHiddenExpandIcon)(data[index]),
  52296. onClick: unref(handleNodeClick),
  52297. onToggle: unref(toggleExpand),
  52298. onCheck: unref(handleNodeCheck),
  52299. onDrop: unref(handleNodeDrop)
  52300. }, null, 8, [
  52301. "style",
  52302. "node",
  52303. "expanded",
  52304. "show-checkbox",
  52305. "checked",
  52306. "indeterminate",
  52307. "item-size",
  52308. "disabled",
  52309. "current",
  52310. "hidden-expand-icon",
  52311. "onClick",
  52312. "onToggle",
  52313. "onCheck",
  52314. "onDrop"
  52315. ]))]),
  52316. _: 1
  52317. }, 8, [
  52318. "class-name",
  52319. "data",
  52320. "total",
  52321. "height",
  52322. "item-size",
  52323. "perf-mode",
  52324. "scrollbar-always-on"
  52325. ])) : (openBlock(), createElementBlock("div", {
  52326. key: 1,
  52327. class: normalizeClass(unref(ns).e("empty-block"))
  52328. }, [renderSlot(_ctx.$slots, "empty", {}, () => [createElementVNode("span", { class: normalizeClass(unref(ns).e("empty-text")) }, toDisplayString(__props.emptyText ?? unref(t)("el.tree.emptyText")), 3)])], 2))], 2);
  52329. };
  52330. }
  52331. });
  52332. //#endregion
  52333. //#region ../../packages/components/tree-v2/src/tree.vue
  52334. var tree_default = tree_vue_vue_type_script_setup_true_lang_default;
  52335. //#endregion
  52336. //#region ../../packages/components/tree-v2/index.ts
  52337. const ElTreeV2 = withInstall(tree_default);
  52338. //#endregion
  52339. //#region ../../packages/components/upload/src/ajax.ts
  52340. const SCOPE$3 = "ElUpload";
  52341. var UploadAjaxError = class extends Error {
  52342. constructor(message, status, method, url) {
  52343. super(message);
  52344. this.name = "UploadAjaxError";
  52345. this.status = status;
  52346. this.method = method;
  52347. this.url = url;
  52348. }
  52349. };
  52350. function getError(action, option, xhr) {
  52351. let msg;
  52352. if (xhr.response) msg = `${xhr.response.error || xhr.response}`;
  52353. else if (xhr.responseText) msg = `${xhr.responseText}`;
  52354. else msg = `fail to ${option.method} ${action} ${xhr.status}`;
  52355. return new UploadAjaxError(msg, xhr.status, option.method, action);
  52356. }
  52357. function getBody(xhr) {
  52358. const text = xhr.responseText || xhr.response;
  52359. if (!text) return text;
  52360. try {
  52361. return JSON.parse(text);
  52362. } catch {
  52363. return text;
  52364. }
  52365. }
  52366. const ajaxUpload = (option) => {
  52367. if (typeof XMLHttpRequest === "undefined") throwError(SCOPE$3, "XMLHttpRequest is undefined");
  52368. const xhr = new XMLHttpRequest();
  52369. const action = option.action;
  52370. if (xhr.upload) xhr.upload.addEventListener("progress", (evt) => {
  52371. const progressEvt = evt;
  52372. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  52373. option.onProgress(progressEvt);
  52374. });
  52375. const formData = new FormData();
  52376. if (option.data) for (const [key, value] of Object.entries(option.data)) if (isArray$1(value)) if (value.length === 2 && value[0] instanceof Blob && isString(value[1])) formData.append(key, value[0], value[1]);
  52377. else value.forEach((item) => {
  52378. formData.append(key, item);
  52379. });
  52380. else formData.append(key, value);
  52381. formData.append(option.filename, option.file, option.file.name);
  52382. xhr.addEventListener("error", () => {
  52383. option.onError(getError(action, option, xhr));
  52384. });
  52385. xhr.addEventListener("load", () => {
  52386. if (xhr.status < 200 || xhr.status >= 300) return option.onError(getError(action, option, xhr));
  52387. option.onSuccess(getBody(xhr));
  52388. });
  52389. xhr.open(option.method, action, true);
  52390. if (option.withCredentials && "withCredentials" in xhr) xhr.withCredentials = true;
  52391. const headers = option.headers || {};
  52392. if (headers instanceof Headers) headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  52393. else for (const [key, value] of Object.entries(headers)) {
  52394. if (isNil(value)) continue;
  52395. xhr.setRequestHeader(key, String(value));
  52396. }
  52397. xhr.send(formData);
  52398. return xhr;
  52399. };
  52400. //#endregion
  52401. //#region ../../packages/components/upload/src/upload.ts
  52402. /**
  52403. * @deprecated Removed after 3.0.0, Use `UploadProps` instead.
  52404. */
  52405. const uploadListTypes = [
  52406. "text",
  52407. "picture",
  52408. "picture-card"
  52409. ];
  52410. let fileId = 1;
  52411. const genFileId = () => Date.now() + fileId++;
  52412. /**
  52413. * @deprecated Removed after 3.0.0, Use `UploadBaseProps` instead.
  52414. */
  52415. const uploadBaseProps = buildProps({
  52416. action: {
  52417. type: String,
  52418. default: "#"
  52419. },
  52420. headers: { type: definePropType(Object) },
  52421. method: {
  52422. type: String,
  52423. default: "post"
  52424. },
  52425. data: {
  52426. type: definePropType([
  52427. Object,
  52428. Function,
  52429. Promise
  52430. ]),
  52431. default: () => mutable({})
  52432. },
  52433. multiple: Boolean,
  52434. name: {
  52435. type: String,
  52436. default: "file"
  52437. },
  52438. drag: Boolean,
  52439. withCredentials: Boolean,
  52440. showFileList: {
  52441. type: Boolean,
  52442. default: true
  52443. },
  52444. accept: {
  52445. type: String,
  52446. default: ""
  52447. },
  52448. fileList: {
  52449. type: definePropType(Array),
  52450. default: () => mutable([])
  52451. },
  52452. autoUpload: {
  52453. type: Boolean,
  52454. default: true
  52455. },
  52456. listType: {
  52457. type: String,
  52458. values: uploadListTypes,
  52459. default: "text"
  52460. },
  52461. httpRequest: {
  52462. type: definePropType(Function),
  52463. default: ajaxUpload
  52464. },
  52465. disabled: {
  52466. type: Boolean,
  52467. default: void 0
  52468. },
  52469. limit: Number,
  52470. directory: Boolean
  52471. });
  52472. /**
  52473. * @deprecated Removed after 3.0.0, Use `UploadProps` instead.
  52474. */
  52475. const uploadProps = buildProps({
  52476. ...uploadBaseProps,
  52477. beforeUpload: {
  52478. type: definePropType(Function),
  52479. default: NOOP
  52480. },
  52481. beforeRemove: { type: definePropType(Function) },
  52482. onRemove: {
  52483. type: definePropType(Function),
  52484. default: NOOP
  52485. },
  52486. onChange: {
  52487. type: definePropType(Function),
  52488. default: NOOP
  52489. },
  52490. onPreview: {
  52491. type: definePropType(Function),
  52492. default: NOOP
  52493. },
  52494. onSuccess: {
  52495. type: definePropType(Function),
  52496. default: NOOP
  52497. },
  52498. onProgress: {
  52499. type: definePropType(Function),
  52500. default: NOOP
  52501. },
  52502. onError: {
  52503. type: definePropType(Function),
  52504. default: NOOP
  52505. },
  52506. onExceed: {
  52507. type: definePropType(Function),
  52508. default: NOOP
  52509. },
  52510. crossorigin: { type: definePropType(String) }
  52511. });
  52512. const uploadBasePropsDefaults = {
  52513. action: "#",
  52514. method: "post",
  52515. data: () => mutable({}),
  52516. name: "file",
  52517. showFileList: true,
  52518. accept: "",
  52519. fileList: () => mutable([]),
  52520. autoUpload: true,
  52521. listType: "text",
  52522. httpRequest: ajaxUpload,
  52523. disabled: void 0
  52524. };
  52525. const uploadPropsDefaults = {
  52526. ...uploadBasePropsDefaults,
  52527. beforeUpload: NOOP,
  52528. onRemove: NOOP,
  52529. onChange: NOOP,
  52530. onPreview: NOOP,
  52531. onSuccess: NOOP,
  52532. onProgress: NOOP,
  52533. onError: NOOP,
  52534. onExceed: NOOP
  52535. };
  52536. //#endregion
  52537. //#region ../../packages/components/upload/src/constants.ts
  52538. const uploadContextKey = Symbol("uploadContextKey");
  52539. //#endregion
  52540. //#region ../../packages/components/upload/src/upload-list.ts
  52541. /**
  52542. * @deprecated Removed after 3.0.0, Use `UploadListProps` instead.
  52543. */
  52544. const uploadListProps = buildProps({
  52545. files: {
  52546. type: definePropType(Array),
  52547. default: () => mutable([])
  52548. },
  52549. disabled: {
  52550. type: Boolean,
  52551. default: void 0
  52552. },
  52553. handlePreview: {
  52554. type: definePropType(Function),
  52555. default: NOOP
  52556. },
  52557. listType: {
  52558. type: String,
  52559. values: uploadListTypes,
  52560. default: "text"
  52561. },
  52562. crossorigin: { type: definePropType(String) }
  52563. });
  52564. const uploadListEmits = { remove: (file) => !!file };
  52565. //#endregion
  52566. //#region ../../packages/components/upload/src/upload-list.vue?vue&type=script&setup=true&lang.ts
  52567. const _hoisted_1$10 = [
  52568. "tabindex",
  52569. "aria-disabled",
  52570. "onKeydown"
  52571. ];
  52572. const _hoisted_2$6 = ["src", "crossorigin"];
  52573. const _hoisted_3$2 = ["onClick"];
  52574. const _hoisted_4$1 = ["title"];
  52575. const _hoisted_5 = ["onClick"];
  52576. const _hoisted_6 = ["onClick"];
  52577. var upload_list_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  52578. name: "ElUploadList",
  52579. __name: "upload-list",
  52580. props: uploadListProps,
  52581. emits: uploadListEmits,
  52582. setup(__props, { emit: __emit }) {
  52583. const props = __props;
  52584. const emit = __emit;
  52585. const { t } = useLocale();
  52586. const nsUpload = useNamespace("upload");
  52587. const nsIcon = useNamespace("icon");
  52588. const nsList = useNamespace("list");
  52589. const disabled = useFormDisabled();
  52590. const focusing = ref(false);
  52591. const containerKls = computed(() => [
  52592. nsUpload.b("list"),
  52593. nsUpload.bm("list", props.listType),
  52594. nsUpload.is("disabled", disabled.value)
  52595. ]);
  52596. const handleRemove = (file) => {
  52597. emit("remove", file);
  52598. };
  52599. return (_ctx, _cache) => {
  52600. return openBlock(), createBlock(TransitionGroup, {
  52601. tag: "ul",
  52602. class: normalizeClass(containerKls.value),
  52603. name: unref(nsList).b()
  52604. }, {
  52605. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.files, (file, index) => {
  52606. return openBlock(), createElementBlock("li", {
  52607. key: file.uid || file.name,
  52608. class: normalizeClass([
  52609. unref(nsUpload).be("list", "item"),
  52610. unref(nsUpload).is(file.status),
  52611. { focusing: focusing.value }
  52612. ]),
  52613. tabindex: unref(disabled) ? void 0 : 0,
  52614. "aria-disabled": unref(disabled),
  52615. role: "button",
  52616. onKeydown: withKeys(($event) => !unref(disabled) && handleRemove(file), ["delete"]),
  52617. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  52618. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  52619. onClick: _cache[2] || (_cache[2] = ($event) => focusing.value = false)
  52620. }, [renderSlot(_ctx.$slots, "default", {
  52621. file,
  52622. index
  52623. }, () => [
  52624. __props.listType === "picture" || file.status !== "uploading" && __props.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  52625. key: 0,
  52626. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  52627. src: file.url,
  52628. crossorigin: __props.crossorigin,
  52629. alt: ""
  52630. }, null, 10, _hoisted_2$6)) : createCommentVNode("v-if", true),
  52631. file.status === "uploading" || __props.listType !== "picture-card" ? (openBlock(), createElementBlock("div", {
  52632. key: 1,
  52633. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  52634. }, [createElementVNode("a", {
  52635. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  52636. onClick: withModifiers(($event) => __props.handlePreview(file), ["prevent"])
  52637. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(nsIcon).m("document")) }, {
  52638. default: withCtx(() => [createVNode(unref(document_default))]),
  52639. _: 1
  52640. }, 8, ["class"]), createElementVNode("span", {
  52641. class: normalizeClass(unref(nsUpload).be("list", "item-file-name")),
  52642. title: file.name
  52643. }, toDisplayString(file.name), 11, _hoisted_4$1)], 10, _hoisted_3$2), file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  52644. key: 0,
  52645. type: __props.listType === "picture-card" ? "circle" : "line",
  52646. "stroke-width": __props.listType === "picture-card" ? 6 : 2,
  52647. percentage: Number(file.percentage),
  52648. style: normalizeStyle(__props.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  52649. }, null, 8, [
  52650. "type",
  52651. "stroke-width",
  52652. "percentage",
  52653. "style"
  52654. ])) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true),
  52655. createElementVNode("label", { class: normalizeClass(unref(nsUpload).be("list", "item-status-label")) }, [__props.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  52656. key: 0,
  52657. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  52658. }, {
  52659. default: withCtx(() => [createVNode(unref(circle_check_default))]),
  52660. _: 1
  52661. }, 8, ["class"])) : ["picture-card", "picture"].includes(__props.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  52662. key: 1,
  52663. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  52664. }, {
  52665. default: withCtx(() => [createVNode(unref(check_default))]),
  52666. _: 1
  52667. }, 8, ["class"])) : createCommentVNode("v-if", true)], 2),
  52668. !unref(disabled) ? (openBlock(), createBlock(unref(ElIcon), {
  52669. key: 2,
  52670. class: normalizeClass(unref(nsIcon).m("close")),
  52671. "aria-label": unref(t)("el.upload.delete"),
  52672. role: "button",
  52673. tabindex: "0",
  52674. onClick: ($event) => handleRemove(file),
  52675. onKeydown: withKeys(withModifiers(($event) => handleRemove(file), ["prevent"]), ["enter", "space"])
  52676. }, {
  52677. default: withCtx(() => [createVNode(unref(close_default))]),
  52678. _: 1
  52679. }, 8, [
  52680. "class",
  52681. "aria-label",
  52682. "onClick",
  52683. "onKeydown"
  52684. ])) : createCommentVNode("v-if", true),
  52685. !unref(disabled) ? (openBlock(), createElementBlock("i", {
  52686. key: 3,
  52687. class: normalizeClass(unref(nsIcon).m("close-tip"))
  52688. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  52689. __props.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  52690. key: 4,
  52691. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  52692. }, [createElementVNode("span", {
  52693. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  52694. onClick: ($event) => __props.handlePreview(file)
  52695. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(nsIcon).m("zoom-in")) }, {
  52696. default: withCtx(() => [createVNode(unref(zoom_in_default))]),
  52697. _: 1
  52698. }, 8, ["class"])], 10, _hoisted_5), !unref(disabled) ? (openBlock(), createElementBlock("span", {
  52699. key: 0,
  52700. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  52701. onClick: ($event) => handleRemove(file)
  52702. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(nsIcon).m("delete")) }, {
  52703. default: withCtx(() => [createVNode(unref(delete_default))]),
  52704. _: 1
  52705. }, 8, ["class"])], 10, _hoisted_6)) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true)
  52706. ])], 42, _hoisted_1$10);
  52707. }), 128)), renderSlot(_ctx.$slots, "append")]),
  52708. _: 3
  52709. }, 8, ["class", "name"]);
  52710. };
  52711. }
  52712. });
  52713. //#endregion
  52714. //#region ../../packages/components/upload/src/upload-list.vue
  52715. var upload_list_default = upload_list_vue_vue_type_script_setup_true_lang_default;
  52716. //#endregion
  52717. //#region ../../packages/components/upload/src/upload-content.ts
  52718. /**
  52719. * @deprecated Removed after 3.0.0, Use `UploadContentProps` instead.
  52720. */
  52721. const uploadContentProps = buildProps({
  52722. ...uploadBaseProps,
  52723. beforeUpload: {
  52724. type: definePropType(Function),
  52725. default: NOOP
  52726. },
  52727. onRemove: {
  52728. type: definePropType(Function),
  52729. default: NOOP
  52730. },
  52731. onStart: {
  52732. type: definePropType(Function),
  52733. default: NOOP
  52734. },
  52735. onSuccess: {
  52736. type: definePropType(Function),
  52737. default: NOOP
  52738. },
  52739. onProgress: {
  52740. type: definePropType(Function),
  52741. default: NOOP
  52742. },
  52743. onError: {
  52744. type: definePropType(Function),
  52745. default: NOOP
  52746. },
  52747. onExceed: {
  52748. type: definePropType(Function),
  52749. default: NOOP
  52750. }
  52751. });
  52752. const uploadContentPropsDefaults = {
  52753. ...uploadBasePropsDefaults,
  52754. beforeUpload: NOOP,
  52755. onRemove: NOOP,
  52756. onStart: NOOP,
  52757. onSuccess: NOOP,
  52758. onProgress: NOOP,
  52759. onError: NOOP,
  52760. onExceed: NOOP
  52761. };
  52762. //#endregion
  52763. //#region ../../packages/components/upload/src/upload-dragger.ts
  52764. /**
  52765. * @deprecated Removed after 3.0.0, Use `UploadDraggerProps` instead.
  52766. */
  52767. const uploadDraggerProps = buildProps({
  52768. disabled: {
  52769. type: Boolean,
  52770. default: void 0
  52771. },
  52772. directory: Boolean
  52773. });
  52774. const uploadDraggerEmits = { file: (file) => isArray$1(file) };
  52775. //#endregion
  52776. //#region ../../packages/components/upload/src/upload-dragger.vue?vue&type=script&setup=true&lang.ts
  52777. const COMPONENT_NAME$1 = "ElUploadDrag";
  52778. var upload_dragger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  52779. name: COMPONENT_NAME$1,
  52780. __name: "upload-dragger",
  52781. props: uploadDraggerProps,
  52782. emits: uploadDraggerEmits,
  52783. setup(__props, { emit: __emit }) {
  52784. const props = __props;
  52785. const emit = __emit;
  52786. if (!inject(uploadContextKey)) throwError(COMPONENT_NAME$1, "usage: <el-upload><el-upload-dragger /></el-upload>");
  52787. const ns = useNamespace("upload");
  52788. const dragover = ref(false);
  52789. const disabled = useFormDisabled();
  52790. const getFile = (entry) => {
  52791. return new Promise((resolve, reject) => entry.file(resolve, reject));
  52792. };
  52793. const getAllFiles = async (entry) => {
  52794. try {
  52795. if (entry.isFile) {
  52796. const file = await getFile(entry);
  52797. file.isDirectory = false;
  52798. return [file];
  52799. }
  52800. if (entry.isDirectory) {
  52801. const dirReader = entry.createReader();
  52802. const getEntries = () => {
  52803. return new Promise((resolve, reject) => dirReader.readEntries(resolve, reject));
  52804. };
  52805. const entries = [];
  52806. let readEntries = await getEntries();
  52807. /**
  52808. * In Chromium-based browsers, readEntries() will only return the first 100 FileSystemEntry instances.
  52809. * https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries#:~:text=In%20Chromium%2Dbased%20browsers%2C%20readEntries()%20will%20only%20return%20the%20first%20100%20FileSystemEntry%20instances.%20In%20order%20to%20obtain%20all%20of%20the%20instances%2C%20readEntries()%20must%20be%20called%20multiple%20times.
  52810. */
  52811. while (readEntries.length > 0) {
  52812. entries.push(...readEntries);
  52813. readEntries = await getEntries();
  52814. }
  52815. const filePromises = entries.map((entry) => getAllFiles(entry).catch(() => []));
  52816. return flatten(await Promise.all(filePromises));
  52817. }
  52818. } catch {
  52819. return [];
  52820. }
  52821. return [];
  52822. };
  52823. const onDrop = async (e) => {
  52824. if (disabled.value) return;
  52825. dragover.value = false;
  52826. e.stopPropagation();
  52827. const files = Array.from(e.dataTransfer.files);
  52828. const items = e.dataTransfer.items || [];
  52829. if (props.directory) {
  52830. const entries = Array.from(items).map((item) => item?.webkitGetAsEntry?.()).filter((entry) => entry);
  52831. emit("file", flatten(await Promise.all(entries.map(getAllFiles))));
  52832. return;
  52833. }
  52834. files.forEach((file, index) => {
  52835. const entry = items[index]?.webkitGetAsEntry?.();
  52836. if (entry) file.isDirectory = entry.isDirectory;
  52837. });
  52838. emit("file", files);
  52839. };
  52840. const onDragover = () => {
  52841. if (!disabled.value) dragover.value = true;
  52842. };
  52843. const onDragleave = (e) => {
  52844. if (!e.currentTarget.contains(e.relatedTarget)) dragover.value = false;
  52845. };
  52846. return (_ctx, _cache) => {
  52847. return openBlock(), createElementBlock("div", {
  52848. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  52849. onDrop: withModifiers(onDrop, ["prevent"]),
  52850. onDragover: withModifiers(onDragover, ["prevent"]),
  52851. onDragleave: withModifiers(onDragleave, ["prevent"])
  52852. }, [renderSlot(_ctx.$slots, "default")], 34);
  52853. };
  52854. }
  52855. });
  52856. //#endregion
  52857. //#region ../../packages/components/upload/src/upload-dragger.vue
  52858. var upload_dragger_default = upload_dragger_vue_vue_type_script_setup_true_lang_default;
  52859. //#endregion
  52860. //#region ../../packages/components/upload/src/upload-content.vue?vue&type=script&setup=true&lang.ts
  52861. const _hoisted_1$9 = [
  52862. "tabindex",
  52863. "aria-disabled",
  52864. "onKeydown"
  52865. ];
  52866. const _hoisted_2$5 = [
  52867. "name",
  52868. "disabled",
  52869. "multiple",
  52870. "accept",
  52871. "webkitdirectory"
  52872. ];
  52873. var upload_content_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  52874. name: "ElUploadContent",
  52875. inheritAttrs: false,
  52876. __name: "upload-content",
  52877. props: uploadContentProps,
  52878. setup(__props, { expose: __expose }) {
  52879. const props = __props;
  52880. const ns = useNamespace("upload");
  52881. const disabled = useFormDisabled();
  52882. const requests = shallowRef({});
  52883. const inputRef = shallowRef();
  52884. const uploadFiles = (files) => {
  52885. if (files.length === 0) return;
  52886. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  52887. if (limit && fileList.length + files.length > limit) {
  52888. onExceed(files, fileList);
  52889. return;
  52890. }
  52891. if (!multiple) files = files.slice(0, 1);
  52892. for (const file of files) {
  52893. const rawFile = file;
  52894. rawFile.uid = genFileId();
  52895. onStart(rawFile);
  52896. if (autoUpload) upload(rawFile);
  52897. }
  52898. };
  52899. const upload = async (rawFile) => {
  52900. inputRef.value.value = "";
  52901. if (!props.beforeUpload) return doUpload(rawFile);
  52902. let hookResult;
  52903. let beforeData = {};
  52904. try {
  52905. const originData = props.data;
  52906. const beforeUploadPromise = props.beforeUpload(rawFile);
  52907. beforeData = isPlainObject$1(props.data) ? cloneDeep(props.data) : props.data;
  52908. hookResult = await beforeUploadPromise;
  52909. if (isPlainObject$1(props.data) && isEqual$1(originData, beforeData)) beforeData = cloneDeep(props.data);
  52910. } catch {
  52911. hookResult = false;
  52912. }
  52913. if (hookResult === false) {
  52914. props.onRemove(rawFile);
  52915. return;
  52916. }
  52917. let file = rawFile;
  52918. if (hookResult instanceof Blob) if (hookResult instanceof File) file = hookResult;
  52919. else file = new File([hookResult], rawFile.name, { type: rawFile.type });
  52920. doUpload(Object.assign(file, { uid: rawFile.uid }), beforeData);
  52921. };
  52922. const resolveData = async (data, rawFile) => {
  52923. if (isFunction$1(data)) return data(rawFile);
  52924. return data;
  52925. };
  52926. const doUpload = async (rawFile, beforeData) => {
  52927. const { headers, data, method, withCredentials, name: filename, action, onProgress, onSuccess, onError, httpRequest } = props;
  52928. try {
  52929. beforeData = await resolveData(beforeData ?? data, rawFile);
  52930. } catch {
  52931. props.onRemove(rawFile);
  52932. return;
  52933. }
  52934. const { uid } = rawFile;
  52935. const options = {
  52936. headers: headers || {},
  52937. withCredentials,
  52938. file: rawFile,
  52939. data: beforeData,
  52940. method,
  52941. filename,
  52942. action,
  52943. onProgress: (evt) => {
  52944. onProgress(evt, rawFile);
  52945. },
  52946. onSuccess: (res) => {
  52947. onSuccess(res, rawFile);
  52948. delete requests.value[uid];
  52949. },
  52950. onError: (err) => {
  52951. onError(err, rawFile);
  52952. delete requests.value[uid];
  52953. }
  52954. };
  52955. const request = httpRequest(options);
  52956. requests.value[uid] = request;
  52957. if (request instanceof Promise) request.then(options.onSuccess, options.onError);
  52958. };
  52959. const handleChange = (e) => {
  52960. const files = e.target.files;
  52961. if (!files) return;
  52962. uploadFiles(Array.from(files));
  52963. };
  52964. const handleClick = () => {
  52965. if (!disabled.value) {
  52966. inputRef.value.value = "";
  52967. inputRef.value.click();
  52968. }
  52969. };
  52970. const handleKeydown = () => {
  52971. handleClick();
  52972. };
  52973. const abort = (file) => {
  52974. entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true).forEach(([uid, req]) => {
  52975. if (req instanceof XMLHttpRequest) req.abort();
  52976. delete requests.value[uid];
  52977. });
  52978. };
  52979. __expose({
  52980. abort,
  52981. upload
  52982. });
  52983. return (_ctx, _cache) => {
  52984. return openBlock(), createElementBlock("div", {
  52985. class: normalizeClass([
  52986. unref(ns).b(),
  52987. unref(ns).m(__props.listType),
  52988. unref(ns).is("drag", __props.drag),
  52989. unref(ns).is("disabled", unref(disabled))
  52990. ]),
  52991. tabindex: unref(disabled) ? void 0 : 0,
  52992. "aria-disabled": unref(disabled),
  52993. role: "button",
  52994. onClick: handleClick,
  52995. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  52996. }, [__props.drag ? (openBlock(), createBlock(upload_dragger_default, {
  52997. key: 0,
  52998. disabled: unref(disabled),
  52999. directory: __props.directory,
  53000. onFile: uploadFiles
  53001. }, {
  53002. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  53003. _: 3
  53004. }, 8, ["disabled", "directory"])) : renderSlot(_ctx.$slots, "default", { key: 1 }), createElementVNode("input", {
  53005. ref_key: "inputRef",
  53006. ref: inputRef,
  53007. class: normalizeClass(unref(ns).e("input")),
  53008. name: __props.name,
  53009. disabled: unref(disabled),
  53010. multiple: __props.multiple,
  53011. accept: __props.accept,
  53012. webkitdirectory: __props.directory || void 0,
  53013. type: "file",
  53014. onChange: handleChange,
  53015. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  53016. }, null, 42, _hoisted_2$5)], 42, _hoisted_1$9);
  53017. };
  53018. }
  53019. });
  53020. //#endregion
  53021. //#region ../../packages/components/upload/src/upload-content.vue
  53022. var upload_content_default = upload_content_vue_vue_type_script_setup_true_lang_default;
  53023. //#endregion
  53024. //#region ../../packages/components/upload/src/use-handlers.ts
  53025. const SCOPE$2 = "ElUpload";
  53026. const revokeFileObjectURL = (file) => {
  53027. if (file.url?.startsWith("blob:")) URL.revokeObjectURL(file.url);
  53028. };
  53029. const useHandlers = (props, uploadRef) => {
  53030. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  53031. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  53032. function abort(file) {
  53033. uploadRef.value?.abort(file);
  53034. }
  53035. function clearFiles(states = [
  53036. "ready",
  53037. "uploading",
  53038. "success",
  53039. "fail"
  53040. ]) {
  53041. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  53042. }
  53043. function removeFile(file) {
  53044. uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile.uid !== file.uid);
  53045. }
  53046. const emitChange = (file) => {
  53047. nextTick(() => props.onChange(file, uploadFiles.value));
  53048. };
  53049. const handleError = (err, rawFile) => {
  53050. const file = getFile(rawFile);
  53051. if (!file) return;
  53052. console.error(err);
  53053. file.status = "fail";
  53054. removeFile(file);
  53055. props.onError(err, file, uploadFiles.value);
  53056. emitChange(file);
  53057. };
  53058. const handleProgress = (evt, rawFile) => {
  53059. const file = getFile(rawFile);
  53060. if (!file) return;
  53061. props.onProgress(evt, file, uploadFiles.value);
  53062. file.status = "uploading";
  53063. file.percentage = Math.round(evt.percent);
  53064. };
  53065. const handleSuccess = (response, rawFile) => {
  53066. const file = getFile(rawFile);
  53067. if (!file) return;
  53068. file.status = "success";
  53069. file.response = response;
  53070. props.onSuccess(response, file, uploadFiles.value);
  53071. emitChange(file);
  53072. };
  53073. const handleStart = (file) => {
  53074. if (isNil(file.uid)) file.uid = genFileId();
  53075. const uploadFile = {
  53076. name: file.name,
  53077. percentage: 0,
  53078. status: "ready",
  53079. size: file.size,
  53080. raw: file,
  53081. uid: file.uid
  53082. };
  53083. if (props.listType === "picture-card" || props.listType === "picture") try {
  53084. uploadFile.url = URL.createObjectURL(file);
  53085. } catch (err) {
  53086. /* @__PURE__ */ debugWarn(SCOPE$2, err.message);
  53087. props.onError(err, uploadFile, uploadFiles.value);
  53088. }
  53089. uploadFiles.value = [...uploadFiles.value, uploadFile];
  53090. emitChange(uploadFile);
  53091. };
  53092. const handleRemove = async (file) => {
  53093. const uploadFile = file instanceof File ? getFile(file) : file;
  53094. if (!uploadFile) throwError(SCOPE$2, "file to be removed not found");
  53095. const doRemove = (file) => {
  53096. abort(file);
  53097. removeFile(file);
  53098. props.onRemove(file, uploadFiles.value);
  53099. revokeFileObjectURL(file);
  53100. };
  53101. if (props.beforeRemove) {
  53102. if (await props.beforeRemove(uploadFile, uploadFiles.value) !== false) doRemove(uploadFile);
  53103. } else doRemove(uploadFile);
  53104. };
  53105. function submit() {
  53106. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => raw && uploadRef.value?.upload(raw));
  53107. }
  53108. watch(() => props.listType, (val) => {
  53109. if (val !== "picture-card" && val !== "picture") return;
  53110. uploadFiles.value = uploadFiles.value.map((file) => {
  53111. const { raw, url } = file;
  53112. if (!url && raw) try {
  53113. file.url = URL.createObjectURL(raw);
  53114. } catch (err) {
  53115. props.onError(err, file, uploadFiles.value);
  53116. }
  53117. return file;
  53118. });
  53119. });
  53120. watch(uploadFiles, (files) => {
  53121. for (const file of files) {
  53122. file.uid ||= genFileId();
  53123. file.status ||= "success";
  53124. }
  53125. }, {
  53126. immediate: true,
  53127. deep: true
  53128. });
  53129. return {
  53130. uploadFiles,
  53131. abort,
  53132. clearFiles,
  53133. handleError,
  53134. handleProgress,
  53135. handleStart,
  53136. handleSuccess,
  53137. handleRemove,
  53138. submit,
  53139. revokeFileObjectURL
  53140. };
  53141. };
  53142. //#endregion
  53143. //#region ../../packages/components/upload/src/upload.vue?vue&type=script&setup=true&lang.ts
  53144. var upload_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  53145. name: "ElUpload",
  53146. __name: "upload",
  53147. props: uploadProps,
  53148. setup(__props, { expose: __expose }) {
  53149. const props = __props;
  53150. const disabled = useFormDisabled();
  53151. const uploadRef = shallowRef();
  53152. const { abort, submit, clearFiles, uploadFiles, handleStart, handleError, handleRemove, handleSuccess, handleProgress, revokeFileObjectURL } = useHandlers(props, uploadRef);
  53153. const isPictureCard = computed(() => props.listType === "picture-card");
  53154. const uploadContentProps = computed(() => ({
  53155. ...props,
  53156. fileList: uploadFiles.value,
  53157. onStart: handleStart,
  53158. onProgress: handleProgress,
  53159. onSuccess: handleSuccess,
  53160. onError: handleError,
  53161. onRemove: handleRemove
  53162. }));
  53163. onBeforeUnmount(() => {
  53164. uploadFiles.value.forEach(revokeFileObjectURL);
  53165. });
  53166. provide(uploadContextKey, { accept: toRef(props, "accept") });
  53167. __expose({
  53168. abort,
  53169. submit,
  53170. clearFiles,
  53171. handleStart,
  53172. handleRemove
  53173. });
  53174. return (_ctx, _cache) => {
  53175. return openBlock(), createElementBlock("div", null, [
  53176. isPictureCard.value && __props.showFileList ? (openBlock(), createBlock(upload_list_default, {
  53177. key: 0,
  53178. disabled: unref(disabled),
  53179. "list-type": __props.listType,
  53180. files: unref(uploadFiles),
  53181. crossorigin: __props.crossorigin,
  53182. "handle-preview": __props.onPreview,
  53183. onRemove: unref(handleRemove)
  53184. }, createSlots({
  53185. append: withCtx(() => [createVNode(upload_content_default, mergeProps({
  53186. ref_key: "uploadRef",
  53187. ref: uploadRef
  53188. }, uploadContentProps.value), {
  53189. default: withCtx(() => [_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true), !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)]),
  53190. _: 3
  53191. }, 16)]),
  53192. _: 2
  53193. }, [_ctx.$slots.file ? {
  53194. name: "default",
  53195. fn: withCtx(({ file, index }) => [renderSlot(_ctx.$slots, "file", {
  53196. file,
  53197. index
  53198. })]),
  53199. key: "0"
  53200. } : void 0]), 1032, [
  53201. "disabled",
  53202. "list-type",
  53203. "files",
  53204. "crossorigin",
  53205. "handle-preview",
  53206. "onRemove"
  53207. ])) : createCommentVNode("v-if", true),
  53208. !isPictureCard.value || isPictureCard.value && !__props.showFileList ? (openBlock(), createBlock(upload_content_default, mergeProps({
  53209. key: 1,
  53210. ref_key: "uploadRef",
  53211. ref: uploadRef
  53212. }, uploadContentProps.value), {
  53213. default: withCtx(() => [_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true), !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)]),
  53214. _: 3
  53215. }, 16)) : createCommentVNode("v-if", true),
  53216. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  53217. renderSlot(_ctx.$slots, "tip"),
  53218. !isPictureCard.value && __props.showFileList ? (openBlock(), createBlock(upload_list_default, {
  53219. key: 3,
  53220. disabled: unref(disabled),
  53221. "list-type": __props.listType,
  53222. files: unref(uploadFiles),
  53223. crossorigin: __props.crossorigin,
  53224. "handle-preview": __props.onPreview,
  53225. onRemove: unref(handleRemove)
  53226. }, createSlots({ _: 2 }, [_ctx.$slots.file ? {
  53227. name: "default",
  53228. fn: withCtx(({ file, index }) => [renderSlot(_ctx.$slots, "file", {
  53229. file,
  53230. index
  53231. })]),
  53232. key: "0"
  53233. } : void 0]), 1032, [
  53234. "disabled",
  53235. "list-type",
  53236. "files",
  53237. "crossorigin",
  53238. "handle-preview",
  53239. "onRemove"
  53240. ])) : createCommentVNode("v-if", true)
  53241. ]);
  53242. };
  53243. }
  53244. });
  53245. //#endregion
  53246. //#region ../../packages/components/upload/src/upload.vue
  53247. var upload_default = upload_vue_vue_type_script_setup_true_lang_default;
  53248. //#endregion
  53249. //#region ../../packages/components/upload/index.ts
  53250. const ElUpload = withInstall(upload_default);
  53251. //#endregion
  53252. //#region ../../packages/components/watermark/src/watermark.ts
  53253. /**
  53254. * @deprecated Removed after 3.0.0, Use `WatermarkProps` instead.
  53255. */
  53256. const watermarkProps = buildProps({
  53257. zIndex: {
  53258. type: Number,
  53259. default: 9
  53260. },
  53261. rotate: {
  53262. type: Number,
  53263. default: -22
  53264. },
  53265. width: Number,
  53266. height: Number,
  53267. image: String,
  53268. content: {
  53269. type: definePropType([String, Array]),
  53270. default: "Element Plus"
  53271. },
  53272. font: { type: definePropType(Object) },
  53273. gap: {
  53274. type: definePropType(Array),
  53275. default: () => [100, 100]
  53276. },
  53277. offset: { type: definePropType(Array) }
  53278. });
  53279. //#endregion
  53280. //#region ../../packages/components/watermark/src/utils.ts
  53281. /** converting camel-cased strings to be lowercase and link it with Separator */
  53282. function toLowercaseSeparator(key) {
  53283. return key.replace(/([A-Z])/g, "-$1").toLowerCase();
  53284. }
  53285. function getStyleStr(style) {
  53286. return Object.keys(style).map((key) => `${toLowercaseSeparator(key)}: ${style[key]};`).join(" ");
  53287. }
  53288. /** Returns the ratio of the device's physical pixel resolution to the css pixel resolution */
  53289. function getPixelRatio() {
  53290. return window.devicePixelRatio || 1;
  53291. }
  53292. /** Whether to re-render the watermark */
  53293. const reRendering = (mutation, watermarkElement) => {
  53294. let flag = false;
  53295. if (mutation.removedNodes.length && watermarkElement) flag = Array.from(mutation.removedNodes).includes(watermarkElement);
  53296. if (mutation.type === "attributes" && mutation.target === watermarkElement) flag = true;
  53297. return flag;
  53298. };
  53299. //#endregion
  53300. //#region ../../packages/components/watermark/src/useClips.ts
  53301. const TEXT_ALIGN_RATIO_MAP = {
  53302. left: [0, .5],
  53303. start: [0, .5],
  53304. center: [.5, 0],
  53305. right: [1, -.5],
  53306. end: [1, -.5]
  53307. };
  53308. function prepareCanvas(width, height, ratio = 1) {
  53309. const canvas = document.createElement("canvas");
  53310. const ctx = canvas.getContext("2d");
  53311. const realWidth = width * ratio;
  53312. const realHeight = height * ratio;
  53313. canvas.setAttribute("width", `${realWidth}px`);
  53314. canvas.setAttribute("height", `${realHeight}px`);
  53315. ctx.save();
  53316. return [
  53317. ctx,
  53318. canvas,
  53319. realWidth,
  53320. realHeight
  53321. ];
  53322. }
  53323. /**
  53324. * Get the clips of text content.
  53325. * This is a lazy hook function since SSR no need this
  53326. */
  53327. function useClips() {
  53328. function getClips(content, rotate, ratio, width, height, font, gapX, gapY, space) {
  53329. const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
  53330. let baselineOffset = 0;
  53331. if (content instanceof HTMLImageElement) ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
  53332. else {
  53333. const { color, fontSize, fontStyle, fontWeight, fontFamily, textAlign, textBaseline } = font;
  53334. const mergedFontSize = Number(fontSize) * ratio;
  53335. ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
  53336. ctx.fillStyle = color;
  53337. ctx.textAlign = textAlign;
  53338. ctx.textBaseline = textBaseline;
  53339. const contents = isArray$1(content) ? content : [content];
  53340. if (textBaseline !== "top" && contents[0]) {
  53341. const argumentMetrics = ctx.measureText(contents[0]);
  53342. ctx.textBaseline = "top";
  53343. const topMetrics = ctx.measureText(contents[0]);
  53344. baselineOffset = argumentMetrics.actualBoundingBoxAscent - topMetrics.actualBoundingBoxAscent;
  53345. }
  53346. contents?.forEach((item, index) => {
  53347. const [alignRatio, spaceRatio] = TEXT_ALIGN_RATIO_MAP[textAlign];
  53348. ctx.fillText(item ?? "", contentWidth * alignRatio + space * spaceRatio, index * (mergedFontSize + font.fontGap * ratio));
  53349. });
  53350. }
  53351. const angle = Math.PI / 180 * Number(rotate);
  53352. const maxSize = Math.max(width, height);
  53353. const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
  53354. rCtx.translate(realMaxSize / 2, realMaxSize / 2);
  53355. rCtx.rotate(angle);
  53356. if (contentWidth > 0 && contentHeight > 0) rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
  53357. function getRotatePos(x, y) {
  53358. return [x * Math.cos(angle) - y * Math.sin(angle), x * Math.sin(angle) + y * Math.cos(angle)];
  53359. }
  53360. let left = 0;
  53361. let right = 0;
  53362. let top = 0;
  53363. let bottom = 0;
  53364. const halfWidth = contentWidth / 2;
  53365. const halfHeight = contentHeight / 2;
  53366. [
  53367. [0 - halfWidth, 0 - halfHeight],
  53368. [0 + halfWidth, 0 - halfHeight],
  53369. [0 + halfWidth, 0 + halfHeight],
  53370. [0 - halfWidth, 0 + halfHeight]
  53371. ].forEach(([x, y]) => {
  53372. const [targetX, targetY] = getRotatePos(x, y);
  53373. left = Math.min(left, targetX);
  53374. right = Math.max(right, targetX);
  53375. top = Math.min(top, targetY);
  53376. bottom = Math.max(bottom, targetY);
  53377. });
  53378. const cutLeft = left + realMaxSize / 2;
  53379. const cutTop = top + realMaxSize / 2;
  53380. const cutWidth = right - left;
  53381. const cutHeight = bottom - top;
  53382. const realGapX = gapX * ratio;
  53383. const realGapY = gapY * ratio;
  53384. const filledWidth = (cutWidth + realGapX) * 2;
  53385. const filledHeight = cutHeight + realGapY;
  53386. const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
  53387. function drawImg(targetX = 0, targetY = 0) {
  53388. fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY + baselineOffset, cutWidth, cutHeight);
  53389. }
  53390. drawImg();
  53391. drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
  53392. drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
  53393. return [
  53394. fCanvas.toDataURL(),
  53395. filledWidth / ratio,
  53396. filledHeight / ratio
  53397. ];
  53398. }
  53399. return getClips;
  53400. }
  53401. //#endregion
  53402. //#region ../../packages/components/watermark/src/watermark.vue?vue&type=script&setup=true&lang.ts
  53403. var watermark_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  53404. name: "ElWatermark",
  53405. __name: "watermark",
  53406. props: watermarkProps,
  53407. setup(__props) {
  53408. const style = { position: "relative" };
  53409. const props = __props;
  53410. const fontGap = computed(() => props.font?.fontGap ?? 3);
  53411. const color = computed(() => props.font?.color ?? "rgba(0,0,0,.15)");
  53412. const fontSize = computed(() => props.font?.fontSize ?? 16);
  53413. const fontWeight = computed(() => props.font?.fontWeight ?? "normal");
  53414. const fontStyle = computed(() => props.font?.fontStyle ?? "normal");
  53415. const fontFamily = computed(() => props.font?.fontFamily ?? "sans-serif");
  53416. const textAlign = computed(() => props.font?.textAlign ?? "center");
  53417. const textBaseline = computed(() => props.font?.textBaseline ?? "hanging");
  53418. const gapX = computed(() => props.gap[0]);
  53419. const gapY = computed(() => props.gap[1]);
  53420. const gapXCenter = computed(() => gapX.value / 2);
  53421. const gapYCenter = computed(() => gapY.value / 2);
  53422. const offsetLeft = computed(() => props.offset?.[0] ?? gapXCenter.value);
  53423. const offsetTop = computed(() => props.offset?.[1] ?? gapYCenter.value);
  53424. const getMarkStyle = () => {
  53425. const markStyle = {
  53426. zIndex: props.zIndex,
  53427. position: "absolute",
  53428. left: 0,
  53429. top: 0,
  53430. width: "100%",
  53431. height: "100%",
  53432. pointerEvents: "none",
  53433. backgroundRepeat: "repeat"
  53434. };
  53435. /** Calculate the style of the offset */
  53436. let positionLeft = offsetLeft.value - gapXCenter.value;
  53437. let positionTop = offsetTop.value - gapYCenter.value;
  53438. if (positionLeft > 0) {
  53439. markStyle.left = `${positionLeft}px`;
  53440. markStyle.width = `calc(100% - ${positionLeft}px)`;
  53441. positionLeft = 0;
  53442. }
  53443. if (positionTop > 0) {
  53444. markStyle.top = `${positionTop}px`;
  53445. markStyle.height = `calc(100% - ${positionTop}px)`;
  53446. positionTop = 0;
  53447. }
  53448. markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
  53449. return markStyle;
  53450. };
  53451. const containerRef = shallowRef(null);
  53452. const watermarkRef = shallowRef();
  53453. const stopObservation = ref(false);
  53454. const destroyWatermark = () => {
  53455. if (watermarkRef.value) {
  53456. watermarkRef.value.remove();
  53457. watermarkRef.value = void 0;
  53458. }
  53459. };
  53460. const appendWatermark = (base64Url, markWidth) => {
  53461. if (containerRef.value && watermarkRef.value) {
  53462. stopObservation.value = true;
  53463. watermarkRef.value.setAttribute("style", getStyleStr({
  53464. ...getMarkStyle(),
  53465. backgroundImage: `url('${base64Url}')`,
  53466. backgroundSize: `${Math.floor(markWidth)}px`
  53467. }));
  53468. containerRef.value?.append(watermarkRef.value);
  53469. setTimeout(() => {
  53470. stopObservation.value = false;
  53471. });
  53472. }
  53473. };
  53474. /**
  53475. * Get the width and height of the watermark. The default values are as follows
  53476. * Image: [120, 64]; Content: It's calculated by content;
  53477. */
  53478. const getMarkSize = (ctx) => {
  53479. let defaultWidth = 120;
  53480. let defaultHeight = 64;
  53481. let space = 0;
  53482. const { image, content, width, height, rotate } = props;
  53483. if (!image && ctx.measureText) {
  53484. ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
  53485. const contents = isArray$1(content) ? content : [content];
  53486. let maxWidth = 0;
  53487. let maxHeight = 0;
  53488. contents.forEach((item) => {
  53489. const { width, fontBoundingBoxAscent, fontBoundingBoxDescent, actualBoundingBoxAscent, actualBoundingBoxDescent } = ctx.measureText(item);
  53490. const height = isUndefined(fontBoundingBoxAscent) ? actualBoundingBoxAscent + actualBoundingBoxDescent : fontBoundingBoxAscent + fontBoundingBoxDescent;
  53491. if (width > maxWidth) maxWidth = Math.ceil(width);
  53492. if (height > maxHeight) maxHeight = Math.ceil(height);
  53493. });
  53494. defaultWidth = maxWidth;
  53495. defaultHeight = maxHeight * contents.length + (contents.length - 1) * fontGap.value;
  53496. const angle = Math.PI / 180 * Number(rotate);
  53497. space = Math.ceil(Math.abs(Math.sin(angle) * defaultHeight) / 2);
  53498. defaultWidth += space;
  53499. }
  53500. return [
  53501. width ?? defaultWidth,
  53502. height ?? defaultHeight,
  53503. space
  53504. ];
  53505. };
  53506. const getClips = useClips();
  53507. const renderWatermark = () => {
  53508. const ctx = document.createElement("canvas").getContext("2d");
  53509. const image = props.image;
  53510. const content = props.content;
  53511. const rotate = props.rotate;
  53512. if (ctx) {
  53513. if (!watermarkRef.value) watermarkRef.value = document.createElement("div");
  53514. const ratio = getPixelRatio();
  53515. const [markWidth, markHeight, space] = getMarkSize(ctx);
  53516. const drawCanvas = (drawContent) => {
  53517. const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
  53518. color: color.value,
  53519. fontSize: fontSize.value,
  53520. fontStyle: fontStyle.value,
  53521. fontWeight: fontWeight.value,
  53522. fontFamily: fontFamily.value,
  53523. fontGap: fontGap.value,
  53524. textAlign: textAlign.value,
  53525. textBaseline: textBaseline.value
  53526. }, gapX.value, gapY.value, space);
  53527. appendWatermark(textClips, clipWidth);
  53528. };
  53529. if (image) {
  53530. const img = new Image();
  53531. img.onload = () => {
  53532. drawCanvas(img);
  53533. };
  53534. img.onerror = () => {
  53535. drawCanvas(content);
  53536. };
  53537. img.crossOrigin = "anonymous";
  53538. img.referrerPolicy = "no-referrer";
  53539. img.src = image;
  53540. } else drawCanvas(content);
  53541. }
  53542. };
  53543. onMounted(() => {
  53544. renderWatermark();
  53545. });
  53546. watch(() => props, () => {
  53547. renderWatermark();
  53548. }, {
  53549. deep: true,
  53550. flush: "post"
  53551. });
  53552. onBeforeUnmount(() => {
  53553. destroyWatermark();
  53554. });
  53555. const onMutate = (mutations) => {
  53556. if (stopObservation.value) return;
  53557. mutations.forEach((mutation) => {
  53558. if (reRendering(mutation, watermarkRef.value)) {
  53559. destroyWatermark();
  53560. renderWatermark();
  53561. }
  53562. });
  53563. };
  53564. useMutationObserver(containerRef, onMutate, {
  53565. attributes: true,
  53566. subtree: true,
  53567. childList: true
  53568. });
  53569. return (_ctx, _cache) => {
  53570. return openBlock(), createElementBlock("div", {
  53571. ref_key: "containerRef",
  53572. ref: containerRef,
  53573. style: normalizeStyle([style])
  53574. }, [renderSlot(_ctx.$slots, "default")], 4);
  53575. };
  53576. }
  53577. });
  53578. //#endregion
  53579. //#region ../../packages/components/watermark/src/watermark.vue
  53580. var watermark_default = watermark_vue_vue_type_script_setup_true_lang_default;
  53581. //#endregion
  53582. //#region ../../packages/components/watermark/index.ts
  53583. const ElWatermark = withInstall(watermark_default);
  53584. //#endregion
  53585. //#region ../../packages/components/tour/src/content.ts
  53586. const tourStrategies = ["absolute", "fixed"];
  53587. const tourPlacements = [
  53588. "top-start",
  53589. "top-end",
  53590. "top",
  53591. "bottom-start",
  53592. "bottom-end",
  53593. "bottom",
  53594. "left-start",
  53595. "left-end",
  53596. "left",
  53597. "right-start",
  53598. "right-end",
  53599. "right"
  53600. ];
  53601. /**
  53602. * @deprecated Removed after 3.0.0, Use `TourContentProps` instead.
  53603. */
  53604. const tourContentProps = buildProps({
  53605. placement: {
  53606. type: definePropType(String),
  53607. values: tourPlacements,
  53608. default: "bottom"
  53609. },
  53610. reference: {
  53611. type: definePropType(Object),
  53612. default: null
  53613. },
  53614. strategy: {
  53615. type: definePropType(String),
  53616. values: tourStrategies,
  53617. default: "absolute"
  53618. },
  53619. offset: {
  53620. type: Number,
  53621. default: 10
  53622. },
  53623. showArrow: Boolean,
  53624. zIndex: {
  53625. type: Number,
  53626. default: 2001
  53627. }
  53628. });
  53629. const tourContentEmits = { close: () => true };
  53630. //#endregion
  53631. //#region ../../packages/components/tour/src/tour.ts
  53632. /**
  53633. * @deprecated Removed after 3.0.0, Use `TourProps` instead.
  53634. */
  53635. const tourProps = buildProps({
  53636. modelValue: Boolean,
  53637. current: {
  53638. type: Number,
  53639. default: 0
  53640. },
  53641. showArrow: {
  53642. type: Boolean,
  53643. default: true
  53644. },
  53645. showClose: {
  53646. type: Boolean,
  53647. default: true
  53648. },
  53649. closeIcon: { type: iconPropType },
  53650. placement: tourContentProps.placement,
  53651. contentStyle: { type: definePropType([Object]) },
  53652. mask: {
  53653. type: definePropType([Boolean, Object]),
  53654. default: true
  53655. },
  53656. gap: {
  53657. type: definePropType(Object),
  53658. default: () => ({
  53659. offset: 6,
  53660. radius: 2
  53661. })
  53662. },
  53663. zIndex: { type: Number },
  53664. scrollIntoViewOptions: {
  53665. type: definePropType([Boolean, Object]),
  53666. default: () => ({ block: "center" })
  53667. },
  53668. type: { type: definePropType(String) },
  53669. appendTo: {
  53670. type: teleportProps.to.type,
  53671. default: "body"
  53672. },
  53673. closeOnPressEscape: {
  53674. type: Boolean,
  53675. default: true
  53676. },
  53677. targetAreaClickable: {
  53678. type: Boolean,
  53679. default: true
  53680. }
  53681. });
  53682. const tourEmits = {
  53683. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  53684. ["update:current"]: (current) => isNumber(current),
  53685. close: (current) => isNumber(current),
  53686. finish: () => true,
  53687. change: (current) => isNumber(current)
  53688. };
  53689. //#endregion
  53690. //#region ../../packages/components/tour/src/mask.ts
  53691. /**
  53692. * @deprecated Removed after 3.0.0, Use `MaskProps` instead.
  53693. */
  53694. const maskProps = buildProps({
  53695. zIndex: {
  53696. type: Number,
  53697. default: 1001
  53698. },
  53699. visible: Boolean,
  53700. fill: {
  53701. type: String,
  53702. default: "rgba(0,0,0,0.5)"
  53703. },
  53704. pos: { type: definePropType(Object) },
  53705. targetAreaClickable: {
  53706. type: Boolean,
  53707. default: true
  53708. }
  53709. });
  53710. //#endregion
  53711. //#region ../../packages/components/tour/src/helper.ts
  53712. const useTarget = (target, open, gap, mergedMask, scrollIntoViewOptions) => {
  53713. const posInfo = ref(null);
  53714. const getTargetEl = () => {
  53715. let targetEl;
  53716. if (isString(target.value)) targetEl = document.querySelector(target.value);
  53717. else if (isFunction$1(target.value)) targetEl = target.value();
  53718. else targetEl = target.value;
  53719. return targetEl;
  53720. };
  53721. const updatePosInfo = () => {
  53722. const targetEl = getTargetEl();
  53723. if (!targetEl || !open.value) {
  53724. posInfo.value = null;
  53725. return;
  53726. }
  53727. if (!isInViewPort(targetEl)) targetEl.scrollIntoView(scrollIntoViewOptions.value);
  53728. const { left, top, width, height } = targetEl.getBoundingClientRect();
  53729. posInfo.value = {
  53730. left,
  53731. top,
  53732. width,
  53733. height,
  53734. radius: 0
  53735. };
  53736. };
  53737. onMounted(() => {
  53738. watch([open, target], () => {
  53739. updatePosInfo();
  53740. }, { immediate: true });
  53741. window.addEventListener("resize", updatePosInfo);
  53742. });
  53743. onBeforeUnmount(() => {
  53744. window.removeEventListener("resize", updatePosInfo);
  53745. });
  53746. const getGapOffset = (index) => (isArray$1(gap.value.offset) ? gap.value.offset[index] : gap.value.offset) ?? 6;
  53747. const mergedPosInfo = computed(() => {
  53748. if (!posInfo.value) return posInfo.value;
  53749. const gapOffsetX = getGapOffset(0);
  53750. const gapOffsetY = getGapOffset(1);
  53751. const gapRadius = gap.value?.radius || 2;
  53752. return {
  53753. left: posInfo.value.left - gapOffsetX,
  53754. top: posInfo.value.top - gapOffsetY,
  53755. width: posInfo.value.width + gapOffsetX * 2,
  53756. height: posInfo.value.height + gapOffsetY * 2,
  53757. radius: gapRadius
  53758. };
  53759. });
  53760. return {
  53761. mergedPosInfo,
  53762. triggerTarget: computed(() => {
  53763. const targetEl = getTargetEl();
  53764. if (!mergedMask.value || !targetEl || !window.DOMRect) return targetEl || void 0;
  53765. return { getBoundingClientRect() {
  53766. return window.DOMRect.fromRect({
  53767. width: mergedPosInfo.value?.width || 0,
  53768. height: mergedPosInfo.value?.height || 0,
  53769. x: mergedPosInfo.value?.left || 0,
  53770. y: mergedPosInfo.value?.top || 0
  53771. });
  53772. } };
  53773. })
  53774. };
  53775. };
  53776. const tourKey = Symbol("ElTour");
  53777. function isInViewPort(element) {
  53778. const viewWidth = window.innerWidth || document.documentElement.clientWidth;
  53779. const viewHeight = window.innerHeight || document.documentElement.clientHeight;
  53780. const { top, right, bottom, left } = element.getBoundingClientRect();
  53781. return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
  53782. }
  53783. const useFloating$1 = (referenceRef, contentRef, arrowRef, placement, strategy, offset$2, zIndex, showArrow) => {
  53784. const x = ref();
  53785. const y = ref();
  53786. const middlewareData = ref({});
  53787. const states = {
  53788. x,
  53789. y,
  53790. placement,
  53791. strategy,
  53792. middlewareData
  53793. };
  53794. const middleware = computed(() => {
  53795. const _middleware = [
  53796. offset(unref(offset$2)),
  53797. flip(),
  53798. shift(),
  53799. overflowMiddleware()
  53800. ];
  53801. if (unref(showArrow) && unref(arrowRef)) _middleware.push(arrow({ element: unref(arrowRef) }));
  53802. return _middleware;
  53803. });
  53804. const update = async () => {
  53805. if (!isClient) return;
  53806. const referenceEl = unref(referenceRef);
  53807. const contentEl = unref(contentRef);
  53808. if (!referenceEl || !contentEl) return;
  53809. const data = await computePosition(referenceEl, contentEl, {
  53810. placement: unref(placement),
  53811. strategy: unref(strategy),
  53812. middleware: unref(middleware)
  53813. });
  53814. keysOf(states).forEach((key) => {
  53815. states[key].value = data[key];
  53816. });
  53817. };
  53818. const contentStyle = computed(() => {
  53819. if (!unref(referenceRef)) return {
  53820. position: "fixed",
  53821. top: "50%",
  53822. left: "50%",
  53823. transform: "translate3d(-50%, -50%, 0)",
  53824. maxWidth: "100vw",
  53825. zIndex: unref(zIndex)
  53826. };
  53827. const { overflow } = unref(middlewareData);
  53828. return {
  53829. position: unref(strategy),
  53830. zIndex: unref(zIndex),
  53831. top: unref(y) != null ? `${unref(y)}px` : "",
  53832. left: unref(x) != null ? `${unref(x)}px` : "",
  53833. maxWidth: overflow?.maxWidth ? `${overflow?.maxWidth}px` : ""
  53834. };
  53835. });
  53836. const arrowStyle = computed(() => {
  53837. if (!unref(showArrow)) return {};
  53838. const { arrow } = unref(middlewareData);
  53839. return {
  53840. left: arrow?.x != null ? `${arrow?.x}px` : "",
  53841. top: arrow?.y != null ? `${arrow?.y}px` : ""
  53842. };
  53843. });
  53844. let cleanup;
  53845. onMounted(() => {
  53846. const referenceEl = unref(referenceRef);
  53847. const contentEl = unref(contentRef);
  53848. if (referenceEl && contentEl) cleanup = autoUpdate(referenceEl, contentEl, update);
  53849. watchEffect(() => {
  53850. update();
  53851. });
  53852. });
  53853. onBeforeUnmount(() => {
  53854. cleanup && cleanup();
  53855. });
  53856. return {
  53857. update,
  53858. contentStyle,
  53859. arrowStyle
  53860. };
  53861. };
  53862. const overflowMiddleware = () => {
  53863. return {
  53864. name: "overflow",
  53865. async fn(state) {
  53866. const overflow = await detectOverflow(state);
  53867. let overWidth = 0;
  53868. if (overflow.left > 0) overWidth = overflow.left;
  53869. if (overflow.right > 0) overWidth = overflow.right;
  53870. return { data: { maxWidth: state.rects.floating.width - overWidth } };
  53871. }
  53872. };
  53873. };
  53874. //#endregion
  53875. //#region ../../packages/components/tour/src/mask.vue?vue&type=script&setup=true&lang.ts
  53876. const _hoisted_1$8 = { style: {
  53877. width: "100%",
  53878. height: "100%"
  53879. } };
  53880. const _hoisted_2$4 = ["d"];
  53881. var mask_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  53882. name: "ElTourMask",
  53883. inheritAttrs: false,
  53884. __name: "mask",
  53885. props: maskProps,
  53886. setup(__props) {
  53887. const props = __props;
  53888. const { ns } = inject(tourKey);
  53889. const radius = computed(() => props.pos?.radius ?? 2);
  53890. const roundInfo = computed(() => {
  53891. const v = radius.value;
  53892. const baseInfo = `a${v},${v} 0 0 1`;
  53893. return {
  53894. topRight: `${baseInfo} ${v},${v}`,
  53895. bottomRight: `${baseInfo} ${-v},${v}`,
  53896. bottomLeft: `${baseInfo} ${-v},${-v}`,
  53897. topLeft: `${baseInfo} ${v},${-v}`
  53898. };
  53899. });
  53900. const { width: windowWidth, height: windowHeight } = useWindowSize();
  53901. const path = computed(() => {
  53902. const width = windowWidth.value;
  53903. const height = windowHeight.value;
  53904. const info = roundInfo.value;
  53905. const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
  53906. const _radius = radius.value;
  53907. return props.pos ? `${_path} M${props.pos.left + _radius},${props.pos.top} h${props.pos.width - _radius * 2} ${info.topRight} v${props.pos.height - _radius * 2} ${info.bottomRight} h${-props.pos.width + _radius * 2} ${info.bottomLeft} v${-props.pos.height + _radius * 2} ${info.topLeft} z` : _path;
  53908. });
  53909. const maskStyle = computed(() => ({
  53910. position: "fixed",
  53911. left: 0,
  53912. right: 0,
  53913. top: 0,
  53914. bottom: 0,
  53915. zIndex: props.zIndex,
  53916. pointerEvents: props.pos && props.targetAreaClickable ? "none" : "auto"
  53917. }));
  53918. const pathStyle = computed(() => ({
  53919. fill: props.fill,
  53920. pointerEvents: "auto",
  53921. cursor: "auto"
  53922. }));
  53923. useLockscreen(toRef(props, "visible"), { ns });
  53924. return (_ctx, _cache) => {
  53925. return __props.visible ? (openBlock(), createElementBlock("div", mergeProps({
  53926. key: 0,
  53927. class: unref(ns).e("mask"),
  53928. style: maskStyle.value
  53929. }, _ctx.$attrs), [(openBlock(), createElementBlock("svg", _hoisted_1$8, [createElementVNode("path", {
  53930. class: normalizeClass(unref(ns).e("hollow")),
  53931. style: normalizeStyle(pathStyle.value),
  53932. d: path.value
  53933. }, null, 14, _hoisted_2$4)]))], 16)) : createCommentVNode("v-if", true);
  53934. };
  53935. }
  53936. });
  53937. //#endregion
  53938. //#region ../../packages/components/tour/src/mask.vue
  53939. var mask_default = mask_vue_vue_type_script_setup_true_lang_default;
  53940. //#endregion
  53941. //#region ../../packages/components/tour/src/content.vue?vue&type=script&setup=true&lang.ts
  53942. const _hoisted_1$7 = ["data-side"];
  53943. var content_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  53944. name: "ElTourContent",
  53945. __name: "content",
  53946. props: tourContentProps,
  53947. emits: tourContentEmits,
  53948. setup(__props, { emit: __emit }) {
  53949. const props = __props;
  53950. const emit = __emit;
  53951. const placement = ref(props.placement);
  53952. const strategy = ref(props.strategy);
  53953. const contentRef = ref(null);
  53954. const arrowRef = ref(null);
  53955. watch(() => props.placement, () => {
  53956. placement.value = props.placement;
  53957. });
  53958. const { contentStyle, arrowStyle } = useFloating$1(toRef(props, "reference"), contentRef, arrowRef, placement, strategy, toRef(props, "offset"), toRef(props, "zIndex"), toRef(props, "showArrow"));
  53959. const side = computed(() => {
  53960. return placement.value.split("-")[0];
  53961. });
  53962. const { ns } = inject(tourKey);
  53963. const onCloseRequested = () => {
  53964. emit("close");
  53965. };
  53966. const onFocusoutPrevented = (event) => {
  53967. if (event.detail.focusReason === "pointer") event.preventDefault();
  53968. };
  53969. return (_ctx, _cache) => {
  53970. return openBlock(), createElementBlock("div", {
  53971. ref_key: "contentRef",
  53972. ref: contentRef,
  53973. style: normalizeStyle(unref(contentStyle)),
  53974. class: normalizeClass(unref(ns).e("content")),
  53975. "data-side": side.value,
  53976. tabindex: "-1"
  53977. }, [createVNode(unref(focus_trap_default), {
  53978. loop: "",
  53979. trapped: "",
  53980. "focus-start-el": "container",
  53981. "focus-trap-el": contentRef.value || void 0,
  53982. onReleaseRequested: onCloseRequested,
  53983. onFocusoutPrevented
  53984. }, {
  53985. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  53986. _: 3
  53987. }, 8, ["focus-trap-el"]), __props.showArrow ? (openBlock(), createElementBlock("span", {
  53988. key: 0,
  53989. ref_key: "arrowRef",
  53990. ref: arrowRef,
  53991. style: normalizeStyle(unref(arrowStyle)),
  53992. class: normalizeClass(unref(ns).e("arrow"))
  53993. }, null, 6)) : createCommentVNode("v-if", true)], 14, _hoisted_1$7);
  53994. };
  53995. }
  53996. });
  53997. //#endregion
  53998. //#region ../../packages/components/tour/src/content.vue
  53999. var content_default$1 = content_vue_vue_type_script_setup_true_lang_default;
  54000. //#endregion
  54001. //#region ../../packages/components/tour/src/steps.ts
  54002. var steps_default = defineComponent({
  54003. name: "ElTourSteps",
  54004. props: { current: {
  54005. type: Number,
  54006. default: 0
  54007. } },
  54008. emits: ["update-total"],
  54009. setup(props, { slots, emit }) {
  54010. let cacheTotal = 0;
  54011. return () => {
  54012. const children = slots.default?.();
  54013. const result = [];
  54014. let total = 0;
  54015. function filterSteps(children) {
  54016. if (!isArray$1(children)) return;
  54017. children.forEach((item) => {
  54018. if ((item?.type || {})?.name === "ElTourStep") {
  54019. result.push(item);
  54020. total += 1;
  54021. }
  54022. });
  54023. }
  54024. if (children.length) filterSteps(flattedChildren(children[0]?.children));
  54025. if (cacheTotal !== total) {
  54026. cacheTotal = total;
  54027. emit("update-total", total);
  54028. }
  54029. if (result.length) return result[props.current];
  54030. return null;
  54031. };
  54032. }
  54033. });
  54034. //#endregion
  54035. //#region ../../packages/components/tour/src/tour.vue?vue&type=script&setup=true&lang.ts
  54036. var tour_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  54037. name: "ElTour",
  54038. inheritAttrs: false,
  54039. __name: "tour",
  54040. props: tourProps,
  54041. emits: tourEmits,
  54042. setup(__props, { emit: __emit }) {
  54043. const props = __props;
  54044. const emit = __emit;
  54045. const ns = useNamespace("tour");
  54046. const total = ref(0);
  54047. const currentStep = ref();
  54048. const current = useVModel(props, "current", emit, { passive: true });
  54049. const currentTarget = computed(() => currentStep.value?.target);
  54050. const kls = computed(() => [ns.b(), mergedType.value === "primary" ? ns.m("primary") : ""]);
  54051. const mergedPlacement = computed(() => currentStep.value?.placement || props.placement);
  54052. const mergedContentStyle = computed(() => currentStep.value?.contentStyle ?? props.contentStyle);
  54053. const mergedMask = computed(() => currentStep.value?.mask ?? props.mask);
  54054. const mergedShowMask = computed(() => !!mergedMask.value && props.modelValue);
  54055. const mergedMaskStyle = computed(() => isBoolean(mergedMask.value) ? void 0 : mergedMask.value);
  54056. const mergedShowArrow = computed(() => !!currentTarget.value && (currentStep.value?.showArrow ?? props.showArrow));
  54057. const mergedScrollIntoViewOptions = computed(() => currentStep.value?.scrollIntoViewOptions ?? props.scrollIntoViewOptions);
  54058. const mergedType = computed(() => currentStep.value?.type ?? props.type);
  54059. const { nextZIndex } = useZIndex();
  54060. const nowZIndex = nextZIndex();
  54061. const mergedZIndex = computed(() => props.zIndex ?? nowZIndex);
  54062. const { mergedPosInfo: pos, triggerTarget } = useTarget(currentTarget, toRef(props, "modelValue"), toRef(props, "gap"), mergedMask, mergedScrollIntoViewOptions);
  54063. watch(() => props.modelValue, (val) => {
  54064. if (!val) current.value = 0;
  54065. });
  54066. const onEscClose = () => {
  54067. if (props.closeOnPressEscape) {
  54068. emit(UPDATE_MODEL_EVENT, false);
  54069. emit("close", current.value);
  54070. }
  54071. };
  54072. const onUpdateTotal = (val) => {
  54073. total.value = val;
  54074. };
  54075. const slots = useSlots();
  54076. provide(tourKey, {
  54077. currentStep,
  54078. current,
  54079. total,
  54080. showClose: toRef(props, "showClose"),
  54081. closeIcon: toRef(props, "closeIcon"),
  54082. mergedType,
  54083. ns,
  54084. slots,
  54085. updateModelValue(modelValue) {
  54086. emit(UPDATE_MODEL_EVENT, modelValue);
  54087. },
  54088. onClose() {
  54089. emit("close", current.value);
  54090. },
  54091. onFinish() {
  54092. emit("finish");
  54093. },
  54094. onChange() {
  54095. emit(CHANGE_EVENT, current.value);
  54096. }
  54097. });
  54098. return (_ctx, _cache) => {
  54099. return openBlock(), createElementBlock(Fragment, null, [
  54100. createVNode(unref(ElTeleport), { to: __props.appendTo }, {
  54101. default: withCtx(() => [createElementVNode("div", mergeProps({ class: kls.value }, _ctx.$attrs), [createVNode(mask_default, {
  54102. visible: mergedShowMask.value,
  54103. fill: mergedMaskStyle.value?.color,
  54104. style: normalizeStyle(mergedMaskStyle.value?.style),
  54105. pos: unref(pos),
  54106. "z-index": mergedZIndex.value,
  54107. "target-area-clickable": __props.targetAreaClickable
  54108. }, null, 8, [
  54109. "visible",
  54110. "fill",
  54111. "style",
  54112. "pos",
  54113. "z-index",
  54114. "target-area-clickable"
  54115. ]), __props.modelValue ? (openBlock(), createBlock(content_default$1, {
  54116. key: unref(current),
  54117. reference: unref(triggerTarget),
  54118. placement: mergedPlacement.value,
  54119. "show-arrow": mergedShowArrow.value,
  54120. "z-index": mergedZIndex.value,
  54121. style: normalizeStyle(mergedContentStyle.value),
  54122. onClose: onEscClose
  54123. }, {
  54124. default: withCtx(() => [createVNode(unref(steps_default), {
  54125. current: unref(current),
  54126. onUpdateTotal
  54127. }, {
  54128. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  54129. _: 3
  54130. }, 8, ["current"])]),
  54131. _: 3
  54132. }, 8, [
  54133. "reference",
  54134. "placement",
  54135. "show-arrow",
  54136. "z-index",
  54137. "style"
  54138. ])) : createCommentVNode("v-if", true)], 16)]),
  54139. _: 3
  54140. }, 8, ["to"]),
  54141. createCommentVNode(" just for IDE "),
  54142. createCommentVNode("v-if", true)
  54143. ], 64);
  54144. };
  54145. }
  54146. });
  54147. //#endregion
  54148. //#region ../../packages/components/tour/src/tour.vue
  54149. var tour_default = tour_vue_vue_type_script_setup_true_lang_default;
  54150. //#endregion
  54151. //#region ../../packages/components/tour/src/step.ts
  54152. /**
  54153. * @deprecated Removed after 3.0.0, Use `TourStepProps` instead.
  54154. */
  54155. const tourStepProps = buildProps({
  54156. target: { type: definePropType([
  54157. String,
  54158. Object,
  54159. Function
  54160. ]) },
  54161. title: String,
  54162. description: String,
  54163. showClose: {
  54164. type: Boolean,
  54165. default: void 0
  54166. },
  54167. closeIcon: { type: iconPropType },
  54168. showArrow: {
  54169. type: Boolean,
  54170. default: void 0
  54171. },
  54172. placement: tourContentProps.placement,
  54173. mask: {
  54174. type: definePropType([Boolean, Object]),
  54175. default: void 0
  54176. },
  54177. contentStyle: { type: definePropType([Object]) },
  54178. prevButtonProps: { type: definePropType(Object) },
  54179. nextButtonProps: { type: definePropType(Object) },
  54180. scrollIntoViewOptions: {
  54181. type: definePropType([Boolean, Object]),
  54182. default: void 0
  54183. },
  54184. type: { type: definePropType(String) }
  54185. });
  54186. const tourStepEmits = { close: () => true };
  54187. //#endregion
  54188. //#region ../../packages/components/tour/src/step.vue?vue&type=script&setup=true&lang.ts
  54189. const _hoisted_1$6 = ["aria-label"];
  54190. var step_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  54191. name: "ElTourStep",
  54192. __name: "step",
  54193. props: tourStepProps,
  54194. emits: tourStepEmits,
  54195. setup(__props, { emit: __emit }) {
  54196. const props = __props;
  54197. const emit = __emit;
  54198. const { Close } = CloseComponents;
  54199. const { t } = useLocale();
  54200. const { currentStep, current, total, showClose, closeIcon, mergedType, ns, slots: tourSlots, updateModelValue, onClose: tourOnClose, onFinish: tourOnFinish, onChange } = inject(tourKey);
  54201. watch(props, (val) => {
  54202. currentStep.value = val;
  54203. }, { immediate: true });
  54204. const mergedShowClose = computed(() => props.showClose ?? showClose.value);
  54205. const mergedCloseIcon = computed(() => props.closeIcon ?? closeIcon.value ?? Close);
  54206. const filterButtonProps = (btnProps) => {
  54207. if (!btnProps) return;
  54208. return omit(btnProps, ["children", "onClick"]);
  54209. };
  54210. const onPrev = () => {
  54211. current.value -= 1;
  54212. if (props.prevButtonProps?.onClick) props.prevButtonProps?.onClick();
  54213. onChange();
  54214. };
  54215. const onNext = () => {
  54216. if (current.value >= total.value - 1) onFinish();
  54217. else current.value += 1;
  54218. if (props.nextButtonProps?.onClick) props.nextButtonProps.onClick();
  54219. onChange();
  54220. };
  54221. const onFinish = () => {
  54222. onClose();
  54223. tourOnFinish();
  54224. };
  54225. const onClose = () => {
  54226. updateModelValue(false);
  54227. tourOnClose();
  54228. emit("close");
  54229. };
  54230. const handleKeydown = (e) => {
  54231. if (e.target?.isContentEditable) return;
  54232. switch (getEventCode(e)) {
  54233. case EVENT_CODE.left:
  54234. e.preventDefault();
  54235. current.value > 0 && onPrev();
  54236. break;
  54237. case EVENT_CODE.right:
  54238. e.preventDefault();
  54239. onNext();
  54240. break;
  54241. }
  54242. };
  54243. onMounted(() => {
  54244. window.addEventListener("keydown", handleKeydown);
  54245. });
  54246. onBeforeUnmount(() => {
  54247. window.removeEventListener("keydown", handleKeydown);
  54248. });
  54249. return (_ctx, _cache) => {
  54250. return openBlock(), createElementBlock(Fragment, null, [
  54251. mergedShowClose.value ? (openBlock(), createElementBlock("button", {
  54252. key: 0,
  54253. "aria-label": unref(t)("el.tour.close"),
  54254. class: normalizeClass(unref(ns).e("closebtn")),
  54255. type: "button",
  54256. onClick: onClose
  54257. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(ns).e("close")) }, {
  54258. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(mergedCloseIcon.value)))]),
  54259. _: 1
  54260. }, 8, ["class"])], 10, _hoisted_1$6)) : createCommentVNode("v-if", true),
  54261. createElementVNode("header", { class: normalizeClass([unref(ns).e("header"), { "show-close": unref(showClose) }]) }, [renderSlot(_ctx.$slots, "header", {}, () => [createElementVNode("span", {
  54262. role: "heading",
  54263. class: normalizeClass(unref(ns).e("title"))
  54264. }, toDisplayString(__props.title), 3)])], 2),
  54265. createElementVNode("div", { class: normalizeClass(unref(ns).e("body")) }, [renderSlot(_ctx.$slots, "default", {}, () => [createElementVNode("span", null, toDisplayString(__props.description), 1)])], 2),
  54266. createElementVNode("footer", { class: normalizeClass(unref(ns).e("footer")) }, [createElementVNode("div", { class: normalizeClass(unref(ns).b("indicators")) }, [unref(tourSlots).indicators ? (openBlock(), createBlock(resolveDynamicComponent(unref(tourSlots).indicators), {
  54267. key: 0,
  54268. current: unref(current),
  54269. total: unref(total)
  54270. }, null, 8, ["current", "total"])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(total), (item, index) => {
  54271. return openBlock(), createElementBlock("span", {
  54272. key: item,
  54273. class: normalizeClass([unref(ns).b("indicator"), unref(ns).is("active", index === unref(current))])
  54274. }, null, 2);
  54275. }), 128))], 2), createElementVNode("div", { class: normalizeClass(unref(ns).b("buttons")) }, [unref(current) > 0 ? (openBlock(), createBlock(unref(ElButton), mergeProps({
  54276. key: 0,
  54277. size: "small",
  54278. type: unref(mergedType)
  54279. }, filterButtonProps(__props.prevButtonProps), { onClick: onPrev }), {
  54280. default: withCtx(() => [createTextVNode(toDisplayString(__props.prevButtonProps?.children ?? unref(t)("el.tour.previous")), 1)]),
  54281. _: 1
  54282. }, 16, ["type"])) : createCommentVNode("v-if", true), unref(current) <= unref(total) - 1 ? (openBlock(), createBlock(unref(ElButton), mergeProps({
  54283. key: 1,
  54284. size: "small",
  54285. type: unref(mergedType) === "primary" ? "default" : "primary"
  54286. }, filterButtonProps(__props.nextButtonProps), { onClick: onNext }), {
  54287. default: withCtx(() => [createTextVNode(toDisplayString(__props.nextButtonProps?.children ?? (unref(current) === unref(total) - 1 ? unref(t)("el.tour.finish") : unref(t)("el.tour.next"))), 1)]),
  54288. _: 1
  54289. }, 16, ["type"])) : createCommentVNode("v-if", true)], 2)], 2)
  54290. ], 64);
  54291. };
  54292. }
  54293. });
  54294. //#endregion
  54295. //#region ../../packages/components/tour/src/step.vue
  54296. var step_default = step_vue_vue_type_script_setup_true_lang_default;
  54297. //#endregion
  54298. //#region ../../packages/components/tour/index.ts
  54299. const ElTour = withInstall(tour_default, { TourStep: step_default });
  54300. const ElTourStep = withNoopInstall(step_default);
  54301. //#endregion
  54302. //#region ../../packages/components/anchor/src/anchor.ts
  54303. /**
  54304. * @deprecated Removed after 3.0.0, Use `AnchorProps` instead.
  54305. */
  54306. const anchorProps = buildProps({
  54307. container: { type: definePropType([String, Object]) },
  54308. offset: {
  54309. type: Number,
  54310. default: 0
  54311. },
  54312. bound: {
  54313. type: Number,
  54314. default: 15
  54315. },
  54316. duration: {
  54317. type: Number,
  54318. default: 300
  54319. },
  54320. marker: {
  54321. type: Boolean,
  54322. default: true
  54323. },
  54324. type: {
  54325. type: definePropType(String),
  54326. default: "default"
  54327. },
  54328. direction: {
  54329. type: definePropType(String),
  54330. default: "vertical"
  54331. },
  54332. selectScrollTop: Boolean
  54333. });
  54334. const anchorEmits = {
  54335. change: (href) => isString(href),
  54336. click: (e, href) => e instanceof MouseEvent && (isString(href) || isUndefined(href))
  54337. };
  54338. //#endregion
  54339. //#region ../../packages/components/anchor/src/constants.ts
  54340. const anchorKey = Symbol("anchor");
  54341. //#endregion
  54342. //#region ../../packages/components/anchor/src/anchor.vue?vue&type=script&setup=true&lang.ts
  54343. var anchor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  54344. name: "ElAnchor",
  54345. __name: "anchor",
  54346. props: anchorProps,
  54347. emits: anchorEmits,
  54348. setup(__props, { expose: __expose, emit: __emit }) {
  54349. const props = __props;
  54350. const emit = __emit;
  54351. const slots = useSlots();
  54352. const currentAnchor = ref("");
  54353. const markerStyle = ref({});
  54354. const anchorRef = ref(null);
  54355. const markerRef = ref(null);
  54356. const containerEl = ref();
  54357. const links = {};
  54358. let isScrolling = false;
  54359. let currentScrollTop = 0;
  54360. const ns = useNamespace("anchor");
  54361. const cls = computed(() => [
  54362. ns.b(),
  54363. props.type === "underline" ? ns.m("underline") : "",
  54364. ns.m(props.direction)
  54365. ]);
  54366. const addLink = (state) => {
  54367. links[state.href] = state.el;
  54368. };
  54369. const removeLink = (href) => {
  54370. delete links[href];
  54371. };
  54372. const setCurrentAnchor = (href) => {
  54373. if (currentAnchor.value !== href) {
  54374. currentAnchor.value = href;
  54375. emit(CHANGE_EVENT, href);
  54376. }
  54377. };
  54378. let clearAnimate = null;
  54379. let currentTargetHref = "";
  54380. const scrollToAnchor = (href) => {
  54381. if (!containerEl.value) return;
  54382. const target = getElement(href);
  54383. if (!target) return;
  54384. if (clearAnimate) {
  54385. if (currentTargetHref === href) return;
  54386. clearAnimate();
  54387. }
  54388. currentTargetHref = href;
  54389. isScrolling = true;
  54390. const scrollEle = getScrollElement(target, containerEl.value);
  54391. const distance = getOffsetTopDistance(target, scrollEle);
  54392. const max = scrollEle.scrollHeight - scrollEle.clientHeight;
  54393. const to = Math.min(distance - props.offset, max);
  54394. clearAnimate = animateScrollTo(containerEl.value, currentScrollTop, to, props.duration, () => {
  54395. setTimeout(() => {
  54396. isScrolling = false;
  54397. currentTargetHref = "";
  54398. }, 20);
  54399. });
  54400. };
  54401. const scrollTo = (href) => {
  54402. if (href) {
  54403. setCurrentAnchor(href);
  54404. scrollToAnchor(href);
  54405. }
  54406. };
  54407. const handleClick = (e, href) => {
  54408. emit("click", e, href);
  54409. scrollTo(href);
  54410. };
  54411. const handleScroll = throttleByRaf(() => {
  54412. if (containerEl.value) currentScrollTop = getScrollTop(containerEl.value);
  54413. const currentHref = getCurrentHref();
  54414. if (isScrolling || isUndefined(currentHref)) return;
  54415. setCurrentAnchor(currentHref);
  54416. });
  54417. const getCurrentHref = () => {
  54418. if (!containerEl.value) return;
  54419. const scrollTop = getScrollTop(containerEl.value);
  54420. const anchorTopList = [];
  54421. for (const href of Object.keys(links)) {
  54422. const target = getElement(href);
  54423. if (!target) continue;
  54424. const distance = getOffsetTopDistance(target, getScrollElement(target, containerEl.value));
  54425. anchorTopList.push({
  54426. top: distance - props.offset - props.bound,
  54427. href
  54428. });
  54429. }
  54430. anchorTopList.sort((prev, next) => prev.top - next.top);
  54431. for (let i = 0; i < anchorTopList.length; i++) {
  54432. const item = anchorTopList[i];
  54433. const next = anchorTopList[i + 1];
  54434. if (i === 0 && scrollTop === 0) return props.selectScrollTop ? item.href : "";
  54435. if (item.top <= scrollTop && (!next || next.top > scrollTop)) return item.href;
  54436. }
  54437. };
  54438. const getContainer = () => {
  54439. const el = getElement(props.container);
  54440. if (!el || isWindow(el)) containerEl.value = window;
  54441. else containerEl.value = el;
  54442. };
  54443. useEventListener(containerEl, "scroll", handleScroll);
  54444. const updateMarkerStyle = () => {
  54445. nextTick(() => {
  54446. if (!anchorRef.value || !markerRef.value || !currentAnchor.value) {
  54447. markerStyle.value = {};
  54448. return;
  54449. }
  54450. const currentLinkEl = links[currentAnchor.value];
  54451. if (!currentLinkEl) {
  54452. markerStyle.value = {};
  54453. return;
  54454. }
  54455. const anchorRect = anchorRef.value.getBoundingClientRect();
  54456. const markerRect = markerRef.value.getBoundingClientRect();
  54457. const linkRect = currentLinkEl.getBoundingClientRect();
  54458. if (props.direction === "horizontal") markerStyle.value = {
  54459. left: `${linkRect.left - anchorRect.left}px`,
  54460. width: `${linkRect.width}px`,
  54461. opacity: 1
  54462. };
  54463. else markerStyle.value = {
  54464. top: `${linkRect.top - anchorRect.top + (linkRect.height - markerRect.height) / 2}px`,
  54465. opacity: 1
  54466. };
  54467. });
  54468. };
  54469. watch(currentAnchor, updateMarkerStyle);
  54470. watch(() => slots.default?.(), updateMarkerStyle);
  54471. onMounted(() => {
  54472. getContainer();
  54473. const hash = decodeURIComponent(window.location.hash);
  54474. if (getElement(hash)) scrollTo(hash);
  54475. else handleScroll();
  54476. });
  54477. watch(() => props.container, () => {
  54478. getContainer();
  54479. });
  54480. provide(anchorKey, {
  54481. ns,
  54482. direction: props.direction,
  54483. currentAnchor,
  54484. addLink,
  54485. removeLink,
  54486. handleClick
  54487. });
  54488. __expose({ scrollTo });
  54489. return (_ctx, _cache) => {
  54490. return openBlock(), createElementBlock("div", {
  54491. ref_key: "anchorRef",
  54492. ref: anchorRef,
  54493. class: normalizeClass(cls.value)
  54494. }, [__props.marker ? (openBlock(), createElementBlock("div", {
  54495. key: 0,
  54496. ref_key: "markerRef",
  54497. ref: markerRef,
  54498. class: normalizeClass(unref(ns).e("marker")),
  54499. style: normalizeStyle(markerStyle.value)
  54500. }, null, 6)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("list")) }, [renderSlot(_ctx.$slots, "default")], 2)], 2);
  54501. };
  54502. }
  54503. });
  54504. //#endregion
  54505. //#region ../../packages/components/anchor/src/anchor.vue
  54506. var anchor_default = anchor_vue_vue_type_script_setup_true_lang_default;
  54507. //#endregion
  54508. //#region ../../packages/components/anchor/src/anchor-link.ts
  54509. /**
  54510. * @deprecated Removed after 3.0.0, Use `AnchorLinkProps` instead.
  54511. */
  54512. const anchorLinkProps = buildProps({
  54513. title: String,
  54514. href: String
  54515. });
  54516. //#endregion
  54517. //#region ../../packages/components/anchor/src/anchor-link.vue?vue&type=script&setup=true&lang.ts
  54518. const _hoisted_1$5 = ["href"];
  54519. var anchor_link_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  54520. name: "ElAnchorLink",
  54521. __name: "anchor-link",
  54522. props: anchorLinkProps,
  54523. setup(__props) {
  54524. const props = __props;
  54525. const linkRef = ref(null);
  54526. const { ns, direction, currentAnchor, addLink, removeLink, handleClick: contextHandleClick } = inject(anchorKey);
  54527. const cls = computed(() => [ns.e("link"), ns.is("active", currentAnchor.value === props.href)]);
  54528. const handleClick = (e) => {
  54529. contextHandleClick(e, props.href);
  54530. };
  54531. watch(() => props.href, (val, oldVal) => {
  54532. nextTick(() => {
  54533. if (oldVal) removeLink(oldVal);
  54534. if (val) addLink({
  54535. href: val,
  54536. el: linkRef.value
  54537. });
  54538. });
  54539. });
  54540. onMounted(() => {
  54541. const { href } = props;
  54542. if (href) addLink({
  54543. href,
  54544. el: linkRef.value
  54545. });
  54546. });
  54547. onBeforeUnmount(() => {
  54548. const { href } = props;
  54549. if (href) removeLink(href);
  54550. });
  54551. return (_ctx, _cache) => {
  54552. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).e("item")) }, [createElementVNode("a", {
  54553. ref_key: "linkRef",
  54554. ref: linkRef,
  54555. class: normalizeClass(cls.value),
  54556. href: __props.href,
  54557. onClick: handleClick
  54558. }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 10, _hoisted_1$5), _ctx.$slots["sub-link"] && unref(direction) === "vertical" ? (openBlock(), createElementBlock("div", {
  54559. key: 0,
  54560. class: normalizeClass(unref(ns).e("list"))
  54561. }, [renderSlot(_ctx.$slots, "sub-link")], 2)) : createCommentVNode("v-if", true)], 2);
  54562. };
  54563. }
  54564. });
  54565. //#endregion
  54566. //#region ../../packages/components/anchor/src/anchor-link.vue
  54567. var anchor_link_default = anchor_link_vue_vue_type_script_setup_true_lang_default;
  54568. //#endregion
  54569. //#region ../../packages/components/anchor/index.ts
  54570. const ElAnchor = withInstall(anchor_default, { AnchorLink: anchor_link_default });
  54571. const ElAnchorLink = withNoopInstall(anchor_link_default);
  54572. //#endregion
  54573. //#region ../../packages/components/segmented/src/segmented.ts
  54574. const defaultProps = {
  54575. label: "label",
  54576. value: "value",
  54577. disabled: "disabled"
  54578. };
  54579. /**
  54580. * @deprecated Removed after 3.0.0, Use `SegmentedProps` instead.
  54581. */
  54582. const segmentedProps = buildProps({
  54583. direction: {
  54584. type: definePropType(String),
  54585. default: "horizontal"
  54586. },
  54587. options: {
  54588. type: definePropType(Array),
  54589. default: () => []
  54590. },
  54591. modelValue: {
  54592. type: [
  54593. String,
  54594. Number,
  54595. Boolean
  54596. ],
  54597. default: void 0
  54598. },
  54599. props: {
  54600. type: definePropType(Object),
  54601. default: () => defaultProps
  54602. },
  54603. block: Boolean,
  54604. size: useSizeProp,
  54605. disabled: {
  54606. type: Boolean,
  54607. default: void 0
  54608. },
  54609. validateEvent: {
  54610. type: Boolean,
  54611. default: true
  54612. },
  54613. id: String,
  54614. name: String,
  54615. ...useAriaProps(["ariaLabel"])
  54616. });
  54617. const segmentedEmits = {
  54618. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  54619. [CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
  54620. };
  54621. //#endregion
  54622. //#region ../../packages/components/segmented/src/segmented.vue?vue&type=script&setup=true&lang.ts
  54623. const _hoisted_1$4 = [
  54624. "id",
  54625. "aria-label",
  54626. "aria-labelledby"
  54627. ];
  54628. const _hoisted_2$3 = [
  54629. "name",
  54630. "disabled",
  54631. "checked",
  54632. "onChange"
  54633. ];
  54634. var segmented_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  54635. name: "ElSegmented",
  54636. __name: "segmented",
  54637. props: {
  54638. direction: {
  54639. type: String,
  54640. required: false,
  54641. default: "horizontal"
  54642. },
  54643. options: {
  54644. type: Array,
  54645. required: false,
  54646. default: () => []
  54647. },
  54648. modelValue: {
  54649. type: [
  54650. String,
  54651. Number,
  54652. Boolean
  54653. ],
  54654. required: false,
  54655. default: void 0
  54656. },
  54657. props: {
  54658. type: Object,
  54659. required: false,
  54660. default: () => defaultProps
  54661. },
  54662. block: {
  54663. type: Boolean,
  54664. required: false
  54665. },
  54666. size: {
  54667. type: null,
  54668. required: false
  54669. },
  54670. disabled: {
  54671. type: Boolean,
  54672. required: false,
  54673. default: void 0
  54674. },
  54675. validateEvent: {
  54676. type: Boolean,
  54677. required: false,
  54678. default: true
  54679. },
  54680. id: {
  54681. type: String,
  54682. required: false
  54683. },
  54684. name: {
  54685. type: String,
  54686. required: false
  54687. },
  54688. ariaLabel: {
  54689. type: String,
  54690. required: false
  54691. }
  54692. },
  54693. emits: segmentedEmits,
  54694. setup(__props, { emit: __emit }) {
  54695. const props = __props;
  54696. const emit = __emit;
  54697. const ns = useNamespace("segmented");
  54698. const segmentedId = useId();
  54699. const segmentedSize = useFormSize();
  54700. const _disabled = useFormDisabled();
  54701. const { formItem } = useFormItem();
  54702. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: formItem });
  54703. const segmentedRef = ref(null);
  54704. const activeElement = useActiveElement();
  54705. const state = reactive({
  54706. isInit: false,
  54707. width: 0,
  54708. height: 0,
  54709. translateX: 0,
  54710. translateY: 0,
  54711. focusVisible: false
  54712. });
  54713. const handleChange = (evt, item) => {
  54714. const value = getValue(item);
  54715. emit(UPDATE_MODEL_EVENT, value);
  54716. emit(CHANGE_EVENT, value);
  54717. evt.target.checked = value === props.modelValue;
  54718. };
  54719. const aliasProps = computed(() => ({
  54720. ...defaultProps,
  54721. ...props.props
  54722. }));
  54723. const getValue = (item) => {
  54724. return isObject$1(item) ? item[aliasProps.value.value] : item;
  54725. };
  54726. const getLabel = (item) => {
  54727. return isObject$1(item) ? item[aliasProps.value.label] : item;
  54728. };
  54729. const getDisabled = (item) => {
  54730. return !!(_disabled.value || (isObject$1(item) ? item[aliasProps.value.disabled] : false));
  54731. };
  54732. const getSelected = (item) => {
  54733. return props.modelValue === getValue(item);
  54734. };
  54735. const getOption = (value) => {
  54736. return props.options.find((item) => getValue(item) === value);
  54737. };
  54738. const getItemCls = (item) => {
  54739. return [
  54740. ns.e("item"),
  54741. ns.is("selected", getSelected(item)),
  54742. ns.is("disabled", getDisabled(item))
  54743. ];
  54744. };
  54745. const updateSelect = () => {
  54746. if (!segmentedRef.value) return;
  54747. const selectedItem = segmentedRef.value.querySelector(".is-selected");
  54748. const selectedItemInput = segmentedRef.value.querySelector(".is-selected input");
  54749. if (!selectedItem || !selectedItemInput) {
  54750. state.width = 0;
  54751. state.height = 0;
  54752. state.translateX = 0;
  54753. state.translateY = 0;
  54754. state.focusVisible = false;
  54755. return;
  54756. }
  54757. state.isInit = true;
  54758. if (props.direction === "vertical") {
  54759. state.height = selectedItem.offsetHeight;
  54760. state.translateY = selectedItem.offsetTop;
  54761. } else {
  54762. state.width = selectedItem.offsetWidth;
  54763. state.translateX = selectedItem.offsetLeft;
  54764. }
  54765. try {
  54766. state.focusVisible = selectedItemInput.matches(":focus-visible");
  54767. } catch {}
  54768. };
  54769. const segmentedCls = computed(() => [
  54770. ns.b(),
  54771. ns.m(segmentedSize.value),
  54772. ns.is("block", props.block)
  54773. ]);
  54774. const selectedStyle = computed(() => ({
  54775. width: props.direction === "vertical" ? "100%" : `${state.width}px`,
  54776. height: props.direction === "vertical" ? `${state.height}px` : "100%",
  54777. transform: props.direction === "vertical" ? `translateY(${state.translateY}px)` : `translateX(${state.translateX}px)`,
  54778. display: state.isInit ? "block" : "none"
  54779. }));
  54780. const selectedCls = computed(() => [
  54781. ns.e("item-selected"),
  54782. ns.is("disabled", getDisabled(getOption(props.modelValue))),
  54783. ns.is("focus-visible", state.focusVisible)
  54784. ]);
  54785. const name = computed(() => {
  54786. return props.name || segmentedId.value;
  54787. });
  54788. useResizeObserver(segmentedRef, updateSelect);
  54789. watch(activeElement, updateSelect);
  54790. watch(() => props.modelValue, () => {
  54791. updateSelect();
  54792. if (props.validateEvent) formItem?.validate?.("change").catch((err) => /* @__PURE__ */ debugWarn(err));
  54793. }, { flush: "post" });
  54794. return (_ctx, _cache) => {
  54795. return __props.options.length ? (openBlock(), createElementBlock("div", {
  54796. key: 0,
  54797. id: unref(inputId),
  54798. ref_key: "segmentedRef",
  54799. ref: segmentedRef,
  54800. class: normalizeClass(segmentedCls.value),
  54801. role: "radiogroup",
  54802. "aria-label": !unref(isLabeledByFormItem) ? __props.ariaLabel || "segmented" : void 0,
  54803. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  54804. }, [createElementVNode("div", { class: normalizeClass([unref(ns).e("group"), unref(ns).m(__props.direction)]) }, [createElementVNode("div", {
  54805. style: normalizeStyle(selectedStyle.value),
  54806. class: normalizeClass(selectedCls.value)
  54807. }, null, 6), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index) => {
  54808. return openBlock(), createElementBlock("label", {
  54809. key: index,
  54810. class: normalizeClass(getItemCls(item))
  54811. }, [createElementVNode("input", {
  54812. class: normalizeClass(unref(ns).e("item-input")),
  54813. type: "radio",
  54814. name: name.value,
  54815. disabled: getDisabled(item),
  54816. checked: getSelected(item),
  54817. onChange: ($event) => handleChange($event, item)
  54818. }, null, 42, _hoisted_2$3), createElementVNode("div", { class: normalizeClass(unref(ns).e("item-label")) }, [renderSlot(_ctx.$slots, "default", { item }, () => [createTextVNode(toDisplayString(getLabel(item)), 1)])], 2)], 2);
  54819. }), 128))], 2)], 10, _hoisted_1$4)) : createCommentVNode("v-if", true);
  54820. };
  54821. }
  54822. });
  54823. //#endregion
  54824. //#region ../../packages/components/segmented/src/segmented.vue
  54825. var segmented_default = segmented_vue_vue_type_script_setup_true_lang_default;
  54826. //#endregion
  54827. //#region ../../packages/components/segmented/index.ts
  54828. const ElSegmented = withInstall(segmented_default);
  54829. //#endregion
  54830. //#region ../../packages/components/mention/src/helper.ts
  54831. const filterOption = (pattern, option) => {
  54832. const lowerCase = pattern.toLowerCase();
  54833. return (option.label || option.value || "").toLowerCase().includes(lowerCase);
  54834. };
  54835. const getMentionCtx = (inputEl, prefix, split) => {
  54836. const { selectionEnd } = inputEl;
  54837. if (selectionEnd === null) return;
  54838. const inputValue = inputEl.value;
  54839. const prefixArray = castArray$1(prefix);
  54840. let splitIndex = -1;
  54841. let mentionCtx;
  54842. for (let i = selectionEnd - 1; i >= 0; --i) {
  54843. const char = inputValue[i];
  54844. if (splitIndex === -1 && (char === split || char === "\n" || char === "\r")) {
  54845. splitIndex = i;
  54846. continue;
  54847. }
  54848. if (prefixArray.includes(char)) {
  54849. const end = splitIndex === -1 ? selectionEnd : splitIndex;
  54850. mentionCtx = {
  54851. pattern: inputValue.slice(i + 1, end),
  54852. start: i + 1,
  54853. end,
  54854. prefix: char,
  54855. prefixIndex: i,
  54856. splitIndex,
  54857. selectionEnd
  54858. };
  54859. break;
  54860. }
  54861. }
  54862. return mentionCtx;
  54863. };
  54864. /**
  54865. * fork from textarea-caret-position
  54866. * https://github.com/component/textarea-caret-position
  54867. * The MIT License (MIT)
  54868. * Copyright (c) 2015 Jonathan Ong me@jongleberry.com
  54869. * Permission is hereby granted, free of charge, to any person obtaining a copy
  54870. * of this software and associated documentation files (the "Software"), to deal
  54871. * in the Software without restriction, including without limitation the rights
  54872. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  54873. * copies of the Software, and to permit persons to whom the Software is
  54874. * furnished to do so, subject to the following conditions:
  54875. * The above copyright notice and this permission notice shall be included in all
  54876. * copies or substantial portions of the Software.
  54877. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  54878. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  54879. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  54880. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  54881. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  54882. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  54883. * SOFTWARE.
  54884. */
  54885. const getCursorPosition = (element, options = {
  54886. debug: false,
  54887. useSelectionEnd: false
  54888. }) => {
  54889. const selectionStart = element.selectionStart !== null ? element.selectionStart : 0;
  54890. const selectionEnd = element.selectionEnd !== null ? element.selectionEnd : 0;
  54891. const position = options.useSelectionEnd ? selectionEnd : selectionStart;
  54892. const properties = [
  54893. "direction",
  54894. "boxSizing",
  54895. "width",
  54896. "height",
  54897. "overflowX",
  54898. "overflowY",
  54899. "borderTopWidth",
  54900. "borderRightWidth",
  54901. "borderBottomWidth",
  54902. "borderLeftWidth",
  54903. "borderStyle",
  54904. "paddingTop",
  54905. "paddingRight",
  54906. "paddingBottom",
  54907. "paddingLeft",
  54908. "fontStyle",
  54909. "fontVariant",
  54910. "fontWeight",
  54911. "fontStretch",
  54912. "fontSize",
  54913. "fontSizeAdjust",
  54914. "lineHeight",
  54915. "fontFamily",
  54916. "textAlign",
  54917. "textTransform",
  54918. "textIndent",
  54919. "textDecoration",
  54920. "letterSpacing",
  54921. "wordSpacing",
  54922. "tabSize",
  54923. "MozTabSize"
  54924. ];
  54925. if (options.debug) {
  54926. const el = document.querySelector("#input-textarea-caret-position-mirror-div");
  54927. if (el?.parentNode) el.parentNode.removeChild(el);
  54928. }
  54929. const div = document.createElement("div");
  54930. div.id = "input-textarea-caret-position-mirror-div";
  54931. document.body.appendChild(div);
  54932. const style = div.style;
  54933. const computed = window.getComputedStyle(element);
  54934. const isInput = element.nodeName === "INPUT";
  54935. style.whiteSpace = isInput ? "nowrap" : "pre-wrap";
  54936. if (!isInput) style.wordWrap = "break-word";
  54937. style.position = "absolute";
  54938. if (!options.debug) style.visibility = "hidden";
  54939. properties.forEach((prop) => {
  54940. if (isInput && prop === "lineHeight") if (computed.boxSizing === "border-box") {
  54941. const height = Number.parseInt(computed.height);
  54942. const outerHeight = Number.parseInt(computed.paddingTop) + Number.parseInt(computed.paddingBottom) + Number.parseInt(computed.borderTopWidth) + Number.parseInt(computed.borderBottomWidth);
  54943. const targetHeight = outerHeight + Number.parseInt(computed.lineHeight);
  54944. if (height > targetHeight) style.lineHeight = `${height - outerHeight}px`;
  54945. else if (height === targetHeight) style.lineHeight = computed.lineHeight;
  54946. else style.lineHeight = "0";
  54947. } else style.lineHeight = computed.height;
  54948. else style[prop] = computed[prop];
  54949. });
  54950. if (isFirefox()) {
  54951. if (element.scrollHeight > Number.parseInt(computed.height)) style.overflowY = "scroll";
  54952. } else style.overflow = "hidden";
  54953. div.textContent = element.value.slice(0, Math.max(0, position));
  54954. if (isInput && div.textContent) div.textContent = div.textContent.replace(/\s/g, "\xA0");
  54955. const span = document.createElement("span");
  54956. span.textContent = element.value.slice(Math.max(0, position)) || ".";
  54957. span.style.position = "relative";
  54958. span.style.left = `${-element.scrollLeft}px`;
  54959. span.style.top = `${-element.scrollTop}px`;
  54960. div.appendChild(span);
  54961. const relativePosition = {
  54962. top: span.offsetTop + Number.parseInt(computed.borderTopWidth),
  54963. left: span.offsetLeft + Number.parseInt(computed.borderLeftWidth),
  54964. height: Number.parseInt(computed.fontSize) * 1.5
  54965. };
  54966. if (options.debug) span.style.backgroundColor = "#aaa";
  54967. else document.body.removeChild(div);
  54968. if (relativePosition.left >= element.clientWidth) relativePosition.left = element.clientWidth;
  54969. return relativePosition;
  54970. };
  54971. //#endregion
  54972. //#region ../../packages/components/mention/src/mention.ts
  54973. /**
  54974. * @deprecated Removed after 3.0.0, Use `MentionProps` instead.
  54975. */
  54976. const mentionProps = buildProps({
  54977. ...inputProps,
  54978. options: {
  54979. type: definePropType(Array),
  54980. default: () => []
  54981. },
  54982. prefix: {
  54983. type: definePropType([String, Array]),
  54984. default: "@",
  54985. validator: (val) => {
  54986. if (isString(val)) return val.length === 1;
  54987. return val.every((v) => isString(v) && v.length === 1);
  54988. }
  54989. },
  54990. split: {
  54991. type: String,
  54992. default: " ",
  54993. validator: (val) => val.length === 1
  54994. },
  54995. filterOption: {
  54996. type: definePropType([Boolean, Function]),
  54997. default: () => filterOption,
  54998. validator: (val) => {
  54999. if (val === false) return true;
  55000. return isFunction$1(val);
  55001. }
  55002. },
  55003. placement: {
  55004. type: definePropType(String),
  55005. default: "bottom"
  55006. },
  55007. showArrow: Boolean,
  55008. offset: {
  55009. type: Number,
  55010. default: 0
  55011. },
  55012. whole: Boolean,
  55013. checkIsWhole: { type: definePropType(Function) },
  55014. modelValue: String,
  55015. loading: Boolean,
  55016. popperClass: useTooltipContentProps.popperClass,
  55017. popperStyle: useTooltipContentProps.popperStyle,
  55018. popperOptions: {
  55019. type: definePropType(Object),
  55020. default: () => ({})
  55021. },
  55022. props: {
  55023. type: definePropType(Object),
  55024. default: () => mentionDefaultProps
  55025. }
  55026. });
  55027. const mentionEmits = {
  55028. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  55029. "whole-remove": (pattern, prefix) => isString(pattern) && isString(prefix),
  55030. input: (value) => isString(value),
  55031. search: (pattern, prefix) => isString(pattern) && isString(prefix),
  55032. select: (option, prefix) => isObject$1(option) && isString(prefix),
  55033. focus: (evt) => evt instanceof FocusEvent,
  55034. blur: (evt) => evt instanceof FocusEvent
  55035. };
  55036. const mentionDefaultProps = {
  55037. value: "value",
  55038. label: "label",
  55039. disabled: "disabled"
  55040. };
  55041. //#endregion
  55042. //#region ../../packages/components/mention/src/mention-dropdown.ts
  55043. /**
  55044. * @deprecated Removed after 3.0.0, Use `MentionDropdownProps` instead.
  55045. */
  55046. const mentionDropdownProps = buildProps({
  55047. options: {
  55048. type: definePropType(Array),
  55049. default: () => []
  55050. },
  55051. loading: Boolean,
  55052. disabled: Boolean,
  55053. contentId: String,
  55054. ariaLabel: String
  55055. });
  55056. const mentionDropdownEmits = { select: (option) => isString(option.value) };
  55057. //#endregion
  55058. //#region ../../packages/components/mention/src/mention-dropdown.vue?vue&type=script&setup=true&lang.ts
  55059. const _hoisted_1$3 = [
  55060. "id",
  55061. "aria-disabled",
  55062. "aria-selected",
  55063. "onMousemove",
  55064. "onClick"
  55065. ];
  55066. var mention_dropdown_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  55067. name: "ElMentionDropdown",
  55068. __name: "mention-dropdown",
  55069. props: mentionDropdownProps,
  55070. emits: mentionDropdownEmits,
  55071. setup(__props, { expose: __expose, emit: __emit }) {
  55072. const props = __props;
  55073. const emit = __emit;
  55074. const ns = useNamespace("mention");
  55075. const { t } = useLocale();
  55076. const hoveringIndex = ref(-1);
  55077. const scrollbarRef = ref();
  55078. const optionRefs = ref();
  55079. const dropdownRef = ref();
  55080. const optionkls = (item, index) => [
  55081. ns.be("dropdown", "item"),
  55082. ns.is("hovering", hoveringIndex.value === index),
  55083. ns.is("disabled", item.disabled || props.disabled)
  55084. ];
  55085. const handleSelect = (item) => {
  55086. if (item.disabled || props.disabled) return;
  55087. emit("select", item);
  55088. };
  55089. const handleMouseEnter = (index) => {
  55090. hoveringIndex.value = index;
  55091. };
  55092. const filteredAllDisabled = computed(() => props.disabled || props.options.every((item) => item.disabled));
  55093. const hoverOption = computed(() => props.options[hoveringIndex.value]);
  55094. const selectHoverOption = () => {
  55095. if (!hoverOption.value || hoverOption.value.disabled || props.disabled) return;
  55096. emit("select", hoverOption.value);
  55097. };
  55098. const navigateOptions = (direction) => {
  55099. const { options } = props;
  55100. if (options.length === 0 || filteredAllDisabled.value) return;
  55101. if (direction === "next") {
  55102. hoveringIndex.value++;
  55103. if (hoveringIndex.value === options.length) hoveringIndex.value = 0;
  55104. } else if (direction === "prev") {
  55105. hoveringIndex.value--;
  55106. if (hoveringIndex.value < 0) hoveringIndex.value = options.length - 1;
  55107. }
  55108. const option = options[hoveringIndex.value];
  55109. if (option.disabled) {
  55110. navigateOptions(direction);
  55111. return;
  55112. }
  55113. nextTick(() => scrollToOption(option));
  55114. };
  55115. const scrollToOption = (option) => {
  55116. const { options } = props;
  55117. const index = options.findIndex((item) => item.value === option.value);
  55118. const target = optionRefs.value?.[index];
  55119. if (target) {
  55120. const menu = dropdownRef.value?.querySelector?.(`.${ns.be("dropdown", "wrap")}`);
  55121. if (menu) scrollIntoView(menu, target);
  55122. }
  55123. scrollbarRef.value?.handleScroll();
  55124. };
  55125. const resetHoveringIndex = () => {
  55126. if (filteredAllDisabled.value || props.options.length === 0) hoveringIndex.value = -1;
  55127. else hoveringIndex.value = props.options.findIndex((item) => !item.disabled);
  55128. };
  55129. watch(() => props.options, resetHoveringIndex, { immediate: true });
  55130. __expose({
  55131. hoveringIndex,
  55132. navigateOptions,
  55133. selectHoverOption,
  55134. hoverOption
  55135. });
  55136. return (_ctx, _cache) => {
  55137. return openBlock(), createElementBlock("div", {
  55138. ref_key: "dropdownRef",
  55139. ref: dropdownRef,
  55140. class: normalizeClass(unref(ns).b("dropdown"))
  55141. }, [
  55142. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  55143. key: 0,
  55144. class: normalizeClass(unref(ns).be("dropdown", "header"))
  55145. }, [renderSlot(_ctx.$slots, "header")], 2)) : createCommentVNode("v-if", true),
  55146. withDirectives(createVNode(unref(ElScrollbar), {
  55147. id: __props.contentId,
  55148. ref_key: "scrollbarRef",
  55149. ref: scrollbarRef,
  55150. tag: "ul",
  55151. "wrap-class": unref(ns).be("dropdown", "wrap"),
  55152. "view-class": unref(ns).be("dropdown", "list"),
  55153. role: "listbox",
  55154. "aria-label": __props.ariaLabel,
  55155. "aria-orientation": "vertical"
  55156. }, {
  55157. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index) => {
  55158. return openBlock(), createElementBlock("li", {
  55159. id: `${__props.contentId}-${index}`,
  55160. ref_for: true,
  55161. ref_key: "optionRefs",
  55162. ref: optionRefs,
  55163. key: index,
  55164. class: normalizeClass(optionkls(item, index)),
  55165. role: "option",
  55166. "aria-disabled": item.disabled || __props.disabled || void 0,
  55167. "aria-selected": hoveringIndex.value === index,
  55168. onMousemove: ($event) => handleMouseEnter(index),
  55169. onClick: withModifiers(($event) => handleSelect(item), ["stop"])
  55170. }, [renderSlot(_ctx.$slots, "label", {
  55171. item,
  55172. index
  55173. }, () => [createElementVNode("span", null, toDisplayString(item.label ?? item.value), 1)])], 42, _hoisted_1$3);
  55174. }), 128))]),
  55175. _: 3
  55176. }, 8, [
  55177. "id",
  55178. "wrap-class",
  55179. "view-class",
  55180. "aria-label"
  55181. ]), [[vShow, __props.options.length > 0 && !__props.loading]]),
  55182. __props.loading ? (openBlock(), createElementBlock("div", {
  55183. key: 1,
  55184. class: normalizeClass(unref(ns).be("dropdown", "loading"))
  55185. }, [renderSlot(_ctx.$slots, "loading", {}, () => [createTextVNode(toDisplayString(unref(t)("el.mention.loading")), 1)])], 2)) : createCommentVNode("v-if", true),
  55186. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  55187. key: 2,
  55188. class: normalizeClass(unref(ns).be("dropdown", "footer"))
  55189. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  55190. ], 2);
  55191. };
  55192. }
  55193. });
  55194. //#endregion
  55195. //#region ../../packages/components/mention/src/mention-dropdown.vue
  55196. var mention_dropdown_default = mention_dropdown_vue_vue_type_script_setup_true_lang_default;
  55197. //#endregion
  55198. //#region ../../packages/components/mention/src/mention.vue?vue&type=script&setup=true&lang.ts
  55199. var mention_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  55200. name: "ElMention",
  55201. inheritAttrs: false,
  55202. __name: "mention",
  55203. props: mentionProps,
  55204. emits: mentionEmits,
  55205. setup(__props, { expose: __expose, emit: __emit }) {
  55206. const props = __props;
  55207. const emit = __emit;
  55208. const passInputProps = computed(() => pick(props, Object.keys(inputProps)));
  55209. const ns = useNamespace("mention");
  55210. const disabled = useFormDisabled();
  55211. const contentId = useId();
  55212. const elInputRef = ref();
  55213. const tooltipRef = ref();
  55214. const dropdownRef = ref();
  55215. const visible = ref(false);
  55216. const cursorStyle = ref();
  55217. const mentionCtx = ref();
  55218. const computedPlacement = computed(() => props.showArrow ? props.placement : `${props.placement}-start`);
  55219. const computedFallbackPlacements = computed(() => props.showArrow ? ["bottom", "top"] : ["bottom-start", "top-start"]);
  55220. const aliasProps = computed(() => ({
  55221. ...mentionDefaultProps,
  55222. ...props.props
  55223. }));
  55224. const mapOption = (option) => {
  55225. const base = {
  55226. label: option[aliasProps.value.label],
  55227. value: option[aliasProps.value.value],
  55228. disabled: option[aliasProps.value.disabled]
  55229. };
  55230. return {
  55231. ...option,
  55232. ...base
  55233. };
  55234. };
  55235. const options = computed(() => props.options.map(mapOption));
  55236. const filteredOptions = computed(() => {
  55237. const { filterOption } = props;
  55238. if (!mentionCtx.value || !filterOption) return options.value;
  55239. return options.value.filter((option) => filterOption(mentionCtx.value.pattern, option));
  55240. });
  55241. const dropdownVisible = computed(() => {
  55242. return visible.value && (!!filteredOptions.value.length || props.loading);
  55243. });
  55244. const hoveringId = computed(() => {
  55245. return `${contentId.value}-${dropdownRef.value?.hoveringIndex}`;
  55246. });
  55247. const handleInputChange = (value) => {
  55248. emit(UPDATE_MODEL_EVENT, value);
  55249. emit(INPUT_EVENT, value);
  55250. syncAfterCursorMove();
  55251. };
  55252. const handleInputKeyDown = (event) => {
  55253. if (elInputRef.value?.isComposing) return;
  55254. const code = getEventCode(event);
  55255. switch (code) {
  55256. case EVENT_CODE.left:
  55257. case EVENT_CODE.right:
  55258. syncAfterCursorMove();
  55259. break;
  55260. case EVENT_CODE.up:
  55261. case EVENT_CODE.down:
  55262. if (!visible.value) return;
  55263. event.preventDefault();
  55264. dropdownRef.value?.navigateOptions(code === EVENT_CODE.up ? "prev" : "next");
  55265. break;
  55266. case EVENT_CODE.enter:
  55267. case EVENT_CODE.numpadEnter:
  55268. if (!visible.value) {
  55269. props.type !== "textarea" && syncAfterCursorMove();
  55270. return;
  55271. }
  55272. event.preventDefault();
  55273. if (dropdownRef.value?.hoverOption) dropdownRef.value?.selectHoverOption();
  55274. else visible.value = false;
  55275. break;
  55276. case EVENT_CODE.esc:
  55277. if (!visible.value) return;
  55278. event.preventDefault();
  55279. visible.value = false;
  55280. break;
  55281. case EVENT_CODE.backspace: if (props.whole && mentionCtx.value) {
  55282. const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
  55283. const inputEl = getInputEl();
  55284. if (!inputEl) return;
  55285. const inputValue = inputEl.value;
  55286. const matchOption = options.value.find((item) => item.value === pattern);
  55287. if ((isFunction$1(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption) && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
  55288. event.preventDefault();
  55289. const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
  55290. emit(UPDATE_MODEL_EVENT, newValue);
  55291. emit(INPUT_EVENT, newValue);
  55292. emit("whole-remove", pattern, prefix);
  55293. const newSelectionEnd = prefixIndex;
  55294. nextTick(() => {
  55295. inputEl.selectionStart = newSelectionEnd;
  55296. inputEl.selectionEnd = newSelectionEnd;
  55297. syncDropdownVisible();
  55298. });
  55299. }
  55300. }
  55301. }
  55302. };
  55303. const { wrapperRef } = useFocusController(elInputRef, {
  55304. disabled,
  55305. afterFocus() {
  55306. syncAfterCursorMove();
  55307. },
  55308. beforeBlur(event) {
  55309. return tooltipRef.value?.isFocusInsideContent(event);
  55310. },
  55311. afterBlur() {
  55312. visible.value = false;
  55313. }
  55314. });
  55315. const handleInputMouseDown = () => {
  55316. syncAfterCursorMove();
  55317. };
  55318. const getOriginalOption = (mentionOption) => {
  55319. return props.options.find((option) => {
  55320. return mentionOption.value === option[aliasProps.value.value];
  55321. });
  55322. };
  55323. const handleSelect = (item) => {
  55324. if (!mentionCtx.value) return;
  55325. const inputEl = getInputEl();
  55326. if (!inputEl) return;
  55327. const inputValue = inputEl.value;
  55328. const { split } = props;
  55329. const newEndPart = inputValue.slice(mentionCtx.value.end);
  55330. const alreadySeparated = newEndPart.startsWith(split);
  55331. const newMiddlePart = `${item.value}${alreadySeparated ? "" : split}`;
  55332. const newValue = inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart;
  55333. emit(UPDATE_MODEL_EVENT, newValue);
  55334. emit(INPUT_EVENT, newValue);
  55335. emit("select", getOriginalOption(item), mentionCtx.value.prefix);
  55336. const newSelectionEnd = mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0);
  55337. nextTick(() => {
  55338. inputEl.selectionStart = newSelectionEnd;
  55339. inputEl.selectionEnd = newSelectionEnd;
  55340. inputEl.focus();
  55341. syncDropdownVisible();
  55342. });
  55343. };
  55344. const getInputEl = () => props.type === "textarea" ? elInputRef.value?.textarea : elInputRef.value?.input;
  55345. const syncAfterCursorMove = () => {
  55346. setTimeout(() => {
  55347. syncCursor();
  55348. syncDropdownVisible();
  55349. nextTick(() => tooltipRef.value?.updatePopper());
  55350. }, 0);
  55351. };
  55352. const syncCursor = () => {
  55353. const inputEl = getInputEl();
  55354. if (!inputEl) return;
  55355. const caretPosition = getCursorPosition(inputEl);
  55356. const inputRect = inputEl.getBoundingClientRect();
  55357. const wrapperRect = wrapperRef.value.getBoundingClientRect();
  55358. cursorStyle.value = {
  55359. position: "absolute",
  55360. width: 0,
  55361. height: `${caretPosition.height}px`,
  55362. left: `${caretPosition.left + inputRect.left - wrapperRect.left}px`,
  55363. top: `${caretPosition.top + inputRect.top - wrapperRect.top}px`
  55364. };
  55365. };
  55366. const syncDropdownVisible = () => {
  55367. const inputEl = getInputEl();
  55368. if (document.activeElement !== inputEl) {
  55369. visible.value = false;
  55370. return;
  55371. }
  55372. const { prefix, split } = props;
  55373. mentionCtx.value = getMentionCtx(inputEl, prefix, split);
  55374. if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {
  55375. visible.value = true;
  55376. emit("search", mentionCtx.value.pattern, mentionCtx.value.prefix);
  55377. return;
  55378. }
  55379. visible.value = false;
  55380. };
  55381. __expose({
  55382. input: elInputRef,
  55383. tooltip: tooltipRef,
  55384. dropdownVisible
  55385. });
  55386. return (_ctx, _cache) => {
  55387. return openBlock(), createElementBlock("div", {
  55388. ref_key: "wrapperRef",
  55389. ref: wrapperRef,
  55390. class: normalizeClass(unref(ns).b())
  55391. }, [createVNode(unref(ElInput), mergeProps(mergeProps(passInputProps.value, _ctx.$attrs), {
  55392. ref_key: "elInputRef",
  55393. ref: elInputRef,
  55394. "model-value": __props.modelValue,
  55395. disabled: unref(disabled),
  55396. role: dropdownVisible.value ? "combobox" : void 0,
  55397. "aria-activedescendant": dropdownVisible.value ? hoveringId.value || "" : void 0,
  55398. "aria-controls": dropdownVisible.value ? unref(contentId) : void 0,
  55399. "aria-expanded": dropdownVisible.value || void 0,
  55400. "aria-label": __props.ariaLabel,
  55401. "aria-autocomplete": dropdownVisible.value ? "none" : void 0,
  55402. "aria-haspopup": dropdownVisible.value ? "listbox" : void 0,
  55403. onInput: handleInputChange,
  55404. onKeydown: handleInputKeyDown,
  55405. onMousedown: handleInputMouseDown
  55406. }), createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, name) => {
  55407. return {
  55408. name,
  55409. fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))])
  55410. };
  55411. })]), 1040, [
  55412. "model-value",
  55413. "disabled",
  55414. "role",
  55415. "aria-activedescendant",
  55416. "aria-controls",
  55417. "aria-expanded",
  55418. "aria-label",
  55419. "aria-autocomplete",
  55420. "aria-haspopup"
  55421. ]), createVNode(unref(ElTooltip), {
  55422. ref_key: "tooltipRef",
  55423. ref: tooltipRef,
  55424. visible: dropdownVisible.value,
  55425. "popper-class": [unref(ns).e("popper"), __props.popperClass],
  55426. "popper-style": __props.popperStyle,
  55427. "popper-options": __props.popperOptions,
  55428. placement: computedPlacement.value,
  55429. "fallback-placements": computedFallbackPlacements.value,
  55430. effect: "light",
  55431. pure: "",
  55432. offset: __props.offset,
  55433. "show-arrow": __props.showArrow
  55434. }, {
  55435. default: withCtx(() => [createElementVNode("div", { style: normalizeStyle(cursorStyle.value) }, null, 4)]),
  55436. content: withCtx(() => [createVNode(mention_dropdown_default, {
  55437. ref_key: "dropdownRef",
  55438. ref: dropdownRef,
  55439. options: filteredOptions.value,
  55440. disabled: unref(disabled),
  55441. loading: __props.loading,
  55442. "content-id": unref(contentId),
  55443. "aria-label": __props.ariaLabel,
  55444. onSelect: handleSelect,
  55445. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => elInputRef.value?.focus(), ["stop"]))
  55446. }, createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, name) => {
  55447. return {
  55448. name,
  55449. fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))])
  55450. };
  55451. })]), 1032, [
  55452. "options",
  55453. "disabled",
  55454. "loading",
  55455. "content-id",
  55456. "aria-label"
  55457. ])]),
  55458. _: 3
  55459. }, 8, [
  55460. "visible",
  55461. "popper-class",
  55462. "popper-style",
  55463. "popper-options",
  55464. "placement",
  55465. "fallback-placements",
  55466. "offset",
  55467. "show-arrow"
  55468. ])], 2);
  55469. };
  55470. }
  55471. });
  55472. //#endregion
  55473. //#region ../../packages/components/mention/src/mention.vue
  55474. var mention_default = mention_vue_vue_type_script_setup_true_lang_default;
  55475. //#endregion
  55476. //#region ../../packages/components/mention/index.ts
  55477. const ElMention = withInstall(mention_default);
  55478. //#endregion
  55479. //#region ../../packages/components/splitter/src/splitter.ts
  55480. /**
  55481. * @deprecated Removed after 3.0.0, Use `SplitterProps` instead.
  55482. */
  55483. const splitterProps = buildProps({
  55484. layout: {
  55485. type: String,
  55486. default: "horizontal",
  55487. values: ["horizontal", "vertical"]
  55488. },
  55489. lazy: Boolean
  55490. });
  55491. const splitterEmits = {
  55492. resizeStart: (index, sizes) => true,
  55493. resize: (index, sizes) => true,
  55494. resizeEnd: (index, sizes) => true,
  55495. collapse: (index, type, sizes) => true
  55496. };
  55497. //#endregion
  55498. //#region ../../packages/components/splitter/src/hooks/useContainer.ts
  55499. function useContainer(layout) {
  55500. const containerEl = ref();
  55501. const { width, height } = useElementSize(containerEl);
  55502. return {
  55503. containerEl,
  55504. containerSize: computed(() => {
  55505. return layout.value === "horizontal" ? width.value : height.value;
  55506. })
  55507. };
  55508. }
  55509. //#endregion
  55510. //#region ../../packages/components/splitter/src/hooks/useSize.ts
  55511. function getPct(str) {
  55512. return Number(str.slice(0, -1)) / 100;
  55513. }
  55514. function getPx(str) {
  55515. return Number(str.slice(0, -2));
  55516. }
  55517. function isPct(itemSize) {
  55518. return isString(itemSize) && itemSize.endsWith("%");
  55519. }
  55520. function isPx(itemSize) {
  55521. return isString(itemSize) && itemSize.endsWith("px");
  55522. }
  55523. function useSize$1(panels, containerSize) {
  55524. const propSizes = computed(() => panels.value.map((i) => i.size));
  55525. const panelCounts = computed(() => panels.value.length);
  55526. const percentSizes = ref([]);
  55527. watch([
  55528. propSizes,
  55529. panelCounts,
  55530. containerSize
  55531. ], () => {
  55532. let ptgList = [];
  55533. let emptyCount = 0;
  55534. for (let i = 0; i < panelCounts.value; i += 1) {
  55535. const itemSize = panels.value[i]?.size;
  55536. if (isPct(itemSize)) ptgList[i] = getPct(itemSize);
  55537. else if (isPx(itemSize)) ptgList[i] = getPx(itemSize) / containerSize.value;
  55538. else if (itemSize || itemSize === 0) {
  55539. const num = Number(itemSize);
  55540. if (!Number.isNaN(num)) ptgList[i] = num / containerSize.value;
  55541. } else {
  55542. emptyCount += 1;
  55543. ptgList[i] = void 0;
  55544. }
  55545. }
  55546. const totalPtg = ptgList.reduce((acc, ptg) => acc + (ptg || 0), 0);
  55547. if (totalPtg > 1 || !emptyCount) {
  55548. const scale = 1 / totalPtg;
  55549. ptgList = ptgList.map((ptg) => ptg === void 0 ? 0 : ptg * scale);
  55550. } else {
  55551. const avgRest = (1 - totalPtg) / emptyCount;
  55552. ptgList = ptgList.map((ptg) => ptg === void 0 ? avgRest : ptg);
  55553. }
  55554. percentSizes.value = ptgList;
  55555. });
  55556. const ptg2px = (ptg) => ptg * containerSize.value;
  55557. return {
  55558. percentSizes,
  55559. pxSizes: computed(() => percentSizes.value.map(ptg2px))
  55560. };
  55561. }
  55562. //#endregion
  55563. //#region ../../packages/components/splitter/src/hooks/useResize.ts
  55564. function useResize(panels, containerSize, pxSizes, lazy) {
  55565. const ptg2px = (ptg) => ptg * containerSize.value || 0;
  55566. function getLimitSize(str, defaultLimit) {
  55567. if (isPct(str)) return ptg2px(getPct(str));
  55568. else if (isPx(str)) return getPx(str);
  55569. return str ?? defaultLimit;
  55570. }
  55571. const lazyOffset = ref(0);
  55572. const movingIndex = ref(null);
  55573. let cachePxSizes = [];
  55574. let updatePanelSizes = NOOP;
  55575. const limitSizes = computed(() => panels.value.map((item) => [item.min, item.max]));
  55576. watch(lazy, () => {
  55577. if (lazyOffset.value) {
  55578. const mouseup = new MouseEvent("mouseup", { bubbles: true });
  55579. window.dispatchEvent(mouseup);
  55580. }
  55581. });
  55582. const onMoveStart = (index) => {
  55583. lazyOffset.value = 0;
  55584. movingIndex.value = {
  55585. index,
  55586. confirmed: false
  55587. };
  55588. cachePxSizes = pxSizes.value;
  55589. };
  55590. const onMoving = (index, offset) => {
  55591. let confirmedIndex = null;
  55592. if ((!movingIndex.value || !movingIndex.value.confirmed) && offset !== 0) {
  55593. if (offset > 0) {
  55594. confirmedIndex = index;
  55595. movingIndex.value = {
  55596. index,
  55597. confirmed: true
  55598. };
  55599. } else for (let i = index; i >= 0; i -= 1) if (cachePxSizes[i] > 0) {
  55600. confirmedIndex = i;
  55601. movingIndex.value = {
  55602. index: i,
  55603. confirmed: true
  55604. };
  55605. break;
  55606. }
  55607. }
  55608. const mergedIndex = confirmedIndex ?? movingIndex.value?.index ?? index;
  55609. const numSizes = [...cachePxSizes];
  55610. const nextIndex = mergedIndex + 1;
  55611. const startMinSize = getLimitSize(limitSizes.value[mergedIndex][0], 0);
  55612. const endMinSize = getLimitSize(limitSizes.value[nextIndex][0], 0);
  55613. const startMaxSize = getLimitSize(limitSizes.value[mergedIndex][1], containerSize.value || 0);
  55614. const endMaxSize = getLimitSize(limitSizes.value[nextIndex][1], containerSize.value || 0);
  55615. let mergedOffset = offset;
  55616. if (numSizes[mergedIndex] + mergedOffset < startMinSize) mergedOffset = startMinSize - numSizes[mergedIndex];
  55617. if (numSizes[nextIndex] - mergedOffset < endMinSize) mergedOffset = numSizes[nextIndex] - endMinSize;
  55618. if (numSizes[mergedIndex] + mergedOffset > startMaxSize) mergedOffset = startMaxSize - numSizes[mergedIndex];
  55619. if (numSizes[nextIndex] - mergedOffset > endMaxSize) mergedOffset = numSizes[nextIndex] - endMaxSize;
  55620. numSizes[mergedIndex] += mergedOffset;
  55621. numSizes[nextIndex] -= mergedOffset;
  55622. lazyOffset.value = mergedOffset;
  55623. updatePanelSizes = () => {
  55624. panels.value.forEach((panel, index) => {
  55625. panel.size = numSizes[index];
  55626. });
  55627. updatePanelSizes = NOOP;
  55628. };
  55629. if (!lazy.value) updatePanelSizes();
  55630. };
  55631. const onMoveEnd = () => {
  55632. if (lazy.value) updatePanelSizes();
  55633. lazyOffset.value = 0;
  55634. movingIndex.value = null;
  55635. cachePxSizes = [];
  55636. };
  55637. const cacheCollapsedSize = [];
  55638. const onCollapse = (index, type) => {
  55639. if (!cacheCollapsedSize.length) cacheCollapsedSize.push(...pxSizes.value);
  55640. const currentSizes = pxSizes.value;
  55641. const currentIndex = type === "start" ? index : index + 1;
  55642. const targetIndex = type === "start" ? index + 1 : index;
  55643. const currentSize = currentSizes[currentIndex];
  55644. const targetSize = currentSizes[targetIndex];
  55645. if (currentSize !== 0 && targetSize !== 0) {
  55646. currentSizes[currentIndex] = 0;
  55647. currentSizes[targetIndex] += currentSize;
  55648. cacheCollapsedSize[index] = currentSize;
  55649. } else {
  55650. const totalSize = currentSize + targetSize;
  55651. const targetCacheCollapsedSize = cacheCollapsedSize[index];
  55652. const currentCacheCollapsedSize = totalSize - targetCacheCollapsedSize;
  55653. currentSizes[targetIndex] = targetCacheCollapsedSize;
  55654. currentSizes[currentIndex] = currentCacheCollapsedSize;
  55655. }
  55656. panels.value.forEach((panel, index) => {
  55657. panel.size = currentSizes[index];
  55658. });
  55659. };
  55660. return {
  55661. lazyOffset,
  55662. onMoveStart,
  55663. onMoving,
  55664. onMoveEnd,
  55665. movingIndex,
  55666. onCollapse
  55667. };
  55668. }
  55669. //#endregion
  55670. //#region ../../packages/components/splitter/src/type.ts
  55671. const splitterRootContextKey = Symbol("splitterRootContextKey");
  55672. //#endregion
  55673. //#region ../../packages/components/splitter/src/splitter.vue?vue&type=script&setup=true&lang.ts
  55674. var splitter_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  55675. name: "ElSplitter",
  55676. __name: "splitter",
  55677. props: splitterProps,
  55678. emits: splitterEmits,
  55679. setup(__props, { emit: __emit }) {
  55680. const ns = useNamespace("splitter");
  55681. const emits = __emit;
  55682. const props = __props;
  55683. const layout = toRef(props, "layout");
  55684. const lazy = toRef(props, "lazy");
  55685. const { containerEl, containerSize } = useContainer(layout);
  55686. const { removeChild: unregisterPanel, children: panels, addChild: registerPanel, ChildrenSorter: PanelsSorter } = useOrderedChildren(getCurrentInstance(), "ElSplitterPanel");
  55687. watch(panels, () => {
  55688. movingIndex.value = null;
  55689. panels.value.forEach((instance, index) => {
  55690. instance.setIndex(index);
  55691. });
  55692. });
  55693. const { percentSizes, pxSizes } = useSize$1(panels, containerSize);
  55694. const { lazyOffset, movingIndex, onMoveStart, onMoving, onMoveEnd, onCollapse } = useResize(panels, containerSize, pxSizes, lazy);
  55695. const splitterStyles = computed(() => {
  55696. return { [ns.cssVarBlockName("bar-offset")]: lazy.value ? `${lazyOffset.value}px` : void 0 };
  55697. });
  55698. const onResizeStart = (index) => {
  55699. onMoveStart(index);
  55700. emits("resizeStart", index, pxSizes.value);
  55701. };
  55702. const onResize = (index, offset) => {
  55703. onMoving(index, offset);
  55704. if (!lazy.value) emits("resize", index, pxSizes.value);
  55705. };
  55706. const onResizeEnd = async (index) => {
  55707. onMoveEnd();
  55708. await nextTick();
  55709. emits("resizeEnd", index, pxSizes.value);
  55710. };
  55711. const onCollapsible = (index, type) => {
  55712. onCollapse(index, type);
  55713. emits("collapse", index, type, pxSizes.value);
  55714. };
  55715. provide(splitterRootContextKey, reactive({
  55716. panels,
  55717. percentSizes,
  55718. pxSizes,
  55719. layout,
  55720. lazy,
  55721. movingIndex,
  55722. containerSize,
  55723. onMoveStart: onResizeStart,
  55724. onMoving: onResize,
  55725. onMoveEnd: onResizeEnd,
  55726. onCollapse: onCollapsible,
  55727. registerPanel,
  55728. unregisterPanel
  55729. }));
  55730. return (_ctx, _cache) => {
  55731. return openBlock(), createElementBlock("div", {
  55732. ref_key: "containerEl",
  55733. ref: containerEl,
  55734. class: normalizeClass([unref(ns).b(), unref(ns).e(layout.value)]),
  55735. style: normalizeStyle(splitterStyles.value)
  55736. }, [
  55737. renderSlot(_ctx.$slots, "default"),
  55738. createVNode(unref(PanelsSorter)),
  55739. createCommentVNode(" Prevent iframe touch events from breaking "),
  55740. unref(movingIndex) ? (openBlock(), createElementBlock("div", {
  55741. key: 0,
  55742. class: normalizeClass([unref(ns).e("mask"), unref(ns).e(`mask-${layout.value}`)])
  55743. }, null, 2)) : createCommentVNode("v-if", true)
  55744. ], 6);
  55745. };
  55746. }
  55747. });
  55748. //#endregion
  55749. //#region ../../packages/components/splitter/src/splitter.vue
  55750. var splitter_default = splitter_vue_vue_type_script_setup_true_lang_default;
  55751. //#endregion
  55752. //#region ../../packages/components/splitter/src/split-panel.ts
  55753. /**
  55754. * @deprecated Removed after 3.0.0, Use `SplitterPanelProps` instead.
  55755. */
  55756. const splitterPanelProps = buildProps({
  55757. min: { type: [String, Number] },
  55758. max: { type: [String, Number] },
  55759. size: { type: [String, Number] },
  55760. resizable: {
  55761. type: Boolean,
  55762. default: true
  55763. },
  55764. collapsible: Boolean
  55765. });
  55766. const splitterPanelEmits = { "update:size": (value) => typeof value === "number" || typeof value === "string" };
  55767. //#endregion
  55768. //#region ../../packages/components/splitter/src/hooks/usePanel.ts
  55769. function getCollapsible(collapsible) {
  55770. if (collapsible && isObject$1(collapsible)) return collapsible;
  55771. return {
  55772. start: !!collapsible,
  55773. end: !!collapsible
  55774. };
  55775. }
  55776. function isCollapsible(panel, size, nextPanel, nextSize) {
  55777. if (panel?.collapsible.end && size > 0) return true;
  55778. if (nextPanel?.collapsible.start && nextSize === 0 && size > 0) return true;
  55779. return false;
  55780. }
  55781. //#endregion
  55782. //#region ../../packages/components/splitter/src/split-bar.vue?vue&type=script&setup=true&lang.ts
  55783. var split_bar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  55784. name: "ElSplitterBar",
  55785. __name: "split-bar",
  55786. props: {
  55787. index: {
  55788. type: Number,
  55789. required: true
  55790. },
  55791. layout: {
  55792. type: String,
  55793. values: ["horizontal", "vertical"],
  55794. default: "horizontal"
  55795. },
  55796. resizable: {
  55797. type: Boolean,
  55798. default: true
  55799. },
  55800. lazy: Boolean,
  55801. startCollapsible: Boolean,
  55802. endCollapsible: Boolean
  55803. },
  55804. emits: [
  55805. "moveStart",
  55806. "moving",
  55807. "moveEnd",
  55808. "collapse"
  55809. ],
  55810. setup(__props, { emit: __emit }) {
  55811. const ns = useNamespace("splitter-bar");
  55812. const props = __props;
  55813. const emit = __emit;
  55814. const isHorizontal = computed(() => props.layout === "horizontal");
  55815. const barWrapStyles = computed(() => {
  55816. if (isHorizontal.value) return { width: 0 };
  55817. return { height: 0 };
  55818. });
  55819. const draggerStyles = computed(() => {
  55820. return {
  55821. width: isHorizontal.value ? "16px" : "100%",
  55822. height: isHorizontal.value ? "100%" : "16px",
  55823. cursor: !props.resizable ? "auto" : isHorizontal.value ? "ew-resize" : "ns-resize",
  55824. touchAction: "none"
  55825. };
  55826. });
  55827. const draggerPseudoClass = computed(() => {
  55828. const prefix = ns.e("dragger");
  55829. return {
  55830. [`${prefix}-horizontal`]: isHorizontal.value,
  55831. [`${prefix}-vertical`]: !isHorizontal.value,
  55832. [`${prefix}-active`]: !!startPos.value
  55833. };
  55834. });
  55835. const startPos = ref(null);
  55836. const onMousedown = (e) => {
  55837. if (!props.resizable) return;
  55838. startPos.value = [e.pageX, e.pageY];
  55839. emit("moveStart", props.index);
  55840. window.addEventListener("mouseup", onMouseUp);
  55841. window.addEventListener("mousemove", onMouseMove);
  55842. };
  55843. const onTouchStart = (e) => {
  55844. if (props.resizable && e.touches.length === 1) {
  55845. e.preventDefault();
  55846. const touch = e.touches[0];
  55847. startPos.value = [touch.pageX, touch.pageY];
  55848. emit("moveStart", props.index);
  55849. window.addEventListener("touchend", onTouchEnd);
  55850. window.addEventListener("touchmove", onTouchMove);
  55851. }
  55852. };
  55853. const onMouseMove = (e) => {
  55854. const { pageX, pageY } = e;
  55855. const offsetX = pageX - startPos.value[0];
  55856. const offsetY = pageY - startPos.value[1];
  55857. const offset = isHorizontal.value ? offsetX : offsetY;
  55858. emit("moving", props.index, offset);
  55859. };
  55860. const onTouchMove = (e) => {
  55861. if (e.touches.length === 1) {
  55862. e.preventDefault();
  55863. const touch = e.touches[0];
  55864. const offsetX = touch.pageX - startPos.value[0];
  55865. const offsetY = touch.pageY - startPos.value[1];
  55866. const offset = isHorizontal.value ? offsetX : offsetY;
  55867. emit("moving", props.index, offset);
  55868. }
  55869. };
  55870. const onMouseUp = () => {
  55871. startPos.value = null;
  55872. window.removeEventListener("mouseup", onMouseUp);
  55873. window.removeEventListener("mousemove", onMouseMove);
  55874. emit("moveEnd", props.index);
  55875. };
  55876. const onTouchEnd = () => {
  55877. startPos.value = null;
  55878. window.removeEventListener("touchend", onTouchEnd);
  55879. window.removeEventListener("touchmove", onTouchMove);
  55880. emit("moveEnd", props.index);
  55881. };
  55882. const StartIcon = computed(() => isHorizontal.value ? arrow_left_default : arrow_up_default);
  55883. const EndIcon = computed(() => isHorizontal.value ? arrow_right_default : arrow_down_default);
  55884. return (_ctx, _cache) => {
  55885. return openBlock(), createElementBlock("div", {
  55886. class: normalizeClass([unref(ns).b()]),
  55887. style: normalizeStyle(barWrapStyles.value)
  55888. }, [
  55889. __props.startCollapsible ? (openBlock(), createElementBlock("div", {
  55890. key: 0,
  55891. class: normalizeClass([unref(ns).e("collapse-icon"), unref(ns).e(`${__props.layout}-collapse-icon-start`)]),
  55892. onClick: _cache[0] || (_cache[0] = ($event) => emit("collapse", __props.index, "start"))
  55893. }, [renderSlot(_ctx.$slots, "start-collapsible", {}, () => [(openBlock(), createBlock(resolveDynamicComponent(StartIcon.value), { style: {
  55894. "width": "12px",
  55895. "height": "12px"
  55896. } }))])], 2)) : createCommentVNode("v-if", true),
  55897. createElementVNode("div", {
  55898. class: normalizeClass([
  55899. unref(ns).e("dragger"),
  55900. draggerPseudoClass.value,
  55901. unref(ns).is("disabled", !__props.resizable),
  55902. unref(ns).is("lazy", __props.resizable && __props.lazy)
  55903. ]),
  55904. style: normalizeStyle(draggerStyles.value),
  55905. onMousedown,
  55906. onTouchstart: onTouchStart
  55907. }, null, 38),
  55908. __props.endCollapsible ? (openBlock(), createElementBlock("div", {
  55909. key: 1,
  55910. class: normalizeClass([unref(ns).e("collapse-icon"), unref(ns).e(`${__props.layout}-collapse-icon-end`)]),
  55911. onClick: _cache[1] || (_cache[1] = ($event) => emit("collapse", __props.index, "end"))
  55912. }, [renderSlot(_ctx.$slots, "end-collapsible", {}, () => [(openBlock(), createBlock(resolveDynamicComponent(EndIcon.value), { style: {
  55913. "width": "12px",
  55914. "height": "12px"
  55915. } }))])], 2)) : createCommentVNode("v-if", true)
  55916. ], 6);
  55917. };
  55918. }
  55919. });
  55920. //#endregion
  55921. //#region ../../packages/components/splitter/src/split-bar.vue
  55922. var split_bar_default = split_bar_vue_vue_type_script_setup_true_lang_default;
  55923. //#endregion
  55924. //#region ../../packages/components/splitter/src/split-panel.vue?vue&type=script&setup=true&lang.ts
  55925. const COMPONENT_NAME = "ElSplitterPanel";
  55926. var split_panel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  55927. name: COMPONENT_NAME,
  55928. __name: "split-panel",
  55929. props: splitterPanelProps,
  55930. emits: splitterPanelEmits,
  55931. setup(__props, { expose: __expose, emit: __emit }) {
  55932. const ns = useNamespace("splitter-panel");
  55933. const props = __props;
  55934. const emits = __emit;
  55935. const splitterContext = inject(splitterRootContextKey);
  55936. if (!splitterContext) throwError(COMPONENT_NAME, "usage: <el-splitter><el-splitter-panel /></el-splitter/>");
  55937. const { panels, layout, lazy, containerSize, pxSizes } = toRefs(splitterContext);
  55938. const { registerPanel, unregisterPanel, onCollapse, onMoveEnd, onMoveStart, onMoving } = splitterContext;
  55939. const panelEl = ref();
  55940. const instance = getCurrentInstance();
  55941. const uid = instance.uid;
  55942. const index = ref(0);
  55943. const panel = computed(() => panels.value[index.value]);
  55944. const setIndex = (val) => {
  55945. index.value = val;
  55946. };
  55947. const panelSize = computed(() => {
  55948. if (!panel.value) return 0;
  55949. return pxSizes.value[index.value] ?? 0;
  55950. });
  55951. const nextSize = computed(() => {
  55952. if (!panel.value) return 0;
  55953. return pxSizes.value[index.value + 1] ?? 0;
  55954. });
  55955. const nextPanel = computed(() => {
  55956. if (panel.value) return panels.value[index.value + 1];
  55957. return null;
  55958. });
  55959. const isResizable = computed(() => {
  55960. if (!nextPanel.value) return false;
  55961. return props.resizable && nextPanel.value?.resizable && (panelSize.value !== 0 || !props.min) && (nextSize.value !== 0 || !nextPanel.value.min);
  55962. });
  55963. const isShowBar = computed(() => {
  55964. if (!panel.value) return false;
  55965. return index.value !== panels.value.length - 1;
  55966. });
  55967. const startCollapsible = computed(() => isCollapsible(panel.value, panelSize.value, nextPanel.value, nextSize.value));
  55968. const endCollapsible = computed(() => isCollapsible(nextPanel.value, nextSize.value, panel.value, panelSize.value));
  55969. function sizeToPx(str) {
  55970. if (isPct(str)) return getPct(str) * containerSize.value || 0;
  55971. else if (isPx(str)) return getPx(str);
  55972. return str ?? 0;
  55973. }
  55974. let isSizeUpdating = false;
  55975. watch(() => props.size, () => {
  55976. if (!isSizeUpdating && panel.value) {
  55977. if (!containerSize.value) {
  55978. panel.value.size = props.size;
  55979. return;
  55980. }
  55981. const size = sizeToPx(props.size);
  55982. const maxSize = sizeToPx(props.max);
  55983. const minSize = sizeToPx(props.min);
  55984. const finalSize = Math.min(Math.max(size, minSize || 0), maxSize || size);
  55985. if (finalSize !== size) emits("update:size", finalSize);
  55986. panel.value.size = finalSize;
  55987. }
  55988. });
  55989. watch(() => panel.value?.size, (val) => {
  55990. if (val !== props.size) {
  55991. isSizeUpdating = true;
  55992. emits("update:size", val);
  55993. nextTick(() => isSizeUpdating = false);
  55994. }
  55995. });
  55996. watch(() => props.resizable, (val) => {
  55997. if (panel.value) panel.value.resizable = val;
  55998. });
  55999. const _panel = reactive({
  56000. uid,
  56001. getVnode: () => instance.vnode,
  56002. setIndex,
  56003. ...props,
  56004. collapsible: computed(() => getCollapsible(props.collapsible))
  56005. });
  56006. registerPanel(_panel);
  56007. onBeforeUnmount(() => unregisterPanel(_panel));
  56008. __expose({ splitterPanelRef: panelEl });
  56009. return (_ctx, _cache) => {
  56010. return openBlock(), createElementBlock(Fragment, null, [createElementVNode("div", mergeProps({
  56011. ref_key: "panelEl",
  56012. ref: panelEl,
  56013. class: [unref(ns).b()],
  56014. style: { flexBasis: `${panelSize.value}px` }
  56015. }, _ctx.$attrs), [renderSlot(_ctx.$slots, "default")], 16), isShowBar.value ? (openBlock(), createBlock(split_bar_default, {
  56016. key: 0,
  56017. index: index.value,
  56018. layout: unref(layout),
  56019. lazy: unref(lazy),
  56020. resizable: isResizable.value,
  56021. "start-collapsible": startCollapsible.value,
  56022. "end-collapsible": endCollapsible.value,
  56023. onMoveStart: unref(onMoveStart),
  56024. onMoving: unref(onMoving),
  56025. onMoveEnd: unref(onMoveEnd),
  56026. onCollapse: unref(onCollapse)
  56027. }, {
  56028. "start-collapsible": withCtx(() => [renderSlot(_ctx.$slots, "start-collapsible")]),
  56029. "end-collapsible": withCtx(() => [renderSlot(_ctx.$slots, "end-collapsible")]),
  56030. _: 3
  56031. }, 8, [
  56032. "index",
  56033. "layout",
  56034. "lazy",
  56035. "resizable",
  56036. "start-collapsible",
  56037. "end-collapsible",
  56038. "onMoveStart",
  56039. "onMoving",
  56040. "onMoveEnd",
  56041. "onCollapse"
  56042. ])) : createCommentVNode("v-if", true)], 64);
  56043. };
  56044. }
  56045. });
  56046. //#endregion
  56047. //#region ../../packages/components/splitter/src/split-panel.vue
  56048. var split_panel_default = split_panel_vue_vue_type_script_setup_true_lang_default;
  56049. //#endregion
  56050. //#region ../../packages/components/splitter/index.ts
  56051. const ElSplitter = withInstall(splitter_default, { SplitPanel: split_panel_default });
  56052. const ElSplitterPanel = withNoopInstall(split_panel_default);
  56053. //#endregion
  56054. //#region ../../packages/element-plus/component.ts
  56055. var component_default = [
  56056. ElAffix,
  56057. ElAlert,
  56058. ElAutocomplete,
  56059. ElAutoResizer,
  56060. ElAvatar,
  56061. ElAvatarGroup,
  56062. ElBacktop,
  56063. ElBadge,
  56064. ElBreadcrumb,
  56065. ElBreadcrumbItem,
  56066. ElButton,
  56067. ElButtonGroup,
  56068. ElCalendar,
  56069. ElCard,
  56070. ElCarousel,
  56071. ElCarouselItem,
  56072. ElCascader,
  56073. ElCascaderPanel,
  56074. ElCheckTag,
  56075. ElCheckbox,
  56076. ElCheckboxButton,
  56077. ElCheckboxGroup,
  56078. ElCol,
  56079. ElCollapse,
  56080. ElCollapseItem,
  56081. ElCollapseTransition,
  56082. ElColorPickerPanel,
  56083. ElColorPicker,
  56084. ElConfigProvider,
  56085. ElContainer,
  56086. ElAside,
  56087. ElFooter,
  56088. ElHeader,
  56089. ElMain,
  56090. ElDatePicker,
  56091. ElDatePickerPanel,
  56092. ElDescriptions,
  56093. ElDescriptionsItem,
  56094. ElDialog,
  56095. ElDivider,
  56096. ElDrawer,
  56097. ElDropdown,
  56098. ElDropdownItem,
  56099. ElDropdownMenu,
  56100. ElEmpty,
  56101. ElForm,
  56102. ElFormItem,
  56103. ElIcon,
  56104. ElImage,
  56105. ElImageViewer,
  56106. ElInput,
  56107. ElInputNumber,
  56108. ElInputTag,
  56109. ElLink,
  56110. ElMenu,
  56111. ElMenuItem,
  56112. ElMenuItemGroup,
  56113. ElSubMenu,
  56114. ElPageHeader,
  56115. ElPagination,
  56116. ElPopconfirm,
  56117. ElPopover,
  56118. ElPopper,
  56119. ElProgress,
  56120. ElRadio,
  56121. ElRadioButton,
  56122. ElRadioGroup,
  56123. ElRate,
  56124. ElResult,
  56125. ElRow,
  56126. ElScrollbar,
  56127. ElSelect,
  56128. ElOption,
  56129. ElOptionGroup,
  56130. ElSelectV2,
  56131. ElSkeleton,
  56132. ElSkeletonItem,
  56133. ElSlider,
  56134. ElSpace,
  56135. ElStatistic,
  56136. ElCountdown,
  56137. ElSteps,
  56138. ElStep,
  56139. ElSwitch,
  56140. ElTable,
  56141. ElTableColumn,
  56142. ElTableV2,
  56143. ElTabs,
  56144. ElTabPane,
  56145. ElTag,
  56146. ElText,
  56147. ElTimePicker,
  56148. ElTimeSelect,
  56149. ElTimeline,
  56150. ElTimelineItem,
  56151. ElTooltip,
  56152. ElTransfer,
  56153. ElTree,
  56154. ElTreeSelect,
  56155. ElTreeV2,
  56156. ElUpload,
  56157. ElWatermark,
  56158. ElTour,
  56159. ElTourStep,
  56160. ElAnchor,
  56161. ElAnchorLink,
  56162. ElSegmented,
  56163. ElMention,
  56164. ElSplitter,
  56165. ElSplitterPanel
  56166. ];
  56167. //#endregion
  56168. //#region ../../packages/components/infinite-scroll/src/index.ts
  56169. const SCOPE$1 = "ElInfiniteScroll";
  56170. const CHECK_INTERVAL = 50;
  56171. const DEFAULT_DELAY = 200;
  56172. const DEFAULT_DISTANCE = 0;
  56173. const attributes = {
  56174. delay: {
  56175. type: Number,
  56176. default: DEFAULT_DELAY
  56177. },
  56178. distance: {
  56179. type: Number,
  56180. default: DEFAULT_DISTANCE
  56181. },
  56182. disabled: {
  56183. type: Boolean,
  56184. default: false
  56185. },
  56186. immediate: {
  56187. type: Boolean,
  56188. default: true
  56189. }
  56190. };
  56191. const getScrollOptions = (el, instance) => {
  56192. return Object.entries(attributes).reduce((acm, [name, option]) => {
  56193. const { type, default: defaultValue } = option;
  56194. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  56195. let value = instance[attrVal] ?? attrVal ?? defaultValue;
  56196. value = value === "false" ? false : value;
  56197. value = type(value);
  56198. acm[name] = Number.isNaN(value) ? defaultValue : value;
  56199. return acm;
  56200. }, {});
  56201. };
  56202. const destroyObserver = (el) => {
  56203. const { observer } = el[SCOPE$1];
  56204. if (observer) {
  56205. observer.disconnect();
  56206. delete el[SCOPE$1].observer;
  56207. }
  56208. };
  56209. const handleScroll = (el, cb) => {
  56210. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE$1];
  56211. const { disabled, distance } = getScrollOptions(el, instance);
  56212. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  56213. const delta = scrollTop - lastScrollTop;
  56214. el[SCOPE$1].lastScrollTop = scrollTop;
  56215. if (observer || disabled || delta < 0) return;
  56216. let shouldTrigger = false;
  56217. if (container === el) shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  56218. else {
  56219. const { clientTop, scrollHeight: height } = el;
  56220. const offsetTop = getOffsetTopDistance(el, containerEl);
  56221. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  56222. }
  56223. if (shouldTrigger) cb.call(instance);
  56224. };
  56225. function checkFull(el, cb) {
  56226. const { containerEl, instance } = el[SCOPE$1];
  56227. const { disabled } = getScrollOptions(el, instance);
  56228. if (disabled || containerEl.clientHeight === 0) return;
  56229. if (containerEl.scrollHeight <= containerEl.clientHeight) cb.call(instance);
  56230. else destroyObserver(el);
  56231. }
  56232. const InfiniteScroll = {
  56233. async mounted(el, binding) {
  56234. const { instance, value: cb } = binding;
  56235. useDeprecated({
  56236. scope: SCOPE$1,
  56237. from: "the directive v-infinite-scroll",
  56238. replacement: "the el-scrollbar infinite scroll",
  56239. version: "3.0.0",
  56240. ref: "https://element-plus.org/en-US/component/scrollbar#infinite-scroll"
  56241. }, true);
  56242. if (!isFunction$1(cb)) throwError(SCOPE$1, "'v-infinite-scroll' binding value must be a function");
  56243. await nextTick();
  56244. const { delay, immediate } = getScrollOptions(el, instance);
  56245. const container = getScrollContainer(el, true);
  56246. const containerEl = container === window ? document.documentElement : container;
  56247. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  56248. if (!container) return;
  56249. el[SCOPE$1] = {
  56250. instance,
  56251. container,
  56252. containerEl,
  56253. delay,
  56254. cb,
  56255. onScroll,
  56256. lastScrollTop: containerEl.scrollTop
  56257. };
  56258. if (immediate) {
  56259. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  56260. el[SCOPE$1].observer = observer;
  56261. observer.observe(el, {
  56262. childList: true,
  56263. subtree: true
  56264. });
  56265. checkFull(el, cb);
  56266. }
  56267. container.addEventListener("scroll", onScroll);
  56268. },
  56269. unmounted(el) {
  56270. if (!el[SCOPE$1]) return;
  56271. const { container, onScroll } = el[SCOPE$1];
  56272. container?.removeEventListener("scroll", onScroll);
  56273. destroyObserver(el);
  56274. },
  56275. async updated(el) {
  56276. if (!el[SCOPE$1]) await nextTick();
  56277. else {
  56278. const { containerEl, cb, observer } = el[SCOPE$1];
  56279. if (containerEl.clientHeight && observer) checkFull(el, cb);
  56280. }
  56281. }
  56282. };
  56283. //#endregion
  56284. //#region ../../packages/components/infinite-scroll/index.ts
  56285. const _InfiniteScroll = InfiniteScroll;
  56286. _InfiniteScroll.install = (app) => {
  56287. app.directive("InfiniteScroll", _InfiniteScroll);
  56288. };
  56289. const ElInfiniteScroll = _InfiniteScroll;
  56290. //#endregion
  56291. //#region ../../packages/components/loading/src/loading.ts
  56292. function createLoadingComponent(options, appContext) {
  56293. let afterLeaveTimer;
  56294. const afterLeaveFlag = ref(false);
  56295. const data = reactive({
  56296. ...options,
  56297. originalPosition: "",
  56298. originalOverflow: "",
  56299. visible: false
  56300. });
  56301. function setText(text) {
  56302. data.text = text;
  56303. }
  56304. function destroySelf() {
  56305. const target = data.parent;
  56306. const ns = vm.ns;
  56307. if (!target.vLoadingAddClassList) {
  56308. let loadingNumber = target.getAttribute("loading-number");
  56309. loadingNumber = Number.parseInt(loadingNumber) - 1;
  56310. if (!loadingNumber) {
  56311. removeClass(target, ns.bm("parent", "relative"));
  56312. target.removeAttribute("loading-number");
  56313. } else target.setAttribute("loading-number", loadingNumber.toString());
  56314. removeClass(target, ns.bm("parent", "hidden"));
  56315. }
  56316. removeElLoadingChild();
  56317. loadingInstance.unmount();
  56318. }
  56319. function removeElLoadingChild() {
  56320. vm.$el?.parentNode?.removeChild(vm.$el);
  56321. }
  56322. function close() {
  56323. if (options.beforeClose && !options.beforeClose()) return;
  56324. afterLeaveFlag.value = true;
  56325. clearTimeout(afterLeaveTimer);
  56326. afterLeaveTimer = setTimeout(handleAfterLeave, 400);
  56327. data.visible = false;
  56328. options.closed?.();
  56329. }
  56330. function handleAfterLeave() {
  56331. if (!afterLeaveFlag.value) return;
  56332. const target = data.parent;
  56333. afterLeaveFlag.value = false;
  56334. target.vLoadingAddClassList = void 0;
  56335. destroySelf();
  56336. }
  56337. const loadingInstance = createApp(defineComponent({
  56338. name: "ElLoading",
  56339. setup(_, { expose }) {
  56340. const { ns, zIndex } = useGlobalComponentSettings("loading");
  56341. expose({
  56342. ns,
  56343. zIndex
  56344. });
  56345. return () => {
  56346. const svg = data.spinner || data.svg;
  56347. const spinner = h("svg", {
  56348. class: "circular",
  56349. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  56350. ...svg ? { innerHTML: svg } : {}
  56351. }, [h("circle", {
  56352. class: "path",
  56353. cx: "25",
  56354. cy: "25",
  56355. r: "20",
  56356. fill: "none"
  56357. })]);
  56358. const spinnerText = data.text ? h("p", { class: ns.b("text") }, [data.text]) : void 0;
  56359. return h(Transition, {
  56360. name: ns.b("fade"),
  56361. onAfterLeave: handleAfterLeave
  56362. }, { default: withCtx(() => [withDirectives(createVNode("div", {
  56363. style: { backgroundColor: data.background || "" },
  56364. class: [
  56365. ns.b("mask"),
  56366. data.customClass,
  56367. ns.is("fullscreen", data.fullscreen)
  56368. ]
  56369. }, [h("div", { class: ns.b("spinner") }, [spinner, spinnerText])]), [[vShow, data.visible]])]) });
  56370. };
  56371. }
  56372. }));
  56373. Object.assign(loadingInstance._context, appContext ?? {});
  56374. const vm = loadingInstance.mount(document.createElement("div"));
  56375. return {
  56376. ...toRefs(data),
  56377. setText,
  56378. removeElLoadingChild,
  56379. close,
  56380. handleAfterLeave,
  56381. vm,
  56382. get $el() {
  56383. return vm.$el;
  56384. }
  56385. };
  56386. }
  56387. //#endregion
  56388. //#region ../../packages/components/loading/src/service.ts
  56389. let fullscreenInstance = void 0;
  56390. const Loading = function(options = {}, context) {
  56391. if (!isClient) return void 0;
  56392. const resolved = resolveOptions(options);
  56393. if (resolved.fullscreen && fullscreenInstance) return fullscreenInstance;
  56394. const instance = createLoadingComponent({
  56395. ...resolved,
  56396. closed: () => {
  56397. resolved.closed?.();
  56398. if (resolved.fullscreen) fullscreenInstance = void 0;
  56399. }
  56400. }, context ?? Loading._context);
  56401. addStyle(resolved, resolved.parent, instance);
  56402. addClassList(resolved, resolved.parent, instance);
  56403. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  56404. /**
  56405. * add loading-number to parent.
  56406. * because if a fullscreen loading is triggered when somewhere
  56407. * a v-loading.body was triggered before and it's parent is
  56408. * document.body which with a margin , the fullscreen loading's
  56409. * destroySelf function will remove 'el-loading-parent--relative',
  56410. * and then the position of v-loading.body will be error.
  56411. */
  56412. let loadingNumber = resolved.parent.getAttribute("loading-number");
  56413. if (!loadingNumber) loadingNumber = "1";
  56414. else loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  56415. resolved.parent.setAttribute("loading-number", loadingNumber);
  56416. resolved.parent.appendChild(instance.$el);
  56417. nextTick(() => instance.visible.value = resolved.visible);
  56418. if (resolved.fullscreen) fullscreenInstance = instance;
  56419. return instance;
  56420. };
  56421. const resolveOptions = (options) => {
  56422. let target;
  56423. if (isString(options.target)) target = document.querySelector(options.target) ?? document.body;
  56424. else target = options.target || document.body;
  56425. return {
  56426. parent: target === document.body || options.body ? document.body : target,
  56427. background: options.background || "",
  56428. svg: options.svg || "",
  56429. svgViewBox: options.svgViewBox || "",
  56430. spinner: options.spinner || false,
  56431. text: options.text || "",
  56432. fullscreen: target === document.body && (options.fullscreen ?? true),
  56433. lock: options.lock ?? false,
  56434. customClass: options.customClass || "",
  56435. visible: options.visible ?? true,
  56436. beforeClose: options.beforeClose,
  56437. closed: options.closed,
  56438. target
  56439. };
  56440. };
  56441. const addStyle = async (options, parent, instance) => {
  56442. const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
  56443. const maskStyle = {};
  56444. if (options.fullscreen) {
  56445. instance.originalPosition.value = getStyle(document.body, "position");
  56446. instance.originalOverflow.value = getStyle(document.body, "overflow");
  56447. maskStyle.zIndex = nextZIndex();
  56448. } else if (options.parent === document.body) {
  56449. instance.originalPosition.value = getStyle(document.body, "position");
  56450. /**
  56451. * await dom render when visible is true in init,
  56452. * because some component's height maybe 0.
  56453. * e.g. el-table.
  56454. */
  56455. await nextTick();
  56456. for (const property of ["top", "left"]) {
  56457. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  56458. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  56459. }
  56460. for (const property of ["height", "width"]) maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  56461. } else instance.originalPosition.value = getStyle(parent, "position");
  56462. for (const [key, value] of Object.entries(maskStyle)) instance.$el.style[key] = value;
  56463. };
  56464. const addClassList = (options, parent, instance) => {
  56465. const ns = instance.vm.ns || instance.vm._.exposed.ns;
  56466. if (![
  56467. "absolute",
  56468. "fixed",
  56469. "sticky"
  56470. ].includes(instance.originalPosition.value)) addClass(parent, ns.bm("parent", "relative"));
  56471. else removeClass(parent, ns.bm("parent", "relative"));
  56472. if (options.fullscreen && options.lock) addClass(parent, ns.bm("parent", "hidden"));
  56473. else removeClass(parent, ns.bm("parent", "hidden"));
  56474. };
  56475. Loading._context = null;
  56476. //#endregion
  56477. //#region ../../packages/components/loading/src/directive.ts
  56478. const INSTANCE_KEY = Symbol("ElLoading");
  56479. const getAttributeName = (name) => {
  56480. return `element-loading-${hyphenate(name)}`;
  56481. };
  56482. const createInstance = (el, binding) => {
  56483. const vm = binding.instance;
  56484. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  56485. const resolveExpression = (key) => {
  56486. return ref(isString(key) && vm?.[key] || key);
  56487. };
  56488. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(getAttributeName(name)));
  56489. const fullscreen = getBindingProp("fullscreen") ?? binding.modifiers.fullscreen;
  56490. const options = {
  56491. text: getProp("text"),
  56492. svg: getProp("svg"),
  56493. svgViewBox: getProp("svgViewBox"),
  56494. spinner: getProp("spinner"),
  56495. background: getProp("background"),
  56496. customClass: getProp("customClass"),
  56497. fullscreen,
  56498. target: getBindingProp("target") ?? (fullscreen ? void 0 : el),
  56499. body: getBindingProp("body") ?? binding.modifiers.body,
  56500. lock: getBindingProp("lock") ?? binding.modifiers.lock
  56501. };
  56502. const instance = Loading(options);
  56503. instance._context = vLoading._context;
  56504. el[INSTANCE_KEY] = {
  56505. options,
  56506. instance
  56507. };
  56508. };
  56509. const updateOptions = (originalOptions, newOptions) => {
  56510. for (const key of Object.keys(originalOptions)) if (isRef(originalOptions[key])) originalOptions[key].value = newOptions[key];
  56511. };
  56512. const vLoading = {
  56513. mounted(el, binding) {
  56514. if (binding.value) createInstance(el, binding);
  56515. },
  56516. updated(el, binding) {
  56517. const instance = el[INSTANCE_KEY];
  56518. if (!binding.value) {
  56519. instance?.instance.close();
  56520. el[INSTANCE_KEY] = null;
  56521. return;
  56522. }
  56523. if (!instance) createInstance(el, binding);
  56524. else updateOptions(instance.options, isObject$1(binding.value) ? binding.value : {
  56525. text: el.getAttribute(getAttributeName("text")),
  56526. svg: el.getAttribute(getAttributeName("svg")),
  56527. svgViewBox: el.getAttribute(getAttributeName("svgViewBox")),
  56528. spinner: el.getAttribute(getAttributeName("spinner")),
  56529. background: el.getAttribute(getAttributeName("background")),
  56530. customClass: el.getAttribute(getAttributeName("customClass"))
  56531. });
  56532. },
  56533. unmounted(el) {
  56534. el[INSTANCE_KEY]?.instance.close();
  56535. el[INSTANCE_KEY] = null;
  56536. }
  56537. };
  56538. vLoading._context = null;
  56539. //#endregion
  56540. //#region ../../packages/components/loading/index.ts
  56541. const ElLoading = {
  56542. install(app) {
  56543. Loading._context = app._context;
  56544. vLoading._context = app._context;
  56545. app.directive("loading", vLoading);
  56546. app.config.globalProperties.$loading = Loading;
  56547. },
  56548. directive: vLoading,
  56549. service: Loading
  56550. };
  56551. //#endregion
  56552. //#region ../../packages/components/message/src/message.ts
  56553. const messageTypes = [
  56554. "primary",
  56555. "success",
  56556. "info",
  56557. "warning",
  56558. "error"
  56559. ];
  56560. const messagePlacement = [
  56561. "top",
  56562. "top-left",
  56563. "top-right",
  56564. "bottom",
  56565. "bottom-left",
  56566. "bottom-right"
  56567. ];
  56568. const MESSAGE_DEFAULT_PLACEMENT = "top";
  56569. const messageDefaults = mutable({
  56570. customClass: "",
  56571. dangerouslyUseHTMLString: false,
  56572. duration: 3e3,
  56573. icon: void 0,
  56574. id: "",
  56575. message: "",
  56576. onClose: void 0,
  56577. showClose: false,
  56578. type: "info",
  56579. plain: false,
  56580. offset: 16,
  56581. placement: void 0,
  56582. zIndex: 0,
  56583. grouping: false,
  56584. repeatNum: 1,
  56585. appendTo: isClient ? document.body : void 0
  56586. });
  56587. /**
  56588. * @deprecated Removed after 3.0.0, Use `MessageProps` instead.
  56589. */
  56590. const messageProps = buildProps({
  56591. customClass: {
  56592. type: String,
  56593. default: messageDefaults.customClass
  56594. },
  56595. dangerouslyUseHTMLString: {
  56596. type: Boolean,
  56597. default: messageDefaults.dangerouslyUseHTMLString
  56598. },
  56599. duration: {
  56600. type: Number,
  56601. default: messageDefaults.duration
  56602. },
  56603. icon: {
  56604. type: iconPropType,
  56605. default: messageDefaults.icon
  56606. },
  56607. id: {
  56608. type: String,
  56609. default: messageDefaults.id
  56610. },
  56611. message: {
  56612. type: definePropType([
  56613. String,
  56614. Object,
  56615. Function
  56616. ]),
  56617. default: messageDefaults.message
  56618. },
  56619. onClose: {
  56620. type: definePropType(Function),
  56621. default: messageDefaults.onClose
  56622. },
  56623. showClose: {
  56624. type: Boolean,
  56625. default: messageDefaults.showClose
  56626. },
  56627. type: {
  56628. type: String,
  56629. values: messageTypes,
  56630. default: messageDefaults.type
  56631. },
  56632. plain: {
  56633. type: Boolean,
  56634. default: messageDefaults.plain
  56635. },
  56636. offset: {
  56637. type: Number,
  56638. default: messageDefaults.offset
  56639. },
  56640. placement: {
  56641. type: String,
  56642. values: messagePlacement,
  56643. default: messageDefaults.placement
  56644. },
  56645. zIndex: {
  56646. type: Number,
  56647. default: messageDefaults.zIndex
  56648. },
  56649. grouping: {
  56650. type: Boolean,
  56651. default: messageDefaults.grouping
  56652. },
  56653. repeatNum: {
  56654. type: Number,
  56655. default: messageDefaults.repeatNum
  56656. }
  56657. });
  56658. const messageEmits = { destroy: () => true };
  56659. //#endregion
  56660. //#region ../../packages/components/message/src/instance.ts
  56661. const placementInstances = shallowReactive({});
  56662. const getOrCreatePlacementInstances = (placement) => {
  56663. if (!placementInstances[placement]) placementInstances[placement] = shallowReactive([]);
  56664. return placementInstances[placement];
  56665. };
  56666. const getInstance = (id, placement) => {
  56667. const instances = placementInstances[placement] || [];
  56668. const idx = instances.findIndex((instance) => instance.id === id);
  56669. const current = instances[idx];
  56670. let prev;
  56671. if (idx > 0) prev = instances[idx - 1];
  56672. return {
  56673. current,
  56674. prev
  56675. };
  56676. };
  56677. const getLastOffset = (id, placement) => {
  56678. const { prev } = getInstance(id, placement);
  56679. if (!prev) return 0;
  56680. return prev.vm.exposed.bottom.value;
  56681. };
  56682. const getOffsetOrSpace = (id, offset, placement) => {
  56683. return (placementInstances[placement] || []).findIndex((instance) => instance.id === id) > 0 ? 16 : offset;
  56684. };
  56685. //#endregion
  56686. //#region ../../packages/components/message/src/message.vue?vue&type=script&setup=true&lang.ts
  56687. const _hoisted_1$2 = ["id"];
  56688. const _hoisted_2$2 = ["innerHTML"];
  56689. var message_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  56690. name: "ElMessage",
  56691. __name: "message",
  56692. props: messageProps,
  56693. emits: messageEmits,
  56694. setup(__props, { expose: __expose, emit: __emit }) {
  56695. const { Close } = TypeComponents;
  56696. const props = __props;
  56697. const emit = __emit;
  56698. const isStartTransition = ref(false);
  56699. const { ns, zIndex } = useGlobalComponentSettings("message");
  56700. const { currentZIndex, nextZIndex } = zIndex;
  56701. const messageRef = ref();
  56702. const visible = ref(false);
  56703. const height = ref(0);
  56704. let stopTimer = void 0;
  56705. const badgeType = computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  56706. const typeClass = computed(() => {
  56707. const type = props.type;
  56708. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  56709. });
  56710. const iconComponent = computed(() => props.icon || TypeComponentsMap[props.type] || "");
  56711. const placement = computed(() => props.placement || MESSAGE_DEFAULT_PLACEMENT);
  56712. const lastOffset = computed(() => getLastOffset(props.id, placement.value));
  56713. const offset = computed(() => {
  56714. return getOffsetOrSpace(props.id, props.offset, placement.value) + lastOffset.value;
  56715. });
  56716. const bottom = computed(() => height.value + offset.value);
  56717. const horizontalClass = computed(() => {
  56718. if (placement.value.includes("left")) return ns.is("left");
  56719. if (placement.value.includes("right")) return ns.is("right");
  56720. return ns.is("center");
  56721. });
  56722. const verticalProperty = computed(() => placement.value.startsWith("top") ? "top" : "bottom");
  56723. const customStyle = computed(() => ({
  56724. [verticalProperty.value]: `${offset.value}px`,
  56725. zIndex: currentZIndex.value
  56726. }));
  56727. function startTimer() {
  56728. if (props.duration === 0) return;
  56729. ({stop: stopTimer} = useTimeoutFn(() => {
  56730. close();
  56731. }, props.duration));
  56732. }
  56733. function clearTimer() {
  56734. stopTimer?.();
  56735. }
  56736. function close() {
  56737. visible.value = false;
  56738. nextTick(() => {
  56739. if (!isStartTransition.value) {
  56740. props.onClose?.();
  56741. emit("destroy");
  56742. }
  56743. });
  56744. }
  56745. function keydown(event) {
  56746. if (getEventCode(event) === EVENT_CODE.esc) close();
  56747. }
  56748. onMounted(() => {
  56749. startTimer();
  56750. nextZIndex();
  56751. visible.value = true;
  56752. });
  56753. watch(() => props.repeatNum, () => {
  56754. clearTimer();
  56755. startTimer();
  56756. });
  56757. useEventListener(document, "keydown", keydown);
  56758. useResizeObserver(messageRef, () => {
  56759. height.value = messageRef.value.getBoundingClientRect().height;
  56760. });
  56761. __expose({
  56762. visible,
  56763. bottom,
  56764. close
  56765. });
  56766. return (_ctx, _cache) => {
  56767. return openBlock(), createBlock(Transition, {
  56768. name: unref(ns).b("fade"),
  56769. onBeforeEnter: _cache[0] || (_cache[0] = ($event) => isStartTransition.value = true),
  56770. onBeforeLeave: __props.onClose,
  56771. onAfterLeave: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("destroy")),
  56772. persisted: ""
  56773. }, {
  56774. default: withCtx(() => [withDirectives(createElementVNode("div", {
  56775. id: __props.id,
  56776. ref_key: "messageRef",
  56777. ref: messageRef,
  56778. class: normalizeClass([
  56779. unref(ns).b(),
  56780. { [unref(ns).m(__props.type)]: __props.type },
  56781. unref(ns).is("closable", __props.showClose),
  56782. unref(ns).is("plain", __props.plain),
  56783. unref(ns).is("bottom", verticalProperty.value === "bottom"),
  56784. horizontalClass.value,
  56785. __props.customClass
  56786. ]),
  56787. style: normalizeStyle(customStyle.value),
  56788. role: "alert",
  56789. onMouseenter: clearTimer,
  56790. onMouseleave: startTimer
  56791. }, [
  56792. __props.repeatNum > 1 ? (openBlock(), createBlock(unref(ElBadge), {
  56793. key: 0,
  56794. value: __props.repeatNum,
  56795. type: badgeType.value,
  56796. class: normalizeClass(unref(ns).e("badge"))
  56797. }, null, 8, [
  56798. "value",
  56799. "type",
  56800. "class"
  56801. ])) : createCommentVNode("v-if", true),
  56802. iconComponent.value ? (openBlock(), createBlock(unref(ElIcon), {
  56803. key: 1,
  56804. class: normalizeClass([unref(ns).e("icon"), typeClass.value])
  56805. }, {
  56806. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(iconComponent.value)))]),
  56807. _: 1
  56808. }, 8, ["class"])) : createCommentVNode("v-if", true),
  56809. renderSlot(_ctx.$slots, "default", {}, () => [!__props.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", {
  56810. key: 0,
  56811. class: normalizeClass(unref(ns).e("content"))
  56812. }, toDisplayString(__props.message), 3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "), createElementVNode("p", {
  56813. class: normalizeClass(unref(ns).e("content")),
  56814. innerHTML: __props.message
  56815. }, null, 10, _hoisted_2$2)], 2112))]),
  56816. __props.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  56817. key: 2,
  56818. class: normalizeClass(unref(ns).e("closeBtn")),
  56819. onClick: withModifiers(close, ["stop"])
  56820. }, {
  56821. default: withCtx(() => [createVNode(unref(Close))]),
  56822. _: 1
  56823. }, 8, ["class"])) : createCommentVNode("v-if", true)
  56824. ], 46, _hoisted_1$2), [[vShow, visible.value]])]),
  56825. _: 3
  56826. }, 8, ["name", "onBeforeLeave"]);
  56827. };
  56828. }
  56829. });
  56830. //#endregion
  56831. //#region ../../packages/components/message/src/message.vue
  56832. var message_default = message_vue_vue_type_script_setup_true_lang_default;
  56833. //#endregion
  56834. //#region ../../packages/components/message/src/method.ts
  56835. let seed$1 = 1;
  56836. const normalizeAppendTo = (normalized) => {
  56837. if (!normalized.appendTo) normalized.appendTo = document.body;
  56838. else if (isString(normalized.appendTo)) {
  56839. let appendTo = document.querySelector(normalized.appendTo);
  56840. if (!isElement$1(appendTo)) {
  56841. /* @__PURE__ */ debugWarn("ElMessage", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  56842. appendTo = document.body;
  56843. }
  56844. normalized.appendTo = appendTo;
  56845. }
  56846. };
  56847. const normalizePlacement = (normalized) => {
  56848. if (!normalized.placement && isString(messageConfig.placement) && messageConfig.placement) normalized.placement = messageConfig.placement;
  56849. if (!normalized.placement) normalized.placement = MESSAGE_DEFAULT_PLACEMENT;
  56850. if (!messagePlacement.includes(normalized.placement)) {
  56851. /* @__PURE__ */ debugWarn("ElMessage", `Invalid placement: ${normalized.placement}. Falling back to '${MESSAGE_DEFAULT_PLACEMENT}'.`);
  56852. normalized.placement = MESSAGE_DEFAULT_PLACEMENT;
  56853. }
  56854. };
  56855. const normalizeOptions = (params) => {
  56856. const options = !params || isString(params) || isVNode(params) || isFunction$1(params) ? { message: params } : params;
  56857. const normalized = {
  56858. ...messageDefaults,
  56859. ...options
  56860. };
  56861. normalizeAppendTo(normalized);
  56862. normalizePlacement(normalized);
  56863. if (isBoolean(messageConfig.grouping) && !normalized.grouping) normalized.grouping = messageConfig.grouping;
  56864. if (isNumber(messageConfig.duration) && normalized.duration === 3e3) normalized.duration = messageConfig.duration;
  56865. if (isNumber(messageConfig.offset) && normalized.offset === 16) normalized.offset = messageConfig.offset;
  56866. if (isBoolean(messageConfig.showClose) && !normalized.showClose) normalized.showClose = messageConfig.showClose;
  56867. if (isBoolean(messageConfig.plain) && !normalized.plain) normalized.plain = messageConfig.plain;
  56868. return normalized;
  56869. };
  56870. const closeMessage = (instance) => {
  56871. const instances = placementInstances[instance.props.placement || MESSAGE_DEFAULT_PLACEMENT];
  56872. const idx = instances.indexOf(instance);
  56873. if (idx === -1) return;
  56874. instances.splice(idx, 1);
  56875. const { handler } = instance;
  56876. handler.close();
  56877. };
  56878. const createMessage = ({ appendTo, ...options }, context) => {
  56879. const id = `message_${seed$1++}`;
  56880. const userOnClose = options.onClose;
  56881. const container = document.createElement("div");
  56882. const props = {
  56883. ...options,
  56884. id,
  56885. onClose: () => {
  56886. userOnClose?.();
  56887. closeMessage(instance);
  56888. },
  56889. onDestroy: () => {
  56890. render(null, container);
  56891. }
  56892. };
  56893. const vnode = createVNode(message_default, props, isFunction$1(props.message) || isVNode(props.message) ? { default: isFunction$1(props.message) ? props.message : () => props.message } : null);
  56894. vnode.appContext = context || message._context;
  56895. render(vnode, container);
  56896. appendTo.appendChild(container.firstElementChild);
  56897. const vm = vnode.component;
  56898. const instance = {
  56899. id,
  56900. vnode,
  56901. vm,
  56902. handler: { close: () => {
  56903. vm.exposed.close();
  56904. } },
  56905. props: vnode.component.props
  56906. };
  56907. return instance;
  56908. };
  56909. const message = (options = {}, context) => {
  56910. if (!isClient) return { close: () => void 0 };
  56911. const normalized = normalizeOptions(options);
  56912. const instances = getOrCreatePlacementInstances(normalized.placement || MESSAGE_DEFAULT_PLACEMENT);
  56913. if (normalized.grouping && instances.length) {
  56914. const instance = instances.find(({ vnode: vm }) => vm.props?.message === normalized.message);
  56915. if (instance) {
  56916. instance.props.repeatNum += 1;
  56917. instance.props.type = normalized.type;
  56918. return instance.handler;
  56919. }
  56920. }
  56921. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) return { close: () => void 0 };
  56922. const instance = createMessage(normalized, context);
  56923. instances.push(instance);
  56924. return instance.handler;
  56925. };
  56926. messageTypes.forEach((type) => {
  56927. message[type] = (options = {}, appContext) => {
  56928. return message({
  56929. ...normalizeOptions(options),
  56930. type
  56931. }, appContext);
  56932. };
  56933. });
  56934. function closeAll$1(type) {
  56935. for (const placement in placementInstances) if (hasOwn(placementInstances, placement)) {
  56936. const instances = [...placementInstances[placement]];
  56937. for (const instance of instances) if (!type || type === instance.props.type) instance.handler.close();
  56938. }
  56939. }
  56940. function closeAllByPlacement(placement) {
  56941. if (!placementInstances[placement]) return;
  56942. [...placementInstances[placement]].forEach((instance) => instance.handler.close());
  56943. }
  56944. message.closeAll = closeAll$1;
  56945. message.closeAllByPlacement = closeAllByPlacement;
  56946. message._context = null;
  56947. //#endregion
  56948. //#region ../../packages/components/message/index.ts
  56949. const ElMessage = withInstallFunction(message, "$message");
  56950. //#endregion
  56951. //#region ../../packages/components/message-box/src/index.vue?vue&type=script&lang.ts
  56952. var index_vue_vue_type_script_lang_default = defineComponent({
  56953. name: "ElMessageBox",
  56954. directives: { TrapFocus },
  56955. components: {
  56956. ElButton,
  56957. ElFocusTrap: focus_trap_default,
  56958. ElInput,
  56959. ElOverlay,
  56960. ElIcon,
  56961. ...TypeComponents
  56962. },
  56963. inheritAttrs: false,
  56964. props: {
  56965. buttonSize: {
  56966. type: String,
  56967. validator: isValidComponentSize
  56968. },
  56969. modal: {
  56970. type: Boolean,
  56971. default: true
  56972. },
  56973. lockScroll: {
  56974. type: Boolean,
  56975. default: true
  56976. },
  56977. showClose: {
  56978. type: Boolean,
  56979. default: true
  56980. },
  56981. closeOnClickModal: {
  56982. type: Boolean,
  56983. default: true
  56984. },
  56985. closeOnPressEscape: {
  56986. type: Boolean,
  56987. default: true
  56988. },
  56989. closeOnHashChange: {
  56990. type: Boolean,
  56991. default: true
  56992. },
  56993. center: Boolean,
  56994. draggable: Boolean,
  56995. overflow: Boolean,
  56996. roundButton: Boolean,
  56997. container: {
  56998. type: String,
  56999. default: "body"
  57000. },
  57001. boxType: {
  57002. type: String,
  57003. default: ""
  57004. }
  57005. },
  57006. emits: ["vanish", "action"],
  57007. setup(props, { emit }) {
  57008. const { locale, zIndex, ns, size: btnSize } = useGlobalComponentSettings("message-box", computed(() => props.buttonSize));
  57009. const { t } = locale;
  57010. const { nextZIndex } = zIndex;
  57011. const visible = ref(false);
  57012. const state = reactive({
  57013. autofocus: true,
  57014. beforeClose: null,
  57015. callback: null,
  57016. cancelButtonText: "",
  57017. cancelButtonClass: "",
  57018. confirmButtonText: "",
  57019. confirmButtonClass: "",
  57020. cancelButtonType: "",
  57021. confirmButtonType: "primary",
  57022. customClass: "",
  57023. customStyle: {},
  57024. dangerouslyUseHTMLString: false,
  57025. distinguishCancelAndClose: false,
  57026. icon: "",
  57027. closeIcon: "",
  57028. inputPattern: null,
  57029. inputPlaceholder: "",
  57030. inputType: "text",
  57031. inputValue: "",
  57032. inputValidator: void 0,
  57033. inputErrorMessage: "",
  57034. message: "",
  57035. modalFade: true,
  57036. modalClass: "",
  57037. showCancelButton: false,
  57038. showConfirmButton: true,
  57039. type: "",
  57040. title: void 0,
  57041. showInput: false,
  57042. action: "",
  57043. confirmButtonLoading: false,
  57044. cancelButtonLoading: false,
  57045. confirmButtonLoadingIcon: markRaw(loading_default),
  57046. cancelButtonLoadingIcon: markRaw(loading_default),
  57047. confirmButtonDisabled: false,
  57048. editorErrorMessage: "",
  57049. validateError: false,
  57050. zIndex: nextZIndex()
  57051. });
  57052. const typeClass = computed(() => {
  57053. const type = state.type;
  57054. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  57055. });
  57056. const contentId = useId();
  57057. const inputId = useId();
  57058. const iconComponent = computed(() => {
  57059. const type = state.type;
  57060. return state.icon || type && TypeComponentsMap[type] || "";
  57061. });
  57062. const hasMessage = computed(() => !!state.message);
  57063. const rootRef = ref();
  57064. const headerRef = ref();
  57065. const focusStartRef = ref();
  57066. const inputRef = ref();
  57067. const confirmRef = ref();
  57068. const confirmButtonClasses = computed(() => state.confirmButtonClass);
  57069. watch(() => state.inputValue, async (val) => {
  57070. await nextTick();
  57071. if (props.boxType === "prompt" && val) validate();
  57072. }, { immediate: true });
  57073. watch(() => visible.value, (val) => {
  57074. if (val) {
  57075. if (props.boxType !== "prompt") if (state.autofocus) focusStartRef.value = confirmRef.value?.$el ?? rootRef.value;
  57076. else focusStartRef.value = rootRef.value;
  57077. state.zIndex = nextZIndex();
  57078. }
  57079. if (props.boxType !== "prompt") return;
  57080. if (val) nextTick().then(() => {
  57081. if (inputRef.value && inputRef.value.$el) if (state.autofocus) focusStartRef.value = getInputElement() ?? rootRef.value;
  57082. else focusStartRef.value = rootRef.value;
  57083. });
  57084. else {
  57085. state.editorErrorMessage = "";
  57086. state.validateError = false;
  57087. }
  57088. });
  57089. const { isDragging } = useDraggable(rootRef, headerRef, computed(() => props.draggable), computed(() => props.overflow));
  57090. onMounted(async () => {
  57091. await nextTick();
  57092. if (props.closeOnHashChange) window.addEventListener("hashchange", doClose);
  57093. });
  57094. onBeforeUnmount(() => {
  57095. if (props.closeOnHashChange) window.removeEventListener("hashchange", doClose);
  57096. });
  57097. function doClose() {
  57098. if (!visible.value) return;
  57099. visible.value = false;
  57100. nextTick(() => {
  57101. if (state.action) emit("action", state.action);
  57102. });
  57103. }
  57104. const handleWrapperClick = () => {
  57105. if (props.closeOnClickModal) handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  57106. };
  57107. const overlayEvent = useSameTarget(handleWrapperClick);
  57108. const handleInputEnter = (e) => {
  57109. if (state.inputType !== "textarea" && !inputRef.value?.isComposing) {
  57110. e.preventDefault();
  57111. return handleAction("confirm");
  57112. }
  57113. };
  57114. const handleAction = (action) => {
  57115. if (props.boxType === "prompt" && action === "confirm" && !validate()) return;
  57116. state.action = action;
  57117. if (state.beforeClose) state.beforeClose?.(action, state, doClose);
  57118. else doClose();
  57119. };
  57120. const validate = () => {
  57121. if (props.boxType === "prompt") {
  57122. const inputPattern = state.inputPattern;
  57123. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  57124. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  57125. state.validateError = true;
  57126. return false;
  57127. }
  57128. const inputValidator = state.inputValidator;
  57129. if (isFunction$1(inputValidator)) {
  57130. const validateResult = inputValidator(state.inputValue);
  57131. if (validateResult === false) {
  57132. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  57133. state.validateError = true;
  57134. return false;
  57135. }
  57136. if (isString(validateResult)) {
  57137. state.editorErrorMessage = validateResult;
  57138. state.validateError = true;
  57139. return false;
  57140. }
  57141. }
  57142. }
  57143. state.editorErrorMessage = "";
  57144. state.validateError = false;
  57145. return true;
  57146. };
  57147. const getInputElement = () => {
  57148. const inputRefs = inputRef.value?.$refs;
  57149. return inputRefs?.input ?? inputRefs?.textarea;
  57150. };
  57151. const handleClose = () => {
  57152. handleAction("close");
  57153. };
  57154. const onCloseRequested = () => {
  57155. if (props.closeOnPressEscape) handleClose();
  57156. };
  57157. if (props.lockScroll) useLockscreen(visible, { ns });
  57158. return {
  57159. ...toRefs(state),
  57160. ns,
  57161. overlayEvent,
  57162. visible,
  57163. hasMessage,
  57164. typeClass,
  57165. contentId,
  57166. inputId,
  57167. btnSize,
  57168. iconComponent,
  57169. confirmButtonClasses,
  57170. rootRef,
  57171. focusStartRef,
  57172. headerRef,
  57173. inputRef,
  57174. isDragging,
  57175. confirmRef,
  57176. doClose,
  57177. handleClose,
  57178. onCloseRequested,
  57179. handleWrapperClick,
  57180. handleInputEnter,
  57181. handleAction,
  57182. t
  57183. };
  57184. }
  57185. });
  57186. //#endregion
  57187. //#region ../../packages/components/message-box/src/index.vue
  57188. const _hoisted_1$1 = ["aria-label", "aria-describedby"];
  57189. const _hoisted_2$1 = ["aria-label"];
  57190. const _hoisted_3$1 = ["id"];
  57191. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  57192. const _component_el_icon = resolveComponent("el-icon");
  57193. const _component_el_input = resolveComponent("el-input");
  57194. const _component_el_button = resolveComponent("el-button");
  57195. const _component_el_focus_trap = resolveComponent("el-focus-trap");
  57196. const _component_el_overlay = resolveComponent("el-overlay");
  57197. return openBlock(), createBlock(Transition, {
  57198. name: "fade-in-linear",
  57199. onAfterLeave: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("vanish")),
  57200. persisted: ""
  57201. }, {
  57202. default: withCtx(() => [withDirectives(createVNode(_component_el_overlay, {
  57203. "z-index": _ctx.zIndex,
  57204. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  57205. mask: _ctx.modal
  57206. }, {
  57207. default: withCtx(() => [createElementVNode("div", {
  57208. role: "dialog",
  57209. "aria-label": _ctx.title,
  57210. "aria-modal": "true",
  57211. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  57212. class: normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  57213. onClick: _cache[8] || (_cache[8] = (...args) => _ctx.overlayEvent.onClick && _ctx.overlayEvent.onClick(...args)),
  57214. onMousedown: _cache[9] || (_cache[9] = (...args) => _ctx.overlayEvent.onMousedown && _ctx.overlayEvent.onMousedown(...args)),
  57215. onMouseup: _cache[10] || (_cache[10] = (...args) => _ctx.overlayEvent.onMouseup && _ctx.overlayEvent.onMouseup(...args))
  57216. }, [createVNode(_component_el_focus_trap, {
  57217. loop: "",
  57218. trapped: _ctx.visible,
  57219. "focus-trap-el": _ctx.rootRef,
  57220. "focus-start-el": _ctx.focusStartRef,
  57221. onReleaseRequested: _ctx.onCloseRequested
  57222. }, {
  57223. default: withCtx(() => [createElementVNode("div", {
  57224. ref: "rootRef",
  57225. class: normalizeClass([
  57226. _ctx.ns.b(),
  57227. _ctx.customClass,
  57228. _ctx.ns.is("draggable", _ctx.draggable),
  57229. _ctx.ns.is("dragging", _ctx.isDragging),
  57230. { [_ctx.ns.m("center")]: _ctx.center }
  57231. ]),
  57232. style: normalizeStyle(_ctx.customStyle),
  57233. tabindex: "-1",
  57234. onClick: _cache[7] || (_cache[7] = withModifiers(() => {}, ["stop"]))
  57235. }, [
  57236. _ctx.title !== null && _ctx.title !== void 0 ? (openBlock(), createElementBlock("div", {
  57237. key: 0,
  57238. ref: "headerRef",
  57239. class: normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
  57240. }, [createElementVNode("div", { class: normalizeClass(_ctx.ns.e("title")) }, [_ctx.iconComponent && _ctx.center ? (openBlock(), createBlock(_component_el_icon, {
  57241. key: 0,
  57242. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  57243. }, {
  57244. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))]),
  57245. _: 1
  57246. }, 8, ["class"])) : createCommentVNode("v-if", true), createElementVNode("span", null, toDisplayString(_ctx.title), 1)], 2), _ctx.showClose ? (openBlock(), createElementBlock("button", {
  57247. key: 0,
  57248. type: "button",
  57249. class: normalizeClass(_ctx.ns.e("headerbtn")),
  57250. "aria-label": _ctx.t("el.messagebox.close"),
  57251. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel")),
  57252. onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"]))
  57253. }, [createVNode(_component_el_icon, { class: normalizeClass(_ctx.ns.e("close")) }, {
  57254. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || "close")))]),
  57255. _: 1
  57256. }, 8, ["class"])], 42, _hoisted_2$1)) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true),
  57257. createElementVNode("div", {
  57258. id: _ctx.contentId,
  57259. class: normalizeClass(_ctx.ns.e("content"))
  57260. }, [createElementVNode("div", { class: normalizeClass(_ctx.ns.e("container")) }, [_ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (openBlock(), createBlock(_component_el_icon, {
  57261. key: 0,
  57262. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  57263. }, {
  57264. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))]),
  57265. _: 1
  57266. }, 8, ["class"])) : createCommentVNode("v-if", true), _ctx.hasMessage ? (openBlock(), createElementBlock("div", {
  57267. key: 1,
  57268. class: normalizeClass(_ctx.ns.e("message"))
  57269. }, [renderSlot(_ctx.$slots, "default", {}, () => [!_ctx.dangerouslyUseHTMLString ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  57270. key: 0,
  57271. for: _ctx.showInput ? _ctx.inputId : void 0,
  57272. textContent: toDisplayString(_ctx.message)
  57273. }, null, 8, ["for", "textContent"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  57274. key: 1,
  57275. for: _ctx.showInput ? _ctx.inputId : void 0,
  57276. innerHTML: _ctx.message
  57277. }, null, 8, ["for", "innerHTML"]))])], 2)) : createCommentVNode("v-if", true)], 2), withDirectives(createElementVNode("div", { class: normalizeClass(_ctx.ns.e("input")) }, [createVNode(_component_el_input, {
  57278. id: _ctx.inputId,
  57279. ref: "inputRef",
  57280. modelValue: _ctx.inputValue,
  57281. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event),
  57282. type: _ctx.inputType,
  57283. placeholder: _ctx.inputPlaceholder,
  57284. "aria-invalid": _ctx.validateError,
  57285. class: normalizeClass({ invalid: _ctx.validateError }),
  57286. onKeydown: withKeys(_ctx.handleInputEnter, ["enter"])
  57287. }, null, 8, [
  57288. "id",
  57289. "modelValue",
  57290. "type",
  57291. "placeholder",
  57292. "aria-invalid",
  57293. "class",
  57294. "onKeydown"
  57295. ]), createElementVNode("div", {
  57296. class: normalizeClass(_ctx.ns.e("errormsg")),
  57297. style: normalizeStyle({ visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden" })
  57298. }, toDisplayString(_ctx.editorErrorMessage), 7)], 2), [[vShow, _ctx.showInput]])], 10, _hoisted_3$1),
  57299. createElementVNode("div", { class: normalizeClass(_ctx.ns.e("btns")) }, [_ctx.showCancelButton ? (openBlock(), createBlock(_component_el_button, {
  57300. key: 0,
  57301. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  57302. text: _ctx.cancelButtonType === "text",
  57303. loading: _ctx.cancelButtonLoading,
  57304. "loading-icon": _ctx.cancelButtonLoadingIcon,
  57305. class: normalizeClass([_ctx.cancelButtonClass]),
  57306. round: _ctx.roundButton,
  57307. size: _ctx.btnSize,
  57308. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")),
  57309. onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"]))
  57310. }, {
  57311. default: withCtx(() => [createTextVNode(toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)]),
  57312. _: 1
  57313. }, 8, [
  57314. "type",
  57315. "text",
  57316. "loading",
  57317. "loading-icon",
  57318. "class",
  57319. "round",
  57320. "size"
  57321. ])) : createCommentVNode("v-if", true), withDirectives(createVNode(_component_el_button, {
  57322. ref: "confirmRef",
  57323. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  57324. text: _ctx.confirmButtonType === "text",
  57325. loading: _ctx.confirmButtonLoading,
  57326. "loading-icon": _ctx.confirmButtonLoadingIcon,
  57327. class: normalizeClass([_ctx.confirmButtonClasses]),
  57328. round: _ctx.roundButton,
  57329. disabled: _ctx.confirmButtonDisabled,
  57330. size: _ctx.btnSize,
  57331. onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")),
  57332. onKeydown: _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"]))
  57333. }, {
  57334. default: withCtx(() => [createTextVNode(toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)]),
  57335. _: 1
  57336. }, 8, [
  57337. "type",
  57338. "text",
  57339. "loading",
  57340. "loading-icon",
  57341. "class",
  57342. "round",
  57343. "disabled",
  57344. "size"
  57345. ]), [[vShow, _ctx.showConfirmButton]])], 2)
  57346. ], 6)]),
  57347. _: 3
  57348. }, 8, [
  57349. "trapped",
  57350. "focus-trap-el",
  57351. "focus-start-el",
  57352. "onReleaseRequested"
  57353. ])], 42, _hoisted_1$1)]),
  57354. _: 3
  57355. }, 8, [
  57356. "z-index",
  57357. "overlay-class",
  57358. "mask"
  57359. ]), [[vShow, _ctx.visible]])]),
  57360. _: 3
  57361. });
  57362. }
  57363. var src_default = /* @__PURE__ */ _plugin_vue_export_helper_default(index_vue_vue_type_script_lang_default, [["render", _sfc_render]]);
  57364. //#endregion
  57365. //#region ../../packages/components/message-box/src/messageBox.ts
  57366. const messageInstance = /* @__PURE__ */ new Map();
  57367. const getAppendToElement = (props) => {
  57368. let appendTo = document.body;
  57369. if (props.appendTo) {
  57370. if (isString(props.appendTo)) appendTo = document.querySelector(props.appendTo);
  57371. if (isElement$1(props.appendTo)) appendTo = props.appendTo;
  57372. if (!isElement$1(appendTo)) {
  57373. /* @__PURE__ */ debugWarn("ElMessageBox", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  57374. appendTo = document.body;
  57375. }
  57376. }
  57377. return appendTo;
  57378. };
  57379. const initInstance = (props, container, appContext = null) => {
  57380. const vnode = createVNode(src_default, props, isFunction$1(props.message) || isVNode(props.message) ? { default: isFunction$1(props.message) ? props.message : () => props.message } : null);
  57381. vnode.appContext = appContext;
  57382. render(vnode, container);
  57383. getAppendToElement(props).appendChild(container.firstElementChild);
  57384. return vnode.component;
  57385. };
  57386. const genContainer = () => {
  57387. return document.createElement("div");
  57388. };
  57389. const showMessage = (options, appContext) => {
  57390. const container = genContainer();
  57391. options.onVanish = () => {
  57392. render(null, container);
  57393. messageInstance.delete(vm);
  57394. };
  57395. options.onAction = (action) => {
  57396. const currentMsg = messageInstance.get(vm);
  57397. let resolve;
  57398. if (options.showInput) resolve = {
  57399. value: vm.inputValue,
  57400. action
  57401. };
  57402. else resolve = action;
  57403. if (options.callback) options.callback(resolve, instance.proxy);
  57404. else if (action === "cancel" || action === "close") if (options.distinguishCancelAndClose && action !== "cancel") currentMsg.reject("close");
  57405. else currentMsg.reject("cancel");
  57406. else currentMsg.resolve(resolve);
  57407. };
  57408. const instance = initInstance(options, container, appContext);
  57409. const vm = instance.proxy;
  57410. for (const prop in options) if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) if (prop === "closeIcon" && isObject$1(options[prop])) vm[prop] = markRaw(options[prop]);
  57411. else vm[prop] = options[prop];
  57412. vm.visible = true;
  57413. return vm;
  57414. };
  57415. function MessageBox(options, appContext = null) {
  57416. if (!isClient) return Promise.reject();
  57417. let callback;
  57418. if (isString(options) || isVNode(options)) options = { message: options };
  57419. else callback = options.callback;
  57420. return new Promise((resolve, reject) => {
  57421. const vm = showMessage(options, appContext ?? MessageBox._context);
  57422. messageInstance.set(vm, {
  57423. options,
  57424. callback,
  57425. resolve,
  57426. reject
  57427. });
  57428. });
  57429. }
  57430. const MESSAGE_BOX_VARIANTS = [
  57431. "alert",
  57432. "confirm",
  57433. "prompt"
  57434. ];
  57435. const MESSAGE_BOX_DEFAULT_OPTS = {
  57436. alert: {
  57437. closeOnPressEscape: false,
  57438. closeOnClickModal: false
  57439. },
  57440. confirm: { showCancelButton: true },
  57441. prompt: {
  57442. showCancelButton: true,
  57443. showInput: true
  57444. }
  57445. };
  57446. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  57447. MessageBox[boxType] = messageBoxFactory(boxType);
  57448. });
  57449. function messageBoxFactory(boxType) {
  57450. return (message, title, options, appContext) => {
  57451. let titleOrOpts = "";
  57452. if (isObject$1(title)) {
  57453. options = title;
  57454. titleOrOpts = "";
  57455. } else if (isUndefined(title)) titleOrOpts = "";
  57456. else titleOrOpts = title;
  57457. return MessageBox(Object.assign({
  57458. title: titleOrOpts,
  57459. message,
  57460. type: "",
  57461. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  57462. }, options, { boxType }), appContext);
  57463. };
  57464. }
  57465. MessageBox.close = () => {
  57466. messageInstance.forEach((_, vm) => {
  57467. vm.doClose();
  57468. });
  57469. messageInstance.clear();
  57470. };
  57471. MessageBox._context = null;
  57472. //#endregion
  57473. //#region ../../packages/components/message-box/index.ts
  57474. const _MessageBox = MessageBox;
  57475. _MessageBox.install = (app) => {
  57476. _MessageBox._context = app._context;
  57477. app.config.globalProperties.$msgbox = _MessageBox;
  57478. app.config.globalProperties.$messageBox = _MessageBox;
  57479. app.config.globalProperties.$alert = _MessageBox.alert;
  57480. app.config.globalProperties.$confirm = _MessageBox.confirm;
  57481. app.config.globalProperties.$prompt = _MessageBox.prompt;
  57482. };
  57483. const ElMessageBox = _MessageBox;
  57484. //#endregion
  57485. //#region ../../packages/components/notification/src/notification.ts
  57486. const notificationTypes = [
  57487. "primary",
  57488. "success",
  57489. "info",
  57490. "warning",
  57491. "error"
  57492. ];
  57493. /**
  57494. * @deprecated Removed after 3.0.0, Use `NotificationProps` instead.
  57495. */
  57496. const notificationProps = buildProps({
  57497. customClass: {
  57498. type: String,
  57499. default: ""
  57500. },
  57501. dangerouslyUseHTMLString: Boolean,
  57502. duration: {
  57503. type: Number,
  57504. default: 4500
  57505. },
  57506. icon: { type: iconPropType },
  57507. id: {
  57508. type: String,
  57509. default: ""
  57510. },
  57511. message: {
  57512. type: definePropType([
  57513. String,
  57514. Object,
  57515. Function
  57516. ]),
  57517. default: ""
  57518. },
  57519. offset: {
  57520. type: Number,
  57521. default: 0
  57522. },
  57523. onClick: {
  57524. type: definePropType(Function),
  57525. default: () => void 0
  57526. },
  57527. onClose: {
  57528. type: definePropType(Function),
  57529. required: true
  57530. },
  57531. position: {
  57532. type: String,
  57533. values: [
  57534. "top-right",
  57535. "top-left",
  57536. "bottom-right",
  57537. "bottom-left"
  57538. ],
  57539. default: "top-right"
  57540. },
  57541. showClose: {
  57542. type: Boolean,
  57543. default: true
  57544. },
  57545. title: {
  57546. type: String,
  57547. default: ""
  57548. },
  57549. type: {
  57550. type: String,
  57551. values: [...notificationTypes, ""],
  57552. default: ""
  57553. },
  57554. zIndex: Number,
  57555. closeIcon: {
  57556. type: iconPropType,
  57557. default: close_default
  57558. }
  57559. });
  57560. const notificationEmits = { destroy: () => true };
  57561. //#endregion
  57562. //#region ../../packages/components/notification/src/notification.vue?vue&type=script&setup=true&lang.ts
  57563. const _hoisted_1 = ["id"];
  57564. const _hoisted_2 = ["textContent"];
  57565. const _hoisted_3 = { key: 0 };
  57566. const _hoisted_4 = ["innerHTML"];
  57567. var notification_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  57568. name: "ElNotification",
  57569. __name: "notification",
  57570. props: notificationProps,
  57571. emits: notificationEmits,
  57572. setup(__props, { expose: __expose }) {
  57573. const props = __props;
  57574. const { ns, zIndex } = useGlobalComponentSettings("notification");
  57575. const { nextZIndex, currentZIndex } = zIndex;
  57576. const visible = ref(false);
  57577. let timer = void 0;
  57578. const typeClass = computed(() => {
  57579. const type = props.type;
  57580. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  57581. });
  57582. const iconComponent = computed(() => {
  57583. if (!props.type) return props.icon;
  57584. return TypeComponentsMap[props.type] || props.icon;
  57585. });
  57586. const horizontalClass = computed(() => props.position.endsWith("right") ? "right" : "left");
  57587. const verticalProperty = computed(() => props.position.startsWith("top") ? "top" : "bottom");
  57588. const positionStyle = computed(() => {
  57589. return {
  57590. [verticalProperty.value]: `${props.offset}px`,
  57591. zIndex: props.zIndex ?? currentZIndex.value
  57592. };
  57593. });
  57594. function startTimer() {
  57595. if (props.duration > 0) ({stop: timer} = useTimeoutFn(() => {
  57596. if (visible.value) close();
  57597. }, props.duration));
  57598. }
  57599. function clearTimer() {
  57600. timer?.();
  57601. }
  57602. function close() {
  57603. visible.value = false;
  57604. }
  57605. function onKeydown(event) {
  57606. switch (getEventCode(event)) {
  57607. case EVENT_CODE.delete:
  57608. case EVENT_CODE.backspace:
  57609. clearTimer();
  57610. break;
  57611. case EVENT_CODE.esc:
  57612. if (visible.value) close();
  57613. break;
  57614. default:
  57615. startTimer();
  57616. break;
  57617. }
  57618. }
  57619. onMounted(() => {
  57620. startTimer();
  57621. nextZIndex();
  57622. visible.value = true;
  57623. });
  57624. useEventListener(document, "keydown", onKeydown);
  57625. __expose({
  57626. visible,
  57627. close
  57628. });
  57629. return (_ctx, _cache) => {
  57630. return openBlock(), createBlock(Transition, {
  57631. name: unref(ns).b("fade"),
  57632. onBeforeLeave: __props.onClose,
  57633. onAfterLeave: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("destroy")),
  57634. persisted: ""
  57635. }, {
  57636. default: withCtx(() => [withDirectives(createElementVNode("div", {
  57637. id: __props.id,
  57638. class: normalizeClass([
  57639. unref(ns).b(),
  57640. __props.customClass,
  57641. horizontalClass.value
  57642. ]),
  57643. style: normalizeStyle(positionStyle.value),
  57644. role: "alert",
  57645. onMouseenter: clearTimer,
  57646. onMouseleave: startTimer,
  57647. onClick: _cache[0] || (_cache[0] = (...args) => __props.onClick && __props.onClick(...args))
  57648. }, [iconComponent.value ? (openBlock(), createBlock(unref(ElIcon), {
  57649. key: 0,
  57650. class: normalizeClass([unref(ns).e("icon"), typeClass.value])
  57651. }, {
  57652. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(iconComponent.value)))]),
  57653. _: 1
  57654. }, 8, ["class"])) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("group")) }, [
  57655. createElementVNode("h2", {
  57656. class: normalizeClass(unref(ns).e("title")),
  57657. textContent: toDisplayString(__props.title)
  57658. }, null, 10, _hoisted_2),
  57659. withDirectives(createElementVNode("div", {
  57660. class: normalizeClass(unref(ns).e("content")),
  57661. style: normalizeStyle(!!__props.title ? void 0 : { margin: 0 })
  57662. }, [renderSlot(_ctx.$slots, "default", {}, () => [!__props.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(__props.message), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "), createElementVNode("p", { innerHTML: __props.message }, null, 8, _hoisted_4)], 2112))])], 6), [[vShow, __props.message]]),
  57663. __props.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  57664. key: 0,
  57665. class: normalizeClass(unref(ns).e("closeBtn")),
  57666. onClick: withModifiers(close, ["stop"])
  57667. }, {
  57668. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.closeIcon)))]),
  57669. _: 1
  57670. }, 8, ["class"])) : createCommentVNode("v-if", true)
  57671. ], 2)], 46, _hoisted_1), [[vShow, visible.value]])]),
  57672. _: 3
  57673. }, 8, ["name", "onBeforeLeave"]);
  57674. };
  57675. }
  57676. });
  57677. //#endregion
  57678. //#region ../../packages/components/notification/src/notification.vue
  57679. var notification_default = notification_vue_vue_type_script_setup_true_lang_default;
  57680. //#endregion
  57681. //#region ../../packages/components/notification/src/notify.ts
  57682. const notifications = {
  57683. "top-left": [],
  57684. "top-right": [],
  57685. "bottom-left": [],
  57686. "bottom-right": []
  57687. };
  57688. const GAP_SIZE = 16;
  57689. let seed = 1;
  57690. const notify = function(options = {}, context) {
  57691. if (!isClient) return { close: () => void 0 };
  57692. if (isString(options) || isVNode(options)) options = { message: options };
  57693. const position = options.position || "top-right";
  57694. let verticalOffset = options.offset || 0;
  57695. notifications[position].forEach(({ vm }) => {
  57696. verticalOffset += (vm.el?.offsetHeight || 0) + GAP_SIZE;
  57697. });
  57698. verticalOffset += GAP_SIZE;
  57699. const id = `notification_${seed++}`;
  57700. const userOnClose = options.onClose;
  57701. const props = {
  57702. ...options,
  57703. offset: verticalOffset,
  57704. id,
  57705. onClose: () => {
  57706. close(id, position, userOnClose);
  57707. }
  57708. };
  57709. let appendTo = document.body;
  57710. if (isElement$1(options.appendTo)) appendTo = options.appendTo;
  57711. else if (isString(options.appendTo)) appendTo = document.querySelector(options.appendTo);
  57712. if (!isElement$1(appendTo)) {
  57713. /* @__PURE__ */ debugWarn("ElNotification", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  57714. appendTo = document.body;
  57715. }
  57716. const container = document.createElement("div");
  57717. const vm = createVNode(notification_default, props, isFunction$1(props.message) ? props.message : isVNode(props.message) ? () => props.message : null);
  57718. vm.appContext = isUndefined(context) ? notify._context : context;
  57719. vm.props.onDestroy = () => {
  57720. render(null, container);
  57721. };
  57722. render(vm, container);
  57723. notifications[position].push({ vm });
  57724. appendTo.appendChild(container.firstElementChild);
  57725. return { close: () => {
  57726. vm.component.exposed.visible.value = false;
  57727. } };
  57728. };
  57729. notificationTypes.forEach((type) => {
  57730. notify[type] = (options = {}, appContext) => {
  57731. if (isString(options) || isVNode(options)) options = { message: options };
  57732. return notify({
  57733. ...options,
  57734. type
  57735. }, appContext);
  57736. };
  57737. });
  57738. /**
  57739. * This function gets called when user click `x` button or press `esc` or the time reached its limitation.
  57740. * Emitted by transition@before-leave event so that we can fetch the current notification.offsetHeight, if this was called
  57741. * by @after-leave the DOM element will be removed from the page thus we can no longer fetch the offsetHeight.
  57742. * @param {String} id notification id to be closed
  57743. * @param {Position} position the positioning strategy
  57744. * @param {Function} userOnClose the callback called when close passed by user
  57745. */
  57746. function close(id, position, userOnClose) {
  57747. const orientedNotifications = notifications[position];
  57748. const idx = orientedNotifications.findIndex(({ vm }) => vm.component?.props.id === id);
  57749. if (idx === -1) return;
  57750. const { vm } = orientedNotifications[idx];
  57751. if (!vm) return;
  57752. userOnClose?.(vm);
  57753. const removedHeight = vm.el.offsetHeight;
  57754. const verticalPos = position.split("-")[0];
  57755. orientedNotifications.splice(idx, 1);
  57756. const len = orientedNotifications.length;
  57757. if (len < 1) return;
  57758. for (let i = idx; i < len; i++) {
  57759. const { el, component } = orientedNotifications[i].vm;
  57760. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  57761. component.props.offset = pos;
  57762. }
  57763. }
  57764. function closeAll() {
  57765. for (const orientedNotifications of Object.values(notifications)) orientedNotifications.forEach(({ vm }) => {
  57766. vm.component.exposed.visible.value = false;
  57767. });
  57768. }
  57769. function updateOffsets(position = "top-right") {
  57770. let verticalOffset = notifications[position][0]?.vm.component?.props?.offset || 0;
  57771. for (const { vm } of notifications[position]) {
  57772. vm.component.props.offset = verticalOffset;
  57773. verticalOffset += (vm.el?.offsetHeight || 0) + GAP_SIZE;
  57774. }
  57775. }
  57776. notify.closeAll = closeAll;
  57777. notify.updateOffsets = updateOffsets;
  57778. notify._context = null;
  57779. //#endregion
  57780. //#region ../../packages/components/notification/index.ts
  57781. const ElNotification = withInstallFunction(notify, "$notify");
  57782. //#endregion
  57783. //#region ../../packages/element-plus/plugin.ts
  57784. var plugin_default = [
  57785. ElInfiniteScroll,
  57786. ElLoading,
  57787. ElMessage,
  57788. ElMessageBox,
  57789. ElNotification,
  57790. ElPopoverDirective
  57791. ];
  57792. //#endregion
  57793. //#region ../../packages/element-plus/defaults.ts
  57794. var defaults_default = makeInstaller([...component_default, ...plugin_default]);
  57795. //#endregion
  57796. //#region ../../packages/element-plus/index.ts
  57797. const install = defaults_default.install;
  57798. const version = defaults_default.version;
  57799. var element_plus_default = defaults_default;
  57800. //#endregion
  57801. var dayjs = import_dayjs_min.default;
  57802. export { BAR_MAP, BORDER_HORIZONTAL_WIDTH, CAROUSEL_ITEM_NAME, CASCADER_PANEL_INJECTION_KEY, CHANGE_EVENT, ClickOutside, picker_default as CommonPicker, CommonProps, DEFAULT_DIALOG_TRANSITION, DEFAULT_EMPTY_VALUES, DEFAULT_FORMATS_DATE, DEFAULT_FORMATS_DATEPICKER, DEFAULT_FORMATS_TIME, DEFAULT_STEP, DEFAULT_VALUE_ON_CLEAR, DROPDOWN_INJECTION_KEY, DROPDOWN_INSTANCE_INJECTION_KEY, DefaultProps, DynamicSizeGrid, DynamicSizeList, EVENT_CODE, Effect, ElAffix, ElAlert, ElAnchor, ElAnchorLink, ElAside, ElAutoResizer, ElAutocomplete, ElAvatar, ElAvatarGroup, ElBacktop, ElBadge, ElBreadcrumb, ElBreadcrumbItem, ElButton, ElButtonGroup, ElCalendar, ElCard, ElCarousel, ElCarouselItem, ElCascader, ElCascaderPanel, ElCheckTag, ElCheckbox, ElCheckboxButton, ElCheckboxGroup, ElCol, ElCollapse, ElCollapseItem, ElCollapseTransition, ElColorPicker, ElColorPickerPanel, ElConfigProvider, ElContainer, ElCountdown, ElDatePicker, ElDatePickerPanel, ElDescriptions, ElDescriptionsItem, ElDialog, ElDivider, ElDrawer, ElDropdown, ElDropdownItem, ElDropdownMenu, ElEmpty, ElFooter, ElForm, ElFormItem, ElHeader, ElIcon, ElImage, ElImageViewer, ElInfiniteScroll, ElInput, ElInputNumber, ElInputTag, ElLink, ElLoading, vLoading as ElLoadingDirective, vLoading, Loading as ElLoadingService, ElMain, ElMention, ElMenu, ElMenuItem, ElMenuItemGroup, ElMessage, ElMessageBox, ElNotification, ElOption, ElOptionGroup, ElOverlay, ElPageHeader, ElPagination, ElPopconfirm, ElPopover, ElPopoverDirective, ElPopper, arrow_default as ElPopperArrow, content_default as ElPopperContent, trigger_default as ElPopperTrigger, ElProgress, ElRadio, ElRadioButton, ElRadioGroup, ElRate, ElResult, ElRow, ElScrollbar, ElSegmented, ElSelect, ElSelectV2, ElSkeleton, ElSkeletonItem, ElSlider, ElSpace, ElSplitter, ElSplitterPanel, ElStatistic, ElStep, ElSteps, ElSubMenu, ElSwitch, ElTabPane, ElTable, ElTableColumn, ElTableV2, ElTabs, ElTag, ElText, ElTimePicker, ElTimeSelect, ElTimeline, ElTimelineItem, ElTooltip, ElTour, ElTourStep, ElTransfer, ElTree, ElTreeSelect, ElTreeV2, ElUpload, ElWatermark, FIRST_KEYS, FIRST_LAST_KEYS, FORWARD_REF_INJECTION_KEY, FixedSizeGrid, FixedSizeList, GAP, ID_INJECTION_KEY, INPUT_EVENT, INSTALLED_KEY, IconComponentMap, IconMap, LAST_KEYS, LEFT_CHECK_CHANGE_EVENT, MENU_INJECTION_KEY, MESSAGE_DEFAULT_PLACEMENT, MINIMUM_INPUT_WIDTH, Mousewheel, NODE_INSTANCE_INJECTION_KEY, PICKER_BASE_INJECTION_KEY, PICKER_POPPER_OPTIONS_INJECTION_KEY, POPPER_CONTENT_INJECTION_KEY, POPPER_INJECTION_KEY, RIGHT_CHECK_CHANGE_EVENT, ROOT_COMMON_COLOR_INJECTION_KEY, ROOT_COMMON_PICKER_INJECTION_KEY, ROOT_PICKER_INJECTION_KEY, ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, ROOT_TREE_INJECTION_KEY, RowAlign, RowJustify, SCOPE, SIZE_INJECTION_KEY, STEPS_INJECTION_KEY, SUB_MENU_INJECTION_KEY, TIMELINE_INJECTION_KEY, TOOLTIP_INJECTION_KEY, TREE_NODE_MAP_INJECTION_KEY, TableV2, Alignment as TableV2Alignment, FixedDir as TableV2FixedDir, placeholderSign as TableV2Placeholder, SortOrder as TableV2SortOrder, panel_time_pick_default as TimePickPanel, TrapFocus, UPDATE_MODEL_EVENT, WEEK_DAYS, ZINDEX_INJECTION_KEY, affixEmits, affixProps, alertEffects, alertEmits, alertProps, anchorEmits, anchorProps, ariaProps, arrowMiddleware, autoResizerProps, autocompleteEmits, autocompleteProps, avatarEmits, avatarGroupContextKey, avatarGroupProps, avatarProps, backtopEmits, backtopProps, badgeProps, breadcrumbItemProps, breadcrumbKey, breadcrumbProps, buildLocaleContext, buildTimeList, buildTranslator, buttonEmits, buttonGroupContextKey, buttonNativeTypes, buttonProps, buttonTypes, calendarEmits, calendarProps, cardContextKey, cardProps, carouselContextKey, carouselEmits, carouselItemProps, carouselProps, cascaderEmits, cascaderPanelEmits, cascaderPanelProps, cascaderProps, checkTagEmits, checkTagProps, checkboxDefaultProps, checkboxEmits, checkboxGroupContextKey, checkboxGroupEmits, checkboxGroupProps, checkboxProps, checkboxPropsDefaults, colProps, collapseContextKey, collapseEmits, collapseItemProps, collapseProps, colorPickerEmits, colorPickerPanelContextKey, colorPickerPanelEmits, colorPickerPanelProps, colorPickerProps, colorPickerPropsDefaults, columnAlignment, componentSizeMap, componentSizes, configProviderContextKey, configProviderProps, countdownEmits, countdownProps, createModelToggleComposable, dateEquals, datePickTypes, datePickerPanelProps, datePickerProps, dayOrDaysToDate, dayjs, element_plus_default as default, defaultInitialZIndex, defaultNamespace, defaultProps, descriptionItemProps, descriptionProps, dialogContextKey, dialogEmits, dialogInjectionKey, dialogProps, dialogPropsDefaults, dividerProps, drawerEmits, drawerProps, dropdownItemProps, dropdownMenuProps, dropdownProps, elPaginationKey, emitChangeFn, emptyProps, emptyValuesContextKey, extractDateFormat, extractTimeFormat, formContextKey, formEmits, formItemContextKey, formItemProps, formItemValidateStates, formMetaProps, formProps, formatter, genFileId, getPositionDataWithUnit, iconProps, imageEmits, imageProps, imageViewerEmits, imageViewerProps, inputEmits, inputNumberEmits, inputNumberProps, inputProps, inputPropsDefaults, inputTagEmits, inputTagProps, install, linkEmits, linkProps, localeContextKey, makeInstaller, makeList, mentionDefaultProps, mentionEmits, mentionProps, menuEmits, menuItemEmits, menuItemGroupProps, menuItemProps, menuProps, messageConfig, messageDefaults, messageEmits, messagePlacement, messageProps, messageTypes, namespaceContextKey, notificationEmits, notificationProps, notificationTypes, overlayEmits, overlayProps, pageHeaderEmits, pageHeaderProps, paginationEmits, paginationProps, parseDate, popconfirmEmits, popconfirmProps, popoverEmits, popoverProps, popoverPropsDefaults, popperArrowProps, popperArrowPropsDefaults, popperContentEmits, popperContentProps, popperContentPropsDefaults, popperCoreConfigProps, popperCoreConfigPropsDefaults, popperProps, popperTriggerProps, progressProps, provideGlobalConfig, radioButtonProps, radioButtonPropsDefaults, radioDefaultProps, radioEmits, radioGroupEmits, radioGroupKey, radioGroupProps, radioGroupPropsDefaults, radioProps, radioPropsBase, radioPropsDefaults, rangeArr, rateEmits, rateProps, renderThumbStyle, resultProps, roleTypes, rowContextKey, rowProps, scrollbarContextKey, scrollbarEmits, scrollbarProps, segmentedEmits, segmentedProps, selectEmits, selectGroupKey, selectKey, selectProps, selectV2InjectionKey, skeletonItemProps, skeletonProps, sliderContextKey, sliderEmits, sliderProps, spaceItemProps, spaceProps, splitterEmits, splitterPanelEmits, splitterPanelProps, splitterProps, statisticProps, stepProps, stepsEmits, stepsProps, subMenuProps, switchEmits, switchProps, tabBarProps, tabNavEmits, tabNavProps, tabPaneProps, tableV2Props, tableV2RowProps, tabsEmits, tabsProps, tabsRootContextKey, tagEmits, tagProps, textProps, thumbProps, timePickerDefaultProps, timePickerRangeTriggerProps, timePickerRngeTriggerProps, timeSelectProps, timeUnits, timelineItemProps, timelineProps, tooltipEmits, tourContentEmits, tourContentProps, tourEmits, tourPlacements, tourProps, tourStepEmits, tourStepProps, tourStrategies, transferCheckedChangeFn, transferEmits, transferProps, translate, treeEmits, treeProps, uploadBaseProps, uploadBasePropsDefaults, uploadContentProps, uploadContentPropsDefaults, uploadContextKey, uploadDraggerEmits, uploadDraggerProps, uploadListEmits, uploadListProps, uploadListTypes, uploadProps, uploadPropsDefaults, useAriaProps, useAttrs, useCalcInputWidth, useCascaderConfig, useComposition, useCursor, useDelayedRender, useDelayedToggle, useDelayedToggleProps, useDelayedTogglePropsDefaults, useDeprecated, useDialog, useDisabled, useDraggable, useEmptyValues, useEmptyValuesProps, useEscapeKeydown, useFloating, useFloatingProps, useFocus, useFocusController, useFormDisabled, useFormItem, useFormItemInputId, useFormSize, useForwardRef, useForwardRefDirective, useGetDerivedNamespace, useGlobalComponentSettings, useGlobalConfig, useGlobalSize, useId, useIdInjection, useLocale, useLockscreen, useModal, useModelToggle, useModelToggleEmits, useModelToggleProps, useNamespace, useOrderedChildren, usePopper, usePopperArrowProps, usePopperContainer, usePopperContainerId, usePopperContentEmits, usePopperContentProps, usePopperCoreConfigProps, usePopperProps, usePopperTriggerProps, usePreventGlobal, useProp, useSameTarget, useSize, useSizeProp, useSizeProps, useSpace, useTeleport, useThrottleRender, useTimeout, useTooltipContentProps, useTooltipContentPropsDefaults, useTooltipModelToggle, useTooltipModelToggleEmits, useTooltipModelToggleProps, useTooltipProps, useTooltipTriggerProps, useTooltipTriggerPropsDefaults, useTransitionFallthrough, useTransitionFallthroughEmits, useZIndex, vRepeatClick, valueEquals, version, virtualizedGridProps, virtualizedListProps, virtualizedProps, virtualizedScrollbarProps, watermarkProps, zIndexContextKey };