index.full.mjs 2.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754
  1. /*! Element Plus v2.11.7 */
  2. import { unref, readonly, shallowRef, watchEffect, getCurrentScope, onScopeDispose, computed, isRef, reactive, getCurrentInstance, onMounted, nextTick, ref, watch, defineComponent, openBlock, createElementBlock, createElementVNode, warn, isVNode, Fragment, Comment, onBeforeUnmount, inject, onUnmounted, h as h$1, Teleport as Teleport$1, onBeforeMount, provide, triggerRef, renderSlot, normalizeClass, normalizeStyle, mergeProps, useSlots, toRef, createBlock, Transition, withCtx, withDirectives, resolveDynamicComponent, createCommentVNode, createTextVNode, toDisplayString, createVNode, vShow, toRefs, onUpdated, TransitionGroup, useAttrs as useAttrs$1, withModifiers, onActivated, cloneVNode, Text as Text$1, onDeactivated, renderList, createSlots, normalizeProps, guardReactiveProps, toRaw, vModelCheckbox, vModelRadio, onBeforeUpdate, withKeys, vModelText, toHandlers, resolveComponent, markRaw, effectScope, resolveDirective, toHandlerKey, render, createApp, shallowReactive } from 'vue';
  3. 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])`;
  4. const isHTMLElement$2 = (e) => {
  5. if (typeof Element === "undefined")
  6. return false;
  7. return e instanceof Element;
  8. };
  9. const isVisible = (element) => {
  10. const computed = getComputedStyle(element);
  11. return computed.position === "fixed" ? false : element.offsetParent !== null;
  12. };
  13. const obtainAllFocusableElements$1 = (element) => {
  14. return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item));
  15. };
  16. const isFocusable = (element) => {
  17. if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
  18. return true;
  19. }
  20. if (element.tabIndex < 0 || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true") {
  21. return false;
  22. }
  23. switch (element.nodeName) {
  24. case "A": {
  25. return !!element.href && element.rel !== "ignore";
  26. }
  27. case "INPUT": {
  28. return !(element.type === "hidden" || element.type === "file");
  29. }
  30. case "BUTTON":
  31. case "SELECT":
  32. case "TEXTAREA": {
  33. return true;
  34. }
  35. default: {
  36. return false;
  37. }
  38. }
  39. };
  40. const triggerEvent = function(elm, name, ...opts) {
  41. let eventName;
  42. if (name.includes("mouse") || name.includes("click")) {
  43. eventName = "MouseEvents";
  44. } else if (name.includes("key")) {
  45. eventName = "KeyboardEvent";
  46. } else {
  47. eventName = "HTMLEvents";
  48. }
  49. const evt = document.createEvent(eventName);
  50. evt.initEvent(name, ...opts);
  51. elm.dispatchEvent(evt);
  52. return elm;
  53. };
  54. const isLeaf = (el) => !el.getAttribute("aria-owns");
  55. const getSibling = (el, distance, elClass) => {
  56. const { parentNode } = el;
  57. if (!parentNode)
  58. return null;
  59. const siblings = parentNode.querySelectorAll(elClass);
  60. const index = Array.prototype.indexOf.call(siblings, el);
  61. return siblings[index + distance] || null;
  62. };
  63. const focusElement = (el, options) => {
  64. if (!el || !el.focus)
  65. return;
  66. let cleanup = false;
  67. if (isHTMLElement$2(el) && !isFocusable(el) && !el.getAttribute("tabindex")) {
  68. el.setAttribute("tabindex", "-1");
  69. cleanup = true;
  70. }
  71. el.focus(options);
  72. if (isHTMLElement$2(el) && cleanup) {
  73. el.removeAttribute("tabindex");
  74. }
  75. };
  76. const focusNode = (el) => {
  77. if (!el)
  78. return;
  79. focusElement(el);
  80. !isLeaf(el) && el.click();
  81. };
  82. const EVENT_CODE = {
  83. tab: "Tab",
  84. enter: "Enter",
  85. space: "Space",
  86. left: "ArrowLeft",
  87. up: "ArrowUp",
  88. right: "ArrowRight",
  89. down: "ArrowDown",
  90. esc: "Escape",
  91. delete: "Delete",
  92. backspace: "Backspace",
  93. numpadEnter: "NumpadEnter",
  94. pageUp: "PageUp",
  95. pageDown: "PageDown",
  96. home: "Home",
  97. end: "End"
  98. };
  99. const datePickTypes = [
  100. "year",
  101. "years",
  102. "month",
  103. "months",
  104. "date",
  105. "dates",
  106. "week",
  107. "datetime",
  108. "datetimerange",
  109. "daterange",
  110. "monthrange",
  111. "yearrange"
  112. ];
  113. const WEEK_DAYS = [
  114. "sun",
  115. "mon",
  116. "tue",
  117. "wed",
  118. "thu",
  119. "fri",
  120. "sat"
  121. ];
  122. const UPDATE_MODEL_EVENT = "update:modelValue";
  123. const CHANGE_EVENT = "change";
  124. const INPUT_EVENT = "input";
  125. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  126. const componentSizes = ["", "default", "small", "large"];
  127. const componentSizeMap = {
  128. large: 40,
  129. default: 32,
  130. small: 24
  131. };
  132. const columnAlignment = ["left", "center", "right"];
  133. const MINIMUM_INPUT_WIDTH = 11;
  134. const BORDER_HORIZONTAL_WIDTH = 2;
  135. function computedEager(fn, options) {
  136. var _a;
  137. const result = shallowRef();
  138. watchEffect(() => {
  139. result.value = fn();
  140. }, {
  141. ...options,
  142. flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
  143. });
  144. return readonly(result);
  145. }
  146. function tryOnScopeDispose(fn) {
  147. if (getCurrentScope()) {
  148. onScopeDispose(fn);
  149. return true;
  150. }
  151. return false;
  152. }
  153. function toValue(r) {
  154. return typeof r === "function" ? r() : unref(r);
  155. }
  156. function toReactive(objectRef) {
  157. if (!isRef(objectRef))
  158. return reactive(objectRef);
  159. const proxy = new Proxy({}, {
  160. get(_, p, receiver) {
  161. return unref(Reflect.get(objectRef.value, p, receiver));
  162. },
  163. set(_, p, value) {
  164. if (isRef(objectRef.value[p]) && !isRef(value))
  165. objectRef.value[p].value = value;
  166. else
  167. objectRef.value[p] = value;
  168. return true;
  169. },
  170. deleteProperty(_, p) {
  171. return Reflect.deleteProperty(objectRef.value, p);
  172. },
  173. has(_, p) {
  174. return Reflect.has(objectRef.value, p);
  175. },
  176. ownKeys() {
  177. return Object.keys(objectRef.value);
  178. },
  179. getOwnPropertyDescriptor() {
  180. return {
  181. enumerable: true,
  182. configurable: true
  183. };
  184. }
  185. });
  186. return reactive(proxy);
  187. }
  188. function reactiveComputed(fn) {
  189. return toReactive(computed(fn));
  190. }
  191. const isClient = typeof window !== "undefined" && typeof document !== "undefined";
  192. typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
  193. const isDef = (val) => typeof val !== "undefined";
  194. const notNullish = (val) => val != null;
  195. const toString$1 = Object.prototype.toString;
  196. const isObject$2 = (val) => toString$1.call(val) === "[object Object]";
  197. const clamp$2 = (n, min, max) => Math.min(max, Math.max(min, n));
  198. const noop$1 = () => {
  199. };
  200. const isIOS = /* @__PURE__ */ getIsIOS();
  201. function getIsIOS() {
  202. var _a, _b;
  203. 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));
  204. }
  205. function createFilterWrapper(filter, fn) {
  206. function wrapper(...args) {
  207. return new Promise((resolve, reject) => {
  208. Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);
  209. });
  210. }
  211. return wrapper;
  212. }
  213. function debounceFilter(ms, options = {}) {
  214. let timer;
  215. let maxTimer;
  216. let lastRejector = noop$1;
  217. const _clearTimeout = (timer2) => {
  218. clearTimeout(timer2);
  219. lastRejector();
  220. lastRejector = noop$1;
  221. };
  222. const filter = (invoke) => {
  223. const duration = toValue(ms);
  224. const maxDuration = toValue(options.maxWait);
  225. if (timer)
  226. _clearTimeout(timer);
  227. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  228. if (maxTimer) {
  229. _clearTimeout(maxTimer);
  230. maxTimer = null;
  231. }
  232. return Promise.resolve(invoke());
  233. }
  234. return new Promise((resolve, reject) => {
  235. lastRejector = options.rejectOnCancel ? reject : resolve;
  236. if (maxDuration && !maxTimer) {
  237. maxTimer = setTimeout(() => {
  238. if (timer)
  239. _clearTimeout(timer);
  240. maxTimer = null;
  241. resolve(invoke());
  242. }, maxDuration);
  243. }
  244. timer = setTimeout(() => {
  245. if (maxTimer)
  246. _clearTimeout(maxTimer);
  247. maxTimer = null;
  248. resolve(invoke());
  249. }, duration);
  250. });
  251. };
  252. return filter;
  253. }
  254. function throttleFilter(...args) {
  255. let lastExec = 0;
  256. let timer;
  257. let isLeading = true;
  258. let lastRejector = noop$1;
  259. let lastValue;
  260. let ms;
  261. let trailing;
  262. let leading;
  263. let rejectOnCancel;
  264. if (!isRef(args[0]) && typeof args[0] === "object")
  265. ({ delay: ms, trailing = true, leading = true, rejectOnCancel = false } = args[0]);
  266. else
  267. [ms, trailing = true, leading = true, rejectOnCancel = false] = args;
  268. const clear = () => {
  269. if (timer) {
  270. clearTimeout(timer);
  271. timer = void 0;
  272. lastRejector();
  273. lastRejector = noop$1;
  274. }
  275. };
  276. const filter = (_invoke) => {
  277. const duration = toValue(ms);
  278. const elapsed = Date.now() - lastExec;
  279. const invoke = () => {
  280. return lastValue = _invoke();
  281. };
  282. clear();
  283. if (duration <= 0) {
  284. lastExec = Date.now();
  285. return invoke();
  286. }
  287. if (elapsed > duration && (leading || !isLeading)) {
  288. lastExec = Date.now();
  289. invoke();
  290. } else if (trailing) {
  291. lastValue = new Promise((resolve, reject) => {
  292. lastRejector = rejectOnCancel ? reject : resolve;
  293. timer = setTimeout(() => {
  294. lastExec = Date.now();
  295. isLeading = true;
  296. resolve(invoke());
  297. clear();
  298. }, Math.max(0, duration - elapsed));
  299. });
  300. }
  301. if (!leading && !timer)
  302. timer = setTimeout(() => isLeading = true, duration);
  303. isLeading = false;
  304. return lastValue;
  305. };
  306. return filter;
  307. }
  308. function getLifeCycleTarget(target) {
  309. return target || getCurrentInstance();
  310. }
  311. function useDebounceFn(fn, ms = 200, options = {}) {
  312. return createFilterWrapper(
  313. debounceFilter(ms, options),
  314. fn
  315. );
  316. }
  317. function refDebounced(value, ms = 200, options = {}) {
  318. const debounced = ref(value.value);
  319. const updater = useDebounceFn(() => {
  320. debounced.value = value.value;
  321. }, ms, options);
  322. watch(value, () => updater());
  323. return debounced;
  324. }
  325. function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {
  326. return createFilterWrapper(
  327. throttleFilter(ms, trailing, leading, rejectOnCancel),
  328. fn
  329. );
  330. }
  331. function tryOnMounted(fn, sync = true, target) {
  332. const instance = getLifeCycleTarget();
  333. if (instance)
  334. onMounted(fn, target);
  335. else if (sync)
  336. fn();
  337. else
  338. nextTick(fn);
  339. }
  340. function useTimeoutFn(cb, interval, options = {}) {
  341. const {
  342. immediate = true
  343. } = options;
  344. const isPending = ref(false);
  345. let timer = null;
  346. function clear() {
  347. if (timer) {
  348. clearTimeout(timer);
  349. timer = null;
  350. }
  351. }
  352. function stop() {
  353. isPending.value = false;
  354. clear();
  355. }
  356. function start(...args) {
  357. clear();
  358. isPending.value = true;
  359. timer = setTimeout(() => {
  360. isPending.value = false;
  361. timer = null;
  362. cb(...args);
  363. }, toValue(interval));
  364. }
  365. if (immediate) {
  366. isPending.value = true;
  367. if (isClient)
  368. start();
  369. }
  370. tryOnScopeDispose(stop);
  371. return {
  372. isPending: readonly(isPending),
  373. start,
  374. stop
  375. };
  376. }
  377. function unrefElement(elRef) {
  378. var _a;
  379. const plain = toValue(elRef);
  380. return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
  381. }
  382. const defaultWindow = isClient ? window : void 0;
  383. const defaultDocument = isClient ? window.document : void 0;
  384. function useEventListener(...args) {
  385. let target;
  386. let events;
  387. let listeners;
  388. let options;
  389. if (typeof args[0] === "string" || Array.isArray(args[0])) {
  390. [events, listeners, options] = args;
  391. target = defaultWindow;
  392. } else {
  393. [target, events, listeners, options] = args;
  394. }
  395. if (!target)
  396. return noop$1;
  397. if (!Array.isArray(events))
  398. events = [events];
  399. if (!Array.isArray(listeners))
  400. listeners = [listeners];
  401. const cleanups = [];
  402. const cleanup = () => {
  403. cleanups.forEach((fn) => fn());
  404. cleanups.length = 0;
  405. };
  406. const register = (el, event, listener, options2) => {
  407. el.addEventListener(event, listener, options2);
  408. return () => el.removeEventListener(event, listener, options2);
  409. };
  410. const stopWatch = watch(
  411. () => [unrefElement(target), toValue(options)],
  412. ([el, options2]) => {
  413. cleanup();
  414. if (!el)
  415. return;
  416. const optionsClone = isObject$2(options2) ? { ...options2 } : options2;
  417. cleanups.push(
  418. ...events.flatMap((event) => {
  419. return listeners.map((listener) => register(el, event, listener, optionsClone));
  420. })
  421. );
  422. },
  423. { immediate: true, flush: "post" }
  424. );
  425. const stop = () => {
  426. stopWatch();
  427. cleanup();
  428. };
  429. tryOnScopeDispose(stop);
  430. return stop;
  431. }
  432. let _iOSWorkaround = false;
  433. function onClickOutside(target, handler, options = {}) {
  434. const { window = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;
  435. if (!window)
  436. return noop$1;
  437. if (isIOS && !_iOSWorkaround) {
  438. _iOSWorkaround = true;
  439. Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", noop$1));
  440. window.document.documentElement.addEventListener("click", noop$1);
  441. }
  442. let shouldListen = true;
  443. const shouldIgnore = (event) => {
  444. return ignore.some((target2) => {
  445. if (typeof target2 === "string") {
  446. return Array.from(window.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el));
  447. } else {
  448. const el = unrefElement(target2);
  449. return el && (event.target === el || event.composedPath().includes(el));
  450. }
  451. });
  452. };
  453. const listener = (event) => {
  454. const el = unrefElement(target);
  455. if (!el || el === event.target || event.composedPath().includes(el))
  456. return;
  457. if (event.detail === 0)
  458. shouldListen = !shouldIgnore(event);
  459. if (!shouldListen) {
  460. shouldListen = true;
  461. return;
  462. }
  463. handler(event);
  464. };
  465. const cleanup = [
  466. useEventListener(window, "click", listener, { passive: true, capture }),
  467. useEventListener(window, "pointerdown", (e) => {
  468. const el = unrefElement(target);
  469. shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));
  470. }, { passive: true }),
  471. detectIframe && useEventListener(window, "blur", (event) => {
  472. setTimeout(() => {
  473. var _a;
  474. const el = unrefElement(target);
  475. if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement))) {
  476. handler(event);
  477. }
  478. }, 0);
  479. })
  480. ].filter(Boolean);
  481. const stop = () => cleanup.forEach((fn) => fn());
  482. return stop;
  483. }
  484. function useMounted() {
  485. const isMounted = ref(false);
  486. const instance = getCurrentInstance();
  487. if (instance) {
  488. onMounted(() => {
  489. isMounted.value = true;
  490. }, instance);
  491. }
  492. return isMounted;
  493. }
  494. function useSupported(callback) {
  495. const isMounted = useMounted();
  496. return computed(() => {
  497. isMounted.value;
  498. return Boolean(callback());
  499. });
  500. }
  501. function useMutationObserver(target, callback, options = {}) {
  502. const { window = defaultWindow, ...mutationOptions } = options;
  503. let observer;
  504. const isSupported = useSupported(() => window && "MutationObserver" in window);
  505. const cleanup = () => {
  506. if (observer) {
  507. observer.disconnect();
  508. observer = void 0;
  509. }
  510. };
  511. const targets = computed(() => {
  512. const value = toValue(target);
  513. const items = (Array.isArray(value) ? value : [value]).map(unrefElement).filter(notNullish);
  514. return new Set(items);
  515. });
  516. const stopWatch = watch(
  517. () => targets.value,
  518. (targets2) => {
  519. cleanup();
  520. if (isSupported.value && targets2.size) {
  521. observer = new MutationObserver(callback);
  522. targets2.forEach((el) => observer.observe(el, mutationOptions));
  523. }
  524. },
  525. { immediate: true, flush: "post" }
  526. );
  527. const takeRecords = () => {
  528. return observer == null ? void 0 : observer.takeRecords();
  529. };
  530. const stop = () => {
  531. cleanup();
  532. stopWatch();
  533. };
  534. tryOnScopeDispose(stop);
  535. return {
  536. isSupported,
  537. stop,
  538. takeRecords
  539. };
  540. }
  541. function useActiveElement(options = {}) {
  542. var _a;
  543. const {
  544. window = defaultWindow,
  545. deep = true,
  546. triggerOnRemoval = false
  547. } = options;
  548. const document = (_a = options.document) != null ? _a : window == null ? void 0 : window.document;
  549. const getDeepActiveElement = () => {
  550. var _a2;
  551. let element = document == null ? void 0 : document.activeElement;
  552. if (deep) {
  553. while (element == null ? void 0 : element.shadowRoot)
  554. element = (_a2 = element == null ? void 0 : element.shadowRoot) == null ? void 0 : _a2.activeElement;
  555. }
  556. return element;
  557. };
  558. const activeElement = ref();
  559. const trigger = () => {
  560. activeElement.value = getDeepActiveElement();
  561. };
  562. if (window) {
  563. useEventListener(window, "blur", (event) => {
  564. if (event.relatedTarget !== null)
  565. return;
  566. trigger();
  567. }, true);
  568. useEventListener(window, "focus", trigger, true);
  569. }
  570. if (triggerOnRemoval) {
  571. useMutationObserver(document, (mutations) => {
  572. mutations.filter((m) => m.removedNodes.length).map((n) => Array.from(n.removedNodes)).flat().forEach((node) => {
  573. if (node === activeElement.value)
  574. trigger();
  575. });
  576. }, {
  577. childList: true,
  578. subtree: true
  579. });
  580. }
  581. trigger();
  582. return activeElement;
  583. }
  584. function useMediaQuery(query, options = {}) {
  585. const { window = defaultWindow } = options;
  586. const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
  587. let mediaQuery;
  588. const matches = ref(false);
  589. const handler = (event) => {
  590. matches.value = event.matches;
  591. };
  592. const cleanup = () => {
  593. if (!mediaQuery)
  594. return;
  595. if ("removeEventListener" in mediaQuery)
  596. mediaQuery.removeEventListener("change", handler);
  597. else
  598. mediaQuery.removeListener(handler);
  599. };
  600. const stopWatch = watchEffect(() => {
  601. if (!isSupported.value)
  602. return;
  603. cleanup();
  604. mediaQuery = window.matchMedia(toValue(query));
  605. if ("addEventListener" in mediaQuery)
  606. mediaQuery.addEventListener("change", handler);
  607. else
  608. mediaQuery.addListener(handler);
  609. matches.value = mediaQuery.matches;
  610. });
  611. tryOnScopeDispose(() => {
  612. stopWatch();
  613. cleanup();
  614. mediaQuery = void 0;
  615. });
  616. return matches;
  617. }
  618. function cloneFnJSON(source) {
  619. return JSON.parse(JSON.stringify(source));
  620. }
  621. function useCssVar(prop, target, options = {}) {
  622. const { window = defaultWindow, initialValue = "", observe = false } = options;
  623. const variable = ref(initialValue);
  624. const elRef = computed(() => {
  625. var _a;
  626. return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
  627. });
  628. function updateCssVar() {
  629. var _a;
  630. const key = toValue(prop);
  631. const el = toValue(elRef);
  632. if (el && window) {
  633. const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
  634. variable.value = value || initialValue;
  635. }
  636. }
  637. if (observe) {
  638. useMutationObserver(elRef, updateCssVar, {
  639. attributeFilter: ["style", "class"],
  640. window
  641. });
  642. }
  643. watch(
  644. [elRef, () => toValue(prop)],
  645. updateCssVar,
  646. { immediate: true }
  647. );
  648. watch(
  649. variable,
  650. (val) => {
  651. var _a;
  652. if ((_a = elRef.value) == null ? void 0 : _a.style)
  653. elRef.value.style.setProperty(toValue(prop), val);
  654. }
  655. );
  656. return variable;
  657. }
  658. function useDocumentVisibility(options = {}) {
  659. const { document = defaultDocument } = options;
  660. if (!document)
  661. return ref("visible");
  662. const visibility = ref(document.visibilityState);
  663. useEventListener(document, "visibilitychange", () => {
  664. visibility.value = document.visibilityState;
  665. });
  666. return visibility;
  667. }
  668. function useResizeObserver(target, callback, options = {}) {
  669. const { window = defaultWindow, ...observerOptions } = options;
  670. let observer;
  671. const isSupported = useSupported(() => window && "ResizeObserver" in window);
  672. const cleanup = () => {
  673. if (observer) {
  674. observer.disconnect();
  675. observer = void 0;
  676. }
  677. };
  678. const targets = computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
  679. const stopWatch = watch(
  680. targets,
  681. (els) => {
  682. cleanup();
  683. if (isSupported.value && window) {
  684. observer = new ResizeObserver(callback);
  685. for (const _el of els)
  686. _el && observer.observe(_el, observerOptions);
  687. }
  688. },
  689. { immediate: true, flush: "post" }
  690. );
  691. const stop = () => {
  692. cleanup();
  693. stopWatch();
  694. };
  695. tryOnScopeDispose(stop);
  696. return {
  697. isSupported,
  698. stop
  699. };
  700. }
  701. function useElementBounding(target, options = {}) {
  702. const {
  703. reset = true,
  704. windowResize = true,
  705. windowScroll = true,
  706. immediate = true
  707. } = options;
  708. const height = ref(0);
  709. const bottom = ref(0);
  710. const left = ref(0);
  711. const right = ref(0);
  712. const top = ref(0);
  713. const width = ref(0);
  714. const x = ref(0);
  715. const y = ref(0);
  716. function update() {
  717. const el = unrefElement(target);
  718. if (!el) {
  719. if (reset) {
  720. height.value = 0;
  721. bottom.value = 0;
  722. left.value = 0;
  723. right.value = 0;
  724. top.value = 0;
  725. width.value = 0;
  726. x.value = 0;
  727. y.value = 0;
  728. }
  729. return;
  730. }
  731. const rect = el.getBoundingClientRect();
  732. height.value = rect.height;
  733. bottom.value = rect.bottom;
  734. left.value = rect.left;
  735. right.value = rect.right;
  736. top.value = rect.top;
  737. width.value = rect.width;
  738. x.value = rect.x;
  739. y.value = rect.y;
  740. }
  741. useResizeObserver(target, update);
  742. watch(() => unrefElement(target), (ele) => !ele && update());
  743. useMutationObserver(target, update, {
  744. attributeFilter: ["style", "class"]
  745. });
  746. if (windowScroll)
  747. useEventListener("scroll", update, { capture: true, passive: true });
  748. if (windowResize)
  749. useEventListener("resize", update, { passive: true });
  750. tryOnMounted(() => {
  751. if (immediate)
  752. update();
  753. });
  754. return {
  755. height,
  756. bottom,
  757. left,
  758. right,
  759. top,
  760. width,
  761. x,
  762. y,
  763. update
  764. };
  765. }
  766. function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
  767. const { window = defaultWindow, box = "content-box" } = options;
  768. const isSVG = computed(() => {
  769. var _a, _b;
  770. return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
  771. });
  772. const width = ref(initialSize.width);
  773. const height = ref(initialSize.height);
  774. const { stop: stop1 } = useResizeObserver(
  775. target,
  776. ([entry]) => {
  777. const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
  778. if (window && isSVG.value) {
  779. const $elem = unrefElement(target);
  780. if ($elem) {
  781. const rect = $elem.getBoundingClientRect();
  782. width.value = rect.width;
  783. height.value = rect.height;
  784. }
  785. } else {
  786. if (boxSize) {
  787. const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
  788. width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
  789. height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
  790. } else {
  791. width.value = entry.contentRect.width;
  792. height.value = entry.contentRect.height;
  793. }
  794. }
  795. },
  796. options
  797. );
  798. tryOnMounted(() => {
  799. const ele = unrefElement(target);
  800. if (ele) {
  801. width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
  802. height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
  803. }
  804. });
  805. const stop2 = watch(
  806. () => unrefElement(target),
  807. (ele) => {
  808. width.value = ele ? initialSize.width : 0;
  809. height.value = ele ? initialSize.height : 0;
  810. }
  811. );
  812. function stop() {
  813. stop1();
  814. stop2();
  815. }
  816. return {
  817. width,
  818. height,
  819. stop
  820. };
  821. }
  822. function useIntersectionObserver(target, callback, options = {}) {
  823. const {
  824. root,
  825. rootMargin = "0px",
  826. threshold = 0.1,
  827. window = defaultWindow,
  828. immediate = true
  829. } = options;
  830. const isSupported = useSupported(() => window && "IntersectionObserver" in window);
  831. const targets = computed(() => {
  832. const _target = toValue(target);
  833. return (Array.isArray(_target) ? _target : [_target]).map(unrefElement).filter(notNullish);
  834. });
  835. let cleanup = noop$1;
  836. const isActive = ref(immediate);
  837. const stopWatch = isSupported.value ? watch(
  838. () => [targets.value, unrefElement(root), isActive.value],
  839. ([targets2, root2]) => {
  840. cleanup();
  841. if (!isActive.value)
  842. return;
  843. if (!targets2.length)
  844. return;
  845. const observer = new IntersectionObserver(
  846. callback,
  847. {
  848. root: unrefElement(root2),
  849. rootMargin,
  850. threshold
  851. }
  852. );
  853. targets2.forEach((el) => el && observer.observe(el));
  854. cleanup = () => {
  855. observer.disconnect();
  856. cleanup = noop$1;
  857. };
  858. },
  859. { immediate, flush: "post" }
  860. ) : noop$1;
  861. const stop = () => {
  862. cleanup();
  863. stopWatch();
  864. isActive.value = false;
  865. };
  866. tryOnScopeDispose(stop);
  867. return {
  868. isSupported,
  869. isActive,
  870. pause() {
  871. cleanup();
  872. isActive.value = false;
  873. },
  874. resume() {
  875. isActive.value = true;
  876. },
  877. stop
  878. };
  879. }
  880. function useVModel(props, key, emit, options = {}) {
  881. var _a, _b, _c;
  882. const {
  883. clone = false,
  884. passive = false,
  885. eventName,
  886. deep = false,
  887. defaultValue,
  888. shouldEmit
  889. } = options;
  890. const vm = getCurrentInstance();
  891. 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));
  892. let event = eventName;
  893. if (!key) {
  894. {
  895. key = "modelValue";
  896. }
  897. }
  898. event = event || `update:${key.toString()}`;
  899. const cloneFn = (val) => !clone ? val : typeof clone === "function" ? clone(val) : cloneFnJSON(val);
  900. const getValue = () => isDef(props[key]) ? cloneFn(props[key]) : defaultValue;
  901. const triggerEmit = (value) => {
  902. if (shouldEmit) {
  903. if (shouldEmit(value))
  904. _emit(event, value);
  905. } else {
  906. _emit(event, value);
  907. }
  908. };
  909. if (passive) {
  910. const initialValue = getValue();
  911. const proxy = ref(initialValue);
  912. let isUpdating = false;
  913. watch(
  914. () => props[key],
  915. (v) => {
  916. if (!isUpdating) {
  917. isUpdating = true;
  918. proxy.value = cloneFn(v);
  919. nextTick(() => isUpdating = false);
  920. }
  921. }
  922. );
  923. watch(
  924. proxy,
  925. (v) => {
  926. if (!isUpdating && (v !== props[key] || deep))
  927. triggerEmit(v);
  928. },
  929. { deep }
  930. );
  931. return proxy;
  932. } else {
  933. return computed({
  934. get() {
  935. return getValue();
  936. },
  937. set(value) {
  938. triggerEmit(value);
  939. }
  940. });
  941. }
  942. }
  943. function useWindowFocus(options = {}) {
  944. const { window = defaultWindow } = options;
  945. if (!window)
  946. return ref(false);
  947. const focused = ref(window.document.hasFocus());
  948. useEventListener(window, "blur", () => {
  949. focused.value = false;
  950. });
  951. useEventListener(window, "focus", () => {
  952. focused.value = true;
  953. });
  954. return focused;
  955. }
  956. function useWindowSize(options = {}) {
  957. const {
  958. window = defaultWindow,
  959. initialWidth = Number.POSITIVE_INFINITY,
  960. initialHeight = Number.POSITIVE_INFINITY,
  961. listenOrientation = true,
  962. includeScrollbar = true
  963. } = options;
  964. const width = ref(initialWidth);
  965. const height = ref(initialHeight);
  966. const update = () => {
  967. if (window) {
  968. if (includeScrollbar) {
  969. width.value = window.innerWidth;
  970. height.value = window.innerHeight;
  971. } else {
  972. width.value = window.document.documentElement.clientWidth;
  973. height.value = window.document.documentElement.clientHeight;
  974. }
  975. }
  976. };
  977. update();
  978. tryOnMounted(update);
  979. useEventListener("resize", update, { passive: true });
  980. if (listenOrientation) {
  981. const matches = useMediaQuery("(orientation: portrait)");
  982. watch(matches, () => update());
  983. }
  984. return { width, height };
  985. }
  986. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  987. const isAndroid = () => isClient && /android/i.test(window.navigator.userAgent);
  988. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  989. const handleEvent = (event) => {
  990. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  991. if (checkForDefaultPrevented === false || !shouldPrevent) {
  992. return oursHandler == null ? void 0 : oursHandler(event);
  993. }
  994. };
  995. return handleEvent;
  996. };
  997. const whenMouse = (handler) => {
  998. return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
  999. };
  1000. const getEventCode = (event) => {
  1001. if (event.code && event.code !== "Unidentified")
  1002. return event.code;
  1003. const key = getEventKey(event);
  1004. if (key) {
  1005. if (Object.values(EVENT_CODE).includes(key))
  1006. return key;
  1007. switch (key) {
  1008. case " ":
  1009. return EVENT_CODE.space;
  1010. default:
  1011. return "";
  1012. }
  1013. }
  1014. return "";
  1015. };
  1016. const getEventKey = (event) => {
  1017. let key = event.key && event.key !== "Unidentified" ? event.key : "";
  1018. if (!key && event.type === "keyup" && isAndroid()) {
  1019. const target = event.target;
  1020. key = target.value.charAt(target.selectionStart - 1);
  1021. }
  1022. return key;
  1023. };
  1024. const getOffsetTop = (el) => {
  1025. let offset = 0;
  1026. let parent = el;
  1027. while (parent) {
  1028. offset += parent.offsetTop;
  1029. parent = parent.offsetParent;
  1030. }
  1031. return offset;
  1032. };
  1033. const getOffsetTopDistance = (el, containerEl) => {
  1034. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  1035. };
  1036. const getClientXY = (event) => {
  1037. let clientX;
  1038. let clientY;
  1039. if (event.type === "touchend") {
  1040. clientY = event.changedTouches[0].clientY;
  1041. clientX = event.changedTouches[0].clientX;
  1042. } else if (event.type.startsWith("touch")) {
  1043. clientY = event.touches[0].clientY;
  1044. clientX = event.touches[0].clientX;
  1045. } else {
  1046. clientY = event.clientY;
  1047. clientX = event.clientX;
  1048. }
  1049. return {
  1050. clientX,
  1051. clientY
  1052. };
  1053. };
  1054. function easeInOutCubic(t, b, c, d) {
  1055. const cc = c - b;
  1056. t /= d / 2;
  1057. if (t < 1) {
  1058. return cc / 2 * t * t * t + b;
  1059. }
  1060. return cc / 2 * ((t -= 2) * t * t + 2) + b;
  1061. }
  1062. const NOOP = () => {
  1063. };
  1064. const hasOwnProperty$p = Object.prototype.hasOwnProperty;
  1065. const hasOwn = (val, key) => hasOwnProperty$p.call(val, key);
  1066. const isArray$1 = Array.isArray;
  1067. const isDate$1 = (val) => toTypeString(val) === "[object Date]";
  1068. const isFunction$1 = (val) => typeof val === "function";
  1069. const isString$1 = (val) => typeof val === "string";
  1070. const isObject$1 = (val) => val !== null && typeof val === "object";
  1071. const isPromise = (val) => {
  1072. return isObject$1(val) && isFunction$1(val.then) && isFunction$1(val.catch);
  1073. };
  1074. const objectToString$1 = Object.prototype.toString;
  1075. const toTypeString = (value) => objectToString$1.call(value);
  1076. const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
  1077. const cacheStringFunction = (fn) => {
  1078. const cache = /* @__PURE__ */ Object.create(null);
  1079. return (str) => {
  1080. const hit = cache[str];
  1081. return hit || (cache[str] = fn(str));
  1082. };
  1083. };
  1084. const camelizeRE = /-(\w)/g;
  1085. const camelize = cacheStringFunction((str) => {
  1086. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  1087. });
  1088. const hyphenateRE = /\B([A-Z])/g;
  1089. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  1090. const capitalize$2 = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  1091. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  1092. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  1093. var root = freeGlobal || freeSelf || Function("return this")();
  1094. var Symbol$1 = root.Symbol;
  1095. var objectProto$s = Object.prototype;
  1096. var hasOwnProperty$o = objectProto$s.hasOwnProperty;
  1097. var nativeObjectToString$3 = objectProto$s.toString;
  1098. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
  1099. function getRawTag(value) {
  1100. var isOwn = hasOwnProperty$o.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  1101. try {
  1102. value[symToStringTag$1] = void 0;
  1103. var unmasked = true;
  1104. } catch (e) {
  1105. }
  1106. var result = nativeObjectToString$3.call(value);
  1107. if (unmasked) {
  1108. if (isOwn) {
  1109. value[symToStringTag$1] = tag;
  1110. } else {
  1111. delete value[symToStringTag$1];
  1112. }
  1113. }
  1114. return result;
  1115. }
  1116. var objectProto$r = Object.prototype;
  1117. var nativeObjectToString$2 = objectProto$r.toString;
  1118. function objectToString(value) {
  1119. return nativeObjectToString$2.call(value);
  1120. }
  1121. var nullTag = "[object Null]";
  1122. var undefinedTag = "[object Undefined]";
  1123. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
  1124. function baseGetTag(value) {
  1125. if (value == null) {
  1126. return value === void 0 ? undefinedTag : nullTag;
  1127. }
  1128. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  1129. }
  1130. function isObjectLike(value) {
  1131. return value != null && typeof value == "object";
  1132. }
  1133. var symbolTag$3 = "[object Symbol]";
  1134. function isSymbol(value) {
  1135. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  1136. }
  1137. var NAN$2 = 0 / 0;
  1138. function baseToNumber(value) {
  1139. if (typeof value == "number") {
  1140. return value;
  1141. }
  1142. if (isSymbol(value)) {
  1143. return NAN$2;
  1144. }
  1145. return +value;
  1146. }
  1147. function arrayMap(array, iteratee) {
  1148. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  1149. while (++index < length) {
  1150. result[index] = iteratee(array[index], index, array);
  1151. }
  1152. return result;
  1153. }
  1154. var isArray = Array.isArray;
  1155. var INFINITY$5 = 1 / 0;
  1156. var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0;
  1157. var symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  1158. function baseToString(value) {
  1159. if (typeof value == "string") {
  1160. return value;
  1161. }
  1162. if (isArray(value)) {
  1163. return arrayMap(value, baseToString) + "";
  1164. }
  1165. if (isSymbol(value)) {
  1166. return symbolToString ? symbolToString.call(value) : "";
  1167. }
  1168. var result = value + "";
  1169. return result == "0" && 1 / value == -INFINITY$5 ? "-0" : result;
  1170. }
  1171. function createMathOperation(operator, defaultValue) {
  1172. return function(value, other) {
  1173. var result;
  1174. if (value === void 0 && other === void 0) {
  1175. return defaultValue;
  1176. }
  1177. if (value !== void 0) {
  1178. result = value;
  1179. }
  1180. if (other !== void 0) {
  1181. if (result === void 0) {
  1182. return other;
  1183. }
  1184. if (typeof value == "string" || typeof other == "string") {
  1185. value = baseToString(value);
  1186. other = baseToString(other);
  1187. } else {
  1188. value = baseToNumber(value);
  1189. other = baseToNumber(other);
  1190. }
  1191. result = operator(value, other);
  1192. }
  1193. return result;
  1194. };
  1195. }
  1196. var add = createMathOperation(function(augend, addend) {
  1197. return augend + addend;
  1198. }, 0);
  1199. var reWhitespace = /\s/;
  1200. function trimmedEndIndex(string) {
  1201. var index = string.length;
  1202. while (index-- && reWhitespace.test(string.charAt(index))) {
  1203. }
  1204. return index;
  1205. }
  1206. var reTrimStart$2 = /^\s+/;
  1207. function baseTrim(string) {
  1208. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart$2, "") : string;
  1209. }
  1210. function isObject(value) {
  1211. var type = typeof value;
  1212. return value != null && (type == "object" || type == "function");
  1213. }
  1214. var NAN$1 = 0 / 0;
  1215. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1216. var reIsBinary = /^0b[01]+$/i;
  1217. var reIsOctal = /^0o[0-7]+$/i;
  1218. var freeParseInt = parseInt;
  1219. function toNumber(value) {
  1220. if (typeof value == "number") {
  1221. return value;
  1222. }
  1223. if (isSymbol(value)) {
  1224. return NAN$1;
  1225. }
  1226. if (isObject(value)) {
  1227. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  1228. value = isObject(other) ? other + "" : other;
  1229. }
  1230. if (typeof value != "string") {
  1231. return value === 0 ? value : +value;
  1232. }
  1233. value = baseTrim(value);
  1234. var isBinary = reIsBinary.test(value);
  1235. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN$1 : +value;
  1236. }
  1237. var INFINITY$4 = 1 / 0;
  1238. var MAX_INTEGER = 17976931348623157e292;
  1239. function toFinite(value) {
  1240. if (!value) {
  1241. return value === 0 ? value : 0;
  1242. }
  1243. value = toNumber(value);
  1244. if (value === INFINITY$4 || value === -INFINITY$4) {
  1245. var sign = value < 0 ? -1 : 1;
  1246. return sign * MAX_INTEGER;
  1247. }
  1248. return value === value ? value : 0;
  1249. }
  1250. function toInteger(value) {
  1251. var result = toFinite(value), remainder = result % 1;
  1252. return result === result ? remainder ? result - remainder : result : 0;
  1253. }
  1254. var FUNC_ERROR_TEXT$b = "Expected a function";
  1255. function after(n, func) {
  1256. if (typeof func != "function") {
  1257. throw new TypeError(FUNC_ERROR_TEXT$b);
  1258. }
  1259. n = toInteger(n);
  1260. return function() {
  1261. if (--n < 1) {
  1262. return func.apply(this, arguments);
  1263. }
  1264. };
  1265. }
  1266. function identity(value) {
  1267. return value;
  1268. }
  1269. var asyncTag = "[object AsyncFunction]";
  1270. var funcTag$2 = "[object Function]";
  1271. var genTag$1 = "[object GeneratorFunction]";
  1272. var proxyTag = "[object Proxy]";
  1273. function isFunction(value) {
  1274. if (!isObject(value)) {
  1275. return false;
  1276. }
  1277. var tag = baseGetTag(value);
  1278. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  1279. }
  1280. var coreJsData = root["__core-js_shared__"];
  1281. var maskSrcKey = function() {
  1282. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  1283. return uid ? "Symbol(src)_1." + uid : "";
  1284. }();
  1285. function isMasked(func) {
  1286. return !!maskSrcKey && maskSrcKey in func;
  1287. }
  1288. var funcProto$2 = Function.prototype;
  1289. var funcToString$2 = funcProto$2.toString;
  1290. function toSource(func) {
  1291. if (func != null) {
  1292. try {
  1293. return funcToString$2.call(func);
  1294. } catch (e) {
  1295. }
  1296. try {
  1297. return func + "";
  1298. } catch (e) {
  1299. }
  1300. }
  1301. return "";
  1302. }
  1303. var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
  1304. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1305. var funcProto$1 = Function.prototype;
  1306. var objectProto$q = Object.prototype;
  1307. var funcToString$1 = funcProto$1.toString;
  1308. var hasOwnProperty$n = objectProto$q.hasOwnProperty;
  1309. var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$n).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  1310. function baseIsNative(value) {
  1311. if (!isObject(value) || isMasked(value)) {
  1312. return false;
  1313. }
  1314. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  1315. return pattern.test(toSource(value));
  1316. }
  1317. function getValue$1(object, key) {
  1318. return object == null ? void 0 : object[key];
  1319. }
  1320. function getNative(object, key) {
  1321. var value = getValue$1(object, key);
  1322. return baseIsNative(value) ? value : void 0;
  1323. }
  1324. var WeakMap$1 = getNative(root, "WeakMap");
  1325. var metaMap = WeakMap$1 && new WeakMap$1();
  1326. var baseSetData = !metaMap ? identity : function(func, data) {
  1327. metaMap.set(func, data);
  1328. return func;
  1329. };
  1330. var objectCreate = Object.create;
  1331. var baseCreate = function() {
  1332. function object() {
  1333. }
  1334. return function(proto) {
  1335. if (!isObject(proto)) {
  1336. return {};
  1337. }
  1338. if (objectCreate) {
  1339. return objectCreate(proto);
  1340. }
  1341. object.prototype = proto;
  1342. var result = new object();
  1343. object.prototype = void 0;
  1344. return result;
  1345. };
  1346. }();
  1347. function createCtor(Ctor) {
  1348. return function() {
  1349. var args = arguments;
  1350. switch (args.length) {
  1351. case 0:
  1352. return new Ctor();
  1353. case 1:
  1354. return new Ctor(args[0]);
  1355. case 2:
  1356. return new Ctor(args[0], args[1]);
  1357. case 3:
  1358. return new Ctor(args[0], args[1], args[2]);
  1359. case 4:
  1360. return new Ctor(args[0], args[1], args[2], args[3]);
  1361. case 5:
  1362. return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  1363. case 6:
  1364. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  1365. case 7:
  1366. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  1367. }
  1368. var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args);
  1369. return isObject(result) ? result : thisBinding;
  1370. };
  1371. }
  1372. var WRAP_BIND_FLAG$8 = 1;
  1373. function createBind(func, bitmask, thisArg) {
  1374. var isBind = bitmask & WRAP_BIND_FLAG$8, Ctor = createCtor(func);
  1375. function wrapper() {
  1376. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1377. return fn.apply(isBind ? thisArg : this, arguments);
  1378. }
  1379. return wrapper;
  1380. }
  1381. function apply(func, thisArg, args) {
  1382. switch (args.length) {
  1383. case 0:
  1384. return func.call(thisArg);
  1385. case 1:
  1386. return func.call(thisArg, args[0]);
  1387. case 2:
  1388. return func.call(thisArg, args[0], args[1]);
  1389. case 3:
  1390. return func.call(thisArg, args[0], args[1], args[2]);
  1391. }
  1392. return func.apply(thisArg, args);
  1393. }
  1394. var nativeMax$g = Math.max;
  1395. function composeArgs(args, partials, holders, isCurried) {
  1396. var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax$g(argsLength - holdersLength, 0), result = Array(leftLength + rangeLength), isUncurried = !isCurried;
  1397. while (++leftIndex < leftLength) {
  1398. result[leftIndex] = partials[leftIndex];
  1399. }
  1400. while (++argsIndex < holdersLength) {
  1401. if (isUncurried || argsIndex < argsLength) {
  1402. result[holders[argsIndex]] = args[argsIndex];
  1403. }
  1404. }
  1405. while (rangeLength--) {
  1406. result[leftIndex++] = args[argsIndex++];
  1407. }
  1408. return result;
  1409. }
  1410. var nativeMax$f = Math.max;
  1411. function composeArgsRight(args, partials, holders, isCurried) {
  1412. var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax$f(argsLength - holdersLength, 0), result = Array(rangeLength + rightLength), isUncurried = !isCurried;
  1413. while (++argsIndex < rangeLength) {
  1414. result[argsIndex] = args[argsIndex];
  1415. }
  1416. var offset = argsIndex;
  1417. while (++rightIndex < rightLength) {
  1418. result[offset + rightIndex] = partials[rightIndex];
  1419. }
  1420. while (++holdersIndex < holdersLength) {
  1421. if (isUncurried || argsIndex < argsLength) {
  1422. result[offset + holders[holdersIndex]] = args[argsIndex++];
  1423. }
  1424. }
  1425. return result;
  1426. }
  1427. function countHolders(array, placeholder) {
  1428. var length = array.length, result = 0;
  1429. while (length--) {
  1430. if (array[length] === placeholder) {
  1431. ++result;
  1432. }
  1433. }
  1434. return result;
  1435. }
  1436. function baseLodash() {
  1437. }
  1438. var MAX_ARRAY_LENGTH$6 = 4294967295;
  1439. function LazyWrapper(value) {
  1440. this.__wrapped__ = value;
  1441. this.__actions__ = [];
  1442. this.__dir__ = 1;
  1443. this.__filtered__ = false;
  1444. this.__iteratees__ = [];
  1445. this.__takeCount__ = MAX_ARRAY_LENGTH$6;
  1446. this.__views__ = [];
  1447. }
  1448. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  1449. LazyWrapper.prototype.constructor = LazyWrapper;
  1450. function noop() {
  1451. }
  1452. var getData = !metaMap ? noop : function(func) {
  1453. return metaMap.get(func);
  1454. };
  1455. var realNames = {};
  1456. var objectProto$p = Object.prototype;
  1457. var hasOwnProperty$m = objectProto$p.hasOwnProperty;
  1458. function getFuncName(func) {
  1459. var result = func.name + "", array = realNames[result], length = hasOwnProperty$m.call(realNames, result) ? array.length : 0;
  1460. while (length--) {
  1461. var data = array[length], otherFunc = data.func;
  1462. if (otherFunc == null || otherFunc == func) {
  1463. return data.name;
  1464. }
  1465. }
  1466. return result;
  1467. }
  1468. function LodashWrapper(value, chainAll) {
  1469. this.__wrapped__ = value;
  1470. this.__actions__ = [];
  1471. this.__chain__ = !!chainAll;
  1472. this.__index__ = 0;
  1473. this.__values__ = void 0;
  1474. }
  1475. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  1476. LodashWrapper.prototype.constructor = LodashWrapper;
  1477. function copyArray(source, array) {
  1478. var index = -1, length = source.length;
  1479. array || (array = Array(length));
  1480. while (++index < length) {
  1481. array[index] = source[index];
  1482. }
  1483. return array;
  1484. }
  1485. function wrapperClone(wrapper) {
  1486. if (wrapper instanceof LazyWrapper) {
  1487. return wrapper.clone();
  1488. }
  1489. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  1490. result.__actions__ = copyArray(wrapper.__actions__);
  1491. result.__index__ = wrapper.__index__;
  1492. result.__values__ = wrapper.__values__;
  1493. return result;
  1494. }
  1495. var objectProto$o = Object.prototype;
  1496. var hasOwnProperty$l = objectProto$o.hasOwnProperty;
  1497. function lodash(value) {
  1498. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  1499. if (value instanceof LodashWrapper) {
  1500. return value;
  1501. }
  1502. if (hasOwnProperty$l.call(value, "__wrapped__")) {
  1503. return wrapperClone(value);
  1504. }
  1505. }
  1506. return new LodashWrapper(value);
  1507. }
  1508. lodash.prototype = baseLodash.prototype;
  1509. lodash.prototype.constructor = lodash;
  1510. function isLaziable(func) {
  1511. var funcName = getFuncName(func), other = lodash[funcName];
  1512. if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
  1513. return false;
  1514. }
  1515. if (func === other) {
  1516. return true;
  1517. }
  1518. var data = getData(other);
  1519. return !!data && func === data[0];
  1520. }
  1521. var HOT_COUNT = 800;
  1522. var HOT_SPAN = 16;
  1523. var nativeNow = Date.now;
  1524. function shortOut(func) {
  1525. var count = 0, lastCalled = 0;
  1526. return function() {
  1527. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  1528. lastCalled = stamp;
  1529. if (remaining > 0) {
  1530. if (++count >= HOT_COUNT) {
  1531. return arguments[0];
  1532. }
  1533. } else {
  1534. count = 0;
  1535. }
  1536. return func.apply(void 0, arguments);
  1537. };
  1538. }
  1539. var setData = shortOut(baseSetData);
  1540. var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
  1541. var reSplitDetails = /,? & /;
  1542. function getWrapDetails(source) {
  1543. var match = source.match(reWrapDetails);
  1544. return match ? match[1].split(reSplitDetails) : [];
  1545. }
  1546. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
  1547. function insertWrapDetails(source, details) {
  1548. var length = details.length;
  1549. if (!length) {
  1550. return source;
  1551. }
  1552. var lastIndex = length - 1;
  1553. details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
  1554. details = details.join(length > 2 ? ", " : " ");
  1555. return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
  1556. }
  1557. function constant(value) {
  1558. return function() {
  1559. return value;
  1560. };
  1561. }
  1562. var defineProperty = function() {
  1563. try {
  1564. var func = getNative(Object, "defineProperty");
  1565. func({}, "", {});
  1566. return func;
  1567. } catch (e) {
  1568. }
  1569. }();
  1570. var baseSetToString = !defineProperty ? identity : function(func, string) {
  1571. return defineProperty(func, "toString", {
  1572. "configurable": true,
  1573. "enumerable": false,
  1574. "value": constant(string),
  1575. "writable": true
  1576. });
  1577. };
  1578. var setToString = shortOut(baseSetToString);
  1579. function arrayEach(array, iteratee) {
  1580. var index = -1, length = array == null ? 0 : array.length;
  1581. while (++index < length) {
  1582. if (iteratee(array[index], index, array) === false) {
  1583. break;
  1584. }
  1585. }
  1586. return array;
  1587. }
  1588. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1589. var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  1590. while (fromRight ? index-- : ++index < length) {
  1591. if (predicate(array[index], index, array)) {
  1592. return index;
  1593. }
  1594. }
  1595. return -1;
  1596. }
  1597. function baseIsNaN(value) {
  1598. return value !== value;
  1599. }
  1600. function strictIndexOf(array, value, fromIndex) {
  1601. var index = fromIndex - 1, length = array.length;
  1602. while (++index < length) {
  1603. if (array[index] === value) {
  1604. return index;
  1605. }
  1606. }
  1607. return -1;
  1608. }
  1609. function baseIndexOf(array, value, fromIndex) {
  1610. return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
  1611. }
  1612. function arrayIncludes(array, value) {
  1613. var length = array == null ? 0 : array.length;
  1614. return !!length && baseIndexOf(array, value, 0) > -1;
  1615. }
  1616. var WRAP_BIND_FLAG$7 = 1;
  1617. var WRAP_BIND_KEY_FLAG$6 = 2;
  1618. var WRAP_CURRY_FLAG$6 = 8;
  1619. var WRAP_CURRY_RIGHT_FLAG$3 = 16;
  1620. var WRAP_PARTIAL_FLAG$6 = 32;
  1621. var WRAP_PARTIAL_RIGHT_FLAG$3 = 64;
  1622. var WRAP_ARY_FLAG$4 = 128;
  1623. var WRAP_REARG_FLAG$3 = 256;
  1624. var WRAP_FLIP_FLAG$2 = 512;
  1625. var wrapFlags = [
  1626. ["ary", WRAP_ARY_FLAG$4],
  1627. ["bind", WRAP_BIND_FLAG$7],
  1628. ["bindKey", WRAP_BIND_KEY_FLAG$6],
  1629. ["curry", WRAP_CURRY_FLAG$6],
  1630. ["curryRight", WRAP_CURRY_RIGHT_FLAG$3],
  1631. ["flip", WRAP_FLIP_FLAG$2],
  1632. ["partial", WRAP_PARTIAL_FLAG$6],
  1633. ["partialRight", WRAP_PARTIAL_RIGHT_FLAG$3],
  1634. ["rearg", WRAP_REARG_FLAG$3]
  1635. ];
  1636. function updateWrapDetails(details, bitmask) {
  1637. arrayEach(wrapFlags, function(pair) {
  1638. var value = "_." + pair[0];
  1639. if (bitmask & pair[1] && !arrayIncludes(details, value)) {
  1640. details.push(value);
  1641. }
  1642. });
  1643. return details.sort();
  1644. }
  1645. function setWrapToString(wrapper, reference, bitmask) {
  1646. var source = reference + "";
  1647. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  1648. }
  1649. var WRAP_BIND_FLAG$6 = 1;
  1650. var WRAP_BIND_KEY_FLAG$5 = 2;
  1651. var WRAP_CURRY_BOUND_FLAG$1 = 4;
  1652. var WRAP_CURRY_FLAG$5 = 8;
  1653. var WRAP_PARTIAL_FLAG$5 = 32;
  1654. var WRAP_PARTIAL_RIGHT_FLAG$2 = 64;
  1655. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  1656. var isCurry = bitmask & WRAP_CURRY_FLAG$5, newHolders = isCurry ? holders : void 0, newHoldersRight = isCurry ? void 0 : holders, newPartials = isCurry ? partials : void 0, newPartialsRight = isCurry ? void 0 : partials;
  1657. bitmask |= isCurry ? WRAP_PARTIAL_FLAG$5 : WRAP_PARTIAL_RIGHT_FLAG$2;
  1658. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$5);
  1659. if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) {
  1660. bitmask &= ~(WRAP_BIND_FLAG$6 | WRAP_BIND_KEY_FLAG$5);
  1661. }
  1662. var newData = [
  1663. func,
  1664. bitmask,
  1665. thisArg,
  1666. newPartials,
  1667. newHolders,
  1668. newPartialsRight,
  1669. newHoldersRight,
  1670. argPos,
  1671. ary,
  1672. arity
  1673. ];
  1674. var result = wrapFunc.apply(void 0, newData);
  1675. if (isLaziable(func)) {
  1676. setData(result, newData);
  1677. }
  1678. result.placeholder = placeholder;
  1679. return setWrapToString(result, func, bitmask);
  1680. }
  1681. function getHolder(func) {
  1682. var object = func;
  1683. return object.placeholder;
  1684. }
  1685. var MAX_SAFE_INTEGER$5 = 9007199254740991;
  1686. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1687. function isIndex(value, length) {
  1688. var type = typeof value;
  1689. length = length == null ? MAX_SAFE_INTEGER$5 : length;
  1690. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  1691. }
  1692. var nativeMin$e = Math.min;
  1693. function reorder(array, indexes) {
  1694. var arrLength = array.length, length = nativeMin$e(indexes.length, arrLength), oldArray = copyArray(array);
  1695. while (length--) {
  1696. var index = indexes[length];
  1697. array[length] = isIndex(index, arrLength) ? oldArray[index] : void 0;
  1698. }
  1699. return array;
  1700. }
  1701. var PLACEHOLDER$1 = "__lodash_placeholder__";
  1702. function replaceHolders(array, placeholder) {
  1703. var index = -1, length = array.length, resIndex = 0, result = [];
  1704. while (++index < length) {
  1705. var value = array[index];
  1706. if (value === placeholder || value === PLACEHOLDER$1) {
  1707. array[index] = PLACEHOLDER$1;
  1708. result[resIndex++] = index;
  1709. }
  1710. }
  1711. return result;
  1712. }
  1713. var WRAP_BIND_FLAG$5 = 1;
  1714. var WRAP_BIND_KEY_FLAG$4 = 2;
  1715. var WRAP_CURRY_FLAG$4 = 8;
  1716. var WRAP_CURRY_RIGHT_FLAG$2 = 16;
  1717. var WRAP_ARY_FLAG$3 = 128;
  1718. var WRAP_FLIP_FLAG$1 = 512;
  1719. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  1720. var isAry = bitmask & WRAP_ARY_FLAG$3, isBind = bitmask & WRAP_BIND_FLAG$5, isBindKey = bitmask & WRAP_BIND_KEY_FLAG$4, isCurried = bitmask & (WRAP_CURRY_FLAG$4 | WRAP_CURRY_RIGHT_FLAG$2), isFlip = bitmask & WRAP_FLIP_FLAG$1, Ctor = isBindKey ? void 0 : createCtor(func);
  1721. function wrapper() {
  1722. var length = arguments.length, args = Array(length), index = length;
  1723. while (index--) {
  1724. args[index] = arguments[index];
  1725. }
  1726. if (isCurried) {
  1727. var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
  1728. }
  1729. if (partials) {
  1730. args = composeArgs(args, partials, holders, isCurried);
  1731. }
  1732. if (partialsRight) {
  1733. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  1734. }
  1735. length -= holdersCount;
  1736. if (isCurried && length < arity) {
  1737. var newHolders = replaceHolders(args, placeholder);
  1738. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length);
  1739. }
  1740. var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
  1741. length = args.length;
  1742. if (argPos) {
  1743. args = reorder(args, argPos);
  1744. } else if (isFlip && length > 1) {
  1745. args.reverse();
  1746. }
  1747. if (isAry && ary < length) {
  1748. args.length = ary;
  1749. }
  1750. if (this && this !== root && this instanceof wrapper) {
  1751. fn = Ctor || createCtor(fn);
  1752. }
  1753. return fn.apply(thisBinding, args);
  1754. }
  1755. return wrapper;
  1756. }
  1757. function createCurry(func, bitmask, arity) {
  1758. var Ctor = createCtor(func);
  1759. function wrapper() {
  1760. var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper);
  1761. while (index--) {
  1762. args[index] = arguments[index];
  1763. }
  1764. var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
  1765. length -= holders.length;
  1766. if (length < arity) {
  1767. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, void 0, args, holders, void 0, void 0, arity - length);
  1768. }
  1769. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1770. return apply(fn, this, args);
  1771. }
  1772. return wrapper;
  1773. }
  1774. var WRAP_BIND_FLAG$4 = 1;
  1775. function createPartial(func, bitmask, thisArg, partials) {
  1776. var isBind = bitmask & WRAP_BIND_FLAG$4, Ctor = createCtor(func);
  1777. function wrapper() {
  1778. var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1779. while (++leftIndex < leftLength) {
  1780. args[leftIndex] = partials[leftIndex];
  1781. }
  1782. while (argsLength--) {
  1783. args[leftIndex++] = arguments[++argsIndex];
  1784. }
  1785. return apply(fn, isBind ? thisArg : this, args);
  1786. }
  1787. return wrapper;
  1788. }
  1789. var PLACEHOLDER = "__lodash_placeholder__";
  1790. var WRAP_BIND_FLAG$3 = 1;
  1791. var WRAP_BIND_KEY_FLAG$3 = 2;
  1792. var WRAP_CURRY_BOUND_FLAG = 4;
  1793. var WRAP_CURRY_FLAG$3 = 8;
  1794. var WRAP_ARY_FLAG$2 = 128;
  1795. var WRAP_REARG_FLAG$2 = 256;
  1796. var nativeMin$d = Math.min;
  1797. function mergeData(data, source) {
  1798. var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG$3 | WRAP_BIND_KEY_FLAG$3 | WRAP_ARY_FLAG$2);
  1799. var isCombo = srcBitmask == WRAP_ARY_FLAG$2 && bitmask == WRAP_CURRY_FLAG$3 || srcBitmask == WRAP_ARY_FLAG$2 && bitmask == WRAP_REARG_FLAG$2 && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG$2 | WRAP_REARG_FLAG$2) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG$3;
  1800. if (!(isCommon || isCombo)) {
  1801. return data;
  1802. }
  1803. if (srcBitmask & WRAP_BIND_FLAG$3) {
  1804. data[2] = source[2];
  1805. newBitmask |= bitmask & WRAP_BIND_FLAG$3 ? 0 : WRAP_CURRY_BOUND_FLAG;
  1806. }
  1807. var value = source[3];
  1808. if (value) {
  1809. var partials = data[3];
  1810. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  1811. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  1812. }
  1813. value = source[5];
  1814. if (value) {
  1815. partials = data[5];
  1816. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  1817. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  1818. }
  1819. value = source[7];
  1820. if (value) {
  1821. data[7] = value;
  1822. }
  1823. if (srcBitmask & WRAP_ARY_FLAG$2) {
  1824. data[8] = data[8] == null ? source[8] : nativeMin$d(data[8], source[8]);
  1825. }
  1826. if (data[9] == null) {
  1827. data[9] = source[9];
  1828. }
  1829. data[0] = source[0];
  1830. data[1] = newBitmask;
  1831. return data;
  1832. }
  1833. var FUNC_ERROR_TEXT$a = "Expected a function";
  1834. var WRAP_BIND_FLAG$2 = 1;
  1835. var WRAP_BIND_KEY_FLAG$2 = 2;
  1836. var WRAP_CURRY_FLAG$2 = 8;
  1837. var WRAP_CURRY_RIGHT_FLAG$1 = 16;
  1838. var WRAP_PARTIAL_FLAG$4 = 32;
  1839. var WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
  1840. var nativeMax$e = Math.max;
  1841. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  1842. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2;
  1843. if (!isBindKey && typeof func != "function") {
  1844. throw new TypeError(FUNC_ERROR_TEXT$a);
  1845. }
  1846. var length = partials ? partials.length : 0;
  1847. if (!length) {
  1848. bitmask &= ~(WRAP_PARTIAL_FLAG$4 | WRAP_PARTIAL_RIGHT_FLAG$1);
  1849. partials = holders = void 0;
  1850. }
  1851. ary = ary === void 0 ? ary : nativeMax$e(toInteger(ary), 0);
  1852. arity = arity === void 0 ? arity : toInteger(arity);
  1853. length -= holders ? holders.length : 0;
  1854. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$1) {
  1855. var partialsRight = partials, holdersRight = holders;
  1856. partials = holders = void 0;
  1857. }
  1858. var data = isBindKey ? void 0 : getData(func);
  1859. var newData = [
  1860. func,
  1861. bitmask,
  1862. thisArg,
  1863. partials,
  1864. holders,
  1865. partialsRight,
  1866. holdersRight,
  1867. argPos,
  1868. ary,
  1869. arity
  1870. ];
  1871. if (data) {
  1872. mergeData(newData, data);
  1873. }
  1874. func = newData[0];
  1875. bitmask = newData[1];
  1876. thisArg = newData[2];
  1877. partials = newData[3];
  1878. holders = newData[4];
  1879. arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax$e(newData[9] - length, 0);
  1880. if (!arity && bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1)) {
  1881. bitmask &= ~(WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1);
  1882. }
  1883. if (!bitmask || bitmask == WRAP_BIND_FLAG$2) {
  1884. var result = createBind(func, bitmask, thisArg);
  1885. } else if (bitmask == WRAP_CURRY_FLAG$2 || bitmask == WRAP_CURRY_RIGHT_FLAG$1) {
  1886. result = createCurry(func, bitmask, arity);
  1887. } else if ((bitmask == WRAP_PARTIAL_FLAG$4 || bitmask == (WRAP_BIND_FLAG$2 | WRAP_PARTIAL_FLAG$4)) && !holders.length) {
  1888. result = createPartial(func, bitmask, thisArg, partials);
  1889. } else {
  1890. result = createHybrid.apply(void 0, newData);
  1891. }
  1892. var setter = data ? baseSetData : setData;
  1893. return setWrapToString(setter(result, newData), func, bitmask);
  1894. }
  1895. var WRAP_ARY_FLAG$1 = 128;
  1896. function ary(func, n, guard) {
  1897. n = guard ? void 0 : n;
  1898. n = func && n == null ? func.length : n;
  1899. return createWrap(func, WRAP_ARY_FLAG$1, void 0, void 0, void 0, void 0, n);
  1900. }
  1901. function baseAssignValue(object, key, value) {
  1902. if (key == "__proto__" && defineProperty) {
  1903. defineProperty(object, key, {
  1904. "configurable": true,
  1905. "enumerable": true,
  1906. "value": value,
  1907. "writable": true
  1908. });
  1909. } else {
  1910. object[key] = value;
  1911. }
  1912. }
  1913. function eq(value, other) {
  1914. return value === other || value !== value && other !== other;
  1915. }
  1916. var objectProto$n = Object.prototype;
  1917. var hasOwnProperty$k = objectProto$n.hasOwnProperty;
  1918. function assignValue(object, key, value) {
  1919. var objValue = object[key];
  1920. if (!(hasOwnProperty$k.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
  1921. baseAssignValue(object, key, value);
  1922. }
  1923. }
  1924. function copyObject(source, props, object, customizer) {
  1925. var isNew = !object;
  1926. object || (object = {});
  1927. var index = -1, length = props.length;
  1928. while (++index < length) {
  1929. var key = props[index];
  1930. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  1931. if (newValue === void 0) {
  1932. newValue = source[key];
  1933. }
  1934. if (isNew) {
  1935. baseAssignValue(object, key, newValue);
  1936. } else {
  1937. assignValue(object, key, newValue);
  1938. }
  1939. }
  1940. return object;
  1941. }
  1942. var nativeMax$d = Math.max;
  1943. function overRest(func, start, transform) {
  1944. start = nativeMax$d(start === void 0 ? func.length - 1 : start, 0);
  1945. return function() {
  1946. var args = arguments, index = -1, length = nativeMax$d(args.length - start, 0), array = Array(length);
  1947. while (++index < length) {
  1948. array[index] = args[start + index];
  1949. }
  1950. index = -1;
  1951. var otherArgs = Array(start + 1);
  1952. while (++index < start) {
  1953. otherArgs[index] = args[index];
  1954. }
  1955. otherArgs[start] = transform(array);
  1956. return apply(func, this, otherArgs);
  1957. };
  1958. }
  1959. function baseRest(func, start) {
  1960. return setToString(overRest(func, start, identity), func + "");
  1961. }
  1962. var MAX_SAFE_INTEGER$4 = 9007199254740991;
  1963. function isLength(value) {
  1964. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4;
  1965. }
  1966. function isArrayLike(value) {
  1967. return value != null && isLength(value.length) && !isFunction(value);
  1968. }
  1969. function isIterateeCall(value, index, object) {
  1970. if (!isObject(object)) {
  1971. return false;
  1972. }
  1973. var type = typeof index;
  1974. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
  1975. return eq(object[index], value);
  1976. }
  1977. return false;
  1978. }
  1979. function createAssigner(assigner) {
  1980. return baseRest(function(object, sources) {
  1981. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  1982. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  1983. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  1984. customizer = length < 3 ? void 0 : customizer;
  1985. length = 1;
  1986. }
  1987. object = Object(object);
  1988. while (++index < length) {
  1989. var source = sources[index];
  1990. if (source) {
  1991. assigner(object, source, index, customizer);
  1992. }
  1993. }
  1994. return object;
  1995. });
  1996. }
  1997. var objectProto$m = Object.prototype;
  1998. function isPrototype(value) {
  1999. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m;
  2000. return value === proto;
  2001. }
  2002. function baseTimes(n, iteratee) {
  2003. var index = -1, result = Array(n);
  2004. while (++index < n) {
  2005. result[index] = iteratee(index);
  2006. }
  2007. return result;
  2008. }
  2009. var argsTag$3 = "[object Arguments]";
  2010. function baseIsArguments(value) {
  2011. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  2012. }
  2013. var objectProto$l = Object.prototype;
  2014. var hasOwnProperty$j = objectProto$l.hasOwnProperty;
  2015. var propertyIsEnumerable$1 = objectProto$l.propertyIsEnumerable;
  2016. var isArguments = baseIsArguments(function() {
  2017. return arguments;
  2018. }()) ? baseIsArguments : function(value) {
  2019. return isObjectLike(value) && hasOwnProperty$j.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  2020. };
  2021. function stubFalse() {
  2022. return false;
  2023. }
  2024. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  2025. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  2026. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  2027. var Buffer$1 = moduleExports$2 ? root.Buffer : void 0;
  2028. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  2029. var isBuffer = nativeIsBuffer || stubFalse;
  2030. var argsTag$2 = "[object Arguments]";
  2031. var arrayTag$2 = "[object Array]";
  2032. var boolTag$4 = "[object Boolean]";
  2033. var dateTag$4 = "[object Date]";
  2034. var errorTag$3 = "[object Error]";
  2035. var funcTag$1 = "[object Function]";
  2036. var mapTag$9 = "[object Map]";
  2037. var numberTag$4 = "[object Number]";
  2038. var objectTag$4 = "[object Object]";
  2039. var regexpTag$4 = "[object RegExp]";
  2040. var setTag$9 = "[object Set]";
  2041. var stringTag$4 = "[object String]";
  2042. var weakMapTag$3 = "[object WeakMap]";
  2043. var arrayBufferTag$4 = "[object ArrayBuffer]";
  2044. var dataViewTag$4 = "[object DataView]";
  2045. var float32Tag$2 = "[object Float32Array]";
  2046. var float64Tag$2 = "[object Float64Array]";
  2047. var int8Tag$2 = "[object Int8Array]";
  2048. var int16Tag$2 = "[object Int16Array]";
  2049. var int32Tag$2 = "[object Int32Array]";
  2050. var uint8Tag$2 = "[object Uint8Array]";
  2051. var uint8ClampedTag$2 = "[object Uint8ClampedArray]";
  2052. var uint16Tag$2 = "[object Uint16Array]";
  2053. var uint32Tag$2 = "[object Uint32Array]";
  2054. var typedArrayTags = {};
  2055. 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;
  2056. typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$4] = typedArrayTags[boolTag$4] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$4] = typedArrayTags[errorTag$3] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$9] = typedArrayTags[numberTag$4] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$4] = typedArrayTags[setTag$9] = typedArrayTags[stringTag$4] = typedArrayTags[weakMapTag$3] = false;
  2057. function baseIsTypedArray(value) {
  2058. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  2059. }
  2060. function baseUnary(func) {
  2061. return function(value) {
  2062. return func(value);
  2063. };
  2064. }
  2065. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  2066. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  2067. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  2068. var freeProcess = moduleExports$1 && freeGlobal.process;
  2069. var nodeUtil = function() {
  2070. try {
  2071. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  2072. if (types) {
  2073. return types;
  2074. }
  2075. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  2076. } catch (e) {
  2077. }
  2078. }();
  2079. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  2080. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  2081. var objectProto$k = Object.prototype;
  2082. var hasOwnProperty$i = objectProto$k.hasOwnProperty;
  2083. function arrayLikeKeys(value, inherited) {
  2084. 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;
  2085. for (var key in value) {
  2086. if ((inherited || hasOwnProperty$i.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  2087. result.push(key);
  2088. }
  2089. }
  2090. return result;
  2091. }
  2092. function overArg(func, transform) {
  2093. return function(arg) {
  2094. return func(transform(arg));
  2095. };
  2096. }
  2097. var nativeKeys = overArg(Object.keys, Object);
  2098. var objectProto$j = Object.prototype;
  2099. var hasOwnProperty$h = objectProto$j.hasOwnProperty;
  2100. function baseKeys(object) {
  2101. if (!isPrototype(object)) {
  2102. return nativeKeys(object);
  2103. }
  2104. var result = [];
  2105. for (var key in Object(object)) {
  2106. if (hasOwnProperty$h.call(object, key) && key != "constructor") {
  2107. result.push(key);
  2108. }
  2109. }
  2110. return result;
  2111. }
  2112. function keys(object) {
  2113. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  2114. }
  2115. var objectProto$i = Object.prototype;
  2116. var hasOwnProperty$g = objectProto$i.hasOwnProperty;
  2117. var assign = createAssigner(function(object, source) {
  2118. if (isPrototype(source) || isArrayLike(source)) {
  2119. copyObject(source, keys(source), object);
  2120. return;
  2121. }
  2122. for (var key in source) {
  2123. if (hasOwnProperty$g.call(source, key)) {
  2124. assignValue(object, key, source[key]);
  2125. }
  2126. }
  2127. });
  2128. function nativeKeysIn(object) {
  2129. var result = [];
  2130. if (object != null) {
  2131. for (var key in Object(object)) {
  2132. result.push(key);
  2133. }
  2134. }
  2135. return result;
  2136. }
  2137. var objectProto$h = Object.prototype;
  2138. var hasOwnProperty$f = objectProto$h.hasOwnProperty;
  2139. function baseKeysIn(object) {
  2140. if (!isObject(object)) {
  2141. return nativeKeysIn(object);
  2142. }
  2143. var isProto = isPrototype(object), result = [];
  2144. for (var key in object) {
  2145. if (!(key == "constructor" && (isProto || !hasOwnProperty$f.call(object, key)))) {
  2146. result.push(key);
  2147. }
  2148. }
  2149. return result;
  2150. }
  2151. function keysIn(object) {
  2152. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  2153. }
  2154. var assignIn = createAssigner(function(object, source) {
  2155. copyObject(source, keysIn(source), object);
  2156. });
  2157. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  2158. copyObject(source, keysIn(source), object, customizer);
  2159. });
  2160. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  2161. copyObject(source, keys(source), object, customizer);
  2162. });
  2163. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
  2164. var reIsPlainProp = /^\w*$/;
  2165. function isKey(value, object) {
  2166. if (isArray(value)) {
  2167. return false;
  2168. }
  2169. var type = typeof value;
  2170. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
  2171. return true;
  2172. }
  2173. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  2174. }
  2175. var nativeCreate = getNative(Object, "create");
  2176. function hashClear() {
  2177. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  2178. this.size = 0;
  2179. }
  2180. function hashDelete(key) {
  2181. var result = this.has(key) && delete this.__data__[key];
  2182. this.size -= result ? 1 : 0;
  2183. return result;
  2184. }
  2185. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  2186. var objectProto$g = Object.prototype;
  2187. var hasOwnProperty$e = objectProto$g.hasOwnProperty;
  2188. function hashGet(key) {
  2189. var data = this.__data__;
  2190. if (nativeCreate) {
  2191. var result = data[key];
  2192. return result === HASH_UNDEFINED$2 ? void 0 : result;
  2193. }
  2194. return hasOwnProperty$e.call(data, key) ? data[key] : void 0;
  2195. }
  2196. var objectProto$f = Object.prototype;
  2197. var hasOwnProperty$d = objectProto$f.hasOwnProperty;
  2198. function hashHas(key) {
  2199. var data = this.__data__;
  2200. return nativeCreate ? data[key] !== void 0 : hasOwnProperty$d.call(data, key);
  2201. }
  2202. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  2203. function hashSet(key, value) {
  2204. var data = this.__data__;
  2205. this.size += this.has(key) ? 0 : 1;
  2206. data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
  2207. return this;
  2208. }
  2209. function Hash(entries) {
  2210. var index = -1, length = entries == null ? 0 : entries.length;
  2211. this.clear();
  2212. while (++index < length) {
  2213. var entry = entries[index];
  2214. this.set(entry[0], entry[1]);
  2215. }
  2216. }
  2217. Hash.prototype.clear = hashClear;
  2218. Hash.prototype["delete"] = hashDelete;
  2219. Hash.prototype.get = hashGet;
  2220. Hash.prototype.has = hashHas;
  2221. Hash.prototype.set = hashSet;
  2222. function listCacheClear() {
  2223. this.__data__ = [];
  2224. this.size = 0;
  2225. }
  2226. function assocIndexOf(array, key) {
  2227. var length = array.length;
  2228. while (length--) {
  2229. if (eq(array[length][0], key)) {
  2230. return length;
  2231. }
  2232. }
  2233. return -1;
  2234. }
  2235. var arrayProto$5 = Array.prototype;
  2236. var splice$2 = arrayProto$5.splice;
  2237. function listCacheDelete(key) {
  2238. var data = this.__data__, index = assocIndexOf(data, key);
  2239. if (index < 0) {
  2240. return false;
  2241. }
  2242. var lastIndex = data.length - 1;
  2243. if (index == lastIndex) {
  2244. data.pop();
  2245. } else {
  2246. splice$2.call(data, index, 1);
  2247. }
  2248. --this.size;
  2249. return true;
  2250. }
  2251. function listCacheGet(key) {
  2252. var data = this.__data__, index = assocIndexOf(data, key);
  2253. return index < 0 ? void 0 : data[index][1];
  2254. }
  2255. function listCacheHas(key) {
  2256. return assocIndexOf(this.__data__, key) > -1;
  2257. }
  2258. function listCacheSet(key, value) {
  2259. var data = this.__data__, index = assocIndexOf(data, key);
  2260. if (index < 0) {
  2261. ++this.size;
  2262. data.push([key, value]);
  2263. } else {
  2264. data[index][1] = value;
  2265. }
  2266. return this;
  2267. }
  2268. function ListCache(entries) {
  2269. var index = -1, length = entries == null ? 0 : entries.length;
  2270. this.clear();
  2271. while (++index < length) {
  2272. var entry = entries[index];
  2273. this.set(entry[0], entry[1]);
  2274. }
  2275. }
  2276. ListCache.prototype.clear = listCacheClear;
  2277. ListCache.prototype["delete"] = listCacheDelete;
  2278. ListCache.prototype.get = listCacheGet;
  2279. ListCache.prototype.has = listCacheHas;
  2280. ListCache.prototype.set = listCacheSet;
  2281. var Map$1 = getNative(root, "Map");
  2282. function mapCacheClear() {
  2283. this.size = 0;
  2284. this.__data__ = {
  2285. "hash": new Hash(),
  2286. "map": new (Map$1 || ListCache)(),
  2287. "string": new Hash()
  2288. };
  2289. }
  2290. function isKeyable(value) {
  2291. var type = typeof value;
  2292. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  2293. }
  2294. function getMapData(map, key) {
  2295. var data = map.__data__;
  2296. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  2297. }
  2298. function mapCacheDelete(key) {
  2299. var result = getMapData(this, key)["delete"](key);
  2300. this.size -= result ? 1 : 0;
  2301. return result;
  2302. }
  2303. function mapCacheGet(key) {
  2304. return getMapData(this, key).get(key);
  2305. }
  2306. function mapCacheHas(key) {
  2307. return getMapData(this, key).has(key);
  2308. }
  2309. function mapCacheSet(key, value) {
  2310. var data = getMapData(this, key), size = data.size;
  2311. data.set(key, value);
  2312. this.size += data.size == size ? 0 : 1;
  2313. return this;
  2314. }
  2315. function MapCache(entries) {
  2316. var index = -1, length = entries == null ? 0 : entries.length;
  2317. this.clear();
  2318. while (++index < length) {
  2319. var entry = entries[index];
  2320. this.set(entry[0], entry[1]);
  2321. }
  2322. }
  2323. MapCache.prototype.clear = mapCacheClear;
  2324. MapCache.prototype["delete"] = mapCacheDelete;
  2325. MapCache.prototype.get = mapCacheGet;
  2326. MapCache.prototype.has = mapCacheHas;
  2327. MapCache.prototype.set = mapCacheSet;
  2328. var FUNC_ERROR_TEXT$9 = "Expected a function";
  2329. function memoize(func, resolver) {
  2330. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  2331. throw new TypeError(FUNC_ERROR_TEXT$9);
  2332. }
  2333. var memoized = function() {
  2334. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  2335. if (cache.has(key)) {
  2336. return cache.get(key);
  2337. }
  2338. var result = func.apply(this, args);
  2339. memoized.cache = cache.set(key, result) || cache;
  2340. return result;
  2341. };
  2342. memoized.cache = new (memoize.Cache || MapCache)();
  2343. return memoized;
  2344. }
  2345. memoize.Cache = MapCache;
  2346. var MAX_MEMOIZE_SIZE = 500;
  2347. function memoizeCapped(func) {
  2348. var result = memoize(func, function(key) {
  2349. if (cache.size === MAX_MEMOIZE_SIZE) {
  2350. cache.clear();
  2351. }
  2352. return key;
  2353. });
  2354. var cache = result.cache;
  2355. return result;
  2356. }
  2357. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  2358. var reEscapeChar = /\\(\\)?/g;
  2359. var stringToPath = memoizeCapped(function(string) {
  2360. var result = [];
  2361. if (string.charCodeAt(0) === 46) {
  2362. result.push("");
  2363. }
  2364. string.replace(rePropName, function(match, number, quote, subString) {
  2365. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  2366. });
  2367. return result;
  2368. });
  2369. function toString(value) {
  2370. return value == null ? "" : baseToString(value);
  2371. }
  2372. function castPath(value, object) {
  2373. if (isArray(value)) {
  2374. return value;
  2375. }
  2376. return isKey(value, object) ? [value] : stringToPath(toString(value));
  2377. }
  2378. var INFINITY$3 = 1 / 0;
  2379. function toKey(value) {
  2380. if (typeof value == "string" || isSymbol(value)) {
  2381. return value;
  2382. }
  2383. var result = value + "";
  2384. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  2385. }
  2386. function baseGet(object, path) {
  2387. path = castPath(path, object);
  2388. var index = 0, length = path.length;
  2389. while (object != null && index < length) {
  2390. object = object[toKey(path[index++])];
  2391. }
  2392. return index && index == length ? object : void 0;
  2393. }
  2394. function get(object, path, defaultValue) {
  2395. var result = object == null ? void 0 : baseGet(object, path);
  2396. return result === void 0 ? defaultValue : result;
  2397. }
  2398. function baseAt(object, paths) {
  2399. var index = -1, length = paths.length, result = Array(length), skip = object == null;
  2400. while (++index < length) {
  2401. result[index] = skip ? void 0 : get(object, paths[index]);
  2402. }
  2403. return result;
  2404. }
  2405. function arrayPush(array, values) {
  2406. var index = -1, length = values.length, offset = array.length;
  2407. while (++index < length) {
  2408. array[offset + index] = values[index];
  2409. }
  2410. return array;
  2411. }
  2412. var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
  2413. function isFlattenable(value) {
  2414. return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  2415. }
  2416. function baseFlatten(array, depth, predicate, isStrict, result) {
  2417. var index = -1, length = array.length;
  2418. predicate || (predicate = isFlattenable);
  2419. result || (result = []);
  2420. while (++index < length) {
  2421. var value = array[index];
  2422. if (depth > 0 && predicate(value)) {
  2423. if (depth > 1) {
  2424. baseFlatten(value, depth - 1, predicate, isStrict, result);
  2425. } else {
  2426. arrayPush(result, value);
  2427. }
  2428. } else if (!isStrict) {
  2429. result[result.length] = value;
  2430. }
  2431. }
  2432. return result;
  2433. }
  2434. function flatten(array) {
  2435. var length = array == null ? 0 : array.length;
  2436. return length ? baseFlatten(array, 1) : [];
  2437. }
  2438. function flatRest(func) {
  2439. return setToString(overRest(func, void 0, flatten), func + "");
  2440. }
  2441. var at$1 = flatRest(baseAt);
  2442. var getPrototype = overArg(Object.getPrototypeOf, Object);
  2443. var objectTag$3 = "[object Object]";
  2444. var funcProto = Function.prototype;
  2445. var objectProto$e = Object.prototype;
  2446. var funcToString = funcProto.toString;
  2447. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  2448. var objectCtorString = funcToString.call(Object);
  2449. function isPlainObject(value) {
  2450. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
  2451. return false;
  2452. }
  2453. var proto = getPrototype(value);
  2454. if (proto === null) {
  2455. return true;
  2456. }
  2457. var Ctor = hasOwnProperty$c.call(proto, "constructor") && proto.constructor;
  2458. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  2459. }
  2460. var domExcTag = "[object DOMException]";
  2461. var errorTag$2 = "[object Error]";
  2462. function isError(value) {
  2463. if (!isObjectLike(value)) {
  2464. return false;
  2465. }
  2466. var tag = baseGetTag(value);
  2467. return tag == errorTag$2 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
  2468. }
  2469. var attempt = baseRest(function(func, args) {
  2470. try {
  2471. return apply(func, void 0, args);
  2472. } catch (e) {
  2473. return isError(e) ? e : new Error(e);
  2474. }
  2475. });
  2476. var FUNC_ERROR_TEXT$8 = "Expected a function";
  2477. function before(n, func) {
  2478. var result;
  2479. if (typeof func != "function") {
  2480. throw new TypeError(FUNC_ERROR_TEXT$8);
  2481. }
  2482. n = toInteger(n);
  2483. return function() {
  2484. if (--n > 0) {
  2485. result = func.apply(this, arguments);
  2486. }
  2487. if (n <= 1) {
  2488. func = void 0;
  2489. }
  2490. return result;
  2491. };
  2492. }
  2493. var WRAP_BIND_FLAG$1 = 1;
  2494. var WRAP_PARTIAL_FLAG$3 = 32;
  2495. var bind = baseRest(function(func, thisArg, partials) {
  2496. var bitmask = WRAP_BIND_FLAG$1;
  2497. if (partials.length) {
  2498. var holders = replaceHolders(partials, getHolder(bind));
  2499. bitmask |= WRAP_PARTIAL_FLAG$3;
  2500. }
  2501. return createWrap(func, bitmask, thisArg, partials, holders);
  2502. });
  2503. bind.placeholder = {};
  2504. var bindAll = flatRest(function(object, methodNames) {
  2505. arrayEach(methodNames, function(key) {
  2506. key = toKey(key);
  2507. baseAssignValue(object, key, bind(object[key], object));
  2508. });
  2509. return object;
  2510. });
  2511. var WRAP_BIND_FLAG = 1;
  2512. var WRAP_BIND_KEY_FLAG$1 = 2;
  2513. var WRAP_PARTIAL_FLAG$2 = 32;
  2514. var bindKey = baseRest(function(object, key, partials) {
  2515. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG$1;
  2516. if (partials.length) {
  2517. var holders = replaceHolders(partials, getHolder(bindKey));
  2518. bitmask |= WRAP_PARTIAL_FLAG$2;
  2519. }
  2520. return createWrap(key, bitmask, object, partials, holders);
  2521. });
  2522. bindKey.placeholder = {};
  2523. function baseSlice(array, start, end) {
  2524. var index = -1, length = array.length;
  2525. if (start < 0) {
  2526. start = -start > length ? 0 : length + start;
  2527. }
  2528. end = end > length ? length : end;
  2529. if (end < 0) {
  2530. end += length;
  2531. }
  2532. length = start > end ? 0 : end - start >>> 0;
  2533. start >>>= 0;
  2534. var result = Array(length);
  2535. while (++index < length) {
  2536. result[index] = array[index + start];
  2537. }
  2538. return result;
  2539. }
  2540. function castSlice(array, start, end) {
  2541. var length = array.length;
  2542. end = end === void 0 ? length : end;
  2543. return !start && end >= length ? array : baseSlice(array, start, end);
  2544. }
  2545. var rsAstralRange$3 = "\\ud800-\\udfff";
  2546. var rsComboMarksRange$4 = "\\u0300-\\u036f";
  2547. var reComboHalfMarksRange$4 = "\\ufe20-\\ufe2f";
  2548. var rsComboSymbolsRange$4 = "\\u20d0-\\u20ff";
  2549. var rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4;
  2550. var rsVarRange$3 = "\\ufe0e\\ufe0f";
  2551. var rsZWJ$3 = "\\u200d";
  2552. var reHasUnicode = RegExp("[" + rsZWJ$3 + rsAstralRange$3 + rsComboRange$4 + rsVarRange$3 + "]");
  2553. function hasUnicode(string) {
  2554. return reHasUnicode.test(string);
  2555. }
  2556. function asciiToArray(string) {
  2557. return string.split("");
  2558. }
  2559. var rsAstralRange$2 = "\\ud800-\\udfff";
  2560. var rsComboMarksRange$3 = "\\u0300-\\u036f";
  2561. var reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f";
  2562. var rsComboSymbolsRange$3 = "\\u20d0-\\u20ff";
  2563. var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
  2564. var rsVarRange$2 = "\\ufe0e\\ufe0f";
  2565. var rsAstral$1 = "[" + rsAstralRange$2 + "]";
  2566. var rsCombo$3 = "[" + rsComboRange$3 + "]";
  2567. var rsFitz$2 = "\\ud83c[\\udffb-\\udfff]";
  2568. var rsModifier$2 = "(?:" + rsCombo$3 + "|" + rsFitz$2 + ")";
  2569. var rsNonAstral$2 = "[^" + rsAstralRange$2 + "]";
  2570. var rsRegional$2 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2571. var rsSurrPair$2 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2572. var rsZWJ$2 = "\\u200d";
  2573. var reOptMod$2 = rsModifier$2 + "?";
  2574. var rsOptVar$2 = "[" + rsVarRange$2 + "]?";
  2575. var rsOptJoin$2 = "(?:" + rsZWJ$2 + "(?:" + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join("|") + ")" + rsOptVar$2 + reOptMod$2 + ")*";
  2576. var rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2;
  2577. var rsSymbol$1 = "(?:" + [rsNonAstral$2 + rsCombo$3 + "?", rsCombo$3, rsRegional$2, rsSurrPair$2, rsAstral$1].join("|") + ")";
  2578. var reUnicode$1 = RegExp(rsFitz$2 + "(?=" + rsFitz$2 + ")|" + rsSymbol$1 + rsSeq$2, "g");
  2579. function unicodeToArray(string) {
  2580. return string.match(reUnicode$1) || [];
  2581. }
  2582. function stringToArray(string) {
  2583. return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
  2584. }
  2585. function createCaseFirst(methodName) {
  2586. return function(string) {
  2587. string = toString(string);
  2588. var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0;
  2589. var chr = strSymbols ? strSymbols[0] : string.charAt(0);
  2590. var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
  2591. return chr[methodName]() + trailing;
  2592. };
  2593. }
  2594. var upperFirst = createCaseFirst("toUpperCase");
  2595. function capitalize$1(string) {
  2596. return upperFirst(toString(string).toLowerCase());
  2597. }
  2598. function arrayReduce(array, iteratee, accumulator, initAccum) {
  2599. var index = -1, length = array == null ? 0 : array.length;
  2600. if (initAccum && length) {
  2601. accumulator = array[++index];
  2602. }
  2603. while (++index < length) {
  2604. accumulator = iteratee(accumulator, array[index], index, array);
  2605. }
  2606. return accumulator;
  2607. }
  2608. function basePropertyOf(object) {
  2609. return function(key) {
  2610. return object == null ? void 0 : object[key];
  2611. };
  2612. }
  2613. var deburredLetters = {
  2614. "\xC0": "A",
  2615. "\xC1": "A",
  2616. "\xC2": "A",
  2617. "\xC3": "A",
  2618. "\xC4": "A",
  2619. "\xC5": "A",
  2620. "\xE0": "a",
  2621. "\xE1": "a",
  2622. "\xE2": "a",
  2623. "\xE3": "a",
  2624. "\xE4": "a",
  2625. "\xE5": "a",
  2626. "\xC7": "C",
  2627. "\xE7": "c",
  2628. "\xD0": "D",
  2629. "\xF0": "d",
  2630. "\xC8": "E",
  2631. "\xC9": "E",
  2632. "\xCA": "E",
  2633. "\xCB": "E",
  2634. "\xE8": "e",
  2635. "\xE9": "e",
  2636. "\xEA": "e",
  2637. "\xEB": "e",
  2638. "\xCC": "I",
  2639. "\xCD": "I",
  2640. "\xCE": "I",
  2641. "\xCF": "I",
  2642. "\xEC": "i",
  2643. "\xED": "i",
  2644. "\xEE": "i",
  2645. "\xEF": "i",
  2646. "\xD1": "N",
  2647. "\xF1": "n",
  2648. "\xD2": "O",
  2649. "\xD3": "O",
  2650. "\xD4": "O",
  2651. "\xD5": "O",
  2652. "\xD6": "O",
  2653. "\xD8": "O",
  2654. "\xF2": "o",
  2655. "\xF3": "o",
  2656. "\xF4": "o",
  2657. "\xF5": "o",
  2658. "\xF6": "o",
  2659. "\xF8": "o",
  2660. "\xD9": "U",
  2661. "\xDA": "U",
  2662. "\xDB": "U",
  2663. "\xDC": "U",
  2664. "\xF9": "u",
  2665. "\xFA": "u",
  2666. "\xFB": "u",
  2667. "\xFC": "u",
  2668. "\xDD": "Y",
  2669. "\xFD": "y",
  2670. "\xFF": "y",
  2671. "\xC6": "Ae",
  2672. "\xE6": "ae",
  2673. "\xDE": "Th",
  2674. "\xFE": "th",
  2675. "\xDF": "ss",
  2676. "\u0100": "A",
  2677. "\u0102": "A",
  2678. "\u0104": "A",
  2679. "\u0101": "a",
  2680. "\u0103": "a",
  2681. "\u0105": "a",
  2682. "\u0106": "C",
  2683. "\u0108": "C",
  2684. "\u010A": "C",
  2685. "\u010C": "C",
  2686. "\u0107": "c",
  2687. "\u0109": "c",
  2688. "\u010B": "c",
  2689. "\u010D": "c",
  2690. "\u010E": "D",
  2691. "\u0110": "D",
  2692. "\u010F": "d",
  2693. "\u0111": "d",
  2694. "\u0112": "E",
  2695. "\u0114": "E",
  2696. "\u0116": "E",
  2697. "\u0118": "E",
  2698. "\u011A": "E",
  2699. "\u0113": "e",
  2700. "\u0115": "e",
  2701. "\u0117": "e",
  2702. "\u0119": "e",
  2703. "\u011B": "e",
  2704. "\u011C": "G",
  2705. "\u011E": "G",
  2706. "\u0120": "G",
  2707. "\u0122": "G",
  2708. "\u011D": "g",
  2709. "\u011F": "g",
  2710. "\u0121": "g",
  2711. "\u0123": "g",
  2712. "\u0124": "H",
  2713. "\u0126": "H",
  2714. "\u0125": "h",
  2715. "\u0127": "h",
  2716. "\u0128": "I",
  2717. "\u012A": "I",
  2718. "\u012C": "I",
  2719. "\u012E": "I",
  2720. "\u0130": "I",
  2721. "\u0129": "i",
  2722. "\u012B": "i",
  2723. "\u012D": "i",
  2724. "\u012F": "i",
  2725. "\u0131": "i",
  2726. "\u0134": "J",
  2727. "\u0135": "j",
  2728. "\u0136": "K",
  2729. "\u0137": "k",
  2730. "\u0138": "k",
  2731. "\u0139": "L",
  2732. "\u013B": "L",
  2733. "\u013D": "L",
  2734. "\u013F": "L",
  2735. "\u0141": "L",
  2736. "\u013A": "l",
  2737. "\u013C": "l",
  2738. "\u013E": "l",
  2739. "\u0140": "l",
  2740. "\u0142": "l",
  2741. "\u0143": "N",
  2742. "\u0145": "N",
  2743. "\u0147": "N",
  2744. "\u014A": "N",
  2745. "\u0144": "n",
  2746. "\u0146": "n",
  2747. "\u0148": "n",
  2748. "\u014B": "n",
  2749. "\u014C": "O",
  2750. "\u014E": "O",
  2751. "\u0150": "O",
  2752. "\u014D": "o",
  2753. "\u014F": "o",
  2754. "\u0151": "o",
  2755. "\u0154": "R",
  2756. "\u0156": "R",
  2757. "\u0158": "R",
  2758. "\u0155": "r",
  2759. "\u0157": "r",
  2760. "\u0159": "r",
  2761. "\u015A": "S",
  2762. "\u015C": "S",
  2763. "\u015E": "S",
  2764. "\u0160": "S",
  2765. "\u015B": "s",
  2766. "\u015D": "s",
  2767. "\u015F": "s",
  2768. "\u0161": "s",
  2769. "\u0162": "T",
  2770. "\u0164": "T",
  2771. "\u0166": "T",
  2772. "\u0163": "t",
  2773. "\u0165": "t",
  2774. "\u0167": "t",
  2775. "\u0168": "U",
  2776. "\u016A": "U",
  2777. "\u016C": "U",
  2778. "\u016E": "U",
  2779. "\u0170": "U",
  2780. "\u0172": "U",
  2781. "\u0169": "u",
  2782. "\u016B": "u",
  2783. "\u016D": "u",
  2784. "\u016F": "u",
  2785. "\u0171": "u",
  2786. "\u0173": "u",
  2787. "\u0174": "W",
  2788. "\u0175": "w",
  2789. "\u0176": "Y",
  2790. "\u0177": "y",
  2791. "\u0178": "Y",
  2792. "\u0179": "Z",
  2793. "\u017B": "Z",
  2794. "\u017D": "Z",
  2795. "\u017A": "z",
  2796. "\u017C": "z",
  2797. "\u017E": "z",
  2798. "\u0132": "IJ",
  2799. "\u0133": "ij",
  2800. "\u0152": "Oe",
  2801. "\u0153": "oe",
  2802. "\u0149": "'n",
  2803. "\u017F": "s"
  2804. };
  2805. var deburrLetter = basePropertyOf(deburredLetters);
  2806. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  2807. var rsComboMarksRange$2 = "\\u0300-\\u036f";
  2808. var reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f";
  2809. var rsComboSymbolsRange$2 = "\\u20d0-\\u20ff";
  2810. var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
  2811. var rsCombo$2 = "[" + rsComboRange$2 + "]";
  2812. var reComboMark = RegExp(rsCombo$2, "g");
  2813. function deburr(string) {
  2814. string = toString(string);
  2815. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
  2816. }
  2817. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  2818. function asciiWords(string) {
  2819. return string.match(reAsciiWord) || [];
  2820. }
  2821. var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
  2822. function hasUnicodeWord(string) {
  2823. return reHasUnicodeWord.test(string);
  2824. }
  2825. var rsAstralRange$1 = "\\ud800-\\udfff";
  2826. var rsComboMarksRange$1 = "\\u0300-\\u036f";
  2827. var reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f";
  2828. var rsComboSymbolsRange$1 = "\\u20d0-\\u20ff";
  2829. var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
  2830. var rsDingbatRange = "\\u2700-\\u27bf";
  2831. var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
  2832. var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
  2833. var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
  2834. var rsPunctuationRange = "\\u2000-\\u206f";
  2835. var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
  2836. var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
  2837. var rsVarRange$1 = "\\ufe0e\\ufe0f";
  2838. var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  2839. var rsApos$1 = "['\u2019]";
  2840. var rsBreak = "[" + rsBreakRange + "]";
  2841. var rsCombo$1 = "[" + rsComboRange$1 + "]";
  2842. var rsDigits = "\\d+";
  2843. var rsDingbat = "[" + rsDingbatRange + "]";
  2844. var rsLower = "[" + rsLowerRange + "]";
  2845. var rsMisc = "[^" + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
  2846. var rsFitz$1 = "\\ud83c[\\udffb-\\udfff]";
  2847. var rsModifier$1 = "(?:" + rsCombo$1 + "|" + rsFitz$1 + ")";
  2848. var rsNonAstral$1 = "[^" + rsAstralRange$1 + "]";
  2849. var rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2850. var rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2851. var rsUpper = "[" + rsUpperRange + "]";
  2852. var rsZWJ$1 = "\\u200d";
  2853. var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
  2854. var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
  2855. var rsOptContrLower = "(?:" + rsApos$1 + "(?:d|ll|m|re|s|t|ve))?";
  2856. var rsOptContrUpper = "(?:" + rsApos$1 + "(?:D|LL|M|RE|S|T|VE))?";
  2857. var reOptMod$1 = rsModifier$1 + "?";
  2858. var rsOptVar$1 = "[" + rsVarRange$1 + "]?";
  2859. var rsOptJoin$1 = "(?:" + rsZWJ$1 + "(?:" + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsOptVar$1 + reOptMod$1 + ")*";
  2860. var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
  2861. var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
  2862. var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1;
  2863. var rsEmoji = "(?:" + [rsDingbat, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsSeq$1;
  2864. var reUnicodeWord = RegExp([
  2865. rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
  2866. rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
  2867. rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
  2868. rsUpper + "+" + rsOptContrUpper,
  2869. rsOrdUpper,
  2870. rsOrdLower,
  2871. rsDigits,
  2872. rsEmoji
  2873. ].join("|"), "g");
  2874. function unicodeWords(string) {
  2875. return string.match(reUnicodeWord) || [];
  2876. }
  2877. function words(string, pattern, guard) {
  2878. string = toString(string);
  2879. pattern = guard ? void 0 : pattern;
  2880. if (pattern === void 0) {
  2881. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  2882. }
  2883. return string.match(pattern) || [];
  2884. }
  2885. var rsApos = "['\u2019]";
  2886. var reApos = RegExp(rsApos, "g");
  2887. function createCompounder(callback) {
  2888. return function(string) {
  2889. return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
  2890. };
  2891. }
  2892. var camelCase = createCompounder(function(result, word, index) {
  2893. word = word.toLowerCase();
  2894. return result + (index ? capitalize$1(word) : word);
  2895. });
  2896. function castArray$1() {
  2897. if (!arguments.length) {
  2898. return [];
  2899. }
  2900. var value = arguments[0];
  2901. return isArray(value) ? value : [value];
  2902. }
  2903. var nativeIsFinite$1 = root.isFinite;
  2904. var nativeMin$c = Math.min;
  2905. function createRound(methodName) {
  2906. var func = Math[methodName];
  2907. return function(number, precision) {
  2908. number = toNumber(number);
  2909. precision = precision == null ? 0 : nativeMin$c(toInteger(precision), 292);
  2910. if (precision && nativeIsFinite$1(number)) {
  2911. var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
  2912. pair = (toString(value) + "e").split("e");
  2913. return +(pair[0] + "e" + (+pair[1] - precision));
  2914. }
  2915. return func(number);
  2916. };
  2917. }
  2918. var ceil = createRound("ceil");
  2919. function chain(value) {
  2920. var result = lodash(value);
  2921. result.__chain__ = true;
  2922. return result;
  2923. }
  2924. var nativeCeil$3 = Math.ceil;
  2925. var nativeMax$c = Math.max;
  2926. function chunk(array, size, guard) {
  2927. if (guard ? isIterateeCall(array, size, guard) : size === void 0) {
  2928. size = 1;
  2929. } else {
  2930. size = nativeMax$c(toInteger(size), 0);
  2931. }
  2932. var length = array == null ? 0 : array.length;
  2933. if (!length || size < 1) {
  2934. return [];
  2935. }
  2936. var index = 0, resIndex = 0, result = Array(nativeCeil$3(length / size));
  2937. while (index < length) {
  2938. result[resIndex++] = baseSlice(array, index, index += size);
  2939. }
  2940. return result;
  2941. }
  2942. function baseClamp(number, lower, upper) {
  2943. if (number === number) {
  2944. if (upper !== void 0) {
  2945. number = number <= upper ? number : upper;
  2946. }
  2947. if (lower !== void 0) {
  2948. number = number >= lower ? number : lower;
  2949. }
  2950. }
  2951. return number;
  2952. }
  2953. function clamp$1(number, lower, upper) {
  2954. if (upper === void 0) {
  2955. upper = lower;
  2956. lower = void 0;
  2957. }
  2958. if (upper !== void 0) {
  2959. upper = toNumber(upper);
  2960. upper = upper === upper ? upper : 0;
  2961. }
  2962. if (lower !== void 0) {
  2963. lower = toNumber(lower);
  2964. lower = lower === lower ? lower : 0;
  2965. }
  2966. return baseClamp(toNumber(number), lower, upper);
  2967. }
  2968. function stackClear() {
  2969. this.__data__ = new ListCache();
  2970. this.size = 0;
  2971. }
  2972. function stackDelete(key) {
  2973. var data = this.__data__, result = data["delete"](key);
  2974. this.size = data.size;
  2975. return result;
  2976. }
  2977. function stackGet(key) {
  2978. return this.__data__.get(key);
  2979. }
  2980. function stackHas(key) {
  2981. return this.__data__.has(key);
  2982. }
  2983. var LARGE_ARRAY_SIZE$2 = 200;
  2984. function stackSet(key, value) {
  2985. var data = this.__data__;
  2986. if (data instanceof ListCache) {
  2987. var pairs = data.__data__;
  2988. if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) {
  2989. pairs.push([key, value]);
  2990. this.size = ++data.size;
  2991. return this;
  2992. }
  2993. data = this.__data__ = new MapCache(pairs);
  2994. }
  2995. data.set(key, value);
  2996. this.size = data.size;
  2997. return this;
  2998. }
  2999. function Stack(entries) {
  3000. var data = this.__data__ = new ListCache(entries);
  3001. this.size = data.size;
  3002. }
  3003. Stack.prototype.clear = stackClear;
  3004. Stack.prototype["delete"] = stackDelete;
  3005. Stack.prototype.get = stackGet;
  3006. Stack.prototype.has = stackHas;
  3007. Stack.prototype.set = stackSet;
  3008. function baseAssign(object, source) {
  3009. return object && copyObject(source, keys(source), object);
  3010. }
  3011. function baseAssignIn(object, source) {
  3012. return object && copyObject(source, keysIn(source), object);
  3013. }
  3014. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  3015. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  3016. var moduleExports = freeModule && freeModule.exports === freeExports;
  3017. var Buffer = moduleExports ? root.Buffer : void 0;
  3018. var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
  3019. function cloneBuffer(buffer, isDeep) {
  3020. if (isDeep) {
  3021. return buffer.slice();
  3022. }
  3023. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  3024. buffer.copy(result);
  3025. return result;
  3026. }
  3027. function arrayFilter(array, predicate) {
  3028. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  3029. while (++index < length) {
  3030. var value = array[index];
  3031. if (predicate(value, index, array)) {
  3032. result[resIndex++] = value;
  3033. }
  3034. }
  3035. return result;
  3036. }
  3037. function stubArray() {
  3038. return [];
  3039. }
  3040. var objectProto$d = Object.prototype;
  3041. var propertyIsEnumerable = objectProto$d.propertyIsEnumerable;
  3042. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  3043. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
  3044. if (object == null) {
  3045. return [];
  3046. }
  3047. object = Object(object);
  3048. return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
  3049. return propertyIsEnumerable.call(object, symbol);
  3050. });
  3051. };
  3052. function copySymbols(source, object) {
  3053. return copyObject(source, getSymbols(source), object);
  3054. }
  3055. var nativeGetSymbols = Object.getOwnPropertySymbols;
  3056. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  3057. var result = [];
  3058. while (object) {
  3059. arrayPush(result, getSymbols(object));
  3060. object = getPrototype(object);
  3061. }
  3062. return result;
  3063. };
  3064. function copySymbolsIn(source, object) {
  3065. return copyObject(source, getSymbolsIn(source), object);
  3066. }
  3067. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  3068. var result = keysFunc(object);
  3069. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  3070. }
  3071. function getAllKeys(object) {
  3072. return baseGetAllKeys(object, keys, getSymbols);
  3073. }
  3074. function getAllKeysIn(object) {
  3075. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  3076. }
  3077. var DataView = getNative(root, "DataView");
  3078. var Promise$1 = getNative(root, "Promise");
  3079. var Set$1 = getNative(root, "Set");
  3080. var mapTag$8 = "[object Map]";
  3081. var objectTag$2 = "[object Object]";
  3082. var promiseTag = "[object Promise]";
  3083. var setTag$8 = "[object Set]";
  3084. var weakMapTag$2 = "[object WeakMap]";
  3085. var dataViewTag$3 = "[object DataView]";
  3086. var dataViewCtorString = toSource(DataView);
  3087. var mapCtorString = toSource(Map$1);
  3088. var promiseCtorString = toSource(Promise$1);
  3089. var setCtorString = toSource(Set$1);
  3090. var weakMapCtorString = toSource(WeakMap$1);
  3091. var getTag = baseGetTag;
  3092. if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$8 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$8 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$2) {
  3093. getTag = function(value) {
  3094. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  3095. if (ctorString) {
  3096. switch (ctorString) {
  3097. case dataViewCtorString:
  3098. return dataViewTag$3;
  3099. case mapCtorString:
  3100. return mapTag$8;
  3101. case promiseCtorString:
  3102. return promiseTag;
  3103. case setCtorString:
  3104. return setTag$8;
  3105. case weakMapCtorString:
  3106. return weakMapTag$2;
  3107. }
  3108. }
  3109. return result;
  3110. };
  3111. }
  3112. var getTag$1 = getTag;
  3113. var objectProto$c = Object.prototype;
  3114. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  3115. function initCloneArray(array) {
  3116. var length = array.length, result = new array.constructor(length);
  3117. if (length && typeof array[0] == "string" && hasOwnProperty$b.call(array, "index")) {
  3118. result.index = array.index;
  3119. result.input = array.input;
  3120. }
  3121. return result;
  3122. }
  3123. var Uint8Array = root.Uint8Array;
  3124. function cloneArrayBuffer(arrayBuffer) {
  3125. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  3126. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  3127. return result;
  3128. }
  3129. function cloneDataView(dataView, isDeep) {
  3130. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  3131. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  3132. }
  3133. var reFlags$1 = /\w*$/;
  3134. function cloneRegExp(regexp) {
  3135. var result = new regexp.constructor(regexp.source, reFlags$1.exec(regexp));
  3136. result.lastIndex = regexp.lastIndex;
  3137. return result;
  3138. }
  3139. var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0;
  3140. var symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  3141. function cloneSymbol(symbol) {
  3142. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  3143. }
  3144. function cloneTypedArray(typedArray, isDeep) {
  3145. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  3146. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  3147. }
  3148. var boolTag$3 = "[object Boolean]";
  3149. var dateTag$3 = "[object Date]";
  3150. var mapTag$7 = "[object Map]";
  3151. var numberTag$3 = "[object Number]";
  3152. var regexpTag$3 = "[object RegExp]";
  3153. var setTag$7 = "[object Set]";
  3154. var stringTag$3 = "[object String]";
  3155. var symbolTag$2 = "[object Symbol]";
  3156. var arrayBufferTag$3 = "[object ArrayBuffer]";
  3157. var dataViewTag$2 = "[object DataView]";
  3158. var float32Tag$1 = "[object Float32Array]";
  3159. var float64Tag$1 = "[object Float64Array]";
  3160. var int8Tag$1 = "[object Int8Array]";
  3161. var int16Tag$1 = "[object Int16Array]";
  3162. var int32Tag$1 = "[object Int32Array]";
  3163. var uint8Tag$1 = "[object Uint8Array]";
  3164. var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
  3165. var uint16Tag$1 = "[object Uint16Array]";
  3166. var uint32Tag$1 = "[object Uint32Array]";
  3167. function initCloneByTag(object, tag, isDeep) {
  3168. var Ctor = object.constructor;
  3169. switch (tag) {
  3170. case arrayBufferTag$3:
  3171. return cloneArrayBuffer(object);
  3172. case boolTag$3:
  3173. case dateTag$3:
  3174. return new Ctor(+object);
  3175. case dataViewTag$2:
  3176. return cloneDataView(object, isDeep);
  3177. case float32Tag$1:
  3178. case float64Tag$1:
  3179. case int8Tag$1:
  3180. case int16Tag$1:
  3181. case int32Tag$1:
  3182. case uint8Tag$1:
  3183. case uint8ClampedTag$1:
  3184. case uint16Tag$1:
  3185. case uint32Tag$1:
  3186. return cloneTypedArray(object, isDeep);
  3187. case mapTag$7:
  3188. return new Ctor();
  3189. case numberTag$3:
  3190. case stringTag$3:
  3191. return new Ctor(object);
  3192. case regexpTag$3:
  3193. return cloneRegExp(object);
  3194. case setTag$7:
  3195. return new Ctor();
  3196. case symbolTag$2:
  3197. return cloneSymbol(object);
  3198. }
  3199. }
  3200. function initCloneObject(object) {
  3201. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
  3202. }
  3203. var mapTag$6 = "[object Map]";
  3204. function baseIsMap(value) {
  3205. return isObjectLike(value) && getTag$1(value) == mapTag$6;
  3206. }
  3207. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  3208. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  3209. var setTag$6 = "[object Set]";
  3210. function baseIsSet(value) {
  3211. return isObjectLike(value) && getTag$1(value) == setTag$6;
  3212. }
  3213. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  3214. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  3215. var CLONE_DEEP_FLAG$7 = 1;
  3216. var CLONE_FLAT_FLAG$1 = 2;
  3217. var CLONE_SYMBOLS_FLAG$5 = 4;
  3218. var argsTag$1 = "[object Arguments]";
  3219. var arrayTag$1 = "[object Array]";
  3220. var boolTag$2 = "[object Boolean]";
  3221. var dateTag$2 = "[object Date]";
  3222. var errorTag$1 = "[object Error]";
  3223. var funcTag = "[object Function]";
  3224. var genTag = "[object GeneratorFunction]";
  3225. var mapTag$5 = "[object Map]";
  3226. var numberTag$2 = "[object Number]";
  3227. var objectTag$1 = "[object Object]";
  3228. var regexpTag$2 = "[object RegExp]";
  3229. var setTag$5 = "[object Set]";
  3230. var stringTag$2 = "[object String]";
  3231. var symbolTag$1 = "[object Symbol]";
  3232. var weakMapTag$1 = "[object WeakMap]";
  3233. var arrayBufferTag$2 = "[object ArrayBuffer]";
  3234. var dataViewTag$1 = "[object DataView]";
  3235. var float32Tag = "[object Float32Array]";
  3236. var float64Tag = "[object Float64Array]";
  3237. var int8Tag = "[object Int8Array]";
  3238. var int16Tag = "[object Int16Array]";
  3239. var int32Tag = "[object Int32Array]";
  3240. var uint8Tag = "[object Uint8Array]";
  3241. var uint8ClampedTag = "[object Uint8ClampedArray]";
  3242. var uint16Tag = "[object Uint16Array]";
  3243. var uint32Tag = "[object Uint32Array]";
  3244. var cloneableTags = {};
  3245. cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$2] = cloneableTags[dateTag$2] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$5] = cloneableTags[numberTag$2] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$2] = cloneableTags[setTag$5] = cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  3246. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag$1] = false;
  3247. function baseClone(value, bitmask, customizer, key, object, stack) {
  3248. var result, isDeep = bitmask & CLONE_DEEP_FLAG$7, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$5;
  3249. if (customizer) {
  3250. result = object ? customizer(value, key, object, stack) : customizer(value);
  3251. }
  3252. if (result !== void 0) {
  3253. return result;
  3254. }
  3255. if (!isObject(value)) {
  3256. return value;
  3257. }
  3258. var isArr = isArray(value);
  3259. if (isArr) {
  3260. result = initCloneArray(value);
  3261. if (!isDeep) {
  3262. return copyArray(value, result);
  3263. }
  3264. } else {
  3265. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  3266. if (isBuffer(value)) {
  3267. return cloneBuffer(value, isDeep);
  3268. }
  3269. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
  3270. result = isFlat || isFunc ? {} : initCloneObject(value);
  3271. if (!isDeep) {
  3272. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  3273. }
  3274. } else {
  3275. if (!cloneableTags[tag]) {
  3276. return object ? value : {};
  3277. }
  3278. result = initCloneByTag(value, tag, isDeep);
  3279. }
  3280. }
  3281. stack || (stack = new Stack());
  3282. var stacked = stack.get(value);
  3283. if (stacked) {
  3284. return stacked;
  3285. }
  3286. stack.set(value, result);
  3287. if (isSet(value)) {
  3288. value.forEach(function(subValue) {
  3289. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  3290. });
  3291. } else if (isMap(value)) {
  3292. value.forEach(function(subValue, key2) {
  3293. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  3294. });
  3295. }
  3296. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  3297. var props = isArr ? void 0 : keysFunc(value);
  3298. arrayEach(props || value, function(subValue, key2) {
  3299. if (props) {
  3300. key2 = subValue;
  3301. subValue = value[key2];
  3302. }
  3303. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  3304. });
  3305. return result;
  3306. }
  3307. var CLONE_SYMBOLS_FLAG$4 = 4;
  3308. function clone(value) {
  3309. return baseClone(value, CLONE_SYMBOLS_FLAG$4);
  3310. }
  3311. var CLONE_DEEP_FLAG$6 = 1;
  3312. var CLONE_SYMBOLS_FLAG$3 = 4;
  3313. function cloneDeep(value) {
  3314. return baseClone(value, CLONE_DEEP_FLAG$6 | CLONE_SYMBOLS_FLAG$3);
  3315. }
  3316. var CLONE_DEEP_FLAG$5 = 1;
  3317. var CLONE_SYMBOLS_FLAG$2 = 4;
  3318. function cloneDeepWith(value, customizer) {
  3319. customizer = typeof customizer == "function" ? customizer : void 0;
  3320. return baseClone(value, CLONE_DEEP_FLAG$5 | CLONE_SYMBOLS_FLAG$2, customizer);
  3321. }
  3322. var CLONE_SYMBOLS_FLAG$1 = 4;
  3323. function cloneWith(value, customizer) {
  3324. customizer = typeof customizer == "function" ? customizer : void 0;
  3325. return baseClone(value, CLONE_SYMBOLS_FLAG$1, customizer);
  3326. }
  3327. function wrapperCommit() {
  3328. return new LodashWrapper(this.value(), this.__chain__);
  3329. }
  3330. function compact(array) {
  3331. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  3332. while (++index < length) {
  3333. var value = array[index];
  3334. if (value) {
  3335. result[resIndex++] = value;
  3336. }
  3337. }
  3338. return result;
  3339. }
  3340. function concat() {
  3341. var length = arguments.length;
  3342. if (!length) {
  3343. return [];
  3344. }
  3345. var args = Array(length - 1), array = arguments[0], index = length;
  3346. while (index--) {
  3347. args[index - 1] = arguments[index];
  3348. }
  3349. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  3350. }
  3351. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  3352. function setCacheAdd(value) {
  3353. this.__data__.set(value, HASH_UNDEFINED);
  3354. return this;
  3355. }
  3356. function setCacheHas(value) {
  3357. return this.__data__.has(value);
  3358. }
  3359. function SetCache(values) {
  3360. var index = -1, length = values == null ? 0 : values.length;
  3361. this.__data__ = new MapCache();
  3362. while (++index < length) {
  3363. this.add(values[index]);
  3364. }
  3365. }
  3366. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3367. SetCache.prototype.has = setCacheHas;
  3368. function arraySome(array, predicate) {
  3369. var index = -1, length = array == null ? 0 : array.length;
  3370. while (++index < length) {
  3371. if (predicate(array[index], index, array)) {
  3372. return true;
  3373. }
  3374. }
  3375. return false;
  3376. }
  3377. function cacheHas(cache, key) {
  3378. return cache.has(key);
  3379. }
  3380. var COMPARE_PARTIAL_FLAG$5 = 1;
  3381. var COMPARE_UNORDERED_FLAG$3 = 2;
  3382. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  3383. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  3384. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  3385. return false;
  3386. }
  3387. var arrStacked = stack.get(array);
  3388. var othStacked = stack.get(other);
  3389. if (arrStacked && othStacked) {
  3390. return arrStacked == other && othStacked == array;
  3391. }
  3392. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  3393. stack.set(array, other);
  3394. stack.set(other, array);
  3395. while (++index < arrLength) {
  3396. var arrValue = array[index], othValue = other[index];
  3397. if (customizer) {
  3398. var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  3399. }
  3400. if (compared !== void 0) {
  3401. if (compared) {
  3402. continue;
  3403. }
  3404. result = false;
  3405. break;
  3406. }
  3407. if (seen) {
  3408. if (!arraySome(other, function(othValue2, othIndex) {
  3409. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  3410. return seen.push(othIndex);
  3411. }
  3412. })) {
  3413. result = false;
  3414. break;
  3415. }
  3416. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  3417. result = false;
  3418. break;
  3419. }
  3420. }
  3421. stack["delete"](array);
  3422. stack["delete"](other);
  3423. return result;
  3424. }
  3425. function mapToArray(map) {
  3426. var index = -1, result = Array(map.size);
  3427. map.forEach(function(value, key) {
  3428. result[++index] = [key, value];
  3429. });
  3430. return result;
  3431. }
  3432. function setToArray(set) {
  3433. var index = -1, result = Array(set.size);
  3434. set.forEach(function(value) {
  3435. result[++index] = value;
  3436. });
  3437. return result;
  3438. }
  3439. var COMPARE_PARTIAL_FLAG$4 = 1;
  3440. var COMPARE_UNORDERED_FLAG$2 = 2;
  3441. var boolTag$1 = "[object Boolean]";
  3442. var dateTag$1 = "[object Date]";
  3443. var errorTag = "[object Error]";
  3444. var mapTag$4 = "[object Map]";
  3445. var numberTag$1 = "[object Number]";
  3446. var regexpTag$1 = "[object RegExp]";
  3447. var setTag$4 = "[object Set]";
  3448. var stringTag$1 = "[object String]";
  3449. var symbolTag = "[object Symbol]";
  3450. var arrayBufferTag$1 = "[object ArrayBuffer]";
  3451. var dataViewTag = "[object DataView]";
  3452. var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
  3453. var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  3454. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  3455. switch (tag) {
  3456. case dataViewTag:
  3457. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  3458. return false;
  3459. }
  3460. object = object.buffer;
  3461. other = other.buffer;
  3462. case arrayBufferTag$1:
  3463. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  3464. return false;
  3465. }
  3466. return true;
  3467. case boolTag$1:
  3468. case dateTag$1:
  3469. case numberTag$1:
  3470. return eq(+object, +other);
  3471. case errorTag:
  3472. return object.name == other.name && object.message == other.message;
  3473. case regexpTag$1:
  3474. case stringTag$1:
  3475. return object == other + "";
  3476. case mapTag$4:
  3477. var convert = mapToArray;
  3478. case setTag$4:
  3479. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  3480. convert || (convert = setToArray);
  3481. if (object.size != other.size && !isPartial) {
  3482. return false;
  3483. }
  3484. var stacked = stack.get(object);
  3485. if (stacked) {
  3486. return stacked == other;
  3487. }
  3488. bitmask |= COMPARE_UNORDERED_FLAG$2;
  3489. stack.set(object, other);
  3490. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  3491. stack["delete"](object);
  3492. return result;
  3493. case symbolTag:
  3494. if (symbolValueOf) {
  3495. return symbolValueOf.call(object) == symbolValueOf.call(other);
  3496. }
  3497. }
  3498. return false;
  3499. }
  3500. var COMPARE_PARTIAL_FLAG$3 = 1;
  3501. var objectProto$b = Object.prototype;
  3502. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  3503. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  3504. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  3505. if (objLength != othLength && !isPartial) {
  3506. return false;
  3507. }
  3508. var index = objLength;
  3509. while (index--) {
  3510. var key = objProps[index];
  3511. if (!(isPartial ? key in other : hasOwnProperty$a.call(other, key))) {
  3512. return false;
  3513. }
  3514. }
  3515. var objStacked = stack.get(object);
  3516. var othStacked = stack.get(other);
  3517. if (objStacked && othStacked) {
  3518. return objStacked == other && othStacked == object;
  3519. }
  3520. var result = true;
  3521. stack.set(object, other);
  3522. stack.set(other, object);
  3523. var skipCtor = isPartial;
  3524. while (++index < objLength) {
  3525. key = objProps[index];
  3526. var objValue = object[key], othValue = other[key];
  3527. if (customizer) {
  3528. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  3529. }
  3530. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  3531. result = false;
  3532. break;
  3533. }
  3534. skipCtor || (skipCtor = key == "constructor");
  3535. }
  3536. if (result && !skipCtor) {
  3537. var objCtor = object.constructor, othCtor = other.constructor;
  3538. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  3539. result = false;
  3540. }
  3541. }
  3542. stack["delete"](object);
  3543. stack["delete"](other);
  3544. return result;
  3545. }
  3546. var COMPARE_PARTIAL_FLAG$2 = 1;
  3547. var argsTag = "[object Arguments]";
  3548. var arrayTag = "[object Array]";
  3549. var objectTag = "[object Object]";
  3550. var objectProto$a = Object.prototype;
  3551. var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
  3552. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3553. var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  3554. objTag = objTag == argsTag ? objectTag : objTag;
  3555. othTag = othTag == argsTag ? objectTag : othTag;
  3556. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  3557. if (isSameTag && isBuffer(object)) {
  3558. if (!isBuffer(other)) {
  3559. return false;
  3560. }
  3561. objIsArr = true;
  3562. objIsObj = false;
  3563. }
  3564. if (isSameTag && !objIsObj) {
  3565. stack || (stack = new Stack());
  3566. return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3567. }
  3568. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  3569. var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$9.call(other, "__wrapped__");
  3570. if (objIsWrapped || othIsWrapped) {
  3571. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  3572. stack || (stack = new Stack());
  3573. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3574. }
  3575. }
  3576. if (!isSameTag) {
  3577. return false;
  3578. }
  3579. stack || (stack = new Stack());
  3580. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3581. }
  3582. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3583. if (value === other) {
  3584. return true;
  3585. }
  3586. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  3587. return value !== value && other !== other;
  3588. }
  3589. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3590. }
  3591. var COMPARE_PARTIAL_FLAG$1 = 1;
  3592. var COMPARE_UNORDERED_FLAG$1 = 2;
  3593. function baseIsMatch(object, source, matchData, customizer) {
  3594. var index = matchData.length, length = index, noCustomizer = !customizer;
  3595. if (object == null) {
  3596. return !length;
  3597. }
  3598. object = Object(object);
  3599. while (index--) {
  3600. var data = matchData[index];
  3601. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
  3602. return false;
  3603. }
  3604. }
  3605. while (++index < length) {
  3606. data = matchData[index];
  3607. var key = data[0], objValue = object[key], srcValue = data[1];
  3608. if (noCustomizer && data[2]) {
  3609. if (objValue === void 0 && !(key in object)) {
  3610. return false;
  3611. }
  3612. } else {
  3613. var stack = new Stack();
  3614. if (customizer) {
  3615. var result = customizer(objValue, srcValue, key, object, source, stack);
  3616. }
  3617. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
  3618. return false;
  3619. }
  3620. }
  3621. }
  3622. return true;
  3623. }
  3624. function isStrictComparable(value) {
  3625. return value === value && !isObject(value);
  3626. }
  3627. function getMatchData(object) {
  3628. var result = keys(object), length = result.length;
  3629. while (length--) {
  3630. var key = result[length], value = object[key];
  3631. result[length] = [key, value, isStrictComparable(value)];
  3632. }
  3633. return result;
  3634. }
  3635. function matchesStrictComparable(key, srcValue) {
  3636. return function(object) {
  3637. if (object == null) {
  3638. return false;
  3639. }
  3640. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  3641. };
  3642. }
  3643. function baseMatches(source) {
  3644. var matchData = getMatchData(source);
  3645. if (matchData.length == 1 && matchData[0][2]) {
  3646. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  3647. }
  3648. return function(object) {
  3649. return object === source || baseIsMatch(object, source, matchData);
  3650. };
  3651. }
  3652. function baseHasIn(object, key) {
  3653. return object != null && key in Object(object);
  3654. }
  3655. function hasPath(object, path, hasFunc) {
  3656. path = castPath(path, object);
  3657. var index = -1, length = path.length, result = false;
  3658. while (++index < length) {
  3659. var key = toKey(path[index]);
  3660. if (!(result = object != null && hasFunc(object, key))) {
  3661. break;
  3662. }
  3663. object = object[key];
  3664. }
  3665. if (result || ++index != length) {
  3666. return result;
  3667. }
  3668. length = object == null ? 0 : object.length;
  3669. return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
  3670. }
  3671. function hasIn(object, path) {
  3672. return object != null && hasPath(object, path, baseHasIn);
  3673. }
  3674. var COMPARE_PARTIAL_FLAG = 1;
  3675. var COMPARE_UNORDERED_FLAG = 2;
  3676. function baseMatchesProperty(path, srcValue) {
  3677. if (isKey(path) && isStrictComparable(srcValue)) {
  3678. return matchesStrictComparable(toKey(path), srcValue);
  3679. }
  3680. return function(object) {
  3681. var objValue = get(object, path);
  3682. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  3683. };
  3684. }
  3685. function baseProperty(key) {
  3686. return function(object) {
  3687. return object == null ? void 0 : object[key];
  3688. };
  3689. }
  3690. function basePropertyDeep(path) {
  3691. return function(object) {
  3692. return baseGet(object, path);
  3693. };
  3694. }
  3695. function property(path) {
  3696. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  3697. }
  3698. function baseIteratee(value) {
  3699. if (typeof value == "function") {
  3700. return value;
  3701. }
  3702. if (value == null) {
  3703. return identity;
  3704. }
  3705. if (typeof value == "object") {
  3706. return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  3707. }
  3708. return property(value);
  3709. }
  3710. var FUNC_ERROR_TEXT$7 = "Expected a function";
  3711. function cond(pairs) {
  3712. var length = pairs == null ? 0 : pairs.length, toIteratee = baseIteratee;
  3713. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  3714. if (typeof pair[1] != "function") {
  3715. throw new TypeError(FUNC_ERROR_TEXT$7);
  3716. }
  3717. return [toIteratee(pair[0]), pair[1]];
  3718. });
  3719. return baseRest(function(args) {
  3720. var index = -1;
  3721. while (++index < length) {
  3722. var pair = pairs[index];
  3723. if (apply(pair[0], this, args)) {
  3724. return apply(pair[1], this, args);
  3725. }
  3726. }
  3727. });
  3728. }
  3729. function baseConformsTo(object, source, props) {
  3730. var length = props.length;
  3731. if (object == null) {
  3732. return !length;
  3733. }
  3734. object = Object(object);
  3735. while (length--) {
  3736. var key = props[length], predicate = source[key], value = object[key];
  3737. if (value === void 0 && !(key in object) || !predicate(value)) {
  3738. return false;
  3739. }
  3740. }
  3741. return true;
  3742. }
  3743. function baseConforms(source) {
  3744. var props = keys(source);
  3745. return function(object) {
  3746. return baseConformsTo(object, source, props);
  3747. };
  3748. }
  3749. var CLONE_DEEP_FLAG$4 = 1;
  3750. function conforms(source) {
  3751. return baseConforms(baseClone(source, CLONE_DEEP_FLAG$4));
  3752. }
  3753. function conformsTo(object, source) {
  3754. return source == null || baseConformsTo(object, source, keys(source));
  3755. }
  3756. function arrayAggregator(array, setter, iteratee, accumulator) {
  3757. var index = -1, length = array == null ? 0 : array.length;
  3758. while (++index < length) {
  3759. var value = array[index];
  3760. setter(accumulator, value, iteratee(value), array);
  3761. }
  3762. return accumulator;
  3763. }
  3764. function createBaseFor(fromRight) {
  3765. return function(object, iteratee, keysFunc) {
  3766. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  3767. while (length--) {
  3768. var key = props[fromRight ? length : ++index];
  3769. if (iteratee(iterable[key], key, iterable) === false) {
  3770. break;
  3771. }
  3772. }
  3773. return object;
  3774. };
  3775. }
  3776. var baseFor = createBaseFor();
  3777. function baseForOwn(object, iteratee) {
  3778. return object && baseFor(object, iteratee, keys);
  3779. }
  3780. function createBaseEach(eachFunc, fromRight) {
  3781. return function(collection, iteratee) {
  3782. if (collection == null) {
  3783. return collection;
  3784. }
  3785. if (!isArrayLike(collection)) {
  3786. return eachFunc(collection, iteratee);
  3787. }
  3788. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  3789. while (fromRight ? index-- : ++index < length) {
  3790. if (iteratee(iterable[index], index, iterable) === false) {
  3791. break;
  3792. }
  3793. }
  3794. return collection;
  3795. };
  3796. }
  3797. var baseEach = createBaseEach(baseForOwn);
  3798. function baseAggregator(collection, setter, iteratee, accumulator) {
  3799. baseEach(collection, function(value, key, collection2) {
  3800. setter(accumulator, value, iteratee(value), collection2);
  3801. });
  3802. return accumulator;
  3803. }
  3804. function createAggregator(setter, initializer) {
  3805. return function(collection, iteratee) {
  3806. var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
  3807. return func(collection, setter, baseIteratee(iteratee), accumulator);
  3808. };
  3809. }
  3810. var objectProto$9 = Object.prototype;
  3811. var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
  3812. var countBy = createAggregator(function(result, value, key) {
  3813. if (hasOwnProperty$8.call(result, key)) {
  3814. ++result[key];
  3815. } else {
  3816. baseAssignValue(result, key, 1);
  3817. }
  3818. });
  3819. function create(prototype, properties) {
  3820. var result = baseCreate(prototype);
  3821. return properties == null ? result : baseAssign(result, properties);
  3822. }
  3823. var WRAP_CURRY_FLAG$1 = 8;
  3824. function curry(func, arity, guard) {
  3825. arity = guard ? void 0 : arity;
  3826. var result = createWrap(func, WRAP_CURRY_FLAG$1, void 0, void 0, void 0, void 0, void 0, arity);
  3827. result.placeholder = curry.placeholder;
  3828. return result;
  3829. }
  3830. curry.placeholder = {};
  3831. var WRAP_CURRY_RIGHT_FLAG = 16;
  3832. function curryRight(func, arity, guard) {
  3833. arity = guard ? void 0 : arity;
  3834. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, void 0, void 0, void 0, void 0, void 0, arity);
  3835. result.placeholder = curryRight.placeholder;
  3836. return result;
  3837. }
  3838. curryRight.placeholder = {};
  3839. var now = function() {
  3840. return root.Date.now();
  3841. };
  3842. var FUNC_ERROR_TEXT$6 = "Expected a function";
  3843. var nativeMax$b = Math.max;
  3844. var nativeMin$b = Math.min;
  3845. function debounce(func, wait, options) {
  3846. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  3847. if (typeof func != "function") {
  3848. throw new TypeError(FUNC_ERROR_TEXT$6);
  3849. }
  3850. wait = toNumber(wait) || 0;
  3851. if (isObject(options)) {
  3852. leading = !!options.leading;
  3853. maxing = "maxWait" in options;
  3854. maxWait = maxing ? nativeMax$b(toNumber(options.maxWait) || 0, wait) : maxWait;
  3855. trailing = "trailing" in options ? !!options.trailing : trailing;
  3856. }
  3857. function invokeFunc(time) {
  3858. var args = lastArgs, thisArg = lastThis;
  3859. lastArgs = lastThis = void 0;
  3860. lastInvokeTime = time;
  3861. result = func.apply(thisArg, args);
  3862. return result;
  3863. }
  3864. function leadingEdge(time) {
  3865. lastInvokeTime = time;
  3866. timerId = setTimeout(timerExpired, wait);
  3867. return leading ? invokeFunc(time) : result;
  3868. }
  3869. function remainingWait(time) {
  3870. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  3871. return maxing ? nativeMin$b(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  3872. }
  3873. function shouldInvoke(time) {
  3874. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  3875. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  3876. }
  3877. function timerExpired() {
  3878. var time = now();
  3879. if (shouldInvoke(time)) {
  3880. return trailingEdge(time);
  3881. }
  3882. timerId = setTimeout(timerExpired, remainingWait(time));
  3883. }
  3884. function trailingEdge(time) {
  3885. timerId = void 0;
  3886. if (trailing && lastArgs) {
  3887. return invokeFunc(time);
  3888. }
  3889. lastArgs = lastThis = void 0;
  3890. return result;
  3891. }
  3892. function cancel() {
  3893. if (timerId !== void 0) {
  3894. clearTimeout(timerId);
  3895. }
  3896. lastInvokeTime = 0;
  3897. lastArgs = lastCallTime = lastThis = timerId = void 0;
  3898. }
  3899. function flush() {
  3900. return timerId === void 0 ? result : trailingEdge(now());
  3901. }
  3902. function debounced() {
  3903. var time = now(), isInvoking = shouldInvoke(time);
  3904. lastArgs = arguments;
  3905. lastThis = this;
  3906. lastCallTime = time;
  3907. if (isInvoking) {
  3908. if (timerId === void 0) {
  3909. return leadingEdge(lastCallTime);
  3910. }
  3911. if (maxing) {
  3912. clearTimeout(timerId);
  3913. timerId = setTimeout(timerExpired, wait);
  3914. return invokeFunc(lastCallTime);
  3915. }
  3916. }
  3917. if (timerId === void 0) {
  3918. timerId = setTimeout(timerExpired, wait);
  3919. }
  3920. return result;
  3921. }
  3922. debounced.cancel = cancel;
  3923. debounced.flush = flush;
  3924. return debounced;
  3925. }
  3926. function defaultTo(value, defaultValue) {
  3927. return value == null || value !== value ? defaultValue : value;
  3928. }
  3929. var objectProto$8 = Object.prototype;
  3930. var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
  3931. var defaults = baseRest(function(object, sources) {
  3932. object = Object(object);
  3933. var index = -1;
  3934. var length = sources.length;
  3935. var guard = length > 2 ? sources[2] : void 0;
  3936. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  3937. length = 1;
  3938. }
  3939. while (++index < length) {
  3940. var source = sources[index];
  3941. var props = keysIn(source);
  3942. var propsIndex = -1;
  3943. var propsLength = props.length;
  3944. while (++propsIndex < propsLength) {
  3945. var key = props[propsIndex];
  3946. var value = object[key];
  3947. if (value === void 0 || eq(value, objectProto$8[key]) && !hasOwnProperty$7.call(object, key)) {
  3948. object[key] = source[key];
  3949. }
  3950. }
  3951. }
  3952. return object;
  3953. });
  3954. function assignMergeValue(object, key, value) {
  3955. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
  3956. baseAssignValue(object, key, value);
  3957. }
  3958. }
  3959. function isArrayLikeObject(value) {
  3960. return isObjectLike(value) && isArrayLike(value);
  3961. }
  3962. function safeGet(object, key) {
  3963. if (key === "constructor" && typeof object[key] === "function") {
  3964. return;
  3965. }
  3966. if (key == "__proto__") {
  3967. return;
  3968. }
  3969. return object[key];
  3970. }
  3971. function toPlainObject(value) {
  3972. return copyObject(value, keysIn(value));
  3973. }
  3974. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  3975. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  3976. if (stacked) {
  3977. assignMergeValue(object, key, stacked);
  3978. return;
  3979. }
  3980. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  3981. var isCommon = newValue === void 0;
  3982. if (isCommon) {
  3983. var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  3984. newValue = srcValue;
  3985. if (isArr || isBuff || isTyped) {
  3986. if (isArray(objValue)) {
  3987. newValue = objValue;
  3988. } else if (isArrayLikeObject(objValue)) {
  3989. newValue = copyArray(objValue);
  3990. } else if (isBuff) {
  3991. isCommon = false;
  3992. newValue = cloneBuffer(srcValue, true);
  3993. } else if (isTyped) {
  3994. isCommon = false;
  3995. newValue = cloneTypedArray(srcValue, true);
  3996. } else {
  3997. newValue = [];
  3998. }
  3999. } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  4000. newValue = objValue;
  4001. if (isArguments(objValue)) {
  4002. newValue = toPlainObject(objValue);
  4003. } else if (!isObject(objValue) || isFunction(objValue)) {
  4004. newValue = initCloneObject(srcValue);
  4005. }
  4006. } else {
  4007. isCommon = false;
  4008. }
  4009. }
  4010. if (isCommon) {
  4011. stack.set(srcValue, newValue);
  4012. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  4013. stack["delete"](srcValue);
  4014. }
  4015. assignMergeValue(object, key, newValue);
  4016. }
  4017. function baseMerge(object, source, srcIndex, customizer, stack) {
  4018. if (object === source) {
  4019. return;
  4020. }
  4021. baseFor(source, function(srcValue, key) {
  4022. stack || (stack = new Stack());
  4023. if (isObject(srcValue)) {
  4024. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4025. } else {
  4026. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  4027. if (newValue === void 0) {
  4028. newValue = srcValue;
  4029. }
  4030. assignMergeValue(object, key, newValue);
  4031. }
  4032. }, keysIn);
  4033. }
  4034. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  4035. if (isObject(objValue) && isObject(srcValue)) {
  4036. stack.set(srcValue, objValue);
  4037. baseMerge(objValue, srcValue, void 0, customDefaultsMerge, stack);
  4038. stack["delete"](srcValue);
  4039. }
  4040. return objValue;
  4041. }
  4042. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  4043. baseMerge(object, source, srcIndex, customizer);
  4044. });
  4045. var defaultsDeep = baseRest(function(args) {
  4046. args.push(void 0, customDefaultsMerge);
  4047. return apply(mergeWith, void 0, args);
  4048. });
  4049. var FUNC_ERROR_TEXT$5 = "Expected a function";
  4050. function baseDelay(func, wait, args) {
  4051. if (typeof func != "function") {
  4052. throw new TypeError(FUNC_ERROR_TEXT$5);
  4053. }
  4054. return setTimeout(function() {
  4055. func.apply(void 0, args);
  4056. }, wait);
  4057. }
  4058. var defer = baseRest(function(func, args) {
  4059. return baseDelay(func, 1, args);
  4060. });
  4061. var delay = baseRest(function(func, wait, args) {
  4062. return baseDelay(func, toNumber(wait) || 0, args);
  4063. });
  4064. function arrayIncludesWith(array, value, comparator) {
  4065. var index = -1, length = array == null ? 0 : array.length;
  4066. while (++index < length) {
  4067. if (comparator(value, array[index])) {
  4068. return true;
  4069. }
  4070. }
  4071. return false;
  4072. }
  4073. var LARGE_ARRAY_SIZE$1 = 200;
  4074. function baseDifference(array, values, iteratee, comparator) {
  4075. var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
  4076. if (!length) {
  4077. return result;
  4078. }
  4079. if (iteratee) {
  4080. values = arrayMap(values, baseUnary(iteratee));
  4081. }
  4082. if (comparator) {
  4083. includes = arrayIncludesWith;
  4084. isCommon = false;
  4085. } else if (values.length >= LARGE_ARRAY_SIZE$1) {
  4086. includes = cacheHas;
  4087. isCommon = false;
  4088. values = new SetCache(values);
  4089. }
  4090. outer:
  4091. while (++index < length) {
  4092. var value = array[index], computed = iteratee == null ? value : iteratee(value);
  4093. value = comparator || value !== 0 ? value : 0;
  4094. if (isCommon && computed === computed) {
  4095. var valuesIndex = valuesLength;
  4096. while (valuesIndex--) {
  4097. if (values[valuesIndex] === computed) {
  4098. continue outer;
  4099. }
  4100. }
  4101. result.push(value);
  4102. } else if (!includes(values, computed, comparator)) {
  4103. result.push(value);
  4104. }
  4105. }
  4106. return result;
  4107. }
  4108. var difference = baseRest(function(array, values) {
  4109. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
  4110. });
  4111. function last(array) {
  4112. var length = array == null ? 0 : array.length;
  4113. return length ? array[length - 1] : void 0;
  4114. }
  4115. var differenceBy = baseRest(function(array, values) {
  4116. var iteratee = last(values);
  4117. if (isArrayLikeObject(iteratee)) {
  4118. iteratee = void 0;
  4119. }
  4120. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee)) : [];
  4121. });
  4122. var differenceWith = baseRest(function(array, values) {
  4123. var comparator = last(values);
  4124. if (isArrayLikeObject(comparator)) {
  4125. comparator = void 0;
  4126. }
  4127. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), void 0, comparator) : [];
  4128. });
  4129. var divide = createMathOperation(function(dividend, divisor) {
  4130. return dividend / divisor;
  4131. }, 1);
  4132. function drop(array, n, guard) {
  4133. var length = array == null ? 0 : array.length;
  4134. if (!length) {
  4135. return [];
  4136. }
  4137. n = guard || n === void 0 ? 1 : toInteger(n);
  4138. return baseSlice(array, n < 0 ? 0 : n, length);
  4139. }
  4140. function dropRight(array, n, guard) {
  4141. var length = array == null ? 0 : array.length;
  4142. if (!length) {
  4143. return [];
  4144. }
  4145. n = guard || n === void 0 ? 1 : toInteger(n);
  4146. n = length - n;
  4147. return baseSlice(array, 0, n < 0 ? 0 : n);
  4148. }
  4149. function baseWhile(array, predicate, isDrop, fromRight) {
  4150. var length = array.length, index = fromRight ? length : -1;
  4151. while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
  4152. }
  4153. return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
  4154. }
  4155. function dropRightWhile(array, predicate) {
  4156. return array && array.length ? baseWhile(array, baseIteratee(predicate), true, true) : [];
  4157. }
  4158. function dropWhile(array, predicate) {
  4159. return array && array.length ? baseWhile(array, baseIteratee(predicate), true) : [];
  4160. }
  4161. function castFunction(value) {
  4162. return typeof value == "function" ? value : identity;
  4163. }
  4164. function forEach(collection, iteratee) {
  4165. var func = isArray(collection) ? arrayEach : baseEach;
  4166. return func(collection, castFunction(iteratee));
  4167. }
  4168. function arrayEachRight(array, iteratee) {
  4169. var length = array == null ? 0 : array.length;
  4170. while (length--) {
  4171. if (iteratee(array[length], length, array) === false) {
  4172. break;
  4173. }
  4174. }
  4175. return array;
  4176. }
  4177. var baseForRight = createBaseFor(true);
  4178. function baseForOwnRight(object, iteratee) {
  4179. return object && baseForRight(object, iteratee, keys);
  4180. }
  4181. var baseEachRight = createBaseEach(baseForOwnRight, true);
  4182. function forEachRight(collection, iteratee) {
  4183. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  4184. return func(collection, castFunction(iteratee));
  4185. }
  4186. function endsWith(string, target, position) {
  4187. string = toString(string);
  4188. target = baseToString(target);
  4189. var length = string.length;
  4190. position = position === void 0 ? length : baseClamp(toInteger(position), 0, length);
  4191. var end = position;
  4192. position -= target.length;
  4193. return position >= 0 && string.slice(position, end) == target;
  4194. }
  4195. function baseToPairs(object, props) {
  4196. return arrayMap(props, function(key) {
  4197. return [key, object[key]];
  4198. });
  4199. }
  4200. function setToPairs(set) {
  4201. var index = -1, result = Array(set.size);
  4202. set.forEach(function(value) {
  4203. result[++index] = [value, value];
  4204. });
  4205. return result;
  4206. }
  4207. var mapTag$3 = "[object Map]";
  4208. var setTag$3 = "[object Set]";
  4209. function createToPairs(keysFunc) {
  4210. return function(object) {
  4211. var tag = getTag$1(object);
  4212. if (tag == mapTag$3) {
  4213. return mapToArray(object);
  4214. }
  4215. if (tag == setTag$3) {
  4216. return setToPairs(object);
  4217. }
  4218. return baseToPairs(object, keysFunc(object));
  4219. };
  4220. }
  4221. var toPairs = createToPairs(keys);
  4222. var toPairsIn = createToPairs(keysIn);
  4223. var htmlEscapes = {
  4224. "&": "&amp;",
  4225. "<": "&lt;",
  4226. ">": "&gt;",
  4227. '"': "&quot;",
  4228. "'": "&#39;"
  4229. };
  4230. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  4231. var reUnescapedHtml = /[&<>"']/g;
  4232. var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  4233. function escape(string) {
  4234. string = toString(string);
  4235. return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
  4236. }
  4237. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  4238. var reHasRegExpChar = RegExp(reRegExpChar.source);
  4239. function escapeRegExp(string) {
  4240. string = toString(string);
  4241. return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
  4242. }
  4243. function arrayEvery(array, predicate) {
  4244. var index = -1, length = array == null ? 0 : array.length;
  4245. while (++index < length) {
  4246. if (!predicate(array[index], index, array)) {
  4247. return false;
  4248. }
  4249. }
  4250. return true;
  4251. }
  4252. function baseEvery(collection, predicate) {
  4253. var result = true;
  4254. baseEach(collection, function(value, index, collection2) {
  4255. result = !!predicate(value, index, collection2);
  4256. return result;
  4257. });
  4258. return result;
  4259. }
  4260. function every(collection, predicate, guard) {
  4261. var func = isArray(collection) ? arrayEvery : baseEvery;
  4262. if (guard && isIterateeCall(collection, predicate, guard)) {
  4263. predicate = void 0;
  4264. }
  4265. return func(collection, baseIteratee(predicate));
  4266. }
  4267. var MAX_ARRAY_LENGTH$5 = 4294967295;
  4268. function toLength(value) {
  4269. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH$5) : 0;
  4270. }
  4271. function baseFill(array, value, start, end) {
  4272. var length = array.length;
  4273. start = toInteger(start);
  4274. if (start < 0) {
  4275. start = -start > length ? 0 : length + start;
  4276. }
  4277. end = end === void 0 || end > length ? length : toInteger(end);
  4278. if (end < 0) {
  4279. end += length;
  4280. }
  4281. end = start > end ? 0 : toLength(end);
  4282. while (start < end) {
  4283. array[start++] = value;
  4284. }
  4285. return array;
  4286. }
  4287. function fill(array, value, start, end) {
  4288. var length = array == null ? 0 : array.length;
  4289. if (!length) {
  4290. return [];
  4291. }
  4292. if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
  4293. start = 0;
  4294. end = length;
  4295. }
  4296. return baseFill(array, value, start, end);
  4297. }
  4298. function baseFilter(collection, predicate) {
  4299. var result = [];
  4300. baseEach(collection, function(value, index, collection2) {
  4301. if (predicate(value, index, collection2)) {
  4302. result.push(value);
  4303. }
  4304. });
  4305. return result;
  4306. }
  4307. function filter(collection, predicate) {
  4308. var func = isArray(collection) ? arrayFilter : baseFilter;
  4309. return func(collection, baseIteratee(predicate));
  4310. }
  4311. function createFind(findIndexFunc) {
  4312. return function(collection, predicate, fromIndex) {
  4313. var iterable = Object(collection);
  4314. if (!isArrayLike(collection)) {
  4315. var iteratee = baseIteratee(predicate);
  4316. collection = keys(collection);
  4317. predicate = function(key) {
  4318. return iteratee(iterable[key], key, iterable);
  4319. };
  4320. }
  4321. var index = findIndexFunc(collection, predicate, fromIndex);
  4322. return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0;
  4323. };
  4324. }
  4325. var nativeMax$a = Math.max;
  4326. function findIndex(array, predicate, fromIndex) {
  4327. var length = array == null ? 0 : array.length;
  4328. if (!length) {
  4329. return -1;
  4330. }
  4331. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  4332. if (index < 0) {
  4333. index = nativeMax$a(length + index, 0);
  4334. }
  4335. return baseFindIndex(array, baseIteratee(predicate), index);
  4336. }
  4337. var find = createFind(findIndex);
  4338. function baseFindKey(collection, predicate, eachFunc) {
  4339. var result;
  4340. eachFunc(collection, function(value, key, collection2) {
  4341. if (predicate(value, key, collection2)) {
  4342. result = key;
  4343. return false;
  4344. }
  4345. });
  4346. return result;
  4347. }
  4348. function findKey(object, predicate) {
  4349. return baseFindKey(object, baseIteratee(predicate), baseForOwn);
  4350. }
  4351. var nativeMax$9 = Math.max;
  4352. var nativeMin$a = Math.min;
  4353. function findLastIndex(array, predicate, fromIndex) {
  4354. var length = array == null ? 0 : array.length;
  4355. if (!length) {
  4356. return -1;
  4357. }
  4358. var index = length - 1;
  4359. if (fromIndex !== void 0) {
  4360. index = toInteger(fromIndex);
  4361. index = fromIndex < 0 ? nativeMax$9(length + index, 0) : nativeMin$a(index, length - 1);
  4362. }
  4363. return baseFindIndex(array, baseIteratee(predicate), index, true);
  4364. }
  4365. var findLast = createFind(findLastIndex);
  4366. function findLastKey(object, predicate) {
  4367. return baseFindKey(object, baseIteratee(predicate), baseForOwnRight);
  4368. }
  4369. function head(array) {
  4370. return array && array.length ? array[0] : void 0;
  4371. }
  4372. function baseMap(collection, iteratee) {
  4373. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  4374. baseEach(collection, function(value, key, collection2) {
  4375. result[++index] = iteratee(value, key, collection2);
  4376. });
  4377. return result;
  4378. }
  4379. function map(collection, iteratee) {
  4380. var func = isArray(collection) ? arrayMap : baseMap;
  4381. return func(collection, baseIteratee(iteratee));
  4382. }
  4383. function flatMap(collection, iteratee) {
  4384. return baseFlatten(map(collection, iteratee), 1);
  4385. }
  4386. var INFINITY$2 = 1 / 0;
  4387. function flatMapDeep(collection, iteratee) {
  4388. return baseFlatten(map(collection, iteratee), INFINITY$2);
  4389. }
  4390. function flatMapDepth(collection, iteratee, depth) {
  4391. depth = depth === void 0 ? 1 : toInteger(depth);
  4392. return baseFlatten(map(collection, iteratee), depth);
  4393. }
  4394. var INFINITY$1 = 1 / 0;
  4395. function flattenDeep(array) {
  4396. var length = array == null ? 0 : array.length;
  4397. return length ? baseFlatten(array, INFINITY$1) : [];
  4398. }
  4399. function flattenDepth(array, depth) {
  4400. var length = array == null ? 0 : array.length;
  4401. if (!length) {
  4402. return [];
  4403. }
  4404. depth = depth === void 0 ? 1 : toInteger(depth);
  4405. return baseFlatten(array, depth);
  4406. }
  4407. var WRAP_FLIP_FLAG = 512;
  4408. function flip$2(func) {
  4409. return createWrap(func, WRAP_FLIP_FLAG);
  4410. }
  4411. var floor$1 = createRound("floor");
  4412. var FUNC_ERROR_TEXT$4 = "Expected a function";
  4413. var WRAP_CURRY_FLAG = 8;
  4414. var WRAP_PARTIAL_FLAG$1 = 32;
  4415. var WRAP_ARY_FLAG = 128;
  4416. var WRAP_REARG_FLAG$1 = 256;
  4417. function createFlow(fromRight) {
  4418. return flatRest(function(funcs) {
  4419. var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
  4420. if (fromRight) {
  4421. funcs.reverse();
  4422. }
  4423. while (index--) {
  4424. var func = funcs[index];
  4425. if (typeof func != "function") {
  4426. throw new TypeError(FUNC_ERROR_TEXT$4);
  4427. }
  4428. if (prereq && !wrapper && getFuncName(func) == "wrapper") {
  4429. var wrapper = new LodashWrapper([], true);
  4430. }
  4431. }
  4432. index = wrapper ? index : length;
  4433. while (++index < length) {
  4434. func = funcs[index];
  4435. var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : void 0;
  4436. if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG$1 | WRAP_REARG_FLAG$1) && !data[4].length && data[9] == 1) {
  4437. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  4438. } else {
  4439. wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
  4440. }
  4441. }
  4442. return function() {
  4443. var args = arguments, value = args[0];
  4444. if (wrapper && args.length == 1 && isArray(value)) {
  4445. return wrapper.plant(value).value();
  4446. }
  4447. var index2 = 0, result = length ? funcs[index2].apply(this, args) : value;
  4448. while (++index2 < length) {
  4449. result = funcs[index2].call(this, result);
  4450. }
  4451. return result;
  4452. };
  4453. });
  4454. }
  4455. var flow = createFlow();
  4456. var flowRight = createFlow(true);
  4457. function forIn(object, iteratee) {
  4458. return object == null ? object : baseFor(object, castFunction(iteratee), keysIn);
  4459. }
  4460. function forInRight(object, iteratee) {
  4461. return object == null ? object : baseForRight(object, castFunction(iteratee), keysIn);
  4462. }
  4463. function forOwn(object, iteratee) {
  4464. return object && baseForOwn(object, castFunction(iteratee));
  4465. }
  4466. function forOwnRight(object, iteratee) {
  4467. return object && baseForOwnRight(object, castFunction(iteratee));
  4468. }
  4469. function fromPairs(pairs) {
  4470. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  4471. while (++index < length) {
  4472. var pair = pairs[index];
  4473. result[pair[0]] = pair[1];
  4474. }
  4475. return result;
  4476. }
  4477. function baseFunctions(object, props) {
  4478. return arrayFilter(props, function(key) {
  4479. return isFunction(object[key]);
  4480. });
  4481. }
  4482. function functions(object) {
  4483. return object == null ? [] : baseFunctions(object, keys(object));
  4484. }
  4485. function functionsIn(object) {
  4486. return object == null ? [] : baseFunctions(object, keysIn(object));
  4487. }
  4488. var objectProto$7 = Object.prototype;
  4489. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  4490. var groupBy = createAggregator(function(result, value, key) {
  4491. if (hasOwnProperty$6.call(result, key)) {
  4492. result[key].push(value);
  4493. } else {
  4494. baseAssignValue(result, key, [value]);
  4495. }
  4496. });
  4497. function baseGt(value, other) {
  4498. return value > other;
  4499. }
  4500. function createRelationalOperation(operator) {
  4501. return function(value, other) {
  4502. if (!(typeof value == "string" && typeof other == "string")) {
  4503. value = toNumber(value);
  4504. other = toNumber(other);
  4505. }
  4506. return operator(value, other);
  4507. };
  4508. }
  4509. var gt$1 = createRelationalOperation(baseGt);
  4510. var gte = createRelationalOperation(function(value, other) {
  4511. return value >= other;
  4512. });
  4513. var objectProto$6 = Object.prototype;
  4514. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  4515. function baseHas(object, key) {
  4516. return object != null && hasOwnProperty$5.call(object, key);
  4517. }
  4518. function has(object, path) {
  4519. return object != null && hasPath(object, path, baseHas);
  4520. }
  4521. var nativeMax$8 = Math.max;
  4522. var nativeMin$9 = Math.min;
  4523. function baseInRange(number, start, end) {
  4524. return number >= nativeMin$9(start, end) && number < nativeMax$8(start, end);
  4525. }
  4526. function inRange(number, start, end) {
  4527. start = toFinite(start);
  4528. if (end === void 0) {
  4529. end = start;
  4530. start = 0;
  4531. } else {
  4532. end = toFinite(end);
  4533. }
  4534. number = toNumber(number);
  4535. return baseInRange(number, start, end);
  4536. }
  4537. var stringTag = "[object String]";
  4538. function isString(value) {
  4539. return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
  4540. }
  4541. function baseValues(object, props) {
  4542. return arrayMap(props, function(key) {
  4543. return object[key];
  4544. });
  4545. }
  4546. function values(object) {
  4547. return object == null ? [] : baseValues(object, keys(object));
  4548. }
  4549. var nativeMax$7 = Math.max;
  4550. function includes(collection, value, fromIndex, guard) {
  4551. collection = isArrayLike(collection) ? collection : values(collection);
  4552. fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
  4553. var length = collection.length;
  4554. if (fromIndex < 0) {
  4555. fromIndex = nativeMax$7(length + fromIndex, 0);
  4556. }
  4557. return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
  4558. }
  4559. var nativeMax$6 = Math.max;
  4560. function indexOf(array, value, fromIndex) {
  4561. var length = array == null ? 0 : array.length;
  4562. if (!length) {
  4563. return -1;
  4564. }
  4565. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  4566. if (index < 0) {
  4567. index = nativeMax$6(length + index, 0);
  4568. }
  4569. return baseIndexOf(array, value, index);
  4570. }
  4571. function initial$1(array) {
  4572. var length = array == null ? 0 : array.length;
  4573. return length ? baseSlice(array, 0, -1) : [];
  4574. }
  4575. var nativeMin$8 = Math.min;
  4576. function baseIntersection(arrays, iteratee, comparator) {
  4577. var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = [];
  4578. while (othIndex--) {
  4579. var array = arrays[othIndex];
  4580. if (othIndex && iteratee) {
  4581. array = arrayMap(array, baseUnary(iteratee));
  4582. }
  4583. maxLength = nativeMin$8(array.length, maxLength);
  4584. caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : void 0;
  4585. }
  4586. array = arrays[0];
  4587. var index = -1, seen = caches[0];
  4588. outer:
  4589. while (++index < length && result.length < maxLength) {
  4590. var value = array[index], computed = iteratee ? iteratee(value) : value;
  4591. value = comparator || value !== 0 ? value : 0;
  4592. if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
  4593. othIndex = othLength;
  4594. while (--othIndex) {
  4595. var cache = caches[othIndex];
  4596. if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) {
  4597. continue outer;
  4598. }
  4599. }
  4600. if (seen) {
  4601. seen.push(computed);
  4602. }
  4603. result.push(value);
  4604. }
  4605. }
  4606. return result;
  4607. }
  4608. function castArrayLikeObject(value) {
  4609. return isArrayLikeObject(value) ? value : [];
  4610. }
  4611. var intersection = baseRest(function(arrays) {
  4612. var mapped = arrayMap(arrays, castArrayLikeObject);
  4613. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
  4614. });
  4615. var intersectionBy = baseRest(function(arrays) {
  4616. var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4617. if (iteratee === last(mapped)) {
  4618. iteratee = void 0;
  4619. } else {
  4620. mapped.pop();
  4621. }
  4622. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, baseIteratee(iteratee)) : [];
  4623. });
  4624. var intersectionWith = baseRest(function(arrays) {
  4625. var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4626. comparator = typeof comparator == "function" ? comparator : void 0;
  4627. if (comparator) {
  4628. mapped.pop();
  4629. }
  4630. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, void 0, comparator) : [];
  4631. });
  4632. function baseInverter(object, setter, iteratee, accumulator) {
  4633. baseForOwn(object, function(value, key, object2) {
  4634. setter(accumulator, iteratee(value), key, object2);
  4635. });
  4636. return accumulator;
  4637. }
  4638. function createInverter(setter, toIteratee) {
  4639. return function(object, iteratee) {
  4640. return baseInverter(object, setter, toIteratee(iteratee), {});
  4641. };
  4642. }
  4643. var objectProto$5 = Object.prototype;
  4644. var nativeObjectToString$1 = objectProto$5.toString;
  4645. var invert = createInverter(function(result, value, key) {
  4646. if (value != null && typeof value.toString != "function") {
  4647. value = nativeObjectToString$1.call(value);
  4648. }
  4649. result[value] = key;
  4650. }, constant(identity));
  4651. var objectProto$4 = Object.prototype;
  4652. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  4653. var nativeObjectToString = objectProto$4.toString;
  4654. var invertBy = createInverter(function(result, value, key) {
  4655. if (value != null && typeof value.toString != "function") {
  4656. value = nativeObjectToString.call(value);
  4657. }
  4658. if (hasOwnProperty$4.call(result, value)) {
  4659. result[value].push(key);
  4660. } else {
  4661. result[value] = [key];
  4662. }
  4663. }, baseIteratee);
  4664. function parent(object, path) {
  4665. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  4666. }
  4667. function baseInvoke(object, path, args) {
  4668. path = castPath(path, object);
  4669. object = parent(object, path);
  4670. var func = object == null ? object : object[toKey(last(path))];
  4671. return func == null ? void 0 : apply(func, object, args);
  4672. }
  4673. var invoke = baseRest(baseInvoke);
  4674. var invokeMap = baseRest(function(collection, path, args) {
  4675. var index = -1, isFunc = typeof path == "function", result = isArrayLike(collection) ? Array(collection.length) : [];
  4676. baseEach(collection, function(value) {
  4677. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  4678. });
  4679. return result;
  4680. });
  4681. var arrayBufferTag = "[object ArrayBuffer]";
  4682. function baseIsArrayBuffer(value) {
  4683. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4684. }
  4685. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
  4686. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  4687. var boolTag = "[object Boolean]";
  4688. function isBoolean$1(value) {
  4689. return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
  4690. }
  4691. var dateTag = "[object Date]";
  4692. function baseIsDate(value) {
  4693. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4694. }
  4695. var nodeIsDate = nodeUtil && nodeUtil.isDate;
  4696. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  4697. function isElement$3(value) {
  4698. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  4699. }
  4700. var mapTag$2 = "[object Map]";
  4701. var setTag$2 = "[object Set]";
  4702. var objectProto$3 = Object.prototype;
  4703. var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
  4704. function isEmpty$1(value) {
  4705. if (value == null) {
  4706. return true;
  4707. }
  4708. if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  4709. return !value.length;
  4710. }
  4711. var tag = getTag$1(value);
  4712. if (tag == mapTag$2 || tag == setTag$2) {
  4713. return !value.size;
  4714. }
  4715. if (isPrototype(value)) {
  4716. return !baseKeys(value).length;
  4717. }
  4718. for (var key in value) {
  4719. if (hasOwnProperty$3.call(value, key)) {
  4720. return false;
  4721. }
  4722. }
  4723. return true;
  4724. }
  4725. function isEqual$1(value, other) {
  4726. return baseIsEqual(value, other);
  4727. }
  4728. function isEqualWith(value, other, customizer) {
  4729. customizer = typeof customizer == "function" ? customizer : void 0;
  4730. var result = customizer ? customizer(value, other) : void 0;
  4731. return result === void 0 ? baseIsEqual(value, other, void 0, customizer) : !!result;
  4732. }
  4733. var nativeIsFinite = root.isFinite;
  4734. function isFinite(value) {
  4735. return typeof value == "number" && nativeIsFinite(value);
  4736. }
  4737. function isInteger(value) {
  4738. return typeof value == "number" && value == toInteger(value);
  4739. }
  4740. function isMatch(object, source) {
  4741. return object === source || baseIsMatch(object, source, getMatchData(source));
  4742. }
  4743. function isMatchWith(object, source, customizer) {
  4744. customizer = typeof customizer == "function" ? customizer : void 0;
  4745. return baseIsMatch(object, source, getMatchData(source), customizer);
  4746. }
  4747. var numberTag = "[object Number]";
  4748. function isNumber$1(value) {
  4749. return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
  4750. }
  4751. function isNaN$1(value) {
  4752. return isNumber$1(value) && value != +value;
  4753. }
  4754. var isMaskable = coreJsData ? isFunction : stubFalse;
  4755. var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.";
  4756. function isNative(value) {
  4757. if (isMaskable(value)) {
  4758. throw new Error(CORE_ERROR_TEXT);
  4759. }
  4760. return baseIsNative(value);
  4761. }
  4762. function isNil(value) {
  4763. return value == null;
  4764. }
  4765. function isNull(value) {
  4766. return value === null;
  4767. }
  4768. var regexpTag = "[object RegExp]";
  4769. function baseIsRegExp(value) {
  4770. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4771. }
  4772. var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
  4773. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  4774. var MAX_SAFE_INTEGER$3 = 9007199254740991;
  4775. function isSafeInteger(value) {
  4776. return isInteger(value) && value >= -MAX_SAFE_INTEGER$3 && value <= MAX_SAFE_INTEGER$3;
  4777. }
  4778. function isUndefined$1(value) {
  4779. return value === void 0;
  4780. }
  4781. var weakMapTag = "[object WeakMap]";
  4782. function isWeakMap(value) {
  4783. return isObjectLike(value) && getTag$1(value) == weakMapTag;
  4784. }
  4785. var weakSetTag = "[object WeakSet]";
  4786. function isWeakSet(value) {
  4787. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  4788. }
  4789. var CLONE_DEEP_FLAG$3 = 1;
  4790. function iteratee(func) {
  4791. return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG$3));
  4792. }
  4793. var arrayProto$4 = Array.prototype;
  4794. var nativeJoin = arrayProto$4.join;
  4795. function join(array, separator) {
  4796. return array == null ? "" : nativeJoin.call(array, separator);
  4797. }
  4798. var kebabCase = createCompounder(function(result, word, index) {
  4799. return result + (index ? "-" : "") + word.toLowerCase();
  4800. });
  4801. var keyBy = createAggregator(function(result, value, key) {
  4802. baseAssignValue(result, key, value);
  4803. });
  4804. function strictLastIndexOf(array, value, fromIndex) {
  4805. var index = fromIndex + 1;
  4806. while (index--) {
  4807. if (array[index] === value) {
  4808. return index;
  4809. }
  4810. }
  4811. return index;
  4812. }
  4813. var nativeMax$5 = Math.max;
  4814. var nativeMin$7 = Math.min;
  4815. function lastIndexOf(array, value, fromIndex) {
  4816. var length = array == null ? 0 : array.length;
  4817. if (!length) {
  4818. return -1;
  4819. }
  4820. var index = length;
  4821. if (fromIndex !== void 0) {
  4822. index = toInteger(fromIndex);
  4823. index = index < 0 ? nativeMax$5(length + index, 0) : nativeMin$7(index, length - 1);
  4824. }
  4825. return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
  4826. }
  4827. var lowerCase = createCompounder(function(result, word, index) {
  4828. return result + (index ? " " : "") + word.toLowerCase();
  4829. });
  4830. var lowerFirst = createCaseFirst("toLowerCase");
  4831. function baseLt(value, other) {
  4832. return value < other;
  4833. }
  4834. var lt$1 = createRelationalOperation(baseLt);
  4835. var lte = createRelationalOperation(function(value, other) {
  4836. return value <= other;
  4837. });
  4838. function mapKeys(object, iteratee) {
  4839. var result = {};
  4840. iteratee = baseIteratee(iteratee);
  4841. baseForOwn(object, function(value, key, object2) {
  4842. baseAssignValue(result, iteratee(value, key, object2), value);
  4843. });
  4844. return result;
  4845. }
  4846. function mapValues(object, iteratee) {
  4847. var result = {};
  4848. iteratee = baseIteratee(iteratee);
  4849. baseForOwn(object, function(value, key, object2) {
  4850. baseAssignValue(result, key, iteratee(value, key, object2));
  4851. });
  4852. return result;
  4853. }
  4854. var CLONE_DEEP_FLAG$2 = 1;
  4855. function matches(source) {
  4856. return baseMatches(baseClone(source, CLONE_DEEP_FLAG$2));
  4857. }
  4858. var CLONE_DEEP_FLAG$1 = 1;
  4859. function matchesProperty(path, srcValue) {
  4860. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG$1));
  4861. }
  4862. function baseExtremum(array, iteratee, comparator) {
  4863. var index = -1, length = array.length;
  4864. while (++index < length) {
  4865. var value = array[index], current = iteratee(value);
  4866. if (current != null && (computed === void 0 ? current === current && !isSymbol(current) : comparator(current, computed))) {
  4867. var computed = current, result = value;
  4868. }
  4869. }
  4870. return result;
  4871. }
  4872. function max$4(array) {
  4873. return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
  4874. }
  4875. function maxBy(array, iteratee) {
  4876. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseGt) : void 0;
  4877. }
  4878. function baseSum(array, iteratee) {
  4879. var result, index = -1, length = array.length;
  4880. while (++index < length) {
  4881. var current = iteratee(array[index]);
  4882. if (current !== void 0) {
  4883. result = result === void 0 ? current : result + current;
  4884. }
  4885. }
  4886. return result;
  4887. }
  4888. var NAN = 0 / 0;
  4889. function baseMean(array, iteratee) {
  4890. var length = array == null ? 0 : array.length;
  4891. return length ? baseSum(array, iteratee) / length : NAN;
  4892. }
  4893. function mean(array) {
  4894. return baseMean(array, identity);
  4895. }
  4896. function meanBy(array, iteratee) {
  4897. return baseMean(array, baseIteratee(iteratee));
  4898. }
  4899. var merge = createAssigner(function(object, source, srcIndex) {
  4900. baseMerge(object, source, srcIndex);
  4901. });
  4902. var method = baseRest(function(path, args) {
  4903. return function(object) {
  4904. return baseInvoke(object, path, args);
  4905. };
  4906. });
  4907. var methodOf = baseRest(function(object, args) {
  4908. return function(path) {
  4909. return baseInvoke(object, path, args);
  4910. };
  4911. });
  4912. function min$4(array) {
  4913. return array && array.length ? baseExtremum(array, identity, baseLt) : void 0;
  4914. }
  4915. function minBy(array, iteratee) {
  4916. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseLt) : void 0;
  4917. }
  4918. function mixin$1(object, source, options) {
  4919. var props = keys(source), methodNames = baseFunctions(source, props);
  4920. var chain = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object);
  4921. arrayEach(methodNames, function(methodName) {
  4922. var func = source[methodName];
  4923. object[methodName] = func;
  4924. if (isFunc) {
  4925. object.prototype[methodName] = function() {
  4926. var chainAll = this.__chain__;
  4927. if (chain || chainAll) {
  4928. var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__);
  4929. actions.push({ "func": func, "args": arguments, "thisArg": object });
  4930. result.__chain__ = chainAll;
  4931. return result;
  4932. }
  4933. return func.apply(object, arrayPush([this.value()], arguments));
  4934. };
  4935. }
  4936. });
  4937. return object;
  4938. }
  4939. var multiply = createMathOperation(function(multiplier, multiplicand) {
  4940. return multiplier * multiplicand;
  4941. }, 1);
  4942. var FUNC_ERROR_TEXT$3 = "Expected a function";
  4943. function negate(predicate) {
  4944. if (typeof predicate != "function") {
  4945. throw new TypeError(FUNC_ERROR_TEXT$3);
  4946. }
  4947. return function() {
  4948. var args = arguments;
  4949. switch (args.length) {
  4950. case 0:
  4951. return !predicate.call(this);
  4952. case 1:
  4953. return !predicate.call(this, args[0]);
  4954. case 2:
  4955. return !predicate.call(this, args[0], args[1]);
  4956. case 3:
  4957. return !predicate.call(this, args[0], args[1], args[2]);
  4958. }
  4959. return !predicate.apply(this, args);
  4960. };
  4961. }
  4962. function iteratorToArray(iterator) {
  4963. var data, result = [];
  4964. while (!(data = iterator.next()).done) {
  4965. result.push(data.value);
  4966. }
  4967. return result;
  4968. }
  4969. var mapTag$1 = "[object Map]";
  4970. var setTag$1 = "[object Set]";
  4971. var symIterator$1 = Symbol$1 ? Symbol$1.iterator : void 0;
  4972. function toArray(value) {
  4973. if (!value) {
  4974. return [];
  4975. }
  4976. if (isArrayLike(value)) {
  4977. return isString(value) ? stringToArray(value) : copyArray(value);
  4978. }
  4979. if (symIterator$1 && value[symIterator$1]) {
  4980. return iteratorToArray(value[symIterator$1]());
  4981. }
  4982. var tag = getTag$1(value), func = tag == mapTag$1 ? mapToArray : tag == setTag$1 ? setToArray : values;
  4983. return func(value);
  4984. }
  4985. function wrapperNext() {
  4986. if (this.__values__ === void 0) {
  4987. this.__values__ = toArray(this.value());
  4988. }
  4989. var done = this.__index__ >= this.__values__.length, value = done ? void 0 : this.__values__[this.__index__++];
  4990. return { "done": done, "value": value };
  4991. }
  4992. function baseNth(array, n) {
  4993. var length = array.length;
  4994. if (!length) {
  4995. return;
  4996. }
  4997. n += n < 0 ? length : 0;
  4998. return isIndex(n, length) ? array[n] : void 0;
  4999. }
  5000. function nth(array, n) {
  5001. return array && array.length ? baseNth(array, toInteger(n)) : void 0;
  5002. }
  5003. function nthArg(n) {
  5004. n = toInteger(n);
  5005. return baseRest(function(args) {
  5006. return baseNth(args, n);
  5007. });
  5008. }
  5009. function baseUnset(object, path) {
  5010. path = castPath(path, object);
  5011. object = parent(object, path);
  5012. return object == null || delete object[toKey(last(path))];
  5013. }
  5014. function customOmitClone(value) {
  5015. return isPlainObject(value) ? void 0 : value;
  5016. }
  5017. var CLONE_DEEP_FLAG = 1;
  5018. var CLONE_FLAT_FLAG = 2;
  5019. var CLONE_SYMBOLS_FLAG = 4;
  5020. var omit = flatRest(function(object, paths) {
  5021. var result = {};
  5022. if (object == null) {
  5023. return result;
  5024. }
  5025. var isDeep = false;
  5026. paths = arrayMap(paths, function(path) {
  5027. path = castPath(path, object);
  5028. isDeep || (isDeep = path.length > 1);
  5029. return path;
  5030. });
  5031. copyObject(object, getAllKeysIn(object), result);
  5032. if (isDeep) {
  5033. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  5034. }
  5035. var length = paths.length;
  5036. while (length--) {
  5037. baseUnset(result, paths[length]);
  5038. }
  5039. return result;
  5040. });
  5041. function baseSet(object, path, value, customizer) {
  5042. if (!isObject(object)) {
  5043. return object;
  5044. }
  5045. path = castPath(path, object);
  5046. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  5047. while (nested != null && ++index < length) {
  5048. var key = toKey(path[index]), newValue = value;
  5049. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  5050. return object;
  5051. }
  5052. if (index != lastIndex) {
  5053. var objValue = nested[key];
  5054. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  5055. if (newValue === void 0) {
  5056. newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  5057. }
  5058. }
  5059. assignValue(nested, key, newValue);
  5060. nested = nested[key];
  5061. }
  5062. return object;
  5063. }
  5064. function basePickBy(object, paths, predicate) {
  5065. var index = -1, length = paths.length, result = {};
  5066. while (++index < length) {
  5067. var path = paths[index], value = baseGet(object, path);
  5068. if (predicate(value, path)) {
  5069. baseSet(result, castPath(path, object), value);
  5070. }
  5071. }
  5072. return result;
  5073. }
  5074. function pickBy(object, predicate) {
  5075. if (object == null) {
  5076. return {};
  5077. }
  5078. var props = arrayMap(getAllKeysIn(object), function(prop) {
  5079. return [prop];
  5080. });
  5081. predicate = baseIteratee(predicate);
  5082. return basePickBy(object, props, function(value, path) {
  5083. return predicate(value, path[0]);
  5084. });
  5085. }
  5086. function omitBy(object, predicate) {
  5087. return pickBy(object, negate(baseIteratee(predicate)));
  5088. }
  5089. function once(func) {
  5090. return before(2, func);
  5091. }
  5092. function baseSortBy(array, comparer) {
  5093. var length = array.length;
  5094. array.sort(comparer);
  5095. while (length--) {
  5096. array[length] = array[length].value;
  5097. }
  5098. return array;
  5099. }
  5100. function compareAscending(value, other) {
  5101. if (value !== other) {
  5102. var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
  5103. var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
  5104. if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
  5105. return 1;
  5106. }
  5107. if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
  5108. return -1;
  5109. }
  5110. }
  5111. return 0;
  5112. }
  5113. function compareMultiple(object, other, orders) {
  5114. var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
  5115. while (++index < length) {
  5116. var result = compareAscending(objCriteria[index], othCriteria[index]);
  5117. if (result) {
  5118. if (index >= ordersLength) {
  5119. return result;
  5120. }
  5121. var order = orders[index];
  5122. return result * (order == "desc" ? -1 : 1);
  5123. }
  5124. }
  5125. return object.index - other.index;
  5126. }
  5127. function baseOrderBy(collection, iteratees, orders) {
  5128. if (iteratees.length) {
  5129. iteratees = arrayMap(iteratees, function(iteratee) {
  5130. if (isArray(iteratee)) {
  5131. return function(value) {
  5132. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  5133. };
  5134. }
  5135. return iteratee;
  5136. });
  5137. } else {
  5138. iteratees = [identity];
  5139. }
  5140. var index = -1;
  5141. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  5142. var result = baseMap(collection, function(value, key, collection2) {
  5143. var criteria = arrayMap(iteratees, function(iteratee) {
  5144. return iteratee(value);
  5145. });
  5146. return { "criteria": criteria, "index": ++index, "value": value };
  5147. });
  5148. return baseSortBy(result, function(object, other) {
  5149. return compareMultiple(object, other, orders);
  5150. });
  5151. }
  5152. function orderBy$1(collection, iteratees, orders, guard) {
  5153. if (collection == null) {
  5154. return [];
  5155. }
  5156. if (!isArray(iteratees)) {
  5157. iteratees = iteratees == null ? [] : [iteratees];
  5158. }
  5159. orders = guard ? void 0 : orders;
  5160. if (!isArray(orders)) {
  5161. orders = orders == null ? [] : [orders];
  5162. }
  5163. return baseOrderBy(collection, iteratees, orders);
  5164. }
  5165. function createOver(arrayFunc) {
  5166. return flatRest(function(iteratees) {
  5167. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  5168. return baseRest(function(args) {
  5169. var thisArg = this;
  5170. return arrayFunc(iteratees, function(iteratee) {
  5171. return apply(iteratee, thisArg, args);
  5172. });
  5173. });
  5174. });
  5175. }
  5176. var over = createOver(arrayMap);
  5177. var castRest = baseRest;
  5178. var nativeMin$6 = Math.min;
  5179. var overArgs = castRest(function(func, transforms) {
  5180. transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(baseIteratee)) : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
  5181. var funcsLength = transforms.length;
  5182. return baseRest(function(args) {
  5183. var index = -1, length = nativeMin$6(args.length, funcsLength);
  5184. while (++index < length) {
  5185. args[index] = transforms[index].call(this, args[index]);
  5186. }
  5187. return apply(func, this, args);
  5188. });
  5189. });
  5190. var overEvery = createOver(arrayEvery);
  5191. var overSome = createOver(arraySome);
  5192. var MAX_SAFE_INTEGER$2 = 9007199254740991;
  5193. var nativeFloor$3 = Math.floor;
  5194. function baseRepeat(string, n) {
  5195. var result = "";
  5196. if (!string || n < 1 || n > MAX_SAFE_INTEGER$2) {
  5197. return result;
  5198. }
  5199. do {
  5200. if (n % 2) {
  5201. result += string;
  5202. }
  5203. n = nativeFloor$3(n / 2);
  5204. if (n) {
  5205. string += string;
  5206. }
  5207. } while (n);
  5208. return result;
  5209. }
  5210. var asciiSize = baseProperty("length");
  5211. var rsAstralRange = "\\ud800-\\udfff";
  5212. var rsComboMarksRange = "\\u0300-\\u036f";
  5213. var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
  5214. var rsComboSymbolsRange = "\\u20d0-\\u20ff";
  5215. var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
  5216. var rsVarRange = "\\ufe0e\\ufe0f";
  5217. var rsAstral = "[" + rsAstralRange + "]";
  5218. var rsCombo = "[" + rsComboRange + "]";
  5219. var rsFitz = "\\ud83c[\\udffb-\\udfff]";
  5220. var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
  5221. var rsNonAstral = "[^" + rsAstralRange + "]";
  5222. var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  5223. var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  5224. var rsZWJ = "\\u200d";
  5225. var reOptMod = rsModifier + "?";
  5226. var rsOptVar = "[" + rsVarRange + "]?";
  5227. var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
  5228. var rsSeq = rsOptVar + reOptMod + rsOptJoin;
  5229. var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
  5230. var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
  5231. function unicodeSize(string) {
  5232. var result = reUnicode.lastIndex = 0;
  5233. while (reUnicode.test(string)) {
  5234. ++result;
  5235. }
  5236. return result;
  5237. }
  5238. function stringSize(string) {
  5239. return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
  5240. }
  5241. var nativeCeil$2 = Math.ceil;
  5242. function createPadding(length, chars) {
  5243. chars = chars === void 0 ? " " : baseToString(chars);
  5244. var charsLength = chars.length;
  5245. if (charsLength < 2) {
  5246. return charsLength ? baseRepeat(chars, length) : chars;
  5247. }
  5248. var result = baseRepeat(chars, nativeCeil$2(length / stringSize(chars)));
  5249. return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length);
  5250. }
  5251. var nativeCeil$1 = Math.ceil;
  5252. var nativeFloor$2 = Math.floor;
  5253. function pad(string, length, chars) {
  5254. string = toString(string);
  5255. length = toInteger(length);
  5256. var strLength = length ? stringSize(string) : 0;
  5257. if (!length || strLength >= length) {
  5258. return string;
  5259. }
  5260. var mid = (length - strLength) / 2;
  5261. return createPadding(nativeFloor$2(mid), chars) + string + createPadding(nativeCeil$1(mid), chars);
  5262. }
  5263. function padEnd(string, length, chars) {
  5264. string = toString(string);
  5265. length = toInteger(length);
  5266. var strLength = length ? stringSize(string) : 0;
  5267. return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
  5268. }
  5269. function padStart(string, length, chars) {
  5270. string = toString(string);
  5271. length = toInteger(length);
  5272. var strLength = length ? stringSize(string) : 0;
  5273. return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
  5274. }
  5275. var reTrimStart$1 = /^\s+/;
  5276. var nativeParseInt = root.parseInt;
  5277. function parseInt$1(string, radix, guard) {
  5278. if (guard || radix == null) {
  5279. radix = 0;
  5280. } else if (radix) {
  5281. radix = +radix;
  5282. }
  5283. return nativeParseInt(toString(string).replace(reTrimStart$1, ""), radix || 0);
  5284. }
  5285. var WRAP_PARTIAL_FLAG = 32;
  5286. var partial = baseRest(function(func, partials) {
  5287. var holders = replaceHolders(partials, getHolder(partial));
  5288. return createWrap(func, WRAP_PARTIAL_FLAG, void 0, partials, holders);
  5289. });
  5290. partial.placeholder = {};
  5291. var WRAP_PARTIAL_RIGHT_FLAG = 64;
  5292. var partialRight = baseRest(function(func, partials) {
  5293. var holders = replaceHolders(partials, getHolder(partialRight));
  5294. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, void 0, partials, holders);
  5295. });
  5296. partialRight.placeholder = {};
  5297. var partition = createAggregator(function(result, value, key) {
  5298. result[key ? 0 : 1].push(value);
  5299. }, function() {
  5300. return [[], []];
  5301. });
  5302. function basePick(object, paths) {
  5303. return basePickBy(object, paths, function(value, path) {
  5304. return hasIn(object, path);
  5305. });
  5306. }
  5307. var pick = flatRest(function(object, paths) {
  5308. return object == null ? {} : basePick(object, paths);
  5309. });
  5310. function wrapperPlant(value) {
  5311. var result, parent = this;
  5312. while (parent instanceof baseLodash) {
  5313. var clone = wrapperClone(parent);
  5314. clone.__index__ = 0;
  5315. clone.__values__ = void 0;
  5316. if (result) {
  5317. previous.__wrapped__ = clone;
  5318. } else {
  5319. result = clone;
  5320. }
  5321. var previous = clone;
  5322. parent = parent.__wrapped__;
  5323. }
  5324. previous.__wrapped__ = value;
  5325. return result;
  5326. }
  5327. function propertyOf(object) {
  5328. return function(path) {
  5329. return object == null ? void 0 : baseGet(object, path);
  5330. };
  5331. }
  5332. function baseIndexOfWith(array, value, fromIndex, comparator) {
  5333. var index = fromIndex - 1, length = array.length;
  5334. while (++index < length) {
  5335. if (comparator(array[index], value)) {
  5336. return index;
  5337. }
  5338. }
  5339. return -1;
  5340. }
  5341. var arrayProto$3 = Array.prototype;
  5342. var splice$1 = arrayProto$3.splice;
  5343. function basePullAll(array, values, iteratee, comparator) {
  5344. var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array;
  5345. if (array === values) {
  5346. values = copyArray(values);
  5347. }
  5348. if (iteratee) {
  5349. seen = arrayMap(array, baseUnary(iteratee));
  5350. }
  5351. while (++index < length) {
  5352. var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value;
  5353. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  5354. if (seen !== array) {
  5355. splice$1.call(seen, fromIndex, 1);
  5356. }
  5357. splice$1.call(array, fromIndex, 1);
  5358. }
  5359. }
  5360. return array;
  5361. }
  5362. function pullAll(array, values) {
  5363. return array && array.length && values && values.length ? basePullAll(array, values) : array;
  5364. }
  5365. var pull = baseRest(pullAll);
  5366. function pullAllBy(array, values, iteratee) {
  5367. return array && array.length && values && values.length ? basePullAll(array, values, baseIteratee(iteratee)) : array;
  5368. }
  5369. function pullAllWith(array, values, comparator) {
  5370. return array && array.length && values && values.length ? basePullAll(array, values, void 0, comparator) : array;
  5371. }
  5372. var arrayProto$2 = Array.prototype;
  5373. var splice = arrayProto$2.splice;
  5374. function basePullAt(array, indexes) {
  5375. var length = array ? indexes.length : 0, lastIndex = length - 1;
  5376. while (length--) {
  5377. var index = indexes[length];
  5378. if (length == lastIndex || index !== previous) {
  5379. var previous = index;
  5380. if (isIndex(index)) {
  5381. splice.call(array, index, 1);
  5382. } else {
  5383. baseUnset(array, index);
  5384. }
  5385. }
  5386. }
  5387. return array;
  5388. }
  5389. var pullAt = flatRest(function(array, indexes) {
  5390. var length = array == null ? 0 : array.length, result = baseAt(array, indexes);
  5391. basePullAt(array, arrayMap(indexes, function(index) {
  5392. return isIndex(index, length) ? +index : index;
  5393. }).sort(compareAscending));
  5394. return result;
  5395. });
  5396. var nativeFloor$1 = Math.floor;
  5397. var nativeRandom$1 = Math.random;
  5398. function baseRandom(lower, upper) {
  5399. return lower + nativeFloor$1(nativeRandom$1() * (upper - lower + 1));
  5400. }
  5401. var freeParseFloat = parseFloat;
  5402. var nativeMin$5 = Math.min;
  5403. var nativeRandom = Math.random;
  5404. function random(lower, upper, floating) {
  5405. if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
  5406. upper = floating = void 0;
  5407. }
  5408. if (floating === void 0) {
  5409. if (typeof upper == "boolean") {
  5410. floating = upper;
  5411. upper = void 0;
  5412. } else if (typeof lower == "boolean") {
  5413. floating = lower;
  5414. lower = void 0;
  5415. }
  5416. }
  5417. if (lower === void 0 && upper === void 0) {
  5418. lower = 0;
  5419. upper = 1;
  5420. } else {
  5421. lower = toFinite(lower);
  5422. if (upper === void 0) {
  5423. upper = lower;
  5424. lower = 0;
  5425. } else {
  5426. upper = toFinite(upper);
  5427. }
  5428. }
  5429. if (lower > upper) {
  5430. var temp = lower;
  5431. lower = upper;
  5432. upper = temp;
  5433. }
  5434. if (floating || lower % 1 || upper % 1) {
  5435. var rand = nativeRandom();
  5436. return nativeMin$5(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
  5437. }
  5438. return baseRandom(lower, upper);
  5439. }
  5440. var nativeCeil = Math.ceil;
  5441. var nativeMax$4 = Math.max;
  5442. function baseRange(start, end, step, fromRight) {
  5443. var index = -1, length = nativeMax$4(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
  5444. while (length--) {
  5445. result[fromRight ? length : ++index] = start;
  5446. start += step;
  5447. }
  5448. return result;
  5449. }
  5450. function createRange(fromRight) {
  5451. return function(start, end, step) {
  5452. if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
  5453. end = step = void 0;
  5454. }
  5455. start = toFinite(start);
  5456. if (end === void 0) {
  5457. end = start;
  5458. start = 0;
  5459. } else {
  5460. end = toFinite(end);
  5461. }
  5462. step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
  5463. return baseRange(start, end, step, fromRight);
  5464. };
  5465. }
  5466. var range$1 = createRange();
  5467. var rangeRight = createRange(true);
  5468. var WRAP_REARG_FLAG = 256;
  5469. var rearg = flatRest(function(func, indexes) {
  5470. return createWrap(func, WRAP_REARG_FLAG, void 0, void 0, void 0, indexes);
  5471. });
  5472. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  5473. eachFunc(collection, function(value, index, collection2) {
  5474. accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
  5475. });
  5476. return accumulator;
  5477. }
  5478. function reduce(collection, iteratee, accumulator) {
  5479. var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
  5480. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach);
  5481. }
  5482. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  5483. var length = array == null ? 0 : array.length;
  5484. if (initAccum && length) {
  5485. accumulator = array[--length];
  5486. }
  5487. while (length--) {
  5488. accumulator = iteratee(accumulator, array[length], length, array);
  5489. }
  5490. return accumulator;
  5491. }
  5492. function reduceRight(collection, iteratee, accumulator) {
  5493. var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
  5494. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEachRight);
  5495. }
  5496. function reject(collection, predicate) {
  5497. var func = isArray(collection) ? arrayFilter : baseFilter;
  5498. return func(collection, negate(baseIteratee(predicate)));
  5499. }
  5500. function remove(array, predicate) {
  5501. var result = [];
  5502. if (!(array && array.length)) {
  5503. return result;
  5504. }
  5505. var index = -1, indexes = [], length = array.length;
  5506. predicate = baseIteratee(predicate);
  5507. while (++index < length) {
  5508. var value = array[index];
  5509. if (predicate(value, index, array)) {
  5510. result.push(value);
  5511. indexes.push(index);
  5512. }
  5513. }
  5514. basePullAt(array, indexes);
  5515. return result;
  5516. }
  5517. function repeat(string, n, guard) {
  5518. if (guard ? isIterateeCall(string, n, guard) : n === void 0) {
  5519. n = 1;
  5520. } else {
  5521. n = toInteger(n);
  5522. }
  5523. return baseRepeat(toString(string), n);
  5524. }
  5525. function replace() {
  5526. var args = arguments, string = toString(args[0]);
  5527. return args.length < 3 ? string : string.replace(args[1], args[2]);
  5528. }
  5529. var FUNC_ERROR_TEXT$2 = "Expected a function";
  5530. function rest(func, start) {
  5531. if (typeof func != "function") {
  5532. throw new TypeError(FUNC_ERROR_TEXT$2);
  5533. }
  5534. start = start === void 0 ? start : toInteger(start);
  5535. return baseRest(func, start);
  5536. }
  5537. function result(object, path, defaultValue) {
  5538. path = castPath(path, object);
  5539. var index = -1, length = path.length;
  5540. if (!length) {
  5541. length = 1;
  5542. object = void 0;
  5543. }
  5544. while (++index < length) {
  5545. var value = object == null ? void 0 : object[toKey(path[index])];
  5546. if (value === void 0) {
  5547. index = length;
  5548. value = defaultValue;
  5549. }
  5550. object = isFunction(value) ? value.call(object) : value;
  5551. }
  5552. return object;
  5553. }
  5554. var arrayProto$1 = Array.prototype;
  5555. var nativeReverse = arrayProto$1.reverse;
  5556. function reverse(array) {
  5557. return array == null ? array : nativeReverse.call(array);
  5558. }
  5559. var round$2 = createRound("round");
  5560. function arraySample(array) {
  5561. var length = array.length;
  5562. return length ? array[baseRandom(0, length - 1)] : void 0;
  5563. }
  5564. function baseSample(collection) {
  5565. return arraySample(values(collection));
  5566. }
  5567. function sample(collection) {
  5568. var func = isArray(collection) ? arraySample : baseSample;
  5569. return func(collection);
  5570. }
  5571. function shuffleSelf(array, size) {
  5572. var index = -1, length = array.length, lastIndex = length - 1;
  5573. size = size === void 0 ? length : size;
  5574. while (++index < size) {
  5575. var rand = baseRandom(index, lastIndex), value = array[rand];
  5576. array[rand] = array[index];
  5577. array[index] = value;
  5578. }
  5579. array.length = size;
  5580. return array;
  5581. }
  5582. function arraySampleSize(array, n) {
  5583. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  5584. }
  5585. function baseSampleSize(collection, n) {
  5586. var array = values(collection);
  5587. return shuffleSelf(array, baseClamp(n, 0, array.length));
  5588. }
  5589. function sampleSize(collection, n, guard) {
  5590. if (guard ? isIterateeCall(collection, n, guard) : n === void 0) {
  5591. n = 1;
  5592. } else {
  5593. n = toInteger(n);
  5594. }
  5595. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  5596. return func(collection, n);
  5597. }
  5598. function set(object, path, value) {
  5599. return object == null ? object : baseSet(object, path, value);
  5600. }
  5601. function setWith(object, path, value, customizer) {
  5602. customizer = typeof customizer == "function" ? customizer : void 0;
  5603. return object == null ? object : baseSet(object, path, value, customizer);
  5604. }
  5605. function arrayShuffle(array) {
  5606. return shuffleSelf(copyArray(array));
  5607. }
  5608. function baseShuffle(collection) {
  5609. return shuffleSelf(values(collection));
  5610. }
  5611. function shuffle(collection) {
  5612. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  5613. return func(collection);
  5614. }
  5615. var mapTag = "[object Map]";
  5616. var setTag = "[object Set]";
  5617. function size$1(collection) {
  5618. if (collection == null) {
  5619. return 0;
  5620. }
  5621. if (isArrayLike(collection)) {
  5622. return isString(collection) ? stringSize(collection) : collection.length;
  5623. }
  5624. var tag = getTag$1(collection);
  5625. if (tag == mapTag || tag == setTag) {
  5626. return collection.size;
  5627. }
  5628. return baseKeys(collection).length;
  5629. }
  5630. function slice(array, start, end) {
  5631. var length = array == null ? 0 : array.length;
  5632. if (!length) {
  5633. return [];
  5634. }
  5635. if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
  5636. start = 0;
  5637. end = length;
  5638. } else {
  5639. start = start == null ? 0 : toInteger(start);
  5640. end = end === void 0 ? length : toInteger(end);
  5641. }
  5642. return baseSlice(array, start, end);
  5643. }
  5644. var snakeCase = createCompounder(function(result, word, index) {
  5645. return result + (index ? "_" : "") + word.toLowerCase();
  5646. });
  5647. function baseSome(collection, predicate) {
  5648. var result;
  5649. baseEach(collection, function(value, index, collection2) {
  5650. result = predicate(value, index, collection2);
  5651. return !result;
  5652. });
  5653. return !!result;
  5654. }
  5655. function some(collection, predicate, guard) {
  5656. var func = isArray(collection) ? arraySome : baseSome;
  5657. if (guard && isIterateeCall(collection, predicate, guard)) {
  5658. predicate = void 0;
  5659. }
  5660. return func(collection, baseIteratee(predicate));
  5661. }
  5662. var sortBy = baseRest(function(collection, iteratees) {
  5663. if (collection == null) {
  5664. return [];
  5665. }
  5666. var length = iteratees.length;
  5667. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  5668. iteratees = [];
  5669. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  5670. iteratees = [iteratees[0]];
  5671. }
  5672. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  5673. });
  5674. var MAX_ARRAY_LENGTH$4 = 4294967295;
  5675. var MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$4 - 1;
  5676. var nativeFloor = Math.floor;
  5677. var nativeMin$4 = Math.min;
  5678. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5679. var low = 0, high = array == null ? 0 : array.length;
  5680. if (high === 0) {
  5681. return 0;
  5682. }
  5683. value = iteratee(value);
  5684. var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === void 0;
  5685. while (low < high) {
  5686. var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== void 0, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
  5687. if (valIsNaN) {
  5688. var setLow = retHighest || othIsReflexive;
  5689. } else if (valIsUndefined) {
  5690. setLow = othIsReflexive && (retHighest || othIsDefined);
  5691. } else if (valIsNull) {
  5692. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5693. } else if (valIsSymbol) {
  5694. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5695. } else if (othIsNull || othIsSymbol) {
  5696. setLow = false;
  5697. } else {
  5698. setLow = retHighest ? computed <= value : computed < value;
  5699. }
  5700. if (setLow) {
  5701. low = mid + 1;
  5702. } else {
  5703. high = mid;
  5704. }
  5705. }
  5706. return nativeMin$4(high, MAX_ARRAY_INDEX);
  5707. }
  5708. var MAX_ARRAY_LENGTH$3 = 4294967295;
  5709. var HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH$3 >>> 1;
  5710. function baseSortedIndex(array, value, retHighest) {
  5711. var low = 0, high = array == null ? low : array.length;
  5712. if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5713. while (low < high) {
  5714. var mid = low + high >>> 1, computed = array[mid];
  5715. if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
  5716. low = mid + 1;
  5717. } else {
  5718. high = mid;
  5719. }
  5720. }
  5721. return high;
  5722. }
  5723. return baseSortedIndexBy(array, value, identity, retHighest);
  5724. }
  5725. function sortedIndex(array, value) {
  5726. return baseSortedIndex(array, value);
  5727. }
  5728. function sortedIndexBy(array, value, iteratee) {
  5729. return baseSortedIndexBy(array, value, baseIteratee(iteratee));
  5730. }
  5731. function sortedIndexOf(array, value) {
  5732. var length = array == null ? 0 : array.length;
  5733. if (length) {
  5734. var index = baseSortedIndex(array, value);
  5735. if (index < length && eq(array[index], value)) {
  5736. return index;
  5737. }
  5738. }
  5739. return -1;
  5740. }
  5741. function sortedLastIndex(array, value) {
  5742. return baseSortedIndex(array, value, true);
  5743. }
  5744. function sortedLastIndexBy(array, value, iteratee) {
  5745. return baseSortedIndexBy(array, value, baseIteratee(iteratee), true);
  5746. }
  5747. function sortedLastIndexOf(array, value) {
  5748. var length = array == null ? 0 : array.length;
  5749. if (length) {
  5750. var index = baseSortedIndex(array, value, true) - 1;
  5751. if (eq(array[index], value)) {
  5752. return index;
  5753. }
  5754. }
  5755. return -1;
  5756. }
  5757. function baseSortedUniq(array, iteratee) {
  5758. var index = -1, length = array.length, resIndex = 0, result = [];
  5759. while (++index < length) {
  5760. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5761. if (!index || !eq(computed, seen)) {
  5762. var seen = computed;
  5763. result[resIndex++] = value === 0 ? 0 : value;
  5764. }
  5765. }
  5766. return result;
  5767. }
  5768. function sortedUniq(array) {
  5769. return array && array.length ? baseSortedUniq(array) : [];
  5770. }
  5771. function sortedUniqBy(array, iteratee) {
  5772. return array && array.length ? baseSortedUniq(array, baseIteratee(iteratee)) : [];
  5773. }
  5774. var MAX_ARRAY_LENGTH$2 = 4294967295;
  5775. function split(string, separator, limit) {
  5776. if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
  5777. separator = limit = void 0;
  5778. }
  5779. limit = limit === void 0 ? MAX_ARRAY_LENGTH$2 : limit >>> 0;
  5780. if (!limit) {
  5781. return [];
  5782. }
  5783. string = toString(string);
  5784. if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
  5785. separator = baseToString(separator);
  5786. if (!separator && hasUnicode(string)) {
  5787. return castSlice(stringToArray(string), 0, limit);
  5788. }
  5789. }
  5790. return string.split(separator, limit);
  5791. }
  5792. var FUNC_ERROR_TEXT$1 = "Expected a function";
  5793. var nativeMax$3 = Math.max;
  5794. function spread(func, start) {
  5795. if (typeof func != "function") {
  5796. throw new TypeError(FUNC_ERROR_TEXT$1);
  5797. }
  5798. start = start == null ? 0 : nativeMax$3(toInteger(start), 0);
  5799. return baseRest(function(args) {
  5800. var array = args[start], otherArgs = castSlice(args, 0, start);
  5801. if (array) {
  5802. arrayPush(otherArgs, array);
  5803. }
  5804. return apply(func, this, otherArgs);
  5805. });
  5806. }
  5807. var startCase = createCompounder(function(result, word, index) {
  5808. return result + (index ? " " : "") + upperFirst(word);
  5809. });
  5810. function startsWith(string, target, position) {
  5811. string = toString(string);
  5812. position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
  5813. target = baseToString(target);
  5814. return string.slice(position, position + target.length) == target;
  5815. }
  5816. function stubObject() {
  5817. return {};
  5818. }
  5819. function stubString() {
  5820. return "";
  5821. }
  5822. function stubTrue() {
  5823. return true;
  5824. }
  5825. var subtract = createMathOperation(function(minuend, subtrahend) {
  5826. return minuend - subtrahend;
  5827. }, 0);
  5828. function sum$1(array) {
  5829. return array && array.length ? baseSum(array, identity) : 0;
  5830. }
  5831. function sumBy(array, iteratee) {
  5832. return array && array.length ? baseSum(array, baseIteratee(iteratee)) : 0;
  5833. }
  5834. function tail(array) {
  5835. var length = array == null ? 0 : array.length;
  5836. return length ? baseSlice(array, 1, length) : [];
  5837. }
  5838. function take(array, n, guard) {
  5839. if (!(array && array.length)) {
  5840. return [];
  5841. }
  5842. n = guard || n === void 0 ? 1 : toInteger(n);
  5843. return baseSlice(array, 0, n < 0 ? 0 : n);
  5844. }
  5845. function takeRight(array, n, guard) {
  5846. var length = array == null ? 0 : array.length;
  5847. if (!length) {
  5848. return [];
  5849. }
  5850. n = guard || n === void 0 ? 1 : toInteger(n);
  5851. n = length - n;
  5852. return baseSlice(array, n < 0 ? 0 : n, length);
  5853. }
  5854. function takeRightWhile(array, predicate) {
  5855. return array && array.length ? baseWhile(array, baseIteratee(predicate), false, true) : [];
  5856. }
  5857. function takeWhile(array, predicate) {
  5858. return array && array.length ? baseWhile(array, baseIteratee(predicate)) : [];
  5859. }
  5860. function tap(value, interceptor) {
  5861. interceptor(value);
  5862. return value;
  5863. }
  5864. var objectProto$2 = Object.prototype;
  5865. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  5866. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  5867. if (objValue === void 0 || eq(objValue, objectProto$2[key]) && !hasOwnProperty$2.call(object, key)) {
  5868. return srcValue;
  5869. }
  5870. return objValue;
  5871. }
  5872. var stringEscapes = {
  5873. "\\": "\\",
  5874. "'": "'",
  5875. "\n": "n",
  5876. "\r": "r",
  5877. "\u2028": "u2028",
  5878. "\u2029": "u2029"
  5879. };
  5880. function escapeStringChar(chr) {
  5881. return "\\" + stringEscapes[chr];
  5882. }
  5883. var reInterpolate = /<%=([\s\S]+?)%>/g;
  5884. var reEscape = /<%-([\s\S]+?)%>/g;
  5885. var reEvaluate = /<%([\s\S]+?)%>/g;
  5886. var templateSettings = {
  5887. "escape": reEscape,
  5888. "evaluate": reEvaluate,
  5889. "interpolate": reInterpolate,
  5890. "variable": "",
  5891. "imports": {
  5892. "_": { "escape": escape }
  5893. }
  5894. };
  5895. var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
  5896. var reEmptyStringLeading = /\b__p \+= '';/g;
  5897. var reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
  5898. var reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  5899. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  5900. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  5901. var reNoMatch = /($^)/;
  5902. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  5903. var objectProto$1 = Object.prototype;
  5904. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  5905. function template(string, options, guard) {
  5906. var settings = templateSettings.imports._.templateSettings || templateSettings;
  5907. if (guard && isIterateeCall(string, options, guard)) {
  5908. options = void 0;
  5909. }
  5910. string = toString(string);
  5911. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  5912. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
  5913. var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
  5914. var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
  5915. var sourceURL = hasOwnProperty$1.call(options, "sourceURL") ? "//# sourceURL=" + (options.sourceURL + "").replace(/\s/g, " ") + "\n" : "";
  5916. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  5917. interpolateValue || (interpolateValue = esTemplateValue);
  5918. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  5919. if (escapeValue) {
  5920. isEscaping = true;
  5921. source += "' +\n__e(" + escapeValue + ") +\n'";
  5922. }
  5923. if (evaluateValue) {
  5924. isEvaluating = true;
  5925. source += "';\n" + evaluateValue + ";\n__p += '";
  5926. }
  5927. if (interpolateValue) {
  5928. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  5929. }
  5930. index = offset + match.length;
  5931. return match;
  5932. });
  5933. source += "';\n";
  5934. var variable = hasOwnProperty$1.call(options, "variable") && options.variable;
  5935. if (!variable) {
  5936. source = "with (obj) {\n" + source + "\n}\n";
  5937. } else if (reForbiddenIdentifierChars.test(variable)) {
  5938. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  5939. }
  5940. source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
  5941. source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
  5942. var result = attempt(function() {
  5943. return Function(importsKeys, sourceURL + "return " + source).apply(void 0, importsValues);
  5944. });
  5945. result.source = source;
  5946. if (isError(result)) {
  5947. throw result;
  5948. }
  5949. return result;
  5950. }
  5951. var FUNC_ERROR_TEXT = "Expected a function";
  5952. function throttle(func, wait, options) {
  5953. var leading = true, trailing = true;
  5954. if (typeof func != "function") {
  5955. throw new TypeError(FUNC_ERROR_TEXT);
  5956. }
  5957. if (isObject(options)) {
  5958. leading = "leading" in options ? !!options.leading : leading;
  5959. trailing = "trailing" in options ? !!options.trailing : trailing;
  5960. }
  5961. return debounce(func, wait, {
  5962. "leading": leading,
  5963. "maxWait": wait,
  5964. "trailing": trailing
  5965. });
  5966. }
  5967. function thru(value, interceptor) {
  5968. return interceptor(value);
  5969. }
  5970. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  5971. var MAX_ARRAY_LENGTH$1 = 4294967295;
  5972. var nativeMin$3 = Math.min;
  5973. function times(n, iteratee) {
  5974. n = toInteger(n);
  5975. if (n < 1 || n > MAX_SAFE_INTEGER$1) {
  5976. return [];
  5977. }
  5978. var index = MAX_ARRAY_LENGTH$1, length = nativeMin$3(n, MAX_ARRAY_LENGTH$1);
  5979. iteratee = castFunction(iteratee);
  5980. n -= MAX_ARRAY_LENGTH$1;
  5981. var result = baseTimes(length, iteratee);
  5982. while (++index < n) {
  5983. iteratee(index);
  5984. }
  5985. return result;
  5986. }
  5987. function wrapperToIterator() {
  5988. return this;
  5989. }
  5990. function baseWrapperValue(value, actions) {
  5991. var result = value;
  5992. if (result instanceof LazyWrapper) {
  5993. result = result.value();
  5994. }
  5995. return arrayReduce(actions, function(result2, action) {
  5996. return action.func.apply(action.thisArg, arrayPush([result2], action.args));
  5997. }, result);
  5998. }
  5999. function wrapperValue() {
  6000. return baseWrapperValue(this.__wrapped__, this.__actions__);
  6001. }
  6002. function toLower(value) {
  6003. return toString(value).toLowerCase();
  6004. }
  6005. function toPath(value) {
  6006. if (isArray(value)) {
  6007. return arrayMap(value, toKey);
  6008. }
  6009. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  6010. }
  6011. var MAX_SAFE_INTEGER = 9007199254740991;
  6012. function toSafeInteger(value) {
  6013. return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
  6014. }
  6015. function toUpper(value) {
  6016. return toString(value).toUpperCase();
  6017. }
  6018. function transform(object, iteratee, accumulator) {
  6019. var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  6020. iteratee = baseIteratee(iteratee);
  6021. if (accumulator == null) {
  6022. var Ctor = object && object.constructor;
  6023. if (isArrLike) {
  6024. accumulator = isArr ? new Ctor() : [];
  6025. } else if (isObject(object)) {
  6026. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  6027. } else {
  6028. accumulator = {};
  6029. }
  6030. }
  6031. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
  6032. return iteratee(accumulator, value, index, object2);
  6033. });
  6034. return accumulator;
  6035. }
  6036. function charsEndIndex(strSymbols, chrSymbols) {
  6037. var index = strSymbols.length;
  6038. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  6039. }
  6040. return index;
  6041. }
  6042. function charsStartIndex(strSymbols, chrSymbols) {
  6043. var index = -1, length = strSymbols.length;
  6044. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  6045. }
  6046. return index;
  6047. }
  6048. function trim(string, chars, guard) {
  6049. string = toString(string);
  6050. if (string && (guard || chars === void 0)) {
  6051. return baseTrim(string);
  6052. }
  6053. if (!string || !(chars = baseToString(chars))) {
  6054. return string;
  6055. }
  6056. var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
  6057. return castSlice(strSymbols, start, end).join("");
  6058. }
  6059. function trimEnd(string, chars, guard) {
  6060. string = toString(string);
  6061. if (string && (guard || chars === void 0)) {
  6062. return string.slice(0, trimmedEndIndex(string) + 1);
  6063. }
  6064. if (!string || !(chars = baseToString(chars))) {
  6065. return string;
  6066. }
  6067. var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  6068. return castSlice(strSymbols, 0, end).join("");
  6069. }
  6070. var reTrimStart = /^\s+/;
  6071. function trimStart(string, chars, guard) {
  6072. string = toString(string);
  6073. if (string && (guard || chars === void 0)) {
  6074. return string.replace(reTrimStart, "");
  6075. }
  6076. if (!string || !(chars = baseToString(chars))) {
  6077. return string;
  6078. }
  6079. var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
  6080. return castSlice(strSymbols, start).join("");
  6081. }
  6082. var DEFAULT_TRUNC_LENGTH = 30;
  6083. var DEFAULT_TRUNC_OMISSION = "...";
  6084. var reFlags = /\w*$/;
  6085. function truncate(string, options) {
  6086. var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
  6087. if (isObject(options)) {
  6088. var separator = "separator" in options ? options.separator : separator;
  6089. length = "length" in options ? toInteger(options.length) : length;
  6090. omission = "omission" in options ? baseToString(options.omission) : omission;
  6091. }
  6092. string = toString(string);
  6093. var strLength = string.length;
  6094. if (hasUnicode(string)) {
  6095. var strSymbols = stringToArray(string);
  6096. strLength = strSymbols.length;
  6097. }
  6098. if (length >= strLength) {
  6099. return string;
  6100. }
  6101. var end = length - stringSize(omission);
  6102. if (end < 1) {
  6103. return omission;
  6104. }
  6105. var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
  6106. if (separator === void 0) {
  6107. return result + omission;
  6108. }
  6109. if (strSymbols) {
  6110. end += result.length - end;
  6111. }
  6112. if (isRegExp(separator)) {
  6113. if (string.slice(end).search(separator)) {
  6114. var match, substring = result;
  6115. if (!separator.global) {
  6116. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g");
  6117. }
  6118. separator.lastIndex = 0;
  6119. while (match = separator.exec(substring)) {
  6120. var newEnd = match.index;
  6121. }
  6122. result = result.slice(0, newEnd === void 0 ? end : newEnd);
  6123. }
  6124. } else if (string.indexOf(baseToString(separator), end) != end) {
  6125. var index = result.lastIndexOf(separator);
  6126. if (index > -1) {
  6127. result = result.slice(0, index);
  6128. }
  6129. }
  6130. return result + omission;
  6131. }
  6132. function unary(func) {
  6133. return ary(func, 1);
  6134. }
  6135. var htmlUnescapes = {
  6136. "&amp;": "&",
  6137. "&lt;": "<",
  6138. "&gt;": ">",
  6139. "&quot;": '"',
  6140. "&#39;": "'"
  6141. };
  6142. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  6143. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
  6144. var reHasEscapedHtml = RegExp(reEscapedHtml.source);
  6145. function unescape(string) {
  6146. string = toString(string);
  6147. return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
  6148. }
  6149. var INFINITY = 1 / 0;
  6150. var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY) ? noop : function(values) {
  6151. return new Set$1(values);
  6152. };
  6153. var LARGE_ARRAY_SIZE = 200;
  6154. function baseUniq(array, iteratee, comparator) {
  6155. var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
  6156. if (comparator) {
  6157. isCommon = false;
  6158. includes = arrayIncludesWith;
  6159. } else if (length >= LARGE_ARRAY_SIZE) {
  6160. var set = iteratee ? null : createSet(array);
  6161. if (set) {
  6162. return setToArray(set);
  6163. }
  6164. isCommon = false;
  6165. includes = cacheHas;
  6166. seen = new SetCache();
  6167. } else {
  6168. seen = iteratee ? [] : result;
  6169. }
  6170. outer:
  6171. while (++index < length) {
  6172. var value = array[index], computed = iteratee ? iteratee(value) : value;
  6173. value = comparator || value !== 0 ? value : 0;
  6174. if (isCommon && computed === computed) {
  6175. var seenIndex = seen.length;
  6176. while (seenIndex--) {
  6177. if (seen[seenIndex] === computed) {
  6178. continue outer;
  6179. }
  6180. }
  6181. if (iteratee) {
  6182. seen.push(computed);
  6183. }
  6184. result.push(value);
  6185. } else if (!includes(seen, computed, comparator)) {
  6186. if (seen !== result) {
  6187. seen.push(computed);
  6188. }
  6189. result.push(value);
  6190. }
  6191. }
  6192. return result;
  6193. }
  6194. var union = baseRest(function(arrays) {
  6195. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  6196. });
  6197. var unionBy = baseRest(function(arrays) {
  6198. var iteratee = last(arrays);
  6199. if (isArrayLikeObject(iteratee)) {
  6200. iteratee = void 0;
  6201. }
  6202. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee));
  6203. });
  6204. var unionWith = baseRest(function(arrays) {
  6205. var comparator = last(arrays);
  6206. comparator = typeof comparator == "function" ? comparator : void 0;
  6207. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), void 0, comparator);
  6208. });
  6209. function uniq(array) {
  6210. return array && array.length ? baseUniq(array) : [];
  6211. }
  6212. function uniqBy(array, iteratee) {
  6213. return array && array.length ? baseUniq(array, baseIteratee(iteratee)) : [];
  6214. }
  6215. function uniqWith(array, comparator) {
  6216. comparator = typeof comparator == "function" ? comparator : void 0;
  6217. return array && array.length ? baseUniq(array, void 0, comparator) : [];
  6218. }
  6219. var idCounter = 0;
  6220. function uniqueId(prefix) {
  6221. var id = ++idCounter;
  6222. return toString(prefix) + id;
  6223. }
  6224. function unset(object, path) {
  6225. return object == null ? true : baseUnset(object, path);
  6226. }
  6227. var nativeMax$2 = Math.max;
  6228. function unzip(array) {
  6229. if (!(array && array.length)) {
  6230. return [];
  6231. }
  6232. var length = 0;
  6233. array = arrayFilter(array, function(group) {
  6234. if (isArrayLikeObject(group)) {
  6235. length = nativeMax$2(group.length, length);
  6236. return true;
  6237. }
  6238. });
  6239. return baseTimes(length, function(index) {
  6240. return arrayMap(array, baseProperty(index));
  6241. });
  6242. }
  6243. function unzipWith(array, iteratee) {
  6244. if (!(array && array.length)) {
  6245. return [];
  6246. }
  6247. var result = unzip(array);
  6248. if (iteratee == null) {
  6249. return result;
  6250. }
  6251. return arrayMap(result, function(group) {
  6252. return apply(iteratee, void 0, group);
  6253. });
  6254. }
  6255. function baseUpdate(object, path, updater, customizer) {
  6256. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  6257. }
  6258. function update(object, path, updater) {
  6259. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  6260. }
  6261. function updateWith(object, path, updater, customizer) {
  6262. customizer = typeof customizer == "function" ? customizer : void 0;
  6263. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  6264. }
  6265. var upperCase = createCompounder(function(result, word, index) {
  6266. return result + (index ? " " : "") + word.toUpperCase();
  6267. });
  6268. function valuesIn(object) {
  6269. return object == null ? [] : baseValues(object, keysIn(object));
  6270. }
  6271. var without = baseRest(function(array, values) {
  6272. return isArrayLikeObject(array) ? baseDifference(array, values) : [];
  6273. });
  6274. function wrap(value, wrapper) {
  6275. return partial(castFunction(wrapper), value);
  6276. }
  6277. var wrapperAt = flatRest(function(paths) {
  6278. var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
  6279. return baseAt(object, paths);
  6280. };
  6281. if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
  6282. return this.thru(interceptor);
  6283. }
  6284. value = value.slice(start, +start + (length ? 1 : 0));
  6285. value.__actions__.push({
  6286. "func": thru,
  6287. "args": [interceptor],
  6288. "thisArg": void 0
  6289. });
  6290. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  6291. if (length && !array.length) {
  6292. array.push(void 0);
  6293. }
  6294. return array;
  6295. });
  6296. });
  6297. function wrapperChain() {
  6298. return chain(this);
  6299. }
  6300. function wrapperReverse() {
  6301. var value = this.__wrapped__;
  6302. if (value instanceof LazyWrapper) {
  6303. var wrapped = value;
  6304. if (this.__actions__.length) {
  6305. wrapped = new LazyWrapper(this);
  6306. }
  6307. wrapped = wrapped.reverse();
  6308. wrapped.__actions__.push({
  6309. "func": thru,
  6310. "args": [reverse],
  6311. "thisArg": void 0
  6312. });
  6313. return new LodashWrapper(wrapped, this.__chain__);
  6314. }
  6315. return this.thru(reverse);
  6316. }
  6317. function baseXor(arrays, iteratee, comparator) {
  6318. var length = arrays.length;
  6319. if (length < 2) {
  6320. return length ? baseUniq(arrays[0]) : [];
  6321. }
  6322. var index = -1, result = Array(length);
  6323. while (++index < length) {
  6324. var array = arrays[index], othIndex = -1;
  6325. while (++othIndex < length) {
  6326. if (othIndex != index) {
  6327. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  6328. }
  6329. }
  6330. }
  6331. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  6332. }
  6333. var xor = baseRest(function(arrays) {
  6334. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  6335. });
  6336. var xorBy = baseRest(function(arrays) {
  6337. var iteratee = last(arrays);
  6338. if (isArrayLikeObject(iteratee)) {
  6339. iteratee = void 0;
  6340. }
  6341. return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee));
  6342. });
  6343. var xorWith = baseRest(function(arrays) {
  6344. var comparator = last(arrays);
  6345. comparator = typeof comparator == "function" ? comparator : void 0;
  6346. return baseXor(arrayFilter(arrays, isArrayLikeObject), void 0, comparator);
  6347. });
  6348. var zip = baseRest(unzip);
  6349. function baseZipObject(props, values, assignFunc) {
  6350. var index = -1, length = props.length, valsLength = values.length, result = {};
  6351. while (++index < length) {
  6352. var value = index < valsLength ? values[index] : void 0;
  6353. assignFunc(result, props[index], value);
  6354. }
  6355. return result;
  6356. }
  6357. function zipObject(props, values) {
  6358. return baseZipObject(props || [], values || [], assignValue);
  6359. }
  6360. function zipObjectDeep(props, values) {
  6361. return baseZipObject(props || [], values || [], baseSet);
  6362. }
  6363. var zipWith = baseRest(function(arrays) {
  6364. var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : void 0;
  6365. iteratee = typeof iteratee == "function" ? (arrays.pop(), iteratee) : void 0;
  6366. return unzipWith(arrays, iteratee);
  6367. });
  6368. var array = {
  6369. chunk,
  6370. compact,
  6371. concat,
  6372. difference,
  6373. differenceBy,
  6374. differenceWith,
  6375. drop,
  6376. dropRight,
  6377. dropRightWhile,
  6378. dropWhile,
  6379. fill,
  6380. findIndex,
  6381. findLastIndex,
  6382. first: head,
  6383. flatten,
  6384. flattenDeep,
  6385. flattenDepth,
  6386. fromPairs,
  6387. head,
  6388. indexOf,
  6389. initial: initial$1,
  6390. intersection,
  6391. intersectionBy,
  6392. intersectionWith,
  6393. join,
  6394. last,
  6395. lastIndexOf,
  6396. nth,
  6397. pull,
  6398. pullAll,
  6399. pullAllBy,
  6400. pullAllWith,
  6401. pullAt,
  6402. remove,
  6403. reverse,
  6404. slice,
  6405. sortedIndex,
  6406. sortedIndexBy,
  6407. sortedIndexOf,
  6408. sortedLastIndex,
  6409. sortedLastIndexBy,
  6410. sortedLastIndexOf,
  6411. sortedUniq,
  6412. sortedUniqBy,
  6413. tail,
  6414. take,
  6415. takeRight,
  6416. takeRightWhile,
  6417. takeWhile,
  6418. union,
  6419. unionBy,
  6420. unionWith,
  6421. uniq,
  6422. uniqBy,
  6423. uniqWith,
  6424. unzip,
  6425. unzipWith,
  6426. without,
  6427. xor,
  6428. xorBy,
  6429. xorWith,
  6430. zip,
  6431. zipObject,
  6432. zipObjectDeep,
  6433. zipWith
  6434. };
  6435. var collection = {
  6436. countBy,
  6437. each: forEach,
  6438. eachRight: forEachRight,
  6439. every,
  6440. filter,
  6441. find,
  6442. findLast,
  6443. flatMap,
  6444. flatMapDeep,
  6445. flatMapDepth,
  6446. forEach,
  6447. forEachRight,
  6448. groupBy,
  6449. includes,
  6450. invokeMap,
  6451. keyBy,
  6452. map,
  6453. orderBy: orderBy$1,
  6454. partition,
  6455. reduce,
  6456. reduceRight,
  6457. reject,
  6458. sample,
  6459. sampleSize,
  6460. shuffle,
  6461. size: size$1,
  6462. some,
  6463. sortBy
  6464. };
  6465. var date = {
  6466. now
  6467. };
  6468. var func = {
  6469. after,
  6470. ary,
  6471. before,
  6472. bind,
  6473. bindKey,
  6474. curry,
  6475. curryRight,
  6476. debounce,
  6477. defer,
  6478. delay,
  6479. flip: flip$2,
  6480. memoize,
  6481. negate,
  6482. once,
  6483. overArgs,
  6484. partial,
  6485. partialRight,
  6486. rearg,
  6487. rest,
  6488. spread,
  6489. throttle,
  6490. unary,
  6491. wrap
  6492. };
  6493. var lang = {
  6494. castArray: castArray$1,
  6495. clone,
  6496. cloneDeep,
  6497. cloneDeepWith,
  6498. cloneWith,
  6499. conformsTo,
  6500. eq,
  6501. gt: gt$1,
  6502. gte,
  6503. isArguments,
  6504. isArray,
  6505. isArrayBuffer,
  6506. isArrayLike,
  6507. isArrayLikeObject,
  6508. isBoolean: isBoolean$1,
  6509. isBuffer,
  6510. isDate,
  6511. isElement: isElement$3,
  6512. isEmpty: isEmpty$1,
  6513. isEqual: isEqual$1,
  6514. isEqualWith,
  6515. isError,
  6516. isFinite,
  6517. isFunction,
  6518. isInteger,
  6519. isLength,
  6520. isMap,
  6521. isMatch,
  6522. isMatchWith,
  6523. isNaN: isNaN$1,
  6524. isNative,
  6525. isNil,
  6526. isNull,
  6527. isNumber: isNumber$1,
  6528. isObject,
  6529. isObjectLike,
  6530. isPlainObject,
  6531. isRegExp,
  6532. isSafeInteger,
  6533. isSet,
  6534. isString,
  6535. isSymbol,
  6536. isTypedArray,
  6537. isUndefined: isUndefined$1,
  6538. isWeakMap,
  6539. isWeakSet,
  6540. lt: lt$1,
  6541. lte,
  6542. toArray,
  6543. toFinite,
  6544. toInteger,
  6545. toLength,
  6546. toNumber,
  6547. toPlainObject,
  6548. toSafeInteger,
  6549. toString
  6550. };
  6551. var math = {
  6552. add,
  6553. ceil,
  6554. divide,
  6555. floor: floor$1,
  6556. max: max$4,
  6557. maxBy,
  6558. mean,
  6559. meanBy,
  6560. min: min$4,
  6561. minBy,
  6562. multiply,
  6563. round: round$2,
  6564. subtract,
  6565. sum: sum$1,
  6566. sumBy
  6567. };
  6568. var number = {
  6569. clamp: clamp$1,
  6570. inRange,
  6571. random
  6572. };
  6573. var object = {
  6574. assign,
  6575. assignIn,
  6576. assignInWith,
  6577. assignWith,
  6578. at: at$1,
  6579. create,
  6580. defaults,
  6581. defaultsDeep,
  6582. entries: toPairs,
  6583. entriesIn: toPairsIn,
  6584. extend: assignIn,
  6585. extendWith: assignInWith,
  6586. findKey,
  6587. findLastKey,
  6588. forIn,
  6589. forInRight,
  6590. forOwn,
  6591. forOwnRight,
  6592. functions,
  6593. functionsIn,
  6594. get,
  6595. has,
  6596. hasIn,
  6597. invert,
  6598. invertBy,
  6599. invoke,
  6600. keys,
  6601. keysIn,
  6602. mapKeys,
  6603. mapValues,
  6604. merge,
  6605. mergeWith,
  6606. omit,
  6607. omitBy,
  6608. pick,
  6609. pickBy,
  6610. result,
  6611. set,
  6612. setWith,
  6613. toPairs,
  6614. toPairsIn,
  6615. transform,
  6616. unset,
  6617. update,
  6618. updateWith,
  6619. values,
  6620. valuesIn
  6621. };
  6622. var seq = {
  6623. at: wrapperAt,
  6624. chain,
  6625. commit: wrapperCommit,
  6626. lodash,
  6627. next: wrapperNext,
  6628. plant: wrapperPlant,
  6629. reverse: wrapperReverse,
  6630. tap,
  6631. thru,
  6632. toIterator: wrapperToIterator,
  6633. toJSON: wrapperValue,
  6634. value: wrapperValue,
  6635. valueOf: wrapperValue,
  6636. wrapperChain
  6637. };
  6638. var string$1 = {
  6639. camelCase,
  6640. capitalize: capitalize$1,
  6641. deburr,
  6642. endsWith,
  6643. escape,
  6644. escapeRegExp,
  6645. kebabCase,
  6646. lowerCase,
  6647. lowerFirst,
  6648. pad,
  6649. padEnd,
  6650. padStart,
  6651. parseInt: parseInt$1,
  6652. repeat,
  6653. replace,
  6654. snakeCase,
  6655. split,
  6656. startCase,
  6657. startsWith,
  6658. template,
  6659. templateSettings,
  6660. toLower,
  6661. toUpper,
  6662. trim,
  6663. trimEnd,
  6664. trimStart,
  6665. truncate,
  6666. unescape,
  6667. upperCase,
  6668. upperFirst,
  6669. words
  6670. };
  6671. var util = {
  6672. attempt,
  6673. bindAll,
  6674. cond,
  6675. conforms,
  6676. constant,
  6677. defaultTo,
  6678. flow,
  6679. flowRight,
  6680. identity,
  6681. iteratee,
  6682. matches,
  6683. matchesProperty,
  6684. method,
  6685. methodOf,
  6686. mixin: mixin$1,
  6687. noop,
  6688. nthArg,
  6689. over,
  6690. overEvery,
  6691. overSome,
  6692. property,
  6693. propertyOf,
  6694. range: range$1,
  6695. rangeRight,
  6696. stubArray,
  6697. stubFalse,
  6698. stubObject,
  6699. stubString,
  6700. stubTrue,
  6701. times,
  6702. toPath,
  6703. uniqueId
  6704. };
  6705. function lazyClone() {
  6706. var result = new LazyWrapper(this.__wrapped__);
  6707. result.__actions__ = copyArray(this.__actions__);
  6708. result.__dir__ = this.__dir__;
  6709. result.__filtered__ = this.__filtered__;
  6710. result.__iteratees__ = copyArray(this.__iteratees__);
  6711. result.__takeCount__ = this.__takeCount__;
  6712. result.__views__ = copyArray(this.__views__);
  6713. return result;
  6714. }
  6715. function lazyReverse() {
  6716. if (this.__filtered__) {
  6717. var result = new LazyWrapper(this);
  6718. result.__dir__ = -1;
  6719. result.__filtered__ = true;
  6720. } else {
  6721. result = this.clone();
  6722. result.__dir__ *= -1;
  6723. }
  6724. return result;
  6725. }
  6726. var nativeMax$1 = Math.max;
  6727. var nativeMin$2 = Math.min;
  6728. function getView(start, end, transforms) {
  6729. var index = -1, length = transforms.length;
  6730. while (++index < length) {
  6731. var data = transforms[index], size = data.size;
  6732. switch (data.type) {
  6733. case "drop":
  6734. start += size;
  6735. break;
  6736. case "dropRight":
  6737. end -= size;
  6738. break;
  6739. case "take":
  6740. end = nativeMin$2(end, start + size);
  6741. break;
  6742. case "takeRight":
  6743. start = nativeMax$1(start, end - size);
  6744. break;
  6745. }
  6746. }
  6747. return { "start": start, "end": end };
  6748. }
  6749. var LAZY_FILTER_FLAG$1 = 1;
  6750. var LAZY_MAP_FLAG = 2;
  6751. var nativeMin$1 = Math.min;
  6752. function lazyValue() {
  6753. var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin$1(length, this.__takeCount__);
  6754. if (!isArr || !isRight && arrLength == length && takeCount == length) {
  6755. return baseWrapperValue(array, this.__actions__);
  6756. }
  6757. var result = [];
  6758. outer:
  6759. while (length-- && resIndex < takeCount) {
  6760. index += dir;
  6761. var iterIndex = -1, value = array[index];
  6762. while (++iterIndex < iterLength) {
  6763. var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value);
  6764. if (type == LAZY_MAP_FLAG) {
  6765. value = computed;
  6766. } else if (!computed) {
  6767. if (type == LAZY_FILTER_FLAG$1) {
  6768. continue outer;
  6769. } else {
  6770. break outer;
  6771. }
  6772. }
  6773. }
  6774. result[resIndex++] = value;
  6775. }
  6776. return result;
  6777. }
  6778. var VERSION = "4.17.21";
  6779. var WRAP_BIND_KEY_FLAG = 2;
  6780. var LAZY_FILTER_FLAG = 1;
  6781. var LAZY_WHILE_FLAG = 3;
  6782. var MAX_ARRAY_LENGTH = 4294967295;
  6783. var arrayProto = Array.prototype;
  6784. var objectProto = Object.prototype;
  6785. var hasOwnProperty = objectProto.hasOwnProperty;
  6786. var symIterator = Symbol$1 ? Symbol$1.iterator : void 0;
  6787. var nativeMax = Math.max;
  6788. var nativeMin = Math.min;
  6789. var mixin = function(func2) {
  6790. return function(object2, source, options) {
  6791. if (options == null) {
  6792. var isObj = isObject(source), props = isObj && keys(source), methodNames = props && props.length && baseFunctions(source, props);
  6793. if (!(methodNames ? methodNames.length : isObj)) {
  6794. options = source;
  6795. source = object2;
  6796. object2 = this;
  6797. }
  6798. }
  6799. return func2(object2, source, options);
  6800. };
  6801. }(mixin$1);
  6802. lodash.after = func.after;
  6803. lodash.ary = func.ary;
  6804. lodash.assign = object.assign;
  6805. lodash.assignIn = object.assignIn;
  6806. lodash.assignInWith = object.assignInWith;
  6807. lodash.assignWith = object.assignWith;
  6808. lodash.at = object.at;
  6809. lodash.before = func.before;
  6810. lodash.bind = func.bind;
  6811. lodash.bindAll = util.bindAll;
  6812. lodash.bindKey = func.bindKey;
  6813. lodash.castArray = lang.castArray;
  6814. lodash.chain = seq.chain;
  6815. lodash.chunk = array.chunk;
  6816. lodash.compact = array.compact;
  6817. lodash.concat = array.concat;
  6818. lodash.cond = util.cond;
  6819. lodash.conforms = util.conforms;
  6820. lodash.constant = util.constant;
  6821. lodash.countBy = collection.countBy;
  6822. lodash.create = object.create;
  6823. lodash.curry = func.curry;
  6824. lodash.curryRight = func.curryRight;
  6825. lodash.debounce = func.debounce;
  6826. lodash.defaults = object.defaults;
  6827. lodash.defaultsDeep = object.defaultsDeep;
  6828. lodash.defer = func.defer;
  6829. lodash.delay = func.delay;
  6830. lodash.difference = array.difference;
  6831. lodash.differenceBy = array.differenceBy;
  6832. lodash.differenceWith = array.differenceWith;
  6833. lodash.drop = array.drop;
  6834. lodash.dropRight = array.dropRight;
  6835. lodash.dropRightWhile = array.dropRightWhile;
  6836. lodash.dropWhile = array.dropWhile;
  6837. lodash.fill = array.fill;
  6838. lodash.filter = collection.filter;
  6839. lodash.flatMap = collection.flatMap;
  6840. lodash.flatMapDeep = collection.flatMapDeep;
  6841. lodash.flatMapDepth = collection.flatMapDepth;
  6842. lodash.flatten = array.flatten;
  6843. lodash.flattenDeep = array.flattenDeep;
  6844. lodash.flattenDepth = array.flattenDepth;
  6845. lodash.flip = func.flip;
  6846. lodash.flow = util.flow;
  6847. lodash.flowRight = util.flowRight;
  6848. lodash.fromPairs = array.fromPairs;
  6849. lodash.functions = object.functions;
  6850. lodash.functionsIn = object.functionsIn;
  6851. lodash.groupBy = collection.groupBy;
  6852. lodash.initial = array.initial;
  6853. lodash.intersection = array.intersection;
  6854. lodash.intersectionBy = array.intersectionBy;
  6855. lodash.intersectionWith = array.intersectionWith;
  6856. lodash.invert = object.invert;
  6857. lodash.invertBy = object.invertBy;
  6858. lodash.invokeMap = collection.invokeMap;
  6859. lodash.iteratee = util.iteratee;
  6860. lodash.keyBy = collection.keyBy;
  6861. lodash.keys = keys;
  6862. lodash.keysIn = object.keysIn;
  6863. lodash.map = collection.map;
  6864. lodash.mapKeys = object.mapKeys;
  6865. lodash.mapValues = object.mapValues;
  6866. lodash.matches = util.matches;
  6867. lodash.matchesProperty = util.matchesProperty;
  6868. lodash.memoize = func.memoize;
  6869. lodash.merge = object.merge;
  6870. lodash.mergeWith = object.mergeWith;
  6871. lodash.method = util.method;
  6872. lodash.methodOf = util.methodOf;
  6873. lodash.mixin = mixin;
  6874. lodash.negate = negate;
  6875. lodash.nthArg = util.nthArg;
  6876. lodash.omit = object.omit;
  6877. lodash.omitBy = object.omitBy;
  6878. lodash.once = func.once;
  6879. lodash.orderBy = collection.orderBy;
  6880. lodash.over = util.over;
  6881. lodash.overArgs = func.overArgs;
  6882. lodash.overEvery = util.overEvery;
  6883. lodash.overSome = util.overSome;
  6884. lodash.partial = func.partial;
  6885. lodash.partialRight = func.partialRight;
  6886. lodash.partition = collection.partition;
  6887. lodash.pick = object.pick;
  6888. lodash.pickBy = object.pickBy;
  6889. lodash.property = util.property;
  6890. lodash.propertyOf = util.propertyOf;
  6891. lodash.pull = array.pull;
  6892. lodash.pullAll = array.pullAll;
  6893. lodash.pullAllBy = array.pullAllBy;
  6894. lodash.pullAllWith = array.pullAllWith;
  6895. lodash.pullAt = array.pullAt;
  6896. lodash.range = util.range;
  6897. lodash.rangeRight = util.rangeRight;
  6898. lodash.rearg = func.rearg;
  6899. lodash.reject = collection.reject;
  6900. lodash.remove = array.remove;
  6901. lodash.rest = func.rest;
  6902. lodash.reverse = array.reverse;
  6903. lodash.sampleSize = collection.sampleSize;
  6904. lodash.set = object.set;
  6905. lodash.setWith = object.setWith;
  6906. lodash.shuffle = collection.shuffle;
  6907. lodash.slice = array.slice;
  6908. lodash.sortBy = collection.sortBy;
  6909. lodash.sortedUniq = array.sortedUniq;
  6910. lodash.sortedUniqBy = array.sortedUniqBy;
  6911. lodash.split = string$1.split;
  6912. lodash.spread = func.spread;
  6913. lodash.tail = array.tail;
  6914. lodash.take = array.take;
  6915. lodash.takeRight = array.takeRight;
  6916. lodash.takeRightWhile = array.takeRightWhile;
  6917. lodash.takeWhile = array.takeWhile;
  6918. lodash.tap = seq.tap;
  6919. lodash.throttle = func.throttle;
  6920. lodash.thru = thru;
  6921. lodash.toArray = lang.toArray;
  6922. lodash.toPairs = object.toPairs;
  6923. lodash.toPairsIn = object.toPairsIn;
  6924. lodash.toPath = util.toPath;
  6925. lodash.toPlainObject = lang.toPlainObject;
  6926. lodash.transform = object.transform;
  6927. lodash.unary = func.unary;
  6928. lodash.union = array.union;
  6929. lodash.unionBy = array.unionBy;
  6930. lodash.unionWith = array.unionWith;
  6931. lodash.uniq = array.uniq;
  6932. lodash.uniqBy = array.uniqBy;
  6933. lodash.uniqWith = array.uniqWith;
  6934. lodash.unset = object.unset;
  6935. lodash.unzip = array.unzip;
  6936. lodash.unzipWith = array.unzipWith;
  6937. lodash.update = object.update;
  6938. lodash.updateWith = object.updateWith;
  6939. lodash.values = object.values;
  6940. lodash.valuesIn = object.valuesIn;
  6941. lodash.without = array.without;
  6942. lodash.words = string$1.words;
  6943. lodash.wrap = func.wrap;
  6944. lodash.xor = array.xor;
  6945. lodash.xorBy = array.xorBy;
  6946. lodash.xorWith = array.xorWith;
  6947. lodash.zip = array.zip;
  6948. lodash.zipObject = array.zipObject;
  6949. lodash.zipObjectDeep = array.zipObjectDeep;
  6950. lodash.zipWith = array.zipWith;
  6951. lodash.entries = object.toPairs;
  6952. lodash.entriesIn = object.toPairsIn;
  6953. lodash.extend = object.assignIn;
  6954. lodash.extendWith = object.assignInWith;
  6955. mixin(lodash, lodash);
  6956. lodash.add = math.add;
  6957. lodash.attempt = util.attempt;
  6958. lodash.camelCase = string$1.camelCase;
  6959. lodash.capitalize = string$1.capitalize;
  6960. lodash.ceil = math.ceil;
  6961. lodash.clamp = number.clamp;
  6962. lodash.clone = lang.clone;
  6963. lodash.cloneDeep = lang.cloneDeep;
  6964. lodash.cloneDeepWith = lang.cloneDeepWith;
  6965. lodash.cloneWith = lang.cloneWith;
  6966. lodash.conformsTo = lang.conformsTo;
  6967. lodash.deburr = string$1.deburr;
  6968. lodash.defaultTo = util.defaultTo;
  6969. lodash.divide = math.divide;
  6970. lodash.endsWith = string$1.endsWith;
  6971. lodash.eq = lang.eq;
  6972. lodash.escape = string$1.escape;
  6973. lodash.escapeRegExp = string$1.escapeRegExp;
  6974. lodash.every = collection.every;
  6975. lodash.find = collection.find;
  6976. lodash.findIndex = array.findIndex;
  6977. lodash.findKey = object.findKey;
  6978. lodash.findLast = collection.findLast;
  6979. lodash.findLastIndex = array.findLastIndex;
  6980. lodash.findLastKey = object.findLastKey;
  6981. lodash.floor = math.floor;
  6982. lodash.forEach = collection.forEach;
  6983. lodash.forEachRight = collection.forEachRight;
  6984. lodash.forIn = object.forIn;
  6985. lodash.forInRight = object.forInRight;
  6986. lodash.forOwn = object.forOwn;
  6987. lodash.forOwnRight = object.forOwnRight;
  6988. lodash.get = object.get;
  6989. lodash.gt = lang.gt;
  6990. lodash.gte = lang.gte;
  6991. lodash.has = object.has;
  6992. lodash.hasIn = object.hasIn;
  6993. lodash.head = array.head;
  6994. lodash.identity = identity;
  6995. lodash.includes = collection.includes;
  6996. lodash.indexOf = array.indexOf;
  6997. lodash.inRange = number.inRange;
  6998. lodash.invoke = object.invoke;
  6999. lodash.isArguments = lang.isArguments;
  7000. lodash.isArray = isArray;
  7001. lodash.isArrayBuffer = lang.isArrayBuffer;
  7002. lodash.isArrayLike = lang.isArrayLike;
  7003. lodash.isArrayLikeObject = lang.isArrayLikeObject;
  7004. lodash.isBoolean = lang.isBoolean;
  7005. lodash.isBuffer = lang.isBuffer;
  7006. lodash.isDate = lang.isDate;
  7007. lodash.isElement = lang.isElement;
  7008. lodash.isEmpty = lang.isEmpty;
  7009. lodash.isEqual = lang.isEqual;
  7010. lodash.isEqualWith = lang.isEqualWith;
  7011. lodash.isError = lang.isError;
  7012. lodash.isFinite = lang.isFinite;
  7013. lodash.isFunction = lang.isFunction;
  7014. lodash.isInteger = lang.isInteger;
  7015. lodash.isLength = lang.isLength;
  7016. lodash.isMap = lang.isMap;
  7017. lodash.isMatch = lang.isMatch;
  7018. lodash.isMatchWith = lang.isMatchWith;
  7019. lodash.isNaN = lang.isNaN;
  7020. lodash.isNative = lang.isNative;
  7021. lodash.isNil = lang.isNil;
  7022. lodash.isNull = lang.isNull;
  7023. lodash.isNumber = lang.isNumber;
  7024. lodash.isObject = isObject;
  7025. lodash.isObjectLike = lang.isObjectLike;
  7026. lodash.isPlainObject = lang.isPlainObject;
  7027. lodash.isRegExp = lang.isRegExp;
  7028. lodash.isSafeInteger = lang.isSafeInteger;
  7029. lodash.isSet = lang.isSet;
  7030. lodash.isString = lang.isString;
  7031. lodash.isSymbol = lang.isSymbol;
  7032. lodash.isTypedArray = lang.isTypedArray;
  7033. lodash.isUndefined = lang.isUndefined;
  7034. lodash.isWeakMap = lang.isWeakMap;
  7035. lodash.isWeakSet = lang.isWeakSet;
  7036. lodash.join = array.join;
  7037. lodash.kebabCase = string$1.kebabCase;
  7038. lodash.last = last;
  7039. lodash.lastIndexOf = array.lastIndexOf;
  7040. lodash.lowerCase = string$1.lowerCase;
  7041. lodash.lowerFirst = string$1.lowerFirst;
  7042. lodash.lt = lang.lt;
  7043. lodash.lte = lang.lte;
  7044. lodash.max = math.max;
  7045. lodash.maxBy = math.maxBy;
  7046. lodash.mean = math.mean;
  7047. lodash.meanBy = math.meanBy;
  7048. lodash.min = math.min;
  7049. lodash.minBy = math.minBy;
  7050. lodash.stubArray = util.stubArray;
  7051. lodash.stubFalse = util.stubFalse;
  7052. lodash.stubObject = util.stubObject;
  7053. lodash.stubString = util.stubString;
  7054. lodash.stubTrue = util.stubTrue;
  7055. lodash.multiply = math.multiply;
  7056. lodash.nth = array.nth;
  7057. lodash.noop = util.noop;
  7058. lodash.now = date.now;
  7059. lodash.pad = string$1.pad;
  7060. lodash.padEnd = string$1.padEnd;
  7061. lodash.padStart = string$1.padStart;
  7062. lodash.parseInt = string$1.parseInt;
  7063. lodash.random = number.random;
  7064. lodash.reduce = collection.reduce;
  7065. lodash.reduceRight = collection.reduceRight;
  7066. lodash.repeat = string$1.repeat;
  7067. lodash.replace = string$1.replace;
  7068. lodash.result = object.result;
  7069. lodash.round = math.round;
  7070. lodash.sample = collection.sample;
  7071. lodash.size = collection.size;
  7072. lodash.snakeCase = string$1.snakeCase;
  7073. lodash.some = collection.some;
  7074. lodash.sortedIndex = array.sortedIndex;
  7075. lodash.sortedIndexBy = array.sortedIndexBy;
  7076. lodash.sortedIndexOf = array.sortedIndexOf;
  7077. lodash.sortedLastIndex = array.sortedLastIndex;
  7078. lodash.sortedLastIndexBy = array.sortedLastIndexBy;
  7079. lodash.sortedLastIndexOf = array.sortedLastIndexOf;
  7080. lodash.startCase = string$1.startCase;
  7081. lodash.startsWith = string$1.startsWith;
  7082. lodash.subtract = math.subtract;
  7083. lodash.sum = math.sum;
  7084. lodash.sumBy = math.sumBy;
  7085. lodash.template = string$1.template;
  7086. lodash.times = util.times;
  7087. lodash.toFinite = lang.toFinite;
  7088. lodash.toInteger = toInteger;
  7089. lodash.toLength = lang.toLength;
  7090. lodash.toLower = string$1.toLower;
  7091. lodash.toNumber = lang.toNumber;
  7092. lodash.toSafeInteger = lang.toSafeInteger;
  7093. lodash.toString = lang.toString;
  7094. lodash.toUpper = string$1.toUpper;
  7095. lodash.trim = string$1.trim;
  7096. lodash.trimEnd = string$1.trimEnd;
  7097. lodash.trimStart = string$1.trimStart;
  7098. lodash.truncate = string$1.truncate;
  7099. lodash.unescape = string$1.unescape;
  7100. lodash.uniqueId = util.uniqueId;
  7101. lodash.upperCase = string$1.upperCase;
  7102. lodash.upperFirst = string$1.upperFirst;
  7103. lodash.each = collection.forEach;
  7104. lodash.eachRight = collection.forEachRight;
  7105. lodash.first = array.head;
  7106. mixin(lodash, function() {
  7107. var source = {};
  7108. baseForOwn(lodash, function(func2, methodName) {
  7109. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  7110. source[methodName] = func2;
  7111. }
  7112. });
  7113. return source;
  7114. }(), { "chain": false });
  7115. lodash.VERSION = VERSION;
  7116. (lodash.templateSettings = string$1.templateSettings).imports._ = lodash;
  7117. arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
  7118. lodash[methodName].placeholder = lodash;
  7119. });
  7120. arrayEach(["drop", "take"], function(methodName, index) {
  7121. LazyWrapper.prototype[methodName] = function(n) {
  7122. n = n === void 0 ? 1 : nativeMax(toInteger(n), 0);
  7123. var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
  7124. if (result.__filtered__) {
  7125. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  7126. } else {
  7127. result.__views__.push({
  7128. "size": nativeMin(n, MAX_ARRAY_LENGTH),
  7129. "type": methodName + (result.__dir__ < 0 ? "Right" : "")
  7130. });
  7131. }
  7132. return result;
  7133. };
  7134. LazyWrapper.prototype[methodName + "Right"] = function(n) {
  7135. return this.reverse()[methodName](n).reverse();
  7136. };
  7137. });
  7138. arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
  7139. var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  7140. LazyWrapper.prototype[methodName] = function(iteratee) {
  7141. var result = this.clone();
  7142. result.__iteratees__.push({
  7143. "iteratee": baseIteratee(iteratee),
  7144. "type": type
  7145. });
  7146. result.__filtered__ = result.__filtered__ || isFilter;
  7147. return result;
  7148. };
  7149. });
  7150. arrayEach(["head", "last"], function(methodName, index) {
  7151. var takeName = "take" + (index ? "Right" : "");
  7152. LazyWrapper.prototype[methodName] = function() {
  7153. return this[takeName](1).value()[0];
  7154. };
  7155. });
  7156. arrayEach(["initial", "tail"], function(methodName, index) {
  7157. var dropName = "drop" + (index ? "" : "Right");
  7158. LazyWrapper.prototype[methodName] = function() {
  7159. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  7160. };
  7161. });
  7162. LazyWrapper.prototype.compact = function() {
  7163. return this.filter(identity);
  7164. };
  7165. LazyWrapper.prototype.find = function(predicate) {
  7166. return this.filter(predicate).head();
  7167. };
  7168. LazyWrapper.prototype.findLast = function(predicate) {
  7169. return this.reverse().find(predicate);
  7170. };
  7171. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  7172. if (typeof path == "function") {
  7173. return new LazyWrapper(this);
  7174. }
  7175. return this.map(function(value) {
  7176. return baseInvoke(value, path, args);
  7177. });
  7178. });
  7179. LazyWrapper.prototype.reject = function(predicate) {
  7180. return this.filter(negate(baseIteratee(predicate)));
  7181. };
  7182. LazyWrapper.prototype.slice = function(start, end) {
  7183. start = toInteger(start);
  7184. var result = this;
  7185. if (result.__filtered__ && (start > 0 || end < 0)) {
  7186. return new LazyWrapper(result);
  7187. }
  7188. if (start < 0) {
  7189. result = result.takeRight(-start);
  7190. } else if (start) {
  7191. result = result.drop(start);
  7192. }
  7193. if (end !== void 0) {
  7194. end = toInteger(end);
  7195. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  7196. }
  7197. return result;
  7198. };
  7199. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  7200. return this.reverse().takeWhile(predicate).reverse();
  7201. };
  7202. LazyWrapper.prototype.toArray = function() {
  7203. return this.take(MAX_ARRAY_LENGTH);
  7204. };
  7205. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  7206. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
  7207. if (!lodashFunc) {
  7208. return;
  7209. }
  7210. lodash.prototype[methodName] = function() {
  7211. var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value);
  7212. var interceptor = function(value2) {
  7213. var result2 = lodashFunc.apply(lodash, arrayPush([value2], args));
  7214. return isTaker && chainAll ? result2[0] : result2;
  7215. };
  7216. if (useLazy && checkIteratee && typeof iteratee == "function" && iteratee.length != 1) {
  7217. isLazy = useLazy = false;
  7218. }
  7219. var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
  7220. if (!retUnwrapped && useLazy) {
  7221. value = onlyLazy ? value : new LazyWrapper(this);
  7222. var result = func2.apply(value, args);
  7223. result.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": void 0 });
  7224. return new LodashWrapper(result, chainAll);
  7225. }
  7226. if (isUnwrapped && onlyLazy) {
  7227. return func2.apply(this, args);
  7228. }
  7229. result = this.thru(interceptor);
  7230. return isUnwrapped ? isTaker ? result.value()[0] : result.value() : result;
  7231. };
  7232. });
  7233. arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
  7234. var func2 = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  7235. lodash.prototype[methodName] = function() {
  7236. var args = arguments;
  7237. if (retUnwrapped && !this.__chain__) {
  7238. var value = this.value();
  7239. return func2.apply(isArray(value) ? value : [], args);
  7240. }
  7241. return this[chainName](function(value2) {
  7242. return func2.apply(isArray(value2) ? value2 : [], args);
  7243. });
  7244. };
  7245. });
  7246. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  7247. var lodashFunc = lodash[methodName];
  7248. if (lodashFunc) {
  7249. var key = lodashFunc.name + "";
  7250. if (!hasOwnProperty.call(realNames, key)) {
  7251. realNames[key] = [];
  7252. }
  7253. realNames[key].push({ "name": methodName, "func": lodashFunc });
  7254. }
  7255. });
  7256. realNames[createHybrid(void 0, WRAP_BIND_KEY_FLAG).name] = [{
  7257. "name": "wrapper",
  7258. "func": void 0
  7259. }];
  7260. LazyWrapper.prototype.clone = lazyClone;
  7261. LazyWrapper.prototype.reverse = lazyReverse;
  7262. LazyWrapper.prototype.value = lazyValue;
  7263. lodash.prototype.at = seq.at;
  7264. lodash.prototype.chain = seq.wrapperChain;
  7265. lodash.prototype.commit = seq.commit;
  7266. lodash.prototype.next = seq.next;
  7267. lodash.prototype.plant = seq.plant;
  7268. lodash.prototype.reverse = seq.reverse;
  7269. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = seq.value;
  7270. lodash.prototype.first = lodash.prototype.head;
  7271. if (symIterator) {
  7272. lodash.prototype[symIterator] = seq.toIterator;
  7273. }
  7274. /**
  7275. * @license
  7276. * Lodash (Custom Build) <https://lodash.com/>
  7277. * Build: `lodash modularize exports="es" -o ./`
  7278. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  7279. * Released under MIT license <https://lodash.com/license>
  7280. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  7281. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  7282. */
  7283. const isUndefined = (val) => val === void 0;
  7284. const isBoolean = (val) => typeof val === "boolean";
  7285. const isNumber = (val) => typeof val === "number";
  7286. const isEmpty = (val) => !val && val !== 0 || isArray$1(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  7287. const isElement$2 = (e) => {
  7288. if (typeof Element === "undefined")
  7289. return false;
  7290. return e instanceof Element;
  7291. };
  7292. const isPropAbsent = (prop) => isNil(prop);
  7293. const isStringNumber = (val) => {
  7294. if (!isString$1(val)) {
  7295. return false;
  7296. }
  7297. return !Number.isNaN(Number(val));
  7298. };
  7299. const isWindow$1 = (val) => val === window;
  7300. const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
  7301. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  7302. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  7303. const capitalize = (str) => capitalize$2(str);
  7304. const keysOf = (arr) => Object.keys(arr);
  7305. const entriesOf = (arr) => Object.entries(arr);
  7306. const getProp = (obj, path, defaultValue) => {
  7307. return {
  7308. get value() {
  7309. return get(obj, path, defaultValue);
  7310. },
  7311. set value(val) {
  7312. set(obj, path, val);
  7313. }
  7314. };
  7315. };
  7316. class ElementPlusError extends Error {
  7317. constructor(m) {
  7318. super(m);
  7319. this.name = "ElementPlusError";
  7320. }
  7321. }
  7322. function throwError(scope, m) {
  7323. throw new ElementPlusError(`[${scope}] ${m}`);
  7324. }
  7325. function debugWarn(scope, message) {
  7326. const error = isString$1(scope) ? new ElementPlusError(`[${scope}] ${message}`) : scope;
  7327. console.warn(error);
  7328. }
  7329. const SCOPE$9 = "utils/dom/style";
  7330. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  7331. const hasClass = (el, cls) => {
  7332. if (!el || !cls)
  7333. return false;
  7334. if (cls.includes(" "))
  7335. throw new Error("className should not contain space.");
  7336. return el.classList.contains(cls);
  7337. };
  7338. const addClass = (el, cls) => {
  7339. if (!el || !cls.trim())
  7340. return;
  7341. el.classList.add(...classNameToArray(cls));
  7342. };
  7343. const removeClass = (el, cls) => {
  7344. if (!el || !cls.trim())
  7345. return;
  7346. el.classList.remove(...classNameToArray(cls));
  7347. };
  7348. const getStyle = (element, styleName) => {
  7349. var _a;
  7350. if (!isClient || !element || !styleName)
  7351. return "";
  7352. let key = camelize(styleName);
  7353. if (key === "float")
  7354. key = "cssFloat";
  7355. try {
  7356. const style = element.style[key];
  7357. if (style)
  7358. return style;
  7359. const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, "");
  7360. return computed ? computed[key] : "";
  7361. } catch (e) {
  7362. return element.style[key];
  7363. }
  7364. };
  7365. const setStyle = (element, styleName, value) => {
  7366. if (!element || !styleName)
  7367. return;
  7368. if (isObject$1(styleName)) {
  7369. entriesOf(styleName).forEach(([prop, value2]) => setStyle(element, prop, value2));
  7370. } else {
  7371. const key = camelize(styleName);
  7372. element.style[key] = value;
  7373. }
  7374. };
  7375. function addUnit(value, defaultUnit = "px") {
  7376. if (!value)
  7377. return "";
  7378. if (isNumber(value) || isStringNumber(value)) {
  7379. return `${value}${defaultUnit}`;
  7380. } else if (isString$1(value)) {
  7381. return value;
  7382. }
  7383. debugWarn(SCOPE$9, "binding value must be a string or number");
  7384. }
  7385. const isScroll = (el, isVertical) => {
  7386. if (!isClient)
  7387. return false;
  7388. const key = {
  7389. undefined: "overflow",
  7390. true: "overflow-y",
  7391. false: "overflow-x"
  7392. }[String(isVertical)];
  7393. const overflow = getStyle(el, key);
  7394. return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s));
  7395. };
  7396. const getScrollContainer = (el, isVertical) => {
  7397. if (!isClient)
  7398. return;
  7399. let parent = el;
  7400. while (parent) {
  7401. if ([window, document, document.documentElement].includes(parent))
  7402. return window;
  7403. if (isScroll(parent, isVertical))
  7404. return parent;
  7405. parent = parent.parentNode;
  7406. }
  7407. return parent;
  7408. };
  7409. let scrollBarWidth;
  7410. const getScrollBarWidth = (namespace) => {
  7411. var _a;
  7412. if (!isClient)
  7413. return 0;
  7414. if (scrollBarWidth !== void 0)
  7415. return scrollBarWidth;
  7416. const outer = document.createElement("div");
  7417. outer.className = `${namespace}-scrollbar__wrap`;
  7418. outer.style.visibility = "hidden";
  7419. outer.style.width = "100px";
  7420. outer.style.position = "absolute";
  7421. outer.style.top = "-9999px";
  7422. document.body.appendChild(outer);
  7423. const widthNoScroll = outer.offsetWidth;
  7424. outer.style.overflow = "scroll";
  7425. const inner = document.createElement("div");
  7426. inner.style.width = "100%";
  7427. outer.appendChild(inner);
  7428. const widthWithScroll = inner.offsetWidth;
  7429. (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
  7430. scrollBarWidth = widthNoScroll - widthWithScroll;
  7431. return scrollBarWidth;
  7432. };
  7433. function scrollIntoView(container, selected) {
  7434. if (!isClient)
  7435. return;
  7436. if (!selected) {
  7437. container.scrollTop = 0;
  7438. return;
  7439. }
  7440. const offsetParents = [];
  7441. let pointer = selected.offsetParent;
  7442. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  7443. offsetParents.push(pointer);
  7444. pointer = pointer.offsetParent;
  7445. }
  7446. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  7447. const bottom = top + selected.offsetHeight;
  7448. const viewRectTop = container.scrollTop;
  7449. const viewRectBottom = viewRectTop + container.clientHeight;
  7450. if (top < viewRectTop) {
  7451. container.scrollTop = top;
  7452. } else if (bottom > viewRectBottom) {
  7453. container.scrollTop = bottom - container.clientHeight;
  7454. }
  7455. }
  7456. function animateScrollTo(container, from, to, duration, callback) {
  7457. const startTime = Date.now();
  7458. let handle;
  7459. const scroll = () => {
  7460. const timestamp = Date.now();
  7461. const time = timestamp - startTime;
  7462. const nextScrollTop = easeInOutCubic(time > duration ? duration : time, from, to, duration);
  7463. if (isWindow$1(container)) {
  7464. container.scrollTo(window.pageXOffset, nextScrollTop);
  7465. } else {
  7466. container.scrollTop = nextScrollTop;
  7467. }
  7468. if (time < duration) {
  7469. handle = rAF(scroll);
  7470. } else if (isFunction$1(callback)) {
  7471. callback();
  7472. }
  7473. };
  7474. scroll();
  7475. return () => {
  7476. handle && cAF(handle);
  7477. };
  7478. }
  7479. const getScrollElement = (target, container) => {
  7480. if (isWindow$1(container)) {
  7481. return target.ownerDocument.documentElement;
  7482. }
  7483. return container;
  7484. };
  7485. const getScrollTop = (container) => {
  7486. if (isWindow$1(container)) {
  7487. return window.scrollY;
  7488. }
  7489. return container.scrollTop;
  7490. };
  7491. const getElement = (target) => {
  7492. if (!isClient || target === "")
  7493. return null;
  7494. if (isString$1(target)) {
  7495. try {
  7496. return document.querySelector(target);
  7497. } catch (e) {
  7498. return null;
  7499. }
  7500. }
  7501. return target;
  7502. };
  7503. let target = !isClient ? void 0 : document.body;
  7504. function createGlobalNode(id) {
  7505. const el = document.createElement("div");
  7506. if (id !== void 0) {
  7507. el.setAttribute("id", id);
  7508. }
  7509. if (target) {
  7510. target.appendChild(el);
  7511. }
  7512. return el;
  7513. }
  7514. function removeGlobalNode(el) {
  7515. el.remove();
  7516. }
  7517. var _sfc_main6 = /* @__PURE__ */ defineComponent({
  7518. name: "ArrowDown",
  7519. __name: "arrow-down",
  7520. setup(__props) {
  7521. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7522. xmlns: "http://www.w3.org/2000/svg",
  7523. viewBox: "0 0 1024 1024"
  7524. }, [
  7525. createElementVNode("path", {
  7526. fill: "currentColor",
  7527. 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"
  7528. })
  7529. ]));
  7530. }
  7531. });
  7532. var arrow_down_default = _sfc_main6;
  7533. var _sfc_main8 = /* @__PURE__ */ defineComponent({
  7534. name: "ArrowLeft",
  7535. __name: "arrow-left",
  7536. setup(__props) {
  7537. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7538. xmlns: "http://www.w3.org/2000/svg",
  7539. viewBox: "0 0 1024 1024"
  7540. }, [
  7541. createElementVNode("path", {
  7542. fill: "currentColor",
  7543. 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"
  7544. })
  7545. ]));
  7546. }
  7547. });
  7548. var arrow_left_default = _sfc_main8;
  7549. var _sfc_main10 = /* @__PURE__ */ defineComponent({
  7550. name: "ArrowRight",
  7551. __name: "arrow-right",
  7552. setup(__props) {
  7553. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7554. xmlns: "http://www.w3.org/2000/svg",
  7555. viewBox: "0 0 1024 1024"
  7556. }, [
  7557. createElementVNode("path", {
  7558. fill: "currentColor",
  7559. 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"
  7560. })
  7561. ]));
  7562. }
  7563. });
  7564. var arrow_right_default = _sfc_main10;
  7565. var _sfc_main12 = /* @__PURE__ */ defineComponent({
  7566. name: "ArrowUp",
  7567. __name: "arrow-up",
  7568. setup(__props) {
  7569. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7570. xmlns: "http://www.w3.org/2000/svg",
  7571. viewBox: "0 0 1024 1024"
  7572. }, [
  7573. createElementVNode("path", {
  7574. fill: "currentColor",
  7575. 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"
  7576. })
  7577. ]));
  7578. }
  7579. });
  7580. var arrow_up_default = _sfc_main12;
  7581. var _sfc_main14 = /* @__PURE__ */ defineComponent({
  7582. name: "Back",
  7583. __name: "back",
  7584. setup(__props) {
  7585. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7586. xmlns: "http://www.w3.org/2000/svg",
  7587. viewBox: "0 0 1024 1024"
  7588. }, [
  7589. createElementVNode("path", {
  7590. fill: "currentColor",
  7591. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64"
  7592. }),
  7593. createElementVNode("path", {
  7594. fill: "currentColor",
  7595. 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"
  7596. })
  7597. ]));
  7598. }
  7599. });
  7600. var back_default = _sfc_main14;
  7601. var _sfc_main29 = /* @__PURE__ */ defineComponent({
  7602. name: "Calendar",
  7603. __name: "calendar",
  7604. setup(__props) {
  7605. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7606. xmlns: "http://www.w3.org/2000/svg",
  7607. viewBox: "0 0 1024 1024"
  7608. }, [
  7609. createElementVNode("path", {
  7610. fill: "currentColor",
  7611. 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"
  7612. })
  7613. ]));
  7614. }
  7615. });
  7616. var calendar_default = _sfc_main29;
  7617. var _sfc_main34 = /* @__PURE__ */ defineComponent({
  7618. name: "CaretRight",
  7619. __name: "caret-right",
  7620. setup(__props) {
  7621. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7622. xmlns: "http://www.w3.org/2000/svg",
  7623. viewBox: "0 0 1024 1024"
  7624. }, [
  7625. createElementVNode("path", {
  7626. fill: "currentColor",
  7627. d: "M384 192v640l384-320.064z"
  7628. })
  7629. ]));
  7630. }
  7631. });
  7632. var caret_right_default = _sfc_main34;
  7633. var _sfc_main35 = /* @__PURE__ */ defineComponent({
  7634. name: "CaretTop",
  7635. __name: "caret-top",
  7636. setup(__props) {
  7637. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7638. xmlns: "http://www.w3.org/2000/svg",
  7639. viewBox: "0 0 1024 1024"
  7640. }, [
  7641. createElementVNode("path", {
  7642. fill: "currentColor",
  7643. d: "M512 320 192 704h639.936z"
  7644. })
  7645. ]));
  7646. }
  7647. });
  7648. var caret_top_default = _sfc_main35;
  7649. var _sfc_main43 = /* @__PURE__ */ defineComponent({
  7650. name: "Check",
  7651. __name: "check",
  7652. setup(__props) {
  7653. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7654. xmlns: "http://www.w3.org/2000/svg",
  7655. viewBox: "0 0 1024 1024"
  7656. }, [
  7657. createElementVNode("path", {
  7658. fill: "currentColor",
  7659. 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"
  7660. })
  7661. ]));
  7662. }
  7663. });
  7664. var check_default = _sfc_main43;
  7665. var _sfc_main48 = /* @__PURE__ */ defineComponent({
  7666. name: "CircleCheckFilled",
  7667. __name: "circle-check-filled",
  7668. setup(__props) {
  7669. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7670. xmlns: "http://www.w3.org/2000/svg",
  7671. viewBox: "0 0 1024 1024"
  7672. }, [
  7673. createElementVNode("path", {
  7674. fill: "currentColor",
  7675. 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"
  7676. })
  7677. ]));
  7678. }
  7679. });
  7680. var circle_check_filled_default = _sfc_main48;
  7681. var _sfc_main49 = /* @__PURE__ */ defineComponent({
  7682. name: "CircleCheck",
  7683. __name: "circle-check",
  7684. setup(__props) {
  7685. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7686. xmlns: "http://www.w3.org/2000/svg",
  7687. viewBox: "0 0 1024 1024"
  7688. }, [
  7689. createElementVNode("path", {
  7690. fill: "currentColor",
  7691. 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"
  7692. }),
  7693. createElementVNode("path", {
  7694. fill: "currentColor",
  7695. 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"
  7696. })
  7697. ]));
  7698. }
  7699. });
  7700. var circle_check_default = _sfc_main49;
  7701. var _sfc_main50 = /* @__PURE__ */ defineComponent({
  7702. name: "CircleCloseFilled",
  7703. __name: "circle-close-filled",
  7704. setup(__props) {
  7705. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7706. xmlns: "http://www.w3.org/2000/svg",
  7707. viewBox: "0 0 1024 1024"
  7708. }, [
  7709. createElementVNode("path", {
  7710. fill: "currentColor",
  7711. 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"
  7712. })
  7713. ]));
  7714. }
  7715. });
  7716. var circle_close_filled_default = _sfc_main50;
  7717. var _sfc_main51 = /* @__PURE__ */ defineComponent({
  7718. name: "CircleClose",
  7719. __name: "circle-close",
  7720. setup(__props) {
  7721. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7722. xmlns: "http://www.w3.org/2000/svg",
  7723. viewBox: "0 0 1024 1024"
  7724. }, [
  7725. createElementVNode("path", {
  7726. fill: "currentColor",
  7727. 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"
  7728. }),
  7729. createElementVNode("path", {
  7730. fill: "currentColor",
  7731. 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"
  7732. })
  7733. ]));
  7734. }
  7735. });
  7736. var circle_close_default = _sfc_main51;
  7737. var _sfc_main54 = /* @__PURE__ */ defineComponent({
  7738. name: "Clock",
  7739. __name: "clock",
  7740. setup(__props) {
  7741. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7742. xmlns: "http://www.w3.org/2000/svg",
  7743. viewBox: "0 0 1024 1024"
  7744. }, [
  7745. createElementVNode("path", {
  7746. fill: "currentColor",
  7747. 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"
  7748. }),
  7749. createElementVNode("path", {
  7750. fill: "currentColor",
  7751. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
  7752. }),
  7753. createElementVNode("path", {
  7754. fill: "currentColor",
  7755. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32"
  7756. })
  7757. ]));
  7758. }
  7759. });
  7760. var clock_default = _sfc_main54;
  7761. var _sfc_main56 = /* @__PURE__ */ defineComponent({
  7762. name: "Close",
  7763. __name: "close",
  7764. setup(__props) {
  7765. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7766. xmlns: "http://www.w3.org/2000/svg",
  7767. viewBox: "0 0 1024 1024"
  7768. }, [
  7769. createElementVNode("path", {
  7770. fill: "currentColor",
  7771. 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"
  7772. })
  7773. ]));
  7774. }
  7775. });
  7776. var close_default = _sfc_main56;
  7777. var _sfc_main72 = /* @__PURE__ */ defineComponent({
  7778. name: "DArrowLeft",
  7779. __name: "d-arrow-left",
  7780. setup(__props) {
  7781. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7782. xmlns: "http://www.w3.org/2000/svg",
  7783. viewBox: "0 0 1024 1024"
  7784. }, [
  7785. createElementVNode("path", {
  7786. fill: "currentColor",
  7787. 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"
  7788. })
  7789. ]));
  7790. }
  7791. });
  7792. var d_arrow_left_default = _sfc_main72;
  7793. var _sfc_main73 = /* @__PURE__ */ defineComponent({
  7794. name: "DArrowRight",
  7795. __name: "d-arrow-right",
  7796. setup(__props) {
  7797. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7798. xmlns: "http://www.w3.org/2000/svg",
  7799. viewBox: "0 0 1024 1024"
  7800. }, [
  7801. createElementVNode("path", {
  7802. fill: "currentColor",
  7803. 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"
  7804. })
  7805. ]));
  7806. }
  7807. });
  7808. var d_arrow_right_default = _sfc_main73;
  7809. var _sfc_main80 = /* @__PURE__ */ defineComponent({
  7810. name: "Delete",
  7811. __name: "delete",
  7812. setup(__props) {
  7813. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7814. xmlns: "http://www.w3.org/2000/svg",
  7815. viewBox: "0 0 1024 1024"
  7816. }, [
  7817. createElementVNode("path", {
  7818. fill: "currentColor",
  7819. 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"
  7820. })
  7821. ]));
  7822. }
  7823. });
  7824. var delete_default = _sfc_main80;
  7825. var _sfc_main90 = /* @__PURE__ */ defineComponent({
  7826. name: "Document",
  7827. __name: "document",
  7828. setup(__props) {
  7829. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7830. xmlns: "http://www.w3.org/2000/svg",
  7831. viewBox: "0 0 1024 1024"
  7832. }, [
  7833. createElementVNode("path", {
  7834. fill: "currentColor",
  7835. 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"
  7836. })
  7837. ]));
  7838. }
  7839. });
  7840. var document_default = _sfc_main90;
  7841. var _sfc_main118 = /* @__PURE__ */ defineComponent({
  7842. name: "FullScreen",
  7843. __name: "full-screen",
  7844. setup(__props) {
  7845. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7846. xmlns: "http://www.w3.org/2000/svg",
  7847. viewBox: "0 0 1024 1024"
  7848. }, [
  7849. createElementVNode("path", {
  7850. fill: "currentColor",
  7851. 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"
  7852. })
  7853. ]));
  7854. }
  7855. });
  7856. var full_screen_default = _sfc_main118;
  7857. var _sfc_main133 = /* @__PURE__ */ defineComponent({
  7858. name: "Hide",
  7859. __name: "hide",
  7860. setup(__props) {
  7861. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7862. xmlns: "http://www.w3.org/2000/svg",
  7863. viewBox: "0 0 1024 1024"
  7864. }, [
  7865. createElementVNode("path", {
  7866. fill: "currentColor",
  7867. 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"
  7868. }),
  7869. createElementVNode("path", {
  7870. fill: "currentColor",
  7871. 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"
  7872. })
  7873. ]));
  7874. }
  7875. });
  7876. var hide_default = _sfc_main133;
  7877. var _sfc_main143 = /* @__PURE__ */ defineComponent({
  7878. name: "InfoFilled",
  7879. __name: "info-filled",
  7880. setup(__props) {
  7881. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7882. xmlns: "http://www.w3.org/2000/svg",
  7883. viewBox: "0 0 1024 1024"
  7884. }, [
  7885. createElementVNode("path", {
  7886. fill: "currentColor",
  7887. 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"
  7888. })
  7889. ]));
  7890. }
  7891. });
  7892. var info_filled_default = _sfc_main143;
  7893. var _sfc_main150 = /* @__PURE__ */ defineComponent({
  7894. name: "Loading",
  7895. __name: "loading",
  7896. setup(__props) {
  7897. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7898. xmlns: "http://www.w3.org/2000/svg",
  7899. viewBox: "0 0 1024 1024"
  7900. }, [
  7901. createElementVNode("path", {
  7902. fill: "currentColor",
  7903. 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"
  7904. })
  7905. ]));
  7906. }
  7907. });
  7908. var loading_default = _sfc_main150;
  7909. var _sfc_main169 = /* @__PURE__ */ defineComponent({
  7910. name: "Minus",
  7911. __name: "minus",
  7912. setup(__props) {
  7913. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7914. xmlns: "http://www.w3.org/2000/svg",
  7915. viewBox: "0 0 1024 1024"
  7916. }, [
  7917. createElementVNode("path", {
  7918. fill: "currentColor",
  7919. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
  7920. })
  7921. ]));
  7922. }
  7923. });
  7924. var minus_default = _sfc_main169;
  7925. var _sfc_main174 = /* @__PURE__ */ defineComponent({
  7926. name: "MoreFilled",
  7927. __name: "more-filled",
  7928. setup(__props) {
  7929. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7930. xmlns: "http://www.w3.org/2000/svg",
  7931. viewBox: "0 0 1024 1024"
  7932. }, [
  7933. createElementVNode("path", {
  7934. fill: "currentColor",
  7935. 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"
  7936. })
  7937. ]));
  7938. }
  7939. });
  7940. var more_filled_default = _sfc_main174;
  7941. var _sfc_main175 = /* @__PURE__ */ defineComponent({
  7942. name: "More",
  7943. __name: "more",
  7944. setup(__props) {
  7945. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7946. xmlns: "http://www.w3.org/2000/svg",
  7947. viewBox: "0 0 1024 1024"
  7948. }, [
  7949. createElementVNode("path", {
  7950. fill: "currentColor",
  7951. 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"
  7952. })
  7953. ]));
  7954. }
  7955. });
  7956. var more_default = _sfc_main175;
  7957. var _sfc_main195 = /* @__PURE__ */ defineComponent({
  7958. name: "PictureFilled",
  7959. __name: "picture-filled",
  7960. setup(__props) {
  7961. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7962. xmlns: "http://www.w3.org/2000/svg",
  7963. viewBox: "0 0 1024 1024"
  7964. }, [
  7965. createElementVNode("path", {
  7966. fill: "currentColor",
  7967. 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"
  7968. })
  7969. ]));
  7970. }
  7971. });
  7972. var picture_filled_default = _sfc_main195;
  7973. var _sfc_main201 = /* @__PURE__ */ defineComponent({
  7974. name: "Plus",
  7975. __name: "plus",
  7976. setup(__props) {
  7977. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7978. xmlns: "http://www.w3.org/2000/svg",
  7979. viewBox: "0 0 1024 1024"
  7980. }, [
  7981. createElementVNode("path", {
  7982. fill: "currentColor",
  7983. 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"
  7984. })
  7985. ]));
  7986. }
  7987. });
  7988. var plus_default = _sfc_main201;
  7989. var _sfc_main211 = /* @__PURE__ */ defineComponent({
  7990. name: "QuestionFilled",
  7991. __name: "question-filled",
  7992. setup(__props) {
  7993. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7994. xmlns: "http://www.w3.org/2000/svg",
  7995. viewBox: "0 0 1024 1024"
  7996. }, [
  7997. createElementVNode("path", {
  7998. fill: "currentColor",
  7999. 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"
  8000. })
  8001. ]));
  8002. }
  8003. });
  8004. var question_filled_default = _sfc_main211;
  8005. var _sfc_main215 = /* @__PURE__ */ defineComponent({
  8006. name: "RefreshLeft",
  8007. __name: "refresh-left",
  8008. setup(__props) {
  8009. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8010. xmlns: "http://www.w3.org/2000/svg",
  8011. viewBox: "0 0 1024 1024"
  8012. }, [
  8013. createElementVNode("path", {
  8014. fill: "currentColor",
  8015. 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"
  8016. })
  8017. ]));
  8018. }
  8019. });
  8020. var refresh_left_default = _sfc_main215;
  8021. var _sfc_main216 = /* @__PURE__ */ defineComponent({
  8022. name: "RefreshRight",
  8023. __name: "refresh-right",
  8024. setup(__props) {
  8025. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8026. xmlns: "http://www.w3.org/2000/svg",
  8027. viewBox: "0 0 1024 1024"
  8028. }, [
  8029. createElementVNode("path", {
  8030. fill: "currentColor",
  8031. 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"
  8032. })
  8033. ]));
  8034. }
  8035. });
  8036. var refresh_right_default = _sfc_main216;
  8037. var _sfc_main222 = /* @__PURE__ */ defineComponent({
  8038. name: "ScaleToOriginal",
  8039. __name: "scale-to-original",
  8040. setup(__props) {
  8041. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8042. xmlns: "http://www.w3.org/2000/svg",
  8043. viewBox: "0 0 1024 1024"
  8044. }, [
  8045. createElementVNode("path", {
  8046. fill: "currentColor",
  8047. 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"
  8048. })
  8049. ]));
  8050. }
  8051. });
  8052. var scale_to_original_default = _sfc_main222;
  8053. var _sfc_main225 = /* @__PURE__ */ defineComponent({
  8054. name: "Search",
  8055. __name: "search",
  8056. setup(__props) {
  8057. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8058. xmlns: "http://www.w3.org/2000/svg",
  8059. viewBox: "0 0 1024 1024"
  8060. }, [
  8061. createElementVNode("path", {
  8062. fill: "currentColor",
  8063. 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"
  8064. })
  8065. ]));
  8066. }
  8067. });
  8068. var search_default = _sfc_main225;
  8069. var _sfc_main242 = /* @__PURE__ */ defineComponent({
  8070. name: "SortDown",
  8071. __name: "sort-down",
  8072. setup(__props) {
  8073. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8074. xmlns: "http://www.w3.org/2000/svg",
  8075. viewBox: "0 0 1024 1024"
  8076. }, [
  8077. createElementVNode("path", {
  8078. fill: "currentColor",
  8079. 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"
  8080. })
  8081. ]));
  8082. }
  8083. });
  8084. var sort_down_default = _sfc_main242;
  8085. var _sfc_main243 = /* @__PURE__ */ defineComponent({
  8086. name: "SortUp",
  8087. __name: "sort-up",
  8088. setup(__props) {
  8089. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8090. xmlns: "http://www.w3.org/2000/svg",
  8091. viewBox: "0 0 1024 1024"
  8092. }, [
  8093. createElementVNode("path", {
  8094. fill: "currentColor",
  8095. 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"
  8096. })
  8097. ]));
  8098. }
  8099. });
  8100. var sort_up_default = _sfc_main243;
  8101. var _sfc_main246 = /* @__PURE__ */ defineComponent({
  8102. name: "StarFilled",
  8103. __name: "star-filled",
  8104. setup(__props) {
  8105. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8106. xmlns: "http://www.w3.org/2000/svg",
  8107. viewBox: "0 0 1024 1024"
  8108. }, [
  8109. createElementVNode("path", {
  8110. fill: "currentColor",
  8111. 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"
  8112. })
  8113. ]));
  8114. }
  8115. });
  8116. var star_filled_default = _sfc_main246;
  8117. var _sfc_main247 = /* @__PURE__ */ defineComponent({
  8118. name: "Star",
  8119. __name: "star",
  8120. setup(__props) {
  8121. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8122. xmlns: "http://www.w3.org/2000/svg",
  8123. viewBox: "0 0 1024 1024"
  8124. }, [
  8125. createElementVNode("path", {
  8126. fill: "currentColor",
  8127. 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"
  8128. })
  8129. ]));
  8130. }
  8131. });
  8132. var star_default = _sfc_main247;
  8133. var _sfc_main249 = /* @__PURE__ */ defineComponent({
  8134. name: "SuccessFilled",
  8135. __name: "success-filled",
  8136. setup(__props) {
  8137. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8138. xmlns: "http://www.w3.org/2000/svg",
  8139. viewBox: "0 0 1024 1024"
  8140. }, [
  8141. createElementVNode("path", {
  8142. fill: "currentColor",
  8143. 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"
  8144. })
  8145. ]));
  8146. }
  8147. });
  8148. var success_filled_default = _sfc_main249;
  8149. var _sfc_main283 = /* @__PURE__ */ defineComponent({
  8150. name: "View",
  8151. __name: "view",
  8152. setup(__props) {
  8153. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8154. xmlns: "http://www.w3.org/2000/svg",
  8155. viewBox: "0 0 1024 1024"
  8156. }, [
  8157. createElementVNode("path", {
  8158. fill: "currentColor",
  8159. 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"
  8160. })
  8161. ]));
  8162. }
  8163. });
  8164. var view_default = _sfc_main283;
  8165. var _sfc_main287 = /* @__PURE__ */ defineComponent({
  8166. name: "WarningFilled",
  8167. __name: "warning-filled",
  8168. setup(__props) {
  8169. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8170. xmlns: "http://www.w3.org/2000/svg",
  8171. viewBox: "0 0 1024 1024"
  8172. }, [
  8173. createElementVNode("path", {
  8174. fill: "currentColor",
  8175. 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"
  8176. })
  8177. ]));
  8178. }
  8179. });
  8180. var warning_filled_default = _sfc_main287;
  8181. var _sfc_main292 = /* @__PURE__ */ defineComponent({
  8182. name: "ZoomIn",
  8183. __name: "zoom-in",
  8184. setup(__props) {
  8185. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8186. xmlns: "http://www.w3.org/2000/svg",
  8187. viewBox: "0 0 1024 1024"
  8188. }, [
  8189. createElementVNode("path", {
  8190. fill: "currentColor",
  8191. 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"
  8192. })
  8193. ]));
  8194. }
  8195. });
  8196. var zoom_in_default = _sfc_main292;
  8197. var _sfc_main293 = /* @__PURE__ */ defineComponent({
  8198. name: "ZoomOut",
  8199. __name: "zoom-out",
  8200. setup(__props) {
  8201. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  8202. xmlns: "http://www.w3.org/2000/svg",
  8203. viewBox: "0 0 1024 1024"
  8204. }, [
  8205. createElementVNode("path", {
  8206. fill: "currentColor",
  8207. 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"
  8208. })
  8209. ]));
  8210. }
  8211. });
  8212. var zoom_out_default = _sfc_main293;
  8213. /*! Element Plus Icons Vue v2.3.2 */
  8214. const epPropKey = "__epPropKey";
  8215. const definePropType = (val) => val;
  8216. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  8217. const buildProp = (prop, key) => {
  8218. if (!isObject$1(prop) || isEpProp(prop))
  8219. return prop;
  8220. const { values, required, default: defaultValue, type, validator } = prop;
  8221. const _validator = values || validator ? (val) => {
  8222. let valid = false;
  8223. let allowedValues = [];
  8224. if (values) {
  8225. allowedValues = Array.from(values);
  8226. if (hasOwn(prop, "default")) {
  8227. allowedValues.push(defaultValue);
  8228. }
  8229. valid || (valid = allowedValues.includes(val));
  8230. }
  8231. if (validator)
  8232. valid || (valid = validator(val));
  8233. if (!valid && allowedValues.length > 0) {
  8234. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  8235. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  8236. }
  8237. return valid;
  8238. } : void 0;
  8239. const epProp = {
  8240. type,
  8241. required: !!required,
  8242. validator: _validator,
  8243. [epPropKey]: true
  8244. };
  8245. if (hasOwn(prop, "default"))
  8246. epProp.default = defaultValue;
  8247. return epProp;
  8248. };
  8249. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  8250. key,
  8251. buildProp(option, key)
  8252. ]));
  8253. const iconPropType = definePropType([
  8254. String,
  8255. Object,
  8256. Function
  8257. ]);
  8258. const CloseComponents = {
  8259. Close: close_default
  8260. };
  8261. const TypeComponents = {
  8262. Close: close_default,
  8263. SuccessFilled: success_filled_default,
  8264. InfoFilled: info_filled_default,
  8265. WarningFilled: warning_filled_default,
  8266. CircleCloseFilled: circle_close_filled_default
  8267. };
  8268. const TypeComponentsMap = {
  8269. primary: info_filled_default,
  8270. success: success_filled_default,
  8271. warning: warning_filled_default,
  8272. error: circle_close_filled_default,
  8273. info: info_filled_default
  8274. };
  8275. const ValidateComponentsMap = {
  8276. validating: loading_default,
  8277. success: circle_check_default,
  8278. error: circle_close_default
  8279. };
  8280. const withInstall = (main, extra) => {
  8281. main.install = (app) => {
  8282. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  8283. app.component(comp.name, comp);
  8284. }
  8285. };
  8286. if (extra) {
  8287. for (const [key, comp] of Object.entries(extra)) {
  8288. main[key] = comp;
  8289. }
  8290. }
  8291. return main;
  8292. };
  8293. const withInstallFunction = (fn, name) => {
  8294. fn.install = (app) => {
  8295. fn._context = app._context;
  8296. app.config.globalProperties[name] = fn;
  8297. };
  8298. return fn;
  8299. };
  8300. const withInstallDirective = (directive, name) => {
  8301. directive.install = (app) => {
  8302. app.directive(name, directive);
  8303. };
  8304. return directive;
  8305. };
  8306. const withNoopInstall = (component) => {
  8307. component.install = NOOP;
  8308. return component;
  8309. };
  8310. const composeRefs = (...refs) => {
  8311. return (el) => {
  8312. refs.forEach((ref) => {
  8313. ref.value = el;
  8314. });
  8315. };
  8316. };
  8317. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  8318. const SCOPE$8 = "utils/vue/vnode";
  8319. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  8320. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  8321. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  8322. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  8323. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  8324. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  8325. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  8326. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  8327. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  8328. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  8329. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  8330. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  8331. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  8332. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  8333. return PatchFlags2;
  8334. })(PatchFlags || {});
  8335. function isFragment(node) {
  8336. return isVNode(node) && node.type === Fragment;
  8337. }
  8338. function isComment(node) {
  8339. return isVNode(node) && node.type === Comment;
  8340. }
  8341. function isValidElementNode(node) {
  8342. return isVNode(node) && !isFragment(node) && !isComment(node);
  8343. }
  8344. const getNormalizedProps = (node) => {
  8345. if (!isVNode(node)) {
  8346. debugWarn(SCOPE$8, "[getNormalizedProps] must be a VNode");
  8347. return {};
  8348. }
  8349. const raw = node.props || {};
  8350. const type = (isVNode(node.type) ? node.type.props : void 0) || {};
  8351. const props = {};
  8352. Object.keys(type).forEach((key) => {
  8353. if (hasOwn(type[key], "default")) {
  8354. props[key] = type[key].default;
  8355. }
  8356. });
  8357. Object.keys(raw).forEach((key) => {
  8358. props[camelize(key)] = raw[key];
  8359. });
  8360. return props;
  8361. };
  8362. const flattedChildren = (children) => {
  8363. const vNodes = isArray$1(children) ? children : [children];
  8364. const result = [];
  8365. vNodes.forEach((child) => {
  8366. var _a;
  8367. if (isArray$1(child)) {
  8368. result.push(...flattedChildren(child));
  8369. } else if (isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
  8370. result.push(child, ...flattedChildren(child.component.subTree));
  8371. } else if (isVNode(child) && isArray$1(child.children)) {
  8372. result.push(...flattedChildren(child.children));
  8373. } else if (isVNode(child) && child.shapeFlag === 2) {
  8374. result.push(...flattedChildren(child.type()));
  8375. } else {
  8376. result.push(child);
  8377. }
  8378. });
  8379. return result;
  8380. };
  8381. const unique = (arr) => [...new Set(arr)];
  8382. const extractFirst = (arr) => {
  8383. return isArray$1(arr) ? arr[0] : arr;
  8384. };
  8385. const castArray = (arr) => {
  8386. if (!arr && arr !== 0)
  8387. return [];
  8388. return isArray$1(arr) ? arr : [arr];
  8389. };
  8390. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  8391. const mutable = (val) => val;
  8392. function throttleByRaf(cb) {
  8393. let timer = 0;
  8394. const throttle = (...args) => {
  8395. if (timer) {
  8396. cAF(timer);
  8397. }
  8398. timer = rAF(() => {
  8399. cb(...args);
  8400. timer = 0;
  8401. });
  8402. };
  8403. throttle.cancel = () => {
  8404. cAF(timer);
  8405. timer = 0;
  8406. };
  8407. return throttle;
  8408. }
  8409. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8410. const LISTENER_PREFIX = /^on[A-Z]/;
  8411. const useAttrs = (params = {}) => {
  8412. const { excludeListeners = false, excludeKeys } = params;
  8413. const allExcludeKeys = computed(() => {
  8414. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  8415. });
  8416. const instance = getCurrentInstance();
  8417. if (!instance) {
  8418. debugWarn("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function");
  8419. return computed(() => ({}));
  8420. }
  8421. return computed(() => {
  8422. var _a;
  8423. return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  8424. });
  8425. };
  8426. function useCalcInputWidth() {
  8427. const calculatorRef = shallowRef();
  8428. const calculatorWidth = ref(0);
  8429. const inputStyle = computed(() => ({
  8430. minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px`
  8431. }));
  8432. const resetCalculatorWidth = () => {
  8433. var _a, _b;
  8434. calculatorWidth.value = (_b = (_a = calculatorRef.value) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 0;
  8435. };
  8436. useResizeObserver(calculatorRef, resetCalculatorWidth);
  8437. return {
  8438. calculatorRef,
  8439. calculatorWidth,
  8440. inputStyle
  8441. };
  8442. }
  8443. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  8444. watch(() => unref(condition), (val) => {
  8445. if (val) {
  8446. debugWarn(scope, `[${type}] ${from} is about to be deprecated in version ${version}, please use ${replacement} instead.
  8447. For more detail, please visit: ${ref}
  8448. `);
  8449. }
  8450. }, {
  8451. immediate: true
  8452. });
  8453. };
  8454. const useDraggable = (targetRef, dragRef, draggable, overflow) => {
  8455. const transform = {
  8456. offsetX: 0,
  8457. offsetY: 0
  8458. };
  8459. const isDragging = ref(false);
  8460. const adjustPosition = (moveX, moveY) => {
  8461. if (targetRef.value) {
  8462. const { offsetX, offsetY } = transform;
  8463. const targetRect = targetRef.value.getBoundingClientRect();
  8464. const targetLeft = targetRect.left;
  8465. const targetTop = targetRect.top;
  8466. const targetWidth = targetRect.width;
  8467. const targetHeight = targetRect.height;
  8468. const clientWidth = document.documentElement.clientWidth;
  8469. const clientHeight = document.documentElement.clientHeight;
  8470. const minLeft = -targetLeft + offsetX;
  8471. const minTop = -targetTop + offsetY;
  8472. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  8473. const maxTop = clientHeight - targetTop - (targetHeight < clientHeight ? targetHeight : 0) + offsetY;
  8474. if (!(overflow == null ? void 0 : overflow.value)) {
  8475. moveX = Math.min(Math.max(moveX, minLeft), maxLeft);
  8476. moveY = Math.min(Math.max(moveY, minTop), maxTop);
  8477. }
  8478. transform.offsetX = moveX;
  8479. transform.offsetY = moveY;
  8480. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  8481. }
  8482. };
  8483. const onMousedown = (e) => {
  8484. const downX = e.clientX;
  8485. const downY = e.clientY;
  8486. const { offsetX, offsetY } = transform;
  8487. const onMousemove = (e2) => {
  8488. if (!isDragging.value) {
  8489. isDragging.value = true;
  8490. }
  8491. const moveX = offsetX + e2.clientX - downX;
  8492. const moveY = offsetY + e2.clientY - downY;
  8493. adjustPosition(moveX, moveY);
  8494. };
  8495. const onMouseup = () => {
  8496. isDragging.value = false;
  8497. document.removeEventListener("mousemove", onMousemove);
  8498. document.removeEventListener("mouseup", onMouseup);
  8499. };
  8500. document.addEventListener("mousemove", onMousemove);
  8501. document.addEventListener("mouseup", onMouseup);
  8502. };
  8503. const onDraggable = () => {
  8504. if (dragRef.value && targetRef.value) {
  8505. dragRef.value.addEventListener("mousedown", onMousedown);
  8506. window.addEventListener("resize", updatePosition);
  8507. }
  8508. };
  8509. const offDraggable = () => {
  8510. if (dragRef.value && targetRef.value) {
  8511. dragRef.value.removeEventListener("mousedown", onMousedown);
  8512. window.removeEventListener("resize", updatePosition);
  8513. }
  8514. };
  8515. const resetPosition = () => {
  8516. transform.offsetX = 0;
  8517. transform.offsetY = 0;
  8518. if (targetRef.value) {
  8519. targetRef.value.style.transform = "";
  8520. }
  8521. };
  8522. const updatePosition = () => {
  8523. const { offsetX, offsetY } = transform;
  8524. adjustPosition(offsetX, offsetY);
  8525. };
  8526. onMounted(() => {
  8527. watchEffect(() => {
  8528. if (draggable.value) {
  8529. onDraggable();
  8530. } else {
  8531. offDraggable();
  8532. }
  8533. });
  8534. });
  8535. onBeforeUnmount(() => {
  8536. offDraggable();
  8537. });
  8538. return {
  8539. isDragging,
  8540. resetPosition,
  8541. updatePosition
  8542. };
  8543. };
  8544. const useFocus = (el) => {
  8545. return {
  8546. focus: () => {
  8547. var _a, _b;
  8548. (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  8549. }
  8550. };
  8551. };
  8552. var English = {
  8553. name: "en",
  8554. el: {
  8555. breadcrumb: {
  8556. label: "Breadcrumb"
  8557. },
  8558. colorpicker: {
  8559. confirm: "OK",
  8560. clear: "Clear",
  8561. defaultLabel: "color picker",
  8562. description: "current color is {color}. press enter to select a new color.",
  8563. alphaLabel: "pick alpha value",
  8564. alphaDescription: "alpha {alpha}, current color is {color}",
  8565. hueLabel: "pick hue value",
  8566. hueDescription: "hue {hue}, current color is {color}",
  8567. svLabel: "pick saturation and brightness value",
  8568. svDescription: "saturation {saturation}, brightness {brightness}, current color is {color}",
  8569. predefineDescription: "select {value} as the color"
  8570. },
  8571. datepicker: {
  8572. now: "Now",
  8573. today: "Today",
  8574. cancel: "Cancel",
  8575. clear: "Clear",
  8576. confirm: "OK",
  8577. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  8578. monthTablePrompt: "Use the arrow keys and enter to select the month",
  8579. yearTablePrompt: "Use the arrow keys and enter to select the year",
  8580. selectedDate: "Selected date",
  8581. selectDate: "Select date",
  8582. selectTime: "Select time",
  8583. startDate: "Start Date",
  8584. startTime: "Start Time",
  8585. endDate: "End Date",
  8586. endTime: "End Time",
  8587. prevYear: "Previous Year",
  8588. nextYear: "Next Year",
  8589. prevMonth: "Previous Month",
  8590. nextMonth: "Next Month",
  8591. year: "",
  8592. month1: "January",
  8593. month2: "February",
  8594. month3: "March",
  8595. month4: "April",
  8596. month5: "May",
  8597. month6: "June",
  8598. month7: "July",
  8599. month8: "August",
  8600. month9: "September",
  8601. month10: "October",
  8602. month11: "November",
  8603. month12: "December",
  8604. weeks: {
  8605. sun: "Sun",
  8606. mon: "Mon",
  8607. tue: "Tue",
  8608. wed: "Wed",
  8609. thu: "Thu",
  8610. fri: "Fri",
  8611. sat: "Sat"
  8612. },
  8613. weeksFull: {
  8614. sun: "Sunday",
  8615. mon: "Monday",
  8616. tue: "Tuesday",
  8617. wed: "Wednesday",
  8618. thu: "Thursday",
  8619. fri: "Friday",
  8620. sat: "Saturday"
  8621. },
  8622. months: {
  8623. jan: "Jan",
  8624. feb: "Feb",
  8625. mar: "Mar",
  8626. apr: "Apr",
  8627. may: "May",
  8628. jun: "Jun",
  8629. jul: "Jul",
  8630. aug: "Aug",
  8631. sep: "Sep",
  8632. oct: "Oct",
  8633. nov: "Nov",
  8634. dec: "Dec"
  8635. }
  8636. },
  8637. inputNumber: {
  8638. decrease: "decrease number",
  8639. increase: "increase number"
  8640. },
  8641. select: {
  8642. loading: "Loading",
  8643. noMatch: "No matching data",
  8644. noData: "No data",
  8645. placeholder: "Select"
  8646. },
  8647. mention: {
  8648. loading: "Loading"
  8649. },
  8650. dropdown: {
  8651. toggleDropdown: "Toggle Dropdown"
  8652. },
  8653. cascader: {
  8654. noMatch: "No matching data",
  8655. loading: "Loading",
  8656. placeholder: "Select",
  8657. noData: "No data"
  8658. },
  8659. pagination: {
  8660. goto: "Go to",
  8661. pagesize: "/page",
  8662. total: "Total {total}",
  8663. pageClassifier: "",
  8664. page: "Page",
  8665. prev: "Go to previous page",
  8666. next: "Go to next page",
  8667. currentPage: "page {pager}",
  8668. prevPages: "Previous {pager} pages",
  8669. nextPages: "Next {pager} pages",
  8670. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  8671. },
  8672. dialog: {
  8673. close: "Close this dialog"
  8674. },
  8675. drawer: {
  8676. close: "Close this dialog"
  8677. },
  8678. messagebox: {
  8679. title: "Message",
  8680. confirm: "OK",
  8681. cancel: "Cancel",
  8682. error: "Illegal input",
  8683. close: "Close this dialog"
  8684. },
  8685. upload: {
  8686. deleteTip: "press delete to remove",
  8687. delete: "Delete",
  8688. preview: "Preview",
  8689. continue: "Continue"
  8690. },
  8691. slider: {
  8692. defaultLabel: "slider between {min} and {max}",
  8693. defaultRangeStartLabel: "pick start value",
  8694. defaultRangeEndLabel: "pick end value"
  8695. },
  8696. table: {
  8697. emptyText: "No Data",
  8698. confirmFilter: "Confirm",
  8699. resetFilter: "Reset",
  8700. clearFilter: "All",
  8701. sumText: "Sum"
  8702. },
  8703. tour: {
  8704. next: "Next",
  8705. previous: "Previous",
  8706. finish: "Finish",
  8707. close: "Close this dialog"
  8708. },
  8709. tree: {
  8710. emptyText: "No Data"
  8711. },
  8712. transfer: {
  8713. noMatch: "No matching data",
  8714. noData: "No data",
  8715. titles: ["List 1", "List 2"],
  8716. filterPlaceholder: "Enter keyword",
  8717. noCheckedFormat: "{total} items",
  8718. hasCheckedFormat: "{checked}/{total} checked"
  8719. },
  8720. image: {
  8721. error: "FAILED"
  8722. },
  8723. pageHeader: {
  8724. title: "Back"
  8725. },
  8726. popconfirm: {
  8727. confirmButtonText: "Yes",
  8728. cancelButtonText: "No"
  8729. },
  8730. carousel: {
  8731. leftArrow: "Carousel arrow left",
  8732. rightArrow: "Carousel arrow right",
  8733. indicator: "Carousel switch to index {index}"
  8734. }
  8735. }
  8736. };
  8737. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  8738. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  8739. var _a;
  8740. return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
  8741. });
  8742. const buildLocaleContext = (locale) => {
  8743. const lang = computed(() => unref(locale).name);
  8744. const localeRef = isRef(locale) ? locale : ref(locale);
  8745. return {
  8746. lang,
  8747. locale: localeRef,
  8748. t: buildTranslator(locale)
  8749. };
  8750. };
  8751. const localeContextKey = Symbol("localeContextKey");
  8752. const useLocale = (localeOverrides) => {
  8753. const locale = localeOverrides || inject(localeContextKey, ref());
  8754. return buildLocaleContext(computed(() => locale.value || English));
  8755. };
  8756. const defaultNamespace = "el";
  8757. const statePrefix = "is-";
  8758. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  8759. let cls = `${namespace}-${block}`;
  8760. if (blockSuffix) {
  8761. cls += `-${blockSuffix}`;
  8762. }
  8763. if (element) {
  8764. cls += `__${element}`;
  8765. }
  8766. if (modifier) {
  8767. cls += `--${modifier}`;
  8768. }
  8769. return cls;
  8770. };
  8771. const namespaceContextKey = Symbol("namespaceContextKey");
  8772. const useGetDerivedNamespace = (namespaceOverrides) => {
  8773. const derivedNamespace = namespaceOverrides || (getCurrentInstance() ? inject(namespaceContextKey, ref(defaultNamespace)) : ref(defaultNamespace));
  8774. const namespace = computed(() => {
  8775. return unref(derivedNamespace) || defaultNamespace;
  8776. });
  8777. return namespace;
  8778. };
  8779. const useNamespace = (block, namespaceOverrides) => {
  8780. const namespace = useGetDerivedNamespace(namespaceOverrides);
  8781. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  8782. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  8783. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  8784. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  8785. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  8786. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  8787. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  8788. const is = (name, ...args) => {
  8789. const state = args.length >= 1 ? args[0] : true;
  8790. return name && state ? `${statePrefix}${name}` : "";
  8791. };
  8792. const cssVar = (object) => {
  8793. const styles = {};
  8794. for (const key in object) {
  8795. if (object[key]) {
  8796. styles[`--${namespace.value}-${key}`] = object[key];
  8797. }
  8798. }
  8799. return styles;
  8800. };
  8801. const cssVarBlock = (object) => {
  8802. const styles = {};
  8803. for (const key in object) {
  8804. if (object[key]) {
  8805. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  8806. }
  8807. }
  8808. return styles;
  8809. };
  8810. const cssVarName = (name) => `--${namespace.value}-${name}`;
  8811. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  8812. return {
  8813. namespace,
  8814. b,
  8815. e,
  8816. m,
  8817. be,
  8818. em,
  8819. bm,
  8820. bem,
  8821. is,
  8822. cssVar,
  8823. cssVarName,
  8824. cssVarBlock,
  8825. cssVarBlockName
  8826. };
  8827. };
  8828. const useLockscreen = (trigger, options = {}) => {
  8829. if (!isRef(trigger)) {
  8830. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  8831. }
  8832. const ns = options.ns || useNamespace("popup");
  8833. const hiddenCls = computed(() => ns.bm("parent", "hidden"));
  8834. let scrollBarWidth = 0;
  8835. let withoutHiddenClass = false;
  8836. let bodyWidth = "0";
  8837. const cleanup = () => {
  8838. setTimeout(() => {
  8839. if (typeof document === "undefined")
  8840. return;
  8841. if (withoutHiddenClass && document) {
  8842. document.body.style.width = bodyWidth;
  8843. removeClass(document.body, hiddenCls.value);
  8844. }
  8845. }, 200);
  8846. };
  8847. watch(trigger, (val) => {
  8848. if (!val) {
  8849. cleanup();
  8850. return;
  8851. }
  8852. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  8853. if (withoutHiddenClass) {
  8854. bodyWidth = document.body.style.width;
  8855. addClass(document.body, hiddenCls.value);
  8856. }
  8857. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  8858. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  8859. const bodyOverflowY = getStyle(document.body, "overflowY");
  8860. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  8861. document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  8862. }
  8863. });
  8864. onScopeDispose(() => cleanup());
  8865. };
  8866. const modalStack = [];
  8867. const closeModal = (e) => {
  8868. if (modalStack.length === 0)
  8869. return;
  8870. const code = getEventCode(e);
  8871. if (code === EVENT_CODE.esc) {
  8872. e.stopPropagation();
  8873. const topModal = modalStack[modalStack.length - 1];
  8874. topModal.handleClose();
  8875. }
  8876. };
  8877. const useModal = (instance, visibleRef) => {
  8878. watch(visibleRef, (val) => {
  8879. if (val) {
  8880. modalStack.push(instance);
  8881. } else {
  8882. modalStack.splice(modalStack.indexOf(instance), 1);
  8883. }
  8884. });
  8885. };
  8886. if (isClient)
  8887. useEventListener(document, "keydown", closeModal);
  8888. const _prop = buildProp({
  8889. type: definePropType(Boolean),
  8890. default: null
  8891. });
  8892. const _event = buildProp({
  8893. type: definePropType(Function)
  8894. });
  8895. const createModelToggleComposable = (name) => {
  8896. const updateEventKey = `update:${name}`;
  8897. const updateEventKeyRaw = `onUpdate:${name}`;
  8898. const useModelToggleEmits2 = [updateEventKey];
  8899. const useModelToggleProps2 = {
  8900. [name]: _prop,
  8901. [updateEventKeyRaw]: _event
  8902. };
  8903. const useModelToggle2 = ({
  8904. indicator,
  8905. toggleReason,
  8906. shouldHideWhenRouteChanges,
  8907. shouldProceed,
  8908. onShow,
  8909. onHide
  8910. }) => {
  8911. const instance = getCurrentInstance();
  8912. const { emit } = instance;
  8913. const props = instance.props;
  8914. const hasUpdateHandler = computed(() => isFunction$1(props[updateEventKeyRaw]));
  8915. const isModelBindingAbsent = computed(() => props[name] === null);
  8916. const doShow = (event) => {
  8917. if (indicator.value === true) {
  8918. return;
  8919. }
  8920. indicator.value = true;
  8921. if (toggleReason) {
  8922. toggleReason.value = event;
  8923. }
  8924. if (isFunction$1(onShow)) {
  8925. onShow(event);
  8926. }
  8927. };
  8928. const doHide = (event) => {
  8929. if (indicator.value === false) {
  8930. return;
  8931. }
  8932. indicator.value = false;
  8933. if (toggleReason) {
  8934. toggleReason.value = event;
  8935. }
  8936. if (isFunction$1(onHide)) {
  8937. onHide(event);
  8938. }
  8939. };
  8940. const show = (event) => {
  8941. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed())
  8942. return;
  8943. const shouldEmit = hasUpdateHandler.value && isClient;
  8944. if (shouldEmit) {
  8945. emit(updateEventKey, true);
  8946. }
  8947. if (isModelBindingAbsent.value || !shouldEmit) {
  8948. doShow(event);
  8949. }
  8950. };
  8951. const hide = (event) => {
  8952. if (props.disabled === true || !isClient)
  8953. return;
  8954. const shouldEmit = hasUpdateHandler.value && isClient;
  8955. if (shouldEmit) {
  8956. emit(updateEventKey, false);
  8957. }
  8958. if (isModelBindingAbsent.value || !shouldEmit) {
  8959. doHide(event);
  8960. }
  8961. };
  8962. const onChange = (val) => {
  8963. if (!isBoolean(val))
  8964. return;
  8965. if (props.disabled && val) {
  8966. if (hasUpdateHandler.value) {
  8967. emit(updateEventKey, false);
  8968. }
  8969. } else if (indicator.value !== val) {
  8970. if (val) {
  8971. doShow();
  8972. } else {
  8973. doHide();
  8974. }
  8975. }
  8976. };
  8977. const toggle = () => {
  8978. if (indicator.value) {
  8979. hide();
  8980. } else {
  8981. show();
  8982. }
  8983. };
  8984. watch(() => props[name], onChange);
  8985. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  8986. watch(() => ({
  8987. ...instance.proxy.$route
  8988. }), () => {
  8989. if (shouldHideWhenRouteChanges.value && indicator.value) {
  8990. hide();
  8991. }
  8992. });
  8993. }
  8994. onMounted(() => {
  8995. onChange(props[name]);
  8996. });
  8997. return {
  8998. hide,
  8999. show,
  9000. toggle,
  9001. hasUpdateHandler
  9002. };
  9003. };
  9004. return {
  9005. useModelToggle: useModelToggle2,
  9006. useModelToggleProps: useModelToggleProps2,
  9007. useModelToggleEmits: useModelToggleEmits2
  9008. };
  9009. };
  9010. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  9011. const usePreventGlobal = (indicator, evt, cb) => {
  9012. const prevent = (e) => {
  9013. if (cb(e))
  9014. e.stopImmediatePropagation();
  9015. };
  9016. let stop = void 0;
  9017. watch(() => indicator.value, (val) => {
  9018. if (val) {
  9019. stop = useEventListener(document, evt, prevent, true);
  9020. } else {
  9021. stop == null ? void 0 : stop();
  9022. }
  9023. }, { immediate: true });
  9024. };
  9025. const useProp = (name) => {
  9026. const vm = getCurrentInstance();
  9027. return computed(() => {
  9028. var _a, _b;
  9029. return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
  9030. });
  9031. };
  9032. var E$1="top",R="bottom",W="right",P$1="left",me="auto",G=[E$1,R,W,P$1],U$1="start",J="end",Xe="clippingParents",je="viewport",K="popper",Ye="reference",De=G.reduce(function(t,e){return t.concat([e+"-"+U$1,e+"-"+J])},[]),Ee=[].concat(G,[me]).reduce(function(t,e){return t.concat([e,e+"-"+U$1,e+"-"+J])},[]),Ge="beforeRead",Je="read",Ke="afterRead",Qe="beforeMain",Ze="main",et="afterMain",tt="beforeWrite",nt="write",rt="afterWrite",ot=[Ge,Je,Ke,Qe,Ze,et,tt,nt,rt];function C(t){return t?(t.nodeName||"").toLowerCase():null}function H(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Q(t){var e=H(t).Element;return t instanceof e||t instanceof Element}function B(t){var e=H(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Pe(t){if(typeof ShadowRoot=="undefined")return !1;var e=H(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Mt(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},i=e.elements[n];!B(i)||!C(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(a){var s=o[a];s===!1?i.removeAttribute(a):i.setAttribute(a,s===!0?"":s);}));});}function Rt(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],i=e.attributes[r]||{},a=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),s=a.reduce(function(f,c){return f[c]="",f},{});!B(o)||!C(o)||(Object.assign(o.style,s),Object.keys(i).forEach(function(f){o.removeAttribute(f);}));});}}var Ae={name:"applyStyles",enabled:!0,phase:"write",fn:Mt,effect:Rt,requires:["computeStyles"]};function q(t){return t.split("-")[0]}var X$1=Math.max,ve=Math.min,Z=Math.round;function ee(t,e){e===void 0&&(e=!1);var n=t.getBoundingClientRect(),r=1,o=1;if(B(t)&&e){var i=t.offsetHeight,a=t.offsetWidth;a>0&&(r=Z(n.width)/a||1),i>0&&(o=Z(n.height)/i||1);}return {width:n.width/r,height:n.height/o,top:n.top/o,right:n.right/r,bottom:n.bottom/o,left:n.left/r,x:n.left/r,y:n.top/o}}function ke(t){var e=ee(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function it(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return !0;if(n&&Pe(n)){var r=e;do{if(r&&t.isSameNode(r))return !0;r=r.parentNode||r.host;}while(r)}return !1}function N$1(t){return H(t).getComputedStyle(t)}function Wt(t){return ["table","td","th"].indexOf(C(t))>=0}function I$1(t){return ((Q(t)?t.ownerDocument:t.document)||window.document).documentElement}function ge(t){return C(t)==="html"?t:t.assignedSlot||t.parentNode||(Pe(t)?t.host:null)||I$1(t)}function at(t){return !B(t)||N$1(t).position==="fixed"?null:t.offsetParent}function Bt(t){var e=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,n=navigator.userAgent.indexOf("Trident")!==-1;if(n&&B(t)){var r=N$1(t);if(r.position==="fixed")return null}var o=ge(t);for(Pe(o)&&(o=o.host);B(o)&&["html","body"].indexOf(C(o))<0;){var i=N$1(o);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return o;o=o.parentNode;}return null}function se(t){for(var e=H(t),n=at(t);n&&Wt(n)&&N$1(n).position==="static";)n=at(n);return n&&(C(n)==="html"||C(n)==="body"&&N$1(n).position==="static")?e:n||Bt(t)||e}function Le(t){return ["top","bottom"].indexOf(t)>=0?"x":"y"}function fe(t,e,n){return X$1(t,ve(e,n))}function St(t,e,n){var r=fe(t,e,n);return r>n?n:r}function st(){return {top:0,right:0,bottom:0,left:0}}function ft(t){return Object.assign({},st(),t)}function ct(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var Tt=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,ft(typeof t!="number"?t:ct(t,G))};function Ht(t){var e,n=t.state,r=t.name,o=t.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=q(n.placement),f=Le(s),c=[P$1,W].indexOf(s)>=0,u=c?"height":"width";if(!(!i||!a)){var m=Tt(o.padding,n),v=ke(i),l=f==="y"?E$1:P$1,h=f==="y"?R:W,p=n.rects.reference[u]+n.rects.reference[f]-a[f]-n.rects.popper[u],g=a[f]-n.rects.reference[f],x=se(i),y=x?f==="y"?x.clientHeight||0:x.clientWidth||0:0,$=p/2-g/2,d=m[l],b=y-v[u]-m[h],w=y/2-v[u]/2+$,O=fe(d,w,b),j=f;n.modifiersData[r]=(e={},e[j]=O,e.centerOffset=O-w,e);}}function Ct(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||!it(e.elements.popper,o)||(e.elements.arrow=o));}var pt={name:"arrow",enabled:!0,phase:"main",fn:Ht,effect:Ct,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function te(t){return t.split("-")[1]}var qt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Vt(t){var e=t.x,n=t.y,r=window,o=r.devicePixelRatio||1;return {x:Z(e*o)/o||0,y:Z(n*o)/o||0}}function ut(t){var e,n=t.popper,r=t.popperRect,o=t.placement,i=t.variation,a=t.offsets,s=t.position,f=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,m=t.isFixed,v=a.x,l=v===void 0?0:v,h=a.y,p=h===void 0?0:h,g=typeof u=="function"?u({x:l,y:p}):{x:l,y:p};l=g.x,p=g.y;var x=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),$=P$1,d=E$1,b=window;if(c){var w=se(n),O="clientHeight",j="clientWidth";if(w===H(n)&&(w=I$1(n),N$1(w).position!=="static"&&s==="absolute"&&(O="scrollHeight",j="scrollWidth")),w=w,o===E$1||(o===P$1||o===W)&&i===J){d=R;var A=m&&w===b&&b.visualViewport?b.visualViewport.height:w[O];p-=A-r.height,p*=f?1:-1;}if(o===P$1||(o===E$1||o===R)&&i===J){$=W;var k=m&&w===b&&b.visualViewport?b.visualViewport.width:w[j];l-=k-r.width,l*=f?1:-1;}}var D=Object.assign({position:s},c&&qt),S=u===!0?Vt({x:l,y:p}):{x:l,y:p};if(l=S.x,p=S.y,f){var L;return Object.assign({},D,(L={},L[d]=y?"0":"",L[$]=x?"0":"",L.transform=(b.devicePixelRatio||1)<=1?"translate("+l+"px, "+p+"px)":"translate3d("+l+"px, "+p+"px, 0)",L))}return Object.assign({},D,(e={},e[d]=y?p+"px":"",e[$]=x?l+"px":"",e.transform="",e))}function Nt(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?!0:r,i=n.adaptive,a=i===void 0?!0:i,s=n.roundOffsets,f=s===void 0?!0:s,c={placement:q(e.placement),variation:te(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,ut(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:f})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,ut(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement});}var Me={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Nt,data:{}},ye={passive:!0};function It(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,i=o===void 0?!0:o,a=r.resize,s=a===void 0?!0:a,f=H(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",n.update,ye);}),s&&f.addEventListener("resize",n.update,ye),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",n.update,ye);}),s&&f.removeEventListener("resize",n.update,ye);}}var Re={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:It,data:{}},_t={left:"right",right:"left",bottom:"top",top:"bottom"};function be(t){return t.replace(/left|right|bottom|top/g,function(e){return _t[e]})}var zt={start:"end",end:"start"};function lt(t){return t.replace(/start|end/g,function(e){return zt[e]})}function We(t){var e=H(t),n=e.pageXOffset,r=e.pageYOffset;return {scrollLeft:n,scrollTop:r}}function Be(t){return ee(I$1(t)).left+We(t).scrollLeft}function Ft(t){var e=H(t),n=I$1(t),r=e.visualViewport,o=n.clientWidth,i=n.clientHeight,a=0,s=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,s=r.offsetTop)),{width:o,height:i,x:a+Be(t),y:s}}function Ut(t){var e,n=I$1(t),r=We(t),o=(e=t.ownerDocument)==null?void 0:e.body,i=X$1(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=X$1(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-r.scrollLeft+Be(t),f=-r.scrollTop;return N$1(o||n).direction==="rtl"&&(s+=X$1(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:s,y:f}}function Se(t){var e=N$1(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return /auto|scroll|overlay|hidden/.test(n+o+r)}function dt(t){return ["html","body","#document"].indexOf(C(t))>=0?t.ownerDocument.body:B(t)&&Se(t)?t:dt(ge(t))}function ce(t,e){var n;e===void 0&&(e=[]);var r=dt(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),i=H(r),a=o?[i].concat(i.visualViewport||[],Se(r)?r:[]):r,s=e.concat(a);return o?s:s.concat(ce(ge(a)))}function Te(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Xt(t){var e=ee(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}function ht(t,e){return e===je?Te(Ft(t)):Q(e)?Xt(e):Te(Ut(I$1(t)))}function Yt(t){var e=ce(ge(t)),n=["absolute","fixed"].indexOf(N$1(t).position)>=0,r=n&&B(t)?se(t):t;return Q(r)?e.filter(function(o){return Q(o)&&it(o,r)&&C(o)!=="body"}):[]}function Gt(t,e,n){var r=e==="clippingParents"?Yt(t):[].concat(e),o=[].concat(r,[n]),i=o[0],a=o.reduce(function(s,f){var c=ht(t,f);return s.top=X$1(c.top,s.top),s.right=ve(c.right,s.right),s.bottom=ve(c.bottom,s.bottom),s.left=X$1(c.left,s.left),s},ht(t,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function mt(t){var e=t.reference,n=t.element,r=t.placement,o=r?q(r):null,i=r?te(r):null,a=e.x+e.width/2-n.width/2,s=e.y+e.height/2-n.height/2,f;switch(o){case E$1:f={x:a,y:e.y-n.height};break;case R:f={x:a,y:e.y+e.height};break;case W:f={x:e.x+e.width,y:s};break;case P$1:f={x:e.x-n.width,y:s};break;default:f={x:e.x,y:e.y};}var c=o?Le(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case U$1:f[c]=f[c]-(e[u]/2-n[u]/2);break;case J:f[c]=f[c]+(e[u]/2-n[u]/2);break}}return f}function ne(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,i=n.boundary,a=i===void 0?Xe:i,s=n.rootBoundary,f=s===void 0?je:s,c=n.elementContext,u=c===void 0?K:c,m=n.altBoundary,v=m===void 0?!1:m,l=n.padding,h=l===void 0?0:l,p=ft(typeof h!="number"?h:ct(h,G)),g=u===K?Ye:K,x=t.rects.popper,y=t.elements[v?g:u],$=Gt(Q(y)?y:y.contextElement||I$1(t.elements.popper),a,f),d=ee(t.elements.reference),b=mt({reference:d,element:x,strategy:"absolute",placement:o}),w=Te(Object.assign({},x,b)),O=u===K?w:d,j={top:$.top-O.top+p.top,bottom:O.bottom-$.bottom+p.bottom,left:$.left-O.left+p.left,right:O.right-$.right+p.right},A=t.modifiersData.offset;if(u===K&&A){var k=A[o];Object.keys(j).forEach(function(D){var S=[W,R].indexOf(D)>=0?1:-1,L=[E$1,R].indexOf(D)>=0?"y":"x";j[D]+=k[L]*S;});}return j}function Jt(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=f===void 0?Ee:f,u=te(r),m=u?s?De:De.filter(function(h){return te(h)===u}):G,v=m.filter(function(h){return c.indexOf(h)>=0});v.length===0&&(v=m);var l=v.reduce(function(h,p){return h[p]=ne(t,{placement:p,boundary:o,rootBoundary:i,padding:a})[q(p)],h},{});return Object.keys(l).sort(function(h,p){return l[h]-l[p]})}function Kt(t){if(q(t)===me)return [];var e=be(t);return [lt(t),e,lt(e)]}function Qt(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,i=o===void 0?!0:o,a=n.altAxis,s=a===void 0?!0:a,f=n.fallbackPlacements,c=n.padding,u=n.boundary,m=n.rootBoundary,v=n.altBoundary,l=n.flipVariations,h=l===void 0?!0:l,p=n.allowedAutoPlacements,g=e.options.placement,x=q(g),y=x===g,$=f||(y||!h?[be(g)]:Kt(g)),d=[g].concat($).reduce(function(z,V){return z.concat(q(V)===me?Jt(e,{placement:V,boundary:u,rootBoundary:m,padding:c,flipVariations:h,allowedAutoPlacements:p}):V)},[]),b=e.rects.reference,w=e.rects.popper,O=new Map,j=!0,A=d[0],k=0;k<d.length;k++){var D=d[k],S=q(D),L=te(D)===U$1,re=[E$1,R].indexOf(S)>=0,oe=re?"width":"height",M=ne(e,{placement:D,boundary:u,rootBoundary:m,altBoundary:v,padding:c}),T=re?L?W:P$1:L?R:E$1;b[oe]>w[oe]&&(T=be(T));var pe=be(T),_=[];if(i&&_.push(M[S]<=0),s&&_.push(M[T]<=0,M[pe]<=0),_.every(function(z){return z})){A=D,j=!1;break}O.set(D,_);}if(j)for(var ue=h?3:1,xe=function(z){var V=d.find(function(de){var ae=O.get(de);if(ae)return ae.slice(0,z).every(function(Y){return Y})});if(V)return A=V,"break"},ie=ue;ie>0;ie--){var le=xe(ie);if(le==="break")break}e.placement!==A&&(e.modifiersData[r]._skip=!0,e.placement=A,e.reset=!0);}}var vt={name:"flip",enabled:!0,phase:"main",fn:Qt,requiresIfExists:["offset"],data:{_skip:!1}};function gt(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function yt(t){return [E$1,W,R,P$1].some(function(e){return t[e]>=0})}function Zt(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,a=ne(e,{elementContext:"reference"}),s=ne(e,{altBoundary:!0}),f=gt(a,r),c=gt(s,o,i),u=yt(f),m=yt(c);e.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:m},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":m});}var bt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Zt};function en(t,e,n){var r=q(t),o=[P$1,E$1].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[P$1,W].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}function tn(t){var e=t.state,n=t.options,r=t.name,o=n.offset,i=o===void 0?[0,0]:o,a=Ee.reduce(function(u,m){return u[m]=en(m,e.rects,i),u},{}),s=a[e.placement],f=s.x,c=s.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=f,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=a;}var wt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:tn};function nn(t){var e=t.state,n=t.name;e.modifiersData[n]=mt({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement});}var He={name:"popperOffsets",enabled:!0,phase:"read",fn:nn,data:{}};function rn(t){return t==="x"?"y":"x"}function on(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,i=o===void 0?!0:o,a=n.altAxis,s=a===void 0?!1:a,f=n.boundary,c=n.rootBoundary,u=n.altBoundary,m=n.padding,v=n.tether,l=v===void 0?!0:v,h=n.tetherOffset,p=h===void 0?0:h,g=ne(e,{boundary:f,rootBoundary:c,padding:m,altBoundary:u}),x=q(e.placement),y=te(e.placement),$=!y,d=Le(x),b=rn(d),w=e.modifiersData.popperOffsets,O=e.rects.reference,j=e.rects.popper,A=typeof p=="function"?p(Object.assign({},e.rects,{placement:e.placement})):p,k=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),D=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,S={x:0,y:0};if(w){if(i){var L,re=d==="y"?E$1:P$1,oe=d==="y"?R:W,M=d==="y"?"height":"width",T=w[d],pe=T+g[re],_=T-g[oe],ue=l?-j[M]/2:0,xe=y===U$1?O[M]:j[M],ie=y===U$1?-j[M]:-O[M],le=e.elements.arrow,z=l&&le?ke(le):{width:0,height:0},V=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:st(),de=V[re],ae=V[oe],Y=fe(0,O[M],z[M]),jt=$?O[M]/2-ue-Y-de-k.mainAxis:xe-Y-de-k.mainAxis,Dt=$?-O[M]/2+ue+Y+ae+k.mainAxis:ie+Y+ae+k.mainAxis,Oe=e.elements.arrow&&se(e.elements.arrow),Et=Oe?d==="y"?Oe.clientTop||0:Oe.clientLeft||0:0,Ce=(L=D==null?void 0:D[d])!=null?L:0,Pt=T+jt-Ce-Et,At=T+Dt-Ce,qe=fe(l?ve(pe,Pt):pe,T,l?X$1(_,At):_);w[d]=qe,S[d]=qe-T;}if(s){var Ve,kt=d==="x"?E$1:P$1,Lt=d==="x"?R:W,F=w[b],he=b==="y"?"height":"width",Ne=F+g[kt],Ie=F-g[Lt],$e=[E$1,P$1].indexOf(x)!==-1,_e=(Ve=D==null?void 0:D[b])!=null?Ve:0,ze=$e?Ne:F-O[he]-j[he]-_e+k.altAxis,Fe=$e?F+O[he]+j[he]-_e-k.altAxis:Ie,Ue=l&&$e?St(ze,F,Fe):fe(l?ze:Ne,F,l?Fe:Ie);w[b]=Ue,S[b]=Ue-F;}e.modifiersData[r]=S;}}var xt={name:"preventOverflow",enabled:!0,phase:"main",fn:on,requiresIfExists:["offset"]};function an(t){return {scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function sn(t){return t===H(t)||!B(t)?We(t):an(t)}function fn(t){var e=t.getBoundingClientRect(),n=Z(e.width)/t.offsetWidth||1,r=Z(e.height)/t.offsetHeight||1;return n!==1||r!==1}function cn(t,e,n){n===void 0&&(n=!1);var r=B(e),o=B(e)&&fn(e),i=I$1(e),a=ee(t,o),s={scrollLeft:0,scrollTop:0},f={x:0,y:0};return (r||!r&&!n)&&((C(e)!=="body"||Se(i))&&(s=sn(e)),B(e)?(f=ee(e,!0),f.x+=e.clientLeft,f.y+=e.clientTop):i&&(f.x=Be(i))),{x:a.left+s.scrollLeft-f.x,y:a.top+s.scrollTop-f.y,width:a.width,height:a.height}}function pn(t){var e=new Map,n=new Set,r=[];t.forEach(function(i){e.set(i.name,i);});function o(i){n.add(i.name);var a=[].concat(i.requires||[],i.requiresIfExists||[]);a.forEach(function(s){if(!n.has(s)){var f=e.get(s);f&&o(f);}}),r.push(i);}return t.forEach(function(i){n.has(i.name)||o(i);}),r}function un(t){var e=pn(t);return ot.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function ln(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t());});})),e}}function dn(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var Ot={placement:"bottom",modifiers:[],strategy:"absolute"};function $t(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return !e.some(function(r){return !(r&&typeof r.getBoundingClientRect=="function")})}function we(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,o=e.defaultOptions,i=o===void 0?Ot:o;return function(a,s,f){f===void 0&&(f=i);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ot,i),modifiersData:{},elements:{reference:a,popper:s},attributes:{},styles:{}},u=[],m=!1,v={state:c,setOptions:function(p){var g=typeof p=="function"?p(c.options):p;h(),c.options=Object.assign({},i,c.options,g),c.scrollParents={reference:Q(a)?ce(a):a.contextElement?ce(a.contextElement):[],popper:ce(s)};var x=un(dn([].concat(r,c.options.modifiers)));return c.orderedModifiers=x.filter(function(y){return y.enabled}),l(),v.update()},forceUpdate:function(){if(!m){var p=c.elements,g=p.reference,x=p.popper;if($t(g,x)){c.rects={reference:cn(g,se(x),c.options.strategy==="fixed"),popper:ke(x)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(j){return c.modifiersData[j.name]=Object.assign({},j.data)});for(var y=0;y<c.orderedModifiers.length;y++){if(c.reset===!0){c.reset=!1,y=-1;continue}var $=c.orderedModifiers[y],d=$.fn,b=$.options,w=b===void 0?{}:b,O=$.name;typeof d=="function"&&(c=d({state:c,options:w,name:O,instance:v})||c);}}}},update:ln(function(){return new Promise(function(p){v.forceUpdate(),p(c);})}),destroy:function(){h(),m=!0;}};if(!$t(a,s))return v;v.setOptions(f).then(function(p){!m&&f.onFirstUpdate&&f.onFirstUpdate(p);});function l(){c.orderedModifiers.forEach(function(p){var g=p.name,x=p.options,y=x===void 0?{}:x,$=p.effect;if(typeof $=="function"){var d=$({state:c,name:g,instance:v,options:y}),b=function(){};u.push(d||b);}});}function h(){u.forEach(function(p){return p()}),u=[];}return v}}we();var mn=[Re,He,Me,Ae];we({defaultModifiers:mn});var gn=[Re,He,Me,Ae,wt,vt,xt,pt,bt],yn=we({defaultModifiers:gn});
  9033. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  9034. const stateUpdater = {
  9035. name: "updateState",
  9036. enabled: true,
  9037. phase: "write",
  9038. fn: ({ state }) => {
  9039. const derivedState = deriveState(state);
  9040. Object.assign(states.value, derivedState);
  9041. },
  9042. requires: ["computeStyles"]
  9043. };
  9044. const options = computed(() => {
  9045. const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
  9046. return {
  9047. onFirstUpdate,
  9048. placement: placement || "bottom",
  9049. strategy: strategy || "absolute",
  9050. modifiers: [
  9051. ...modifiers || [],
  9052. stateUpdater,
  9053. { name: "applyStyles", enabled: false }
  9054. ]
  9055. };
  9056. });
  9057. const instanceRef = shallowRef();
  9058. const states = ref({
  9059. styles: {
  9060. popper: {
  9061. position: unref(options).strategy,
  9062. left: "0",
  9063. top: "0"
  9064. },
  9065. arrow: {
  9066. position: "absolute"
  9067. }
  9068. },
  9069. attributes: {}
  9070. });
  9071. const destroy = () => {
  9072. if (!instanceRef.value)
  9073. return;
  9074. instanceRef.value.destroy();
  9075. instanceRef.value = void 0;
  9076. };
  9077. watch(options, (newOptions) => {
  9078. const instance = unref(instanceRef);
  9079. if (instance) {
  9080. instance.setOptions(newOptions);
  9081. }
  9082. }, {
  9083. deep: true
  9084. });
  9085. watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  9086. destroy();
  9087. if (!referenceElement || !popperElement)
  9088. return;
  9089. instanceRef.value = yn(referenceElement, popperElement, unref(options));
  9090. });
  9091. onBeforeUnmount(() => {
  9092. destroy();
  9093. });
  9094. return {
  9095. state: computed(() => {
  9096. var _a;
  9097. return { ...((_a = unref(instanceRef)) == null ? void 0 : _a.state) || {} };
  9098. }),
  9099. styles: computed(() => unref(states).styles),
  9100. attributes: computed(() => unref(states).attributes),
  9101. update: () => {
  9102. var _a;
  9103. return (_a = unref(instanceRef)) == null ? void 0 : _a.update();
  9104. },
  9105. forceUpdate: () => {
  9106. var _a;
  9107. return (_a = unref(instanceRef)) == null ? void 0 : _a.forceUpdate();
  9108. },
  9109. instanceRef: computed(() => unref(instanceRef))
  9110. };
  9111. };
  9112. function deriveState(state) {
  9113. const elements = Object.keys(state.elements);
  9114. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  9115. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  9116. return {
  9117. styles,
  9118. attributes
  9119. };
  9120. }
  9121. const useSameTarget = (handleClick) => {
  9122. if (!handleClick) {
  9123. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  9124. }
  9125. let mousedownTarget = false;
  9126. let mouseupTarget = false;
  9127. const onClick = (e) => {
  9128. if (mousedownTarget && mouseupTarget) {
  9129. handleClick(e);
  9130. }
  9131. mousedownTarget = mouseupTarget = false;
  9132. };
  9133. const onMousedown = (e) => {
  9134. mousedownTarget = e.target === e.currentTarget;
  9135. };
  9136. const onMouseup = (e) => {
  9137. mouseupTarget = e.target === e.currentTarget;
  9138. };
  9139. return { onClick, onMousedown, onMouseup };
  9140. };
  9141. const useTeleport = (contentRenderer, appendToBody) => {
  9142. const isTeleportVisible = ref(false);
  9143. if (!isClient) {
  9144. return {
  9145. isTeleportVisible,
  9146. showTeleport: NOOP,
  9147. hideTeleport: NOOP,
  9148. renderTeleport: NOOP
  9149. };
  9150. }
  9151. let $el = null;
  9152. const showTeleport = () => {
  9153. isTeleportVisible.value = true;
  9154. if ($el !== null)
  9155. return;
  9156. $el = createGlobalNode();
  9157. };
  9158. const hideTeleport = () => {
  9159. isTeleportVisible.value = false;
  9160. if ($el !== null) {
  9161. removeGlobalNode($el);
  9162. $el = null;
  9163. }
  9164. };
  9165. const renderTeleport = () => {
  9166. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [h$1(Teleport$1, { to: $el }, contentRenderer())] : void 0;
  9167. };
  9168. onUnmounted(hideTeleport);
  9169. return {
  9170. isTeleportVisible,
  9171. showTeleport,
  9172. hideTeleport,
  9173. renderTeleport
  9174. };
  9175. };
  9176. const useThrottleRender = (loading, throttle = 0) => {
  9177. if (throttle === 0)
  9178. return loading;
  9179. const initVal = isObject$1(throttle) && Boolean(throttle.initVal);
  9180. const throttled = ref(initVal);
  9181. let timeoutHandle = null;
  9182. const dispatchThrottling = (timer) => {
  9183. if (isUndefined(timer)) {
  9184. throttled.value = loading.value;
  9185. return;
  9186. }
  9187. if (timeoutHandle) {
  9188. clearTimeout(timeoutHandle);
  9189. }
  9190. timeoutHandle = setTimeout(() => {
  9191. throttled.value = loading.value;
  9192. }, timer);
  9193. };
  9194. const dispatcher = (type) => {
  9195. if (type === "leading") {
  9196. if (isNumber(throttle)) {
  9197. dispatchThrottling(throttle);
  9198. } else {
  9199. dispatchThrottling(throttle.leading);
  9200. }
  9201. } else {
  9202. if (isObject$1(throttle)) {
  9203. dispatchThrottling(throttle.trailing);
  9204. } else {
  9205. throttled.value = false;
  9206. }
  9207. }
  9208. };
  9209. onMounted(() => dispatcher("leading"));
  9210. watch(() => loading.value, (val) => {
  9211. dispatcher(val ? "leading" : "trailing");
  9212. });
  9213. return throttled;
  9214. };
  9215. function useTimeout() {
  9216. let timeoutHandle;
  9217. const registerTimeout = (fn, delay) => {
  9218. cancelTimeout();
  9219. timeoutHandle = window.setTimeout(fn, delay);
  9220. };
  9221. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  9222. tryOnScopeDispose(() => cancelTimeout());
  9223. return {
  9224. registerTimeout,
  9225. cancelTimeout
  9226. };
  9227. }
  9228. const AFTER_APPEAR = "after-appear";
  9229. const AFTER_ENTER = "after-enter";
  9230. const AFTER_LEAVE = "after-leave";
  9231. const APPEAR = "appear";
  9232. const APPEAR_CANCELLED = "appear-cancelled";
  9233. const BEFORE_ENTER = "before-enter";
  9234. const BEFORE_LEAVE = "before-leave";
  9235. const ENTER = "enter";
  9236. const ENTER_CANCELLED = "enter-cancelled";
  9237. const LEAVE = "leave";
  9238. const LEAVE_CANCELLED = "leave-cancelled";
  9239. const useTransitionFallthroughEmits = [
  9240. AFTER_APPEAR,
  9241. AFTER_ENTER,
  9242. AFTER_LEAVE,
  9243. APPEAR,
  9244. APPEAR_CANCELLED,
  9245. BEFORE_ENTER,
  9246. BEFORE_LEAVE,
  9247. ENTER,
  9248. ENTER_CANCELLED,
  9249. LEAVE,
  9250. LEAVE_CANCELLED
  9251. ];
  9252. const useTransitionFallthrough = () => {
  9253. const { emit } = getCurrentInstance();
  9254. return {
  9255. onAfterAppear: () => {
  9256. emit(AFTER_APPEAR);
  9257. },
  9258. onAfterEnter: () => {
  9259. emit(AFTER_ENTER);
  9260. },
  9261. onAfterLeave: () => {
  9262. emit(AFTER_LEAVE);
  9263. },
  9264. onAppearCancelled: () => {
  9265. emit(APPEAR_CANCELLED);
  9266. },
  9267. onBeforeEnter: () => {
  9268. emit(BEFORE_ENTER);
  9269. },
  9270. onBeforeLeave: () => {
  9271. emit(BEFORE_LEAVE);
  9272. },
  9273. onEnter: () => {
  9274. emit(ENTER);
  9275. },
  9276. onEnterCancelled: () => {
  9277. emit(ENTER_CANCELLED);
  9278. },
  9279. onLeave: () => {
  9280. emit(LEAVE);
  9281. },
  9282. onLeaveCancelled: () => {
  9283. emit(LEAVE_CANCELLED);
  9284. }
  9285. };
  9286. };
  9287. const defaultIdInjection = {
  9288. prefix: Math.floor(Math.random() * 1e4),
  9289. current: 0
  9290. };
  9291. const ID_INJECTION_KEY = Symbol("elIdInjection");
  9292. const useIdInjection = () => {
  9293. return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  9294. };
  9295. const useId = (deterministicId) => {
  9296. const idInjection = useIdInjection();
  9297. if (!isClient && idInjection === defaultIdInjection) {
  9298. debugWarn("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
  9299. usage: app.provide(ID_INJECTION_KEY, {
  9300. prefix: number,
  9301. current: number,
  9302. })`);
  9303. }
  9304. const namespace = useGetDerivedNamespace();
  9305. const idRef = computedEager(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  9306. return idRef;
  9307. };
  9308. let registeredEscapeHandlers = [];
  9309. const cachedHandler = (event) => {
  9310. const code = getEventCode(event);
  9311. if (code === EVENT_CODE.esc) {
  9312. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  9313. }
  9314. };
  9315. const useEscapeKeydown = (handler) => {
  9316. onMounted(() => {
  9317. if (registeredEscapeHandlers.length === 0) {
  9318. document.addEventListener("keydown", cachedHandler);
  9319. }
  9320. if (isClient)
  9321. registeredEscapeHandlers.push(handler);
  9322. });
  9323. onBeforeUnmount(() => {
  9324. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  9325. if (registeredEscapeHandlers.length === 0) {
  9326. if (isClient)
  9327. document.removeEventListener("keydown", cachedHandler);
  9328. }
  9329. });
  9330. };
  9331. const usePopperContainerId = () => {
  9332. const namespace = useGetDerivedNamespace();
  9333. const idInjection = useIdInjection();
  9334. const id = computed(() => {
  9335. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  9336. });
  9337. const selector = computed(() => `#${id.value}`);
  9338. return {
  9339. id,
  9340. selector
  9341. };
  9342. };
  9343. const createContainer = (id) => {
  9344. const container = document.createElement("div");
  9345. container.id = id;
  9346. document.body.appendChild(container);
  9347. return container;
  9348. };
  9349. const usePopperContainer = () => {
  9350. const { id, selector } = usePopperContainerId();
  9351. onBeforeMount(() => {
  9352. if (!isClient)
  9353. return;
  9354. if (!document.body.querySelector(selector.value)) {
  9355. createContainer(id.value);
  9356. }
  9357. });
  9358. return {
  9359. id,
  9360. selector
  9361. };
  9362. };
  9363. const useDelayedRender = ({
  9364. indicator,
  9365. intermediateIndicator,
  9366. shouldSetIntermediate = () => true,
  9367. beforeShow,
  9368. afterShow,
  9369. afterHide,
  9370. beforeHide
  9371. }) => {
  9372. watch(() => unref(indicator), (val) => {
  9373. if (val) {
  9374. beforeShow == null ? void 0 : beforeShow();
  9375. nextTick(() => {
  9376. if (!unref(indicator))
  9377. return;
  9378. if (shouldSetIntermediate("show")) {
  9379. intermediateIndicator.value = true;
  9380. }
  9381. });
  9382. } else {
  9383. beforeHide == null ? void 0 : beforeHide();
  9384. nextTick(() => {
  9385. if (unref(indicator))
  9386. return;
  9387. if (shouldSetIntermediate("hide")) {
  9388. intermediateIndicator.value = false;
  9389. }
  9390. });
  9391. }
  9392. });
  9393. watch(() => intermediateIndicator.value, (val) => {
  9394. if (val) {
  9395. afterShow == null ? void 0 : afterShow();
  9396. } else {
  9397. afterHide == null ? void 0 : afterHide();
  9398. }
  9399. });
  9400. };
  9401. const useDelayedToggleProps = buildProps({
  9402. showAfter: {
  9403. type: Number,
  9404. default: 0
  9405. },
  9406. hideAfter: {
  9407. type: Number,
  9408. default: 200
  9409. },
  9410. autoClose: {
  9411. type: Number,
  9412. default: 0
  9413. }
  9414. });
  9415. const useDelayedToggle = ({
  9416. showAfter,
  9417. hideAfter,
  9418. autoClose,
  9419. open,
  9420. close
  9421. }) => {
  9422. const { registerTimeout } = useTimeout();
  9423. const {
  9424. registerTimeout: registerTimeoutForAutoClose,
  9425. cancelTimeout: cancelTimeoutForAutoClose
  9426. } = useTimeout();
  9427. const onOpen = (event, delay = unref(showAfter)) => {
  9428. registerTimeout(() => {
  9429. open(event);
  9430. const _autoClose = unref(autoClose);
  9431. if (isNumber(_autoClose) && _autoClose > 0) {
  9432. registerTimeoutForAutoClose(() => {
  9433. close(event);
  9434. }, _autoClose);
  9435. }
  9436. }, delay);
  9437. };
  9438. const onClose = (event, delay = unref(hideAfter)) => {
  9439. cancelTimeoutForAutoClose();
  9440. registerTimeout(() => {
  9441. close(event);
  9442. }, delay);
  9443. };
  9444. return {
  9445. onOpen,
  9446. onClose
  9447. };
  9448. };
  9449. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  9450. const useForwardRef = (forwardRef) => {
  9451. const setForwardRef = (el) => {
  9452. forwardRef.value = el;
  9453. };
  9454. provide(FORWARD_REF_INJECTION_KEY, {
  9455. setForwardRef
  9456. });
  9457. };
  9458. const useForwardRefDirective = (setForwardRef) => {
  9459. return {
  9460. mounted(el) {
  9461. setForwardRef(el);
  9462. },
  9463. updated(el) {
  9464. setForwardRef(el);
  9465. },
  9466. unmounted() {
  9467. setForwardRef(null);
  9468. }
  9469. };
  9470. };
  9471. const initial = {
  9472. current: 0
  9473. };
  9474. const zIndex = ref(0);
  9475. const defaultInitialZIndex = 2e3;
  9476. const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
  9477. const zIndexContextKey = Symbol("zIndexContextKey");
  9478. const useZIndex = (zIndexOverrides) => {
  9479. const increasingInjection = getCurrentInstance() ? inject(ZINDEX_INJECTION_KEY, initial) : initial;
  9480. const zIndexInjection = zIndexOverrides || (getCurrentInstance() ? inject(zIndexContextKey, void 0) : void 0);
  9481. const initialZIndex = computed(() => {
  9482. const zIndexFromInjection = unref(zIndexInjection);
  9483. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  9484. });
  9485. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  9486. const nextZIndex = () => {
  9487. increasingInjection.current++;
  9488. zIndex.value = increasingInjection.current;
  9489. return currentZIndex.value;
  9490. };
  9491. if (!isClient && !inject(ZINDEX_INJECTION_KEY)) {
  9492. debugWarn("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
  9493. usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`);
  9494. }
  9495. return {
  9496. initialZIndex,
  9497. currentZIndex,
  9498. nextZIndex
  9499. };
  9500. };
  9501. /**
  9502. * Custom positioning reference element.
  9503. * @see https://floating-ui.com/docs/virtual-elements
  9504. */
  9505. const sides = ['top', 'right', 'bottom', 'left'];
  9506. const alignments = ['start', 'end'];
  9507. const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
  9508. const min$3 = Math.min;
  9509. const max$3 = Math.max;
  9510. const round$1 = Math.round;
  9511. const createCoords = v => ({
  9512. x: v,
  9513. y: v
  9514. });
  9515. const oppositeSideMap = {
  9516. left: 'right',
  9517. right: 'left',
  9518. bottom: 'top',
  9519. top: 'bottom'
  9520. };
  9521. const oppositeAlignmentMap = {
  9522. start: 'end',
  9523. end: 'start'
  9524. };
  9525. function clamp(start, value, end) {
  9526. return max$3(start, min$3(value, end));
  9527. }
  9528. function evaluate(value, param) {
  9529. return typeof value === 'function' ? value(param) : value;
  9530. }
  9531. function getSide$1(placement) {
  9532. return placement.split('-')[0];
  9533. }
  9534. function getAlignment$1(placement) {
  9535. return placement.split('-')[1];
  9536. }
  9537. function getOppositeAxis(axis) {
  9538. return axis === 'x' ? 'y' : 'x';
  9539. }
  9540. function getAxisLength(axis) {
  9541. return axis === 'y' ? 'height' : 'width';
  9542. }
  9543. function getSideAxis(placement) {
  9544. return ['top', 'bottom'].includes(getSide$1(placement)) ? 'y' : 'x';
  9545. }
  9546. function getAlignmentAxis(placement) {
  9547. return getOppositeAxis(getSideAxis(placement));
  9548. }
  9549. function getAlignmentSides$1(placement, rects, rtl) {
  9550. if (rtl === void 0) {
  9551. rtl = false;
  9552. }
  9553. const alignment = getAlignment$1(placement);
  9554. const alignmentAxis = getAlignmentAxis(placement);
  9555. const length = getAxisLength(alignmentAxis);
  9556. let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  9557. if (rects.reference[length] > rects.floating[length]) {
  9558. mainAlignmentSide = getOppositePlacement$1(mainAlignmentSide);
  9559. }
  9560. return [mainAlignmentSide, getOppositePlacement$1(mainAlignmentSide)];
  9561. }
  9562. function getExpandedPlacements$1(placement) {
  9563. const oppositePlacement = getOppositePlacement$1(placement);
  9564. return [getOppositeAlignmentPlacement$1(placement), oppositePlacement, getOppositeAlignmentPlacement$1(oppositePlacement)];
  9565. }
  9566. function getOppositeAlignmentPlacement$1(placement) {
  9567. return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
  9568. }
  9569. function getSideList(side, isStart, rtl) {
  9570. const lr = ['left', 'right'];
  9571. const rl = ['right', 'left'];
  9572. const tb = ['top', 'bottom'];
  9573. const bt = ['bottom', 'top'];
  9574. switch (side) {
  9575. case 'top':
  9576. case 'bottom':
  9577. if (rtl) return isStart ? rl : lr;
  9578. return isStart ? lr : rl;
  9579. case 'left':
  9580. case 'right':
  9581. return isStart ? tb : bt;
  9582. default:
  9583. return [];
  9584. }
  9585. }
  9586. function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
  9587. const alignment = getAlignment$1(placement);
  9588. let list = getSideList(getSide$1(placement), direction === 'start', rtl);
  9589. if (alignment) {
  9590. list = list.map(side => side + "-" + alignment);
  9591. if (flipAlignment) {
  9592. list = list.concat(list.map(getOppositeAlignmentPlacement$1));
  9593. }
  9594. }
  9595. return list;
  9596. }
  9597. function getOppositePlacement$1(placement) {
  9598. return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
  9599. }
  9600. function expandPaddingObject$1(padding) {
  9601. return {
  9602. top: 0,
  9603. right: 0,
  9604. bottom: 0,
  9605. left: 0,
  9606. ...padding
  9607. };
  9608. }
  9609. function getPaddingObject(padding) {
  9610. return typeof padding !== 'number' ? expandPaddingObject$1(padding) : {
  9611. top: padding,
  9612. right: padding,
  9613. bottom: padding,
  9614. left: padding
  9615. };
  9616. }
  9617. function rectToClientRect$1(rect) {
  9618. const {
  9619. x,
  9620. y,
  9621. width,
  9622. height
  9623. } = rect;
  9624. return {
  9625. width,
  9626. height,
  9627. top: y,
  9628. left: x,
  9629. right: x + width,
  9630. bottom: y + height,
  9631. x,
  9632. y
  9633. };
  9634. }
  9635. function computeCoordsFromPlacement$1(_ref, placement, rtl) {
  9636. let {
  9637. reference,
  9638. floating
  9639. } = _ref;
  9640. const sideAxis = getSideAxis(placement);
  9641. const alignmentAxis = getAlignmentAxis(placement);
  9642. const alignLength = getAxisLength(alignmentAxis);
  9643. const side = getSide$1(placement);
  9644. const isVertical = sideAxis === 'y';
  9645. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  9646. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  9647. const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
  9648. let coords;
  9649. switch (side) {
  9650. case 'top':
  9651. coords = {
  9652. x: commonX,
  9653. y: reference.y - floating.height
  9654. };
  9655. break;
  9656. case 'bottom':
  9657. coords = {
  9658. x: commonX,
  9659. y: reference.y + reference.height
  9660. };
  9661. break;
  9662. case 'right':
  9663. coords = {
  9664. x: reference.x + reference.width,
  9665. y: commonY
  9666. };
  9667. break;
  9668. case 'left':
  9669. coords = {
  9670. x: reference.x - floating.width,
  9671. y: commonY
  9672. };
  9673. break;
  9674. default:
  9675. coords = {
  9676. x: reference.x,
  9677. y: reference.y
  9678. };
  9679. }
  9680. switch (getAlignment$1(placement)) {
  9681. case 'start':
  9682. coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  9683. break;
  9684. case 'end':
  9685. coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  9686. break;
  9687. }
  9688. return coords;
  9689. }
  9690. /**
  9691. * Computes the `x` and `y` coordinates that will place the floating element
  9692. * next to a given reference element.
  9693. *
  9694. * This export does not have any `platform` interface logic. You will need to
  9695. * write one for the platform you are using Floating UI with.
  9696. */
  9697. const computePosition$3 = async (reference, floating, config) => {
  9698. const {
  9699. placement = 'bottom',
  9700. strategy = 'absolute',
  9701. middleware = [],
  9702. platform
  9703. } = config;
  9704. const validMiddleware = middleware.filter(Boolean);
  9705. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  9706. let rects = await platform.getElementRects({
  9707. reference,
  9708. floating,
  9709. strategy
  9710. });
  9711. let {
  9712. x,
  9713. y
  9714. } = computeCoordsFromPlacement$1(rects, placement, rtl);
  9715. let statefulPlacement = placement;
  9716. let middlewareData = {};
  9717. let resetCount = 0;
  9718. for (let i = 0; i < validMiddleware.length; i++) {
  9719. const {
  9720. name,
  9721. fn
  9722. } = validMiddleware[i];
  9723. const {
  9724. x: nextX,
  9725. y: nextY,
  9726. data,
  9727. reset
  9728. } = await fn({
  9729. x,
  9730. y,
  9731. initialPlacement: placement,
  9732. placement: statefulPlacement,
  9733. strategy,
  9734. middlewareData,
  9735. rects,
  9736. platform,
  9737. elements: {
  9738. reference,
  9739. floating
  9740. }
  9741. });
  9742. x = nextX != null ? nextX : x;
  9743. y = nextY != null ? nextY : y;
  9744. middlewareData = {
  9745. ...middlewareData,
  9746. [name]: {
  9747. ...middlewareData[name],
  9748. ...data
  9749. }
  9750. };
  9751. if (reset && resetCount <= 50) {
  9752. resetCount++;
  9753. if (typeof reset === 'object') {
  9754. if (reset.placement) {
  9755. statefulPlacement = reset.placement;
  9756. }
  9757. if (reset.rects) {
  9758. rects = reset.rects === true ? await platform.getElementRects({
  9759. reference,
  9760. floating,
  9761. strategy
  9762. }) : reset.rects;
  9763. }
  9764. ({
  9765. x,
  9766. y
  9767. } = computeCoordsFromPlacement$1(rects, statefulPlacement, rtl));
  9768. }
  9769. i = -1;
  9770. }
  9771. }
  9772. return {
  9773. x,
  9774. y,
  9775. placement: statefulPlacement,
  9776. strategy,
  9777. middlewareData
  9778. };
  9779. };
  9780. /**
  9781. * Resolves with an object of overflow side offsets that determine how much the
  9782. * element is overflowing a given clipping boundary on each side.
  9783. * - positive = overflowing the boundary by that number of pixels
  9784. * - negative = how many pixels left before it will overflow
  9785. * - 0 = lies flush with the boundary
  9786. * @see https://floating-ui.com/docs/detectOverflow
  9787. */
  9788. async function detectOverflow$1(state, options) {
  9789. var _await$platform$isEle;
  9790. if (options === void 0) {
  9791. options = {};
  9792. }
  9793. const {
  9794. x,
  9795. y,
  9796. platform,
  9797. rects,
  9798. elements,
  9799. strategy
  9800. } = state;
  9801. const {
  9802. boundary = 'clippingAncestors',
  9803. rootBoundary = 'viewport',
  9804. elementContext = 'floating',
  9805. altBoundary = false,
  9806. padding = 0
  9807. } = evaluate(options, state);
  9808. const paddingObject = getPaddingObject(padding);
  9809. const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  9810. const element = elements[altBoundary ? altContext : elementContext];
  9811. const clippingClientRect = rectToClientRect$1(await platform.getClippingRect({
  9812. 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))),
  9813. boundary,
  9814. rootBoundary,
  9815. strategy
  9816. }));
  9817. const rect = elementContext === 'floating' ? {
  9818. x,
  9819. y,
  9820. width: rects.floating.width,
  9821. height: rects.floating.height
  9822. } : rects.reference;
  9823. const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
  9824. const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
  9825. x: 1,
  9826. y: 1
  9827. } : {
  9828. x: 1,
  9829. y: 1
  9830. };
  9831. const elementClientRect = rectToClientRect$1(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  9832. elements,
  9833. rect,
  9834. offsetParent,
  9835. strategy
  9836. }) : rect);
  9837. return {
  9838. top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
  9839. bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
  9840. left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
  9841. right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
  9842. };
  9843. }
  9844. /**
  9845. * Provides data to position an inner element of the floating element so that it
  9846. * appears centered to the reference element.
  9847. * @see https://floating-ui.com/docs/arrow
  9848. */
  9849. const arrow$2 = options => ({
  9850. name: 'arrow',
  9851. options,
  9852. async fn(state) {
  9853. const {
  9854. x,
  9855. y,
  9856. placement,
  9857. rects,
  9858. platform,
  9859. elements,
  9860. middlewareData
  9861. } = state;
  9862. // Since `element` is required, we don't Partial<> the type.
  9863. const {
  9864. element,
  9865. padding = 0
  9866. } = evaluate(options, state) || {};
  9867. if (element == null) {
  9868. return {};
  9869. }
  9870. const paddingObject = getPaddingObject(padding);
  9871. const coords = {
  9872. x,
  9873. y
  9874. };
  9875. const axis = getAlignmentAxis(placement);
  9876. const length = getAxisLength(axis);
  9877. const arrowDimensions = await platform.getDimensions(element);
  9878. const isYAxis = axis === 'y';
  9879. const minProp = isYAxis ? 'top' : 'left';
  9880. const maxProp = isYAxis ? 'bottom' : 'right';
  9881. const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
  9882. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  9883. const startDiff = coords[axis] - rects.reference[axis];
  9884. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  9885. let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
  9886. // DOM platform can return `window` as the `offsetParent`.
  9887. if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
  9888. clientSize = elements.floating[clientProp] || rects.floating[length];
  9889. }
  9890. const centerToReference = endDiff / 2 - startDiff / 2;
  9891. // If the padding is large enough that it causes the arrow to no longer be
  9892. // centered, modify the padding so that it is centered.
  9893. const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
  9894. const minPadding = min$3(paddingObject[minProp], largestPossiblePadding);
  9895. const maxPadding = min$3(paddingObject[maxProp], largestPossiblePadding);
  9896. // Make sure the arrow doesn't overflow the floating element if the center
  9897. // point is outside the floating element's bounds.
  9898. const min$1 = minPadding;
  9899. const max = clientSize - arrowDimensions[length] - maxPadding;
  9900. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  9901. const offset = clamp(min$1, center, max);
  9902. // If the reference is small enough that the arrow's padding causes it to
  9903. // to point to nothing for an aligned placement, adjust the offset of the
  9904. // floating element itself. To ensure `shift()` continues to take action,
  9905. // a single reset is performed when this is true.
  9906. const shouldAddOffset = !middlewareData.arrow && getAlignment$1(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
  9907. const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
  9908. return {
  9909. [axis]: coords[axis] + alignmentOffset,
  9910. data: {
  9911. [axis]: offset,
  9912. centerOffset: center - offset - alignmentOffset,
  9913. ...(shouldAddOffset && {
  9914. alignmentOffset
  9915. })
  9916. },
  9917. reset: shouldAddOffset
  9918. };
  9919. }
  9920. });
  9921. function getPlacementList(alignment, autoAlignment, allowedPlacements) {
  9922. const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment$1(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment$1(placement) !== alignment)] : allowedPlacements.filter(placement => getSide$1(placement) === placement);
  9923. return allowedPlacementsSortedByAlignment.filter(placement => {
  9924. if (alignment) {
  9925. return getAlignment$1(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement$1(placement) !== placement : false);
  9926. }
  9927. return true;
  9928. });
  9929. }
  9930. /**
  9931. * Optimizes the visibility of the floating element by choosing the placement
  9932. * that has the most space available automatically, without needing to specify a
  9933. * preferred placement. Alternative to `flip`.
  9934. * @see https://floating-ui.com/docs/autoPlacement
  9935. */
  9936. const autoPlacement = function (options) {
  9937. if (options === void 0) {
  9938. options = {};
  9939. }
  9940. return {
  9941. name: 'autoPlacement',
  9942. options,
  9943. async fn(state) {
  9944. var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
  9945. const {
  9946. rects,
  9947. middlewareData,
  9948. placement,
  9949. platform,
  9950. elements
  9951. } = state;
  9952. const {
  9953. crossAxis = false,
  9954. alignment,
  9955. allowedPlacements = placements,
  9956. autoAlignment = true,
  9957. ...detectOverflowOptions
  9958. } = evaluate(options, state);
  9959. const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
  9960. const overflow = await detectOverflow$1(state, detectOverflowOptions);
  9961. const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
  9962. const currentPlacement = placements$1[currentIndex];
  9963. if (currentPlacement == null) {
  9964. return {};
  9965. }
  9966. const alignmentSides = getAlignmentSides$1(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
  9967. // Make `computeCoords` start from the right place.
  9968. if (placement !== currentPlacement) {
  9969. return {
  9970. reset: {
  9971. placement: placements$1[0]
  9972. }
  9973. };
  9974. }
  9975. const currentOverflows = [overflow[getSide$1(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
  9976. const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
  9977. placement: currentPlacement,
  9978. overflows: currentOverflows
  9979. }];
  9980. const nextPlacement = placements$1[currentIndex + 1];
  9981. // There are more placements to check.
  9982. if (nextPlacement) {
  9983. return {
  9984. data: {
  9985. index: currentIndex + 1,
  9986. overflows: allOverflows
  9987. },
  9988. reset: {
  9989. placement: nextPlacement
  9990. }
  9991. };
  9992. }
  9993. const placementsSortedByMostSpace = allOverflows.map(d => {
  9994. const alignment = getAlignment$1(d.placement);
  9995. return [d.placement, alignment && crossAxis ?
  9996. // Check along the mainAxis and main crossAxis side.
  9997. d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
  9998. // Check only the mainAxis.
  9999. d.overflows[0], d.overflows];
  10000. }).sort((a, b) => a[1] - b[1]);
  10001. const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
  10002. // Aligned placements should not check their opposite crossAxis
  10003. // side.
  10004. getAlignment$1(d[0]) ? 2 : 3).every(v => v <= 0));
  10005. const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
  10006. if (resetPlacement !== placement) {
  10007. return {
  10008. data: {
  10009. index: currentIndex + 1,
  10010. overflows: allOverflows
  10011. },
  10012. reset: {
  10013. placement: resetPlacement
  10014. }
  10015. };
  10016. }
  10017. return {};
  10018. }
  10019. };
  10020. };
  10021. /**
  10022. * Optimizes the visibility of the floating element by flipping the `placement`
  10023. * in order to keep it in view when the preferred placement(s) will overflow the
  10024. * clipping boundary. Alternative to `autoPlacement`.
  10025. * @see https://floating-ui.com/docs/flip
  10026. */
  10027. const flip$1 = function (options) {
  10028. if (options === void 0) {
  10029. options = {};
  10030. }
  10031. return {
  10032. name: 'flip',
  10033. options,
  10034. async fn(state) {
  10035. var _middlewareData$arrow, _middlewareData$flip;
  10036. const {
  10037. placement,
  10038. middlewareData,
  10039. rects,
  10040. initialPlacement,
  10041. platform,
  10042. elements
  10043. } = state;
  10044. const {
  10045. mainAxis: checkMainAxis = true,
  10046. crossAxis: checkCrossAxis = true,
  10047. fallbackPlacements: specifiedFallbackPlacements,
  10048. fallbackStrategy = 'bestFit',
  10049. fallbackAxisSideDirection = 'none',
  10050. flipAlignment = true,
  10051. ...detectOverflowOptions
  10052. } = evaluate(options, state);
  10053. // If a reset by the arrow was caused due to an alignment offset being
  10054. // added, we should skip any logic now since `flip()` has already done its
  10055. // work.
  10056. // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
  10057. if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
  10058. return {};
  10059. }
  10060. const side = getSide$1(placement);
  10061. const initialSideAxis = getSideAxis(initialPlacement);
  10062. const isBasePlacement = getSide$1(initialPlacement) === initialPlacement;
  10063. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  10064. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement$1(initialPlacement)] : getExpandedPlacements$1(initialPlacement));
  10065. const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
  10066. if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
  10067. fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
  10068. }
  10069. const placements = [initialPlacement, ...fallbackPlacements];
  10070. const overflow = await detectOverflow$1(state, detectOverflowOptions);
  10071. const overflows = [];
  10072. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  10073. if (checkMainAxis) {
  10074. overflows.push(overflow[side]);
  10075. }
  10076. if (checkCrossAxis) {
  10077. const sides = getAlignmentSides$1(placement, rects, rtl);
  10078. overflows.push(overflow[sides[0]], overflow[sides[1]]);
  10079. }
  10080. overflowsData = [...overflowsData, {
  10081. placement,
  10082. overflows
  10083. }];
  10084. // One or more sides is overflowing.
  10085. if (!overflows.every(side => side <= 0)) {
  10086. var _middlewareData$flip2, _overflowsData$filter;
  10087. const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
  10088. const nextPlacement = placements[nextIndex];
  10089. if (nextPlacement) {
  10090. // Try next placement and re-run the lifecycle.
  10091. return {
  10092. data: {
  10093. index: nextIndex,
  10094. overflows: overflowsData
  10095. },
  10096. reset: {
  10097. placement: nextPlacement
  10098. }
  10099. };
  10100. }
  10101. // First, find the candidates that fit on the mainAxis side of overflow,
  10102. // then find the placement that fits the best on the main crossAxis side.
  10103. 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;
  10104. // Otherwise fallback.
  10105. if (!resetPlacement) {
  10106. switch (fallbackStrategy) {
  10107. case 'bestFit':
  10108. {
  10109. var _overflowsData$filter2;
  10110. const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
  10111. if (hasFallbackAxisSideDirection) {
  10112. const currentSideAxis = getSideAxis(d.placement);
  10113. return currentSideAxis === initialSideAxis ||
  10114. // Create a bias to the `y` side axis due to horizontal
  10115. // reading directions favoring greater width.
  10116. currentSideAxis === 'y';
  10117. }
  10118. return true;
  10119. }).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];
  10120. if (placement) {
  10121. resetPlacement = placement;
  10122. }
  10123. break;
  10124. }
  10125. case 'initialPlacement':
  10126. resetPlacement = initialPlacement;
  10127. break;
  10128. }
  10129. }
  10130. if (placement !== resetPlacement) {
  10131. return {
  10132. reset: {
  10133. placement: resetPlacement
  10134. }
  10135. };
  10136. }
  10137. }
  10138. return {};
  10139. }
  10140. };
  10141. };
  10142. function getSideOffsets(overflow, rect) {
  10143. return {
  10144. top: overflow.top - rect.height,
  10145. right: overflow.right - rect.width,
  10146. bottom: overflow.bottom - rect.height,
  10147. left: overflow.left - rect.width
  10148. };
  10149. }
  10150. function isAnySideFullyClipped(overflow) {
  10151. return sides.some(side => overflow[side] >= 0);
  10152. }
  10153. /**
  10154. * Provides data to hide the floating element in applicable situations, such as
  10155. * when it is not in the same clipping context as the reference element.
  10156. * @see https://floating-ui.com/docs/hide
  10157. */
  10158. const hide = function (options) {
  10159. if (options === void 0) {
  10160. options = {};
  10161. }
  10162. return {
  10163. name: 'hide',
  10164. options,
  10165. async fn(state) {
  10166. const {
  10167. rects
  10168. } = state;
  10169. const {
  10170. strategy = 'referenceHidden',
  10171. ...detectOverflowOptions
  10172. } = evaluate(options, state);
  10173. switch (strategy) {
  10174. case 'referenceHidden':
  10175. {
  10176. const overflow = await detectOverflow$1(state, {
  10177. ...detectOverflowOptions,
  10178. elementContext: 'reference'
  10179. });
  10180. const offsets = getSideOffsets(overflow, rects.reference);
  10181. return {
  10182. data: {
  10183. referenceHiddenOffsets: offsets,
  10184. referenceHidden: isAnySideFullyClipped(offsets)
  10185. }
  10186. };
  10187. }
  10188. case 'escaped':
  10189. {
  10190. const overflow = await detectOverflow$1(state, {
  10191. ...detectOverflowOptions,
  10192. altBoundary: true
  10193. });
  10194. const offsets = getSideOffsets(overflow, rects.floating);
  10195. return {
  10196. data: {
  10197. escapedOffsets: offsets,
  10198. escaped: isAnySideFullyClipped(offsets)
  10199. }
  10200. };
  10201. }
  10202. default:
  10203. {
  10204. return {};
  10205. }
  10206. }
  10207. }
  10208. };
  10209. };
  10210. function getBoundingRect(rects) {
  10211. const minX = min$3(...rects.map(rect => rect.left));
  10212. const minY = min$3(...rects.map(rect => rect.top));
  10213. const maxX = max$3(...rects.map(rect => rect.right));
  10214. const maxY = max$3(...rects.map(rect => rect.bottom));
  10215. return {
  10216. x: minX,
  10217. y: minY,
  10218. width: maxX - minX,
  10219. height: maxY - minY
  10220. };
  10221. }
  10222. function getRectsByLine(rects) {
  10223. const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
  10224. const groups = [];
  10225. let prevRect = null;
  10226. for (let i = 0; i < sortedRects.length; i++) {
  10227. const rect = sortedRects[i];
  10228. if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
  10229. groups.push([rect]);
  10230. } else {
  10231. groups[groups.length - 1].push(rect);
  10232. }
  10233. prevRect = rect;
  10234. }
  10235. return groups.map(rect => rectToClientRect$1(getBoundingRect(rect)));
  10236. }
  10237. /**
  10238. * Provides improved positioning for inline reference elements that can span
  10239. * over multiple lines, such as hyperlinks or range selections.
  10240. * @see https://floating-ui.com/docs/inline
  10241. */
  10242. const inline = function (options) {
  10243. if (options === void 0) {
  10244. options = {};
  10245. }
  10246. return {
  10247. name: 'inline',
  10248. options,
  10249. async fn(state) {
  10250. const {
  10251. placement,
  10252. elements,
  10253. rects,
  10254. platform,
  10255. strategy
  10256. } = state;
  10257. // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
  10258. // ClientRect's bounds, despite the event listener being triggered. A
  10259. // padding of 2 seems to handle this issue.
  10260. const {
  10261. padding = 2,
  10262. x,
  10263. y
  10264. } = evaluate(options, state);
  10265. const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
  10266. const clientRects = getRectsByLine(nativeClientRects);
  10267. const fallback = rectToClientRect$1(getBoundingRect(nativeClientRects));
  10268. const paddingObject = getPaddingObject(padding);
  10269. function getBoundingClientRect() {
  10270. // There are two rects and they are disjoined.
  10271. if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
  10272. // Find the first rect in which the point is fully inside.
  10273. return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
  10274. }
  10275. // There are 2 or more connected rects.
  10276. if (clientRects.length >= 2) {
  10277. if (getSideAxis(placement) === 'y') {
  10278. const firstRect = clientRects[0];
  10279. const lastRect = clientRects[clientRects.length - 1];
  10280. const isTop = getSide$1(placement) === 'top';
  10281. const top = firstRect.top;
  10282. const bottom = lastRect.bottom;
  10283. const left = isTop ? firstRect.left : lastRect.left;
  10284. const right = isTop ? firstRect.right : lastRect.right;
  10285. const width = right - left;
  10286. const height = bottom - top;
  10287. return {
  10288. top,
  10289. bottom,
  10290. left,
  10291. right,
  10292. width,
  10293. height,
  10294. x: left,
  10295. y: top
  10296. };
  10297. }
  10298. const isLeftSide = getSide$1(placement) === 'left';
  10299. const maxRight = max$3(...clientRects.map(rect => rect.right));
  10300. const minLeft = min$3(...clientRects.map(rect => rect.left));
  10301. const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
  10302. const top = measureRects[0].top;
  10303. const bottom = measureRects[measureRects.length - 1].bottom;
  10304. const left = minLeft;
  10305. const right = maxRight;
  10306. const width = right - left;
  10307. const height = bottom - top;
  10308. return {
  10309. top,
  10310. bottom,
  10311. left,
  10312. right,
  10313. width,
  10314. height,
  10315. x: left,
  10316. y: top
  10317. };
  10318. }
  10319. return fallback;
  10320. }
  10321. const resetRects = await platform.getElementRects({
  10322. reference: {
  10323. getBoundingClientRect
  10324. },
  10325. floating: elements.floating,
  10326. strategy
  10327. });
  10328. if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
  10329. return {
  10330. reset: {
  10331. rects: resetRects
  10332. }
  10333. };
  10334. }
  10335. return {};
  10336. }
  10337. };
  10338. };
  10339. // For type backwards-compatibility, the `OffsetOptions` type was also
  10340. // Derivable.
  10341. async function convertValueToCoords$1(state, options) {
  10342. const {
  10343. placement,
  10344. platform,
  10345. elements
  10346. } = state;
  10347. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  10348. const side = getSide$1(placement);
  10349. const alignment = getAlignment$1(placement);
  10350. const isVertical = getSideAxis(placement) === 'y';
  10351. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  10352. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  10353. const rawValue = evaluate(options, state);
  10354. // eslint-disable-next-line prefer-const
  10355. let {
  10356. mainAxis,
  10357. crossAxis,
  10358. alignmentAxis
  10359. } = typeof rawValue === 'number' ? {
  10360. mainAxis: rawValue,
  10361. crossAxis: 0,
  10362. alignmentAxis: null
  10363. } : {
  10364. mainAxis: 0,
  10365. crossAxis: 0,
  10366. alignmentAxis: null,
  10367. ...rawValue
  10368. };
  10369. if (alignment && typeof alignmentAxis === 'number') {
  10370. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  10371. }
  10372. return isVertical ? {
  10373. x: crossAxis * crossAxisMulti,
  10374. y: mainAxis * mainAxisMulti
  10375. } : {
  10376. x: mainAxis * mainAxisMulti,
  10377. y: crossAxis * crossAxisMulti
  10378. };
  10379. }
  10380. /**
  10381. * Modifies the placement by translating the floating element along the
  10382. * specified axes.
  10383. * A number (shorthand for `mainAxis` or distance), or an axes configuration
  10384. * object may be passed.
  10385. * @see https://floating-ui.com/docs/offset
  10386. */
  10387. const offset$1 = function (options) {
  10388. if (options === void 0) {
  10389. options = 0;
  10390. }
  10391. return {
  10392. name: 'offset',
  10393. options,
  10394. async fn(state) {
  10395. var _middlewareData$offse, _middlewareData$arrow;
  10396. const {
  10397. x,
  10398. y,
  10399. placement,
  10400. middlewareData
  10401. } = state;
  10402. const diffCoords = await convertValueToCoords$1(state, options);
  10403. // If the placement is the same and the arrow caused an alignment offset
  10404. // then we don't need to change the positioning coordinates.
  10405. if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
  10406. return {};
  10407. }
  10408. return {
  10409. x: x + diffCoords.x,
  10410. y: y + diffCoords.y,
  10411. data: {
  10412. ...diffCoords,
  10413. placement
  10414. }
  10415. };
  10416. }
  10417. };
  10418. };
  10419. /**
  10420. * Optimizes the visibility of the floating element by shifting it in order to
  10421. * keep it in view when it will overflow the clipping boundary.
  10422. * @see https://floating-ui.com/docs/shift
  10423. */
  10424. const shift$1 = function (options) {
  10425. if (options === void 0) {
  10426. options = {};
  10427. }
  10428. return {
  10429. name: 'shift',
  10430. options,
  10431. async fn(state) {
  10432. const {
  10433. x,
  10434. y,
  10435. placement
  10436. } = state;
  10437. const {
  10438. mainAxis: checkMainAxis = true,
  10439. crossAxis: checkCrossAxis = false,
  10440. limiter = {
  10441. fn: _ref => {
  10442. let {
  10443. x,
  10444. y
  10445. } = _ref;
  10446. return {
  10447. x,
  10448. y
  10449. };
  10450. }
  10451. },
  10452. ...detectOverflowOptions
  10453. } = evaluate(options, state);
  10454. const coords = {
  10455. x,
  10456. y
  10457. };
  10458. const overflow = await detectOverflow$1(state, detectOverflowOptions);
  10459. const crossAxis = getSideAxis(getSide$1(placement));
  10460. const mainAxis = getOppositeAxis(crossAxis);
  10461. let mainAxisCoord = coords[mainAxis];
  10462. let crossAxisCoord = coords[crossAxis];
  10463. if (checkMainAxis) {
  10464. const minSide = mainAxis === 'y' ? 'top' : 'left';
  10465. const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
  10466. const min = mainAxisCoord + overflow[minSide];
  10467. const max = mainAxisCoord - overflow[maxSide];
  10468. mainAxisCoord = clamp(min, mainAxisCoord, max);
  10469. }
  10470. if (checkCrossAxis) {
  10471. const minSide = crossAxis === 'y' ? 'top' : 'left';
  10472. const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
  10473. const min = crossAxisCoord + overflow[minSide];
  10474. const max = crossAxisCoord - overflow[maxSide];
  10475. crossAxisCoord = clamp(min, crossAxisCoord, max);
  10476. }
  10477. const limitedCoords = limiter.fn({
  10478. ...state,
  10479. [mainAxis]: mainAxisCoord,
  10480. [crossAxis]: crossAxisCoord
  10481. });
  10482. return {
  10483. ...limitedCoords,
  10484. data: {
  10485. x: limitedCoords.x - x,
  10486. y: limitedCoords.y - y
  10487. }
  10488. };
  10489. }
  10490. };
  10491. };
  10492. /**
  10493. * Built-in `limiter` that will stop `shift()` at a certain point.
  10494. */
  10495. const limitShift = function (options) {
  10496. if (options === void 0) {
  10497. options = {};
  10498. }
  10499. return {
  10500. options,
  10501. fn(state) {
  10502. const {
  10503. x,
  10504. y,
  10505. placement,
  10506. rects,
  10507. middlewareData
  10508. } = state;
  10509. const {
  10510. offset = 0,
  10511. mainAxis: checkMainAxis = true,
  10512. crossAxis: checkCrossAxis = true
  10513. } = evaluate(options, state);
  10514. const coords = {
  10515. x,
  10516. y
  10517. };
  10518. const crossAxis = getSideAxis(placement);
  10519. const mainAxis = getOppositeAxis(crossAxis);
  10520. let mainAxisCoord = coords[mainAxis];
  10521. let crossAxisCoord = coords[crossAxis];
  10522. const rawOffset = evaluate(offset, state);
  10523. const computedOffset = typeof rawOffset === 'number' ? {
  10524. mainAxis: rawOffset,
  10525. crossAxis: 0
  10526. } : {
  10527. mainAxis: 0,
  10528. crossAxis: 0,
  10529. ...rawOffset
  10530. };
  10531. if (checkMainAxis) {
  10532. const len = mainAxis === 'y' ? 'height' : 'width';
  10533. const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
  10534. const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
  10535. if (mainAxisCoord < limitMin) {
  10536. mainAxisCoord = limitMin;
  10537. } else if (mainAxisCoord > limitMax) {
  10538. mainAxisCoord = limitMax;
  10539. }
  10540. }
  10541. if (checkCrossAxis) {
  10542. var _middlewareData$offse, _middlewareData$offse2;
  10543. const len = mainAxis === 'y' ? 'width' : 'height';
  10544. const isOriginSide = ['top', 'left'].includes(getSide$1(placement));
  10545. const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
  10546. const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
  10547. if (crossAxisCoord < limitMin) {
  10548. crossAxisCoord = limitMin;
  10549. } else if (crossAxisCoord > limitMax) {
  10550. crossAxisCoord = limitMax;
  10551. }
  10552. }
  10553. return {
  10554. [mainAxis]: mainAxisCoord,
  10555. [crossAxis]: crossAxisCoord
  10556. };
  10557. }
  10558. };
  10559. };
  10560. /**
  10561. * Provides data that allows you to change the size of the floating element —
  10562. * for instance, prevent it from overflowing the clipping boundary or match the
  10563. * width of the reference element.
  10564. * @see https://floating-ui.com/docs/size
  10565. */
  10566. const size = function (options) {
  10567. if (options === void 0) {
  10568. options = {};
  10569. }
  10570. return {
  10571. name: 'size',
  10572. options,
  10573. async fn(state) {
  10574. const {
  10575. placement,
  10576. rects,
  10577. platform,
  10578. elements
  10579. } = state;
  10580. const {
  10581. apply = () => {},
  10582. ...detectOverflowOptions
  10583. } = evaluate(options, state);
  10584. const overflow = await detectOverflow$1(state, detectOverflowOptions);
  10585. const side = getSide$1(placement);
  10586. const alignment = getAlignment$1(placement);
  10587. const isYAxis = getSideAxis(placement) === 'y';
  10588. const {
  10589. width,
  10590. height
  10591. } = rects.floating;
  10592. let heightSide;
  10593. let widthSide;
  10594. if (side === 'top' || side === 'bottom') {
  10595. heightSide = side;
  10596. widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
  10597. } else {
  10598. widthSide = side;
  10599. heightSide = alignment === 'end' ? 'top' : 'bottom';
  10600. }
  10601. const maximumClippingHeight = height - overflow.top - overflow.bottom;
  10602. const maximumClippingWidth = width - overflow.left - overflow.right;
  10603. const overflowAvailableHeight = min$3(height - overflow[heightSide], maximumClippingHeight);
  10604. const overflowAvailableWidth = min$3(width - overflow[widthSide], maximumClippingWidth);
  10605. const noShift = !state.middlewareData.shift;
  10606. let availableHeight = overflowAvailableHeight;
  10607. let availableWidth = overflowAvailableWidth;
  10608. if (isYAxis) {
  10609. availableWidth = alignment || noShift ? min$3(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
  10610. } else {
  10611. availableHeight = alignment || noShift ? min$3(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
  10612. }
  10613. if (noShift && !alignment) {
  10614. const xMin = max$3(overflow.left, 0);
  10615. const xMax = max$3(overflow.right, 0);
  10616. const yMin = max$3(overflow.top, 0);
  10617. const yMax = max$3(overflow.bottom, 0);
  10618. if (isYAxis) {
  10619. availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$3(overflow.left, overflow.right));
  10620. } else {
  10621. availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$3(overflow.top, overflow.bottom));
  10622. }
  10623. }
  10624. await apply({
  10625. ...state,
  10626. availableWidth,
  10627. availableHeight
  10628. });
  10629. const nextDimensions = await platform.getDimensions(elements.floating);
  10630. if (width !== nextDimensions.width || height !== nextDimensions.height) {
  10631. return {
  10632. reset: {
  10633. rects: true
  10634. }
  10635. };
  10636. }
  10637. return {};
  10638. }
  10639. };
  10640. };
  10641. function getNodeName$1(node) {
  10642. if (isNode$1(node)) {
  10643. return (node.nodeName || '').toLowerCase();
  10644. }
  10645. // Mocked nodes in testing environments may not be instances of Node. By
  10646. // returning `#document` an infinite loop won't occur.
  10647. // https://github.com/floating-ui/floating-ui/issues/2317
  10648. return '#document';
  10649. }
  10650. function getWindow$1(node) {
  10651. var _node$ownerDocument;
  10652. return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
  10653. }
  10654. function getDocumentElement$1(node) {
  10655. var _ref;
  10656. return (_ref = (isNode$1(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
  10657. }
  10658. function isNode$1(value) {
  10659. return value instanceof Node || value instanceof getWindow$1(value).Node;
  10660. }
  10661. function isElement$1(value) {
  10662. return value instanceof Element || value instanceof getWindow$1(value).Element;
  10663. }
  10664. function isHTMLElement$1(value) {
  10665. return value instanceof HTMLElement || value instanceof getWindow$1(value).HTMLElement;
  10666. }
  10667. function isShadowRoot$1(value) {
  10668. // Browsers without `ShadowRoot` support.
  10669. if (typeof ShadowRoot === 'undefined') {
  10670. return false;
  10671. }
  10672. return value instanceof ShadowRoot || value instanceof getWindow$1(value).ShadowRoot;
  10673. }
  10674. function isOverflowElement$1(element) {
  10675. const {
  10676. overflow,
  10677. overflowX,
  10678. overflowY,
  10679. display
  10680. } = getComputedStyle$2(element);
  10681. return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
  10682. }
  10683. function isTableElement$1(element) {
  10684. return ['table', 'td', 'th'].includes(getNodeName$1(element));
  10685. }
  10686. function isTopLayer(element) {
  10687. return [':popover-open', ':modal'].some(selector => {
  10688. try {
  10689. return element.matches(selector);
  10690. } catch (e) {
  10691. return false;
  10692. }
  10693. });
  10694. }
  10695. function isContainingBlock$1(elementOrCss) {
  10696. const webkit = isWebKit();
  10697. const css = isElement$1(elementOrCss) ? getComputedStyle$2(elementOrCss) : elementOrCss;
  10698. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  10699. return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
  10700. }
  10701. function getContainingBlock$1(element) {
  10702. let currentNode = getParentNode$1(element);
  10703. while (isHTMLElement$1(currentNode) && !isLastTraversableNode(currentNode)) {
  10704. if (isContainingBlock$1(currentNode)) {
  10705. return currentNode;
  10706. } else if (isTopLayer(currentNode)) {
  10707. return null;
  10708. }
  10709. currentNode = getParentNode$1(currentNode);
  10710. }
  10711. return null;
  10712. }
  10713. function isWebKit() {
  10714. if (typeof CSS === 'undefined' || !CSS.supports) return false;
  10715. return CSS.supports('-webkit-backdrop-filter', 'none');
  10716. }
  10717. function isLastTraversableNode(node) {
  10718. return ['html', 'body', '#document'].includes(getNodeName$1(node));
  10719. }
  10720. function getComputedStyle$2(element) {
  10721. return getWindow$1(element).getComputedStyle(element);
  10722. }
  10723. function getNodeScroll$1(element) {
  10724. if (isElement$1(element)) {
  10725. return {
  10726. scrollLeft: element.scrollLeft,
  10727. scrollTop: element.scrollTop
  10728. };
  10729. }
  10730. return {
  10731. scrollLeft: element.scrollX,
  10732. scrollTop: element.scrollY
  10733. };
  10734. }
  10735. function getParentNode$1(node) {
  10736. if (getNodeName$1(node) === 'html') {
  10737. return node;
  10738. }
  10739. const result =
  10740. // Step into the shadow DOM of the parent of a slotted node.
  10741. node.assignedSlot ||
  10742. // DOM Element detected.
  10743. node.parentNode ||
  10744. // ShadowRoot detected.
  10745. isShadowRoot$1(node) && node.host ||
  10746. // Fallback.
  10747. getDocumentElement$1(node);
  10748. return isShadowRoot$1(result) ? result.host : result;
  10749. }
  10750. function getNearestOverflowAncestor$1(node) {
  10751. const parentNode = getParentNode$1(node);
  10752. if (isLastTraversableNode(parentNode)) {
  10753. return node.ownerDocument ? node.ownerDocument.body : node.body;
  10754. }
  10755. if (isHTMLElement$1(parentNode) && isOverflowElement$1(parentNode)) {
  10756. return parentNode;
  10757. }
  10758. return getNearestOverflowAncestor$1(parentNode);
  10759. }
  10760. function getOverflowAncestors$1(node, list, traverseIframes) {
  10761. var _node$ownerDocument2;
  10762. if (list === void 0) {
  10763. list = [];
  10764. }
  10765. if (traverseIframes === void 0) {
  10766. traverseIframes = true;
  10767. }
  10768. const scrollableAncestor = getNearestOverflowAncestor$1(node);
  10769. const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
  10770. const win = getWindow$1(scrollableAncestor);
  10771. if (isBody) {
  10772. return list.concat(win, win.visualViewport || [], isOverflowElement$1(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors$1(win.frameElement) : []);
  10773. }
  10774. return list.concat(scrollableAncestor, getOverflowAncestors$1(scrollableAncestor, [], traverseIframes));
  10775. }
  10776. function getCssDimensions(element) {
  10777. const css = getComputedStyle$2(element);
  10778. // In testing environments, the `width` and `height` properties are empty
  10779. // strings for SVG elements, returning NaN. Fallback to `0` in this case.
  10780. let width = parseFloat(css.width) || 0;
  10781. let height = parseFloat(css.height) || 0;
  10782. const hasOffset = isHTMLElement$1(element);
  10783. const offsetWidth = hasOffset ? element.offsetWidth : width;
  10784. const offsetHeight = hasOffset ? element.offsetHeight : height;
  10785. const shouldFallback = round$1(width) !== offsetWidth || round$1(height) !== offsetHeight;
  10786. if (shouldFallback) {
  10787. width = offsetWidth;
  10788. height = offsetHeight;
  10789. }
  10790. return {
  10791. width,
  10792. height,
  10793. $: shouldFallback
  10794. };
  10795. }
  10796. function unwrapElement(element) {
  10797. return !isElement$1(element) ? element.contextElement : element;
  10798. }
  10799. function getScale(element) {
  10800. const domElement = unwrapElement(element);
  10801. if (!isHTMLElement$1(domElement)) {
  10802. return createCoords(1);
  10803. }
  10804. const rect = domElement.getBoundingClientRect();
  10805. const {
  10806. width,
  10807. height,
  10808. $
  10809. } = getCssDimensions(domElement);
  10810. let x = ($ ? round$1(rect.width) : rect.width) / width;
  10811. let y = ($ ? round$1(rect.height) : rect.height) / height;
  10812. // 0, NaN, or Infinity should always fallback to 1.
  10813. if (!x || !Number.isFinite(x)) {
  10814. x = 1;
  10815. }
  10816. if (!y || !Number.isFinite(y)) {
  10817. y = 1;
  10818. }
  10819. return {
  10820. x,
  10821. y
  10822. };
  10823. }
  10824. const noOffsets = /*#__PURE__*/createCoords(0);
  10825. function getVisualOffsets(element) {
  10826. const win = getWindow$1(element);
  10827. if (!isWebKit() || !win.visualViewport) {
  10828. return noOffsets;
  10829. }
  10830. return {
  10831. x: win.visualViewport.offsetLeft,
  10832. y: win.visualViewport.offsetTop
  10833. };
  10834. }
  10835. function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
  10836. if (isFixed === void 0) {
  10837. isFixed = false;
  10838. }
  10839. if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow$1(element)) {
  10840. return false;
  10841. }
  10842. return isFixed;
  10843. }
  10844. function getBoundingClientRect$1(element, includeScale, isFixedStrategy, offsetParent) {
  10845. if (includeScale === void 0) {
  10846. includeScale = false;
  10847. }
  10848. if (isFixedStrategy === void 0) {
  10849. isFixedStrategy = false;
  10850. }
  10851. const clientRect = element.getBoundingClientRect();
  10852. const domElement = unwrapElement(element);
  10853. let scale = createCoords(1);
  10854. if (includeScale) {
  10855. if (offsetParent) {
  10856. if (isElement$1(offsetParent)) {
  10857. scale = getScale(offsetParent);
  10858. }
  10859. } else {
  10860. scale = getScale(element);
  10861. }
  10862. }
  10863. const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
  10864. let x = (clientRect.left + visualOffsets.x) / scale.x;
  10865. let y = (clientRect.top + visualOffsets.y) / scale.y;
  10866. let width = clientRect.width / scale.x;
  10867. let height = clientRect.height / scale.y;
  10868. if (domElement) {
  10869. const win = getWindow$1(domElement);
  10870. const offsetWin = offsetParent && isElement$1(offsetParent) ? getWindow$1(offsetParent) : offsetParent;
  10871. let currentWin = win;
  10872. let currentIFrame = currentWin.frameElement;
  10873. while (currentIFrame && offsetParent && offsetWin !== currentWin) {
  10874. const iframeScale = getScale(currentIFrame);
  10875. const iframeRect = currentIFrame.getBoundingClientRect();
  10876. const css = getComputedStyle$2(currentIFrame);
  10877. const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
  10878. const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
  10879. x *= iframeScale.x;
  10880. y *= iframeScale.y;
  10881. width *= iframeScale.x;
  10882. height *= iframeScale.y;
  10883. x += left;
  10884. y += top;
  10885. currentWin = getWindow$1(currentIFrame);
  10886. currentIFrame = currentWin.frameElement;
  10887. }
  10888. }
  10889. return rectToClientRect$1({
  10890. width,
  10891. height,
  10892. x,
  10893. y
  10894. });
  10895. }
  10896. function convertOffsetParentRelativeRectToViewportRelativeRect$1(_ref) {
  10897. let {
  10898. elements,
  10899. rect,
  10900. offsetParent,
  10901. strategy
  10902. } = _ref;
  10903. const isFixed = strategy === 'fixed';
  10904. const documentElement = getDocumentElement$1(offsetParent);
  10905. const topLayer = elements ? isTopLayer(elements.floating) : false;
  10906. if (offsetParent === documentElement || topLayer && isFixed) {
  10907. return rect;
  10908. }
  10909. let scroll = {
  10910. scrollLeft: 0,
  10911. scrollTop: 0
  10912. };
  10913. let scale = createCoords(1);
  10914. const offsets = createCoords(0);
  10915. const isOffsetParentAnElement = isHTMLElement$1(offsetParent);
  10916. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  10917. if (getNodeName$1(offsetParent) !== 'body' || isOverflowElement$1(documentElement)) {
  10918. scroll = getNodeScroll$1(offsetParent);
  10919. }
  10920. if (isHTMLElement$1(offsetParent)) {
  10921. const offsetRect = getBoundingClientRect$1(offsetParent);
  10922. scale = getScale(offsetParent);
  10923. offsets.x = offsetRect.x + offsetParent.clientLeft;
  10924. offsets.y = offsetRect.y + offsetParent.clientTop;
  10925. }
  10926. }
  10927. return {
  10928. width: rect.width * scale.x,
  10929. height: rect.height * scale.y,
  10930. x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
  10931. y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
  10932. };
  10933. }
  10934. function getClientRects(element) {
  10935. return Array.from(element.getClientRects());
  10936. }
  10937. function getWindowScrollBarX$1(element) {
  10938. // If <html> has a CSS width greater than the viewport, then this will be
  10939. // incorrect for RTL.
  10940. return getBoundingClientRect$1(getDocumentElement$1(element)).left + getNodeScroll$1(element).scrollLeft;
  10941. }
  10942. // Gets the entire size of the scrollable document area, even extending outside
  10943. // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
  10944. function getDocumentRect$1(element) {
  10945. const html = getDocumentElement$1(element);
  10946. const scroll = getNodeScroll$1(element);
  10947. const body = element.ownerDocument.body;
  10948. const width = max$3(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
  10949. const height = max$3(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
  10950. let x = -scroll.scrollLeft + getWindowScrollBarX$1(element);
  10951. const y = -scroll.scrollTop;
  10952. if (getComputedStyle$2(body).direction === 'rtl') {
  10953. x += max$3(html.clientWidth, body.clientWidth) - width;
  10954. }
  10955. return {
  10956. width,
  10957. height,
  10958. x,
  10959. y
  10960. };
  10961. }
  10962. function getViewportRect$1(element, strategy) {
  10963. const win = getWindow$1(element);
  10964. const html = getDocumentElement$1(element);
  10965. const visualViewport = win.visualViewport;
  10966. let width = html.clientWidth;
  10967. let height = html.clientHeight;
  10968. let x = 0;
  10969. let y = 0;
  10970. if (visualViewport) {
  10971. width = visualViewport.width;
  10972. height = visualViewport.height;
  10973. const visualViewportBased = isWebKit();
  10974. if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
  10975. x = visualViewport.offsetLeft;
  10976. y = visualViewport.offsetTop;
  10977. }
  10978. }
  10979. return {
  10980. width,
  10981. height,
  10982. x,
  10983. y
  10984. };
  10985. }
  10986. // Returns the inner client rect, subtracting scrollbars if present.
  10987. function getInnerBoundingClientRect$1(element, strategy) {
  10988. const clientRect = getBoundingClientRect$1(element, true, strategy === 'fixed');
  10989. const top = clientRect.top + element.clientTop;
  10990. const left = clientRect.left + element.clientLeft;
  10991. const scale = isHTMLElement$1(element) ? getScale(element) : createCoords(1);
  10992. const width = element.clientWidth * scale.x;
  10993. const height = element.clientHeight * scale.y;
  10994. const x = left * scale.x;
  10995. const y = top * scale.y;
  10996. return {
  10997. width,
  10998. height,
  10999. x,
  11000. y
  11001. };
  11002. }
  11003. function getClientRectFromClippingAncestor$1(element, clippingAncestor, strategy) {
  11004. let rect;
  11005. if (clippingAncestor === 'viewport') {
  11006. rect = getViewportRect$1(element, strategy);
  11007. } else if (clippingAncestor === 'document') {
  11008. rect = getDocumentRect$1(getDocumentElement$1(element));
  11009. } else if (isElement$1(clippingAncestor)) {
  11010. rect = getInnerBoundingClientRect$1(clippingAncestor, strategy);
  11011. } else {
  11012. const visualOffsets = getVisualOffsets(element);
  11013. rect = {
  11014. ...clippingAncestor,
  11015. x: clippingAncestor.x - visualOffsets.x,
  11016. y: clippingAncestor.y - visualOffsets.y
  11017. };
  11018. }
  11019. return rectToClientRect$1(rect);
  11020. }
  11021. function hasFixedPositionAncestor(element, stopNode) {
  11022. const parentNode = getParentNode$1(element);
  11023. if (parentNode === stopNode || !isElement$1(parentNode) || isLastTraversableNode(parentNode)) {
  11024. return false;
  11025. }
  11026. return getComputedStyle$2(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
  11027. }
  11028. // A "clipping ancestor" is an `overflow` element with the characteristic of
  11029. // clipping (or hiding) child elements. This returns all clipping ancestors
  11030. // of the given element up the tree.
  11031. function getClippingElementAncestors(element, cache) {
  11032. const cachedResult = cache.get(element);
  11033. if (cachedResult) {
  11034. return cachedResult;
  11035. }
  11036. let result = getOverflowAncestors$1(element, [], false).filter(el => isElement$1(el) && getNodeName$1(el) !== 'body');
  11037. let currentContainingBlockComputedStyle = null;
  11038. const elementIsFixed = getComputedStyle$2(element).position === 'fixed';
  11039. let currentNode = elementIsFixed ? getParentNode$1(element) : element;
  11040. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  11041. while (isElement$1(currentNode) && !isLastTraversableNode(currentNode)) {
  11042. const computedStyle = getComputedStyle$2(currentNode);
  11043. const currentNodeIsContaining = isContainingBlock$1(currentNode);
  11044. if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
  11045. currentContainingBlockComputedStyle = null;
  11046. }
  11047. const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement$1(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
  11048. if (shouldDropCurrentNode) {
  11049. // Drop non-containing blocks.
  11050. result = result.filter(ancestor => ancestor !== currentNode);
  11051. } else {
  11052. // Record last containing block for next iteration.
  11053. currentContainingBlockComputedStyle = computedStyle;
  11054. }
  11055. currentNode = getParentNode$1(currentNode);
  11056. }
  11057. cache.set(element, result);
  11058. return result;
  11059. }
  11060. // Gets the maximum area that the element is visible in due to any number of
  11061. // clipping ancestors.
  11062. function getClippingRect$1(_ref) {
  11063. let {
  11064. element,
  11065. boundary,
  11066. rootBoundary,
  11067. strategy
  11068. } = _ref;
  11069. const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
  11070. const clippingAncestors = [...elementClippingAncestors, rootBoundary];
  11071. const firstClippingAncestor = clippingAncestors[0];
  11072. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  11073. const rect = getClientRectFromClippingAncestor$1(element, clippingAncestor, strategy);
  11074. accRect.top = max$3(rect.top, accRect.top);
  11075. accRect.right = min$3(rect.right, accRect.right);
  11076. accRect.bottom = min$3(rect.bottom, accRect.bottom);
  11077. accRect.left = max$3(rect.left, accRect.left);
  11078. return accRect;
  11079. }, getClientRectFromClippingAncestor$1(element, firstClippingAncestor, strategy));
  11080. return {
  11081. width: clippingRect.right - clippingRect.left,
  11082. height: clippingRect.bottom - clippingRect.top,
  11083. x: clippingRect.left,
  11084. y: clippingRect.top
  11085. };
  11086. }
  11087. function getDimensions$1(element) {
  11088. const {
  11089. width,
  11090. height
  11091. } = getCssDimensions(element);
  11092. return {
  11093. width,
  11094. height
  11095. };
  11096. }
  11097. function getRectRelativeToOffsetParent$1(element, offsetParent, strategy) {
  11098. const isOffsetParentAnElement = isHTMLElement$1(offsetParent);
  11099. const documentElement = getDocumentElement$1(offsetParent);
  11100. const isFixed = strategy === 'fixed';
  11101. const rect = getBoundingClientRect$1(element, true, isFixed, offsetParent);
  11102. let scroll = {
  11103. scrollLeft: 0,
  11104. scrollTop: 0
  11105. };
  11106. const offsets = createCoords(0);
  11107. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  11108. if (getNodeName$1(offsetParent) !== 'body' || isOverflowElement$1(documentElement)) {
  11109. scroll = getNodeScroll$1(offsetParent);
  11110. }
  11111. if (isOffsetParentAnElement) {
  11112. const offsetRect = getBoundingClientRect$1(offsetParent, true, isFixed, offsetParent);
  11113. offsets.x = offsetRect.x + offsetParent.clientLeft;
  11114. offsets.y = offsetRect.y + offsetParent.clientTop;
  11115. } else if (documentElement) {
  11116. offsets.x = getWindowScrollBarX$1(documentElement);
  11117. }
  11118. }
  11119. const x = rect.left + scroll.scrollLeft - offsets.x;
  11120. const y = rect.top + scroll.scrollTop - offsets.y;
  11121. return {
  11122. x,
  11123. y,
  11124. width: rect.width,
  11125. height: rect.height
  11126. };
  11127. }
  11128. function isStaticPositioned(element) {
  11129. return getComputedStyle$2(element).position === 'static';
  11130. }
  11131. function getTrueOffsetParent$1(element, polyfill) {
  11132. if (!isHTMLElement$1(element) || getComputedStyle$2(element).position === 'fixed') {
  11133. return null;
  11134. }
  11135. if (polyfill) {
  11136. return polyfill(element);
  11137. }
  11138. return element.offsetParent;
  11139. }
  11140. // Gets the closest ancestor positioned element. Handles some edge cases,
  11141. // such as table ancestors and cross browser bugs.
  11142. function getOffsetParent$1(element, polyfill) {
  11143. const win = getWindow$1(element);
  11144. if (isTopLayer(element)) {
  11145. return win;
  11146. }
  11147. if (!isHTMLElement$1(element)) {
  11148. let svgOffsetParent = getParentNode$1(element);
  11149. while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
  11150. if (isElement$1(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
  11151. return svgOffsetParent;
  11152. }
  11153. svgOffsetParent = getParentNode$1(svgOffsetParent);
  11154. }
  11155. return win;
  11156. }
  11157. let offsetParent = getTrueOffsetParent$1(element, polyfill);
  11158. while (offsetParent && isTableElement$1(offsetParent) && isStaticPositioned(offsetParent)) {
  11159. offsetParent = getTrueOffsetParent$1(offsetParent, polyfill);
  11160. }
  11161. if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock$1(offsetParent)) {
  11162. return win;
  11163. }
  11164. return offsetParent || getContainingBlock$1(element) || win;
  11165. }
  11166. const getElementRects = async function (data) {
  11167. const getOffsetParentFn = this.getOffsetParent || getOffsetParent$1;
  11168. const getDimensionsFn = this.getDimensions;
  11169. const floatingDimensions = await getDimensionsFn(data.floating);
  11170. return {
  11171. reference: getRectRelativeToOffsetParent$1(data.reference, await getOffsetParentFn(data.floating), data.strategy),
  11172. floating: {
  11173. x: 0,
  11174. y: 0,
  11175. width: floatingDimensions.width,
  11176. height: floatingDimensions.height
  11177. }
  11178. };
  11179. };
  11180. function isRTL$1(element) {
  11181. return getComputedStyle$2(element).direction === 'rtl';
  11182. }
  11183. const platform$1 = {
  11184. convertOffsetParentRelativeRectToViewportRelativeRect: convertOffsetParentRelativeRectToViewportRelativeRect$1,
  11185. getDocumentElement: getDocumentElement$1,
  11186. getClippingRect: getClippingRect$1,
  11187. getOffsetParent: getOffsetParent$1,
  11188. getElementRects,
  11189. getClientRects,
  11190. getDimensions: getDimensions$1,
  11191. getScale,
  11192. isElement: isElement$1,
  11193. isRTL: isRTL$1
  11194. };
  11195. /**
  11196. * Modifies the placement by translating the floating element along the
  11197. * specified axes.
  11198. * A number (shorthand for `mainAxis` or distance), or an axes configuration
  11199. * object may be passed.
  11200. * @see https://floating-ui.com/docs/offset
  11201. */
  11202. offset$1;
  11203. /**
  11204. * Optimizes the visibility of the floating element by choosing the placement
  11205. * that has the most space available automatically, without needing to specify a
  11206. * preferred placement. Alternative to `flip`.
  11207. * @see https://floating-ui.com/docs/autoPlacement
  11208. */
  11209. autoPlacement;
  11210. /**
  11211. * Optimizes the visibility of the floating element by shifting it in order to
  11212. * keep it in view when it will overflow the clipping boundary.
  11213. * @see https://floating-ui.com/docs/shift
  11214. */
  11215. shift$1;
  11216. /**
  11217. * Optimizes the visibility of the floating element by flipping the `placement`
  11218. * in order to keep it in view when the preferred placement(s) will overflow the
  11219. * clipping boundary. Alternative to `autoPlacement`.
  11220. * @see https://floating-ui.com/docs/flip
  11221. */
  11222. flip$1;
  11223. /**
  11224. * Provides data that allows you to change the size of the floating element —
  11225. * for instance, prevent it from overflowing the clipping boundary or match the
  11226. * width of the reference element.
  11227. * @see https://floating-ui.com/docs/size
  11228. */
  11229. size;
  11230. /**
  11231. * Provides data to hide the floating element in applicable situations, such as
  11232. * when it is not in the same clipping context as the reference element.
  11233. * @see https://floating-ui.com/docs/hide
  11234. */
  11235. hide;
  11236. /**
  11237. * Provides data to position an inner element of the floating element so that it
  11238. * appears centered to the reference element.
  11239. * @see https://floating-ui.com/docs/arrow
  11240. */
  11241. const arrow$1 = arrow$2;
  11242. /**
  11243. * Provides improved positioning for inline reference elements that can span
  11244. * over multiple lines, such as hyperlinks or range selections.
  11245. * @see https://floating-ui.com/docs/inline
  11246. */
  11247. inline;
  11248. /**
  11249. * Built-in `limiter` that will stop `shift()` at a certain point.
  11250. */
  11251. limitShift;
  11252. /**
  11253. * Computes the `x` and `y` coordinates that will place the floating element
  11254. * next to a given reference element.
  11255. */
  11256. const computePosition$2 = (reference, floating, options) => {
  11257. // This caches the expensive `getClippingElementAncestors` function so that
  11258. // multiple lifecycle resets re-use the same result. It only lives for a
  11259. // single call. If other functions become expensive, we can add them as well.
  11260. const cache = new Map();
  11261. const mergedOptions = {
  11262. platform: platform$1,
  11263. ...options
  11264. };
  11265. const platformWithCache = {
  11266. ...mergedOptions.platform,
  11267. _c: cache
  11268. };
  11269. return computePosition$3(reference, floating, {
  11270. ...mergedOptions,
  11271. platform: platformWithCache
  11272. });
  11273. };
  11274. const useFloatingProps = buildProps({});
  11275. const unrefReference = (elRef) => {
  11276. if (!isClient)
  11277. return;
  11278. if (!elRef)
  11279. return elRef;
  11280. const unrefEl = unrefElement(elRef);
  11281. if (unrefEl)
  11282. return unrefEl;
  11283. return isRef(elRef) ? unrefEl : elRef;
  11284. };
  11285. const getPositionDataWithUnit = (record, key) => {
  11286. const value = record == null ? void 0 : record[key];
  11287. return isNil(value) ? "" : `${value}px`;
  11288. };
  11289. const useFloating$1 = ({
  11290. middleware,
  11291. placement,
  11292. strategy
  11293. }) => {
  11294. const referenceRef = ref();
  11295. const contentRef = ref();
  11296. const x = ref();
  11297. const y = ref();
  11298. const middlewareData = ref({});
  11299. const states = {
  11300. x,
  11301. y,
  11302. placement,
  11303. strategy,
  11304. middlewareData
  11305. };
  11306. const update = async () => {
  11307. if (!isClient)
  11308. return;
  11309. const referenceEl = unrefReference(referenceRef);
  11310. const contentEl = unrefElement(contentRef);
  11311. if (!referenceEl || !contentEl)
  11312. return;
  11313. const data = await computePosition$2(referenceEl, contentEl, {
  11314. placement: unref(placement),
  11315. strategy: unref(strategy),
  11316. middleware: unref(middleware)
  11317. });
  11318. keysOf(states).forEach((key) => {
  11319. states[key].value = data[key];
  11320. });
  11321. };
  11322. onMounted(() => {
  11323. watchEffect(() => {
  11324. update();
  11325. });
  11326. });
  11327. return {
  11328. ...states,
  11329. update,
  11330. referenceRef,
  11331. contentRef
  11332. };
  11333. };
  11334. const arrowMiddleware = ({
  11335. arrowRef,
  11336. padding
  11337. }) => {
  11338. return {
  11339. name: "arrow",
  11340. options: {
  11341. element: arrowRef,
  11342. padding
  11343. },
  11344. fn(args) {
  11345. const arrowEl = unref(arrowRef);
  11346. if (!arrowEl)
  11347. return {};
  11348. return arrow$1({
  11349. element: arrowEl,
  11350. padding
  11351. }).fn(args);
  11352. }
  11353. };
  11354. };
  11355. function useCursor(input) {
  11356. let selectionInfo;
  11357. function recordCursor() {
  11358. if (input.value == void 0)
  11359. return;
  11360. const { selectionStart, selectionEnd, value } = input.value;
  11361. if (selectionStart == null || selectionEnd == null)
  11362. return;
  11363. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  11364. const afterTxt = value.slice(Math.max(0, selectionEnd));
  11365. selectionInfo = {
  11366. selectionStart,
  11367. selectionEnd,
  11368. value,
  11369. beforeTxt,
  11370. afterTxt
  11371. };
  11372. }
  11373. function setCursor() {
  11374. if (input.value == void 0 || selectionInfo == void 0)
  11375. return;
  11376. const { value } = input.value;
  11377. const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
  11378. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  11379. return;
  11380. let startPos = value.length;
  11381. if (value.endsWith(afterTxt)) {
  11382. startPos = value.length - afterTxt.length;
  11383. } else if (value.startsWith(beforeTxt)) {
  11384. startPos = beforeTxt.length;
  11385. } else {
  11386. const beforeLastChar = beforeTxt[selectionStart - 1];
  11387. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  11388. if (newIndex !== -1) {
  11389. startPos = newIndex + 1;
  11390. }
  11391. }
  11392. input.value.setSelectionRange(startPos, startPos);
  11393. }
  11394. return [recordCursor, setCursor];
  11395. }
  11396. const getOrderedChildren = (vm, childComponentName, children) => {
  11397. const nodes = flattedChildren(vm.subTree).filter((n) => {
  11398. var _a;
  11399. return isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
  11400. });
  11401. const uids = nodes.map((n) => n.component.uid);
  11402. return uids.map((uid) => children[uid]).filter((p) => !!p);
  11403. };
  11404. const useOrderedChildren = (vm, childComponentName) => {
  11405. const children = shallowRef({});
  11406. const orderedChildren = shallowRef([]);
  11407. const nodesMap = /* @__PURE__ */ new WeakMap();
  11408. const addChild = (child) => {
  11409. children.value[child.uid] = child;
  11410. triggerRef(children);
  11411. onMounted(() => {
  11412. const childNode = child.getVnode().el;
  11413. const parentNode = childNode.parentNode;
  11414. if (!nodesMap.has(parentNode)) {
  11415. nodesMap.set(parentNode, []);
  11416. const originalFn = parentNode.insertBefore.bind(parentNode);
  11417. parentNode.insertBefore = (node, anchor) => {
  11418. const shouldSortChildren = nodesMap.get(parentNode).some((el) => node === el || anchor === el);
  11419. if (shouldSortChildren)
  11420. triggerRef(children);
  11421. return originalFn(node, anchor);
  11422. };
  11423. }
  11424. nodesMap.get(parentNode).push(childNode);
  11425. });
  11426. };
  11427. const removeChild = (child) => {
  11428. delete children.value[child.uid];
  11429. triggerRef(children);
  11430. const childNode = child.getVnode().el;
  11431. const parentNode = childNode.parentNode;
  11432. const childNodes = nodesMap.get(parentNode);
  11433. const index = childNodes.indexOf(childNode);
  11434. childNodes.splice(index, 1);
  11435. };
  11436. const sortChildren = () => {
  11437. orderedChildren.value = getOrderedChildren(vm, childComponentName, children.value);
  11438. };
  11439. const IsolatedRenderer = (props) => {
  11440. return props.render();
  11441. };
  11442. const ChildrenSorter = defineComponent({
  11443. setup(_, { slots }) {
  11444. return () => {
  11445. sortChildren();
  11446. return slots.default ? h$1(IsolatedRenderer, {
  11447. render: slots.default
  11448. }) : null;
  11449. };
  11450. }
  11451. });
  11452. return {
  11453. children: orderedChildren,
  11454. addChild,
  11455. removeChild,
  11456. ChildrenSorter
  11457. };
  11458. };
  11459. const useSizeProp = buildProp({
  11460. type: String,
  11461. values: componentSizes,
  11462. required: false
  11463. });
  11464. const useSizeProps = {
  11465. size: useSizeProp
  11466. };
  11467. const SIZE_INJECTION_KEY = Symbol("size");
  11468. const useGlobalSize = () => {
  11469. const injectedSize = inject(SIZE_INJECTION_KEY, {});
  11470. return computed(() => {
  11471. return unref(injectedSize.size) || "";
  11472. });
  11473. };
  11474. function useFocusController(target, {
  11475. disabled,
  11476. beforeFocus,
  11477. afterFocus,
  11478. beforeBlur,
  11479. afterBlur
  11480. } = {}) {
  11481. const instance = getCurrentInstance();
  11482. const { emit } = instance;
  11483. const wrapperRef = shallowRef();
  11484. const isFocused = ref(false);
  11485. const handleFocus = (event) => {
  11486. const cancelFocus = isFunction$1(beforeFocus) ? beforeFocus(event) : false;
  11487. if (unref(disabled) || isFocused.value || cancelFocus)
  11488. return;
  11489. isFocused.value = true;
  11490. emit("focus", event);
  11491. afterFocus == null ? void 0 : afterFocus();
  11492. };
  11493. const handleBlur = (event) => {
  11494. var _a;
  11495. const cancelBlur = isFunction$1(beforeBlur) ? beforeBlur(event) : false;
  11496. if (unref(disabled) || event.relatedTarget && ((_a = wrapperRef.value) == null ? void 0 : _a.contains(event.relatedTarget)) || cancelBlur)
  11497. return;
  11498. isFocused.value = false;
  11499. emit("blur", event);
  11500. afterBlur == null ? void 0 : afterBlur();
  11501. };
  11502. const handleClick = (event) => {
  11503. var _a, _b;
  11504. if (unref(disabled) || isFocusable(event.target) || ((_a = wrapperRef.value) == null ? void 0 : _a.contains(document.activeElement)) && wrapperRef.value !== document.activeElement)
  11505. return;
  11506. (_b = target.value) == null ? void 0 : _b.focus();
  11507. };
  11508. watch([wrapperRef, () => unref(disabled)], ([el, disabled2]) => {
  11509. if (!el)
  11510. return;
  11511. if (disabled2) {
  11512. el.removeAttribute("tabindex");
  11513. } else {
  11514. el.setAttribute("tabindex", "-1");
  11515. }
  11516. });
  11517. useEventListener(wrapperRef, "focus", handleFocus, true);
  11518. useEventListener(wrapperRef, "blur", handleBlur, true);
  11519. useEventListener(wrapperRef, "click", handleClick, true);
  11520. return {
  11521. isFocused,
  11522. wrapperRef,
  11523. handleFocus,
  11524. handleBlur
  11525. };
  11526. }
  11527. function useComposition({
  11528. afterComposition,
  11529. emit
  11530. }) {
  11531. const isComposing = ref(false);
  11532. const handleCompositionStart = (event) => {
  11533. emit == null ? void 0 : emit("compositionstart", event);
  11534. isComposing.value = true;
  11535. };
  11536. const handleCompositionUpdate = (event) => {
  11537. var _a;
  11538. emit == null ? void 0 : emit("compositionupdate", event);
  11539. const text = (_a = event.target) == null ? void 0 : _a.value;
  11540. const lastCharacter = text[text.length - 1] || "";
  11541. isComposing.value = !isKorean(lastCharacter);
  11542. };
  11543. const handleCompositionEnd = (event) => {
  11544. emit == null ? void 0 : emit("compositionend", event);
  11545. if (isComposing.value) {
  11546. isComposing.value = false;
  11547. nextTick(() => afterComposition(event));
  11548. }
  11549. };
  11550. const handleComposition = (event) => {
  11551. event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
  11552. };
  11553. return {
  11554. isComposing,
  11555. handleComposition,
  11556. handleCompositionStart,
  11557. handleCompositionUpdate,
  11558. handleCompositionEnd
  11559. };
  11560. }
  11561. const emptyValuesContextKey = Symbol("emptyValuesContextKey");
  11562. const SCOPE$7 = "use-empty-values";
  11563. const DEFAULT_EMPTY_VALUES = ["", void 0, null];
  11564. const DEFAULT_VALUE_ON_CLEAR = void 0;
  11565. const useEmptyValuesProps = buildProps({
  11566. emptyValues: Array,
  11567. valueOnClear: {
  11568. type: definePropType([
  11569. String,
  11570. Number,
  11571. Boolean,
  11572. Function
  11573. ]),
  11574. default: void 0,
  11575. validator: (val) => {
  11576. val = isFunction$1(val) ? val() : val;
  11577. if (isArray$1(val)) {
  11578. return val.every((item) => !item);
  11579. }
  11580. return !val;
  11581. }
  11582. }
  11583. });
  11584. const useEmptyValues = (props, defaultValue) => {
  11585. const config = getCurrentInstance() ? inject(emptyValuesContextKey, ref({})) : ref({});
  11586. const emptyValues = computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
  11587. const valueOnClear = computed(() => {
  11588. if (isFunction$1(props.valueOnClear)) {
  11589. return props.valueOnClear();
  11590. } else if (props.valueOnClear !== void 0) {
  11591. return props.valueOnClear;
  11592. } else if (isFunction$1(config.value.valueOnClear)) {
  11593. return config.value.valueOnClear();
  11594. } else if (config.value.valueOnClear !== void 0) {
  11595. return config.value.valueOnClear;
  11596. }
  11597. return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
  11598. });
  11599. const isEmptyValue = (value) => {
  11600. let result = true;
  11601. if (isArray$1(value)) {
  11602. result = emptyValues.value.some((emptyValue) => {
  11603. return isEqual$1(value, emptyValue);
  11604. });
  11605. } else {
  11606. result = emptyValues.value.includes(value);
  11607. }
  11608. return result;
  11609. };
  11610. if (!isEmptyValue(valueOnClear.value)) {
  11611. debugWarn(SCOPE$7, "value-on-clear should be a value of empty-values");
  11612. }
  11613. return {
  11614. emptyValues,
  11615. valueOnClear,
  11616. isEmptyValue
  11617. };
  11618. };
  11619. const ariaProps = buildProps({
  11620. ariaLabel: String,
  11621. ariaOrientation: {
  11622. type: String,
  11623. values: ["horizontal", "vertical", "undefined"]
  11624. },
  11625. ariaControls: String
  11626. });
  11627. const useAriaProps = (arias) => {
  11628. return pick(ariaProps, arias);
  11629. };
  11630. const configProviderContextKey = Symbol();
  11631. const globalConfig = ref();
  11632. function useGlobalConfig(key, defaultValue = void 0) {
  11633. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  11634. if (key) {
  11635. return computed(() => {
  11636. var _a, _b;
  11637. return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
  11638. });
  11639. } else {
  11640. return config;
  11641. }
  11642. }
  11643. function useGlobalComponentSettings(block, sizeFallback) {
  11644. const config = useGlobalConfig();
  11645. const ns = useNamespace(block, computed(() => {
  11646. var _a;
  11647. return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace;
  11648. }));
  11649. const locale = useLocale(computed(() => {
  11650. var _a;
  11651. return (_a = config.value) == null ? void 0 : _a.locale;
  11652. }));
  11653. const zIndex = useZIndex(computed(() => {
  11654. var _a;
  11655. return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex;
  11656. }));
  11657. const size = computed(() => {
  11658. var _a;
  11659. return unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || "";
  11660. });
  11661. provideGlobalConfig(computed(() => unref(config) || {}));
  11662. return {
  11663. ns,
  11664. locale,
  11665. zIndex,
  11666. size
  11667. };
  11668. }
  11669. const provideGlobalConfig = (config, app, global = false) => {
  11670. var _a;
  11671. const inSetup = !!getCurrentInstance();
  11672. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  11673. const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? provide : void 0;
  11674. if (!provideFn) {
  11675. debugWarn("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
  11676. return;
  11677. }
  11678. const context = computed(() => {
  11679. const cfg = unref(config);
  11680. if (!(oldConfig == null ? void 0 : oldConfig.value))
  11681. return cfg;
  11682. return mergeConfig(oldConfig.value, cfg);
  11683. });
  11684. provideFn(configProviderContextKey, context);
  11685. provideFn(localeContextKey, computed(() => context.value.locale));
  11686. provideFn(namespaceContextKey, computed(() => context.value.namespace));
  11687. provideFn(zIndexContextKey, computed(() => context.value.zIndex));
  11688. provideFn(SIZE_INJECTION_KEY, {
  11689. size: computed(() => context.value.size || "")
  11690. });
  11691. provideFn(emptyValuesContextKey, computed(() => ({
  11692. emptyValues: context.value.emptyValues,
  11693. valueOnClear: context.value.valueOnClear
  11694. })));
  11695. if (global || !globalConfig.value) {
  11696. globalConfig.value = context.value;
  11697. }
  11698. return context;
  11699. };
  11700. const mergeConfig = (a, b) => {
  11701. const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  11702. const obj = {};
  11703. for (const key of keys) {
  11704. obj[key] = b[key] !== void 0 ? b[key] : a[key];
  11705. }
  11706. return obj;
  11707. };
  11708. const configProviderProps = buildProps({
  11709. a11y: {
  11710. type: Boolean,
  11711. default: true
  11712. },
  11713. locale: {
  11714. type: definePropType(Object)
  11715. },
  11716. size: useSizeProp,
  11717. button: {
  11718. type: definePropType(Object)
  11719. },
  11720. card: {
  11721. type: definePropType(Object)
  11722. },
  11723. dialog: {
  11724. type: definePropType(Object)
  11725. },
  11726. link: {
  11727. type: definePropType(Object)
  11728. },
  11729. experimentalFeatures: {
  11730. type: definePropType(Object)
  11731. },
  11732. keyboardNavigation: {
  11733. type: Boolean,
  11734. default: true
  11735. },
  11736. message: {
  11737. type: definePropType(Object)
  11738. },
  11739. zIndex: Number,
  11740. namespace: {
  11741. type: String,
  11742. default: "el"
  11743. },
  11744. ...useEmptyValuesProps
  11745. });
  11746. const messageConfig = {
  11747. placement: "top"
  11748. };
  11749. const ConfigProvider = defineComponent({
  11750. name: "ElConfigProvider",
  11751. props: configProviderProps,
  11752. setup(props, { slots }) {
  11753. const config = provideGlobalConfig(props);
  11754. watch(() => props.message, (val) => {
  11755. var _a, _b;
  11756. Object.assign(messageConfig, (_b = (_a = config == null ? void 0 : config.value) == null ? void 0 : _a.message) != null ? _b : {}, val != null ? val : {});
  11757. }, { immediate: true, deep: true });
  11758. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  11759. }
  11760. });
  11761. const ElConfigProvider = withInstall(ConfigProvider);
  11762. const version$1 = "2.11.7";
  11763. const makeInstaller = (components = []) => {
  11764. const install = (app, options) => {
  11765. if (app[INSTALLED_KEY])
  11766. return;
  11767. app[INSTALLED_KEY] = true;
  11768. components.forEach((c) => app.use(c));
  11769. if (options)
  11770. provideGlobalConfig(options, app, true);
  11771. };
  11772. return {
  11773. version: version$1,
  11774. install
  11775. };
  11776. };
  11777. const affixProps = buildProps({
  11778. zIndex: {
  11779. type: definePropType([Number, String]),
  11780. default: 100
  11781. },
  11782. target: {
  11783. type: String,
  11784. default: ""
  11785. },
  11786. offset: {
  11787. type: Number,
  11788. default: 0
  11789. },
  11790. position: {
  11791. type: String,
  11792. values: ["top", "bottom"],
  11793. default: "top"
  11794. }
  11795. });
  11796. const affixEmits = {
  11797. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  11798. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  11799. };
  11800. var _export_sfc = (sfc, props) => {
  11801. const target = sfc.__vccOpts || sfc;
  11802. for (const [key, val] of props) {
  11803. target[key] = val;
  11804. }
  11805. return target;
  11806. };
  11807. const COMPONENT_NAME$p = "ElAffix";
  11808. const __default__$1Y = defineComponent({
  11809. name: COMPONENT_NAME$p
  11810. });
  11811. const _sfc_main$2v = /* @__PURE__ */ defineComponent({
  11812. ...__default__$1Y,
  11813. props: affixProps,
  11814. emits: affixEmits,
  11815. setup(__props, { expose, emit }) {
  11816. const props = __props;
  11817. const ns = useNamespace("affix");
  11818. const target = shallowRef();
  11819. const root = shallowRef();
  11820. const scrollContainer = shallowRef();
  11821. const { height: windowHeight } = useWindowSize();
  11822. const {
  11823. height: rootHeight,
  11824. width: rootWidth,
  11825. top: rootTop,
  11826. bottom: rootBottom,
  11827. update: updateRoot
  11828. } = useElementBounding(root, { windowScroll: false });
  11829. const targetRect = useElementBounding(target);
  11830. const fixed = ref(false);
  11831. const scrollTop = ref(0);
  11832. const transform = ref(0);
  11833. const rootStyle = computed(() => {
  11834. return {
  11835. height: fixed.value ? `${rootHeight.value}px` : "",
  11836. width: fixed.value ? `${rootWidth.value}px` : ""
  11837. };
  11838. });
  11839. const affixStyle = computed(() => {
  11840. if (!fixed.value)
  11841. return {};
  11842. const offset = props.offset ? addUnit(props.offset) : 0;
  11843. return {
  11844. height: `${rootHeight.value}px`,
  11845. width: `${rootWidth.value}px`,
  11846. top: props.position === "top" ? offset : "",
  11847. bottom: props.position === "bottom" ? offset : "",
  11848. transform: transform.value ? `translateY(${transform.value}px)` : "",
  11849. zIndex: props.zIndex
  11850. };
  11851. });
  11852. const update = () => {
  11853. if (!scrollContainer.value)
  11854. return;
  11855. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  11856. const { position, target: target2, offset } = props;
  11857. const rootHeightOffset = offset + rootHeight.value;
  11858. if (position === "top") {
  11859. if (target2) {
  11860. const difference = targetRect.bottom.value - rootHeightOffset;
  11861. fixed.value = offset > rootTop.value && targetRect.bottom.value > 0;
  11862. transform.value = difference < 0 ? difference : 0;
  11863. } else {
  11864. fixed.value = offset > rootTop.value;
  11865. }
  11866. } else if (target2) {
  11867. const difference = windowHeight.value - targetRect.top.value - rootHeightOffset;
  11868. fixed.value = windowHeight.value - offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  11869. transform.value = difference < 0 ? -difference : 0;
  11870. } else {
  11871. fixed.value = windowHeight.value - offset < rootBottom.value;
  11872. }
  11873. };
  11874. const updateRootRect = async () => {
  11875. if (!fixed.value) {
  11876. updateRoot();
  11877. return;
  11878. }
  11879. fixed.value = false;
  11880. await nextTick();
  11881. updateRoot();
  11882. fixed.value = true;
  11883. };
  11884. const handleScroll = async () => {
  11885. updateRoot();
  11886. await nextTick();
  11887. emit("scroll", {
  11888. scrollTop: scrollTop.value,
  11889. fixed: fixed.value
  11890. });
  11891. };
  11892. watch(fixed, (val) => emit(CHANGE_EVENT, val));
  11893. onMounted(() => {
  11894. var _a;
  11895. if (props.target) {
  11896. target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  11897. if (!target.value)
  11898. throwError(COMPONENT_NAME$p, `Target does not exist: ${props.target}`);
  11899. } else {
  11900. target.value = document.documentElement;
  11901. }
  11902. scrollContainer.value = getScrollContainer(root.value, true);
  11903. updateRoot();
  11904. });
  11905. useEventListener(scrollContainer, "scroll", handleScroll);
  11906. watchEffect(update);
  11907. expose({
  11908. update,
  11909. updateRoot: updateRootRect
  11910. });
  11911. return (_ctx, _cache) => {
  11912. return openBlock(), createElementBlock("div", {
  11913. ref_key: "root",
  11914. ref: root,
  11915. class: normalizeClass(unref(ns).b()),
  11916. style: normalizeStyle(unref(rootStyle))
  11917. }, [
  11918. createElementVNode("div", {
  11919. class: normalizeClass({ [unref(ns).m("fixed")]: fixed.value }),
  11920. style: normalizeStyle(unref(affixStyle))
  11921. }, [
  11922. renderSlot(_ctx.$slots, "default")
  11923. ], 6)
  11924. ], 6);
  11925. };
  11926. }
  11927. });
  11928. var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2v, [["__file", "affix.vue"]]);
  11929. const ElAffix = withInstall(Affix);
  11930. const iconProps = buildProps({
  11931. size: {
  11932. type: definePropType([Number, String])
  11933. },
  11934. color: {
  11935. type: String
  11936. }
  11937. });
  11938. const __default__$1X = defineComponent({
  11939. name: "ElIcon",
  11940. inheritAttrs: false
  11941. });
  11942. const _sfc_main$2u = /* @__PURE__ */ defineComponent({
  11943. ...__default__$1X,
  11944. props: iconProps,
  11945. setup(__props) {
  11946. const props = __props;
  11947. const ns = useNamespace("icon");
  11948. const style = computed(() => {
  11949. const { size, color } = props;
  11950. if (!size && !color)
  11951. return {};
  11952. return {
  11953. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  11954. "--color": color
  11955. };
  11956. });
  11957. return (_ctx, _cache) => {
  11958. return openBlock(), createElementBlock("i", mergeProps({
  11959. class: unref(ns).b(),
  11960. style: unref(style)
  11961. }, _ctx.$attrs), [
  11962. renderSlot(_ctx.$slots, "default")
  11963. ], 16);
  11964. };
  11965. }
  11966. });
  11967. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2u, [["__file", "icon.vue"]]);
  11968. const ElIcon = withInstall(Icon);
  11969. const alertEffects = ["light", "dark"];
  11970. const alertProps = buildProps({
  11971. title: {
  11972. type: String,
  11973. default: ""
  11974. },
  11975. description: {
  11976. type: String,
  11977. default: ""
  11978. },
  11979. type: {
  11980. type: String,
  11981. values: keysOf(TypeComponentsMap),
  11982. default: "info"
  11983. },
  11984. closable: {
  11985. type: Boolean,
  11986. default: true
  11987. },
  11988. closeText: {
  11989. type: String,
  11990. default: ""
  11991. },
  11992. showIcon: Boolean,
  11993. center: Boolean,
  11994. effect: {
  11995. type: String,
  11996. values: alertEffects,
  11997. default: "light"
  11998. },
  11999. ...useDelayedToggleProps,
  12000. showAfter: Number
  12001. });
  12002. const alertEmits = {
  12003. open: () => true,
  12004. close: (evt) => isUndefined(evt) || evt instanceof Event
  12005. };
  12006. const __default__$1W = defineComponent({
  12007. name: "ElAlert"
  12008. });
  12009. const _sfc_main$2t = /* @__PURE__ */ defineComponent({
  12010. ...__default__$1W,
  12011. props: alertProps,
  12012. emits: alertEmits,
  12013. setup(__props, { emit }) {
  12014. const props = __props;
  12015. const { Close } = TypeComponents;
  12016. const slots = useSlots();
  12017. const ns = useNamespace("alert");
  12018. const visible = ref(isUndefined(props.showAfter));
  12019. const iconComponent = computed(() => TypeComponentsMap[props.type]);
  12020. const hasDesc = computed(() => !!(props.description || slots.default));
  12021. const open = () => {
  12022. visible.value = true;
  12023. emit("open");
  12024. };
  12025. const close = (event) => {
  12026. visible.value = false;
  12027. emit("close", event);
  12028. };
  12029. const { onOpen, onClose } = useDelayedToggle({
  12030. showAfter: toRef(props, "showAfter", 0),
  12031. hideAfter: toRef(props, "hideAfter"),
  12032. autoClose: toRef(props, "autoClose"),
  12033. open,
  12034. close
  12035. });
  12036. if (isClient) {
  12037. onOpen();
  12038. }
  12039. return (_ctx, _cache) => {
  12040. return openBlock(), createBlock(Transition, {
  12041. name: unref(ns).b("fade"),
  12042. persisted: ""
  12043. }, {
  12044. default: withCtx(() => [
  12045. withDirectives(createElementVNode("div", {
  12046. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.type), unref(ns).is("center", _ctx.center), unref(ns).is(_ctx.effect)]),
  12047. role: "alert"
  12048. }, [
  12049. _ctx.showIcon && (_ctx.$slots.icon || unref(iconComponent)) ? (openBlock(), createBlock(unref(ElIcon), {
  12050. key: 0,
  12051. class: normalizeClass([unref(ns).e("icon"), unref(ns).is("big", unref(hasDesc))])
  12052. }, {
  12053. default: withCtx(() => [
  12054. renderSlot(_ctx.$slots, "icon", {}, () => [
  12055. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  12056. ])
  12057. ]),
  12058. _: 3
  12059. }, 8, ["class"])) : createCommentVNode("v-if", true),
  12060. createElementVNode("div", {
  12061. class: normalizeClass(unref(ns).e("content"))
  12062. }, [
  12063. _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", {
  12064. key: 0,
  12065. class: normalizeClass([unref(ns).e("title"), { "with-description": unref(hasDesc) }])
  12066. }, [
  12067. renderSlot(_ctx.$slots, "title", {}, () => [
  12068. createTextVNode(toDisplayString(_ctx.title), 1)
  12069. ])
  12070. ], 2)) : createCommentVNode("v-if", true),
  12071. unref(hasDesc) ? (openBlock(), createElementBlock("p", {
  12072. key: 1,
  12073. class: normalizeClass(unref(ns).e("description"))
  12074. }, [
  12075. renderSlot(_ctx.$slots, "default", {}, () => [
  12076. createTextVNode(toDisplayString(_ctx.description), 1)
  12077. ])
  12078. ], 2)) : createCommentVNode("v-if", true),
  12079. _ctx.closable ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  12080. _ctx.closeText ? (openBlock(), createElementBlock("div", {
  12081. key: 0,
  12082. class: normalizeClass([unref(ns).e("close-btn"), unref(ns).is("customed")]),
  12083. onClick: close
  12084. }, toDisplayString(_ctx.closeText), 3)) : (openBlock(), createBlock(unref(ElIcon), {
  12085. key: 1,
  12086. class: normalizeClass(unref(ns).e("close-btn")),
  12087. onClick: unref(onClose)
  12088. }, {
  12089. default: withCtx(() => [
  12090. createVNode(unref(Close))
  12091. ]),
  12092. _: 1
  12093. }, 8, ["class", "onClick"]))
  12094. ], 64)) : createCommentVNode("v-if", true)
  12095. ], 2)
  12096. ], 2), [
  12097. [vShow, visible.value]
  12098. ])
  12099. ]),
  12100. _: 3
  12101. }, 8, ["name"]);
  12102. };
  12103. }
  12104. });
  12105. var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2t, [["__file", "alert.vue"]]);
  12106. const ElAlert = withInstall(Alert);
  12107. const formContextKey = Symbol("formContextKey");
  12108. const formItemContextKey = Symbol("formItemContextKey");
  12109. const useFormSize = (fallback, ignore = {}) => {
  12110. const emptyRef = ref(void 0);
  12111. const size = ignore.prop ? emptyRef : useProp("size");
  12112. const globalConfig = ignore.global ? emptyRef : useGlobalSize();
  12113. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  12114. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  12115. return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
  12116. };
  12117. const useFormDisabled = (fallback) => {
  12118. const disabled = useProp("disabled");
  12119. const form = inject(formContextKey, void 0);
  12120. return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  12121. };
  12122. const useSize$1 = useFormSize;
  12123. const useDisabled = useFormDisabled;
  12124. const useFormItem = () => {
  12125. const form = inject(formContextKey, void 0);
  12126. const formItem = inject(formItemContextKey, void 0);
  12127. return {
  12128. form,
  12129. formItem
  12130. };
  12131. };
  12132. const useFormItemInputId = (props, {
  12133. formItemContext,
  12134. disableIdGeneration,
  12135. disableIdManagement
  12136. }) => {
  12137. if (!disableIdGeneration) {
  12138. disableIdGeneration = ref(false);
  12139. }
  12140. if (!disableIdManagement) {
  12141. disableIdManagement = ref(false);
  12142. }
  12143. const instance = getCurrentInstance();
  12144. const inLabel = () => {
  12145. let parent = instance == null ? void 0 : instance.parent;
  12146. while (parent) {
  12147. if (parent.type.name === "ElFormItem") {
  12148. return false;
  12149. }
  12150. if (parent.type.name === "ElLabelWrap") {
  12151. return true;
  12152. }
  12153. parent = parent.parent;
  12154. }
  12155. return false;
  12156. };
  12157. const inputId = ref();
  12158. let idUnwatch = void 0;
  12159. const isLabeledByFormItem = computed(() => {
  12160. var _a;
  12161. return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
  12162. });
  12163. onMounted(() => {
  12164. idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  12165. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  12166. if (newId !== inputId.value) {
  12167. if ((formItemContext == null ? void 0 : formItemContext.removeInputId) && !inLabel()) {
  12168. inputId.value && formItemContext.removeInputId(inputId.value);
  12169. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  12170. formItemContext.addInputId(newId);
  12171. }
  12172. }
  12173. inputId.value = newId;
  12174. }
  12175. }, { immediate: true });
  12176. });
  12177. onUnmounted(() => {
  12178. idUnwatch && idUnwatch();
  12179. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  12180. inputId.value && formItemContext.removeInputId(inputId.value);
  12181. }
  12182. });
  12183. return {
  12184. isLabeledByFormItem,
  12185. inputId
  12186. };
  12187. };
  12188. const formMetaProps = buildProps({
  12189. size: {
  12190. type: String,
  12191. values: componentSizes
  12192. },
  12193. disabled: Boolean
  12194. });
  12195. const formProps = buildProps({
  12196. ...formMetaProps,
  12197. model: Object,
  12198. rules: {
  12199. type: definePropType(Object)
  12200. },
  12201. labelPosition: {
  12202. type: String,
  12203. values: ["left", "right", "top"],
  12204. default: "right"
  12205. },
  12206. requireAsteriskPosition: {
  12207. type: String,
  12208. values: ["left", "right"],
  12209. default: "left"
  12210. },
  12211. labelWidth: {
  12212. type: [String, Number],
  12213. default: ""
  12214. },
  12215. labelSuffix: {
  12216. type: String,
  12217. default: ""
  12218. },
  12219. inline: Boolean,
  12220. inlineMessage: Boolean,
  12221. statusIcon: Boolean,
  12222. showMessage: {
  12223. type: Boolean,
  12224. default: true
  12225. },
  12226. validateOnRuleChange: {
  12227. type: Boolean,
  12228. default: true
  12229. },
  12230. hideRequiredAsterisk: Boolean,
  12231. scrollToError: Boolean,
  12232. scrollIntoViewOptions: {
  12233. type: definePropType([Object, Boolean]),
  12234. default: true
  12235. }
  12236. });
  12237. const formEmits = {
  12238. validate: (prop, isValid, message) => (isArray$1(prop) || isString$1(prop)) && isBoolean(isValid) && isString$1(message)
  12239. };
  12240. const SCOPE$6 = "ElForm";
  12241. function useFormLabelWidth() {
  12242. const potentialLabelWidthArr = ref([]);
  12243. const autoLabelWidth = computed(() => {
  12244. if (!potentialLabelWidthArr.value.length)
  12245. return "0";
  12246. const max = Math.max(...potentialLabelWidthArr.value);
  12247. return max ? `${max}px` : "";
  12248. });
  12249. function getLabelWidthIndex(width) {
  12250. const index = potentialLabelWidthArr.value.indexOf(width);
  12251. if (index === -1 && autoLabelWidth.value === "0") {
  12252. debugWarn(SCOPE$6, `unexpected width ${width}`);
  12253. }
  12254. return index;
  12255. }
  12256. function registerLabelWidth(val, oldVal) {
  12257. if (val && oldVal) {
  12258. const index = getLabelWidthIndex(oldVal);
  12259. potentialLabelWidthArr.value.splice(index, 1, val);
  12260. } else if (val) {
  12261. potentialLabelWidthArr.value.push(val);
  12262. }
  12263. }
  12264. function deregisterLabelWidth(val) {
  12265. const index = getLabelWidthIndex(val);
  12266. if (index > -1) {
  12267. potentialLabelWidthArr.value.splice(index, 1);
  12268. }
  12269. }
  12270. return {
  12271. autoLabelWidth,
  12272. registerLabelWidth,
  12273. deregisterLabelWidth
  12274. };
  12275. }
  12276. const filterFields = (fields, props) => {
  12277. const normalized = castArray$1(props).map((prop) => isArray$1(prop) ? prop.join(".") : prop);
  12278. return normalized.length > 0 ? fields.filter((field) => field.propString && normalized.includes(field.propString)) : fields;
  12279. };
  12280. const COMPONENT_NAME$o = "ElForm";
  12281. const __default__$1V = defineComponent({
  12282. name: COMPONENT_NAME$o
  12283. });
  12284. const _sfc_main$2s = /* @__PURE__ */ defineComponent({
  12285. ...__default__$1V,
  12286. props: formProps,
  12287. emits: formEmits,
  12288. setup(__props, { expose, emit }) {
  12289. const props = __props;
  12290. const formRef = ref();
  12291. const fields = reactive([]);
  12292. const formSize = useFormSize();
  12293. const ns = useNamespace("form");
  12294. const formClasses = computed(() => {
  12295. const { labelPosition, inline } = props;
  12296. return [
  12297. ns.b(),
  12298. ns.m(formSize.value || "default"),
  12299. {
  12300. [ns.m(`label-${labelPosition}`)]: labelPosition,
  12301. [ns.m("inline")]: inline
  12302. }
  12303. ];
  12304. });
  12305. const getField = (prop) => {
  12306. return filterFields(fields, [prop])[0];
  12307. };
  12308. const addField = (field) => {
  12309. fields.push(field);
  12310. };
  12311. const removeField = (field) => {
  12312. if (field.prop) {
  12313. fields.splice(fields.indexOf(field), 1);
  12314. }
  12315. };
  12316. const resetFields = (properties = []) => {
  12317. if (!props.model) {
  12318. debugWarn(COMPONENT_NAME$o, "model is required for resetFields to work.");
  12319. return;
  12320. }
  12321. filterFields(fields, properties).forEach((field) => field.resetField());
  12322. };
  12323. const clearValidate = (props2 = []) => {
  12324. filterFields(fields, props2).forEach((field) => field.clearValidate());
  12325. };
  12326. const isValidatable = computed(() => {
  12327. const hasModel = !!props.model;
  12328. if (!hasModel) {
  12329. debugWarn(COMPONENT_NAME$o, "model is required for validate to work.");
  12330. }
  12331. return hasModel;
  12332. });
  12333. const obtainValidateFields = (props2) => {
  12334. if (fields.length === 0)
  12335. return [];
  12336. const filteredFields = filterFields(fields, props2);
  12337. if (!filteredFields.length) {
  12338. debugWarn(COMPONENT_NAME$o, "please pass correct props!");
  12339. return [];
  12340. }
  12341. return filteredFields;
  12342. };
  12343. const validate = async (callback) => validateField(void 0, callback);
  12344. const doValidateField = async (props2 = []) => {
  12345. if (!isValidatable.value)
  12346. return false;
  12347. const fields2 = obtainValidateFields(props2);
  12348. if (fields2.length === 0)
  12349. return true;
  12350. let validationErrors = {};
  12351. for (const field of fields2) {
  12352. try {
  12353. await field.validate("");
  12354. if (field.validateState === "error" && !field.error)
  12355. field.resetField();
  12356. } catch (fields3) {
  12357. validationErrors = {
  12358. ...validationErrors,
  12359. ...fields3
  12360. };
  12361. }
  12362. }
  12363. if (Object.keys(validationErrors).length === 0)
  12364. return true;
  12365. return Promise.reject(validationErrors);
  12366. };
  12367. const validateField = async (modelProps = [], callback) => {
  12368. let result = false;
  12369. const shouldThrow = !isFunction$1(callback);
  12370. try {
  12371. result = await doValidateField(modelProps);
  12372. if (result === true) {
  12373. await (callback == null ? void 0 : callback(result));
  12374. }
  12375. return result;
  12376. } catch (e) {
  12377. if (e instanceof Error)
  12378. throw e;
  12379. const invalidFields = e;
  12380. if (props.scrollToError) {
  12381. if (formRef.value) {
  12382. const formItem = formRef.value.querySelector(`.${ns.b()}-item.is-error`);
  12383. formItem == null ? void 0 : formItem.scrollIntoView(props.scrollIntoViewOptions);
  12384. }
  12385. }
  12386. !result && await (callback == null ? void 0 : callback(false, invalidFields));
  12387. return shouldThrow && Promise.reject(invalidFields);
  12388. }
  12389. };
  12390. const scrollToField = (prop) => {
  12391. var _a;
  12392. const field = getField(prop);
  12393. if (field) {
  12394. (_a = field.$el) == null ? void 0 : _a.scrollIntoView(props.scrollIntoViewOptions);
  12395. }
  12396. };
  12397. watch(() => props.rules, () => {
  12398. if (props.validateOnRuleChange) {
  12399. validate().catch((err) => debugWarn(err));
  12400. }
  12401. }, { deep: true, flush: "post" });
  12402. provide(formContextKey, reactive({
  12403. ...toRefs(props),
  12404. emit,
  12405. resetFields,
  12406. clearValidate,
  12407. validateField,
  12408. getField,
  12409. addField,
  12410. removeField,
  12411. ...useFormLabelWidth()
  12412. }));
  12413. expose({
  12414. validate,
  12415. validateField,
  12416. resetFields,
  12417. clearValidate,
  12418. scrollToField,
  12419. getField,
  12420. fields
  12421. });
  12422. return (_ctx, _cache) => {
  12423. return openBlock(), createElementBlock("form", {
  12424. ref_key: "formRef",
  12425. ref: formRef,
  12426. class: normalizeClass(unref(formClasses))
  12427. }, [
  12428. renderSlot(_ctx.$slots, "default")
  12429. ], 2);
  12430. };
  12431. }
  12432. });
  12433. var Form = /* @__PURE__ */ _export_sfc(_sfc_main$2s, [["__file", "form.vue"]]);
  12434. function _extends() {
  12435. _extends = Object.assign ? Object.assign.bind() : function(target) {
  12436. for (var i = 1; i < arguments.length; i++) {
  12437. var source = arguments[i];
  12438. for (var key in source) {
  12439. if (Object.prototype.hasOwnProperty.call(source, key)) {
  12440. target[key] = source[key];
  12441. }
  12442. }
  12443. }
  12444. return target;
  12445. };
  12446. return _extends.apply(this, arguments);
  12447. }
  12448. function _inheritsLoose(subClass, superClass) {
  12449. subClass.prototype = Object.create(superClass.prototype);
  12450. subClass.prototype.constructor = subClass;
  12451. _setPrototypeOf(subClass, superClass);
  12452. }
  12453. function _getPrototypeOf(o) {
  12454. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  12455. return o2.__proto__ || Object.getPrototypeOf(o2);
  12456. };
  12457. return _getPrototypeOf(o);
  12458. }
  12459. function _setPrototypeOf(o, p) {
  12460. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  12461. o2.__proto__ = p2;
  12462. return o2;
  12463. };
  12464. return _setPrototypeOf(o, p);
  12465. }
  12466. function _isNativeReflectConstruct() {
  12467. if (typeof Reflect === "undefined" || !Reflect.construct)
  12468. return false;
  12469. if (Reflect.construct.sham)
  12470. return false;
  12471. if (typeof Proxy === "function")
  12472. return true;
  12473. try {
  12474. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  12475. }));
  12476. return true;
  12477. } catch (e) {
  12478. return false;
  12479. }
  12480. }
  12481. function _construct(Parent, args, Class) {
  12482. if (_isNativeReflectConstruct()) {
  12483. _construct = Reflect.construct.bind();
  12484. } else {
  12485. _construct = function _construct2(Parent2, args2, Class2) {
  12486. var a = [null];
  12487. a.push.apply(a, args2);
  12488. var Constructor = Function.bind.apply(Parent2, a);
  12489. var instance = new Constructor();
  12490. if (Class2)
  12491. _setPrototypeOf(instance, Class2.prototype);
  12492. return instance;
  12493. };
  12494. }
  12495. return _construct.apply(null, arguments);
  12496. }
  12497. function _isNativeFunction(fn) {
  12498. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  12499. }
  12500. function _wrapNativeSuper(Class) {
  12501. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  12502. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  12503. if (Class2 === null || !_isNativeFunction(Class2))
  12504. return Class2;
  12505. if (typeof Class2 !== "function") {
  12506. throw new TypeError("Super expression must either be null or a function");
  12507. }
  12508. if (typeof _cache !== "undefined") {
  12509. if (_cache.has(Class2))
  12510. return _cache.get(Class2);
  12511. _cache.set(Class2, Wrapper);
  12512. }
  12513. function Wrapper() {
  12514. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  12515. }
  12516. Wrapper.prototype = Object.create(Class2.prototype, {
  12517. constructor: {
  12518. value: Wrapper,
  12519. enumerable: false,
  12520. writable: true,
  12521. configurable: true
  12522. }
  12523. });
  12524. return _setPrototypeOf(Wrapper, Class2);
  12525. };
  12526. return _wrapNativeSuper(Class);
  12527. }
  12528. var formatRegExp = /%[sdj%]/g;
  12529. var warning = function warning2() {
  12530. };
  12531. if (typeof process !== "undefined" && process.env && false) {
  12532. warning = function warning3(type4, errors) {
  12533. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  12534. if (errors.every(function(e) {
  12535. return typeof e === "string";
  12536. })) {
  12537. console.warn(type4, errors);
  12538. }
  12539. }
  12540. };
  12541. }
  12542. function convertFieldsError(errors) {
  12543. if (!errors || !errors.length)
  12544. return null;
  12545. var fields = {};
  12546. errors.forEach(function(error) {
  12547. var field = error.field;
  12548. fields[field] = fields[field] || [];
  12549. fields[field].push(error);
  12550. });
  12551. return fields;
  12552. }
  12553. function format(template) {
  12554. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  12555. args[_key - 1] = arguments[_key];
  12556. }
  12557. var i = 0;
  12558. var len = args.length;
  12559. if (typeof template === "function") {
  12560. return template.apply(null, args);
  12561. }
  12562. if (typeof template === "string") {
  12563. var str = template.replace(formatRegExp, function(x) {
  12564. if (x === "%%") {
  12565. return "%";
  12566. }
  12567. if (i >= len) {
  12568. return x;
  12569. }
  12570. switch (x) {
  12571. case "%s":
  12572. return String(args[i++]);
  12573. case "%d":
  12574. return Number(args[i++]);
  12575. case "%j":
  12576. try {
  12577. return JSON.stringify(args[i++]);
  12578. } catch (_) {
  12579. return "[Circular]";
  12580. }
  12581. break;
  12582. default:
  12583. return x;
  12584. }
  12585. });
  12586. return str;
  12587. }
  12588. return template;
  12589. }
  12590. function isNativeStringType(type4) {
  12591. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  12592. }
  12593. function isEmptyValue(value, type4) {
  12594. if (value === void 0 || value === null) {
  12595. return true;
  12596. }
  12597. if (type4 === "array" && Array.isArray(value) && !value.length) {
  12598. return true;
  12599. }
  12600. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  12601. return true;
  12602. }
  12603. return false;
  12604. }
  12605. function asyncParallelArray(arr, func, callback) {
  12606. var results = [];
  12607. var total = 0;
  12608. var arrLength = arr.length;
  12609. function count(errors) {
  12610. results.push.apply(results, errors || []);
  12611. total++;
  12612. if (total === arrLength) {
  12613. callback(results);
  12614. }
  12615. }
  12616. arr.forEach(function(a) {
  12617. func(a, count);
  12618. });
  12619. }
  12620. function asyncSerialArray(arr, func, callback) {
  12621. var index = 0;
  12622. var arrLength = arr.length;
  12623. function next(errors) {
  12624. if (errors && errors.length) {
  12625. callback(errors);
  12626. return;
  12627. }
  12628. var original = index;
  12629. index = index + 1;
  12630. if (original < arrLength) {
  12631. func(arr[original], next);
  12632. } else {
  12633. callback([]);
  12634. }
  12635. }
  12636. next([]);
  12637. }
  12638. function flattenObjArr(objArr) {
  12639. var ret = [];
  12640. Object.keys(objArr).forEach(function(k) {
  12641. ret.push.apply(ret, objArr[k] || []);
  12642. });
  12643. return ret;
  12644. }
  12645. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  12646. _inheritsLoose(AsyncValidationError2, _Error);
  12647. function AsyncValidationError2(errors, fields) {
  12648. var _this;
  12649. _this = _Error.call(this, "Async Validation Error") || this;
  12650. _this.errors = errors;
  12651. _this.fields = fields;
  12652. return _this;
  12653. }
  12654. return AsyncValidationError2;
  12655. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  12656. function asyncMap(objArr, option, func, callback, source) {
  12657. if (option.first) {
  12658. var _pending = new Promise(function(resolve, reject) {
  12659. var next = function next2(errors) {
  12660. callback(errors);
  12661. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  12662. };
  12663. var flattenArr = flattenObjArr(objArr);
  12664. asyncSerialArray(flattenArr, func, next);
  12665. });
  12666. _pending["catch"](function(e) {
  12667. return e;
  12668. });
  12669. return _pending;
  12670. }
  12671. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  12672. var objArrKeys = Object.keys(objArr);
  12673. var objArrLength = objArrKeys.length;
  12674. var total = 0;
  12675. var results = [];
  12676. var pending = new Promise(function(resolve, reject) {
  12677. var next = function next2(errors) {
  12678. results.push.apply(results, errors);
  12679. total++;
  12680. if (total === objArrLength) {
  12681. callback(results);
  12682. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  12683. }
  12684. };
  12685. if (!objArrKeys.length) {
  12686. callback(results);
  12687. resolve(source);
  12688. }
  12689. objArrKeys.forEach(function(key) {
  12690. var arr = objArr[key];
  12691. if (firstFields.indexOf(key) !== -1) {
  12692. asyncSerialArray(arr, func, next);
  12693. } else {
  12694. asyncParallelArray(arr, func, next);
  12695. }
  12696. });
  12697. });
  12698. pending["catch"](function(e) {
  12699. return e;
  12700. });
  12701. return pending;
  12702. }
  12703. function isErrorObj(obj) {
  12704. return !!(obj && obj.message !== void 0);
  12705. }
  12706. function getValue(value, path) {
  12707. var v = value;
  12708. for (var i = 0; i < path.length; i++) {
  12709. if (v == void 0) {
  12710. return v;
  12711. }
  12712. v = v[path[i]];
  12713. }
  12714. return v;
  12715. }
  12716. function complementError(rule, source) {
  12717. return function(oe) {
  12718. var fieldValue;
  12719. if (rule.fullFields) {
  12720. fieldValue = getValue(source, rule.fullFields);
  12721. } else {
  12722. fieldValue = source[oe.field || rule.fullField];
  12723. }
  12724. if (isErrorObj(oe)) {
  12725. oe.field = oe.field || rule.fullField;
  12726. oe.fieldValue = fieldValue;
  12727. return oe;
  12728. }
  12729. return {
  12730. message: typeof oe === "function" ? oe() : oe,
  12731. fieldValue,
  12732. field: oe.field || rule.fullField
  12733. };
  12734. };
  12735. }
  12736. function deepMerge(target, source) {
  12737. if (source) {
  12738. for (var s in source) {
  12739. if (source.hasOwnProperty(s)) {
  12740. var value = source[s];
  12741. if (typeof value === "object" && typeof target[s] === "object") {
  12742. target[s] = _extends({}, target[s], value);
  12743. } else {
  12744. target[s] = value;
  12745. }
  12746. }
  12747. }
  12748. }
  12749. return target;
  12750. }
  12751. var required$1 = function required(rule, value, source, errors, options, type4) {
  12752. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  12753. errors.push(format(options.messages.required, rule.fullField));
  12754. }
  12755. };
  12756. var whitespace = function whitespace2(rule, value, source, errors, options) {
  12757. if (/^\s+$/.test(value) || value === "") {
  12758. errors.push(format(options.messages.whitespace, rule.fullField));
  12759. }
  12760. };
  12761. var urlReg;
  12762. var getUrlRegex = function() {
  12763. if (urlReg) {
  12764. return urlReg;
  12765. }
  12766. var word = "[a-fA-F\\d:]";
  12767. var b = function b2(options) {
  12768. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  12769. };
  12770. 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}";
  12771. var v6seg = "[a-fA-F\\d]{1,4}";
  12772. 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();
  12773. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  12774. var v4exact = new RegExp("^" + v4 + "$");
  12775. var v6exact = new RegExp("^" + v6 + "$");
  12776. var ip = function ip2(options) {
  12777. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  12778. };
  12779. ip.v4 = function(options) {
  12780. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  12781. };
  12782. ip.v6 = function(options) {
  12783. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  12784. };
  12785. var protocol = "(?:(?:[a-z]+:)?//)";
  12786. var auth = "(?:\\S+(?::\\S*)?@)?";
  12787. var ipv4 = ip.v4().source;
  12788. var ipv6 = ip.v6().source;
  12789. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  12790. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  12791. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  12792. var port = "(?::\\d{2,5})?";
  12793. var path = '(?:[/?#][^\\s"]*)?';
  12794. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  12795. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  12796. return urlReg;
  12797. };
  12798. var pattern$2 = {
  12799. 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,}))$/,
  12800. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  12801. };
  12802. var types = {
  12803. integer: function integer(value) {
  12804. return types.number(value) && parseInt(value, 10) === value;
  12805. },
  12806. "float": function float(value) {
  12807. return types.number(value) && !types.integer(value);
  12808. },
  12809. array: function array(value) {
  12810. return Array.isArray(value);
  12811. },
  12812. regexp: function regexp(value) {
  12813. if (value instanceof RegExp) {
  12814. return true;
  12815. }
  12816. try {
  12817. return !!new RegExp(value);
  12818. } catch (e) {
  12819. return false;
  12820. }
  12821. },
  12822. date: function date(value) {
  12823. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  12824. },
  12825. number: function number(value) {
  12826. if (isNaN(value)) {
  12827. return false;
  12828. }
  12829. return typeof value === "number";
  12830. },
  12831. object: function object(value) {
  12832. return typeof value === "object" && !types.array(value);
  12833. },
  12834. method: function method(value) {
  12835. return typeof value === "function";
  12836. },
  12837. email: function email(value) {
  12838. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  12839. },
  12840. url: function url(value) {
  12841. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  12842. },
  12843. hex: function hex(value) {
  12844. return typeof value === "string" && !!value.match(pattern$2.hex);
  12845. }
  12846. };
  12847. var type$1 = function type(rule, value, source, errors, options) {
  12848. if (rule.required && value === void 0) {
  12849. required$1(rule, value, source, errors, options);
  12850. return;
  12851. }
  12852. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  12853. var ruleType = rule.type;
  12854. if (custom.indexOf(ruleType) > -1) {
  12855. if (!types[ruleType](value)) {
  12856. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  12857. }
  12858. } else if (ruleType && typeof value !== rule.type) {
  12859. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  12860. }
  12861. };
  12862. var range = function range2(rule, value, source, errors, options) {
  12863. var len = typeof rule.len === "number";
  12864. var min = typeof rule.min === "number";
  12865. var max = typeof rule.max === "number";
  12866. var val = value;
  12867. var key = null;
  12868. var num = typeof value === "number";
  12869. var str = typeof value === "string";
  12870. var arr = Array.isArray(value);
  12871. if (num) {
  12872. key = "number";
  12873. } else if (str) {
  12874. key = "string";
  12875. } else if (arr) {
  12876. key = "array";
  12877. }
  12878. if (!key) {
  12879. return false;
  12880. }
  12881. if (arr) {
  12882. val = value.length;
  12883. }
  12884. if (str) {
  12885. val = value.length;
  12886. }
  12887. if (len) {
  12888. if (val !== rule.len) {
  12889. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  12890. }
  12891. } else if (min && !max && val < rule.min) {
  12892. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  12893. } else if (max && !min && val > rule.max) {
  12894. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  12895. } else if (min && max && (val < rule.min || val > rule.max)) {
  12896. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  12897. }
  12898. };
  12899. var ENUM$1 = "enum";
  12900. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  12901. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  12902. if (rule[ENUM$1].indexOf(value) === -1) {
  12903. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  12904. }
  12905. };
  12906. var pattern$1 = function pattern(rule, value, source, errors, options) {
  12907. if (rule.pattern) {
  12908. if (rule.pattern instanceof RegExp) {
  12909. rule.pattern.lastIndex = 0;
  12910. if (!rule.pattern.test(value)) {
  12911. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  12912. }
  12913. } else if (typeof rule.pattern === "string") {
  12914. var _pattern = new RegExp(rule.pattern);
  12915. if (!_pattern.test(value)) {
  12916. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  12917. }
  12918. }
  12919. }
  12920. };
  12921. var rules = {
  12922. required: required$1,
  12923. whitespace,
  12924. type: type$1,
  12925. range,
  12926. "enum": enumerable$1,
  12927. pattern: pattern$1
  12928. };
  12929. var string = function string2(rule, value, callback, source, options) {
  12930. var errors = [];
  12931. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12932. if (validate) {
  12933. if (isEmptyValue(value, "string") && !rule.required) {
  12934. return callback();
  12935. }
  12936. rules.required(rule, value, source, errors, options, "string");
  12937. if (!isEmptyValue(value, "string")) {
  12938. rules.type(rule, value, source, errors, options);
  12939. rules.range(rule, value, source, errors, options);
  12940. rules.pattern(rule, value, source, errors, options);
  12941. if (rule.whitespace === true) {
  12942. rules.whitespace(rule, value, source, errors, options);
  12943. }
  12944. }
  12945. }
  12946. callback(errors);
  12947. };
  12948. var method2 = function method3(rule, value, callback, source, options) {
  12949. var errors = [];
  12950. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12951. if (validate) {
  12952. if (isEmptyValue(value) && !rule.required) {
  12953. return callback();
  12954. }
  12955. rules.required(rule, value, source, errors, options);
  12956. if (value !== void 0) {
  12957. rules.type(rule, value, source, errors, options);
  12958. }
  12959. }
  12960. callback(errors);
  12961. };
  12962. var number2 = function number3(rule, value, callback, source, options) {
  12963. var errors = [];
  12964. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12965. if (validate) {
  12966. if (value === "") {
  12967. value = void 0;
  12968. }
  12969. if (isEmptyValue(value) && !rule.required) {
  12970. return callback();
  12971. }
  12972. rules.required(rule, value, source, errors, options);
  12973. if (value !== void 0) {
  12974. rules.type(rule, value, source, errors, options);
  12975. rules.range(rule, value, source, errors, options);
  12976. }
  12977. }
  12978. callback(errors);
  12979. };
  12980. var _boolean = function _boolean2(rule, value, callback, source, options) {
  12981. var errors = [];
  12982. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12983. if (validate) {
  12984. if (isEmptyValue(value) && !rule.required) {
  12985. return callback();
  12986. }
  12987. rules.required(rule, value, source, errors, options);
  12988. if (value !== void 0) {
  12989. rules.type(rule, value, source, errors, options);
  12990. }
  12991. }
  12992. callback(errors);
  12993. };
  12994. var regexp2 = function regexp3(rule, value, callback, source, options) {
  12995. var errors = [];
  12996. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12997. if (validate) {
  12998. if (isEmptyValue(value) && !rule.required) {
  12999. return callback();
  13000. }
  13001. rules.required(rule, value, source, errors, options);
  13002. if (!isEmptyValue(value)) {
  13003. rules.type(rule, value, source, errors, options);
  13004. }
  13005. }
  13006. callback(errors);
  13007. };
  13008. var integer2 = function integer3(rule, value, callback, source, options) {
  13009. var errors = [];
  13010. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13011. if (validate) {
  13012. if (isEmptyValue(value) && !rule.required) {
  13013. return callback();
  13014. }
  13015. rules.required(rule, value, source, errors, options);
  13016. if (value !== void 0) {
  13017. rules.type(rule, value, source, errors, options);
  13018. rules.range(rule, value, source, errors, options);
  13019. }
  13020. }
  13021. callback(errors);
  13022. };
  13023. var floatFn = function floatFn2(rule, value, callback, source, options) {
  13024. var errors = [];
  13025. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13026. if (validate) {
  13027. if (isEmptyValue(value) && !rule.required) {
  13028. return callback();
  13029. }
  13030. rules.required(rule, value, source, errors, options);
  13031. if (value !== void 0) {
  13032. rules.type(rule, value, source, errors, options);
  13033. rules.range(rule, value, source, errors, options);
  13034. }
  13035. }
  13036. callback(errors);
  13037. };
  13038. var array2 = function array3(rule, value, callback, source, options) {
  13039. var errors = [];
  13040. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13041. if (validate) {
  13042. if ((value === void 0 || value === null) && !rule.required) {
  13043. return callback();
  13044. }
  13045. rules.required(rule, value, source, errors, options, "array");
  13046. if (value !== void 0 && value !== null) {
  13047. rules.type(rule, value, source, errors, options);
  13048. rules.range(rule, value, source, errors, options);
  13049. }
  13050. }
  13051. callback(errors);
  13052. };
  13053. var object2 = function object3(rule, value, callback, source, options) {
  13054. var errors = [];
  13055. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13056. if (validate) {
  13057. if (isEmptyValue(value) && !rule.required) {
  13058. return callback();
  13059. }
  13060. rules.required(rule, value, source, errors, options);
  13061. if (value !== void 0) {
  13062. rules.type(rule, value, source, errors, options);
  13063. }
  13064. }
  13065. callback(errors);
  13066. };
  13067. var ENUM = "enum";
  13068. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  13069. var errors = [];
  13070. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13071. if (validate) {
  13072. if (isEmptyValue(value) && !rule.required) {
  13073. return callback();
  13074. }
  13075. rules.required(rule, value, source, errors, options);
  13076. if (value !== void 0) {
  13077. rules[ENUM](rule, value, source, errors, options);
  13078. }
  13079. }
  13080. callback(errors);
  13081. };
  13082. var pattern2 = function pattern3(rule, value, callback, source, options) {
  13083. var errors = [];
  13084. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13085. if (validate) {
  13086. if (isEmptyValue(value, "string") && !rule.required) {
  13087. return callback();
  13088. }
  13089. rules.required(rule, value, source, errors, options);
  13090. if (!isEmptyValue(value, "string")) {
  13091. rules.pattern(rule, value, source, errors, options);
  13092. }
  13093. }
  13094. callback(errors);
  13095. };
  13096. var date2 = function date3(rule, value, callback, source, options) {
  13097. var errors = [];
  13098. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13099. if (validate) {
  13100. if (isEmptyValue(value, "date") && !rule.required) {
  13101. return callback();
  13102. }
  13103. rules.required(rule, value, source, errors, options);
  13104. if (!isEmptyValue(value, "date")) {
  13105. var dateObject;
  13106. if (value instanceof Date) {
  13107. dateObject = value;
  13108. } else {
  13109. dateObject = new Date(value);
  13110. }
  13111. rules.type(rule, dateObject, source, errors, options);
  13112. if (dateObject) {
  13113. rules.range(rule, dateObject.getTime(), source, errors, options);
  13114. }
  13115. }
  13116. }
  13117. callback(errors);
  13118. };
  13119. var required2 = function required3(rule, value, callback, source, options) {
  13120. var errors = [];
  13121. var type4 = Array.isArray(value) ? "array" : typeof value;
  13122. rules.required(rule, value, source, errors, options, type4);
  13123. callback(errors);
  13124. };
  13125. var type2 = function type3(rule, value, callback, source, options) {
  13126. var ruleType = rule.type;
  13127. var errors = [];
  13128. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13129. if (validate) {
  13130. if (isEmptyValue(value, ruleType) && !rule.required) {
  13131. return callback();
  13132. }
  13133. rules.required(rule, value, source, errors, options, ruleType);
  13134. if (!isEmptyValue(value, ruleType)) {
  13135. rules.type(rule, value, source, errors, options);
  13136. }
  13137. }
  13138. callback(errors);
  13139. };
  13140. var any = function any2(rule, value, callback, source, options) {
  13141. var errors = [];
  13142. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13143. if (validate) {
  13144. if (isEmptyValue(value) && !rule.required) {
  13145. return callback();
  13146. }
  13147. rules.required(rule, value, source, errors, options);
  13148. }
  13149. callback(errors);
  13150. };
  13151. var validators = {
  13152. string,
  13153. method: method2,
  13154. number: number2,
  13155. "boolean": _boolean,
  13156. regexp: regexp2,
  13157. integer: integer2,
  13158. "float": floatFn,
  13159. array: array2,
  13160. object: object2,
  13161. "enum": enumerable2,
  13162. pattern: pattern2,
  13163. date: date2,
  13164. url: type2,
  13165. hex: type2,
  13166. email: type2,
  13167. required: required2,
  13168. any
  13169. };
  13170. function newMessages() {
  13171. return {
  13172. "default": "Validation error on field %s",
  13173. required: "%s is required",
  13174. "enum": "%s must be one of %s",
  13175. whitespace: "%s cannot be empty",
  13176. date: {
  13177. format: "%s date %s is invalid for format %s",
  13178. parse: "%s date could not be parsed, %s is invalid ",
  13179. invalid: "%s date %s is invalid"
  13180. },
  13181. types: {
  13182. string: "%s is not a %s",
  13183. method: "%s is not a %s (function)",
  13184. array: "%s is not an %s",
  13185. object: "%s is not an %s",
  13186. number: "%s is not a %s",
  13187. date: "%s is not a %s",
  13188. "boolean": "%s is not a %s",
  13189. integer: "%s is not an %s",
  13190. "float": "%s is not a %s",
  13191. regexp: "%s is not a valid %s",
  13192. email: "%s is not a valid %s",
  13193. url: "%s is not a valid %s",
  13194. hex: "%s is not a valid %s"
  13195. },
  13196. string: {
  13197. len: "%s must be exactly %s characters",
  13198. min: "%s must be at least %s characters",
  13199. max: "%s cannot be longer than %s characters",
  13200. range: "%s must be between %s and %s characters"
  13201. },
  13202. number: {
  13203. len: "%s must equal %s",
  13204. min: "%s cannot be less than %s",
  13205. max: "%s cannot be greater than %s",
  13206. range: "%s must be between %s and %s"
  13207. },
  13208. array: {
  13209. len: "%s must be exactly %s in length",
  13210. min: "%s cannot be less than %s in length",
  13211. max: "%s cannot be greater than %s in length",
  13212. range: "%s must be between %s and %s in length"
  13213. },
  13214. pattern: {
  13215. mismatch: "%s value %s does not match pattern %s"
  13216. },
  13217. clone: function clone() {
  13218. var cloned = JSON.parse(JSON.stringify(this));
  13219. cloned.clone = this.clone;
  13220. return cloned;
  13221. }
  13222. };
  13223. }
  13224. var messages = newMessages();
  13225. var Schema = /* @__PURE__ */ function() {
  13226. function Schema2(descriptor) {
  13227. this.rules = null;
  13228. this._messages = messages;
  13229. this.define(descriptor);
  13230. }
  13231. var _proto = Schema2.prototype;
  13232. _proto.define = function define(rules2) {
  13233. var _this = this;
  13234. if (!rules2) {
  13235. throw new Error("Cannot configure a schema with no rules");
  13236. }
  13237. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  13238. throw new Error("Rules must be an object");
  13239. }
  13240. this.rules = {};
  13241. Object.keys(rules2).forEach(function(name) {
  13242. var item = rules2[name];
  13243. _this.rules[name] = Array.isArray(item) ? item : [item];
  13244. });
  13245. };
  13246. _proto.messages = function messages2(_messages) {
  13247. if (_messages) {
  13248. this._messages = deepMerge(newMessages(), _messages);
  13249. }
  13250. return this._messages;
  13251. };
  13252. _proto.validate = function validate(source_, o, oc) {
  13253. var _this2 = this;
  13254. if (o === void 0) {
  13255. o = {};
  13256. }
  13257. if (oc === void 0) {
  13258. oc = function oc2() {
  13259. };
  13260. }
  13261. var source = source_;
  13262. var options = o;
  13263. var callback = oc;
  13264. if (typeof options === "function") {
  13265. callback = options;
  13266. options = {};
  13267. }
  13268. if (!this.rules || Object.keys(this.rules).length === 0) {
  13269. if (callback) {
  13270. callback(null, source);
  13271. }
  13272. return Promise.resolve(source);
  13273. }
  13274. function complete(results) {
  13275. var errors = [];
  13276. var fields = {};
  13277. function add(e) {
  13278. if (Array.isArray(e)) {
  13279. var _errors;
  13280. errors = (_errors = errors).concat.apply(_errors, e);
  13281. } else {
  13282. errors.push(e);
  13283. }
  13284. }
  13285. for (var i = 0; i < results.length; i++) {
  13286. add(results[i]);
  13287. }
  13288. if (!errors.length) {
  13289. callback(null, source);
  13290. } else {
  13291. fields = convertFieldsError(errors);
  13292. callback(errors, fields);
  13293. }
  13294. }
  13295. if (options.messages) {
  13296. var messages$1 = this.messages();
  13297. if (messages$1 === messages) {
  13298. messages$1 = newMessages();
  13299. }
  13300. deepMerge(messages$1, options.messages);
  13301. options.messages = messages$1;
  13302. } else {
  13303. options.messages = this.messages();
  13304. }
  13305. var series = {};
  13306. var keys = options.keys || Object.keys(this.rules);
  13307. keys.forEach(function(z) {
  13308. var arr = _this2.rules[z];
  13309. var value = source[z];
  13310. arr.forEach(function(r) {
  13311. var rule = r;
  13312. if (typeof rule.transform === "function") {
  13313. if (source === source_) {
  13314. source = _extends({}, source);
  13315. }
  13316. value = source[z] = rule.transform(value);
  13317. }
  13318. if (typeof rule === "function") {
  13319. rule = {
  13320. validator: rule
  13321. };
  13322. } else {
  13323. rule = _extends({}, rule);
  13324. }
  13325. rule.validator = _this2.getValidationMethod(rule);
  13326. if (!rule.validator) {
  13327. return;
  13328. }
  13329. rule.field = z;
  13330. rule.fullField = rule.fullField || z;
  13331. rule.type = _this2.getType(rule);
  13332. series[z] = series[z] || [];
  13333. series[z].push({
  13334. rule,
  13335. value,
  13336. source,
  13337. field: z
  13338. });
  13339. });
  13340. });
  13341. var errorFields = {};
  13342. return asyncMap(series, options, function(data, doIt) {
  13343. var rule = data.rule;
  13344. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  13345. deep = deep && (rule.required || !rule.required && data.value);
  13346. rule.field = data.field;
  13347. function addFullField(key, schema) {
  13348. return _extends({}, schema, {
  13349. fullField: rule.fullField + "." + key,
  13350. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  13351. });
  13352. }
  13353. function cb(e) {
  13354. if (e === void 0) {
  13355. e = [];
  13356. }
  13357. var errorList = Array.isArray(e) ? e : [e];
  13358. if (!options.suppressWarning && errorList.length) {
  13359. Schema2.warning("async-validator:", errorList);
  13360. }
  13361. if (errorList.length && rule.message !== void 0) {
  13362. errorList = [].concat(rule.message);
  13363. }
  13364. var filledErrors = errorList.map(complementError(rule, source));
  13365. if (options.first && filledErrors.length) {
  13366. errorFields[rule.field] = 1;
  13367. return doIt(filledErrors);
  13368. }
  13369. if (!deep) {
  13370. doIt(filledErrors);
  13371. } else {
  13372. if (rule.required && !data.value) {
  13373. if (rule.message !== void 0) {
  13374. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  13375. } else if (options.error) {
  13376. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  13377. }
  13378. return doIt(filledErrors);
  13379. }
  13380. var fieldsSchema = {};
  13381. if (rule.defaultField) {
  13382. Object.keys(data.value).map(function(key) {
  13383. fieldsSchema[key] = rule.defaultField;
  13384. });
  13385. }
  13386. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  13387. var paredFieldsSchema = {};
  13388. Object.keys(fieldsSchema).forEach(function(field) {
  13389. var fieldSchema = fieldsSchema[field];
  13390. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  13391. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  13392. });
  13393. var schema = new Schema2(paredFieldsSchema);
  13394. schema.messages(options.messages);
  13395. if (data.rule.options) {
  13396. data.rule.options.messages = options.messages;
  13397. data.rule.options.error = options.error;
  13398. }
  13399. schema.validate(data.value, data.rule.options || options, function(errs) {
  13400. var finalErrors = [];
  13401. if (filledErrors && filledErrors.length) {
  13402. finalErrors.push.apply(finalErrors, filledErrors);
  13403. }
  13404. if (errs && errs.length) {
  13405. finalErrors.push.apply(finalErrors, errs);
  13406. }
  13407. doIt(finalErrors.length ? finalErrors : null);
  13408. });
  13409. }
  13410. }
  13411. var res;
  13412. if (rule.asyncValidator) {
  13413. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  13414. } else if (rule.validator) {
  13415. try {
  13416. res = rule.validator(rule, data.value, cb, data.source, options);
  13417. } catch (error) {
  13418. console.error == null ? void 0 : console.error(error);
  13419. if (!options.suppressValidatorError) {
  13420. setTimeout(function() {
  13421. throw error;
  13422. }, 0);
  13423. }
  13424. cb(error.message);
  13425. }
  13426. if (res === true) {
  13427. cb();
  13428. } else if (res === false) {
  13429. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  13430. } else if (res instanceof Array) {
  13431. cb(res);
  13432. } else if (res instanceof Error) {
  13433. cb(res.message);
  13434. }
  13435. }
  13436. if (res && res.then) {
  13437. res.then(function() {
  13438. return cb();
  13439. }, function(e) {
  13440. return cb(e);
  13441. });
  13442. }
  13443. }, function(results) {
  13444. complete(results);
  13445. }, source);
  13446. };
  13447. _proto.getType = function getType(rule) {
  13448. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  13449. rule.type = "pattern";
  13450. }
  13451. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  13452. throw new Error(format("Unknown rule type %s", rule.type));
  13453. }
  13454. return rule.type || "string";
  13455. };
  13456. _proto.getValidationMethod = function getValidationMethod(rule) {
  13457. if (typeof rule.validator === "function") {
  13458. return rule.validator;
  13459. }
  13460. var keys = Object.keys(rule);
  13461. var messageIndex = keys.indexOf("message");
  13462. if (messageIndex !== -1) {
  13463. keys.splice(messageIndex, 1);
  13464. }
  13465. if (keys.length === 1 && keys[0] === "required") {
  13466. return validators.required;
  13467. }
  13468. return validators[this.getType(rule)] || void 0;
  13469. };
  13470. return Schema2;
  13471. }();
  13472. Schema.register = function register(type4, validator) {
  13473. if (typeof validator !== "function") {
  13474. throw new Error("Cannot register a validator by type, validator is not a function");
  13475. }
  13476. validators[type4] = validator;
  13477. };
  13478. Schema.warning = warning;
  13479. Schema.messages = messages;
  13480. Schema.validators = validators;
  13481. const formItemValidateStates = [
  13482. "",
  13483. "error",
  13484. "validating",
  13485. "success"
  13486. ];
  13487. const formItemProps = buildProps({
  13488. label: String,
  13489. labelWidth: {
  13490. type: [String, Number],
  13491. default: ""
  13492. },
  13493. labelPosition: {
  13494. type: String,
  13495. values: ["left", "right", "top", ""],
  13496. default: ""
  13497. },
  13498. prop: {
  13499. type: definePropType([String, Array])
  13500. },
  13501. required: {
  13502. type: Boolean,
  13503. default: void 0
  13504. },
  13505. rules: {
  13506. type: definePropType([Object, Array])
  13507. },
  13508. error: String,
  13509. validateStatus: {
  13510. type: String,
  13511. values: formItemValidateStates
  13512. },
  13513. for: String,
  13514. inlineMessage: {
  13515. type: Boolean,
  13516. default: void 0
  13517. },
  13518. showMessage: {
  13519. type: Boolean,
  13520. default: true
  13521. },
  13522. size: {
  13523. type: String,
  13524. values: componentSizes
  13525. }
  13526. });
  13527. const COMPONENT_NAME$n = "ElLabelWrap";
  13528. var FormLabelWrap = defineComponent({
  13529. name: COMPONENT_NAME$n,
  13530. props: {
  13531. isAutoWidth: Boolean,
  13532. updateAll: Boolean
  13533. },
  13534. setup(props, {
  13535. slots
  13536. }) {
  13537. const formContext = inject(formContextKey, void 0);
  13538. const formItemContext = inject(formItemContextKey);
  13539. if (!formItemContext)
  13540. throwError(COMPONENT_NAME$n, "usage: <el-form-item><label-wrap /></el-form-item>");
  13541. const ns = useNamespace("form");
  13542. const el = ref();
  13543. const computedWidth = ref(0);
  13544. const getLabelWidth = () => {
  13545. var _a;
  13546. if ((_a = el.value) == null ? void 0 : _a.firstElementChild) {
  13547. const width = window.getComputedStyle(el.value.firstElementChild).width;
  13548. return Math.ceil(Number.parseFloat(width));
  13549. } else {
  13550. return 0;
  13551. }
  13552. };
  13553. const updateLabelWidth = (action = "update") => {
  13554. nextTick(() => {
  13555. if (slots.default && props.isAutoWidth) {
  13556. if (action === "update") {
  13557. computedWidth.value = getLabelWidth();
  13558. } else if (action === "remove") {
  13559. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  13560. }
  13561. }
  13562. });
  13563. };
  13564. const updateLabelWidthFn = () => updateLabelWidth("update");
  13565. onMounted(() => {
  13566. updateLabelWidthFn();
  13567. });
  13568. onBeforeUnmount(() => {
  13569. updateLabelWidth("remove");
  13570. });
  13571. onUpdated(() => updateLabelWidthFn());
  13572. watch(computedWidth, (val, oldVal) => {
  13573. if (props.updateAll) {
  13574. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  13575. }
  13576. });
  13577. useResizeObserver(computed(() => {
  13578. var _a, _b;
  13579. return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null;
  13580. }), updateLabelWidthFn);
  13581. return () => {
  13582. var _a, _b;
  13583. if (!slots)
  13584. return null;
  13585. const {
  13586. isAutoWidth
  13587. } = props;
  13588. if (isAutoWidth) {
  13589. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  13590. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  13591. const style = {};
  13592. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  13593. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  13594. const labelPosition = formItemContext.labelPosition || formContext.labelPosition;
  13595. const marginPosition = labelPosition === "left" ? "marginRight" : "marginLeft";
  13596. if (marginWidth) {
  13597. style[marginPosition] = `${marginWidth}px`;
  13598. }
  13599. }
  13600. return createVNode("div", {
  13601. "ref": el,
  13602. "class": [ns.be("item", "label-wrap")],
  13603. "style": style
  13604. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  13605. } else {
  13606. return createVNode(Fragment, {
  13607. "ref": el
  13608. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  13609. }
  13610. };
  13611. }
  13612. });
  13613. const __default__$1U = defineComponent({
  13614. name: "ElFormItem"
  13615. });
  13616. const _sfc_main$2r = /* @__PURE__ */ defineComponent({
  13617. ...__default__$1U,
  13618. props: formItemProps,
  13619. setup(__props, { expose }) {
  13620. const props = __props;
  13621. const slots = useSlots();
  13622. const formContext = inject(formContextKey, void 0);
  13623. const parentFormItemContext = inject(formItemContextKey, void 0);
  13624. const _size = useFormSize(void 0, { formItem: false });
  13625. const ns = useNamespace("form-item");
  13626. const labelId = useId().value;
  13627. const inputIds = ref([]);
  13628. const validateState = ref("");
  13629. const validateStateDebounced = refDebounced(validateState, 100);
  13630. const validateMessage = ref("");
  13631. const formItemRef = ref();
  13632. let initialValue = void 0;
  13633. let isResettingField = false;
  13634. const labelPosition = computed(() => props.labelPosition || (formContext == null ? void 0 : formContext.labelPosition));
  13635. const labelStyle = computed(() => {
  13636. if (labelPosition.value === "top") {
  13637. return {};
  13638. }
  13639. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  13640. if (labelWidth)
  13641. return { width: labelWidth };
  13642. return {};
  13643. });
  13644. const contentStyle = computed(() => {
  13645. if (labelPosition.value === "top" || (formContext == null ? void 0 : formContext.inline)) {
  13646. return {};
  13647. }
  13648. if (!props.label && !props.labelWidth && isNested) {
  13649. return {};
  13650. }
  13651. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  13652. if (!props.label && !slots.label) {
  13653. return { marginLeft: labelWidth };
  13654. }
  13655. return {};
  13656. });
  13657. const formItemClasses = computed(() => [
  13658. ns.b(),
  13659. ns.m(_size.value),
  13660. ns.is("error", validateState.value === "error"),
  13661. ns.is("validating", validateState.value === "validating"),
  13662. ns.is("success", validateState.value === "success"),
  13663. ns.is("required", isRequired.value || props.required),
  13664. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  13665. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  13666. {
  13667. [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon,
  13668. [ns.m(`label-${labelPosition.value}`)]: labelPosition.value
  13669. }
  13670. ]);
  13671. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  13672. const validateClasses = computed(() => [
  13673. ns.e("error"),
  13674. { [ns.em("error", "inline")]: _inlineMessage.value }
  13675. ]);
  13676. const propString = computed(() => {
  13677. if (!props.prop)
  13678. return "";
  13679. return isArray$1(props.prop) ? props.prop.join(".") : props.prop;
  13680. });
  13681. const hasLabel = computed(() => {
  13682. return !!(props.label || slots.label);
  13683. });
  13684. const labelFor = computed(() => {
  13685. var _a;
  13686. return (_a = props.for) != null ? _a : inputIds.value.length === 1 ? inputIds.value[0] : void 0;
  13687. });
  13688. const isGroup = computed(() => {
  13689. return !labelFor.value && hasLabel.value;
  13690. });
  13691. const isNested = !!parentFormItemContext;
  13692. const fieldValue = computed(() => {
  13693. const model = formContext == null ? void 0 : formContext.model;
  13694. if (!model || !props.prop) {
  13695. return;
  13696. }
  13697. return getProp(model, props.prop).value;
  13698. });
  13699. const normalizedRules = computed(() => {
  13700. const { required } = props;
  13701. const rules = [];
  13702. if (props.rules) {
  13703. rules.push(...castArray$1(props.rules));
  13704. }
  13705. const formRules = formContext == null ? void 0 : formContext.rules;
  13706. if (formRules && props.prop) {
  13707. const _rules = getProp(formRules, props.prop).value;
  13708. if (_rules) {
  13709. rules.push(...castArray$1(_rules));
  13710. }
  13711. }
  13712. if (required !== void 0) {
  13713. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => "required" in rule);
  13714. if (requiredRules.length > 0) {
  13715. for (const [rule, i] of requiredRules) {
  13716. if (rule.required === required)
  13717. continue;
  13718. rules[i] = { ...rule, required };
  13719. }
  13720. } else {
  13721. rules.push({ required });
  13722. }
  13723. }
  13724. return rules;
  13725. });
  13726. const validateEnabled = computed(() => normalizedRules.value.length > 0);
  13727. const getFilteredRule = (trigger) => {
  13728. const rules = normalizedRules.value;
  13729. return rules.filter((rule) => {
  13730. if (!rule.trigger || !trigger)
  13731. return true;
  13732. if (isArray$1(rule.trigger)) {
  13733. return rule.trigger.includes(trigger);
  13734. } else {
  13735. return rule.trigger === trigger;
  13736. }
  13737. }).map(({ trigger: trigger2, ...rule }) => rule);
  13738. };
  13739. const isRequired = computed(() => normalizedRules.value.some((rule) => rule.required));
  13740. const shouldShowError = computed(() => {
  13741. var _a;
  13742. return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true);
  13743. });
  13744. const currentLabel = computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  13745. const setValidationState = (state) => {
  13746. validateState.value = state;
  13747. };
  13748. const onValidationFailed = (error) => {
  13749. var _a, _b;
  13750. const { errors, fields } = error;
  13751. if (!errors || !fields) {
  13752. console.error(error);
  13753. }
  13754. setValidationState("error");
  13755. validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : "";
  13756. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  13757. };
  13758. const onValidationSucceeded = () => {
  13759. setValidationState("success");
  13760. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  13761. };
  13762. const doValidate = async (rules) => {
  13763. const modelName = propString.value;
  13764. const validator = new Schema({
  13765. [modelName]: rules
  13766. });
  13767. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  13768. onValidationSucceeded();
  13769. return true;
  13770. }).catch((err) => {
  13771. onValidationFailed(err);
  13772. return Promise.reject(err);
  13773. });
  13774. };
  13775. const validate = async (trigger, callback) => {
  13776. if (isResettingField || !props.prop) {
  13777. return false;
  13778. }
  13779. const hasCallback = isFunction$1(callback);
  13780. if (!validateEnabled.value) {
  13781. callback == null ? void 0 : callback(false);
  13782. return false;
  13783. }
  13784. const rules = getFilteredRule(trigger);
  13785. if (rules.length === 0) {
  13786. callback == null ? void 0 : callback(true);
  13787. return true;
  13788. }
  13789. setValidationState("validating");
  13790. return doValidate(rules).then(() => {
  13791. callback == null ? void 0 : callback(true);
  13792. return true;
  13793. }).catch((err) => {
  13794. const { fields } = err;
  13795. callback == null ? void 0 : callback(false, fields);
  13796. return hasCallback ? false : Promise.reject(fields);
  13797. });
  13798. };
  13799. const clearValidate = () => {
  13800. setValidationState("");
  13801. validateMessage.value = "";
  13802. isResettingField = false;
  13803. };
  13804. const resetField = async () => {
  13805. const model = formContext == null ? void 0 : formContext.model;
  13806. if (!model || !props.prop)
  13807. return;
  13808. const computedValue = getProp(model, props.prop);
  13809. isResettingField = true;
  13810. computedValue.value = clone(initialValue);
  13811. await nextTick();
  13812. clearValidate();
  13813. isResettingField = false;
  13814. };
  13815. const addInputId = (id) => {
  13816. if (!inputIds.value.includes(id)) {
  13817. inputIds.value.push(id);
  13818. }
  13819. };
  13820. const removeInputId = (id) => {
  13821. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  13822. };
  13823. watch(() => props.error, (val) => {
  13824. validateMessage.value = val || "";
  13825. setValidationState(val ? "error" : "");
  13826. }, { immediate: true });
  13827. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  13828. const context = reactive({
  13829. ...toRefs(props),
  13830. $el: formItemRef,
  13831. size: _size,
  13832. validateMessage,
  13833. validateState,
  13834. labelId,
  13835. inputIds,
  13836. isGroup,
  13837. hasLabel,
  13838. fieldValue,
  13839. addInputId,
  13840. removeInputId,
  13841. resetField,
  13842. clearValidate,
  13843. validate,
  13844. propString
  13845. });
  13846. provide(formItemContextKey, context);
  13847. onMounted(() => {
  13848. if (props.prop) {
  13849. formContext == null ? void 0 : formContext.addField(context);
  13850. initialValue = clone(fieldValue.value);
  13851. }
  13852. });
  13853. onBeforeUnmount(() => {
  13854. formContext == null ? void 0 : formContext.removeField(context);
  13855. });
  13856. expose({
  13857. size: _size,
  13858. validateMessage,
  13859. validateState,
  13860. validate,
  13861. clearValidate,
  13862. resetField
  13863. });
  13864. return (_ctx, _cache) => {
  13865. var _a;
  13866. return openBlock(), createElementBlock("div", {
  13867. ref_key: "formItemRef",
  13868. ref: formItemRef,
  13869. class: normalizeClass(unref(formItemClasses)),
  13870. role: unref(isGroup) ? "group" : void 0,
  13871. "aria-labelledby": unref(isGroup) ? unref(labelId) : void 0
  13872. }, [
  13873. createVNode(unref(FormLabelWrap), {
  13874. "is-auto-width": unref(labelStyle).width === "auto",
  13875. "update-all": ((_a = unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto"
  13876. }, {
  13877. default: withCtx(() => [
  13878. !!(_ctx.label || _ctx.$slots.label) ? (openBlock(), createBlock(resolveDynamicComponent(unref(labelFor) ? "label" : "div"), {
  13879. key: 0,
  13880. id: unref(labelId),
  13881. for: unref(labelFor),
  13882. class: normalizeClass(unref(ns).e("label")),
  13883. style: normalizeStyle(unref(labelStyle))
  13884. }, {
  13885. default: withCtx(() => [
  13886. renderSlot(_ctx.$slots, "label", { label: unref(currentLabel) }, () => [
  13887. createTextVNode(toDisplayString(unref(currentLabel)), 1)
  13888. ])
  13889. ]),
  13890. _: 3
  13891. }, 8, ["id", "for", "class", "style"])) : createCommentVNode("v-if", true)
  13892. ]),
  13893. _: 3
  13894. }, 8, ["is-auto-width", "update-all"]),
  13895. createElementVNode("div", {
  13896. class: normalizeClass(unref(ns).e("content")),
  13897. style: normalizeStyle(unref(contentStyle))
  13898. }, [
  13899. renderSlot(_ctx.$slots, "default"),
  13900. createVNode(TransitionGroup, {
  13901. name: `${unref(ns).namespace.value}-zoom-in-top`
  13902. }, {
  13903. default: withCtx(() => [
  13904. unref(shouldShowError) ? renderSlot(_ctx.$slots, "error", {
  13905. key: 0,
  13906. error: validateMessage.value
  13907. }, () => [
  13908. createElementVNode("div", {
  13909. class: normalizeClass(unref(validateClasses))
  13910. }, toDisplayString(validateMessage.value), 3)
  13911. ]) : createCommentVNode("v-if", true)
  13912. ]),
  13913. _: 3
  13914. }, 8, ["name"])
  13915. ], 6)
  13916. ], 10, ["role", "aria-labelledby"]);
  13917. };
  13918. }
  13919. });
  13920. var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2r, [["__file", "form-item.vue"]]);
  13921. const ElForm = withInstall(Form, {
  13922. FormItem
  13923. });
  13924. const ElFormItem = withNoopInstall(FormItem);
  13925. let hiddenTextarea = void 0;
  13926. const HIDDEN_STYLE = {
  13927. height: "0",
  13928. visibility: "hidden",
  13929. overflow: isFirefox() ? "" : "hidden",
  13930. position: "absolute",
  13931. "z-index": "-1000",
  13932. top: "0",
  13933. right: "0"
  13934. };
  13935. const CONTEXT_STYLE = [
  13936. "letter-spacing",
  13937. "line-height",
  13938. "padding-top",
  13939. "padding-bottom",
  13940. "font-family",
  13941. "font-weight",
  13942. "font-size",
  13943. "text-rendering",
  13944. "text-transform",
  13945. "width",
  13946. "text-indent",
  13947. "padding-left",
  13948. "padding-right",
  13949. "border-width",
  13950. "box-sizing",
  13951. "word-break"
  13952. ];
  13953. const looseToNumber = (val) => {
  13954. const n = Number.parseFloat(val);
  13955. return Number.isNaN(n) ? val : n;
  13956. };
  13957. function calculateNodeStyling(targetElement) {
  13958. const style = window.getComputedStyle(targetElement);
  13959. const boxSizing = style.getPropertyValue("box-sizing");
  13960. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  13961. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  13962. const contextStyle = CONTEXT_STYLE.map((name) => [
  13963. name,
  13964. style.getPropertyValue(name)
  13965. ]);
  13966. return { contextStyle, paddingSize, borderSize, boxSizing };
  13967. }
  13968. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  13969. var _a, _b;
  13970. if (!hiddenTextarea) {
  13971. hiddenTextarea = document.createElement("textarea");
  13972. ((_a = targetElement.parentNode) != null ? _a : document.body).appendChild(hiddenTextarea);
  13973. }
  13974. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  13975. contextStyle.forEach(([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value));
  13976. Object.entries(HIDDEN_STYLE).forEach(([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value, "important"));
  13977. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  13978. let height = hiddenTextarea.scrollHeight;
  13979. const result = {};
  13980. if (boxSizing === "border-box") {
  13981. height = height + borderSize;
  13982. } else if (boxSizing === "content-box") {
  13983. height = height - paddingSize;
  13984. }
  13985. hiddenTextarea.value = "";
  13986. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  13987. if (isNumber(minRows)) {
  13988. let minHeight = singleRowHeight * minRows;
  13989. if (boxSizing === "border-box") {
  13990. minHeight = minHeight + paddingSize + borderSize;
  13991. }
  13992. height = Math.max(minHeight, height);
  13993. result.minHeight = `${minHeight}px`;
  13994. }
  13995. if (isNumber(maxRows)) {
  13996. let maxHeight = singleRowHeight * maxRows;
  13997. if (boxSizing === "border-box") {
  13998. maxHeight = maxHeight + paddingSize + borderSize;
  13999. }
  14000. height = Math.min(maxHeight, height);
  14001. }
  14002. result.height = `${height}px`;
  14003. (_b = hiddenTextarea.parentNode) == null ? void 0 : _b.removeChild(hiddenTextarea);
  14004. hiddenTextarea = void 0;
  14005. return result;
  14006. }
  14007. const inputProps = buildProps({
  14008. id: {
  14009. type: String,
  14010. default: void 0
  14011. },
  14012. size: useSizeProp,
  14013. disabled: Boolean,
  14014. modelValue: {
  14015. type: definePropType([
  14016. String,
  14017. Number,
  14018. Object
  14019. ]),
  14020. default: ""
  14021. },
  14022. modelModifiers: {
  14023. type: definePropType(Object),
  14024. default: () => ({})
  14025. },
  14026. maxlength: {
  14027. type: [String, Number]
  14028. },
  14029. minlength: {
  14030. type: [String, Number]
  14031. },
  14032. type: {
  14033. type: String,
  14034. default: "text"
  14035. },
  14036. resize: {
  14037. type: String,
  14038. values: ["none", "both", "horizontal", "vertical"]
  14039. },
  14040. autosize: {
  14041. type: definePropType([Boolean, Object]),
  14042. default: false
  14043. },
  14044. autocomplete: {
  14045. type: definePropType(String),
  14046. default: "off"
  14047. },
  14048. formatter: {
  14049. type: Function
  14050. },
  14051. parser: {
  14052. type: Function
  14053. },
  14054. placeholder: {
  14055. type: String
  14056. },
  14057. form: {
  14058. type: String
  14059. },
  14060. readonly: Boolean,
  14061. clearable: Boolean,
  14062. clearIcon: {
  14063. type: iconPropType,
  14064. default: circle_close_default
  14065. },
  14066. showPassword: Boolean,
  14067. showWordLimit: Boolean,
  14068. wordLimitPosition: {
  14069. type: String,
  14070. values: ["inside", "outside"],
  14071. default: "inside"
  14072. },
  14073. suffixIcon: {
  14074. type: iconPropType
  14075. },
  14076. prefixIcon: {
  14077. type: iconPropType
  14078. },
  14079. containerRole: {
  14080. type: String,
  14081. default: void 0
  14082. },
  14083. tabindex: {
  14084. type: [String, Number],
  14085. default: 0
  14086. },
  14087. validateEvent: {
  14088. type: Boolean,
  14089. default: true
  14090. },
  14091. inputStyle: {
  14092. type: definePropType([Object, Array, String]),
  14093. default: () => mutable({})
  14094. },
  14095. autofocus: Boolean,
  14096. rows: {
  14097. type: Number,
  14098. default: 2
  14099. },
  14100. ...useAriaProps(["ariaLabel"]),
  14101. inputmode: {
  14102. type: definePropType(String),
  14103. default: void 0
  14104. },
  14105. name: String
  14106. });
  14107. const inputEmits = {
  14108. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  14109. input: (value) => isString$1(value),
  14110. change: (value) => isString$1(value),
  14111. focus: (evt) => evt instanceof FocusEvent,
  14112. blur: (evt) => evt instanceof FocusEvent,
  14113. clear: () => true,
  14114. mouseleave: (evt) => evt instanceof MouseEvent,
  14115. mouseenter: (evt) => evt instanceof MouseEvent,
  14116. keydown: (evt) => evt instanceof Event,
  14117. compositionstart: (evt) => evt instanceof CompositionEvent,
  14118. compositionupdate: (evt) => evt instanceof CompositionEvent,
  14119. compositionend: (evt) => evt instanceof CompositionEvent
  14120. };
  14121. const COMPONENT_NAME$m = "ElInput";
  14122. const __default__$1T = defineComponent({
  14123. name: COMPONENT_NAME$m,
  14124. inheritAttrs: false
  14125. });
  14126. const _sfc_main$2q = /* @__PURE__ */ defineComponent({
  14127. ...__default__$1T,
  14128. props: inputProps,
  14129. emits: inputEmits,
  14130. setup(__props, { expose, emit }) {
  14131. const props = __props;
  14132. const rawAttrs = useAttrs$1();
  14133. const attrs = useAttrs();
  14134. const slots = useSlots();
  14135. const containerKls = computed(() => [
  14136. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  14137. nsInput.m(inputSize.value),
  14138. nsInput.is("disabled", inputDisabled.value),
  14139. nsInput.is("exceed", inputExceed.value),
  14140. {
  14141. [nsInput.b("group")]: slots.prepend || slots.append,
  14142. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  14143. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  14144. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
  14145. [nsInput.b("hidden")]: props.type === "hidden"
  14146. },
  14147. rawAttrs.class
  14148. ]);
  14149. const wrapperKls = computed(() => [
  14150. nsInput.e("wrapper"),
  14151. nsInput.is("focus", isFocused.value)
  14152. ]);
  14153. const { form: elForm, formItem: elFormItem } = useFormItem();
  14154. const { inputId } = useFormItemInputId(props, {
  14155. formItemContext: elFormItem
  14156. });
  14157. const inputSize = useFormSize();
  14158. const inputDisabled = useFormDisabled();
  14159. const nsInput = useNamespace("input");
  14160. const nsTextarea = useNamespace("textarea");
  14161. const input = shallowRef();
  14162. const textarea = shallowRef();
  14163. const hovering = ref(false);
  14164. const passwordVisible = ref(false);
  14165. const countStyle = ref();
  14166. const textareaCalcStyle = shallowRef(props.inputStyle);
  14167. const _ref = computed(() => input.value || textarea.value);
  14168. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
  14169. disabled: inputDisabled,
  14170. afterBlur() {
  14171. var _a;
  14172. if (props.validateEvent) {
  14173. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn(err));
  14174. }
  14175. }
  14176. });
  14177. const needStatusIcon = computed(() => {
  14178. var _a;
  14179. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  14180. });
  14181. const validateState = computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  14182. const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  14183. const passwordIcon = computed(() => passwordVisible.value ? view_default : hide_default);
  14184. const containerStyle = computed(() => [
  14185. rawAttrs.style
  14186. ]);
  14187. const textareaStyle = computed(() => [
  14188. props.inputStyle,
  14189. textareaCalcStyle.value,
  14190. { resize: props.resize }
  14191. ]);
  14192. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  14193. const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
  14194. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !!nativeInputValue.value);
  14195. const isWordLimitVisible = computed(() => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  14196. const textLength = computed(() => nativeInputValue.value.length);
  14197. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength));
  14198. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  14199. const hasModelModifiers = computed(() => !!Object.keys(props.modelModifiers).length);
  14200. const [recordCursor, setCursor] = useCursor(input);
  14201. useResizeObserver(textarea, (entries) => {
  14202. onceInitSizeTextarea();
  14203. if (!isWordLimitVisible.value || props.resize !== "both")
  14204. return;
  14205. const entry = entries[0];
  14206. const { width } = entry.contentRect;
  14207. countStyle.value = {
  14208. right: `calc(100% - ${width + 15 + 6}px)`
  14209. };
  14210. });
  14211. const resizeTextarea = () => {
  14212. const { type, autosize } = props;
  14213. if (!isClient || type !== "textarea" || !textarea.value)
  14214. return;
  14215. if (autosize) {
  14216. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  14217. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  14218. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  14219. textareaCalcStyle.value = {
  14220. overflowY: "hidden",
  14221. ...textareaStyle2
  14222. };
  14223. nextTick(() => {
  14224. textarea.value.offsetHeight;
  14225. textareaCalcStyle.value = textareaStyle2;
  14226. });
  14227. } else {
  14228. textareaCalcStyle.value = {
  14229. minHeight: calcTextareaHeight(textarea.value).minHeight
  14230. };
  14231. }
  14232. };
  14233. const createOnceInitResize = (resizeTextarea2) => {
  14234. let isInit = false;
  14235. return () => {
  14236. var _a;
  14237. if (isInit || !props.autosize)
  14238. return;
  14239. const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null;
  14240. if (!isElHidden) {
  14241. setTimeout(resizeTextarea2);
  14242. isInit = true;
  14243. }
  14244. };
  14245. };
  14246. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  14247. const setNativeInputValue = () => {
  14248. const input2 = _ref.value;
  14249. const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
  14250. if (!input2 || input2.value === formatterValue)
  14251. return;
  14252. input2.value = formatterValue;
  14253. };
  14254. const formatValue = (value) => {
  14255. const { trim, number } = props.modelModifiers;
  14256. if (trim) {
  14257. value = value.trim();
  14258. }
  14259. if (number) {
  14260. value = `${looseToNumber(value)}`;
  14261. }
  14262. if (props.formatter && props.parser) {
  14263. value = props.parser(value);
  14264. }
  14265. return value;
  14266. };
  14267. const handleInput = async (event) => {
  14268. if (isComposing.value)
  14269. return;
  14270. const { lazy } = props.modelModifiers;
  14271. let { value } = event.target;
  14272. if (lazy) {
  14273. emit(INPUT_EVENT, value);
  14274. return;
  14275. }
  14276. value = formatValue(value);
  14277. if (String(value) === nativeInputValue.value) {
  14278. if (props.formatter) {
  14279. setNativeInputValue();
  14280. }
  14281. return;
  14282. }
  14283. recordCursor();
  14284. emit(UPDATE_MODEL_EVENT, value);
  14285. emit(INPUT_EVENT, value);
  14286. await nextTick();
  14287. if (props.formatter && props.parser || !hasModelModifiers.value) {
  14288. setNativeInputValue();
  14289. }
  14290. setCursor();
  14291. };
  14292. const handleChange = async (event) => {
  14293. let { value } = event.target;
  14294. value = formatValue(value);
  14295. if (props.modelModifiers.lazy) {
  14296. emit(UPDATE_MODEL_EVENT, value);
  14297. }
  14298. emit(CHANGE_EVENT, value);
  14299. await nextTick();
  14300. setNativeInputValue();
  14301. };
  14302. const {
  14303. isComposing,
  14304. handleCompositionStart,
  14305. handleCompositionUpdate,
  14306. handleCompositionEnd
  14307. } = useComposition({ emit, afterComposition: handleInput });
  14308. const handlePasswordVisible = () => {
  14309. passwordVisible.value = !passwordVisible.value;
  14310. };
  14311. const focus = () => {
  14312. var _a;
  14313. return (_a = _ref.value) == null ? void 0 : _a.focus();
  14314. };
  14315. const blur = () => {
  14316. var _a;
  14317. return (_a = _ref.value) == null ? void 0 : _a.blur();
  14318. };
  14319. const handleMouseLeave = (evt) => {
  14320. hovering.value = false;
  14321. emit("mouseleave", evt);
  14322. };
  14323. const handleMouseEnter = (evt) => {
  14324. hovering.value = true;
  14325. emit("mouseenter", evt);
  14326. };
  14327. const handleKeydown = (evt) => {
  14328. emit("keydown", evt);
  14329. };
  14330. const select = () => {
  14331. var _a;
  14332. (_a = _ref.value) == null ? void 0 : _a.select();
  14333. };
  14334. const clear = () => {
  14335. emit(UPDATE_MODEL_EVENT, "");
  14336. emit(CHANGE_EVENT, "");
  14337. emit("clear");
  14338. emit(INPUT_EVENT, "");
  14339. };
  14340. watch(() => props.modelValue, () => {
  14341. var _a;
  14342. nextTick(() => resizeTextarea());
  14343. if (props.validateEvent) {
  14344. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn(err));
  14345. }
  14346. });
  14347. watch(nativeInputValue, (newValue) => {
  14348. if (!_ref.value) {
  14349. return;
  14350. }
  14351. const { trim, number } = props.modelModifiers;
  14352. const elValue = _ref.value.value;
  14353. const displayValue = (number || props.type === "number") && !/^0\d/.test(elValue) ? `${looseToNumber(elValue)}` : elValue;
  14354. if (displayValue === newValue) {
  14355. return;
  14356. }
  14357. if (document.activeElement === _ref.value && _ref.value.type !== "range") {
  14358. if (trim && displayValue.trim() === newValue) {
  14359. return;
  14360. }
  14361. }
  14362. setNativeInputValue();
  14363. });
  14364. watch(() => props.type, async () => {
  14365. await nextTick();
  14366. setNativeInputValue();
  14367. resizeTextarea();
  14368. });
  14369. onMounted(() => {
  14370. if (!props.formatter && props.parser) {
  14371. debugWarn(COMPONENT_NAME$m, "If you set the parser, you also need to set the formatter.");
  14372. }
  14373. setNativeInputValue();
  14374. nextTick(resizeTextarea);
  14375. });
  14376. expose({
  14377. input,
  14378. textarea,
  14379. ref: _ref,
  14380. textareaStyle,
  14381. autosize: toRef(props, "autosize"),
  14382. isComposing,
  14383. focus,
  14384. blur,
  14385. select,
  14386. clear,
  14387. resizeTextarea
  14388. });
  14389. return (_ctx, _cache) => {
  14390. return openBlock(), createElementBlock("div", {
  14391. class: normalizeClass([
  14392. unref(containerKls),
  14393. {
  14394. [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  14395. [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
  14396. }
  14397. ]),
  14398. style: normalizeStyle(unref(containerStyle)),
  14399. onMouseenter: handleMouseEnter,
  14400. onMouseleave: handleMouseLeave
  14401. }, [
  14402. createCommentVNode(" input "),
  14403. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  14404. createCommentVNode(" prepend slot "),
  14405. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  14406. key: 0,
  14407. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  14408. }, [
  14409. renderSlot(_ctx.$slots, "prepend")
  14410. ], 2)) : createCommentVNode("v-if", true),
  14411. createElementVNode("div", {
  14412. ref_key: "wrapperRef",
  14413. ref: wrapperRef,
  14414. class: normalizeClass(unref(wrapperKls))
  14415. }, [
  14416. createCommentVNode(" prefix slot "),
  14417. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  14418. key: 0,
  14419. class: normalizeClass(unref(nsInput).e("prefix"))
  14420. }, [
  14421. createElementVNode("span", {
  14422. class: normalizeClass(unref(nsInput).e("prefix-inner"))
  14423. }, [
  14424. renderSlot(_ctx.$slots, "prefix"),
  14425. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  14426. key: 0,
  14427. class: normalizeClass(unref(nsInput).e("icon"))
  14428. }, {
  14429. default: withCtx(() => [
  14430. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  14431. ]),
  14432. _: 1
  14433. }, 8, ["class"])) : createCommentVNode("v-if", true)
  14434. ], 2)
  14435. ], 2)) : createCommentVNode("v-if", true),
  14436. createElementVNode("input", mergeProps({
  14437. id: unref(inputId),
  14438. ref_key: "input",
  14439. ref: input,
  14440. class: unref(nsInput).e("inner")
  14441. }, unref(attrs), {
  14442. name: _ctx.name,
  14443. minlength: _ctx.minlength,
  14444. maxlength: _ctx.maxlength,
  14445. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  14446. disabled: unref(inputDisabled),
  14447. readonly: _ctx.readonly,
  14448. autocomplete: _ctx.autocomplete,
  14449. tabindex: _ctx.tabindex,
  14450. "aria-label": _ctx.ariaLabel,
  14451. placeholder: _ctx.placeholder,
  14452. style: _ctx.inputStyle,
  14453. form: _ctx.form,
  14454. autofocus: _ctx.autofocus,
  14455. role: _ctx.containerRole,
  14456. inputmode: _ctx.inputmode,
  14457. onCompositionstart: unref(handleCompositionStart),
  14458. onCompositionupdate: unref(handleCompositionUpdate),
  14459. onCompositionend: unref(handleCompositionEnd),
  14460. onInput: handleInput,
  14461. onChange: handleChange,
  14462. onKeydown: handleKeydown
  14463. }), null, 16, ["id", "name", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "role", "inputmode", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  14464. createCommentVNode(" suffix slot "),
  14465. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  14466. key: 1,
  14467. class: normalizeClass(unref(nsInput).e("suffix"))
  14468. }, [
  14469. createElementVNode("span", {
  14470. class: normalizeClass(unref(nsInput).e("suffix-inner"))
  14471. }, [
  14472. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  14473. renderSlot(_ctx.$slots, "suffix"),
  14474. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  14475. key: 0,
  14476. class: normalizeClass(unref(nsInput).e("icon"))
  14477. }, {
  14478. default: withCtx(() => [
  14479. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  14480. ]),
  14481. _: 1
  14482. }, 8, ["class"])) : createCommentVNode("v-if", true)
  14483. ], 64)) : createCommentVNode("v-if", true),
  14484. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  14485. key: 1,
  14486. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  14487. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  14488. onClick: clear
  14489. }, {
  14490. default: withCtx(() => [
  14491. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  14492. ]),
  14493. _: 1
  14494. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
  14495. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  14496. key: 2,
  14497. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  14498. onClick: handlePasswordVisible,
  14499. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  14500. onMouseup: withModifiers(unref(NOOP), ["prevent"])
  14501. }, {
  14502. default: withCtx(() => [
  14503. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  14504. ]),
  14505. _: 1
  14506. }, 8, ["class", "onMousedown", "onMouseup"])) : createCommentVNode("v-if", true),
  14507. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  14508. key: 3,
  14509. class: normalizeClass([
  14510. unref(nsInput).e("count"),
  14511. unref(nsInput).is("outside", _ctx.wordLimitPosition === "outside")
  14512. ])
  14513. }, [
  14514. createElementVNode("span", {
  14515. class: normalizeClass(unref(nsInput).e("count-inner"))
  14516. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(_ctx.maxlength), 3)
  14517. ], 2)) : createCommentVNode("v-if", true),
  14518. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  14519. key: 4,
  14520. class: normalizeClass([
  14521. unref(nsInput).e("icon"),
  14522. unref(nsInput).e("validateIcon"),
  14523. unref(nsInput).is("loading", unref(validateState) === "validating")
  14524. ])
  14525. }, {
  14526. default: withCtx(() => [
  14527. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  14528. ]),
  14529. _: 1
  14530. }, 8, ["class"])) : createCommentVNode("v-if", true)
  14531. ], 2)
  14532. ], 2)) : createCommentVNode("v-if", true)
  14533. ], 2),
  14534. createCommentVNode(" append slot "),
  14535. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  14536. key: 1,
  14537. class: normalizeClass(unref(nsInput).be("group", "append"))
  14538. }, [
  14539. renderSlot(_ctx.$slots, "append")
  14540. ], 2)) : createCommentVNode("v-if", true)
  14541. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  14542. createCommentVNode(" textarea "),
  14543. createElementVNode("textarea", mergeProps({
  14544. id: unref(inputId),
  14545. ref_key: "textarea",
  14546. ref: textarea,
  14547. class: [unref(nsTextarea).e("inner"), unref(nsInput).is("focus", unref(isFocused))]
  14548. }, unref(attrs), {
  14549. minlength: _ctx.minlength,
  14550. maxlength: _ctx.maxlength,
  14551. tabindex: _ctx.tabindex,
  14552. disabled: unref(inputDisabled),
  14553. readonly: _ctx.readonly,
  14554. autocomplete: _ctx.autocomplete,
  14555. style: unref(textareaStyle),
  14556. "aria-label": _ctx.ariaLabel,
  14557. placeholder: _ctx.placeholder,
  14558. form: _ctx.form,
  14559. autofocus: _ctx.autofocus,
  14560. rows: _ctx.rows,
  14561. role: _ctx.containerRole,
  14562. onCompositionstart: unref(handleCompositionStart),
  14563. onCompositionupdate: unref(handleCompositionUpdate),
  14564. onCompositionend: unref(handleCompositionEnd),
  14565. onInput: handleInput,
  14566. onFocus: unref(handleFocus),
  14567. onBlur: unref(handleBlur),
  14568. onChange: handleChange,
  14569. onKeydown: handleKeydown
  14570. }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]),
  14571. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  14572. key: 0,
  14573. style: normalizeStyle(countStyle.value),
  14574. class: normalizeClass([
  14575. unref(nsInput).e("count"),
  14576. unref(nsInput).is("outside", _ctx.wordLimitPosition === "outside")
  14577. ])
  14578. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(_ctx.maxlength), 7)) : createCommentVNode("v-if", true)
  14579. ], 64))
  14580. ], 38);
  14581. };
  14582. }
  14583. });
  14584. var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2q, [["__file", "input.vue"]]);
  14585. const ElInput = withInstall(Input);
  14586. const GAP = 4;
  14587. const BAR_MAP = {
  14588. vertical: {
  14589. offset: "offsetHeight",
  14590. scroll: "scrollTop",
  14591. scrollSize: "scrollHeight",
  14592. size: "height",
  14593. key: "vertical",
  14594. axis: "Y",
  14595. client: "clientY",
  14596. direction: "top"
  14597. },
  14598. horizontal: {
  14599. offset: "offsetWidth",
  14600. scroll: "scrollLeft",
  14601. scrollSize: "scrollWidth",
  14602. size: "width",
  14603. key: "horizontal",
  14604. axis: "X",
  14605. client: "clientX",
  14606. direction: "left"
  14607. }
  14608. };
  14609. const renderThumbStyle$1 = ({
  14610. move,
  14611. size,
  14612. bar
  14613. }) => ({
  14614. [bar.size]: size,
  14615. transform: `translate${bar.axis}(${move}%)`
  14616. });
  14617. const scrollbarContextKey = Symbol("scrollbarContextKey");
  14618. const thumbProps = buildProps({
  14619. vertical: Boolean,
  14620. size: String,
  14621. move: Number,
  14622. ratio: {
  14623. type: Number,
  14624. required: true
  14625. },
  14626. always: Boolean
  14627. });
  14628. const COMPONENT_NAME$l = "Thumb";
  14629. const _sfc_main$2p = /* @__PURE__ */ defineComponent({
  14630. __name: "thumb",
  14631. props: thumbProps,
  14632. setup(__props) {
  14633. const props = __props;
  14634. const scrollbar = inject(scrollbarContextKey);
  14635. const ns = useNamespace("scrollbar");
  14636. if (!scrollbar)
  14637. throwError(COMPONENT_NAME$l, "can not inject scrollbar context");
  14638. const instance = ref();
  14639. const thumb = ref();
  14640. const thumbState = ref({});
  14641. const visible = ref(false);
  14642. let cursorDown = false;
  14643. let cursorLeave = false;
  14644. let baseScrollHeight = 0;
  14645. let baseScrollWidth = 0;
  14646. let originalOnSelectStart = isClient ? document.onselectstart : null;
  14647. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  14648. const thumbStyle = computed(() => renderThumbStyle$1({
  14649. size: props.size,
  14650. move: props.move,
  14651. bar: bar.value
  14652. }));
  14653. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  14654. const clickThumbHandler = (e) => {
  14655. var _a;
  14656. e.stopPropagation();
  14657. if (e.ctrlKey || [1, 2].includes(e.button))
  14658. return;
  14659. (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
  14660. startDrag(e);
  14661. const el = e.currentTarget;
  14662. if (!el)
  14663. return;
  14664. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  14665. };
  14666. const clickTrackHandler = (e) => {
  14667. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  14668. return;
  14669. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  14670. const thumbHalf = thumb.value[bar.value.offset] / 2;
  14671. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  14672. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  14673. };
  14674. const startDrag = (e) => {
  14675. e.stopImmediatePropagation();
  14676. cursorDown = true;
  14677. baseScrollHeight = scrollbar.wrapElement.scrollHeight;
  14678. baseScrollWidth = scrollbar.wrapElement.scrollWidth;
  14679. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  14680. document.addEventListener("mouseup", mouseUpDocumentHandler);
  14681. originalOnSelectStart = document.onselectstart;
  14682. document.onselectstart = () => false;
  14683. };
  14684. const mouseMoveDocumentHandler = (e) => {
  14685. if (!instance.value || !thumb.value)
  14686. return;
  14687. if (cursorDown === false)
  14688. return;
  14689. const prevPage = thumbState.value[bar.value.axis];
  14690. if (!prevPage)
  14691. return;
  14692. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  14693. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  14694. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  14695. if (bar.value.scroll === "scrollLeft") {
  14696. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * baseScrollWidth / 100;
  14697. } else {
  14698. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * baseScrollHeight / 100;
  14699. }
  14700. };
  14701. const mouseUpDocumentHandler = () => {
  14702. cursorDown = false;
  14703. thumbState.value[bar.value.axis] = 0;
  14704. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  14705. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  14706. restoreOnselectstart();
  14707. if (cursorLeave)
  14708. visible.value = false;
  14709. };
  14710. const mouseMoveScrollbarHandler = () => {
  14711. cursorLeave = false;
  14712. visible.value = !!props.size;
  14713. };
  14714. const mouseLeaveScrollbarHandler = () => {
  14715. cursorLeave = true;
  14716. visible.value = cursorDown;
  14717. };
  14718. onBeforeUnmount(() => {
  14719. restoreOnselectstart();
  14720. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  14721. });
  14722. const restoreOnselectstart = () => {
  14723. if (document.onselectstart !== originalOnSelectStart)
  14724. document.onselectstart = originalOnSelectStart;
  14725. };
  14726. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  14727. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  14728. return (_ctx, _cache) => {
  14729. return openBlock(), createBlock(Transition, {
  14730. name: unref(ns).b("fade"),
  14731. persisted: ""
  14732. }, {
  14733. default: withCtx(() => [
  14734. withDirectives(createElementVNode("div", {
  14735. ref_key: "instance",
  14736. ref: instance,
  14737. class: normalizeClass([unref(ns).e("bar"), unref(ns).is(unref(bar).key)]),
  14738. onMousedown: clickTrackHandler,
  14739. onClick: withModifiers(() => {
  14740. }, ["stop"])
  14741. }, [
  14742. createElementVNode("div", {
  14743. ref_key: "thumb",
  14744. ref: thumb,
  14745. class: normalizeClass(unref(ns).e("thumb")),
  14746. style: normalizeStyle(unref(thumbStyle)),
  14747. onMousedown: clickThumbHandler
  14748. }, null, 38)
  14749. ], 42, ["onClick"]), [
  14750. [vShow, _ctx.always || visible.value]
  14751. ])
  14752. ]),
  14753. _: 1
  14754. }, 8, ["name"]);
  14755. };
  14756. }
  14757. });
  14758. var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2p, [["__file", "thumb.vue"]]);
  14759. const barProps = buildProps({
  14760. always: {
  14761. type: Boolean,
  14762. default: true
  14763. },
  14764. minSize: {
  14765. type: Number,
  14766. required: true
  14767. }
  14768. });
  14769. const _sfc_main$2o = /* @__PURE__ */ defineComponent({
  14770. __name: "bar",
  14771. props: barProps,
  14772. setup(__props, { expose }) {
  14773. const props = __props;
  14774. const scrollbar = inject(scrollbarContextKey);
  14775. const moveX = ref(0);
  14776. const moveY = ref(0);
  14777. const sizeWidth = ref("");
  14778. const sizeHeight = ref("");
  14779. const ratioY = ref(1);
  14780. const ratioX = ref(1);
  14781. const handleScroll = (wrap) => {
  14782. if (wrap) {
  14783. const offsetHeight = wrap.offsetHeight - GAP;
  14784. const offsetWidth = wrap.offsetWidth - GAP;
  14785. moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
  14786. moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
  14787. }
  14788. };
  14789. const update = () => {
  14790. const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
  14791. if (!wrap)
  14792. return;
  14793. const offsetHeight = wrap.offsetHeight - GAP;
  14794. const offsetWidth = wrap.offsetWidth - GAP;
  14795. const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
  14796. const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
  14797. const height = Math.max(originalHeight, props.minSize);
  14798. const width = Math.max(originalWidth, props.minSize);
  14799. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  14800. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  14801. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  14802. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  14803. };
  14804. expose({
  14805. handleScroll,
  14806. update
  14807. });
  14808. return (_ctx, _cache) => {
  14809. return openBlock(), createElementBlock(Fragment, null, [
  14810. createVNode(Thumb, {
  14811. move: moveX.value,
  14812. ratio: ratioX.value,
  14813. size: sizeWidth.value,
  14814. always: _ctx.always
  14815. }, null, 8, ["move", "ratio", "size", "always"]),
  14816. createVNode(Thumb, {
  14817. move: moveY.value,
  14818. ratio: ratioY.value,
  14819. size: sizeHeight.value,
  14820. vertical: "",
  14821. always: _ctx.always
  14822. }, null, 8, ["move", "ratio", "size", "always"])
  14823. ], 64);
  14824. };
  14825. }
  14826. });
  14827. var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2o, [["__file", "bar.vue"]]);
  14828. const scrollbarProps = buildProps({
  14829. distance: {
  14830. type: Number,
  14831. default: 0
  14832. },
  14833. height: {
  14834. type: [String, Number],
  14835. default: ""
  14836. },
  14837. maxHeight: {
  14838. type: [String, Number],
  14839. default: ""
  14840. },
  14841. native: Boolean,
  14842. wrapStyle: {
  14843. type: definePropType([String, Object, Array]),
  14844. default: ""
  14845. },
  14846. wrapClass: {
  14847. type: [String, Array],
  14848. default: ""
  14849. },
  14850. viewClass: {
  14851. type: [String, Array],
  14852. default: ""
  14853. },
  14854. viewStyle: {
  14855. type: [String, Array, Object],
  14856. default: ""
  14857. },
  14858. noresize: Boolean,
  14859. tag: {
  14860. type: String,
  14861. default: "div"
  14862. },
  14863. always: Boolean,
  14864. minSize: {
  14865. type: Number,
  14866. default: 20
  14867. },
  14868. tabindex: {
  14869. type: [String, Number],
  14870. default: void 0
  14871. },
  14872. id: String,
  14873. role: String,
  14874. ...useAriaProps(["ariaLabel", "ariaOrientation"])
  14875. });
  14876. const scrollbarEmits = {
  14877. "end-reached": (direction) => ["left", "right", "top", "bottom"].includes(direction),
  14878. scroll: ({
  14879. scrollTop,
  14880. scrollLeft
  14881. }) => [scrollTop, scrollLeft].every(isNumber)
  14882. };
  14883. const COMPONENT_NAME$k = "ElScrollbar";
  14884. const __default__$1S = defineComponent({
  14885. name: COMPONENT_NAME$k
  14886. });
  14887. const _sfc_main$2n = /* @__PURE__ */ defineComponent({
  14888. ...__default__$1S,
  14889. props: scrollbarProps,
  14890. emits: scrollbarEmits,
  14891. setup(__props, { expose, emit }) {
  14892. const props = __props;
  14893. const ns = useNamespace("scrollbar");
  14894. let stopResizeObserver = void 0;
  14895. let stopWrapResizeObserver = void 0;
  14896. let stopResizeListener = void 0;
  14897. let wrapScrollTop = 0;
  14898. let wrapScrollLeft = 0;
  14899. let direction = "";
  14900. const distanceScrollState = {
  14901. bottom: false,
  14902. top: false,
  14903. right: false,
  14904. left: false
  14905. };
  14906. const scrollbarRef = ref();
  14907. const wrapRef = ref();
  14908. const resizeRef = ref();
  14909. const barRef = ref();
  14910. const wrapStyle = computed(() => {
  14911. const style = {};
  14912. if (props.height)
  14913. style.height = addUnit(props.height);
  14914. if (props.maxHeight)
  14915. style.maxHeight = addUnit(props.maxHeight);
  14916. return [props.wrapStyle, style];
  14917. });
  14918. const wrapKls = computed(() => {
  14919. return [
  14920. props.wrapClass,
  14921. ns.e("wrap"),
  14922. { [ns.em("wrap", "hidden-default")]: !props.native }
  14923. ];
  14924. });
  14925. const resizeKls = computed(() => {
  14926. return [ns.e("view"), props.viewClass];
  14927. });
  14928. const shouldSkipDirection = (direction2) => {
  14929. var _a;
  14930. return (_a = distanceScrollState[direction2]) != null ? _a : false;
  14931. };
  14932. const DIRECTION_PAIRS = {
  14933. top: "bottom",
  14934. bottom: "top",
  14935. left: "right",
  14936. right: "left"
  14937. };
  14938. const updateTriggerStatus = (arrivedStates) => {
  14939. const oppositeDirection = DIRECTION_PAIRS[direction];
  14940. if (!oppositeDirection)
  14941. return;
  14942. const arrived = arrivedStates[direction];
  14943. const oppositeArrived = arrivedStates[oppositeDirection];
  14944. if (arrived && !distanceScrollState[direction]) {
  14945. distanceScrollState[direction] = true;
  14946. }
  14947. if (!oppositeArrived && distanceScrollState[oppositeDirection]) {
  14948. distanceScrollState[oppositeDirection] = false;
  14949. }
  14950. };
  14951. const handleScroll = () => {
  14952. var _a;
  14953. if (wrapRef.value) {
  14954. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  14955. const prevTop = wrapScrollTop;
  14956. const prevLeft = wrapScrollLeft;
  14957. wrapScrollTop = wrapRef.value.scrollTop;
  14958. wrapScrollLeft = wrapRef.value.scrollLeft;
  14959. const arrivedStates = {
  14960. bottom: wrapScrollTop + wrapRef.value.clientHeight >= wrapRef.value.scrollHeight - props.distance,
  14961. top: wrapScrollTop <= props.distance && prevTop !== 0,
  14962. right: wrapScrollLeft + wrapRef.value.clientWidth >= wrapRef.value.scrollWidth - props.distance && prevLeft !== wrapScrollLeft,
  14963. left: wrapScrollLeft <= props.distance && prevLeft !== 0
  14964. };
  14965. emit("scroll", {
  14966. scrollTop: wrapScrollTop,
  14967. scrollLeft: wrapScrollLeft
  14968. });
  14969. if (prevTop !== wrapScrollTop) {
  14970. direction = wrapScrollTop > prevTop ? "bottom" : "top";
  14971. }
  14972. if (prevLeft !== wrapScrollLeft) {
  14973. direction = wrapScrollLeft > prevLeft ? "right" : "left";
  14974. }
  14975. if (props.distance > 0) {
  14976. if (shouldSkipDirection(direction)) {
  14977. return;
  14978. }
  14979. updateTriggerStatus(arrivedStates);
  14980. }
  14981. if (arrivedStates[direction])
  14982. emit("end-reached", direction);
  14983. }
  14984. };
  14985. function scrollTo(arg1, arg2) {
  14986. if (isObject$1(arg1)) {
  14987. wrapRef.value.scrollTo(arg1);
  14988. } else if (isNumber(arg1) && isNumber(arg2)) {
  14989. wrapRef.value.scrollTo(arg1, arg2);
  14990. }
  14991. }
  14992. const setScrollTop = (value) => {
  14993. if (!isNumber(value)) {
  14994. debugWarn(COMPONENT_NAME$k, "value must be a number");
  14995. return;
  14996. }
  14997. wrapRef.value.scrollTop = value;
  14998. };
  14999. const setScrollLeft = (value) => {
  15000. if (!isNumber(value)) {
  15001. debugWarn(COMPONENT_NAME$k, "value must be a number");
  15002. return;
  15003. }
  15004. wrapRef.value.scrollLeft = value;
  15005. };
  15006. const update = () => {
  15007. var _a;
  15008. (_a = barRef.value) == null ? void 0 : _a.update();
  15009. distanceScrollState[direction] = false;
  15010. };
  15011. watch(() => props.noresize, (noresize) => {
  15012. if (noresize) {
  15013. stopResizeObserver == null ? void 0 : stopResizeObserver();
  15014. stopWrapResizeObserver == null ? void 0 : stopWrapResizeObserver();
  15015. stopResizeListener == null ? void 0 : stopResizeListener();
  15016. } else {
  15017. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  15018. ({ stop: stopWrapResizeObserver } = useResizeObserver(wrapRef, update));
  15019. stopResizeListener = useEventListener("resize", update);
  15020. }
  15021. }, { immediate: true });
  15022. watch(() => [props.maxHeight, props.height], () => {
  15023. if (!props.native)
  15024. nextTick(() => {
  15025. var _a;
  15026. update();
  15027. if (wrapRef.value) {
  15028. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  15029. }
  15030. });
  15031. });
  15032. provide(scrollbarContextKey, reactive({
  15033. scrollbarElement: scrollbarRef,
  15034. wrapElement: wrapRef
  15035. }));
  15036. onActivated(() => {
  15037. if (wrapRef.value) {
  15038. wrapRef.value.scrollTop = wrapScrollTop;
  15039. wrapRef.value.scrollLeft = wrapScrollLeft;
  15040. }
  15041. });
  15042. onMounted(() => {
  15043. if (!props.native)
  15044. nextTick(() => {
  15045. update();
  15046. });
  15047. });
  15048. onUpdated(() => update());
  15049. expose({
  15050. wrapRef,
  15051. update,
  15052. scrollTo,
  15053. setScrollTop,
  15054. setScrollLeft,
  15055. handleScroll
  15056. });
  15057. return (_ctx, _cache) => {
  15058. return openBlock(), createElementBlock("div", {
  15059. ref_key: "scrollbarRef",
  15060. ref: scrollbarRef,
  15061. class: normalizeClass(unref(ns).b())
  15062. }, [
  15063. createElementVNode("div", {
  15064. ref_key: "wrapRef",
  15065. ref: wrapRef,
  15066. class: normalizeClass(unref(wrapKls)),
  15067. style: normalizeStyle(unref(wrapStyle)),
  15068. tabindex: _ctx.tabindex,
  15069. onScroll: handleScroll
  15070. }, [
  15071. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  15072. id: _ctx.id,
  15073. ref_key: "resizeRef",
  15074. ref: resizeRef,
  15075. class: normalizeClass(unref(resizeKls)),
  15076. style: normalizeStyle(_ctx.viewStyle),
  15077. role: _ctx.role,
  15078. "aria-label": _ctx.ariaLabel,
  15079. "aria-orientation": _ctx.ariaOrientation
  15080. }, {
  15081. default: withCtx(() => [
  15082. renderSlot(_ctx.$slots, "default")
  15083. ]),
  15084. _: 3
  15085. }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
  15086. ], 46, ["tabindex"]),
  15087. !_ctx.native ? (openBlock(), createBlock(Bar, {
  15088. key: 0,
  15089. ref_key: "barRef",
  15090. ref: barRef,
  15091. always: _ctx.always,
  15092. "min-size": _ctx.minSize
  15093. }, null, 8, ["always", "min-size"])) : createCommentVNode("v-if", true)
  15094. ], 2);
  15095. };
  15096. }
  15097. });
  15098. var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$2n, [["__file", "scrollbar.vue"]]);
  15099. const ElScrollbar = withInstall(Scrollbar$1);
  15100. const POPPER_INJECTION_KEY = Symbol("popper");
  15101. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  15102. const Effect = {
  15103. LIGHT: "light",
  15104. DARK: "dark"
  15105. };
  15106. const roleTypes = [
  15107. "dialog",
  15108. "grid",
  15109. "group",
  15110. "listbox",
  15111. "menu",
  15112. "navigation",
  15113. "tooltip",
  15114. "tree"
  15115. ];
  15116. const popperProps = buildProps({
  15117. role: {
  15118. type: String,
  15119. values: roleTypes,
  15120. default: "tooltip"
  15121. }
  15122. });
  15123. const usePopperProps = popperProps;
  15124. const __default__$1R = defineComponent({
  15125. name: "ElPopper",
  15126. inheritAttrs: false
  15127. });
  15128. const _sfc_main$2m = /* @__PURE__ */ defineComponent({
  15129. ...__default__$1R,
  15130. props: popperProps,
  15131. setup(__props, { expose }) {
  15132. const props = __props;
  15133. const triggerRef = ref();
  15134. const popperInstanceRef = ref();
  15135. const contentRef = ref();
  15136. const referenceRef = ref();
  15137. const role = computed(() => props.role);
  15138. const popperProvides = {
  15139. triggerRef,
  15140. popperInstanceRef,
  15141. contentRef,
  15142. referenceRef,
  15143. role
  15144. };
  15145. expose(popperProvides);
  15146. provide(POPPER_INJECTION_KEY, popperProvides);
  15147. return (_ctx, _cache) => {
  15148. return renderSlot(_ctx.$slots, "default");
  15149. };
  15150. }
  15151. });
  15152. var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$2m, [["__file", "popper.vue"]]);
  15153. const __default__$1Q = defineComponent({
  15154. name: "ElPopperArrow",
  15155. inheritAttrs: false
  15156. });
  15157. const _sfc_main$2l = /* @__PURE__ */ defineComponent({
  15158. ...__default__$1Q,
  15159. setup(__props, { expose }) {
  15160. const ns = useNamespace("popper");
  15161. const { arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  15162. onBeforeUnmount(() => {
  15163. arrowRef.value = void 0;
  15164. });
  15165. expose({
  15166. arrowRef
  15167. });
  15168. return (_ctx, _cache) => {
  15169. return openBlock(), createElementBlock("span", {
  15170. ref_key: "arrowRef",
  15171. ref: arrowRef,
  15172. class: normalizeClass(unref(ns).e("arrow")),
  15173. style: normalizeStyle(unref(arrowStyle)),
  15174. "data-popper-arrow": ""
  15175. }, null, 6);
  15176. };
  15177. }
  15178. });
  15179. var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$2l, [["__file", "arrow.vue"]]);
  15180. const NAME = "ElOnlyChild";
  15181. const OnlyChild = defineComponent({
  15182. name: NAME,
  15183. setup(_, {
  15184. slots,
  15185. attrs
  15186. }) {
  15187. var _a;
  15188. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  15189. const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
  15190. return () => {
  15191. var _a2;
  15192. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
  15193. if (!defaultSlot)
  15194. return null;
  15195. const [firstLegitNode, length] = findFirstLegitChild(defaultSlot);
  15196. if (!firstLegitNode) {
  15197. debugWarn(NAME, "no valid child node found");
  15198. return null;
  15199. }
  15200. if (length > 1) {
  15201. debugWarn(NAME, "requires exact only one valid child.");
  15202. }
  15203. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  15204. };
  15205. }
  15206. });
  15207. function findFirstLegitChild(node) {
  15208. if (!node)
  15209. return [null, 0];
  15210. const children = node;
  15211. const len = children.filter((c) => c.type !== Comment).length;
  15212. for (const child of children) {
  15213. if (isObject$1(child)) {
  15214. switch (child.type) {
  15215. case Comment:
  15216. continue;
  15217. case Text$1:
  15218. case "svg":
  15219. return [wrapTextContent(child), len];
  15220. case Fragment:
  15221. return findFirstLegitChild(child.children);
  15222. default:
  15223. return [child, len];
  15224. }
  15225. }
  15226. return [wrapTextContent(child), len];
  15227. }
  15228. return [null, 0];
  15229. }
  15230. function wrapTextContent(s) {
  15231. const ns = useNamespace("only-child");
  15232. return createVNode("span", {
  15233. "class": ns.e("content")
  15234. }, [s]);
  15235. }
  15236. const popperTriggerProps = buildProps({
  15237. virtualRef: {
  15238. type: definePropType(Object)
  15239. },
  15240. virtualTriggering: Boolean,
  15241. onMouseenter: {
  15242. type: definePropType(Function)
  15243. },
  15244. onMouseleave: {
  15245. type: definePropType(Function)
  15246. },
  15247. onClick: {
  15248. type: definePropType(Function)
  15249. },
  15250. onKeydown: {
  15251. type: definePropType(Function)
  15252. },
  15253. onFocus: {
  15254. type: definePropType(Function)
  15255. },
  15256. onBlur: {
  15257. type: definePropType(Function)
  15258. },
  15259. onContextmenu: {
  15260. type: definePropType(Function)
  15261. },
  15262. id: String,
  15263. open: Boolean
  15264. });
  15265. const usePopperTriggerProps = popperTriggerProps;
  15266. const __default__$1P = defineComponent({
  15267. name: "ElPopperTrigger",
  15268. inheritAttrs: false
  15269. });
  15270. const _sfc_main$2k = /* @__PURE__ */ defineComponent({
  15271. ...__default__$1P,
  15272. props: popperTriggerProps,
  15273. setup(__props, { expose }) {
  15274. const props = __props;
  15275. const { role, triggerRef } = inject(POPPER_INJECTION_KEY, void 0);
  15276. useForwardRef(triggerRef);
  15277. const ariaControls = computed(() => {
  15278. return ariaHaspopup.value ? props.id : void 0;
  15279. });
  15280. const ariaDescribedby = computed(() => {
  15281. if (role && role.value === "tooltip") {
  15282. return props.open && props.id ? props.id : void 0;
  15283. }
  15284. return void 0;
  15285. });
  15286. const ariaHaspopup = computed(() => {
  15287. if (role && role.value !== "tooltip") {
  15288. return role.value;
  15289. }
  15290. return void 0;
  15291. });
  15292. const ariaExpanded = computed(() => {
  15293. return ariaHaspopup.value ? `${props.open}` : void 0;
  15294. });
  15295. let virtualTriggerAriaStopWatch = void 0;
  15296. const TRIGGER_ELE_EVENTS = [
  15297. "onMouseenter",
  15298. "onMouseleave",
  15299. "onClick",
  15300. "onKeydown",
  15301. "onFocus",
  15302. "onBlur",
  15303. "onContextmenu"
  15304. ];
  15305. onMounted(() => {
  15306. watch(() => props.virtualRef, (virtualEl) => {
  15307. if (virtualEl) {
  15308. triggerRef.value = unrefElement(virtualEl);
  15309. }
  15310. }, {
  15311. immediate: true
  15312. });
  15313. watch(triggerRef, (el, prevEl) => {
  15314. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  15315. virtualTriggerAriaStopWatch = void 0;
  15316. if (isElement$2(el)) {
  15317. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  15318. var _a;
  15319. const handler = props[eventName];
  15320. if (handler) {
  15321. el.addEventListener(eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  15322. (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  15323. }
  15324. });
  15325. if (isFocusable(el)) {
  15326. virtualTriggerAriaStopWatch = watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  15327. [
  15328. "aria-controls",
  15329. "aria-describedby",
  15330. "aria-haspopup",
  15331. "aria-expanded"
  15332. ].forEach((key, idx) => {
  15333. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  15334. });
  15335. }, { immediate: true });
  15336. }
  15337. }
  15338. if (isElement$2(prevEl) && isFocusable(prevEl)) {
  15339. [
  15340. "aria-controls",
  15341. "aria-describedby",
  15342. "aria-haspopup",
  15343. "aria-expanded"
  15344. ].forEach((key) => prevEl.removeAttribute(key));
  15345. }
  15346. }, {
  15347. immediate: true
  15348. });
  15349. });
  15350. onBeforeUnmount(() => {
  15351. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  15352. virtualTriggerAriaStopWatch = void 0;
  15353. if (triggerRef.value && isElement$2(triggerRef.value)) {
  15354. const el = triggerRef.value;
  15355. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  15356. const handler = props[eventName];
  15357. if (handler) {
  15358. el.removeEventListener(eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  15359. }
  15360. });
  15361. triggerRef.value = void 0;
  15362. }
  15363. });
  15364. expose({
  15365. triggerRef
  15366. });
  15367. return (_ctx, _cache) => {
  15368. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  15369. "aria-controls": unref(ariaControls),
  15370. "aria-describedby": unref(ariaDescribedby),
  15371. "aria-expanded": unref(ariaExpanded),
  15372. "aria-haspopup": unref(ariaHaspopup)
  15373. }), {
  15374. default: withCtx(() => [
  15375. renderSlot(_ctx.$slots, "default")
  15376. ]),
  15377. _: 3
  15378. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
  15379. };
  15380. }
  15381. });
  15382. var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2k, [["__file", "trigger.vue"]]);
  15383. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  15384. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  15385. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  15386. const FOCUS_AFTER_TRAPPED_OPTS = {
  15387. cancelable: true,
  15388. bubbles: false
  15389. };
  15390. const FOCUSOUT_PREVENTED_OPTS = {
  15391. cancelable: true,
  15392. bubbles: false
  15393. };
  15394. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  15395. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  15396. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  15397. const focusReason = ref();
  15398. const lastUserFocusTimestamp = ref(0);
  15399. const lastAutomatedFocusTimestamp = ref(0);
  15400. let focusReasonUserCount = 0;
  15401. const obtainAllFocusableElements = (element) => {
  15402. const nodes = [];
  15403. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  15404. acceptNode: (node) => {
  15405. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  15406. if (node.disabled || node.hidden || isHiddenInput)
  15407. return NodeFilter.FILTER_SKIP;
  15408. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  15409. }
  15410. });
  15411. while (walker.nextNode())
  15412. nodes.push(walker.currentNode);
  15413. return nodes;
  15414. };
  15415. const getVisibleElement = (elements, container) => {
  15416. for (const element of elements) {
  15417. if (!isHidden(element, container))
  15418. return element;
  15419. }
  15420. };
  15421. const isHidden = (element, container) => {
  15422. if (getComputedStyle(element).visibility === "hidden")
  15423. return true;
  15424. while (element) {
  15425. if (container && element === container)
  15426. return false;
  15427. if (getComputedStyle(element).display === "none")
  15428. return true;
  15429. element = element.parentElement;
  15430. }
  15431. return false;
  15432. };
  15433. const getEdges = (container) => {
  15434. const focusable = obtainAllFocusableElements(container);
  15435. const first = getVisibleElement(focusable, container);
  15436. const last = getVisibleElement(focusable.reverse(), container);
  15437. return [first, last];
  15438. };
  15439. const isSelectable = (element) => {
  15440. return element instanceof HTMLInputElement && "select" in element;
  15441. };
  15442. const tryFocus = (element, shouldSelect) => {
  15443. if (element) {
  15444. const prevFocusedElement = document.activeElement;
  15445. focusElement(element, { preventScroll: true });
  15446. lastAutomatedFocusTimestamp.value = window.performance.now();
  15447. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  15448. element.select();
  15449. }
  15450. }
  15451. };
  15452. function removeFromStack(list, item) {
  15453. const copy = [...list];
  15454. const idx = list.indexOf(item);
  15455. if (idx !== -1) {
  15456. copy.splice(idx, 1);
  15457. }
  15458. return copy;
  15459. }
  15460. const createFocusableStack = () => {
  15461. let stack = [];
  15462. const push = (layer) => {
  15463. const currentLayer = stack[0];
  15464. if (currentLayer && layer !== currentLayer) {
  15465. currentLayer.pause();
  15466. }
  15467. stack = removeFromStack(stack, layer);
  15468. stack.unshift(layer);
  15469. };
  15470. const remove = (layer) => {
  15471. var _a, _b;
  15472. stack = removeFromStack(stack, layer);
  15473. (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
  15474. };
  15475. return {
  15476. push,
  15477. remove
  15478. };
  15479. };
  15480. const focusFirstDescendant = (elements, shouldSelect = false) => {
  15481. const prevFocusedElement = document.activeElement;
  15482. for (const element of elements) {
  15483. tryFocus(element, shouldSelect);
  15484. if (document.activeElement !== prevFocusedElement)
  15485. return;
  15486. }
  15487. };
  15488. const focusableStack = createFocusableStack();
  15489. const isFocusCausedByUserEvent = () => {
  15490. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  15491. };
  15492. const notifyFocusReasonPointer = () => {
  15493. focusReason.value = "pointer";
  15494. lastUserFocusTimestamp.value = window.performance.now();
  15495. };
  15496. const notifyFocusReasonKeydown = () => {
  15497. focusReason.value = "keyboard";
  15498. lastUserFocusTimestamp.value = window.performance.now();
  15499. };
  15500. const useFocusReason = () => {
  15501. onMounted(() => {
  15502. if (focusReasonUserCount === 0) {
  15503. document.addEventListener("mousedown", notifyFocusReasonPointer);
  15504. document.addEventListener("touchstart", notifyFocusReasonPointer);
  15505. document.addEventListener("keydown", notifyFocusReasonKeydown);
  15506. }
  15507. focusReasonUserCount++;
  15508. });
  15509. onBeforeUnmount(() => {
  15510. focusReasonUserCount--;
  15511. if (focusReasonUserCount <= 0) {
  15512. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  15513. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  15514. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  15515. }
  15516. });
  15517. return {
  15518. focusReason,
  15519. lastUserFocusTimestamp,
  15520. lastAutomatedFocusTimestamp
  15521. };
  15522. };
  15523. const createFocusOutPreventedEvent = (detail) => {
  15524. return new CustomEvent(FOCUSOUT_PREVENTED, {
  15525. ...FOCUSOUT_PREVENTED_OPTS,
  15526. detail
  15527. });
  15528. };
  15529. const _sfc_main$2j = defineComponent({
  15530. name: "ElFocusTrap",
  15531. inheritAttrs: false,
  15532. props: {
  15533. loop: Boolean,
  15534. trapped: Boolean,
  15535. focusTrapEl: Object,
  15536. focusStartEl: {
  15537. type: [Object, String],
  15538. default: "first"
  15539. }
  15540. },
  15541. emits: [
  15542. ON_TRAP_FOCUS_EVT,
  15543. ON_RELEASE_FOCUS_EVT,
  15544. "focusin",
  15545. "focusout",
  15546. "focusout-prevented",
  15547. "release-requested"
  15548. ],
  15549. setup(props, { emit }) {
  15550. const forwardRef = ref();
  15551. let lastFocusBeforeTrapped;
  15552. let lastFocusAfterTrapped;
  15553. const { focusReason } = useFocusReason();
  15554. useEscapeKeydown((event) => {
  15555. if (props.trapped && !focusLayer.paused) {
  15556. emit("release-requested", event);
  15557. }
  15558. });
  15559. const focusLayer = {
  15560. paused: false,
  15561. pause() {
  15562. this.paused = true;
  15563. },
  15564. resume() {
  15565. this.paused = false;
  15566. }
  15567. };
  15568. const onKeydown = (e) => {
  15569. if (!props.loop && !props.trapped)
  15570. return;
  15571. if (focusLayer.paused)
  15572. return;
  15573. const { altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  15574. const { loop } = props;
  15575. const code = getEventCode(e);
  15576. const isTabbing = code === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  15577. const currentFocusingEl = document.activeElement;
  15578. if (isTabbing && currentFocusingEl) {
  15579. const container = currentTarget;
  15580. const [first, last] = getEdges(container);
  15581. const isTabbable = first && last;
  15582. if (!isTabbable) {
  15583. if (currentFocusingEl === container) {
  15584. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  15585. focusReason: focusReason.value
  15586. });
  15587. emit("focusout-prevented", focusoutPreventedEvent);
  15588. if (!focusoutPreventedEvent.defaultPrevented) {
  15589. e.preventDefault();
  15590. }
  15591. }
  15592. } else {
  15593. if (!shiftKey && currentFocusingEl === last) {
  15594. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  15595. focusReason: focusReason.value
  15596. });
  15597. emit("focusout-prevented", focusoutPreventedEvent);
  15598. if (!focusoutPreventedEvent.defaultPrevented) {
  15599. e.preventDefault();
  15600. if (loop)
  15601. tryFocus(first, true);
  15602. }
  15603. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  15604. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  15605. focusReason: focusReason.value
  15606. });
  15607. emit("focusout-prevented", focusoutPreventedEvent);
  15608. if (!focusoutPreventedEvent.defaultPrevented) {
  15609. e.preventDefault();
  15610. if (loop)
  15611. tryFocus(last, true);
  15612. }
  15613. }
  15614. }
  15615. }
  15616. };
  15617. provide(FOCUS_TRAP_INJECTION_KEY, {
  15618. focusTrapRef: forwardRef,
  15619. onKeydown
  15620. });
  15621. watch(() => props.focusTrapEl, (focusTrapEl) => {
  15622. if (focusTrapEl) {
  15623. forwardRef.value = focusTrapEl;
  15624. }
  15625. }, { immediate: true });
  15626. watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  15627. if (forwardRef2) {
  15628. forwardRef2.addEventListener("keydown", onKeydown);
  15629. forwardRef2.addEventListener("focusin", onFocusIn);
  15630. forwardRef2.addEventListener("focusout", onFocusOut);
  15631. }
  15632. if (oldForwardRef) {
  15633. oldForwardRef.removeEventListener("keydown", onKeydown);
  15634. oldForwardRef.removeEventListener("focusin", onFocusIn);
  15635. oldForwardRef.removeEventListener("focusout", onFocusOut);
  15636. }
  15637. });
  15638. const trapOnFocus = (e) => {
  15639. emit(ON_TRAP_FOCUS_EVT, e);
  15640. };
  15641. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  15642. const onFocusIn = (e) => {
  15643. const trapContainer = unref(forwardRef);
  15644. if (!trapContainer)
  15645. return;
  15646. const target = e.target;
  15647. const relatedTarget = e.relatedTarget;
  15648. const isFocusedInTrap = target && trapContainer.contains(target);
  15649. if (!props.trapped) {
  15650. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  15651. if (!isPrevFocusedInTrap) {
  15652. lastFocusBeforeTrapped = relatedTarget;
  15653. }
  15654. }
  15655. if (isFocusedInTrap)
  15656. emit("focusin", e);
  15657. if (focusLayer.paused)
  15658. return;
  15659. if (props.trapped) {
  15660. if (isFocusedInTrap) {
  15661. lastFocusAfterTrapped = target;
  15662. } else {
  15663. tryFocus(lastFocusAfterTrapped, true);
  15664. }
  15665. }
  15666. };
  15667. const onFocusOut = (e) => {
  15668. const trapContainer = unref(forwardRef);
  15669. if (focusLayer.paused || !trapContainer)
  15670. return;
  15671. if (props.trapped) {
  15672. const relatedTarget = e.relatedTarget;
  15673. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  15674. setTimeout(() => {
  15675. if (!focusLayer.paused && props.trapped) {
  15676. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  15677. focusReason: focusReason.value
  15678. });
  15679. emit("focusout-prevented", focusoutPreventedEvent);
  15680. if (!focusoutPreventedEvent.defaultPrevented) {
  15681. tryFocus(lastFocusAfterTrapped, true);
  15682. }
  15683. }
  15684. }, 0);
  15685. }
  15686. } else {
  15687. const target = e.target;
  15688. const isFocusedInTrap = target && trapContainer.contains(target);
  15689. if (!isFocusedInTrap)
  15690. emit("focusout", e);
  15691. }
  15692. };
  15693. async function startTrap() {
  15694. await nextTick();
  15695. const trapContainer = unref(forwardRef);
  15696. if (trapContainer) {
  15697. focusableStack.push(focusLayer);
  15698. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  15699. lastFocusBeforeTrapped = prevFocusedElement;
  15700. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  15701. if (!isPrevFocusContained) {
  15702. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  15703. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  15704. trapContainer.dispatchEvent(focusEvent);
  15705. if (!focusEvent.defaultPrevented) {
  15706. nextTick(() => {
  15707. let focusStartEl = props.focusStartEl;
  15708. if (!isString$1(focusStartEl)) {
  15709. tryFocus(focusStartEl);
  15710. if (document.activeElement !== focusStartEl) {
  15711. focusStartEl = "first";
  15712. }
  15713. }
  15714. if (focusStartEl === "first") {
  15715. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  15716. }
  15717. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  15718. tryFocus(trapContainer);
  15719. }
  15720. });
  15721. }
  15722. }
  15723. }
  15724. }
  15725. function stopTrap() {
  15726. const trapContainer = unref(forwardRef);
  15727. if (trapContainer) {
  15728. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  15729. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  15730. ...FOCUS_AFTER_TRAPPED_OPTS,
  15731. detail: {
  15732. focusReason: focusReason.value
  15733. }
  15734. });
  15735. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  15736. trapContainer.dispatchEvent(releasedEvent);
  15737. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  15738. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  15739. }
  15740. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  15741. focusableStack.remove(focusLayer);
  15742. lastFocusBeforeTrapped = null;
  15743. lastFocusAfterTrapped = null;
  15744. }
  15745. }
  15746. onMounted(() => {
  15747. if (props.trapped) {
  15748. startTrap();
  15749. }
  15750. watch(() => props.trapped, (trapped) => {
  15751. if (trapped) {
  15752. startTrap();
  15753. } else {
  15754. stopTrap();
  15755. }
  15756. });
  15757. });
  15758. onBeforeUnmount(() => {
  15759. if (props.trapped) {
  15760. stopTrap();
  15761. }
  15762. if (forwardRef.value) {
  15763. forwardRef.value.removeEventListener("keydown", onKeydown);
  15764. forwardRef.value.removeEventListener("focusin", onFocusIn);
  15765. forwardRef.value.removeEventListener("focusout", onFocusOut);
  15766. forwardRef.value = void 0;
  15767. }
  15768. });
  15769. return {
  15770. onKeydown
  15771. };
  15772. }
  15773. });
  15774. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  15775. return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  15776. }
  15777. var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$2j, [["render", _sfc_render$l], ["__file", "focus-trap.vue"]]);
  15778. const popperArrowProps = buildProps({
  15779. arrowOffset: {
  15780. type: Number,
  15781. default: 5
  15782. }
  15783. });
  15784. const usePopperArrowProps = popperArrowProps;
  15785. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  15786. const popperCoreConfigProps = buildProps({
  15787. boundariesPadding: {
  15788. type: Number,
  15789. default: 0
  15790. },
  15791. fallbackPlacements: {
  15792. type: definePropType(Array),
  15793. default: void 0
  15794. },
  15795. gpuAcceleration: {
  15796. type: Boolean,
  15797. default: true
  15798. },
  15799. offset: {
  15800. type: Number,
  15801. default: 12
  15802. },
  15803. placement: {
  15804. type: String,
  15805. values: Ee,
  15806. default: "bottom"
  15807. },
  15808. popperOptions: {
  15809. type: definePropType(Object),
  15810. default: () => ({})
  15811. },
  15812. strategy: {
  15813. type: String,
  15814. values: POSITIONING_STRATEGIES,
  15815. default: "absolute"
  15816. }
  15817. });
  15818. const popperContentProps = buildProps({
  15819. ...popperCoreConfigProps,
  15820. ...popperArrowProps,
  15821. id: String,
  15822. style: {
  15823. type: definePropType([String, Array, Object])
  15824. },
  15825. className: {
  15826. type: definePropType([String, Array, Object])
  15827. },
  15828. effect: {
  15829. type: definePropType(String),
  15830. default: "dark"
  15831. },
  15832. visible: Boolean,
  15833. enterable: {
  15834. type: Boolean,
  15835. default: true
  15836. },
  15837. pure: Boolean,
  15838. focusOnShow: Boolean,
  15839. trapping: Boolean,
  15840. popperClass: {
  15841. type: definePropType([String, Array, Object])
  15842. },
  15843. popperStyle: {
  15844. type: definePropType([String, Array, Object])
  15845. },
  15846. referenceEl: {
  15847. type: definePropType(Object)
  15848. },
  15849. triggerTargetEl: {
  15850. type: definePropType(Object)
  15851. },
  15852. stopPopperMouseEvent: {
  15853. type: Boolean,
  15854. default: true
  15855. },
  15856. virtualTriggering: Boolean,
  15857. zIndex: Number,
  15858. ...useAriaProps(["ariaLabel"]),
  15859. loop: Boolean
  15860. });
  15861. const popperContentEmits = {
  15862. mouseenter: (evt) => evt instanceof MouseEvent,
  15863. mouseleave: (evt) => evt instanceof MouseEvent,
  15864. focus: () => true,
  15865. blur: () => true,
  15866. close: () => true
  15867. };
  15868. const usePopperCoreConfigProps = popperCoreConfigProps;
  15869. const usePopperContentProps = popperContentProps;
  15870. const usePopperContentEmits = popperContentEmits;
  15871. const buildPopperOptions = (props, modifiers = []) => {
  15872. const { placement, strategy, popperOptions } = props;
  15873. const options = {
  15874. placement,
  15875. strategy,
  15876. ...popperOptions,
  15877. modifiers: [...genModifiers(props), ...modifiers]
  15878. };
  15879. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  15880. return options;
  15881. };
  15882. const unwrapMeasurableEl = ($el) => {
  15883. if (!isClient)
  15884. return;
  15885. return unrefElement($el);
  15886. };
  15887. function genModifiers(options) {
  15888. const { offset, gpuAcceleration, fallbackPlacements } = options;
  15889. return [
  15890. {
  15891. name: "offset",
  15892. options: {
  15893. offset: [0, offset != null ? offset : 12]
  15894. }
  15895. },
  15896. {
  15897. name: "preventOverflow",
  15898. options: {
  15899. padding: {
  15900. top: 0,
  15901. bottom: 0,
  15902. left: 0,
  15903. right: 0
  15904. }
  15905. }
  15906. },
  15907. {
  15908. name: "flip",
  15909. options: {
  15910. padding: 5,
  15911. fallbackPlacements
  15912. }
  15913. },
  15914. {
  15915. name: "computeStyles",
  15916. options: {
  15917. gpuAcceleration
  15918. }
  15919. }
  15920. ];
  15921. }
  15922. function deriveExtraModifiers(options, modifiers) {
  15923. if (modifiers) {
  15924. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  15925. }
  15926. }
  15927. const DEFAULT_ARROW_OFFSET = 0;
  15928. const usePopperContent = (props) => {
  15929. const { popperInstanceRef, contentRef, triggerRef, role } = inject(POPPER_INJECTION_KEY, void 0);
  15930. const arrowRef = ref();
  15931. const arrowOffset = computed(() => props.arrowOffset);
  15932. const eventListenerModifier = computed(() => {
  15933. return {
  15934. name: "eventListeners",
  15935. enabled: !!props.visible
  15936. };
  15937. });
  15938. const arrowModifier = computed(() => {
  15939. var _a;
  15940. const arrowEl = unref(arrowRef);
  15941. const offset = (_a = unref(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET;
  15942. return {
  15943. name: "arrow",
  15944. enabled: !isUndefined$1(arrowEl),
  15945. options: {
  15946. element: arrowEl,
  15947. padding: offset
  15948. }
  15949. };
  15950. });
  15951. const options = computed(() => {
  15952. return {
  15953. onFirstUpdate: () => {
  15954. update();
  15955. },
  15956. ...buildPopperOptions(props, [
  15957. unref(arrowModifier),
  15958. unref(eventListenerModifier)
  15959. ])
  15960. };
  15961. });
  15962. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef));
  15963. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  15964. watch(instanceRef, (instance) => popperInstanceRef.value = instance, {
  15965. flush: "sync"
  15966. });
  15967. onMounted(() => {
  15968. watch(() => {
  15969. var _a, _b;
  15970. return (_b = (_a = unref(computedReference)) == null ? void 0 : _a.getBoundingClientRect) == null ? void 0 : _b.call(_a);
  15971. }, () => {
  15972. update();
  15973. });
  15974. });
  15975. return {
  15976. attributes,
  15977. arrowRef,
  15978. contentRef,
  15979. instanceRef,
  15980. state,
  15981. styles,
  15982. role,
  15983. forceUpdate,
  15984. update
  15985. };
  15986. };
  15987. const usePopperContentDOM = (props, {
  15988. attributes,
  15989. styles,
  15990. role
  15991. }) => {
  15992. const { nextZIndex } = useZIndex();
  15993. const ns = useNamespace("popper");
  15994. const contentAttrs = computed(() => unref(attributes).popper);
  15995. const contentZIndex = ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  15996. const contentClass = computed(() => [
  15997. ns.b(),
  15998. ns.is("pure", props.pure),
  15999. ns.is(props.effect),
  16000. props.popperClass
  16001. ]);
  16002. const contentStyle = computed(() => {
  16003. return [
  16004. { zIndex: unref(contentZIndex) },
  16005. unref(styles).popper,
  16006. props.popperStyle || {}
  16007. ];
  16008. });
  16009. const ariaModal = computed(() => role.value === "dialog" ? "false" : void 0);
  16010. const arrowStyle = computed(() => unref(styles).arrow || {});
  16011. const updateZIndex = () => {
  16012. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  16013. };
  16014. return {
  16015. ariaModal,
  16016. arrowStyle,
  16017. contentAttrs,
  16018. contentClass,
  16019. contentStyle,
  16020. contentZIndex,
  16021. updateZIndex
  16022. };
  16023. };
  16024. const usePopperContentFocusTrap = (props, emit) => {
  16025. const trapped = ref(false);
  16026. const focusStartRef = ref();
  16027. const onFocusAfterTrapped = () => {
  16028. emit("focus");
  16029. };
  16030. const onFocusAfterReleased = (event) => {
  16031. var _a;
  16032. if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
  16033. focusStartRef.value = "first";
  16034. emit("blur");
  16035. }
  16036. };
  16037. const onFocusInTrap = (event) => {
  16038. if (props.visible && !trapped.value) {
  16039. if (event.target) {
  16040. focusStartRef.value = event.target;
  16041. }
  16042. trapped.value = true;
  16043. }
  16044. };
  16045. const onFocusoutPrevented = (event) => {
  16046. if (!props.trapping) {
  16047. if (event.detail.focusReason === "pointer") {
  16048. event.preventDefault();
  16049. }
  16050. trapped.value = false;
  16051. }
  16052. };
  16053. const onReleaseRequested = () => {
  16054. trapped.value = false;
  16055. emit("close");
  16056. };
  16057. return {
  16058. focusStartRef,
  16059. trapped,
  16060. onFocusAfterReleased,
  16061. onFocusAfterTrapped,
  16062. onFocusInTrap,
  16063. onFocusoutPrevented,
  16064. onReleaseRequested
  16065. };
  16066. };
  16067. const __default__$1O = defineComponent({
  16068. name: "ElPopperContent"
  16069. });
  16070. const _sfc_main$2i = /* @__PURE__ */ defineComponent({
  16071. ...__default__$1O,
  16072. props: popperContentProps,
  16073. emits: popperContentEmits,
  16074. setup(__props, { expose, emit }) {
  16075. const props = __props;
  16076. const {
  16077. focusStartRef,
  16078. trapped,
  16079. onFocusAfterReleased,
  16080. onFocusAfterTrapped,
  16081. onFocusInTrap,
  16082. onFocusoutPrevented,
  16083. onReleaseRequested
  16084. } = usePopperContentFocusTrap(props, emit);
  16085. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  16086. const {
  16087. ariaModal,
  16088. arrowStyle,
  16089. contentAttrs,
  16090. contentClass,
  16091. contentStyle,
  16092. updateZIndex
  16093. } = usePopperContentDOM(props, {
  16094. styles,
  16095. attributes,
  16096. role
  16097. });
  16098. const formItemContext = inject(formItemContextKey, void 0);
  16099. provide(POPPER_CONTENT_INJECTION_KEY, {
  16100. arrowStyle,
  16101. arrowRef
  16102. });
  16103. if (formItemContext) {
  16104. provide(formItemContextKey, {
  16105. ...formItemContext,
  16106. addInputId: NOOP,
  16107. removeInputId: NOOP
  16108. });
  16109. }
  16110. let triggerTargetAriaStopWatch = void 0;
  16111. const updatePopper = (shouldUpdateZIndex = true) => {
  16112. update();
  16113. shouldUpdateZIndex && updateZIndex();
  16114. };
  16115. const togglePopperAlive = () => {
  16116. updatePopper(false);
  16117. if (props.visible && props.focusOnShow) {
  16118. trapped.value = true;
  16119. } else if (props.visible === false) {
  16120. trapped.value = false;
  16121. }
  16122. };
  16123. onMounted(() => {
  16124. watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  16125. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  16126. triggerTargetAriaStopWatch = void 0;
  16127. const el = unref(triggerTargetEl || contentRef.value);
  16128. const prevEl = unref(prevTriggerTargetEl || contentRef.value);
  16129. if (isElement$2(el)) {
  16130. triggerTargetAriaStopWatch = watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  16131. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  16132. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  16133. });
  16134. }, { immediate: true });
  16135. }
  16136. if (prevEl !== el && isElement$2(prevEl)) {
  16137. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  16138. prevEl.removeAttribute(key);
  16139. });
  16140. }
  16141. }, { immediate: true });
  16142. watch(() => props.visible, togglePopperAlive, { immediate: true });
  16143. });
  16144. onBeforeUnmount(() => {
  16145. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  16146. triggerTargetAriaStopWatch = void 0;
  16147. });
  16148. expose({
  16149. popperContentRef: contentRef,
  16150. popperInstanceRef: instanceRef,
  16151. updatePopper,
  16152. contentStyle
  16153. });
  16154. return (_ctx, _cache) => {
  16155. return openBlock(), createElementBlock("div", mergeProps({
  16156. ref_key: "contentRef",
  16157. ref: contentRef
  16158. }, unref(contentAttrs), {
  16159. style: unref(contentStyle),
  16160. class: unref(contentClass),
  16161. tabindex: "-1",
  16162. onMouseenter: (e) => _ctx.$emit("mouseenter", e),
  16163. onMouseleave: (e) => _ctx.$emit("mouseleave", e)
  16164. }), [
  16165. createVNode(unref(ElFocusTrap), {
  16166. loop: _ctx.loop,
  16167. trapped: unref(trapped),
  16168. "trap-on-focus-in": true,
  16169. "focus-trap-el": unref(contentRef),
  16170. "focus-start-el": unref(focusStartRef),
  16171. onFocusAfterTrapped: unref(onFocusAfterTrapped),
  16172. onFocusAfterReleased: unref(onFocusAfterReleased),
  16173. onFocusin: unref(onFocusInTrap),
  16174. onFocusoutPrevented: unref(onFocusoutPrevented),
  16175. onReleaseRequested: unref(onReleaseRequested)
  16176. }, {
  16177. default: withCtx(() => [
  16178. renderSlot(_ctx.$slots, "default")
  16179. ]),
  16180. _: 3
  16181. }, 8, ["loop", "trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  16182. ], 16, ["onMouseenter", "onMouseleave"]);
  16183. };
  16184. }
  16185. });
  16186. var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__file", "content.vue"]]);
  16187. const ElPopper = withInstall(Popper);
  16188. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  16189. const teleportProps = buildProps({
  16190. to: {
  16191. type: definePropType([String, Object]),
  16192. required: true
  16193. },
  16194. disabled: Boolean
  16195. });
  16196. const _sfc_main$2h = /* @__PURE__ */ defineComponent({
  16197. __name: "teleport",
  16198. props: teleportProps,
  16199. setup(__props) {
  16200. return (_ctx, _cache) => {
  16201. return _ctx.disabled ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createBlock(Teleport$1, {
  16202. key: 1,
  16203. to: _ctx.to
  16204. }, [
  16205. renderSlot(_ctx.$slots, "default")
  16206. ], 8, ["to"]));
  16207. };
  16208. }
  16209. });
  16210. var Teleport = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__file", "teleport.vue"]]);
  16211. const ElTeleport = withInstall(Teleport);
  16212. var ElTeleport$1 = ElTeleport;
  16213. const useTooltipContentProps = buildProps({
  16214. ...useDelayedToggleProps,
  16215. ...popperContentProps,
  16216. appendTo: {
  16217. type: teleportProps.to.type
  16218. },
  16219. content: {
  16220. type: String,
  16221. default: ""
  16222. },
  16223. rawContent: Boolean,
  16224. persistent: Boolean,
  16225. visible: {
  16226. type: definePropType(Boolean),
  16227. default: null
  16228. },
  16229. transition: String,
  16230. teleported: {
  16231. type: Boolean,
  16232. default: true
  16233. },
  16234. disabled: Boolean,
  16235. ...useAriaProps(["ariaLabel"])
  16236. });
  16237. const useTooltipTriggerProps = buildProps({
  16238. ...popperTriggerProps,
  16239. disabled: Boolean,
  16240. trigger: {
  16241. type: definePropType([String, Array]),
  16242. default: "hover"
  16243. },
  16244. triggerKeys: {
  16245. type: definePropType(Array),
  16246. default: () => [EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space]
  16247. },
  16248. focusOnTarget: Boolean
  16249. });
  16250. const {
  16251. useModelToggleProps: useTooltipModelToggleProps,
  16252. useModelToggleEmits: useTooltipModelToggleEmits,
  16253. useModelToggle: useTooltipModelToggle
  16254. } = createModelToggleComposable("visible");
  16255. const useTooltipProps = buildProps({
  16256. ...popperProps,
  16257. ...useTooltipModelToggleProps,
  16258. ...useTooltipContentProps,
  16259. ...useTooltipTriggerProps,
  16260. ...popperArrowProps,
  16261. showArrow: {
  16262. type: Boolean,
  16263. default: true
  16264. }
  16265. });
  16266. const tooltipEmits = [
  16267. ...useTooltipModelToggleEmits,
  16268. "before-show",
  16269. "before-hide",
  16270. "show",
  16271. "hide",
  16272. "open",
  16273. "close"
  16274. ];
  16275. const isTriggerType = (trigger, type) => {
  16276. if (isArray$1(trigger)) {
  16277. return trigger.includes(type);
  16278. }
  16279. return trigger === type;
  16280. };
  16281. const whenTrigger = (trigger, type, handler) => {
  16282. return (e) => {
  16283. isTriggerType(unref(trigger), type) && handler(e);
  16284. };
  16285. };
  16286. const __default__$1N = defineComponent({
  16287. name: "ElTooltipTrigger"
  16288. });
  16289. const _sfc_main$2g = /* @__PURE__ */ defineComponent({
  16290. ...__default__$1N,
  16291. props: useTooltipTriggerProps,
  16292. setup(__props, { expose }) {
  16293. const props = __props;
  16294. const ns = useNamespace("tooltip");
  16295. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  16296. const triggerRef = ref(null);
  16297. const stopWhenControlledOrDisabled = () => {
  16298. if (unref(controlled) || props.disabled) {
  16299. return true;
  16300. }
  16301. };
  16302. const trigger = toRef(props, "trigger");
  16303. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", (e) => {
  16304. onOpen(e);
  16305. if (props.focusOnTarget && e.target) {
  16306. nextTick(() => {
  16307. focusElement(e.target, { preventScroll: true });
  16308. });
  16309. }
  16310. }));
  16311. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  16312. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  16313. if (e.button === 0) {
  16314. onToggle(e);
  16315. }
  16316. }));
  16317. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  16318. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  16319. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  16320. e.preventDefault();
  16321. onToggle(e);
  16322. }));
  16323. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  16324. const code = getEventCode(e);
  16325. if (props.triggerKeys.includes(code)) {
  16326. e.preventDefault();
  16327. onToggle(e);
  16328. }
  16329. });
  16330. expose({
  16331. triggerRef
  16332. });
  16333. return (_ctx, _cache) => {
  16334. return openBlock(), createBlock(unref(ElPopperTrigger), {
  16335. id: unref(id),
  16336. "virtual-ref": _ctx.virtualRef,
  16337. open: unref(open),
  16338. "virtual-triggering": _ctx.virtualTriggering,
  16339. class: normalizeClass(unref(ns).e("trigger")),
  16340. onBlur: unref(onBlur),
  16341. onClick: unref(onClick),
  16342. onContextmenu: unref(onContextMenu),
  16343. onFocus: unref(onFocus),
  16344. onMouseenter: unref(onMouseenter),
  16345. onMouseleave: unref(onMouseleave),
  16346. onKeydown: unref(onKeydown)
  16347. }, {
  16348. default: withCtx(() => [
  16349. renderSlot(_ctx.$slots, "default")
  16350. ]),
  16351. _: 3
  16352. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  16353. };
  16354. }
  16355. });
  16356. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__file", "trigger.vue"]]);
  16357. const __default__$1M = defineComponent({
  16358. name: "ElTooltipContent",
  16359. inheritAttrs: false
  16360. });
  16361. const _sfc_main$2f = /* @__PURE__ */ defineComponent({
  16362. ...__default__$1M,
  16363. props: useTooltipContentProps,
  16364. setup(__props, { expose }) {
  16365. const props = __props;
  16366. const { selector } = usePopperContainerId();
  16367. const ns = useNamespace("tooltip");
  16368. const contentRef = ref();
  16369. const popperContentRef = computedEager(() => {
  16370. var _a;
  16371. return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  16372. });
  16373. let stopHandle;
  16374. const {
  16375. controlled,
  16376. id,
  16377. open,
  16378. trigger,
  16379. onClose,
  16380. onOpen,
  16381. onShow,
  16382. onHide,
  16383. onBeforeShow,
  16384. onBeforeHide
  16385. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  16386. const transitionClass = computed(() => {
  16387. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  16388. });
  16389. const persistentRef = computed(() => {
  16390. return props.persistent;
  16391. });
  16392. onBeforeUnmount(() => {
  16393. stopHandle == null ? void 0 : stopHandle();
  16394. });
  16395. const shouldRender = computed(() => {
  16396. return unref(persistentRef) ? true : unref(open);
  16397. });
  16398. const shouldShow = computed(() => {
  16399. return props.disabled ? false : unref(open);
  16400. });
  16401. const appendTo = computed(() => {
  16402. return props.appendTo || selector.value;
  16403. });
  16404. const contentStyle = computed(() => {
  16405. var _a;
  16406. return (_a = props.style) != null ? _a : {};
  16407. });
  16408. const ariaHidden = ref(true);
  16409. const onTransitionLeave = () => {
  16410. onHide();
  16411. isFocusInsideContent() && focusElement(document.body, { preventScroll: true });
  16412. ariaHidden.value = true;
  16413. };
  16414. const stopWhenControlled = () => {
  16415. if (unref(controlled))
  16416. return true;
  16417. };
  16418. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  16419. if (props.enterable && isTriggerType(unref(trigger), "hover")) {
  16420. onOpen();
  16421. }
  16422. });
  16423. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  16424. if (isTriggerType(unref(trigger), "hover")) {
  16425. onClose();
  16426. }
  16427. });
  16428. const onBeforeEnter = () => {
  16429. var _a, _b;
  16430. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  16431. onBeforeShow == null ? void 0 : onBeforeShow();
  16432. };
  16433. const onBeforeLeave = () => {
  16434. onBeforeHide == null ? void 0 : onBeforeHide();
  16435. };
  16436. const onAfterShow = () => {
  16437. onShow();
  16438. };
  16439. const onBlur = () => {
  16440. if (!props.virtualTriggering) {
  16441. onClose();
  16442. }
  16443. };
  16444. const isFocusInsideContent = (event) => {
  16445. var _a;
  16446. const popperContent = (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  16447. const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
  16448. return popperContent == null ? void 0 : popperContent.contains(activeElement);
  16449. };
  16450. watch(() => unref(open), (val) => {
  16451. if (!val) {
  16452. stopHandle == null ? void 0 : stopHandle();
  16453. } else {
  16454. ariaHidden.value = false;
  16455. stopHandle = onClickOutside(popperContentRef, () => {
  16456. if (unref(controlled))
  16457. return;
  16458. const needClose = castArray(unref(trigger)).every((item) => {
  16459. return item !== "hover" && item !== "focus";
  16460. });
  16461. if (needClose) {
  16462. onClose();
  16463. }
  16464. }, { detectIframe: true });
  16465. }
  16466. }, {
  16467. flush: "post"
  16468. });
  16469. watch(() => props.content, () => {
  16470. var _a, _b;
  16471. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  16472. });
  16473. expose({
  16474. contentRef,
  16475. isFocusInsideContent
  16476. });
  16477. return (_ctx, _cache) => {
  16478. return openBlock(), createBlock(unref(ElTeleport$1), {
  16479. disabled: !_ctx.teleported,
  16480. to: unref(appendTo)
  16481. }, {
  16482. default: withCtx(() => [
  16483. unref(shouldRender) || !ariaHidden.value ? (openBlock(), createBlock(Transition, {
  16484. key: 0,
  16485. name: unref(transitionClass),
  16486. appear: !unref(persistentRef),
  16487. onAfterLeave: onTransitionLeave,
  16488. onBeforeEnter,
  16489. onAfterEnter: onAfterShow,
  16490. onBeforeLeave,
  16491. persisted: ""
  16492. }, {
  16493. default: withCtx(() => [
  16494. withDirectives(createVNode(unref(ElPopperContent), mergeProps({
  16495. id: unref(id),
  16496. ref_key: "contentRef",
  16497. ref: contentRef
  16498. }, _ctx.$attrs, {
  16499. "aria-label": _ctx.ariaLabel,
  16500. "aria-hidden": ariaHidden.value,
  16501. "boundaries-padding": _ctx.boundariesPadding,
  16502. "fallback-placements": _ctx.fallbackPlacements,
  16503. "gpu-acceleration": _ctx.gpuAcceleration,
  16504. offset: _ctx.offset,
  16505. placement: _ctx.placement,
  16506. "popper-options": _ctx.popperOptions,
  16507. "arrow-offset": _ctx.arrowOffset,
  16508. strategy: _ctx.strategy,
  16509. effect: _ctx.effect,
  16510. enterable: _ctx.enterable,
  16511. pure: _ctx.pure,
  16512. "popper-class": _ctx.popperClass,
  16513. "popper-style": [_ctx.popperStyle, unref(contentStyle)],
  16514. "reference-el": _ctx.referenceEl,
  16515. "trigger-target-el": _ctx.triggerTargetEl,
  16516. visible: unref(shouldShow),
  16517. "z-index": _ctx.zIndex,
  16518. loop: _ctx.loop,
  16519. onMouseenter: unref(onContentEnter),
  16520. onMouseleave: unref(onContentLeave),
  16521. onBlur,
  16522. onClose: unref(onClose)
  16523. }), {
  16524. default: withCtx(() => [
  16525. renderSlot(_ctx.$slots, "default")
  16526. ]),
  16527. _: 3
  16528. }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "arrow-offset", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "loop", "onMouseenter", "onMouseleave", "onClose"]), [
  16529. [vShow, unref(shouldShow)]
  16530. ])
  16531. ]),
  16532. _: 3
  16533. }, 8, ["name", "appear"])) : createCommentVNode("v-if", true)
  16534. ]),
  16535. _: 3
  16536. }, 8, ["disabled", "to"]);
  16537. };
  16538. }
  16539. });
  16540. var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "content.vue"]]);
  16541. const __default__$1L = defineComponent({
  16542. name: "ElTooltip"
  16543. });
  16544. const _sfc_main$2e = /* @__PURE__ */ defineComponent({
  16545. ...__default__$1L,
  16546. props: useTooltipProps,
  16547. emits: tooltipEmits,
  16548. setup(__props, { expose, emit }) {
  16549. const props = __props;
  16550. usePopperContainer();
  16551. const ns = useNamespace("tooltip");
  16552. const id = useId();
  16553. const popperRef = ref();
  16554. const contentRef = ref();
  16555. const updatePopper = () => {
  16556. var _a;
  16557. const popperComponent = unref(popperRef);
  16558. if (popperComponent) {
  16559. (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
  16560. }
  16561. };
  16562. const open = ref(false);
  16563. const toggleReason = ref();
  16564. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  16565. indicator: open,
  16566. toggleReason
  16567. });
  16568. const { onOpen, onClose } = useDelayedToggle({
  16569. showAfter: toRef(props, "showAfter"),
  16570. hideAfter: toRef(props, "hideAfter"),
  16571. autoClose: toRef(props, "autoClose"),
  16572. open: show,
  16573. close: hide
  16574. });
  16575. const controlled = computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  16576. const kls = computed(() => {
  16577. return [ns.b(), props.popperClass];
  16578. });
  16579. provide(TOOLTIP_INJECTION_KEY, {
  16580. controlled,
  16581. id,
  16582. open: readonly(open),
  16583. trigger: toRef(props, "trigger"),
  16584. onOpen,
  16585. onClose,
  16586. onToggle: (event) => {
  16587. if (unref(open)) {
  16588. onClose(event);
  16589. } else {
  16590. onOpen(event);
  16591. }
  16592. },
  16593. onShow: () => {
  16594. emit("show", toggleReason.value);
  16595. },
  16596. onHide: () => {
  16597. emit("hide", toggleReason.value);
  16598. },
  16599. onBeforeShow: () => {
  16600. emit("before-show", toggleReason.value);
  16601. },
  16602. onBeforeHide: () => {
  16603. emit("before-hide", toggleReason.value);
  16604. },
  16605. updatePopper
  16606. });
  16607. watch(() => props.disabled, (disabled) => {
  16608. if (disabled && open.value) {
  16609. open.value = false;
  16610. }
  16611. });
  16612. const isFocusInsideContent = (event) => {
  16613. var _a;
  16614. return (_a = contentRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  16615. };
  16616. onDeactivated(() => open.value && hide());
  16617. expose({
  16618. popperRef,
  16619. contentRef,
  16620. isFocusInsideContent,
  16621. updatePopper,
  16622. onOpen,
  16623. onClose,
  16624. hide
  16625. });
  16626. return (_ctx, _cache) => {
  16627. return openBlock(), createBlock(unref(ElPopper), {
  16628. ref_key: "popperRef",
  16629. ref: popperRef,
  16630. role: _ctx.role
  16631. }, {
  16632. default: withCtx(() => [
  16633. createVNode(ElTooltipTrigger, {
  16634. disabled: _ctx.disabled,
  16635. trigger: _ctx.trigger,
  16636. "trigger-keys": _ctx.triggerKeys,
  16637. "virtual-ref": _ctx.virtualRef,
  16638. "virtual-triggering": _ctx.virtualTriggering,
  16639. "focus-on-target": _ctx.focusOnTarget
  16640. }, {
  16641. default: withCtx(() => [
  16642. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  16643. ]),
  16644. _: 3
  16645. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering", "focus-on-target"]),
  16646. createVNode(ElTooltipContent, {
  16647. ref_key: "contentRef",
  16648. ref: contentRef,
  16649. "aria-label": _ctx.ariaLabel,
  16650. "boundaries-padding": _ctx.boundariesPadding,
  16651. content: _ctx.content,
  16652. disabled: _ctx.disabled,
  16653. effect: _ctx.effect,
  16654. enterable: _ctx.enterable,
  16655. "fallback-placements": _ctx.fallbackPlacements,
  16656. "hide-after": _ctx.hideAfter,
  16657. "gpu-acceleration": _ctx.gpuAcceleration,
  16658. offset: _ctx.offset,
  16659. persistent: _ctx.persistent,
  16660. "popper-class": unref(kls),
  16661. "popper-style": _ctx.popperStyle,
  16662. placement: _ctx.placement,
  16663. "popper-options": _ctx.popperOptions,
  16664. "arrow-offset": _ctx.arrowOffset,
  16665. pure: _ctx.pure,
  16666. "raw-content": _ctx.rawContent,
  16667. "reference-el": _ctx.referenceEl,
  16668. "trigger-target-el": _ctx.triggerTargetEl,
  16669. "show-after": _ctx.showAfter,
  16670. strategy: _ctx.strategy,
  16671. teleported: _ctx.teleported,
  16672. transition: _ctx.transition,
  16673. "virtual-triggering": _ctx.virtualTriggering,
  16674. "z-index": _ctx.zIndex,
  16675. "append-to": _ctx.appendTo,
  16676. loop: _ctx.loop
  16677. }, {
  16678. default: withCtx(() => [
  16679. renderSlot(_ctx.$slots, "content", {}, () => [
  16680. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  16681. key: 0,
  16682. innerHTML: _ctx.content
  16683. }, null, 8, ["innerHTML"])) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.content), 1))
  16684. ]),
  16685. _ctx.showArrow ? (openBlock(), createBlock(unref(ElPopperArrow), { key: 0 })) : createCommentVNode("v-if", true)
  16686. ]),
  16687. _: 3
  16688. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "arrow-offset", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to", "loop"])
  16689. ]),
  16690. _: 3
  16691. }, 8, ["role"]);
  16692. };
  16693. }
  16694. });
  16695. var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__file", "tooltip.vue"]]);
  16696. const ElTooltip = withInstall(Tooltip);
  16697. const autocompleteProps = buildProps({
  16698. ...inputProps,
  16699. valueKey: {
  16700. type: String,
  16701. default: "value"
  16702. },
  16703. modelValue: {
  16704. type: [String, Number],
  16705. default: ""
  16706. },
  16707. debounce: {
  16708. type: Number,
  16709. default: 300
  16710. },
  16711. placement: {
  16712. type: definePropType(String),
  16713. values: [
  16714. "top",
  16715. "top-start",
  16716. "top-end",
  16717. "bottom",
  16718. "bottom-start",
  16719. "bottom-end"
  16720. ],
  16721. default: "bottom-start"
  16722. },
  16723. fetchSuggestions: {
  16724. type: definePropType([Function, Array]),
  16725. default: NOOP
  16726. },
  16727. popperClass: useTooltipContentProps.popperClass,
  16728. popperStyle: useTooltipContentProps.popperStyle,
  16729. triggerOnFocus: {
  16730. type: Boolean,
  16731. default: true
  16732. },
  16733. selectWhenUnmatched: Boolean,
  16734. hideLoading: Boolean,
  16735. teleported: useTooltipContentProps.teleported,
  16736. appendTo: useTooltipContentProps.appendTo,
  16737. highlightFirstItem: Boolean,
  16738. fitInputWidth: Boolean,
  16739. loopNavigation: {
  16740. type: Boolean,
  16741. default: true
  16742. }
  16743. });
  16744. const autocompleteEmits = {
  16745. [UPDATE_MODEL_EVENT]: (value) => isString$1(value) || isNumber(value),
  16746. [INPUT_EVENT]: (value) => isString$1(value) || isNumber(value),
  16747. [CHANGE_EVENT]: (value) => isString$1(value) || isNumber(value),
  16748. focus: (evt) => evt instanceof FocusEvent,
  16749. blur: (evt) => evt instanceof FocusEvent,
  16750. clear: () => true,
  16751. select: (item) => isObject$1(item)
  16752. };
  16753. const COMPONENT_NAME$j = "ElAutocomplete";
  16754. const __default__$1K = defineComponent({
  16755. name: COMPONENT_NAME$j,
  16756. inheritAttrs: false
  16757. });
  16758. const _sfc_main$2d = /* @__PURE__ */ defineComponent({
  16759. ...__default__$1K,
  16760. props: autocompleteProps,
  16761. emits: autocompleteEmits,
  16762. setup(__props, { expose, emit }) {
  16763. const props = __props;
  16764. const passInputProps = computed(() => pick(props, Object.keys(inputProps)));
  16765. const rawAttrs = useAttrs$1();
  16766. const disabled = useFormDisabled();
  16767. const ns = useNamespace("autocomplete");
  16768. const inputRef = ref();
  16769. const regionRef = ref();
  16770. const popperRef = ref();
  16771. const listboxRef = ref();
  16772. let readonly = false;
  16773. let ignoreFocusEvent = false;
  16774. const suggestions = ref([]);
  16775. const highlightedIndex = ref(-1);
  16776. const dropdownWidth = ref("");
  16777. const activated = ref(false);
  16778. const suggestionDisabled = ref(false);
  16779. const loading = ref(false);
  16780. const listboxId = useId();
  16781. const styles = computed(() => rawAttrs.style);
  16782. const suggestionVisible = computed(() => {
  16783. const isValidData = suggestions.value.length > 0;
  16784. return (isValidData || loading.value) && activated.value;
  16785. });
  16786. const suggestionLoading = computed(() => !props.hideLoading && loading.value);
  16787. const refInput = computed(() => {
  16788. if (inputRef.value) {
  16789. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  16790. }
  16791. return [];
  16792. });
  16793. const onSuggestionShow = () => {
  16794. if (suggestionVisible.value) {
  16795. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  16796. }
  16797. };
  16798. const onHide = () => {
  16799. highlightedIndex.value = -1;
  16800. };
  16801. const getData = async (queryString) => {
  16802. if (suggestionDisabled.value)
  16803. return;
  16804. const cb = (suggestionList) => {
  16805. loading.value = false;
  16806. if (suggestionDisabled.value)
  16807. return;
  16808. if (isArray$1(suggestionList)) {
  16809. suggestions.value = suggestionList;
  16810. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  16811. } else {
  16812. throwError(COMPONENT_NAME$j, "autocomplete suggestions must be an array");
  16813. }
  16814. };
  16815. loading.value = true;
  16816. if (isArray$1(props.fetchSuggestions)) {
  16817. cb(props.fetchSuggestions);
  16818. } else {
  16819. const result = await props.fetchSuggestions(queryString, cb);
  16820. if (isArray$1(result))
  16821. cb(result);
  16822. }
  16823. };
  16824. const debounce = computed(() => props.debounce);
  16825. const debouncedGetData = useDebounceFn(getData, debounce);
  16826. const handleInput = (value) => {
  16827. const valuePresented = !!value;
  16828. emit(INPUT_EVENT, value);
  16829. emit(UPDATE_MODEL_EVENT, value);
  16830. suggestionDisabled.value = false;
  16831. activated.value || (activated.value = valuePresented);
  16832. if (!props.triggerOnFocus && !value) {
  16833. suggestionDisabled.value = true;
  16834. suggestions.value = [];
  16835. return;
  16836. }
  16837. debouncedGetData(value);
  16838. };
  16839. const handleMouseDown = (event) => {
  16840. var _a;
  16841. if (disabled.value)
  16842. return;
  16843. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  16844. activated.value = true;
  16845. }
  16846. };
  16847. const handleChange = (value) => {
  16848. emit(CHANGE_EVENT, value);
  16849. };
  16850. const handleFocus = (evt) => {
  16851. var _a;
  16852. if (!ignoreFocusEvent) {
  16853. activated.value = true;
  16854. emit("focus", evt);
  16855. const queryString = (_a = props.modelValue) != null ? _a : "";
  16856. if (props.triggerOnFocus && !readonly) {
  16857. debouncedGetData(String(queryString));
  16858. }
  16859. } else {
  16860. ignoreFocusEvent = false;
  16861. }
  16862. };
  16863. const handleBlur = (evt) => {
  16864. setTimeout(() => {
  16865. var _a;
  16866. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) {
  16867. ignoreFocusEvent = true;
  16868. return;
  16869. }
  16870. activated.value && close();
  16871. emit("blur", evt);
  16872. });
  16873. };
  16874. const handleClear = () => {
  16875. activated.value = false;
  16876. emit(UPDATE_MODEL_EVENT, "");
  16877. emit("clear");
  16878. };
  16879. const handleKeyEnter = async () => {
  16880. var _a;
  16881. if ((_a = inputRef.value) == null ? void 0 : _a.isComposing) {
  16882. return;
  16883. }
  16884. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  16885. handleSelect(suggestions.value[highlightedIndex.value]);
  16886. } else {
  16887. if (props.selectWhenUnmatched) {
  16888. emit("select", { value: props.modelValue });
  16889. suggestions.value = [];
  16890. highlightedIndex.value = -1;
  16891. }
  16892. activated.value = true;
  16893. debouncedGetData(String(props.modelValue));
  16894. }
  16895. };
  16896. const handleKeyEscape = (evt) => {
  16897. if (suggestionVisible.value) {
  16898. evt.preventDefault();
  16899. evt.stopPropagation();
  16900. close();
  16901. }
  16902. };
  16903. const close = () => {
  16904. activated.value = false;
  16905. };
  16906. const focus = () => {
  16907. var _a;
  16908. (_a = inputRef.value) == null ? void 0 : _a.focus();
  16909. };
  16910. const blur = () => {
  16911. var _a;
  16912. (_a = inputRef.value) == null ? void 0 : _a.blur();
  16913. };
  16914. const handleSelect = async (item) => {
  16915. emit(INPUT_EVENT, item[props.valueKey]);
  16916. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  16917. emit("select", item);
  16918. suggestions.value = [];
  16919. highlightedIndex.value = -1;
  16920. };
  16921. const highlight = (index) => {
  16922. var _a, _b;
  16923. if (!suggestionVisible.value || loading.value)
  16924. return;
  16925. if (index < 0) {
  16926. if (!props.loopNavigation) {
  16927. highlightedIndex.value = -1;
  16928. return;
  16929. }
  16930. index = suggestions.value.length - 1;
  16931. }
  16932. if (index >= suggestions.value.length) {
  16933. index = props.loopNavigation ? 0 : suggestions.value.length - 1;
  16934. }
  16935. const [suggestion, suggestionList] = getSuggestionContext();
  16936. const highlightItem = suggestionList[index];
  16937. const scrollTop = suggestion.scrollTop;
  16938. const { offsetTop, scrollHeight } = highlightItem;
  16939. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  16940. suggestion.scrollTop = offsetTop + scrollHeight - suggestion.clientHeight;
  16941. }
  16942. if (offsetTop < scrollTop) {
  16943. suggestion.scrollTop = offsetTop;
  16944. }
  16945. highlightedIndex.value = index;
  16946. (_b = (_a = inputRef.value) == null ? void 0 : _a.ref) == null ? void 0 : _b.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  16947. };
  16948. const getSuggestionContext = () => {
  16949. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  16950. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  16951. return [suggestion, suggestionList];
  16952. };
  16953. const stopHandle = onClickOutside(listboxRef, () => {
  16954. var _a;
  16955. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent())
  16956. return;
  16957. suggestionVisible.value && close();
  16958. });
  16959. const handleKeydown = (e) => {
  16960. const code = getEventCode(e);
  16961. switch (code) {
  16962. case EVENT_CODE.up:
  16963. e.preventDefault();
  16964. highlight(highlightedIndex.value - 1);
  16965. break;
  16966. case EVENT_CODE.down:
  16967. e.preventDefault();
  16968. highlight(highlightedIndex.value + 1);
  16969. break;
  16970. case EVENT_CODE.enter:
  16971. e.preventDefault();
  16972. handleKeyEnter();
  16973. break;
  16974. case EVENT_CODE.tab:
  16975. close();
  16976. break;
  16977. case EVENT_CODE.esc:
  16978. handleKeyEscape(e);
  16979. break;
  16980. case EVENT_CODE.home:
  16981. e.preventDefault();
  16982. highlight(0);
  16983. break;
  16984. case EVENT_CODE.end:
  16985. e.preventDefault();
  16986. highlight(suggestions.value.length - 1);
  16987. break;
  16988. case EVENT_CODE.pageUp:
  16989. e.preventDefault();
  16990. highlight(Math.max(0, highlightedIndex.value - 10));
  16991. break;
  16992. case EVENT_CODE.pageDown:
  16993. e.preventDefault();
  16994. highlight(Math.min(suggestions.value.length - 1, highlightedIndex.value + 10));
  16995. break;
  16996. }
  16997. };
  16998. onBeforeUnmount(() => {
  16999. stopHandle == null ? void 0 : stopHandle();
  17000. });
  17001. onMounted(() => {
  17002. var _a;
  17003. const inputElement = (_a = inputRef.value) == null ? void 0 : _a.ref;
  17004. if (!inputElement)
  17005. return;
  17006. [
  17007. { key: "role", value: "textbox" },
  17008. { key: "aria-autocomplete", value: "list" },
  17009. { key: "aria-controls", value: "id" },
  17010. {
  17011. key: "aria-activedescendant",
  17012. value: `${listboxId.value}-item-${highlightedIndex.value}`
  17013. }
  17014. ].forEach(({ key, value }) => inputElement.setAttribute(key, value));
  17015. readonly = inputElement.hasAttribute("readonly");
  17016. });
  17017. expose({
  17018. highlightedIndex,
  17019. activated,
  17020. loading,
  17021. inputRef,
  17022. popperRef,
  17023. suggestions,
  17024. handleSelect,
  17025. handleKeyEnter,
  17026. focus,
  17027. blur,
  17028. close,
  17029. highlight,
  17030. getData
  17031. });
  17032. return (_ctx, _cache) => {
  17033. return openBlock(), createBlock(unref(ElTooltip), {
  17034. ref_key: "popperRef",
  17035. ref: popperRef,
  17036. visible: unref(suggestionVisible),
  17037. placement: _ctx.placement,
  17038. "fallback-placements": ["bottom-start", "top-start"],
  17039. "popper-class": [unref(ns).e("popper"), _ctx.popperClass],
  17040. "popper-style": _ctx.popperStyle,
  17041. teleported: _ctx.teleported,
  17042. "append-to": _ctx.appendTo,
  17043. "gpu-acceleration": false,
  17044. pure: "",
  17045. "manual-mode": "",
  17046. effect: "light",
  17047. trigger: "click",
  17048. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  17049. persistent: "",
  17050. role: "listbox",
  17051. onBeforeShow: onSuggestionShow,
  17052. onHide
  17053. }, {
  17054. content: withCtx(() => [
  17055. createElementVNode("div", {
  17056. ref_key: "regionRef",
  17057. ref: regionRef,
  17058. class: normalizeClass([unref(ns).b("suggestion"), unref(ns).is("loading", unref(suggestionLoading))]),
  17059. style: normalizeStyle({
  17060. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  17061. outline: "none"
  17062. }),
  17063. role: "region"
  17064. }, [
  17065. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  17066. key: 0,
  17067. class: normalizeClass(unref(ns).be("suggestion", "header")),
  17068. onClick: withModifiers(() => {
  17069. }, ["stop"])
  17070. }, [
  17071. renderSlot(_ctx.$slots, "header")
  17072. ], 10, ["onClick"])) : createCommentVNode("v-if", true),
  17073. createVNode(unref(ElScrollbar), {
  17074. id: unref(listboxId),
  17075. tag: "ul",
  17076. "wrap-class": unref(ns).be("suggestion", "wrap"),
  17077. "view-class": unref(ns).be("suggestion", "list"),
  17078. role: "listbox"
  17079. }, {
  17080. default: withCtx(() => [
  17081. unref(suggestionLoading) ? (openBlock(), createElementBlock("li", { key: 0 }, [
  17082. renderSlot(_ctx.$slots, "loading", {}, () => [
  17083. createVNode(unref(ElIcon), {
  17084. class: normalizeClass(unref(ns).is("loading"))
  17085. }, {
  17086. default: withCtx(() => [
  17087. createVNode(unref(loading_default))
  17088. ]),
  17089. _: 1
  17090. }, 8, ["class"])
  17091. ])
  17092. ])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(suggestions.value, (item, index) => {
  17093. return openBlock(), createElementBlock("li", {
  17094. id: `${unref(listboxId)}-item-${index}`,
  17095. key: index,
  17096. class: normalizeClass({ highlighted: highlightedIndex.value === index }),
  17097. role: "option",
  17098. "aria-selected": highlightedIndex.value === index,
  17099. onClick: ($event) => handleSelect(item)
  17100. }, [
  17101. renderSlot(_ctx.$slots, "default", { item }, () => [
  17102. createTextVNode(toDisplayString(item[_ctx.valueKey]), 1)
  17103. ])
  17104. ], 10, ["id", "aria-selected", "onClick"]);
  17105. }), 128))
  17106. ]),
  17107. _: 3
  17108. }, 8, ["id", "wrap-class", "view-class"]),
  17109. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  17110. key: 1,
  17111. class: normalizeClass(unref(ns).be("suggestion", "footer")),
  17112. onClick: withModifiers(() => {
  17113. }, ["stop"])
  17114. }, [
  17115. renderSlot(_ctx.$slots, "footer")
  17116. ], 10, ["onClick"])) : createCommentVNode("v-if", true)
  17117. ], 6)
  17118. ]),
  17119. default: withCtx(() => [
  17120. createElementVNode("div", {
  17121. ref_key: "listboxRef",
  17122. ref: listboxRef,
  17123. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  17124. style: normalizeStyle(unref(styles)),
  17125. role: "combobox",
  17126. "aria-haspopup": "listbox",
  17127. "aria-expanded": unref(suggestionVisible),
  17128. "aria-owns": unref(listboxId)
  17129. }, [
  17130. createVNode(unref(ElInput), mergeProps({
  17131. ref_key: "inputRef",
  17132. ref: inputRef
  17133. }, mergeProps(unref(passInputProps), _ctx.$attrs), {
  17134. "model-value": _ctx.modelValue,
  17135. disabled: unref(disabled),
  17136. onInput: handleInput,
  17137. onChange: handleChange,
  17138. onFocus: handleFocus,
  17139. onBlur: handleBlur,
  17140. onClear: handleClear,
  17141. onKeydown: handleKeydown,
  17142. onMousedown: handleMouseDown
  17143. }), createSlots({
  17144. _: 2
  17145. }, [
  17146. _ctx.$slots.prepend ? {
  17147. name: "prepend",
  17148. fn: withCtx(() => [
  17149. renderSlot(_ctx.$slots, "prepend")
  17150. ])
  17151. } : void 0,
  17152. _ctx.$slots.append ? {
  17153. name: "append",
  17154. fn: withCtx(() => [
  17155. renderSlot(_ctx.$slots, "append")
  17156. ])
  17157. } : void 0,
  17158. _ctx.$slots.prefix ? {
  17159. name: "prefix",
  17160. fn: withCtx(() => [
  17161. renderSlot(_ctx.$slots, "prefix")
  17162. ])
  17163. } : void 0,
  17164. _ctx.$slots.suffix ? {
  17165. name: "suffix",
  17166. fn: withCtx(() => [
  17167. renderSlot(_ctx.$slots, "suffix")
  17168. ])
  17169. } : void 0
  17170. ]), 1040, ["model-value", "disabled"])
  17171. ], 14, ["aria-expanded", "aria-owns"])
  17172. ]),
  17173. _: 3
  17174. }, 8, ["visible", "placement", "popper-class", "popper-style", "teleported", "append-to", "transition"]);
  17175. };
  17176. }
  17177. });
  17178. var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "autocomplete.vue"]]);
  17179. const ElAutocomplete = withInstall(Autocomplete);
  17180. const avatarProps = buildProps({
  17181. size: {
  17182. type: [Number, String],
  17183. values: componentSizes,
  17184. default: "",
  17185. validator: (val) => isNumber(val)
  17186. },
  17187. shape: {
  17188. type: String,
  17189. values: ["circle", "square"],
  17190. default: "circle"
  17191. },
  17192. icon: {
  17193. type: iconPropType
  17194. },
  17195. src: {
  17196. type: String,
  17197. default: ""
  17198. },
  17199. alt: String,
  17200. srcSet: String,
  17201. fit: {
  17202. type: definePropType(String),
  17203. default: "cover"
  17204. }
  17205. });
  17206. const avatarEmits = {
  17207. error: (evt) => evt instanceof Event
  17208. };
  17209. const __default__$1J = defineComponent({
  17210. name: "ElAvatar"
  17211. });
  17212. const _sfc_main$2c = /* @__PURE__ */ defineComponent({
  17213. ...__default__$1J,
  17214. props: avatarProps,
  17215. emits: avatarEmits,
  17216. setup(__props, { emit }) {
  17217. const props = __props;
  17218. const ns = useNamespace("avatar");
  17219. const hasLoadError = ref(false);
  17220. const avatarClass = computed(() => {
  17221. const { size, icon, shape } = props;
  17222. const classList = [ns.b()];
  17223. if (isString$1(size))
  17224. classList.push(ns.m(size));
  17225. if (icon)
  17226. classList.push(ns.m("icon"));
  17227. if (shape)
  17228. classList.push(ns.m(shape));
  17229. return classList;
  17230. });
  17231. const sizeStyle = computed(() => {
  17232. const { size } = props;
  17233. return isNumber(size) ? ns.cssVarBlock({
  17234. size: addUnit(size) || ""
  17235. }) : void 0;
  17236. });
  17237. const fitStyle = computed(() => ({
  17238. objectFit: props.fit
  17239. }));
  17240. watch(() => props.src, () => hasLoadError.value = false);
  17241. function handleError(e) {
  17242. hasLoadError.value = true;
  17243. emit("error", e);
  17244. }
  17245. return (_ctx, _cache) => {
  17246. return openBlock(), createElementBlock("span", {
  17247. class: normalizeClass(unref(avatarClass)),
  17248. style: normalizeStyle(unref(sizeStyle))
  17249. }, [
  17250. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
  17251. key: 0,
  17252. src: _ctx.src,
  17253. alt: _ctx.alt,
  17254. srcset: _ctx.srcSet,
  17255. style: normalizeStyle(unref(fitStyle)),
  17256. onError: handleError
  17257. }, null, 44, ["src", "alt", "srcset"])) : _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  17258. default: withCtx(() => [
  17259. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  17260. ]),
  17261. _: 1
  17262. })) : renderSlot(_ctx.$slots, "default", { key: 2 })
  17263. ], 6);
  17264. };
  17265. }
  17266. });
  17267. var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "avatar.vue"]]);
  17268. const ElAvatar = withInstall(Avatar);
  17269. const backtopProps = {
  17270. visibilityHeight: {
  17271. type: Number,
  17272. default: 200
  17273. },
  17274. target: {
  17275. type: String,
  17276. default: ""
  17277. },
  17278. right: {
  17279. type: Number,
  17280. default: 40
  17281. },
  17282. bottom: {
  17283. type: Number,
  17284. default: 40
  17285. }
  17286. };
  17287. const backtopEmits = {
  17288. click: (evt) => evt instanceof MouseEvent
  17289. };
  17290. const useBackTop = (props, emit, componentName) => {
  17291. const el = shallowRef();
  17292. const container = shallowRef();
  17293. const visible = ref(false);
  17294. const handleScroll = () => {
  17295. if (el.value)
  17296. visible.value = el.value.scrollTop >= props.visibilityHeight;
  17297. };
  17298. const handleClick = (event) => {
  17299. var _a;
  17300. (_a = el.value) == null ? void 0 : _a.scrollTo({ top: 0, behavior: "smooth" });
  17301. emit("click", event);
  17302. };
  17303. const handleScrollThrottled = useThrottleFn(handleScroll, 300, true);
  17304. useEventListener(container, "scroll", handleScrollThrottled);
  17305. onMounted(() => {
  17306. var _a;
  17307. container.value = document;
  17308. el.value = document.documentElement;
  17309. if (props.target) {
  17310. el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  17311. if (!el.value) {
  17312. throwError(componentName, `target does not exist: ${props.target}`);
  17313. }
  17314. container.value = el.value;
  17315. }
  17316. handleScroll();
  17317. });
  17318. return {
  17319. visible,
  17320. handleClick
  17321. };
  17322. };
  17323. const COMPONENT_NAME$i = "ElBacktop";
  17324. const __default__$1I = defineComponent({
  17325. name: COMPONENT_NAME$i
  17326. });
  17327. const _sfc_main$2b = /* @__PURE__ */ defineComponent({
  17328. ...__default__$1I,
  17329. props: backtopProps,
  17330. emits: backtopEmits,
  17331. setup(__props, { emit }) {
  17332. const props = __props;
  17333. const ns = useNamespace("backtop");
  17334. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$i);
  17335. const backTopStyle = computed(() => ({
  17336. right: `${props.right}px`,
  17337. bottom: `${props.bottom}px`
  17338. }));
  17339. return (_ctx, _cache) => {
  17340. return openBlock(), createBlock(Transition, {
  17341. name: `${unref(ns).namespace.value}-fade-in`
  17342. }, {
  17343. default: withCtx(() => [
  17344. unref(visible) ? (openBlock(), createElementBlock("div", {
  17345. key: 0,
  17346. style: normalizeStyle(unref(backTopStyle)),
  17347. class: normalizeClass(unref(ns).b()),
  17348. onClick: withModifiers(unref(handleClick), ["stop"])
  17349. }, [
  17350. renderSlot(_ctx.$slots, "default", {}, () => [
  17351. createVNode(unref(ElIcon), {
  17352. class: normalizeClass(unref(ns).e("icon"))
  17353. }, {
  17354. default: withCtx(() => [
  17355. createVNode(unref(caret_top_default))
  17356. ]),
  17357. _: 1
  17358. }, 8, ["class"])
  17359. ])
  17360. ], 14, ["onClick"])) : createCommentVNode("v-if", true)
  17361. ]),
  17362. _: 3
  17363. }, 8, ["name"]);
  17364. };
  17365. }
  17366. });
  17367. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "backtop.vue"]]);
  17368. const ElBacktop = withInstall(Backtop);
  17369. const badgeProps = buildProps({
  17370. value: {
  17371. type: [String, Number],
  17372. default: ""
  17373. },
  17374. max: {
  17375. type: Number,
  17376. default: 99
  17377. },
  17378. isDot: Boolean,
  17379. hidden: Boolean,
  17380. type: {
  17381. type: String,
  17382. values: ["primary", "success", "warning", "info", "danger"],
  17383. default: "danger"
  17384. },
  17385. showZero: {
  17386. type: Boolean,
  17387. default: true
  17388. },
  17389. color: String,
  17390. badgeStyle: {
  17391. type: definePropType([String, Object, Array])
  17392. },
  17393. offset: {
  17394. type: definePropType(Array),
  17395. default: [0, 0]
  17396. },
  17397. badgeClass: {
  17398. type: String
  17399. }
  17400. });
  17401. const __default__$1H = defineComponent({
  17402. name: "ElBadge"
  17403. });
  17404. const _sfc_main$2a = /* @__PURE__ */ defineComponent({
  17405. ...__default__$1H,
  17406. props: badgeProps,
  17407. setup(__props, { expose }) {
  17408. const props = __props;
  17409. const ns = useNamespace("badge");
  17410. const content = computed(() => {
  17411. if (props.isDot)
  17412. return "";
  17413. if (isNumber(props.value) && isNumber(props.max)) {
  17414. return props.max < props.value ? `${props.max}+` : `${props.value}`;
  17415. }
  17416. return `${props.value}`;
  17417. });
  17418. const style = computed(() => {
  17419. var _a, _b, _c, _d, _e;
  17420. return [
  17421. {
  17422. backgroundColor: props.color,
  17423. marginRight: addUnit(-((_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : 0)),
  17424. marginTop: addUnit((_d = (_c = props.offset) == null ? void 0 : _c[1]) != null ? _d : 0)
  17425. },
  17426. (_e = props.badgeStyle) != null ? _e : {}
  17427. ];
  17428. });
  17429. expose({
  17430. content
  17431. });
  17432. return (_ctx, _cache) => {
  17433. return openBlock(), createElementBlock("div", {
  17434. class: normalizeClass(unref(ns).b())
  17435. }, [
  17436. renderSlot(_ctx.$slots, "default"),
  17437. createVNode(Transition, {
  17438. name: `${unref(ns).namespace.value}-zoom-in-center`,
  17439. persisted: ""
  17440. }, {
  17441. default: withCtx(() => [
  17442. withDirectives(createElementVNode("sup", {
  17443. class: normalizeClass([
  17444. unref(ns).e("content"),
  17445. unref(ns).em("content", _ctx.type),
  17446. unref(ns).is("fixed", !!_ctx.$slots.default),
  17447. unref(ns).is("dot", _ctx.isDot),
  17448. unref(ns).is("hide-zero", !_ctx.showZero && _ctx.value === 0),
  17449. _ctx.badgeClass
  17450. ]),
  17451. style: normalizeStyle(unref(style))
  17452. }, [
  17453. renderSlot(_ctx.$slots, "content", { value: unref(content) }, () => [
  17454. createTextVNode(toDisplayString(unref(content)), 1)
  17455. ])
  17456. ], 6), [
  17457. [vShow, !_ctx.hidden && (unref(content) || _ctx.isDot || _ctx.$slots.content)]
  17458. ])
  17459. ]),
  17460. _: 3
  17461. }, 8, ["name"])
  17462. ], 2);
  17463. };
  17464. }
  17465. });
  17466. var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "badge.vue"]]);
  17467. const ElBadge = withInstall(Badge);
  17468. const breadcrumbKey = Symbol("breadcrumbKey");
  17469. const breadcrumbProps = buildProps({
  17470. separator: {
  17471. type: String,
  17472. default: "/"
  17473. },
  17474. separatorIcon: {
  17475. type: iconPropType
  17476. }
  17477. });
  17478. const __default__$1G = defineComponent({
  17479. name: "ElBreadcrumb"
  17480. });
  17481. const _sfc_main$29 = /* @__PURE__ */ defineComponent({
  17482. ...__default__$1G,
  17483. props: breadcrumbProps,
  17484. setup(__props) {
  17485. const props = __props;
  17486. const { t } = useLocale();
  17487. const ns = useNamespace("breadcrumb");
  17488. const breadcrumb = ref();
  17489. provide(breadcrumbKey, props);
  17490. onMounted(() => {
  17491. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  17492. if (items.length) {
  17493. items[items.length - 1].setAttribute("aria-current", "page");
  17494. }
  17495. });
  17496. return (_ctx, _cache) => {
  17497. return openBlock(), createElementBlock("div", {
  17498. ref_key: "breadcrumb",
  17499. ref: breadcrumb,
  17500. class: normalizeClass(unref(ns).b()),
  17501. "aria-label": unref(t)("el.breadcrumb.label"),
  17502. role: "navigation"
  17503. }, [
  17504. renderSlot(_ctx.$slots, "default")
  17505. ], 10, ["aria-label"]);
  17506. };
  17507. }
  17508. });
  17509. var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "breadcrumb.vue"]]);
  17510. const breadcrumbItemProps = buildProps({
  17511. to: {
  17512. type: definePropType([String, Object]),
  17513. default: ""
  17514. },
  17515. replace: Boolean
  17516. });
  17517. const __default__$1F = defineComponent({
  17518. name: "ElBreadcrumbItem"
  17519. });
  17520. const _sfc_main$28 = /* @__PURE__ */ defineComponent({
  17521. ...__default__$1F,
  17522. props: breadcrumbItemProps,
  17523. setup(__props) {
  17524. const props = __props;
  17525. const instance = getCurrentInstance();
  17526. const breadcrumbContext = inject(breadcrumbKey, void 0);
  17527. const ns = useNamespace("breadcrumb");
  17528. const router = instance.appContext.config.globalProperties.$router;
  17529. const link = ref();
  17530. const onClick = () => {
  17531. if (!props.to || !router)
  17532. return;
  17533. props.replace ? router.replace(props.to) : router.push(props.to);
  17534. };
  17535. return (_ctx, _cache) => {
  17536. var _a, _b;
  17537. return openBlock(), createElementBlock("span", {
  17538. class: normalizeClass(unref(ns).e("item"))
  17539. }, [
  17540. createElementVNode("span", {
  17541. ref_key: "link",
  17542. ref: link,
  17543. class: normalizeClass([unref(ns).e("inner"), unref(ns).is("link", !!_ctx.to)]),
  17544. role: "link",
  17545. onClick
  17546. }, [
  17547. renderSlot(_ctx.$slots, "default")
  17548. ], 2),
  17549. ((_a = unref(breadcrumbContext)) == null ? void 0 : _a.separatorIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  17550. key: 0,
  17551. class: normalizeClass(unref(ns).e("separator"))
  17552. }, {
  17553. default: withCtx(() => [
  17554. (openBlock(), createBlock(resolveDynamicComponent(unref(breadcrumbContext).separatorIcon)))
  17555. ]),
  17556. _: 1
  17557. }, 8, ["class"])) : (openBlock(), createElementBlock("span", {
  17558. key: 1,
  17559. class: normalizeClass(unref(ns).e("separator")),
  17560. role: "presentation"
  17561. }, toDisplayString((_b = unref(breadcrumbContext)) == null ? void 0 : _b.separator), 3))
  17562. ], 2);
  17563. };
  17564. }
  17565. });
  17566. var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "breadcrumb-item.vue"]]);
  17567. const ElBreadcrumb = withInstall(Breadcrumb, {
  17568. BreadcrumbItem
  17569. });
  17570. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  17571. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  17572. const useButton = (props, emit) => {
  17573. useDeprecated({
  17574. from: "type.text",
  17575. replacement: "link",
  17576. version: "3.0.0",
  17577. scope: "props",
  17578. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  17579. }, computed(() => props.type === "text"));
  17580. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  17581. const globalConfig = useGlobalConfig("button");
  17582. const { form } = useFormItem();
  17583. const _size = useFormSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  17584. const _disabled = useFormDisabled();
  17585. const _ref = ref();
  17586. const slots = useSlots();
  17587. const _type = computed(() => {
  17588. var _a;
  17589. return props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || ((_a = globalConfig.value) == null ? void 0 : _a.type) || "";
  17590. });
  17591. const autoInsertSpace = computed(() => {
  17592. var _a, _b, _c;
  17593. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
  17594. });
  17595. const _plain = computed(() => {
  17596. var _a, _b, _c;
  17597. return (_c = (_b = props.plain) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.plain) != null ? _c : false;
  17598. });
  17599. const _round = computed(() => {
  17600. var _a, _b, _c;
  17601. return (_c = (_b = props.round) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.round) != null ? _c : false;
  17602. });
  17603. const _text = computed(() => {
  17604. var _a, _b, _c;
  17605. return (_c = (_b = props.text) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.text) != null ? _c : false;
  17606. });
  17607. const _props = computed(() => {
  17608. if (props.tag === "button") {
  17609. return {
  17610. ariaDisabled: _disabled.value || props.loading,
  17611. disabled: _disabled.value || props.loading,
  17612. autofocus: props.autofocus,
  17613. type: props.nativeType
  17614. };
  17615. }
  17616. return {};
  17617. });
  17618. const shouldAddSpace = computed(() => {
  17619. var _a;
  17620. const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
  17621. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  17622. const slot = defaultSlot[0];
  17623. if ((slot == null ? void 0 : slot.type) === Text$1) {
  17624. const text = slot.children;
  17625. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  17626. }
  17627. }
  17628. return false;
  17629. });
  17630. const handleClick = (evt) => {
  17631. if (_disabled.value || props.loading) {
  17632. evt.stopPropagation();
  17633. return;
  17634. }
  17635. if (props.nativeType === "reset") {
  17636. form == null ? void 0 : form.resetFields();
  17637. }
  17638. emit("click", evt);
  17639. };
  17640. return {
  17641. _disabled,
  17642. _size,
  17643. _type,
  17644. _ref,
  17645. _props,
  17646. _plain,
  17647. _round,
  17648. _text,
  17649. shouldAddSpace,
  17650. handleClick
  17651. };
  17652. };
  17653. const buttonTypes = [
  17654. "default",
  17655. "primary",
  17656. "success",
  17657. "warning",
  17658. "info",
  17659. "danger",
  17660. "text",
  17661. ""
  17662. ];
  17663. const buttonNativeTypes = ["button", "submit", "reset"];
  17664. const buttonProps = buildProps({
  17665. size: useSizeProp,
  17666. disabled: Boolean,
  17667. type: {
  17668. type: String,
  17669. values: buttonTypes,
  17670. default: ""
  17671. },
  17672. icon: {
  17673. type: iconPropType
  17674. },
  17675. nativeType: {
  17676. type: String,
  17677. values: buttonNativeTypes,
  17678. default: "button"
  17679. },
  17680. loading: Boolean,
  17681. loadingIcon: {
  17682. type: iconPropType,
  17683. default: () => loading_default
  17684. },
  17685. plain: {
  17686. type: Boolean,
  17687. default: void 0
  17688. },
  17689. text: {
  17690. type: Boolean,
  17691. default: void 0
  17692. },
  17693. link: Boolean,
  17694. bg: Boolean,
  17695. autofocus: Boolean,
  17696. round: {
  17697. type: Boolean,
  17698. default: void 0
  17699. },
  17700. circle: Boolean,
  17701. color: String,
  17702. dark: Boolean,
  17703. autoInsertSpace: {
  17704. type: Boolean,
  17705. default: void 0
  17706. },
  17707. tag: {
  17708. type: definePropType([String, Object]),
  17709. default: "button"
  17710. }
  17711. });
  17712. const buttonEmits = {
  17713. click: (evt) => evt instanceof MouseEvent
  17714. };
  17715. function bound01(n, max) {
  17716. if (isOnePointZero(n)) {
  17717. n = "100%";
  17718. }
  17719. var isPercent = isPercentage(n);
  17720. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  17721. if (isPercent) {
  17722. n = parseInt(String(n * max), 10) / 100;
  17723. }
  17724. if (Math.abs(n - max) < 1e-6) {
  17725. return 1;
  17726. }
  17727. if (max === 360) {
  17728. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  17729. } else {
  17730. n = n % max / parseFloat(String(max));
  17731. }
  17732. return n;
  17733. }
  17734. function clamp01(val) {
  17735. return Math.min(1, Math.max(0, val));
  17736. }
  17737. function isOnePointZero(n) {
  17738. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  17739. }
  17740. function isPercentage(n) {
  17741. return typeof n === "string" && n.indexOf("%") !== -1;
  17742. }
  17743. function boundAlpha(a) {
  17744. a = parseFloat(a);
  17745. if (isNaN(a) || a < 0 || a > 1) {
  17746. a = 1;
  17747. }
  17748. return a;
  17749. }
  17750. function convertToPercentage(n) {
  17751. if (n <= 1) {
  17752. return "".concat(Number(n) * 100, "%");
  17753. }
  17754. return n;
  17755. }
  17756. function pad2(c) {
  17757. return c.length === 1 ? "0" + c : String(c);
  17758. }
  17759. function rgbToRgb(r, g, b) {
  17760. return {
  17761. r: bound01(r, 255) * 255,
  17762. g: bound01(g, 255) * 255,
  17763. b: bound01(b, 255) * 255
  17764. };
  17765. }
  17766. function rgbToHsl(r, g, b) {
  17767. r = bound01(r, 255);
  17768. g = bound01(g, 255);
  17769. b = bound01(b, 255);
  17770. var max = Math.max(r, g, b);
  17771. var min = Math.min(r, g, b);
  17772. var h = 0;
  17773. var s = 0;
  17774. var l = (max + min) / 2;
  17775. if (max === min) {
  17776. s = 0;
  17777. h = 0;
  17778. } else {
  17779. var d = max - min;
  17780. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  17781. switch (max) {
  17782. case r:
  17783. h = (g - b) / d + (g < b ? 6 : 0);
  17784. break;
  17785. case g:
  17786. h = (b - r) / d + 2;
  17787. break;
  17788. case b:
  17789. h = (r - g) / d + 4;
  17790. break;
  17791. }
  17792. h /= 6;
  17793. }
  17794. return { h, s, l };
  17795. }
  17796. function hue2rgb(p, q, t) {
  17797. if (t < 0) {
  17798. t += 1;
  17799. }
  17800. if (t > 1) {
  17801. t -= 1;
  17802. }
  17803. if (t < 1 / 6) {
  17804. return p + (q - p) * (6 * t);
  17805. }
  17806. if (t < 1 / 2) {
  17807. return q;
  17808. }
  17809. if (t < 2 / 3) {
  17810. return p + (q - p) * (2 / 3 - t) * 6;
  17811. }
  17812. return p;
  17813. }
  17814. function hslToRgb(h, s, l) {
  17815. var r;
  17816. var g;
  17817. var b;
  17818. h = bound01(h, 360);
  17819. s = bound01(s, 100);
  17820. l = bound01(l, 100);
  17821. if (s === 0) {
  17822. g = l;
  17823. b = l;
  17824. r = l;
  17825. } else {
  17826. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  17827. var p = 2 * l - q;
  17828. r = hue2rgb(p, q, h + 1 / 3);
  17829. g = hue2rgb(p, q, h);
  17830. b = hue2rgb(p, q, h - 1 / 3);
  17831. }
  17832. return { r: r * 255, g: g * 255, b: b * 255 };
  17833. }
  17834. function rgbToHsv(r, g, b) {
  17835. r = bound01(r, 255);
  17836. g = bound01(g, 255);
  17837. b = bound01(b, 255);
  17838. var max = Math.max(r, g, b);
  17839. var min = Math.min(r, g, b);
  17840. var h = 0;
  17841. var v = max;
  17842. var d = max - min;
  17843. var s = max === 0 ? 0 : d / max;
  17844. if (max === min) {
  17845. h = 0;
  17846. } else {
  17847. switch (max) {
  17848. case r:
  17849. h = (g - b) / d + (g < b ? 6 : 0);
  17850. break;
  17851. case g:
  17852. h = (b - r) / d + 2;
  17853. break;
  17854. case b:
  17855. h = (r - g) / d + 4;
  17856. break;
  17857. }
  17858. h /= 6;
  17859. }
  17860. return { h, s, v };
  17861. }
  17862. function hsvToRgb(h, s, v) {
  17863. h = bound01(h, 360) * 6;
  17864. s = bound01(s, 100);
  17865. v = bound01(v, 100);
  17866. var i = Math.floor(h);
  17867. var f = h - i;
  17868. var p = v * (1 - s);
  17869. var q = v * (1 - f * s);
  17870. var t = v * (1 - (1 - f) * s);
  17871. var mod = i % 6;
  17872. var r = [v, q, p, p, t, v][mod];
  17873. var g = [t, v, v, q, p, p][mod];
  17874. var b = [p, p, t, v, v, q][mod];
  17875. return { r: r * 255, g: g * 255, b: b * 255 };
  17876. }
  17877. function rgbToHex(r, g, b, allow3Char) {
  17878. var hex = [
  17879. pad2(Math.round(r).toString(16)),
  17880. pad2(Math.round(g).toString(16)),
  17881. pad2(Math.round(b).toString(16))
  17882. ];
  17883. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  17884. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  17885. }
  17886. return hex.join("");
  17887. }
  17888. function rgbaToHex(r, g, b, a, allow4Char) {
  17889. var hex = [
  17890. pad2(Math.round(r).toString(16)),
  17891. pad2(Math.round(g).toString(16)),
  17892. pad2(Math.round(b).toString(16)),
  17893. pad2(convertDecimalToHex(a))
  17894. ];
  17895. 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))) {
  17896. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  17897. }
  17898. return hex.join("");
  17899. }
  17900. function convertDecimalToHex(d) {
  17901. return Math.round(parseFloat(d) * 255).toString(16);
  17902. }
  17903. function convertHexToDecimal(h) {
  17904. return parseIntFromHex(h) / 255;
  17905. }
  17906. function parseIntFromHex(val) {
  17907. return parseInt(val, 16);
  17908. }
  17909. function numberInputToObject(color) {
  17910. return {
  17911. r: color >> 16,
  17912. g: (color & 65280) >> 8,
  17913. b: color & 255
  17914. };
  17915. }
  17916. var names = {
  17917. aliceblue: "#f0f8ff",
  17918. antiquewhite: "#faebd7",
  17919. aqua: "#00ffff",
  17920. aquamarine: "#7fffd4",
  17921. azure: "#f0ffff",
  17922. beige: "#f5f5dc",
  17923. bisque: "#ffe4c4",
  17924. black: "#000000",
  17925. blanchedalmond: "#ffebcd",
  17926. blue: "#0000ff",
  17927. blueviolet: "#8a2be2",
  17928. brown: "#a52a2a",
  17929. burlywood: "#deb887",
  17930. cadetblue: "#5f9ea0",
  17931. chartreuse: "#7fff00",
  17932. chocolate: "#d2691e",
  17933. coral: "#ff7f50",
  17934. cornflowerblue: "#6495ed",
  17935. cornsilk: "#fff8dc",
  17936. crimson: "#dc143c",
  17937. cyan: "#00ffff",
  17938. darkblue: "#00008b",
  17939. darkcyan: "#008b8b",
  17940. darkgoldenrod: "#b8860b",
  17941. darkgray: "#a9a9a9",
  17942. darkgreen: "#006400",
  17943. darkgrey: "#a9a9a9",
  17944. darkkhaki: "#bdb76b",
  17945. darkmagenta: "#8b008b",
  17946. darkolivegreen: "#556b2f",
  17947. darkorange: "#ff8c00",
  17948. darkorchid: "#9932cc",
  17949. darkred: "#8b0000",
  17950. darksalmon: "#e9967a",
  17951. darkseagreen: "#8fbc8f",
  17952. darkslateblue: "#483d8b",
  17953. darkslategray: "#2f4f4f",
  17954. darkslategrey: "#2f4f4f",
  17955. darkturquoise: "#00ced1",
  17956. darkviolet: "#9400d3",
  17957. deeppink: "#ff1493",
  17958. deepskyblue: "#00bfff",
  17959. dimgray: "#696969",
  17960. dimgrey: "#696969",
  17961. dodgerblue: "#1e90ff",
  17962. firebrick: "#b22222",
  17963. floralwhite: "#fffaf0",
  17964. forestgreen: "#228b22",
  17965. fuchsia: "#ff00ff",
  17966. gainsboro: "#dcdcdc",
  17967. ghostwhite: "#f8f8ff",
  17968. goldenrod: "#daa520",
  17969. gold: "#ffd700",
  17970. gray: "#808080",
  17971. green: "#008000",
  17972. greenyellow: "#adff2f",
  17973. grey: "#808080",
  17974. honeydew: "#f0fff0",
  17975. hotpink: "#ff69b4",
  17976. indianred: "#cd5c5c",
  17977. indigo: "#4b0082",
  17978. ivory: "#fffff0",
  17979. khaki: "#f0e68c",
  17980. lavenderblush: "#fff0f5",
  17981. lavender: "#e6e6fa",
  17982. lawngreen: "#7cfc00",
  17983. lemonchiffon: "#fffacd",
  17984. lightblue: "#add8e6",
  17985. lightcoral: "#f08080",
  17986. lightcyan: "#e0ffff",
  17987. lightgoldenrodyellow: "#fafad2",
  17988. lightgray: "#d3d3d3",
  17989. lightgreen: "#90ee90",
  17990. lightgrey: "#d3d3d3",
  17991. lightpink: "#ffb6c1",
  17992. lightsalmon: "#ffa07a",
  17993. lightseagreen: "#20b2aa",
  17994. lightskyblue: "#87cefa",
  17995. lightslategray: "#778899",
  17996. lightslategrey: "#778899",
  17997. lightsteelblue: "#b0c4de",
  17998. lightyellow: "#ffffe0",
  17999. lime: "#00ff00",
  18000. limegreen: "#32cd32",
  18001. linen: "#faf0e6",
  18002. magenta: "#ff00ff",
  18003. maroon: "#800000",
  18004. mediumaquamarine: "#66cdaa",
  18005. mediumblue: "#0000cd",
  18006. mediumorchid: "#ba55d3",
  18007. mediumpurple: "#9370db",
  18008. mediumseagreen: "#3cb371",
  18009. mediumslateblue: "#7b68ee",
  18010. mediumspringgreen: "#00fa9a",
  18011. mediumturquoise: "#48d1cc",
  18012. mediumvioletred: "#c71585",
  18013. midnightblue: "#191970",
  18014. mintcream: "#f5fffa",
  18015. mistyrose: "#ffe4e1",
  18016. moccasin: "#ffe4b5",
  18017. navajowhite: "#ffdead",
  18018. navy: "#000080",
  18019. oldlace: "#fdf5e6",
  18020. olive: "#808000",
  18021. olivedrab: "#6b8e23",
  18022. orange: "#ffa500",
  18023. orangered: "#ff4500",
  18024. orchid: "#da70d6",
  18025. palegoldenrod: "#eee8aa",
  18026. palegreen: "#98fb98",
  18027. paleturquoise: "#afeeee",
  18028. palevioletred: "#db7093",
  18029. papayawhip: "#ffefd5",
  18030. peachpuff: "#ffdab9",
  18031. peru: "#cd853f",
  18032. pink: "#ffc0cb",
  18033. plum: "#dda0dd",
  18034. powderblue: "#b0e0e6",
  18035. purple: "#800080",
  18036. rebeccapurple: "#663399",
  18037. red: "#ff0000",
  18038. rosybrown: "#bc8f8f",
  18039. royalblue: "#4169e1",
  18040. saddlebrown: "#8b4513",
  18041. salmon: "#fa8072",
  18042. sandybrown: "#f4a460",
  18043. seagreen: "#2e8b57",
  18044. seashell: "#fff5ee",
  18045. sienna: "#a0522d",
  18046. silver: "#c0c0c0",
  18047. skyblue: "#87ceeb",
  18048. slateblue: "#6a5acd",
  18049. slategray: "#708090",
  18050. slategrey: "#708090",
  18051. snow: "#fffafa",
  18052. springgreen: "#00ff7f",
  18053. steelblue: "#4682b4",
  18054. tan: "#d2b48c",
  18055. teal: "#008080",
  18056. thistle: "#d8bfd8",
  18057. tomato: "#ff6347",
  18058. turquoise: "#40e0d0",
  18059. violet: "#ee82ee",
  18060. wheat: "#f5deb3",
  18061. white: "#ffffff",
  18062. whitesmoke: "#f5f5f5",
  18063. yellow: "#ffff00",
  18064. yellowgreen: "#9acd32"
  18065. };
  18066. function inputToRGB(color) {
  18067. var rgb = { r: 0, g: 0, b: 0 };
  18068. var a = 1;
  18069. var s = null;
  18070. var v = null;
  18071. var l = null;
  18072. var ok = false;
  18073. var format = false;
  18074. if (typeof color === "string") {
  18075. color = stringInputToObject(color);
  18076. }
  18077. if (typeof color === "object") {
  18078. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  18079. rgb = rgbToRgb(color.r, color.g, color.b);
  18080. ok = true;
  18081. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  18082. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  18083. s = convertToPercentage(color.s);
  18084. v = convertToPercentage(color.v);
  18085. rgb = hsvToRgb(color.h, s, v);
  18086. ok = true;
  18087. format = "hsv";
  18088. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  18089. s = convertToPercentage(color.s);
  18090. l = convertToPercentage(color.l);
  18091. rgb = hslToRgb(color.h, s, l);
  18092. ok = true;
  18093. format = "hsl";
  18094. }
  18095. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  18096. a = color.a;
  18097. }
  18098. }
  18099. a = boundAlpha(a);
  18100. return {
  18101. ok,
  18102. format: color.format || format,
  18103. r: Math.min(255, Math.max(rgb.r, 0)),
  18104. g: Math.min(255, Math.max(rgb.g, 0)),
  18105. b: Math.min(255, Math.max(rgb.b, 0)),
  18106. a
  18107. };
  18108. }
  18109. var CSS_INTEGER = "[-\\+]?\\d+%?";
  18110. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  18111. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  18112. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  18113. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  18114. var matchers = {
  18115. CSS_UNIT: new RegExp(CSS_UNIT),
  18116. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  18117. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  18118. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  18119. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  18120. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  18121. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  18122. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  18123. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  18124. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  18125. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  18126. };
  18127. function stringInputToObject(color) {
  18128. color = color.trim().toLowerCase();
  18129. if (color.length === 0) {
  18130. return false;
  18131. }
  18132. var named = false;
  18133. if (names[color]) {
  18134. color = names[color];
  18135. named = true;
  18136. } else if (color === "transparent") {
  18137. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  18138. }
  18139. var match = matchers.rgb.exec(color);
  18140. if (match) {
  18141. return { r: match[1], g: match[2], b: match[3] };
  18142. }
  18143. match = matchers.rgba.exec(color);
  18144. if (match) {
  18145. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  18146. }
  18147. match = matchers.hsl.exec(color);
  18148. if (match) {
  18149. return { h: match[1], s: match[2], l: match[3] };
  18150. }
  18151. match = matchers.hsla.exec(color);
  18152. if (match) {
  18153. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  18154. }
  18155. match = matchers.hsv.exec(color);
  18156. if (match) {
  18157. return { h: match[1], s: match[2], v: match[3] };
  18158. }
  18159. match = matchers.hsva.exec(color);
  18160. if (match) {
  18161. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  18162. }
  18163. match = matchers.hex8.exec(color);
  18164. if (match) {
  18165. return {
  18166. r: parseIntFromHex(match[1]),
  18167. g: parseIntFromHex(match[2]),
  18168. b: parseIntFromHex(match[3]),
  18169. a: convertHexToDecimal(match[4]),
  18170. format: named ? "name" : "hex8"
  18171. };
  18172. }
  18173. match = matchers.hex6.exec(color);
  18174. if (match) {
  18175. return {
  18176. r: parseIntFromHex(match[1]),
  18177. g: parseIntFromHex(match[2]),
  18178. b: parseIntFromHex(match[3]),
  18179. format: named ? "name" : "hex"
  18180. };
  18181. }
  18182. match = matchers.hex4.exec(color);
  18183. if (match) {
  18184. return {
  18185. r: parseIntFromHex(match[1] + match[1]),
  18186. g: parseIntFromHex(match[2] + match[2]),
  18187. b: parseIntFromHex(match[3] + match[3]),
  18188. a: convertHexToDecimal(match[4] + match[4]),
  18189. format: named ? "name" : "hex8"
  18190. };
  18191. }
  18192. match = matchers.hex3.exec(color);
  18193. if (match) {
  18194. return {
  18195. r: parseIntFromHex(match[1] + match[1]),
  18196. g: parseIntFromHex(match[2] + match[2]),
  18197. b: parseIntFromHex(match[3] + match[3]),
  18198. format: named ? "name" : "hex"
  18199. };
  18200. }
  18201. return false;
  18202. }
  18203. function isValidCSSUnit(color) {
  18204. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  18205. }
  18206. var TinyColor = function() {
  18207. function TinyColor2(color, opts) {
  18208. if (color === void 0) {
  18209. color = "";
  18210. }
  18211. if (opts === void 0) {
  18212. opts = {};
  18213. }
  18214. var _a;
  18215. if (color instanceof TinyColor2) {
  18216. return color;
  18217. }
  18218. if (typeof color === "number") {
  18219. color = numberInputToObject(color);
  18220. }
  18221. this.originalInput = color;
  18222. var rgb = inputToRGB(color);
  18223. this.originalInput = color;
  18224. this.r = rgb.r;
  18225. this.g = rgb.g;
  18226. this.b = rgb.b;
  18227. this.a = rgb.a;
  18228. this.roundA = Math.round(100 * this.a) / 100;
  18229. this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
  18230. this.gradientType = opts.gradientType;
  18231. if (this.r < 1) {
  18232. this.r = Math.round(this.r);
  18233. }
  18234. if (this.g < 1) {
  18235. this.g = Math.round(this.g);
  18236. }
  18237. if (this.b < 1) {
  18238. this.b = Math.round(this.b);
  18239. }
  18240. this.isValid = rgb.ok;
  18241. }
  18242. TinyColor2.prototype.isDark = function() {
  18243. return this.getBrightness() < 128;
  18244. };
  18245. TinyColor2.prototype.isLight = function() {
  18246. return !this.isDark();
  18247. };
  18248. TinyColor2.prototype.getBrightness = function() {
  18249. var rgb = this.toRgb();
  18250. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  18251. };
  18252. TinyColor2.prototype.getLuminance = function() {
  18253. var rgb = this.toRgb();
  18254. var R;
  18255. var G;
  18256. var B;
  18257. var RsRGB = rgb.r / 255;
  18258. var GsRGB = rgb.g / 255;
  18259. var BsRGB = rgb.b / 255;
  18260. if (RsRGB <= 0.03928) {
  18261. R = RsRGB / 12.92;
  18262. } else {
  18263. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  18264. }
  18265. if (GsRGB <= 0.03928) {
  18266. G = GsRGB / 12.92;
  18267. } else {
  18268. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  18269. }
  18270. if (BsRGB <= 0.03928) {
  18271. B = BsRGB / 12.92;
  18272. } else {
  18273. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  18274. }
  18275. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  18276. };
  18277. TinyColor2.prototype.getAlpha = function() {
  18278. return this.a;
  18279. };
  18280. TinyColor2.prototype.setAlpha = function(alpha) {
  18281. this.a = boundAlpha(alpha);
  18282. this.roundA = Math.round(100 * this.a) / 100;
  18283. return this;
  18284. };
  18285. TinyColor2.prototype.isMonochrome = function() {
  18286. var s = this.toHsl().s;
  18287. return s === 0;
  18288. };
  18289. TinyColor2.prototype.toHsv = function() {
  18290. var hsv = rgbToHsv(this.r, this.g, this.b);
  18291. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  18292. };
  18293. TinyColor2.prototype.toHsvString = function() {
  18294. var hsv = rgbToHsv(this.r, this.g, this.b);
  18295. var h = Math.round(hsv.h * 360);
  18296. var s = Math.round(hsv.s * 100);
  18297. var v = Math.round(hsv.v * 100);
  18298. return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  18299. };
  18300. TinyColor2.prototype.toHsl = function() {
  18301. var hsl = rgbToHsl(this.r, this.g, this.b);
  18302. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  18303. };
  18304. TinyColor2.prototype.toHslString = function() {
  18305. var hsl = rgbToHsl(this.r, this.g, this.b);
  18306. var h = Math.round(hsl.h * 360);
  18307. var s = Math.round(hsl.s * 100);
  18308. var l = Math.round(hsl.l * 100);
  18309. return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  18310. };
  18311. TinyColor2.prototype.toHex = function(allow3Char) {
  18312. if (allow3Char === void 0) {
  18313. allow3Char = false;
  18314. }
  18315. return rgbToHex(this.r, this.g, this.b, allow3Char);
  18316. };
  18317. TinyColor2.prototype.toHexString = function(allow3Char) {
  18318. if (allow3Char === void 0) {
  18319. allow3Char = false;
  18320. }
  18321. return "#" + this.toHex(allow3Char);
  18322. };
  18323. TinyColor2.prototype.toHex8 = function(allow4Char) {
  18324. if (allow4Char === void 0) {
  18325. allow4Char = false;
  18326. }
  18327. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  18328. };
  18329. TinyColor2.prototype.toHex8String = function(allow4Char) {
  18330. if (allow4Char === void 0) {
  18331. allow4Char = false;
  18332. }
  18333. return "#" + this.toHex8(allow4Char);
  18334. };
  18335. TinyColor2.prototype.toHexShortString = function(allowShortChar) {
  18336. if (allowShortChar === void 0) {
  18337. allowShortChar = false;
  18338. }
  18339. return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
  18340. };
  18341. TinyColor2.prototype.toRgb = function() {
  18342. return {
  18343. r: Math.round(this.r),
  18344. g: Math.round(this.g),
  18345. b: Math.round(this.b),
  18346. a: this.a
  18347. };
  18348. };
  18349. TinyColor2.prototype.toRgbString = function() {
  18350. var r = Math.round(this.r);
  18351. var g = Math.round(this.g);
  18352. var b = Math.round(this.b);
  18353. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  18354. };
  18355. TinyColor2.prototype.toPercentageRgb = function() {
  18356. var fmt = function(x) {
  18357. return "".concat(Math.round(bound01(x, 255) * 100), "%");
  18358. };
  18359. return {
  18360. r: fmt(this.r),
  18361. g: fmt(this.g),
  18362. b: fmt(this.b),
  18363. a: this.a
  18364. };
  18365. };
  18366. TinyColor2.prototype.toPercentageRgbString = function() {
  18367. var rnd = function(x) {
  18368. return Math.round(bound01(x, 255) * 100);
  18369. };
  18370. return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
  18371. };
  18372. TinyColor2.prototype.toName = function() {
  18373. if (this.a === 0) {
  18374. return "transparent";
  18375. }
  18376. if (this.a < 1) {
  18377. return false;
  18378. }
  18379. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  18380. for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
  18381. var _b = _a[_i], key = _b[0], value = _b[1];
  18382. if (hex === value) {
  18383. return key;
  18384. }
  18385. }
  18386. return false;
  18387. };
  18388. TinyColor2.prototype.toString = function(format) {
  18389. var formatSet = Boolean(format);
  18390. format = format !== null && format !== void 0 ? format : this.format;
  18391. var formattedString = false;
  18392. var hasAlpha = this.a < 1 && this.a >= 0;
  18393. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  18394. if (needsAlphaFormat) {
  18395. if (format === "name" && this.a === 0) {
  18396. return this.toName();
  18397. }
  18398. return this.toRgbString();
  18399. }
  18400. if (format === "rgb") {
  18401. formattedString = this.toRgbString();
  18402. }
  18403. if (format === "prgb") {
  18404. formattedString = this.toPercentageRgbString();
  18405. }
  18406. if (format === "hex" || format === "hex6") {
  18407. formattedString = this.toHexString();
  18408. }
  18409. if (format === "hex3") {
  18410. formattedString = this.toHexString(true);
  18411. }
  18412. if (format === "hex4") {
  18413. formattedString = this.toHex8String(true);
  18414. }
  18415. if (format === "hex8") {
  18416. formattedString = this.toHex8String();
  18417. }
  18418. if (format === "name") {
  18419. formattedString = this.toName();
  18420. }
  18421. if (format === "hsl") {
  18422. formattedString = this.toHslString();
  18423. }
  18424. if (format === "hsv") {
  18425. formattedString = this.toHsvString();
  18426. }
  18427. return formattedString || this.toHexString();
  18428. };
  18429. TinyColor2.prototype.toNumber = function() {
  18430. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  18431. };
  18432. TinyColor2.prototype.clone = function() {
  18433. return new TinyColor2(this.toString());
  18434. };
  18435. TinyColor2.prototype.lighten = function(amount) {
  18436. if (amount === void 0) {
  18437. amount = 10;
  18438. }
  18439. var hsl = this.toHsl();
  18440. hsl.l += amount / 100;
  18441. hsl.l = clamp01(hsl.l);
  18442. return new TinyColor2(hsl);
  18443. };
  18444. TinyColor2.prototype.brighten = function(amount) {
  18445. if (amount === void 0) {
  18446. amount = 10;
  18447. }
  18448. var rgb = this.toRgb();
  18449. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  18450. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  18451. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  18452. return new TinyColor2(rgb);
  18453. };
  18454. TinyColor2.prototype.darken = function(amount) {
  18455. if (amount === void 0) {
  18456. amount = 10;
  18457. }
  18458. var hsl = this.toHsl();
  18459. hsl.l -= amount / 100;
  18460. hsl.l = clamp01(hsl.l);
  18461. return new TinyColor2(hsl);
  18462. };
  18463. TinyColor2.prototype.tint = function(amount) {
  18464. if (amount === void 0) {
  18465. amount = 10;
  18466. }
  18467. return this.mix("white", amount);
  18468. };
  18469. TinyColor2.prototype.shade = function(amount) {
  18470. if (amount === void 0) {
  18471. amount = 10;
  18472. }
  18473. return this.mix("black", amount);
  18474. };
  18475. TinyColor2.prototype.desaturate = function(amount) {
  18476. if (amount === void 0) {
  18477. amount = 10;
  18478. }
  18479. var hsl = this.toHsl();
  18480. hsl.s -= amount / 100;
  18481. hsl.s = clamp01(hsl.s);
  18482. return new TinyColor2(hsl);
  18483. };
  18484. TinyColor2.prototype.saturate = function(amount) {
  18485. if (amount === void 0) {
  18486. amount = 10;
  18487. }
  18488. var hsl = this.toHsl();
  18489. hsl.s += amount / 100;
  18490. hsl.s = clamp01(hsl.s);
  18491. return new TinyColor2(hsl);
  18492. };
  18493. TinyColor2.prototype.greyscale = function() {
  18494. return this.desaturate(100);
  18495. };
  18496. TinyColor2.prototype.spin = function(amount) {
  18497. var hsl = this.toHsl();
  18498. var hue = (hsl.h + amount) % 360;
  18499. hsl.h = hue < 0 ? 360 + hue : hue;
  18500. return new TinyColor2(hsl);
  18501. };
  18502. TinyColor2.prototype.mix = function(color, amount) {
  18503. if (amount === void 0) {
  18504. amount = 50;
  18505. }
  18506. var rgb1 = this.toRgb();
  18507. var rgb2 = new TinyColor2(color).toRgb();
  18508. var p = amount / 100;
  18509. var rgba = {
  18510. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  18511. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  18512. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  18513. a: (rgb2.a - rgb1.a) * p + rgb1.a
  18514. };
  18515. return new TinyColor2(rgba);
  18516. };
  18517. TinyColor2.prototype.analogous = function(results, slices) {
  18518. if (results === void 0) {
  18519. results = 6;
  18520. }
  18521. if (slices === void 0) {
  18522. slices = 30;
  18523. }
  18524. var hsl = this.toHsl();
  18525. var part = 360 / slices;
  18526. var ret = [this];
  18527. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  18528. hsl.h = (hsl.h + part) % 360;
  18529. ret.push(new TinyColor2(hsl));
  18530. }
  18531. return ret;
  18532. };
  18533. TinyColor2.prototype.complement = function() {
  18534. var hsl = this.toHsl();
  18535. hsl.h = (hsl.h + 180) % 360;
  18536. return new TinyColor2(hsl);
  18537. };
  18538. TinyColor2.prototype.monochromatic = function(results) {
  18539. if (results === void 0) {
  18540. results = 6;
  18541. }
  18542. var hsv = this.toHsv();
  18543. var h = hsv.h;
  18544. var s = hsv.s;
  18545. var v = hsv.v;
  18546. var res = [];
  18547. var modification = 1 / results;
  18548. while (results--) {
  18549. res.push(new TinyColor2({ h, s, v }));
  18550. v = (v + modification) % 1;
  18551. }
  18552. return res;
  18553. };
  18554. TinyColor2.prototype.splitcomplement = function() {
  18555. var hsl = this.toHsl();
  18556. var h = hsl.h;
  18557. return [
  18558. this,
  18559. new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
  18560. new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
  18561. ];
  18562. };
  18563. TinyColor2.prototype.onBackground = function(background) {
  18564. var fg = this.toRgb();
  18565. var bg = new TinyColor2(background).toRgb();
  18566. var alpha = fg.a + bg.a * (1 - fg.a);
  18567. return new TinyColor2({
  18568. r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
  18569. g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
  18570. b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
  18571. a: alpha
  18572. });
  18573. };
  18574. TinyColor2.prototype.triad = function() {
  18575. return this.polyad(3);
  18576. };
  18577. TinyColor2.prototype.tetrad = function() {
  18578. return this.polyad(4);
  18579. };
  18580. TinyColor2.prototype.polyad = function(n) {
  18581. var hsl = this.toHsl();
  18582. var h = hsl.h;
  18583. var result = [this];
  18584. var increment = 360 / n;
  18585. for (var i = 1; i < n; i++) {
  18586. result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
  18587. }
  18588. return result;
  18589. };
  18590. TinyColor2.prototype.equals = function(color) {
  18591. return this.toRgbString() === new TinyColor2(color).toRgbString();
  18592. };
  18593. return TinyColor2;
  18594. }();
  18595. function darken(color, amount = 20) {
  18596. return color.mix("#141414", amount).toString();
  18597. }
  18598. function useButtonCustomStyle(props) {
  18599. const _disabled = useFormDisabled();
  18600. const ns = useNamespace("button");
  18601. return computed(() => {
  18602. let styles = {};
  18603. let buttonColor = props.color;
  18604. if (buttonColor) {
  18605. const match = buttonColor.match(/var\((.*?)\)/);
  18606. if (match) {
  18607. buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
  18608. }
  18609. const color = new TinyColor(buttonColor);
  18610. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  18611. if (props.plain) {
  18612. styles = ns.cssVarBlock({
  18613. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  18614. "text-color": buttonColor,
  18615. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  18616. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  18617. "hover-bg-color": buttonColor,
  18618. "hover-border-color": buttonColor,
  18619. "active-bg-color": activeBgColor,
  18620. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  18621. "active-border-color": activeBgColor
  18622. });
  18623. if (_disabled.value) {
  18624. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  18625. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  18626. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  18627. }
  18628. } else {
  18629. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  18630. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  18631. styles = ns.cssVarBlock({
  18632. "bg-color": buttonColor,
  18633. "text-color": textColor,
  18634. "border-color": buttonColor,
  18635. "hover-bg-color": hoverBgColor,
  18636. "hover-text-color": textColor,
  18637. "hover-border-color": hoverBgColor,
  18638. "active-bg-color": activeBgColor,
  18639. "active-border-color": activeBgColor
  18640. });
  18641. if (_disabled.value) {
  18642. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  18643. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  18644. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  18645. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  18646. }
  18647. }
  18648. }
  18649. return styles;
  18650. });
  18651. }
  18652. const __default__$1E = defineComponent({
  18653. name: "ElButton"
  18654. });
  18655. const _sfc_main$27 = /* @__PURE__ */ defineComponent({
  18656. ...__default__$1E,
  18657. props: buttonProps,
  18658. emits: buttonEmits,
  18659. setup(__props, { expose, emit }) {
  18660. const props = __props;
  18661. const buttonStyle = useButtonCustomStyle(props);
  18662. const ns = useNamespace("button");
  18663. const {
  18664. _ref,
  18665. _size,
  18666. _type,
  18667. _disabled,
  18668. _props,
  18669. _plain,
  18670. _round,
  18671. _text,
  18672. shouldAddSpace,
  18673. handleClick
  18674. } = useButton(props, emit);
  18675. const buttonKls = computed(() => [
  18676. ns.b(),
  18677. ns.m(_type.value),
  18678. ns.m(_size.value),
  18679. ns.is("disabled", _disabled.value),
  18680. ns.is("loading", props.loading),
  18681. ns.is("plain", _plain.value),
  18682. ns.is("round", _round.value),
  18683. ns.is("circle", props.circle),
  18684. ns.is("text", _text.value),
  18685. ns.is("link", props.link),
  18686. ns.is("has-bg", props.bg)
  18687. ]);
  18688. expose({
  18689. ref: _ref,
  18690. size: _size,
  18691. type: _type,
  18692. disabled: _disabled,
  18693. shouldAddSpace
  18694. });
  18695. return (_ctx, _cache) => {
  18696. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
  18697. ref_key: "_ref",
  18698. ref: _ref
  18699. }, unref(_props), {
  18700. class: unref(buttonKls),
  18701. style: unref(buttonStyle),
  18702. onClick: unref(handleClick)
  18703. }), {
  18704. default: withCtx(() => [
  18705. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  18706. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  18707. key: 1,
  18708. class: normalizeClass(unref(ns).is("loading"))
  18709. }, {
  18710. default: withCtx(() => [
  18711. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  18712. ]),
  18713. _: 1
  18714. }, 8, ["class"]))
  18715. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  18716. default: withCtx(() => [
  18717. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  18718. ]),
  18719. _: 3
  18720. })) : createCommentVNode("v-if", true),
  18721. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  18722. key: 2,
  18723. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  18724. }, [
  18725. renderSlot(_ctx.$slots, "default")
  18726. ], 2)) : createCommentVNode("v-if", true)
  18727. ]),
  18728. _: 3
  18729. }, 16, ["class", "style", "onClick"]);
  18730. };
  18731. }
  18732. });
  18733. var Button = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "button.vue"]]);
  18734. const buttonGroupProps = {
  18735. size: buttonProps.size,
  18736. type: buttonProps.type
  18737. };
  18738. const __default__$1D = defineComponent({
  18739. name: "ElButtonGroup"
  18740. });
  18741. const _sfc_main$26 = /* @__PURE__ */ defineComponent({
  18742. ...__default__$1D,
  18743. props: buttonGroupProps,
  18744. setup(__props) {
  18745. const props = __props;
  18746. provide(buttonGroupContextKey, reactive({
  18747. size: toRef(props, "size"),
  18748. type: toRef(props, "type")
  18749. }));
  18750. const ns = useNamespace("button");
  18751. return (_ctx, _cache) => {
  18752. return openBlock(), createElementBlock("div", {
  18753. class: normalizeClass(unref(ns).b("group"))
  18754. }, [
  18755. renderSlot(_ctx.$slots, "default")
  18756. ], 2);
  18757. };
  18758. }
  18759. });
  18760. var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["__file", "button-group.vue"]]);
  18761. const ElButton = withInstall(Button, {
  18762. ButtonGroup
  18763. });
  18764. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  18765. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  18766. var dayjs_min = {exports: {}};
  18767. (function(module, exports) {
  18768. !function(t, e) {
  18769. module.exports = e() ;
  18770. }(commonjsGlobal, function() {
  18771. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
  18772. var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
  18773. return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
  18774. } }, m = function(t2, e2, n2) {
  18775. var r2 = String(t2);
  18776. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  18777. }, v = { s: m, z: function(t2) {
  18778. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  18779. return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
  18780. }, m: function t2(e2, n2) {
  18781. if (e2.date() < n2.date())
  18782. return -t2(n2, e2);
  18783. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
  18784. return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
  18785. }, a: function(t2) {
  18786. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  18787. }, p: function(t2) {
  18788. return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  18789. }, u: function(t2) {
  18790. return t2 === void 0;
  18791. } }, g = "en", D = {};
  18792. D[g] = M;
  18793. var p = "$isDayjsObject", S = function(t2) {
  18794. return t2 instanceof _ || !(!t2 || !t2[p]);
  18795. }, w = function t2(e2, n2, r2) {
  18796. var i2;
  18797. if (!e2)
  18798. return g;
  18799. if (typeof e2 == "string") {
  18800. var s2 = e2.toLowerCase();
  18801. D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
  18802. var u2 = e2.split("-");
  18803. if (!i2 && u2.length > 1)
  18804. return t2(u2[0]);
  18805. } else {
  18806. var a2 = e2.name;
  18807. D[a2] = e2, i2 = a2;
  18808. }
  18809. return !r2 && i2 && (g = i2), i2 || !r2 && g;
  18810. }, O = function(t2, e2) {
  18811. if (S(t2))
  18812. return t2.clone();
  18813. var n2 = typeof e2 == "object" ? e2 : {};
  18814. return n2.date = t2, n2.args = arguments, new _(n2);
  18815. }, b = v;
  18816. b.l = w, b.i = S, b.w = function(t2, e2) {
  18817. return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  18818. };
  18819. var _ = function() {
  18820. function M2(t2) {
  18821. this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
  18822. }
  18823. var m2 = M2.prototype;
  18824. return m2.parse = function(t2) {
  18825. this.$d = function(t3) {
  18826. var e2 = t3.date, n2 = t3.utc;
  18827. if (e2 === null)
  18828. return new Date(NaN);
  18829. if (b.u(e2))
  18830. return new Date();
  18831. if (e2 instanceof Date)
  18832. return new Date(e2);
  18833. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  18834. var r2 = e2.match($);
  18835. if (r2) {
  18836. var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
  18837. return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
  18838. }
  18839. }
  18840. return new Date(e2);
  18841. }(t2), this.init();
  18842. }, m2.init = function() {
  18843. var t2 = this.$d;
  18844. this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
  18845. }, m2.$utils = function() {
  18846. return b;
  18847. }, m2.isValid = function() {
  18848. return !(this.$d.toString() === l);
  18849. }, m2.isSame = function(t2, e2) {
  18850. var n2 = O(t2);
  18851. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  18852. }, m2.isAfter = function(t2, e2) {
  18853. return O(t2) < this.startOf(e2);
  18854. }, m2.isBefore = function(t2, e2) {
  18855. return this.endOf(e2) < O(t2);
  18856. }, m2.$g = function(t2, e2, n2) {
  18857. return b.u(t2) ? this[e2] : this.set(n2, t2);
  18858. }, m2.unix = function() {
  18859. return Math.floor(this.valueOf() / 1e3);
  18860. }, m2.valueOf = function() {
  18861. return this.$d.getTime();
  18862. }, m2.startOf = function(t2, e2) {
  18863. var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
  18864. var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  18865. return r2 ? i2 : i2.endOf(a);
  18866. }, $2 = function(t3, e3) {
  18867. return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  18868. }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
  18869. switch (f2) {
  18870. case h:
  18871. return r2 ? l2(1, 0) : l2(31, 11);
  18872. case c:
  18873. return r2 ? l2(1, M3) : l2(0, M3 + 1);
  18874. case o:
  18875. var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
  18876. return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
  18877. case a:
  18878. case d:
  18879. return $2(v2 + "Hours", 0);
  18880. case u:
  18881. return $2(v2 + "Minutes", 1);
  18882. case s:
  18883. return $2(v2 + "Seconds", 2);
  18884. case i:
  18885. return $2(v2 + "Milliseconds", 3);
  18886. default:
  18887. return this.clone();
  18888. }
  18889. }, m2.endOf = function(t2) {
  18890. return this.startOf(t2, false);
  18891. }, m2.$set = function(t2, e2) {
  18892. var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
  18893. if (o2 === c || o2 === h) {
  18894. var y2 = this.clone().set(d, 1);
  18895. y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
  18896. } else
  18897. l2 && this.$d[l2]($2);
  18898. return this.init(), this;
  18899. }, m2.set = function(t2, e2) {
  18900. return this.clone().$set(t2, e2);
  18901. }, m2.get = function(t2) {
  18902. return this[b.p(t2)]();
  18903. }, m2.add = function(r2, f2) {
  18904. var d2, l2 = this;
  18905. r2 = Number(r2);
  18906. var $2 = b.p(f2), y2 = function(t2) {
  18907. var e2 = O(l2);
  18908. return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
  18909. };
  18910. if ($2 === c)
  18911. return this.set(c, this.$M + r2);
  18912. if ($2 === h)
  18913. return this.set(h, this.$y + r2);
  18914. if ($2 === a)
  18915. return y2(1);
  18916. if ($2 === o)
  18917. return y2(7);
  18918. var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
  18919. return b.w(m3, this);
  18920. }, m2.subtract = function(t2, e2) {
  18921. return this.add(-1 * t2, e2);
  18922. }, m2.format = function(t2) {
  18923. var e2 = this, n2 = this.$locale();
  18924. if (!this.isValid())
  18925. return n2.invalidDate || l;
  18926. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
  18927. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
  18928. }, d2 = function(t3) {
  18929. return b.s(s2 % 12 || 12, t3, "0");
  18930. }, $2 = f2 || function(t3, e3, n3) {
  18931. var r3 = t3 < 12 ? "AM" : "PM";
  18932. return n3 ? r3.toLowerCase() : r3;
  18933. };
  18934. return r2.replace(y, function(t3, r3) {
  18935. return r3 || function(t4) {
  18936. switch (t4) {
  18937. case "YY":
  18938. return String(e2.$y).slice(-2);
  18939. case "YYYY":
  18940. return b.s(e2.$y, 4, "0");
  18941. case "M":
  18942. return a2 + 1;
  18943. case "MM":
  18944. return b.s(a2 + 1, 2, "0");
  18945. case "MMM":
  18946. return h2(n2.monthsShort, a2, c2, 3);
  18947. case "MMMM":
  18948. return h2(c2, a2);
  18949. case "D":
  18950. return e2.$D;
  18951. case "DD":
  18952. return b.s(e2.$D, 2, "0");
  18953. case "d":
  18954. return String(e2.$W);
  18955. case "dd":
  18956. return h2(n2.weekdaysMin, e2.$W, o2, 2);
  18957. case "ddd":
  18958. return h2(n2.weekdaysShort, e2.$W, o2, 3);
  18959. case "dddd":
  18960. return o2[e2.$W];
  18961. case "H":
  18962. return String(s2);
  18963. case "HH":
  18964. return b.s(s2, 2, "0");
  18965. case "h":
  18966. return d2(1);
  18967. case "hh":
  18968. return d2(2);
  18969. case "a":
  18970. return $2(s2, u2, true);
  18971. case "A":
  18972. return $2(s2, u2, false);
  18973. case "m":
  18974. return String(u2);
  18975. case "mm":
  18976. return b.s(u2, 2, "0");
  18977. case "s":
  18978. return String(e2.$s);
  18979. case "ss":
  18980. return b.s(e2.$s, 2, "0");
  18981. case "SSS":
  18982. return b.s(e2.$ms, 3, "0");
  18983. case "Z":
  18984. return i2;
  18985. }
  18986. return null;
  18987. }(t3) || i2.replace(":", "");
  18988. });
  18989. }, m2.utcOffset = function() {
  18990. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  18991. }, m2.diff = function(r2, d2, l2) {
  18992. var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
  18993. return b.m(y2, m3);
  18994. };
  18995. switch (M3) {
  18996. case h:
  18997. $2 = D2() / 12;
  18998. break;
  18999. case c:
  19000. $2 = D2();
  19001. break;
  19002. case f:
  19003. $2 = D2() / 3;
  19004. break;
  19005. case o:
  19006. $2 = (g2 - v2) / 6048e5;
  19007. break;
  19008. case a:
  19009. $2 = (g2 - v2) / 864e5;
  19010. break;
  19011. case u:
  19012. $2 = g2 / n;
  19013. break;
  19014. case s:
  19015. $2 = g2 / e;
  19016. break;
  19017. case i:
  19018. $2 = g2 / t;
  19019. break;
  19020. default:
  19021. $2 = g2;
  19022. }
  19023. return l2 ? $2 : b.a($2);
  19024. }, m2.daysInMonth = function() {
  19025. return this.endOf(c).$D;
  19026. }, m2.$locale = function() {
  19027. return D[this.$L];
  19028. }, m2.locale = function(t2, e2) {
  19029. if (!t2)
  19030. return this.$L;
  19031. var n2 = this.clone(), r2 = w(t2, e2, true);
  19032. return r2 && (n2.$L = r2), n2;
  19033. }, m2.clone = function() {
  19034. return b.w(this.$d, this);
  19035. }, m2.toDate = function() {
  19036. return new Date(this.valueOf());
  19037. }, m2.toJSON = function() {
  19038. return this.isValid() ? this.toISOString() : null;
  19039. }, m2.toISOString = function() {
  19040. return this.$d.toISOString();
  19041. }, m2.toString = function() {
  19042. return this.$d.toUTCString();
  19043. }, M2;
  19044. }(), k = _.prototype;
  19045. return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
  19046. k[t2[1]] = function(e2) {
  19047. return this.$g(e2, t2[0], t2[1]);
  19048. };
  19049. }), O.extend = function(t2, e2) {
  19050. return t2.$i || (t2(e2, _, O), t2.$i = true), O;
  19051. }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
  19052. return O(1e3 * t2);
  19053. }, O.en = D[g], O.Ls = D, O.p = {}, O;
  19054. });
  19055. })(dayjs_min);
  19056. var dayjs = dayjs_min.exports;
  19057. var customParseFormat$1 = {exports: {}};
  19058. (function(module, exports) {
  19059. !function(e, t) {
  19060. module.exports = t() ;
  19061. }(commonjsGlobal, function() {
  19062. var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, s = {}, a = function(e2) {
  19063. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  19064. };
  19065. var f = function(e2) {
  19066. return function(t2) {
  19067. this[e2] = +t2;
  19068. };
  19069. }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  19070. (this.zone || (this.zone = {})).offset = function(e3) {
  19071. if (!e3)
  19072. return 0;
  19073. if (e3 === "Z")
  19074. return 0;
  19075. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  19076. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  19077. }(e2);
  19078. }], u = function(e2) {
  19079. var t2 = s[e2];
  19080. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  19081. }, d = function(e2, t2) {
  19082. var n2, r2 = s.meridiem;
  19083. if (r2) {
  19084. for (var i2 = 1; i2 <= 24; i2 += 1)
  19085. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  19086. n2 = i2 > 12;
  19087. break;
  19088. }
  19089. } else
  19090. n2 = e2 === (t2 ? "pm" : "PM");
  19091. return n2;
  19092. }, c = { A: [o, function(e2) {
  19093. this.afternoon = d(e2, false);
  19094. }], a: [o, function(e2) {
  19095. this.afternoon = d(e2, true);
  19096. }], Q: [n, function(e2) {
  19097. this.month = 3 * (e2 - 1) + 1;
  19098. }], S: [n, function(e2) {
  19099. this.milliseconds = 100 * +e2;
  19100. }], SS: [r, function(e2) {
  19101. this.milliseconds = 10 * +e2;
  19102. }], SSS: [/\d{3}/, function(e2) {
  19103. this.milliseconds = +e2;
  19104. }], s: [i, f("seconds")], ss: [i, f("seconds")], m: [i, f("minutes")], mm: [i, f("minutes")], H: [i, f("hours")], h: [i, f("hours")], HH: [i, f("hours")], hh: [i, f("hours")], D: [i, f("day")], DD: [r, f("day")], Do: [o, function(e2) {
  19105. var t2 = s.ordinal, n2 = e2.match(/\d+/);
  19106. if (this.day = n2[0], t2)
  19107. for (var r2 = 1; r2 <= 31; r2 += 1)
  19108. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  19109. }], w: [i, f("week")], ww: [r, f("week")], M: [i, f("month")], MM: [r, f("month")], MMM: [o, function(e2) {
  19110. var t2 = u("months"), n2 = (u("monthsShort") || t2.map(function(e3) {
  19111. return e3.slice(0, 3);
  19112. })).indexOf(e2) + 1;
  19113. if (n2 < 1)
  19114. throw new Error();
  19115. this.month = n2 % 12 || n2;
  19116. }], MMMM: [o, function(e2) {
  19117. var t2 = u("months").indexOf(e2) + 1;
  19118. if (t2 < 1)
  19119. throw new Error();
  19120. this.month = t2 % 12 || t2;
  19121. }], Y: [/[+-]?\d+/, f("year")], YY: [r, function(e2) {
  19122. this.year = a(e2);
  19123. }], YYYY: [/\d{4}/, f("year")], Z: h, ZZ: h };
  19124. function l(n2) {
  19125. var r2, i2;
  19126. r2 = n2, i2 = s && s.formats;
  19127. for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  19128. var o3 = r3 && r3.toUpperCase();
  19129. return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  19130. return t3 || n4.slice(1);
  19131. });
  19132. })).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) {
  19133. var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1];
  19134. o2[f2] = l2 ? { regex: d2, parser: l2 } : h2.replace(/^\[|\]$/g, "");
  19135. }
  19136. return function(e2) {
  19137. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
  19138. var i3 = o2[n3];
  19139. if (typeof i3 == "string")
  19140. r3 += i3.length;
  19141. else {
  19142. var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0];
  19143. f3.call(t2, u3), e2 = e2.replace(u3, "");
  19144. }
  19145. }
  19146. return function(e3) {
  19147. var t3 = e3.afternoon;
  19148. if (t3 !== void 0) {
  19149. var n4 = e3.hours;
  19150. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  19151. }
  19152. }(t2), t2;
  19153. };
  19154. }
  19155. return function(e2, t2, n2) {
  19156. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear);
  19157. var r2 = t2.prototype, i2 = r2.parse;
  19158. r2.parse = function(e3) {
  19159. var t3 = e3.date, r3 = e3.utc, o2 = e3.args;
  19160. this.$u = r3;
  19161. var a2 = o2[1];
  19162. if (typeof a2 == "string") {
  19163. var f2 = o2[2] === true, h2 = o2[3] === true, u2 = f2 || h2, d2 = o2[2];
  19164. h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = function(e4, t4, n3, r4) {
  19165. try {
  19166. if (["x", "X"].indexOf(t4) > -1)
  19167. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  19168. var i3 = l(t4)(e4), o3 = i3.year, s2 = i3.month, a3 = i3.day, f3 = i3.hours, h3 = i3.minutes, u3 = i3.seconds, d3 = i3.milliseconds, c3 = i3.zone, m2 = i3.week, M2 = new Date(), Y = a3 || (o3 || s2 ? 1 : M2.getDate()), p = o3 || M2.getFullYear(), v = 0;
  19169. o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth());
  19170. var D, w = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0;
  19171. return c3 ? new Date(Date.UTC(p, v, Y, w, g, y, L + 60 * c3.offset * 1e3)) : n3 ? new Date(Date.UTC(p, v, Y, w, g, y, L)) : (D = new Date(p, v, Y, w, g, y, L), m2 && (D = r4(D).week(m2).toDate()), D);
  19172. } catch (e5) {
  19173. return new Date("");
  19174. }
  19175. }(t3, a2, r3, n2), this.init(), d2 && d2 !== true && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = new Date("")), s = {};
  19176. } else if (a2 instanceof Array)
  19177. for (var c2 = a2.length, m = 1; m <= c2; m += 1) {
  19178. o2[1] = a2[m - 1];
  19179. var M = n2.apply(this, o2);
  19180. if (M.isValid()) {
  19181. this.$d = M.$d, this.$L = M.$L, this.init();
  19182. break;
  19183. }
  19184. m === c2 && (this.$d = new Date(""));
  19185. }
  19186. else
  19187. i2.call(this, e3);
  19188. };
  19189. };
  19190. });
  19191. })(customParseFormat$1);
  19192. var customParseFormat = customParseFormat$1.exports;
  19193. const timeUnits$1 = ["hours", "minutes", "seconds"];
  19194. const PICKER_BASE_INJECTION_KEY = "EP_PICKER_BASE";
  19195. const PICKER_POPPER_OPTIONS_INJECTION_KEY = "ElPopperOptions";
  19196. const ROOT_COMMON_PICKER_INJECTION_KEY = Symbol("commonPickerContextKey");
  19197. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  19198. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  19199. const DEFAULT_FORMATS_DATEPICKER = {
  19200. date: DEFAULT_FORMATS_DATE,
  19201. dates: DEFAULT_FORMATS_DATE,
  19202. week: "gggg[w]ww",
  19203. year: "YYYY",
  19204. years: "YYYY",
  19205. month: "YYYY-MM",
  19206. months: "YYYY-MM",
  19207. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  19208. monthrange: "YYYY-MM",
  19209. yearrange: "YYYY",
  19210. daterange: DEFAULT_FORMATS_DATE,
  19211. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  19212. };
  19213. const buildTimeList = (value, bound) => {
  19214. return [
  19215. value > 0 ? value - 1 : void 0,
  19216. value,
  19217. value < bound ? value + 1 : void 0
  19218. ];
  19219. };
  19220. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  19221. const extractDateFormat = (format) => {
  19222. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  19223. };
  19224. const extractTimeFormat = (format) => {
  19225. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  19226. };
  19227. const dateEquals = function(a, b) {
  19228. const aIsDate = isDate$1(a);
  19229. const bIsDate = isDate$1(b);
  19230. if (aIsDate && bIsDate) {
  19231. return a.getTime() === b.getTime();
  19232. }
  19233. if (!aIsDate && !bIsDate) {
  19234. return a === b;
  19235. }
  19236. return false;
  19237. };
  19238. const valueEquals = function(a, b) {
  19239. const aIsArray = isArray$1(a);
  19240. const bIsArray = isArray$1(b);
  19241. if (aIsArray && bIsArray) {
  19242. if (a.length !== b.length) {
  19243. return false;
  19244. }
  19245. return a.every((item, index) => dateEquals(item, b[index]));
  19246. }
  19247. if (!aIsArray && !bIsArray) {
  19248. return dateEquals(a, b);
  19249. }
  19250. return false;
  19251. };
  19252. const parseDate = function(date, format, lang) {
  19253. const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
  19254. return day.isValid() ? day : void 0;
  19255. };
  19256. const formatter = function(date, format, lang) {
  19257. if (isEmpty(format))
  19258. return date;
  19259. if (format === "x")
  19260. return +date;
  19261. return dayjs(date).locale(lang).format(format);
  19262. };
  19263. const makeList = (total, method) => {
  19264. var _a;
  19265. const arr = [];
  19266. const disabledArr = method == null ? void 0 : method();
  19267. for (let i = 0; i < total; i++) {
  19268. arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
  19269. }
  19270. return arr;
  19271. };
  19272. const dayOrDaysToDate = (dayOrDays) => {
  19273. return isArray$1(dayOrDays) ? dayOrDays.map((d) => d.toDate()) : dayOrDays.toDate();
  19274. };
  19275. const useCommonPicker = (props, emit) => {
  19276. const { lang } = useLocale();
  19277. const pickerVisible = ref(false);
  19278. const pickerActualVisible = ref(false);
  19279. const userInput = ref(null);
  19280. const valueIsEmpty = computed(() => {
  19281. const { modelValue } = props;
  19282. return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length;
  19283. });
  19284. const emitInput = (input) => {
  19285. if (!valueEquals(props.modelValue, input)) {
  19286. let formatted;
  19287. if (isArray$1(input)) {
  19288. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  19289. } else if (input) {
  19290. formatted = formatter(input, props.valueFormat, lang.value);
  19291. }
  19292. const emitVal = input ? formatted : input;
  19293. emit(UPDATE_MODEL_EVENT, emitVal, lang.value);
  19294. }
  19295. };
  19296. const parsedValue = computed(() => {
  19297. var _a;
  19298. let dayOrDays;
  19299. if (valueIsEmpty.value) {
  19300. if (pickerOptions.value.getDefaultValue) {
  19301. dayOrDays = pickerOptions.value.getDefaultValue();
  19302. }
  19303. } else {
  19304. if (isArray$1(props.modelValue)) {
  19305. dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  19306. } else {
  19307. dayOrDays = parseDate((_a = props.modelValue) != null ? _a : "", props.valueFormat, lang.value);
  19308. }
  19309. }
  19310. if (pickerOptions.value.getRangeAvailableTime) {
  19311. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  19312. if (!isEqual$1(availableResult, dayOrDays)) {
  19313. dayOrDays = availableResult;
  19314. if (!valueIsEmpty.value) {
  19315. emitInput(dayOrDaysToDate(dayOrDays));
  19316. }
  19317. }
  19318. }
  19319. if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) {
  19320. dayOrDays = [];
  19321. }
  19322. return dayOrDays;
  19323. });
  19324. const pickerOptions = ref({});
  19325. const onSetPickerOption = (e) => {
  19326. pickerOptions.value[e[0]] = e[1];
  19327. pickerOptions.value.panelReady = true;
  19328. };
  19329. const onCalendarChange = (e) => {
  19330. emit("calendar-change", e);
  19331. };
  19332. const onPanelChange = (value, mode, view) => {
  19333. emit("panel-change", value, mode, view);
  19334. };
  19335. const onPick = (date = "", visible = false) => {
  19336. pickerVisible.value = visible;
  19337. let result;
  19338. if (isArray$1(date)) {
  19339. result = date.map((_) => _.toDate());
  19340. } else {
  19341. result = date ? date.toDate() : date;
  19342. }
  19343. userInput.value = null;
  19344. emitInput(result);
  19345. };
  19346. return {
  19347. parsedValue,
  19348. pickerActualVisible,
  19349. pickerOptions,
  19350. pickerVisible,
  19351. userInput,
  19352. valueIsEmpty,
  19353. emitInput,
  19354. onCalendarChange,
  19355. onPanelChange,
  19356. onPick,
  19357. onSetPickerOption
  19358. };
  19359. };
  19360. const disabledTimeListsProps = buildProps({
  19361. disabledHours: {
  19362. type: definePropType(Function)
  19363. },
  19364. disabledMinutes: {
  19365. type: definePropType(Function)
  19366. },
  19367. disabledSeconds: {
  19368. type: definePropType(Function)
  19369. }
  19370. });
  19371. const timePanelSharedProps = buildProps({
  19372. visible: Boolean,
  19373. actualVisible: {
  19374. type: Boolean,
  19375. default: void 0
  19376. },
  19377. format: {
  19378. type: String,
  19379. default: ""
  19380. }
  19381. });
  19382. const timePickerDefaultProps = buildProps({
  19383. automaticDropdown: {
  19384. type: Boolean,
  19385. default: true
  19386. },
  19387. id: {
  19388. type: definePropType([Array, String])
  19389. },
  19390. name: {
  19391. type: definePropType([Array, String])
  19392. },
  19393. popperClass: useTooltipContentProps.popperClass,
  19394. popperStyle: useTooltipContentProps.popperStyle,
  19395. format: String,
  19396. valueFormat: String,
  19397. dateFormat: String,
  19398. timeFormat: String,
  19399. type: {
  19400. type: String,
  19401. default: ""
  19402. },
  19403. clearable: {
  19404. type: Boolean,
  19405. default: true
  19406. },
  19407. clearIcon: {
  19408. type: definePropType([String, Object]),
  19409. default: circle_close_default
  19410. },
  19411. editable: {
  19412. type: Boolean,
  19413. default: true
  19414. },
  19415. prefixIcon: {
  19416. type: definePropType([String, Object]),
  19417. default: ""
  19418. },
  19419. size: useSizeProp,
  19420. readonly: Boolean,
  19421. disabled: Boolean,
  19422. placeholder: {
  19423. type: String,
  19424. default: ""
  19425. },
  19426. popperOptions: {
  19427. type: definePropType(Object),
  19428. default: () => ({})
  19429. },
  19430. modelValue: {
  19431. type: definePropType([Date, Array, String, Number]),
  19432. default: ""
  19433. },
  19434. rangeSeparator: {
  19435. type: String,
  19436. default: "-"
  19437. },
  19438. startPlaceholder: String,
  19439. endPlaceholder: String,
  19440. defaultValue: {
  19441. type: definePropType([Date, Array])
  19442. },
  19443. defaultTime: {
  19444. type: definePropType([Date, Array])
  19445. },
  19446. isRange: Boolean,
  19447. ...disabledTimeListsProps,
  19448. disabledDate: {
  19449. type: Function
  19450. },
  19451. cellClassName: {
  19452. type: Function
  19453. },
  19454. shortcuts: {
  19455. type: Array,
  19456. default: () => []
  19457. },
  19458. arrowControl: Boolean,
  19459. tabindex: {
  19460. type: definePropType([String, Number]),
  19461. default: 0
  19462. },
  19463. validateEvent: {
  19464. type: Boolean,
  19465. default: true
  19466. },
  19467. unlinkPanels: Boolean,
  19468. placement: {
  19469. type: definePropType(String),
  19470. values: Ee,
  19471. default: "bottom"
  19472. },
  19473. fallbackPlacements: {
  19474. type: definePropType(Array),
  19475. default: ["bottom", "top", "right", "left"]
  19476. },
  19477. ...useEmptyValuesProps,
  19478. ...useAriaProps(["ariaLabel"]),
  19479. showNow: {
  19480. type: Boolean,
  19481. default: true
  19482. },
  19483. showConfirm: {
  19484. type: Boolean,
  19485. default: true
  19486. },
  19487. showFooter: {
  19488. type: Boolean,
  19489. default: true
  19490. },
  19491. showWeekNumber: Boolean
  19492. });
  19493. const timePickerRangeTriggerProps = buildProps({
  19494. id: {
  19495. type: definePropType(Array)
  19496. },
  19497. name: {
  19498. type: definePropType(Array)
  19499. },
  19500. modelValue: {
  19501. type: definePropType([Array, String])
  19502. },
  19503. startPlaceholder: String,
  19504. endPlaceholder: String,
  19505. disabled: Boolean
  19506. });
  19507. const timePickerRngeTriggerProps = timePickerRangeTriggerProps;
  19508. const __default__$1C = defineComponent({
  19509. name: "PickerRangeTrigger",
  19510. inheritAttrs: false
  19511. });
  19512. const _sfc_main$25 = /* @__PURE__ */ defineComponent({
  19513. ...__default__$1C,
  19514. props: timePickerRangeTriggerProps,
  19515. emits: [
  19516. "mouseenter",
  19517. "mouseleave",
  19518. "click",
  19519. "touchstart",
  19520. "focus",
  19521. "blur",
  19522. "startInput",
  19523. "endInput",
  19524. "startChange",
  19525. "endChange"
  19526. ],
  19527. setup(__props, { expose, emit }) {
  19528. const props = __props;
  19529. const { formItem } = useFormItem();
  19530. const { inputId } = useFormItemInputId(reactive({ id: computed(() => {
  19531. var _a;
  19532. return (_a = props.id) == null ? void 0 : _a[0];
  19533. }) }), {
  19534. formItemContext: formItem
  19535. });
  19536. const attrs = useAttrs();
  19537. const nsDate = useNamespace("date");
  19538. const nsRange = useNamespace("range");
  19539. const inputRef = ref();
  19540. const endInputRef = ref();
  19541. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  19542. disabled: computed(() => props.disabled)
  19543. });
  19544. const handleClick = (evt) => {
  19545. emit("click", evt);
  19546. };
  19547. const handleMouseEnter = (evt) => {
  19548. emit("mouseenter", evt);
  19549. };
  19550. const handleMouseLeave = (evt) => {
  19551. emit("mouseleave", evt);
  19552. };
  19553. const handleTouchStart = (evt) => {
  19554. emit("touchstart", evt);
  19555. };
  19556. const handleStartInput = (evt) => {
  19557. emit("startInput", evt);
  19558. };
  19559. const handleEndInput = (evt) => {
  19560. emit("endInput", evt);
  19561. };
  19562. const handleStartChange = (evt) => {
  19563. emit("startChange", evt);
  19564. };
  19565. const handleEndChange = (evt) => {
  19566. emit("endChange", evt);
  19567. };
  19568. const focus = () => {
  19569. var _a;
  19570. (_a = inputRef.value) == null ? void 0 : _a.focus();
  19571. };
  19572. const blur = () => {
  19573. var _a, _b;
  19574. (_a = inputRef.value) == null ? void 0 : _a.blur();
  19575. (_b = endInputRef.value) == null ? void 0 : _b.blur();
  19576. };
  19577. expose({
  19578. focus,
  19579. blur
  19580. });
  19581. return (_ctx, _cache) => {
  19582. return openBlock(), createElementBlock("div", {
  19583. ref_key: "wrapperRef",
  19584. ref: wrapperRef,
  19585. class: normalizeClass([unref(nsDate).is("active", unref(isFocused)), _ctx.$attrs.class]),
  19586. style: normalizeStyle(_ctx.$attrs.style),
  19587. onClick: handleClick,
  19588. onMouseenter: handleMouseEnter,
  19589. onMouseleave: handleMouseLeave,
  19590. onTouchstartPassive: handleTouchStart
  19591. }, [
  19592. renderSlot(_ctx.$slots, "prefix"),
  19593. createElementVNode("input", mergeProps(unref(attrs), {
  19594. id: unref(inputId),
  19595. ref_key: "inputRef",
  19596. ref: inputRef,
  19597. name: _ctx.name && _ctx.name[0],
  19598. placeholder: _ctx.startPlaceholder,
  19599. value: _ctx.modelValue && _ctx.modelValue[0],
  19600. class: unref(nsRange).b("input"),
  19601. disabled: _ctx.disabled,
  19602. onInput: handleStartInput,
  19603. onChange: handleStartChange
  19604. }), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
  19605. renderSlot(_ctx.$slots, "range-separator"),
  19606. createElementVNode("input", mergeProps(unref(attrs), {
  19607. id: _ctx.id && _ctx.id[1],
  19608. ref_key: "endInputRef",
  19609. ref: endInputRef,
  19610. name: _ctx.name && _ctx.name[1],
  19611. placeholder: _ctx.endPlaceholder,
  19612. value: _ctx.modelValue && _ctx.modelValue[1],
  19613. class: unref(nsRange).b("input"),
  19614. disabled: _ctx.disabled,
  19615. onInput: handleEndInput,
  19616. onChange: handleEndChange
  19617. }), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
  19618. renderSlot(_ctx.$slots, "suffix")
  19619. ], 38);
  19620. };
  19621. }
  19622. });
  19623. var PickerRangeTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["__file", "picker-range-trigger.vue"]]);
  19624. const __default__$1B = defineComponent({
  19625. name: "Picker"
  19626. });
  19627. const _sfc_main$24 = /* @__PURE__ */ defineComponent({
  19628. ...__default__$1B,
  19629. props: timePickerDefaultProps,
  19630. emits: [
  19631. UPDATE_MODEL_EVENT,
  19632. CHANGE_EVENT,
  19633. "focus",
  19634. "blur",
  19635. "clear",
  19636. "calendar-change",
  19637. "panel-change",
  19638. "visible-change",
  19639. "keydown"
  19640. ],
  19641. setup(__props, { expose, emit }) {
  19642. const props = __props;
  19643. const attrs = useAttrs$1();
  19644. const nsDate = useNamespace("date");
  19645. const nsInput = useNamespace("input");
  19646. const nsRange = useNamespace("range");
  19647. const { formItem } = useFormItem();
  19648. const elPopperOptions = inject(PICKER_POPPER_OPTIONS_INJECTION_KEY, {});
  19649. const emptyValues = useEmptyValues(props, null);
  19650. const refPopper = ref();
  19651. const inputRef = ref();
  19652. const valueOnOpen = ref(null);
  19653. let hasJustTabExitedInput = false;
  19654. const pickerDisabled = useFormDisabled();
  19655. const commonPicker = useCommonPicker(props, emit);
  19656. const {
  19657. parsedValue,
  19658. pickerActualVisible,
  19659. userInput,
  19660. pickerVisible,
  19661. pickerOptions,
  19662. valueIsEmpty,
  19663. emitInput,
  19664. onPick,
  19665. onSetPickerOption,
  19666. onCalendarChange,
  19667. onPanelChange
  19668. } = commonPicker;
  19669. const { isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
  19670. disabled: pickerDisabled,
  19671. beforeFocus() {
  19672. return props.readonly;
  19673. },
  19674. afterFocus() {
  19675. if (!props.automaticDropdown)
  19676. return;
  19677. pickerVisible.value = true;
  19678. },
  19679. beforeBlur(event) {
  19680. var _a;
  19681. return !hasJustTabExitedInput && ((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent(event));
  19682. },
  19683. afterBlur() {
  19684. handleChange();
  19685. pickerVisible.value = false;
  19686. hasJustTabExitedInput = false;
  19687. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn(err)));
  19688. }
  19689. });
  19690. const hovering = ref(false);
  19691. const rangeInputKls = computed(() => [
  19692. nsDate.b("editor"),
  19693. nsDate.bm("editor", props.type),
  19694. nsInput.e("wrapper"),
  19695. nsDate.is("disabled", pickerDisabled.value),
  19696. nsDate.is("active", pickerVisible.value),
  19697. nsRange.b("editor"),
  19698. pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
  19699. attrs.class
  19700. ]);
  19701. const clearIconKls = computed(() => [
  19702. nsInput.e("icon"),
  19703. nsRange.e("close-icon"),
  19704. !showClearBtn.value ? nsRange.em("close-icon", "hidden") : ""
  19705. ]);
  19706. watch(pickerVisible, (val) => {
  19707. if (!val) {
  19708. userInput.value = null;
  19709. nextTick(() => {
  19710. emitChange(props.modelValue);
  19711. });
  19712. } else {
  19713. nextTick(() => {
  19714. if (val) {
  19715. valueOnOpen.value = props.modelValue;
  19716. }
  19717. });
  19718. }
  19719. });
  19720. const emitChange = (val, isClear) => {
  19721. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  19722. emit(CHANGE_EVENT, val);
  19723. isClear && (valueOnOpen.value = val);
  19724. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err)));
  19725. }
  19726. };
  19727. const emitKeydown = (e) => {
  19728. emit("keydown", e);
  19729. };
  19730. const refInput = computed(() => {
  19731. if (inputRef.value) {
  19732. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  19733. }
  19734. return [];
  19735. });
  19736. const setSelectionRange = (start, end, pos) => {
  19737. const _inputs = refInput.value;
  19738. if (!_inputs.length)
  19739. return;
  19740. if (!pos || pos === "min") {
  19741. _inputs[0].setSelectionRange(start, end);
  19742. _inputs[0].focus();
  19743. } else if (pos === "max") {
  19744. _inputs[1].setSelectionRange(start, end);
  19745. _inputs[1].focus();
  19746. }
  19747. };
  19748. const onBeforeShow = () => {
  19749. pickerActualVisible.value = true;
  19750. };
  19751. const onShow = () => {
  19752. emit("visible-change", true);
  19753. };
  19754. const onHide = () => {
  19755. pickerActualVisible.value = false;
  19756. pickerVisible.value = false;
  19757. emit("visible-change", false);
  19758. };
  19759. const handleOpen = () => {
  19760. pickerVisible.value = true;
  19761. };
  19762. const handleClose = () => {
  19763. pickerVisible.value = false;
  19764. };
  19765. const displayValue = computed(() => {
  19766. const formattedValue = formatToString(parsedValue.value);
  19767. if (isArray$1(userInput.value)) {
  19768. return [
  19769. userInput.value[0] || formattedValue && formattedValue[0] || "",
  19770. userInput.value[1] || formattedValue && formattedValue[1] || ""
  19771. ];
  19772. } else if (userInput.value !== null) {
  19773. return userInput.value;
  19774. }
  19775. if (!isTimePicker.value && valueIsEmpty.value)
  19776. return "";
  19777. if (!pickerVisible.value && valueIsEmpty.value)
  19778. return "";
  19779. if (formattedValue) {
  19780. return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
  19781. }
  19782. return "";
  19783. });
  19784. const isTimeLikePicker = computed(() => props.type.includes("time"));
  19785. const isTimePicker = computed(() => props.type.startsWith("time"));
  19786. const isDatesPicker = computed(() => props.type === "dates");
  19787. const isMonthsPicker = computed(() => props.type === "months");
  19788. const isYearsPicker = computed(() => props.type === "years");
  19789. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  19790. const showClearBtn = computed(() => props.clearable && !pickerDisabled.value && !props.readonly && !valueIsEmpty.value && (hovering.value || isFocused.value));
  19791. const onClearIconClick = (event) => {
  19792. if (props.readonly || pickerDisabled.value)
  19793. return;
  19794. if (showClearBtn.value) {
  19795. event.stopPropagation();
  19796. if (pickerOptions.value.handleClear) {
  19797. pickerOptions.value.handleClear();
  19798. } else {
  19799. emitInput(emptyValues.valueOnClear.value);
  19800. }
  19801. emitChange(emptyValues.valueOnClear.value, true);
  19802. onHide();
  19803. }
  19804. emit("clear");
  19805. };
  19806. const onMouseDownInput = async (event) => {
  19807. var _a;
  19808. if (props.readonly || pickerDisabled.value)
  19809. return;
  19810. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value || !props.automaticDropdown) {
  19811. pickerVisible.value = true;
  19812. }
  19813. };
  19814. const onMouseEnter = () => {
  19815. if (props.readonly || pickerDisabled.value)
  19816. return;
  19817. if (!valueIsEmpty.value && props.clearable) {
  19818. hovering.value = true;
  19819. }
  19820. };
  19821. const onMouseLeave = () => {
  19822. hovering.value = false;
  19823. };
  19824. const onTouchStartInput = (event) => {
  19825. var _a;
  19826. if (props.readonly || pickerDisabled.value)
  19827. return;
  19828. if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value || !props.automaticDropdown) {
  19829. pickerVisible.value = true;
  19830. }
  19831. };
  19832. const isRangeInput = computed(() => {
  19833. return props.type.includes("range");
  19834. });
  19835. const pickerSize = useFormSize();
  19836. const popperEl = computed(() => {
  19837. var _a, _b;
  19838. return (_b = (_a = unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  19839. });
  19840. const stophandle = onClickOutside(inputRef, (e) => {
  19841. const unrefedPopperEl = unref(popperEl);
  19842. const inputEl = unrefElement(inputRef);
  19843. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || inputEl && e.composedPath().includes(inputEl))
  19844. return;
  19845. pickerVisible.value = false;
  19846. });
  19847. onBeforeUnmount(() => {
  19848. stophandle == null ? void 0 : stophandle();
  19849. });
  19850. const handleChange = () => {
  19851. if (userInput.value) {
  19852. const value = parseUserInputToDayjs(displayValue.value);
  19853. if (value) {
  19854. if (isValidValue(value)) {
  19855. emitInput(dayOrDaysToDate(value));
  19856. userInput.value = null;
  19857. }
  19858. }
  19859. }
  19860. if (userInput.value === "") {
  19861. emitInput(emptyValues.valueOnClear.value);
  19862. emitChange(emptyValues.valueOnClear.value, true);
  19863. userInput.value = null;
  19864. }
  19865. };
  19866. const parseUserInputToDayjs = (value) => {
  19867. if (!value)
  19868. return null;
  19869. return pickerOptions.value.parseUserInput(value);
  19870. };
  19871. const formatToString = (value) => {
  19872. if (!value)
  19873. return null;
  19874. const res = isArray$1(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
  19875. return res;
  19876. };
  19877. const isValidValue = (value) => {
  19878. return pickerOptions.value.isValidValue(value);
  19879. };
  19880. const handleKeydownInput = async (event) => {
  19881. if (props.readonly || pickerDisabled.value)
  19882. return;
  19883. const code = getEventCode(event);
  19884. emitKeydown(event);
  19885. if (code === EVENT_CODE.esc) {
  19886. if (pickerVisible.value === true) {
  19887. pickerVisible.value = false;
  19888. event.preventDefault();
  19889. event.stopPropagation();
  19890. }
  19891. return;
  19892. }
  19893. if (code === EVENT_CODE.down) {
  19894. if (pickerOptions.value.handleFocusPicker) {
  19895. event.preventDefault();
  19896. event.stopPropagation();
  19897. }
  19898. if (pickerVisible.value === false) {
  19899. pickerVisible.value = true;
  19900. await nextTick();
  19901. }
  19902. if (pickerOptions.value.handleFocusPicker) {
  19903. pickerOptions.value.handleFocusPicker();
  19904. return;
  19905. }
  19906. }
  19907. if (code === EVENT_CODE.tab) {
  19908. hasJustTabExitedInput = true;
  19909. return;
  19910. }
  19911. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  19912. if (!pickerVisible.value) {
  19913. pickerVisible.value = true;
  19914. } else if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  19915. handleChange();
  19916. pickerVisible.value = false;
  19917. }
  19918. event.preventDefault();
  19919. event.stopPropagation();
  19920. return;
  19921. }
  19922. if (userInput.value) {
  19923. event.stopPropagation();
  19924. return;
  19925. }
  19926. if (pickerOptions.value.handleKeydownInput) {
  19927. pickerOptions.value.handleKeydownInput(event);
  19928. }
  19929. };
  19930. const onUserInput = (e) => {
  19931. userInput.value = e;
  19932. if (!pickerVisible.value) {
  19933. pickerVisible.value = true;
  19934. }
  19935. };
  19936. const handleStartInput = (event) => {
  19937. const target = event.target;
  19938. if (userInput.value) {
  19939. userInput.value = [target.value, userInput.value[1]];
  19940. } else {
  19941. userInput.value = [target.value, null];
  19942. }
  19943. };
  19944. const handleEndInput = (event) => {
  19945. const target = event.target;
  19946. if (userInput.value) {
  19947. userInput.value = [userInput.value[0], target.value];
  19948. } else {
  19949. userInput.value = [null, target.value];
  19950. }
  19951. };
  19952. const handleStartChange = () => {
  19953. var _a;
  19954. const values = userInput.value;
  19955. const value = parseUserInputToDayjs(values && values[0]);
  19956. const parsedVal = unref(parsedValue);
  19957. if (value && value.isValid()) {
  19958. userInput.value = [
  19959. formatToString(value),
  19960. ((_a = displayValue.value) == null ? void 0 : _a[1]) || null
  19961. ];
  19962. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  19963. if (isValidValue(newValue)) {
  19964. emitInput(dayOrDaysToDate(newValue));
  19965. userInput.value = null;
  19966. }
  19967. }
  19968. };
  19969. const handleEndChange = () => {
  19970. var _a;
  19971. const values = unref(userInput);
  19972. const value = parseUserInputToDayjs(values && values[1]);
  19973. const parsedVal = unref(parsedValue);
  19974. if (value && value.isValid()) {
  19975. userInput.value = [
  19976. ((_a = unref(displayValue)) == null ? void 0 : _a[0]) || null,
  19977. formatToString(value)
  19978. ];
  19979. const newValue = [parsedVal && parsedVal[0], value];
  19980. if (isValidValue(newValue)) {
  19981. emitInput(dayOrDaysToDate(newValue));
  19982. userInput.value = null;
  19983. }
  19984. }
  19985. };
  19986. const focus = () => {
  19987. var _a;
  19988. (_a = inputRef.value) == null ? void 0 : _a.focus();
  19989. };
  19990. const blur = () => {
  19991. var _a;
  19992. (_a = inputRef.value) == null ? void 0 : _a.blur();
  19993. };
  19994. provide(PICKER_BASE_INJECTION_KEY, {
  19995. props,
  19996. emptyValues
  19997. });
  19998. provide(ROOT_COMMON_PICKER_INJECTION_KEY, commonPicker);
  19999. expose({
  20000. focus,
  20001. blur,
  20002. handleOpen,
  20003. handleClose,
  20004. onPick
  20005. });
  20006. return (_ctx, _cache) => {
  20007. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  20008. ref_key: "refPopper",
  20009. ref: refPopper,
  20010. visible: unref(pickerVisible),
  20011. effect: "light",
  20012. pure: "",
  20013. trigger: "click"
  20014. }, _ctx.$attrs, {
  20015. role: "dialog",
  20016. teleported: "",
  20017. transition: `${unref(nsDate).namespace.value}-zoom-in-top`,
  20018. "popper-class": [`${unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  20019. "popper-style": _ctx.popperStyle,
  20020. "popper-options": unref(elPopperOptions),
  20021. "fallback-placements": _ctx.fallbackPlacements,
  20022. "gpu-acceleration": false,
  20023. placement: _ctx.placement,
  20024. "stop-popper-mouse-event": false,
  20025. "hide-after": 0,
  20026. persistent: "",
  20027. onBeforeShow,
  20028. onShow,
  20029. onHide
  20030. }), {
  20031. default: withCtx(() => [
  20032. !unref(isRangeInput) ? (openBlock(), createBlock(unref(ElInput), {
  20033. key: 0,
  20034. id: _ctx.id,
  20035. ref_key: "inputRef",
  20036. ref: inputRef,
  20037. "container-role": "combobox",
  20038. "model-value": unref(displayValue),
  20039. name: _ctx.name,
  20040. size: unref(pickerSize),
  20041. disabled: unref(pickerDisabled),
  20042. placeholder: _ctx.placeholder,
  20043. class: normalizeClass([
  20044. unref(nsDate).b("editor"),
  20045. unref(nsDate).bm("editor", _ctx.type),
  20046. unref(nsDate).is("focus", unref(pickerVisible)),
  20047. _ctx.$attrs.class
  20048. ]),
  20049. style: normalizeStyle(_ctx.$attrs.style),
  20050. readonly: !_ctx.editable || _ctx.readonly || unref(isDatesPicker) || unref(isMonthsPicker) || unref(isYearsPicker) || _ctx.type === "week",
  20051. "aria-label": _ctx.ariaLabel,
  20052. tabindex: _ctx.tabindex,
  20053. "validate-event": false,
  20054. onInput: onUserInput,
  20055. onFocus: unref(handleFocus),
  20056. onBlur: unref(handleBlur),
  20057. onKeydown: handleKeydownInput,
  20058. onChange: handleChange,
  20059. onMousedown: onMouseDownInput,
  20060. onMouseenter: onMouseEnter,
  20061. onMouseleave: onMouseLeave,
  20062. onTouchstartPassive: onTouchStartInput,
  20063. onClick: withModifiers(() => {
  20064. }, ["stop"])
  20065. }, {
  20066. prefix: withCtx(() => [
  20067. unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  20068. key: 0,
  20069. class: normalizeClass(unref(nsInput).e("icon")),
  20070. onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
  20071. onTouchstartPassive: onTouchStartInput
  20072. }, {
  20073. default: withCtx(() => [
  20074. (openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
  20075. ]),
  20076. _: 1
  20077. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
  20078. ]),
  20079. suffix: withCtx(() => [
  20080. unref(showClearBtn) && _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  20081. key: 0,
  20082. class: normalizeClass(`${unref(nsInput).e("icon")} clear-icon`),
  20083. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  20084. onClick: onClearIconClick
  20085. }, {
  20086. default: withCtx(() => [
  20087. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  20088. ]),
  20089. _: 1
  20090. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
  20091. ]),
  20092. _: 1
  20093. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "aria-label", "tabindex", "onFocus", "onBlur", "onClick"])) : (openBlock(), createBlock(PickerRangeTrigger, {
  20094. key: 1,
  20095. id: _ctx.id,
  20096. ref_key: "inputRef",
  20097. ref: inputRef,
  20098. "model-value": unref(displayValue),
  20099. name: _ctx.name,
  20100. disabled: unref(pickerDisabled),
  20101. readonly: !_ctx.editable || _ctx.readonly,
  20102. "start-placeholder": _ctx.startPlaceholder,
  20103. "end-placeholder": _ctx.endPlaceholder,
  20104. class: normalizeClass(unref(rangeInputKls)),
  20105. style: normalizeStyle(_ctx.$attrs.style),
  20106. "aria-label": _ctx.ariaLabel,
  20107. tabindex: _ctx.tabindex,
  20108. autocomplete: "off",
  20109. role: "combobox",
  20110. onClick: onMouseDownInput,
  20111. onFocus: unref(handleFocus),
  20112. onBlur: unref(handleBlur),
  20113. onStartInput: handleStartInput,
  20114. onStartChange: handleStartChange,
  20115. onEndInput: handleEndInput,
  20116. onEndChange: handleEndChange,
  20117. onMousedown: onMouseDownInput,
  20118. onMouseenter: onMouseEnter,
  20119. onMouseleave: onMouseLeave,
  20120. onTouchstartPassive: onTouchStartInput,
  20121. onKeydown: handleKeydownInput
  20122. }, {
  20123. prefix: withCtx(() => [
  20124. unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  20125. key: 0,
  20126. class: normalizeClass([unref(nsInput).e("icon"), unref(nsRange).e("icon")])
  20127. }, {
  20128. default: withCtx(() => [
  20129. (openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
  20130. ]),
  20131. _: 1
  20132. }, 8, ["class"])) : createCommentVNode("v-if", true)
  20133. ]),
  20134. "range-separator": withCtx(() => [
  20135. renderSlot(_ctx.$slots, "range-separator", {}, () => [
  20136. createElementVNode("span", {
  20137. class: normalizeClass(unref(nsRange).b("separator"))
  20138. }, toDisplayString(_ctx.rangeSeparator), 3)
  20139. ])
  20140. ]),
  20141. suffix: withCtx(() => [
  20142. _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  20143. key: 0,
  20144. class: normalizeClass(unref(clearIconKls)),
  20145. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  20146. onClick: onClearIconClick
  20147. }, {
  20148. default: withCtx(() => [
  20149. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  20150. ]),
  20151. _: 1
  20152. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
  20153. ]),
  20154. _: 3
  20155. }, 8, ["id", "model-value", "name", "disabled", "readonly", "start-placeholder", "end-placeholder", "class", "style", "aria-label", "tabindex", "onFocus", "onBlur"]))
  20156. ]),
  20157. content: withCtx(() => [
  20158. renderSlot(_ctx.$slots, "default", {
  20159. visible: unref(pickerVisible),
  20160. actualVisible: unref(pickerActualVisible),
  20161. parsedValue: unref(parsedValue),
  20162. format: _ctx.format,
  20163. dateFormat: _ctx.dateFormat,
  20164. timeFormat: _ctx.timeFormat,
  20165. unlinkPanels: _ctx.unlinkPanels,
  20166. type: _ctx.type,
  20167. defaultValue: _ctx.defaultValue,
  20168. showNow: _ctx.showNow,
  20169. showConfirm: _ctx.showConfirm,
  20170. showFooter: _ctx.showFooter,
  20171. showWeekNumber: _ctx.showWeekNumber,
  20172. onPick: unref(onPick),
  20173. onSelectRange: setSelectionRange,
  20174. onSetPickerOption: unref(onSetPickerOption),
  20175. onCalendarChange: unref(onCalendarChange),
  20176. onPanelChange: unref(onPanelChange),
  20177. onMousedown: withModifiers(() => {
  20178. }, ["stop"])
  20179. })
  20180. ]),
  20181. _: 3
  20182. }, 16, ["visible", "transition", "popper-class", "popper-style", "popper-options", "fallback-placements", "placement"]);
  20183. };
  20184. }
  20185. });
  20186. var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "picker.vue"]]);
  20187. const panelTimePickerProps = buildProps({
  20188. ...timePanelSharedProps,
  20189. datetimeRole: String,
  20190. parsedValue: {
  20191. type: definePropType(Object)
  20192. }
  20193. });
  20194. const useTimePanel = ({
  20195. getAvailableHours,
  20196. getAvailableMinutes,
  20197. getAvailableSeconds
  20198. }) => {
  20199. const getAvailableTime = (date, role, first, compareDate) => {
  20200. const availableTimeGetters = {
  20201. hour: getAvailableHours,
  20202. minute: getAvailableMinutes,
  20203. second: getAvailableSeconds
  20204. };
  20205. let result = date;
  20206. ["hour", "minute", "second"].forEach((type) => {
  20207. if (availableTimeGetters[type]) {
  20208. let availableTimeSlots;
  20209. const method = availableTimeGetters[type];
  20210. switch (type) {
  20211. case "minute": {
  20212. availableTimeSlots = method(result.hour(), role, compareDate);
  20213. break;
  20214. }
  20215. case "second": {
  20216. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  20217. break;
  20218. }
  20219. default: {
  20220. availableTimeSlots = method(role, compareDate);
  20221. break;
  20222. }
  20223. }
  20224. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
  20225. const pos = first ? 0 : availableTimeSlots.length - 1;
  20226. result = result[type](availableTimeSlots[pos]);
  20227. }
  20228. }
  20229. });
  20230. return result;
  20231. };
  20232. const timePickerOptions = {};
  20233. const onSetOption = ([key, val]) => {
  20234. timePickerOptions[key] = val;
  20235. };
  20236. return {
  20237. timePickerOptions,
  20238. getAvailableTime,
  20239. onSetOption
  20240. };
  20241. };
  20242. const makeAvailableArr = (disabledList) => {
  20243. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  20244. const getNumber = (predicate) => predicate !== true;
  20245. return disabledList.map(trueOrNumber).filter(getNumber);
  20246. };
  20247. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  20248. const getHoursList = (role, compare) => {
  20249. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  20250. };
  20251. const getMinutesList = (hour, role, compare) => {
  20252. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  20253. };
  20254. const getSecondsList = (hour, minute, role, compare) => {
  20255. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  20256. };
  20257. return {
  20258. getHoursList,
  20259. getMinutesList,
  20260. getSecondsList
  20261. };
  20262. };
  20263. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  20264. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  20265. const getAvailableHours = (role, compare) => {
  20266. return makeAvailableArr(getHoursList(role, compare));
  20267. };
  20268. const getAvailableMinutes = (hour, role, compare) => {
  20269. return makeAvailableArr(getMinutesList(hour, role, compare));
  20270. };
  20271. const getAvailableSeconds = (hour, minute, role, compare) => {
  20272. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  20273. };
  20274. return {
  20275. getAvailableHours,
  20276. getAvailableMinutes,
  20277. getAvailableSeconds
  20278. };
  20279. };
  20280. const useOldValue = (props) => {
  20281. const oldValue = ref(props.parsedValue);
  20282. watch(() => props.visible, (val) => {
  20283. if (!val) {
  20284. oldValue.value = props.parsedValue;
  20285. }
  20286. });
  20287. return oldValue;
  20288. };
  20289. const nodeList = /* @__PURE__ */ new Map();
  20290. if (isClient) {
  20291. let startClick;
  20292. document.addEventListener("mousedown", (e) => startClick = e);
  20293. document.addEventListener("mouseup", (e) => {
  20294. if (startClick) {
  20295. for (const handlers of nodeList.values()) {
  20296. for (const { documentHandler } of handlers) {
  20297. documentHandler(e, startClick);
  20298. }
  20299. }
  20300. startClick = void 0;
  20301. }
  20302. });
  20303. }
  20304. function createDocumentHandler(el, binding) {
  20305. let excludes = [];
  20306. if (isArray$1(binding.arg)) {
  20307. excludes = binding.arg;
  20308. } else if (isElement$2(binding.arg)) {
  20309. excludes.push(binding.arg);
  20310. }
  20311. return function(mouseup, mousedown) {
  20312. const popperRef = binding.instance.popperRef;
  20313. const mouseUpTarget = mouseup.target;
  20314. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  20315. const isBound = !binding || !binding.instance;
  20316. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  20317. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  20318. const isSelf = el === mouseUpTarget;
  20319. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  20320. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  20321. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  20322. return;
  20323. }
  20324. binding.value(mouseup, mousedown);
  20325. };
  20326. }
  20327. const ClickOutside = {
  20328. beforeMount(el, binding) {
  20329. if (!nodeList.has(el)) {
  20330. nodeList.set(el, []);
  20331. }
  20332. nodeList.get(el).push({
  20333. documentHandler: createDocumentHandler(el, binding),
  20334. bindingFn: binding.value
  20335. });
  20336. },
  20337. updated(el, binding) {
  20338. if (!nodeList.has(el)) {
  20339. nodeList.set(el, []);
  20340. }
  20341. const handlers = nodeList.get(el);
  20342. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  20343. const newHandler = {
  20344. documentHandler: createDocumentHandler(el, binding),
  20345. bindingFn: binding.value
  20346. };
  20347. if (oldHandlerIndex >= 0) {
  20348. handlers.splice(oldHandlerIndex, 1, newHandler);
  20349. } else {
  20350. handlers.push(newHandler);
  20351. }
  20352. },
  20353. unmounted(el) {
  20354. nodeList.delete(el);
  20355. }
  20356. };
  20357. const REPEAT_INTERVAL = 100;
  20358. const REPEAT_DELAY = 600;
  20359. const SCOPE$5 = "_RepeatClick";
  20360. const vRepeatClick = {
  20361. beforeMount(el, binding) {
  20362. const value = binding.value;
  20363. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$1(value) ? {} : value;
  20364. let intervalId;
  20365. let delayId;
  20366. const handler = () => isFunction$1(value) ? value() : value.handler();
  20367. const clear = () => {
  20368. if (delayId) {
  20369. clearTimeout(delayId);
  20370. delayId = void 0;
  20371. }
  20372. if (intervalId) {
  20373. clearInterval(intervalId);
  20374. intervalId = void 0;
  20375. }
  20376. };
  20377. const start = (evt) => {
  20378. if (evt.button !== 0)
  20379. return;
  20380. clear();
  20381. handler();
  20382. document.addEventListener("mouseup", clear, { once: true });
  20383. delayId = setTimeout(() => {
  20384. intervalId = setInterval(() => {
  20385. handler();
  20386. }, interval);
  20387. }, delay);
  20388. };
  20389. el[SCOPE$5] = { start, clear };
  20390. el.addEventListener("mousedown", start);
  20391. },
  20392. unmounted(el) {
  20393. if (!el[SCOPE$5])
  20394. return;
  20395. const { start, clear } = el[SCOPE$5];
  20396. if (start) {
  20397. el.removeEventListener("mousedown", start);
  20398. }
  20399. if (clear) {
  20400. clear();
  20401. document.removeEventListener("mouseup", clear);
  20402. }
  20403. el[SCOPE$5] = null;
  20404. }
  20405. };
  20406. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  20407. const FOCUS_STACK = [];
  20408. const FOCUS_HANDLER = (e) => {
  20409. if (FOCUS_STACK.length === 0)
  20410. return;
  20411. const code = getEventCode(e);
  20412. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  20413. if (focusableElement.length > 0 && code === EVENT_CODE.tab) {
  20414. if (focusableElement.length === 1) {
  20415. e.preventDefault();
  20416. if (document.activeElement !== focusableElement[0]) {
  20417. focusableElement[0].focus();
  20418. }
  20419. return;
  20420. }
  20421. const goingBackward = e.shiftKey;
  20422. const isFirst = e.target === focusableElement[0];
  20423. const isLast = e.target === focusableElement[focusableElement.length - 1];
  20424. if (isFirst && goingBackward) {
  20425. e.preventDefault();
  20426. focusableElement[focusableElement.length - 1].focus();
  20427. }
  20428. if (isLast && !goingBackward) {
  20429. e.preventDefault();
  20430. focusableElement[0].focus();
  20431. }
  20432. }
  20433. };
  20434. const TrapFocus = {
  20435. beforeMount(el) {
  20436. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  20437. FOCUS_STACK.push(el);
  20438. if (FOCUS_STACK.length <= 1) {
  20439. document.addEventListener("keydown", FOCUS_HANDLER);
  20440. }
  20441. },
  20442. updated(el) {
  20443. nextTick(() => {
  20444. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  20445. });
  20446. },
  20447. unmounted() {
  20448. FOCUS_STACK.shift();
  20449. if (FOCUS_STACK.length === 0) {
  20450. document.removeEventListener("keydown", FOCUS_HANDLER);
  20451. }
  20452. }
  20453. };
  20454. var v=!1,o,f,s,u,d,N,l,p,m,w,D,x,E,M,F;function a(){if(!v){v=!0;var e=navigator.userAgent,n=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),i=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(x=/\b(iPhone|iP[ao]d)/.exec(e),E=/\b(iP[ao]d)/.exec(e),w=/Android/i.exec(e),M=/FBAN\/\w+;/i.exec(e),F=/Mobile/i.exec(e),D=!!/Win64/.exec(e),n){o=n[1]?parseFloat(n[1]):n[5]?parseFloat(n[5]):NaN,o&&document&&document.documentMode&&(o=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(e);N=r?parseFloat(r[1])+4:o,f=n[2]?parseFloat(n[2]):NaN,s=n[3]?parseFloat(n[3]):NaN,u=n[4]?parseFloat(n[4]):NaN,u?(n=/(?:Chrome\/(\d+\.\d+))/.exec(e),d=n&&n[1]?parseFloat(n[1]):NaN):d=NaN;}else o=f=s=d=u=NaN;if(i){if(i[1]){var t=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);l=t?parseFloat(t[1].replace("_",".")):!0;}else l=!1;p=!!i[2],m=!!i[3];}else l=p=m=!1;}}var _={ie:function(){return a()||o},ieCompatibilityMode:function(){return a()||N>o},ie64:function(){return _.ie()&&D},firefox:function(){return a()||f},opera:function(){return a()||s},webkit:function(){return a()||u},safari:function(){return _.webkit()},chrome:function(){return a()||d},windows:function(){return a()||p},osx:function(){return a()||l},linux:function(){return a()||m},iphone:function(){return a()||x},mobile:function(){return a()||x||E||w||F},nativeApp:function(){return a()||M},android:function(){return a()||w},ipad:function(){return a()||E}},A=_;var c=!!(typeof window<"u"&&window.document&&window.document.createElement),U={canUseDOM:c,canUseWorkers:typeof Worker<"u",canUseEventListeners:c&&!!(window.addEventListener||window.attachEvent),canUseViewport:c&&!!window.screen,isInWorker:!c},h=U;var X;h.canUseDOM&&(X=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function S(e,n){if(!h.canUseDOM||n&&!("addEventListener"in document))return !1;var i="on"+e,r=i in document;if(!r){var t=document.createElement("div");t.setAttribute(i,"return;"),r=typeof t[i]=="function";}return !r&&X&&e==="wheel"&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var b=S;var O=10,I=40,P=800;function T(e){var n=0,i=0,r=0,t=0;return "detail"in e&&(i=e.detail),"wheelDelta"in e&&(i=-e.wheelDelta/120),"wheelDeltaY"in e&&(i=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(n=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(n=i,i=0),r=n*O,t=i*O,"deltaY"in e&&(t=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||t)&&e.deltaMode&&(e.deltaMode==1?(r*=I,t*=I):(r*=P,t*=P)),r&&!n&&(n=r<1?-1:1),t&&!i&&(i=t<1?-1:1),{spinX:n,spinY:i,pixelX:r,pixelY:t}}T.getEventType=function(){return A.firefox()?"DOMMouseScroll":b("wheel")?"wheel":"mousewheel"};var Y=T;/**
  20455. * Checks if an event is supported in the current execution environment.
  20456. *
  20457. * NOTE: This will not work correctly for non-generic events such as `change`,
  20458. * `reset`, `load`, `error`, and `select`.
  20459. *
  20460. * Borrows from Modernizr.
  20461. *
  20462. * @param {string} eventNameSuffix Event name, e.g. "click".
  20463. * @param {?boolean} capture Check if the capture phase is supported.
  20464. * @return {boolean} True if the event is supported.
  20465. * @internal
  20466. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  20467. */
  20468. const SCOPE$4 = "_Mousewheel";
  20469. const mousewheel = function(element, callback) {
  20470. if (element && element.addEventListener) {
  20471. removeWheelHandler(element);
  20472. const fn = function(event) {
  20473. const normalized = Y(event);
  20474. callback && Reflect.apply(callback, this, [event, normalized]);
  20475. };
  20476. element[SCOPE$4] = { wheelHandler: fn };
  20477. element.addEventListener("wheel", fn, { passive: true });
  20478. }
  20479. };
  20480. const removeWheelHandler = (element) => {
  20481. var _a;
  20482. if ((_a = element[SCOPE$4]) == null ? void 0 : _a.wheelHandler) {
  20483. element.removeEventListener("wheel", element[SCOPE$4].wheelHandler);
  20484. element[SCOPE$4] = null;
  20485. }
  20486. };
  20487. const Mousewheel = {
  20488. beforeMount(el, binding) {
  20489. mousewheel(el, binding.value);
  20490. },
  20491. unmounted(el) {
  20492. removeWheelHandler(el);
  20493. },
  20494. updated(el, binding) {
  20495. if (binding.value !== binding.oldValue) {
  20496. mousewheel(el, binding.value);
  20497. }
  20498. }
  20499. };
  20500. const basicTimeSpinnerProps = buildProps({
  20501. role: {
  20502. type: String,
  20503. required: true
  20504. },
  20505. spinnerDate: {
  20506. type: definePropType(Object),
  20507. required: true
  20508. },
  20509. showSeconds: {
  20510. type: Boolean,
  20511. default: true
  20512. },
  20513. arrowControl: Boolean,
  20514. amPmMode: {
  20515. type: definePropType(String),
  20516. default: ""
  20517. },
  20518. ...disabledTimeListsProps
  20519. });
  20520. const _sfc_main$23 = /* @__PURE__ */ defineComponent({
  20521. __name: "basic-time-spinner",
  20522. props: basicTimeSpinnerProps,
  20523. emits: [CHANGE_EVENT, "select-range", "set-option"],
  20524. setup(__props, { emit }) {
  20525. const props = __props;
  20526. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  20527. const { isRange, format } = pickerBase.props;
  20528. const ns = useNamespace("time");
  20529. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  20530. let isScrolling = false;
  20531. const currentScrollbar = ref();
  20532. const listHoursRef = ref();
  20533. const listMinutesRef = ref();
  20534. const listSecondsRef = ref();
  20535. const listRefsMap = {
  20536. hours: listHoursRef,
  20537. minutes: listMinutesRef,
  20538. seconds: listSecondsRef
  20539. };
  20540. const spinnerItems = computed(() => {
  20541. return props.showSeconds ? timeUnits$1 : timeUnits$1.slice(0, 2);
  20542. });
  20543. const timePartials = computed(() => {
  20544. const { spinnerDate } = props;
  20545. const hours = spinnerDate.hour();
  20546. const minutes = spinnerDate.minute();
  20547. const seconds = spinnerDate.second();
  20548. return { hours, minutes, seconds };
  20549. });
  20550. const timeList = computed(() => {
  20551. const { hours, minutes } = unref(timePartials);
  20552. const { role, spinnerDate } = props;
  20553. const compare = !isRange ? spinnerDate : void 0;
  20554. return {
  20555. hours: getHoursList(role, compare),
  20556. minutes: getMinutesList(hours, role, compare),
  20557. seconds: getSecondsList(hours, minutes, role, compare)
  20558. };
  20559. });
  20560. const arrowControlTimeList = computed(() => {
  20561. const { hours, minutes, seconds } = unref(timePartials);
  20562. return {
  20563. hours: buildTimeList(hours, 23),
  20564. minutes: buildTimeList(minutes, 59),
  20565. seconds: buildTimeList(seconds, 59)
  20566. };
  20567. });
  20568. const debouncedResetScroll = debounce((type) => {
  20569. isScrolling = false;
  20570. adjustCurrentSpinner(type);
  20571. }, 200);
  20572. const getAmPmFlag = (hour) => {
  20573. const shouldShowAmPm = !!props.amPmMode;
  20574. if (!shouldShowAmPm)
  20575. return "";
  20576. const isCapital = props.amPmMode === "A";
  20577. let content = hour < 12 ? " am" : " pm";
  20578. if (isCapital)
  20579. content = content.toUpperCase();
  20580. return content;
  20581. };
  20582. const emitSelectRange = (type) => {
  20583. let range = [0, 0];
  20584. const actualFormat = format || DEFAULT_FORMATS_TIME;
  20585. const hourIndex = actualFormat.indexOf("HH");
  20586. const minuteIndex = actualFormat.indexOf("mm");
  20587. const secondIndex = actualFormat.indexOf("ss");
  20588. switch (type) {
  20589. case "hours":
  20590. if (hourIndex !== -1) {
  20591. range = [hourIndex, hourIndex + 2];
  20592. }
  20593. break;
  20594. case "minutes":
  20595. if (minuteIndex !== -1) {
  20596. range = [minuteIndex, minuteIndex + 2];
  20597. }
  20598. break;
  20599. case "seconds":
  20600. if (secondIndex !== -1) {
  20601. range = [secondIndex, secondIndex + 2];
  20602. }
  20603. break;
  20604. }
  20605. const [left, right] = range;
  20606. emit("select-range", left, right);
  20607. currentScrollbar.value = type;
  20608. };
  20609. const adjustCurrentSpinner = (type) => {
  20610. adjustSpinner(type, unref(timePartials)[type]);
  20611. };
  20612. const adjustSpinners = () => {
  20613. adjustCurrentSpinner("hours");
  20614. adjustCurrentSpinner("minutes");
  20615. adjustCurrentSpinner("seconds");
  20616. };
  20617. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  20618. const adjustSpinner = (type, value) => {
  20619. if (props.arrowControl)
  20620. return;
  20621. const scrollbar = unref(listRefsMap[type]);
  20622. if (scrollbar && scrollbar.$el) {
  20623. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  20624. }
  20625. };
  20626. const typeItemHeight = (type) => {
  20627. const scrollbar = unref(listRefsMap[type]);
  20628. const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
  20629. if (listItem) {
  20630. return Number.parseFloat(getStyle(listItem, "height")) || 0;
  20631. }
  20632. return 0;
  20633. };
  20634. const onIncrement = () => {
  20635. scrollDown(1);
  20636. };
  20637. const onDecrement = () => {
  20638. scrollDown(-1);
  20639. };
  20640. const scrollDown = (step) => {
  20641. if (!currentScrollbar.value) {
  20642. emitSelectRange("hours");
  20643. }
  20644. const label = currentScrollbar.value;
  20645. const now = unref(timePartials)[label];
  20646. const total = currentScrollbar.value === "hours" ? 24 : 60;
  20647. const next = findNextUnDisabled(label, now, step, total);
  20648. modifyDateField(label, next);
  20649. adjustSpinner(label, next);
  20650. nextTick(() => emitSelectRange(label));
  20651. };
  20652. const findNextUnDisabled = (type, now, step, total) => {
  20653. let next = (now + step + total) % total;
  20654. const list = unref(timeList)[type];
  20655. while (list[next] && next !== now) {
  20656. next = (next + step + total) % total;
  20657. }
  20658. return next;
  20659. };
  20660. const modifyDateField = (type, value) => {
  20661. const list = unref(timeList)[type];
  20662. const isDisabled = list[value];
  20663. if (isDisabled)
  20664. return;
  20665. const { hours, minutes, seconds } = unref(timePartials);
  20666. let changeTo;
  20667. switch (type) {
  20668. case "hours":
  20669. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  20670. break;
  20671. case "minutes":
  20672. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  20673. break;
  20674. case "seconds":
  20675. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  20676. break;
  20677. }
  20678. emit(CHANGE_EVENT, changeTo);
  20679. };
  20680. const handleClick = (type, { value, disabled }) => {
  20681. if (!disabled) {
  20682. modifyDateField(type, value);
  20683. emitSelectRange(type);
  20684. adjustSpinner(type, value);
  20685. }
  20686. };
  20687. const handleScroll = (type) => {
  20688. const scrollbar = unref(listRefsMap[type]);
  20689. if (!scrollbar)
  20690. return;
  20691. isScrolling = true;
  20692. debouncedResetScroll(type);
  20693. const value = Math.min(Math.round((getScrollbarElement(scrollbar.$el).scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59);
  20694. modifyDateField(type, value);
  20695. };
  20696. const scrollBarHeight = (type) => {
  20697. return unref(listRefsMap[type]).$el.offsetHeight;
  20698. };
  20699. const bindScrollEvent = () => {
  20700. const bindFunction = (type) => {
  20701. const scrollbar = unref(listRefsMap[type]);
  20702. if (scrollbar && scrollbar.$el) {
  20703. getScrollbarElement(scrollbar.$el).onscroll = () => {
  20704. handleScroll(type);
  20705. };
  20706. }
  20707. };
  20708. bindFunction("hours");
  20709. bindFunction("minutes");
  20710. bindFunction("seconds");
  20711. };
  20712. onMounted(() => {
  20713. nextTick(() => {
  20714. !props.arrowControl && bindScrollEvent();
  20715. adjustSpinners();
  20716. if (props.role === "start")
  20717. emitSelectRange("hours");
  20718. });
  20719. });
  20720. const setRef = (scrollbar, type) => {
  20721. listRefsMap[type].value = scrollbar != null ? scrollbar : void 0;
  20722. };
  20723. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  20724. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  20725. watch(() => props.spinnerDate, () => {
  20726. if (isScrolling)
  20727. return;
  20728. adjustSpinners();
  20729. });
  20730. return (_ctx, _cache) => {
  20731. return openBlock(), createElementBlock("div", {
  20732. class: normalizeClass([unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  20733. }, [
  20734. !_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(spinnerItems), (item) => {
  20735. return openBlock(), createBlock(unref(ElScrollbar), {
  20736. key: item,
  20737. ref_for: true,
  20738. ref: (scrollbar) => setRef(scrollbar, item),
  20739. class: normalizeClass(unref(ns).be("spinner", "wrapper")),
  20740. "wrap-style": "max-height: inherit;",
  20741. "view-class": unref(ns).be("spinner", "list"),
  20742. noresize: "",
  20743. tag: "ul",
  20744. onMouseenter: ($event) => emitSelectRange(item),
  20745. onMousemove: ($event) => adjustCurrentSpinner(item)
  20746. }, {
  20747. default: withCtx(() => [
  20748. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(timeList)[item], (disabled, key) => {
  20749. return openBlock(), createElementBlock("li", {
  20750. key,
  20751. class: normalizeClass([
  20752. unref(ns).be("spinner", "item"),
  20753. unref(ns).is("active", key === unref(timePartials)[item]),
  20754. unref(ns).is("disabled", disabled)
  20755. ]),
  20756. onClick: ($event) => handleClick(item, { value: key, disabled })
  20757. }, [
  20758. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  20759. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(getAmPmFlag(key)), 1)
  20760. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  20761. createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
  20762. ], 64))
  20763. ], 10, ["onClick"]);
  20764. }), 128))
  20765. ]),
  20766. _: 2
  20767. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  20768. }), 128)) : createCommentVNode("v-if", true),
  20769. _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(spinnerItems), (item) => {
  20770. return openBlock(), createElementBlock("div", {
  20771. key: item,
  20772. class: normalizeClass([unref(ns).be("spinner", "wrapper"), unref(ns).is("arrow")]),
  20773. onMouseenter: ($event) => emitSelectRange(item)
  20774. }, [
  20775. withDirectives((openBlock(), createBlock(unref(ElIcon), {
  20776. class: normalizeClass(["arrow-up", unref(ns).be("spinner", "arrow")])
  20777. }, {
  20778. default: withCtx(() => [
  20779. createVNode(unref(arrow_up_default))
  20780. ]),
  20781. _: 1
  20782. }, 8, ["class"])), [
  20783. [unref(vRepeatClick), onDecrement]
  20784. ]),
  20785. withDirectives((openBlock(), createBlock(unref(ElIcon), {
  20786. class: normalizeClass(["arrow-down", unref(ns).be("spinner", "arrow")])
  20787. }, {
  20788. default: withCtx(() => [
  20789. createVNode(unref(arrow_down_default))
  20790. ]),
  20791. _: 1
  20792. }, 8, ["class"])), [
  20793. [unref(vRepeatClick), onIncrement]
  20794. ]),
  20795. createElementVNode("ul", {
  20796. class: normalizeClass(unref(ns).be("spinner", "list"))
  20797. }, [
  20798. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(arrowControlTimeList)[item], (time, key) => {
  20799. return openBlock(), createElementBlock("li", {
  20800. key,
  20801. class: normalizeClass([
  20802. unref(ns).be("spinner", "item"),
  20803. unref(ns).is("active", time === unref(timePartials)[item]),
  20804. unref(ns).is("disabled", unref(timeList)[item][time])
  20805. ])
  20806. }, [
  20807. unref(isNumber)(time) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  20808. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  20809. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(getAmPmFlag(time)), 1)
  20810. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  20811. createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
  20812. ], 64))
  20813. ], 64)) : createCommentVNode("v-if", true)
  20814. ], 2);
  20815. }), 128))
  20816. ], 2)
  20817. ], 42, ["onMouseenter"]);
  20818. }), 128)) : createCommentVNode("v-if", true)
  20819. ], 2);
  20820. };
  20821. }
  20822. });
  20823. var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "basic-time-spinner.vue"]]);
  20824. const _sfc_main$22 = /* @__PURE__ */ defineComponent({
  20825. __name: "panel-time-pick",
  20826. props: panelTimePickerProps,
  20827. emits: ["pick", "select-range", "set-picker-option"],
  20828. setup(__props, { emit }) {
  20829. const props = __props;
  20830. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  20831. const {
  20832. arrowControl,
  20833. disabledHours,
  20834. disabledMinutes,
  20835. disabledSeconds,
  20836. defaultValue
  20837. } = pickerBase.props;
  20838. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  20839. const ns = useNamespace("time");
  20840. const { t, lang } = useLocale();
  20841. const selectionRange = ref([0, 2]);
  20842. const oldValue = useOldValue(props);
  20843. const transitionName = computed(() => {
  20844. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  20845. });
  20846. const showSeconds = computed(() => {
  20847. return props.format.includes("ss");
  20848. });
  20849. const amPmMode = computed(() => {
  20850. if (props.format.includes("A"))
  20851. return "A";
  20852. if (props.format.includes("a"))
  20853. return "a";
  20854. return "";
  20855. });
  20856. const isValidValue = (_date) => {
  20857. const parsedDate = dayjs(_date).locale(lang.value);
  20858. const result = getRangeAvailableTime(parsedDate);
  20859. return parsedDate.isSame(result);
  20860. };
  20861. const handleCancel = () => {
  20862. const old = oldValue.value;
  20863. emit("pick", old, false);
  20864. nextTick(() => {
  20865. oldValue.value = old;
  20866. });
  20867. };
  20868. const handleConfirm = (visible = false, first = false) => {
  20869. if (first)
  20870. return;
  20871. emit("pick", props.parsedValue, visible);
  20872. };
  20873. const handleChange = (_date) => {
  20874. if (!props.visible) {
  20875. return;
  20876. }
  20877. const result = getRangeAvailableTime(_date).millisecond(0);
  20878. emit("pick", result, true);
  20879. };
  20880. const setSelectionRange = (start, end) => {
  20881. emit("select-range", start, end);
  20882. selectionRange.value = [start, end];
  20883. };
  20884. const changeSelectionRange = (step) => {
  20885. const actualFormat = props.format;
  20886. const hourIndex = actualFormat.indexOf("HH");
  20887. const minuteIndex = actualFormat.indexOf("mm");
  20888. const secondIndex = actualFormat.indexOf("ss");
  20889. const list = [];
  20890. const mapping = [];
  20891. if (hourIndex !== -1) {
  20892. list.push(hourIndex);
  20893. mapping.push("hours");
  20894. }
  20895. if (minuteIndex !== -1) {
  20896. list.push(minuteIndex);
  20897. mapping.push("minutes");
  20898. }
  20899. if (secondIndex !== -1 && showSeconds.value) {
  20900. list.push(secondIndex);
  20901. mapping.push("seconds");
  20902. }
  20903. const index = list.indexOf(selectionRange.value[0]);
  20904. const next = (index + step + list.length) % list.length;
  20905. timePickerOptions["start_emitSelectRange"](mapping[next]);
  20906. };
  20907. const handleKeydown = (event) => {
  20908. const code = getEventCode(event);
  20909. const { left, right, up, down } = EVENT_CODE;
  20910. if ([left, right].includes(code)) {
  20911. const step = code === left ? -1 : 1;
  20912. changeSelectionRange(step);
  20913. event.preventDefault();
  20914. return;
  20915. }
  20916. if ([up, down].includes(code)) {
  20917. const step = code === up ? -1 : 1;
  20918. timePickerOptions["start_scrollDown"](step);
  20919. event.preventDefault();
  20920. return;
  20921. }
  20922. };
  20923. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  20924. getAvailableHours,
  20925. getAvailableMinutes,
  20926. getAvailableSeconds
  20927. });
  20928. const getRangeAvailableTime = (date) => {
  20929. return getAvailableTime(date, props.datetimeRole || "", true);
  20930. };
  20931. const parseUserInput = (value) => {
  20932. if (!value)
  20933. return null;
  20934. return dayjs(value, props.format).locale(lang.value);
  20935. };
  20936. const getDefaultValue = () => {
  20937. return dayjs(defaultValue).locale(lang.value);
  20938. };
  20939. emit("set-picker-option", ["isValidValue", isValidValue]);
  20940. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  20941. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  20942. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  20943. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  20944. return (_ctx, _cache) => {
  20945. return openBlock(), createBlock(Transition, { name: unref(transitionName) }, {
  20946. default: withCtx(() => [
  20947. _ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  20948. key: 0,
  20949. class: normalizeClass(unref(ns).b("panel"))
  20950. }, [
  20951. createElementVNode("div", {
  20952. class: normalizeClass([unref(ns).be("panel", "content"), { "has-seconds": unref(showSeconds) }])
  20953. }, [
  20954. createVNode(TimeSpinner, {
  20955. ref: "spinner",
  20956. role: _ctx.datetimeRole || "start",
  20957. "arrow-control": unref(arrowControl),
  20958. "show-seconds": unref(showSeconds),
  20959. "am-pm-mode": unref(amPmMode),
  20960. "spinner-date": _ctx.parsedValue,
  20961. "disabled-hours": unref(disabledHours),
  20962. "disabled-minutes": unref(disabledMinutes),
  20963. "disabled-seconds": unref(disabledSeconds),
  20964. onChange: handleChange,
  20965. onSetOption: unref(onSetOption),
  20966. onSelectRange: setSelectionRange
  20967. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  20968. ], 2),
  20969. createElementVNode("div", {
  20970. class: normalizeClass(unref(ns).be("panel", "footer"))
  20971. }, [
  20972. createElementVNode("button", {
  20973. type: "button",
  20974. class: normalizeClass([unref(ns).be("panel", "btn"), "cancel"]),
  20975. onClick: handleCancel
  20976. }, toDisplayString(unref(t)("el.datepicker.cancel")), 3),
  20977. createElementVNode("button", {
  20978. type: "button",
  20979. class: normalizeClass([unref(ns).be("panel", "btn"), "confirm"]),
  20980. onClick: ($event) => handleConfirm()
  20981. }, toDisplayString(unref(t)("el.datepicker.confirm")), 11, ["onClick"])
  20982. ], 2)
  20983. ], 2)) : createCommentVNode("v-if", true)
  20984. ]),
  20985. _: 1
  20986. }, 8, ["name"]);
  20987. };
  20988. }
  20989. });
  20990. var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "panel-time-pick.vue"]]);
  20991. const panelTimeRangeProps = buildProps({
  20992. ...timePanelSharedProps,
  20993. parsedValue: {
  20994. type: definePropType(Array)
  20995. }
  20996. });
  20997. const _sfc_main$21 = /* @__PURE__ */ defineComponent({
  20998. __name: "panel-time-range",
  20999. props: panelTimeRangeProps,
  21000. emits: ["pick", "select-range", "set-picker-option"],
  21001. setup(__props, { emit }) {
  21002. const props = __props;
  21003. const makeSelectRange = (start, end) => {
  21004. const result = [];
  21005. for (let i = start; i <= end; i++) {
  21006. result.push(i);
  21007. }
  21008. return result;
  21009. };
  21010. const { t, lang } = useLocale();
  21011. const nsTime = useNamespace("time");
  21012. const nsPicker = useNamespace("picker");
  21013. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  21014. const {
  21015. arrowControl,
  21016. disabledHours,
  21017. disabledMinutes,
  21018. disabledSeconds,
  21019. defaultValue
  21020. } = pickerBase.props;
  21021. const startContainerKls = computed(() => [
  21022. nsTime.be("range-picker", "body"),
  21023. nsTime.be("panel", "content"),
  21024. nsTime.is("arrow", arrowControl),
  21025. showSeconds.value ? "has-seconds" : ""
  21026. ]);
  21027. const endContainerKls = computed(() => [
  21028. nsTime.be("range-picker", "body"),
  21029. nsTime.be("panel", "content"),
  21030. nsTime.is("arrow", arrowControl),
  21031. showSeconds.value ? "has-seconds" : ""
  21032. ]);
  21033. const startTime = computed(() => props.parsedValue[0]);
  21034. const endTime = computed(() => props.parsedValue[1]);
  21035. const oldValue = useOldValue(props);
  21036. const handleCancel = () => {
  21037. const old = oldValue.value;
  21038. emit("pick", old, false);
  21039. nextTick(() => {
  21040. oldValue.value = old;
  21041. });
  21042. };
  21043. const showSeconds = computed(() => {
  21044. return props.format.includes("ss");
  21045. });
  21046. const amPmMode = computed(() => {
  21047. if (props.format.includes("A"))
  21048. return "A";
  21049. if (props.format.includes("a"))
  21050. return "a";
  21051. return "";
  21052. });
  21053. const handleConfirm = (visible = false) => {
  21054. emit("pick", [startTime.value, endTime.value], visible);
  21055. };
  21056. const handleMinChange = (date) => {
  21057. handleChange(date.millisecond(0), endTime.value);
  21058. };
  21059. const handleMaxChange = (date) => {
  21060. handleChange(startTime.value, date.millisecond(0));
  21061. };
  21062. const isValidValue = (_date) => {
  21063. const parsedDate = _date.map((_) => dayjs(_).locale(lang.value));
  21064. const result = getRangeAvailableTime(parsedDate);
  21065. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  21066. };
  21067. const handleChange = (start, end) => {
  21068. if (!props.visible) {
  21069. return;
  21070. }
  21071. emit("pick", [start, end], true);
  21072. };
  21073. const btnConfirmDisabled = computed(() => {
  21074. return startTime.value > endTime.value;
  21075. });
  21076. const selectionRange = ref([0, 2]);
  21077. const setMinSelectionRange = (start, end) => {
  21078. emit("select-range", start, end, "min");
  21079. selectionRange.value = [start, end];
  21080. };
  21081. const offset = computed(() => showSeconds.value ? 11 : 8);
  21082. const setMaxSelectionRange = (start, end) => {
  21083. emit("select-range", start, end, "max");
  21084. const _offset = unref(offset);
  21085. selectionRange.value = [start + _offset, end + _offset];
  21086. };
  21087. const changeSelectionRange = (step) => {
  21088. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  21089. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  21090. const index = list.indexOf(selectionRange.value[0]);
  21091. const next = (index + step + list.length) % list.length;
  21092. const half = list.length / 2;
  21093. if (next < half) {
  21094. timePickerOptions["start_emitSelectRange"](mapping[next]);
  21095. } else {
  21096. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  21097. }
  21098. };
  21099. const handleKeydown = (event) => {
  21100. const code = getEventCode(event);
  21101. const { left, right, up, down } = EVENT_CODE;
  21102. if ([left, right].includes(code)) {
  21103. const step = code === left ? -1 : 1;
  21104. changeSelectionRange(step);
  21105. event.preventDefault();
  21106. return;
  21107. }
  21108. if ([up, down].includes(code)) {
  21109. const step = code === up ? -1 : 1;
  21110. const role = selectionRange.value[0] < offset.value ? "start" : "end";
  21111. timePickerOptions[`${role}_scrollDown`](step);
  21112. event.preventDefault();
  21113. return;
  21114. }
  21115. };
  21116. const disabledHours_ = (role, compare) => {
  21117. const defaultDisable = disabledHours ? disabledHours(role) : [];
  21118. const isStart = role === "start";
  21119. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  21120. const compareHour = compareDate.hour();
  21121. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  21122. return union(defaultDisable, nextDisable);
  21123. };
  21124. const disabledMinutes_ = (hour, role, compare) => {
  21125. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  21126. const isStart = role === "start";
  21127. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  21128. const compareHour = compareDate.hour();
  21129. if (hour !== compareHour) {
  21130. return defaultDisable;
  21131. }
  21132. const compareMinute = compareDate.minute();
  21133. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  21134. return union(defaultDisable, nextDisable);
  21135. };
  21136. const disabledSeconds_ = (hour, minute, role, compare) => {
  21137. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  21138. const isStart = role === "start";
  21139. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  21140. const compareHour = compareDate.hour();
  21141. const compareMinute = compareDate.minute();
  21142. if (hour !== compareHour || minute !== compareMinute) {
  21143. return defaultDisable;
  21144. }
  21145. const compareSecond = compareDate.second();
  21146. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  21147. return union(defaultDisable, nextDisable);
  21148. };
  21149. const getRangeAvailableTime = ([start, end]) => {
  21150. return [
  21151. getAvailableTime(start, "start", true, end),
  21152. getAvailableTime(end, "end", false, start)
  21153. ];
  21154. };
  21155. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  21156. const {
  21157. timePickerOptions,
  21158. getAvailableTime,
  21159. onSetOption
  21160. } = useTimePanel({
  21161. getAvailableHours,
  21162. getAvailableMinutes,
  21163. getAvailableSeconds
  21164. });
  21165. const parseUserInput = (days) => {
  21166. if (!days)
  21167. return null;
  21168. if (isArray$1(days)) {
  21169. return days.map((d) => dayjs(d, props.format).locale(lang.value));
  21170. }
  21171. return dayjs(days, props.format).locale(lang.value);
  21172. };
  21173. const getDefaultValue = () => {
  21174. if (isArray$1(defaultValue)) {
  21175. return defaultValue.map((d) => dayjs(d).locale(lang.value));
  21176. }
  21177. const defaultDay = dayjs(defaultValue).locale(lang.value);
  21178. return [defaultDay, defaultDay.add(60, "m")];
  21179. };
  21180. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  21181. emit("set-picker-option", ["isValidValue", isValidValue]);
  21182. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  21183. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  21184. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  21185. return (_ctx, _cache) => {
  21186. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  21187. key: 0,
  21188. class: normalizeClass([unref(nsTime).b("range-picker"), unref(nsPicker).b("panel")])
  21189. }, [
  21190. createElementVNode("div", {
  21191. class: normalizeClass(unref(nsTime).be("range-picker", "content"))
  21192. }, [
  21193. createElementVNode("div", {
  21194. class: normalizeClass(unref(nsTime).be("range-picker", "cell"))
  21195. }, [
  21196. createElementVNode("div", {
  21197. class: normalizeClass(unref(nsTime).be("range-picker", "header"))
  21198. }, toDisplayString(unref(t)("el.datepicker.startTime")), 3),
  21199. createElementVNode("div", {
  21200. class: normalizeClass(unref(startContainerKls))
  21201. }, [
  21202. createVNode(TimeSpinner, {
  21203. ref: "minSpinner",
  21204. role: "start",
  21205. "show-seconds": unref(showSeconds),
  21206. "am-pm-mode": unref(amPmMode),
  21207. "arrow-control": unref(arrowControl),
  21208. "spinner-date": unref(startTime),
  21209. "disabled-hours": disabledHours_,
  21210. "disabled-minutes": disabledMinutes_,
  21211. "disabled-seconds": disabledSeconds_,
  21212. onChange: handleMinChange,
  21213. onSetOption: unref(onSetOption),
  21214. onSelectRange: setMinSelectionRange
  21215. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  21216. ], 2)
  21217. ], 2),
  21218. createElementVNode("div", {
  21219. class: normalizeClass(unref(nsTime).be("range-picker", "cell"))
  21220. }, [
  21221. createElementVNode("div", {
  21222. class: normalizeClass(unref(nsTime).be("range-picker", "header"))
  21223. }, toDisplayString(unref(t)("el.datepicker.endTime")), 3),
  21224. createElementVNode("div", {
  21225. class: normalizeClass(unref(endContainerKls))
  21226. }, [
  21227. createVNode(TimeSpinner, {
  21228. ref: "maxSpinner",
  21229. role: "end",
  21230. "show-seconds": unref(showSeconds),
  21231. "am-pm-mode": unref(amPmMode),
  21232. "arrow-control": unref(arrowControl),
  21233. "spinner-date": unref(endTime),
  21234. "disabled-hours": disabledHours_,
  21235. "disabled-minutes": disabledMinutes_,
  21236. "disabled-seconds": disabledSeconds_,
  21237. onChange: handleMaxChange,
  21238. onSetOption: unref(onSetOption),
  21239. onSelectRange: setMaxSelectionRange
  21240. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  21241. ], 2)
  21242. ], 2)
  21243. ], 2),
  21244. createElementVNode("div", {
  21245. class: normalizeClass(unref(nsTime).be("panel", "footer"))
  21246. }, [
  21247. createElementVNode("button", {
  21248. type: "button",
  21249. class: normalizeClass([unref(nsTime).be("panel", "btn"), "cancel"]),
  21250. onClick: ($event) => handleCancel()
  21251. }, toDisplayString(unref(t)("el.datepicker.cancel")), 11, ["onClick"]),
  21252. createElementVNode("button", {
  21253. type: "button",
  21254. class: normalizeClass([unref(nsTime).be("panel", "btn"), "confirm"]),
  21255. disabled: unref(btnConfirmDisabled),
  21256. onClick: ($event) => handleConfirm()
  21257. }, toDisplayString(unref(t)("el.datepicker.confirm")), 11, ["disabled", "onClick"])
  21258. ], 2)
  21259. ], 2)) : createCommentVNode("v-if", true);
  21260. };
  21261. }
  21262. });
  21263. var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "panel-time-range.vue"]]);
  21264. dayjs.extend(customParseFormat);
  21265. var TimePicker = defineComponent({
  21266. name: "ElTimePicker",
  21267. install: null,
  21268. props: {
  21269. ...timePickerDefaultProps,
  21270. isRange: Boolean
  21271. },
  21272. emits: [UPDATE_MODEL_EVENT],
  21273. setup(props, ctx) {
  21274. const commonPicker = ref();
  21275. const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  21276. const modelUpdater = (value) => ctx.emit(UPDATE_MODEL_EVENT, value);
  21277. provide(PICKER_POPPER_OPTIONS_INJECTION_KEY, props.popperOptions);
  21278. ctx.expose({
  21279. focus: () => {
  21280. var _a;
  21281. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  21282. },
  21283. blur: () => {
  21284. var _a;
  21285. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  21286. },
  21287. handleOpen: () => {
  21288. var _a;
  21289. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  21290. },
  21291. handleClose: () => {
  21292. var _a;
  21293. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  21294. }
  21295. });
  21296. return () => {
  21297. var _a;
  21298. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
  21299. return createVNode(CommonPicker, mergeProps(props, {
  21300. "ref": commonPicker,
  21301. "type": type,
  21302. "format": format,
  21303. "onUpdate:modelValue": modelUpdater
  21304. }), {
  21305. default: (props2) => createVNode(Panel, props2, null)
  21306. });
  21307. };
  21308. }
  21309. });
  21310. const ElTimePicker = withInstall(TimePicker);
  21311. const getPrevMonthLastDays = (date, count) => {
  21312. const lastDay = date.subtract(1, "month").endOf("month").date();
  21313. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  21314. };
  21315. const getMonthDays = (date) => {
  21316. const days = date.daysInMonth();
  21317. return rangeArr(days).map((_, index) => index + 1);
  21318. };
  21319. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  21320. const start = index * 7;
  21321. return days.slice(start, start + 7);
  21322. });
  21323. const dateTableProps = buildProps({
  21324. selectedDay: {
  21325. type: definePropType(Object)
  21326. },
  21327. range: {
  21328. type: definePropType(Array)
  21329. },
  21330. date: {
  21331. type: definePropType(Object),
  21332. required: true
  21333. },
  21334. hideHeader: {
  21335. type: Boolean
  21336. }
  21337. });
  21338. const dateTableEmits = {
  21339. pick: (value) => isObject$1(value)
  21340. };
  21341. var localeData$1 = {exports: {}};
  21342. (function(module, exports) {
  21343. !function(n, e) {
  21344. module.exports = e() ;
  21345. }(commonjsGlobal, function() {
  21346. return function(n, e, t) {
  21347. var r = e.prototype, o = function(n2) {
  21348. return n2 && (n2.indexOf ? n2 : n2.s);
  21349. }, u = function(n2, e2, t2, r2, u2) {
  21350. var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
  21351. return n3.slice(0, r2);
  21352. });
  21353. if (!u2)
  21354. return f;
  21355. var d = i2.weekStart;
  21356. return f.map(function(n3, e3) {
  21357. return f[(e3 + (d || 0)) % 7];
  21358. });
  21359. }, i = function() {
  21360. return t.Ls[t.locale()];
  21361. }, a = function(n2, e2) {
  21362. return n2.formats[e2] || function(n3) {
  21363. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  21364. return e3 || t2.slice(1);
  21365. });
  21366. }(n2.formats[e2.toUpperCase()]);
  21367. }, s = function() {
  21368. var n2 = this;
  21369. return { months: function(e2) {
  21370. return e2 ? e2.format("MMMM") : u(n2, "months");
  21371. }, monthsShort: function(e2) {
  21372. return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
  21373. }, firstDayOfWeek: function() {
  21374. return n2.$locale().weekStart || 0;
  21375. }, weekdays: function(e2) {
  21376. return e2 ? e2.format("dddd") : u(n2, "weekdays");
  21377. }, weekdaysMin: function(e2) {
  21378. return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
  21379. }, weekdaysShort: function(e2) {
  21380. return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
  21381. }, longDateFormat: function(e2) {
  21382. return a(n2.$locale(), e2);
  21383. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  21384. };
  21385. r.localeData = function() {
  21386. return s.bind(this)();
  21387. }, t.localeData = function() {
  21388. var n2 = i();
  21389. return { firstDayOfWeek: function() {
  21390. return n2.weekStart || 0;
  21391. }, weekdays: function() {
  21392. return t.weekdays();
  21393. }, weekdaysShort: function() {
  21394. return t.weekdaysShort();
  21395. }, weekdaysMin: function() {
  21396. return t.weekdaysMin();
  21397. }, months: function() {
  21398. return t.months();
  21399. }, monthsShort: function() {
  21400. return t.monthsShort();
  21401. }, longDateFormat: function(e2) {
  21402. return a(n2, e2);
  21403. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  21404. }, t.months = function() {
  21405. return u(i(), "months");
  21406. }, t.monthsShort = function() {
  21407. return u(i(), "monthsShort", "months", 3);
  21408. }, t.weekdays = function(n2) {
  21409. return u(i(), "weekdays", null, null, n2);
  21410. }, t.weekdaysShort = function(n2) {
  21411. return u(i(), "weekdaysShort", "weekdays", 3, n2);
  21412. }, t.weekdaysMin = function(n2) {
  21413. return u(i(), "weekdaysMin", "weekdays", 2, n2);
  21414. };
  21415. };
  21416. });
  21417. })(localeData$1);
  21418. var localeData = localeData$1.exports;
  21419. const useDateTable = (props, emit) => {
  21420. dayjs.extend(localeData);
  21421. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  21422. const { t, lang } = useLocale();
  21423. const now = dayjs().locale(lang.value);
  21424. const isInRange = computed(() => !!props.range && !!props.range.length);
  21425. const rows = computed(() => {
  21426. let days = [];
  21427. if (isInRange.value) {
  21428. const [start, end] = props.range;
  21429. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  21430. text: start.date() + index,
  21431. type: "current"
  21432. }));
  21433. let remaining = currentMonthRange.length % 7;
  21434. remaining = remaining === 0 ? 0 : 7 - remaining;
  21435. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  21436. text: index + 1,
  21437. type: "next"
  21438. }));
  21439. days = currentMonthRange.concat(nextMonthRange);
  21440. } else {
  21441. const firstDay = props.date.startOf("month").day();
  21442. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  21443. text: day,
  21444. type: "prev"
  21445. }));
  21446. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  21447. text: day,
  21448. type: "current"
  21449. }));
  21450. days = [...prevMonthDays, ...currentMonthDays];
  21451. const remaining = 7 - (days.length % 7 || 7);
  21452. const nextMonthDays = rangeArr(remaining).map((_, index) => ({
  21453. text: index + 1,
  21454. type: "next"
  21455. }));
  21456. days = days.concat(nextMonthDays);
  21457. }
  21458. return toNestedArr(days);
  21459. });
  21460. const weekDays = computed(() => {
  21461. const start = firstDayOfWeek;
  21462. if (start === 0) {
  21463. return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  21464. } else {
  21465. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  21466. }
  21467. });
  21468. const getFormattedDate = (day, type) => {
  21469. switch (type) {
  21470. case "prev":
  21471. return props.date.startOf("month").subtract(1, "month").date(day);
  21472. case "next":
  21473. return props.date.startOf("month").add(1, "month").date(day);
  21474. case "current":
  21475. return props.date.date(day);
  21476. }
  21477. };
  21478. const handlePickDay = ({ text, type }) => {
  21479. const date = getFormattedDate(text, type);
  21480. emit("pick", date);
  21481. };
  21482. const getSlotData = ({ text, type }) => {
  21483. const day = getFormattedDate(text, type);
  21484. return {
  21485. isSelected: day.isSame(props.selectedDay),
  21486. type: `${type}-month`,
  21487. day: day.format("YYYY-MM-DD"),
  21488. date: day.toDate()
  21489. };
  21490. };
  21491. return {
  21492. now,
  21493. isInRange,
  21494. rows,
  21495. weekDays,
  21496. getFormattedDate,
  21497. handlePickDay,
  21498. getSlotData
  21499. };
  21500. };
  21501. const __default__$1A = defineComponent({
  21502. name: "DateTable"
  21503. });
  21504. const _sfc_main$20 = /* @__PURE__ */ defineComponent({
  21505. ...__default__$1A,
  21506. props: dateTableProps,
  21507. emits: dateTableEmits,
  21508. setup(__props, { expose, emit }) {
  21509. const props = __props;
  21510. const {
  21511. isInRange,
  21512. now,
  21513. rows,
  21514. weekDays,
  21515. getFormattedDate,
  21516. handlePickDay,
  21517. getSlotData
  21518. } = useDateTable(props, emit);
  21519. const nsTable = useNamespace("calendar-table");
  21520. const nsDay = useNamespace("calendar-day");
  21521. const getCellClass = ({ text, type }) => {
  21522. const classes = [type];
  21523. if (type === "current") {
  21524. const date = getFormattedDate(text, type);
  21525. if (date.isSame(props.selectedDay, "day")) {
  21526. classes.push(nsDay.is("selected"));
  21527. }
  21528. if (date.isSame(now, "day")) {
  21529. classes.push(nsDay.is("today"));
  21530. }
  21531. }
  21532. return classes;
  21533. };
  21534. expose({
  21535. getFormattedDate
  21536. });
  21537. return (_ctx, _cache) => {
  21538. return openBlock(), createElementBlock("table", {
  21539. class: normalizeClass([unref(nsTable).b(), unref(nsTable).is("range", unref(isInRange))]),
  21540. cellspacing: "0",
  21541. cellpadding: "0"
  21542. }, [
  21543. !_ctx.hideHeader ? (openBlock(), createElementBlock("thead", { key: 0 }, [
  21544. createElementVNode("tr", null, [
  21545. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(weekDays), (day) => {
  21546. return openBlock(), createElementBlock("th", {
  21547. key: day,
  21548. scope: "col"
  21549. }, toDisplayString(day), 1);
  21550. }), 128))
  21551. ])
  21552. ])) : createCommentVNode("v-if", true),
  21553. createElementVNode("tbody", null, [
  21554. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, index) => {
  21555. return openBlock(), createElementBlock("tr", {
  21556. key: index,
  21557. class: normalizeClass({
  21558. [unref(nsTable).e("row")]: true,
  21559. [unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
  21560. })
  21561. }, [
  21562. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key) => {
  21563. return openBlock(), createElementBlock("td", {
  21564. key,
  21565. class: normalizeClass(getCellClass(cell)),
  21566. onClick: ($event) => unref(handlePickDay)(cell)
  21567. }, [
  21568. createElementVNode("div", {
  21569. class: normalizeClass(unref(nsDay).b())
  21570. }, [
  21571. renderSlot(_ctx.$slots, "date-cell", {
  21572. data: unref(getSlotData)(cell)
  21573. }, () => [
  21574. createElementVNode("span", null, toDisplayString(cell.text), 1)
  21575. ])
  21576. ], 2)
  21577. ], 10, ["onClick"]);
  21578. }), 128))
  21579. ], 2);
  21580. }), 128))
  21581. ])
  21582. ], 2);
  21583. };
  21584. }
  21585. });
  21586. var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "date-table.vue"]]);
  21587. const adjacentMonth = (start, end) => {
  21588. const firstMonthLastDay = start.endOf("month");
  21589. const lastMonthFirstDay = end.startOf("month");
  21590. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  21591. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  21592. return [
  21593. [start, firstMonthLastDay],
  21594. [lastMonthStartDay.startOf("week"), end]
  21595. ];
  21596. };
  21597. const threeConsecutiveMonth = (start, end) => {
  21598. const firstMonthLastDay = start.endOf("month");
  21599. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  21600. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  21601. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  21602. const lastMonthFirstDay = end.startOf("month");
  21603. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  21604. return [
  21605. [start, firstMonthLastDay],
  21606. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  21607. [lastMonthStartDay.startOf("week"), end]
  21608. ];
  21609. };
  21610. const useCalendar = (props, emit, componentName) => {
  21611. const { lang } = useLocale();
  21612. const selectedDay = ref();
  21613. const now = dayjs().locale(lang.value);
  21614. const realSelectedDay = computed({
  21615. get() {
  21616. if (!props.modelValue)
  21617. return selectedDay.value;
  21618. return date.value;
  21619. },
  21620. set(val) {
  21621. if (!val)
  21622. return;
  21623. selectedDay.value = val;
  21624. const result = val.toDate();
  21625. emit(INPUT_EVENT, result);
  21626. emit(UPDATE_MODEL_EVENT, result);
  21627. }
  21628. });
  21629. const validatedRange = computed(() => {
  21630. if (!props.range || !isArray$1(props.range) || props.range.length !== 2 || props.range.some((item) => !isDate$1(item)))
  21631. return [];
  21632. const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
  21633. const [startDayjs, endDayjs] = rangeArrDayjs;
  21634. if (startDayjs.isAfter(endDayjs)) {
  21635. debugWarn(componentName, "end time should be greater than start time");
  21636. return [];
  21637. }
  21638. if (startDayjs.isSame(endDayjs, "month")) {
  21639. return calculateValidatedDateRange(startDayjs, endDayjs);
  21640. } else {
  21641. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  21642. debugWarn(componentName, "start time and end time interval must not exceed two months");
  21643. return [];
  21644. }
  21645. return calculateValidatedDateRange(startDayjs, endDayjs);
  21646. }
  21647. });
  21648. const date = computed(() => {
  21649. if (!props.modelValue) {
  21650. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  21651. } else {
  21652. return dayjs(props.modelValue).locale(lang.value);
  21653. }
  21654. });
  21655. const prevMonthDayjs = computed(() => date.value.subtract(1, "month").date(1));
  21656. const nextMonthDayjs = computed(() => date.value.add(1, "month").date(1));
  21657. const prevYearDayjs = computed(() => date.value.subtract(1, "year").date(1));
  21658. const nextYearDayjs = computed(() => date.value.add(1, "year").date(1));
  21659. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  21660. const firstDay = startDayjs.startOf("week");
  21661. const lastDay = endDayjs.endOf("week");
  21662. const firstMonth = firstDay.get("month");
  21663. const lastMonth = lastDay.get("month");
  21664. if (firstMonth === lastMonth) {
  21665. return [[firstDay, lastDay]];
  21666. } else if ((firstMonth + 1) % 12 === lastMonth) {
  21667. return adjacentMonth(firstDay, lastDay);
  21668. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  21669. return threeConsecutiveMonth(firstDay, lastDay);
  21670. } else {
  21671. debugWarn(componentName, "start time and end time interval must not exceed two months");
  21672. return [];
  21673. }
  21674. };
  21675. const pickDay = (day) => {
  21676. realSelectedDay.value = day;
  21677. };
  21678. const selectDate = (type) => {
  21679. const dateMap = {
  21680. "prev-month": prevMonthDayjs.value,
  21681. "next-month": nextMonthDayjs.value,
  21682. "prev-year": prevYearDayjs.value,
  21683. "next-year": nextYearDayjs.value,
  21684. today: now
  21685. };
  21686. const day = dateMap[type];
  21687. if (!day.isSame(date.value, "day")) {
  21688. pickDay(day);
  21689. }
  21690. };
  21691. return {
  21692. calculateValidatedDateRange,
  21693. date,
  21694. realSelectedDay,
  21695. pickDay,
  21696. selectDate,
  21697. validatedRange
  21698. };
  21699. };
  21700. const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate$1(item));
  21701. const calendarProps = buildProps({
  21702. modelValue: {
  21703. type: Date
  21704. },
  21705. range: {
  21706. type: definePropType(Array),
  21707. validator: isValidRange$1
  21708. }
  21709. });
  21710. const calendarEmits = {
  21711. [UPDATE_MODEL_EVENT]: (value) => isDate$1(value),
  21712. [INPUT_EVENT]: (value) => isDate$1(value)
  21713. };
  21714. const COMPONENT_NAME$h = "ElCalendar";
  21715. const __default__$1z = defineComponent({
  21716. name: COMPONENT_NAME$h
  21717. });
  21718. const _sfc_main$1$ = /* @__PURE__ */ defineComponent({
  21719. ...__default__$1z,
  21720. props: calendarProps,
  21721. emits: calendarEmits,
  21722. setup(__props, { expose, emit }) {
  21723. const props = __props;
  21724. const ns = useNamespace("calendar");
  21725. const {
  21726. calculateValidatedDateRange,
  21727. date,
  21728. pickDay,
  21729. realSelectedDay,
  21730. selectDate,
  21731. validatedRange
  21732. } = useCalendar(props, emit, COMPONENT_NAME$h);
  21733. const { t } = useLocale();
  21734. const i18nDate = computed(() => {
  21735. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  21736. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  21737. });
  21738. expose({
  21739. selectedDay: realSelectedDay,
  21740. pickDay,
  21741. selectDate,
  21742. calculateValidatedDateRange
  21743. });
  21744. return (_ctx, _cache) => {
  21745. return openBlock(), createElementBlock("div", {
  21746. class: normalizeClass(unref(ns).b())
  21747. }, [
  21748. createElementVNode("div", {
  21749. class: normalizeClass(unref(ns).e("header"))
  21750. }, [
  21751. renderSlot(_ctx.$slots, "header", { date: unref(i18nDate) }, () => [
  21752. createElementVNode("div", {
  21753. class: normalizeClass(unref(ns).e("title"))
  21754. }, toDisplayString(unref(i18nDate)), 3),
  21755. unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
  21756. key: 0,
  21757. class: normalizeClass(unref(ns).e("button-group"))
  21758. }, [
  21759. createVNode(unref(ElButtonGroup$1), null, {
  21760. default: withCtx(() => [
  21761. createVNode(unref(ElButton), {
  21762. size: "small",
  21763. onClick: ($event) => unref(selectDate)("prev-month")
  21764. }, {
  21765. default: withCtx(() => [
  21766. createTextVNode(toDisplayString(unref(t)("el.datepicker.prevMonth")), 1)
  21767. ]),
  21768. _: 1
  21769. }, 8, ["onClick"]),
  21770. createVNode(unref(ElButton), {
  21771. size: "small",
  21772. onClick: ($event) => unref(selectDate)("today")
  21773. }, {
  21774. default: withCtx(() => [
  21775. createTextVNode(toDisplayString(unref(t)("el.datepicker.today")), 1)
  21776. ]),
  21777. _: 1
  21778. }, 8, ["onClick"]),
  21779. createVNode(unref(ElButton), {
  21780. size: "small",
  21781. onClick: ($event) => unref(selectDate)("next-month")
  21782. }, {
  21783. default: withCtx(() => [
  21784. createTextVNode(toDisplayString(unref(t)("el.datepicker.nextMonth")), 1)
  21785. ]),
  21786. _: 1
  21787. }, 8, ["onClick"])
  21788. ]),
  21789. _: 1
  21790. })
  21791. ], 2)) : createCommentVNode("v-if", true)
  21792. ])
  21793. ], 2),
  21794. unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
  21795. key: 0,
  21796. class: normalizeClass(unref(ns).e("body"))
  21797. }, [
  21798. createVNode(DateTable$1, {
  21799. date: unref(date),
  21800. "selected-day": unref(realSelectedDay),
  21801. onPick: unref(pickDay)
  21802. }, createSlots({
  21803. _: 2
  21804. }, [
  21805. _ctx.$slots["date-cell"] ? {
  21806. name: "date-cell",
  21807. fn: withCtx((data) => [
  21808. renderSlot(_ctx.$slots, "date-cell", normalizeProps(guardReactiveProps(data)))
  21809. ])
  21810. } : void 0
  21811. ]), 1032, ["date", "selected-day", "onPick"])
  21812. ], 2)) : (openBlock(), createElementBlock("div", {
  21813. key: 1,
  21814. class: normalizeClass(unref(ns).e("body"))
  21815. }, [
  21816. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(validatedRange), (range_, index) => {
  21817. return openBlock(), createBlock(DateTable$1, {
  21818. key: index,
  21819. date: range_[0],
  21820. "selected-day": unref(realSelectedDay),
  21821. range: range_,
  21822. "hide-header": index !== 0,
  21823. onPick: unref(pickDay)
  21824. }, createSlots({
  21825. _: 2
  21826. }, [
  21827. _ctx.$slots["date-cell"] ? {
  21828. name: "date-cell",
  21829. fn: withCtx((data) => [
  21830. renderSlot(_ctx.$slots, "date-cell", normalizeProps(guardReactiveProps(data)))
  21831. ])
  21832. } : void 0
  21833. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  21834. }), 128))
  21835. ], 2))
  21836. ], 2);
  21837. };
  21838. }
  21839. });
  21840. var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "calendar.vue"]]);
  21841. const ElCalendar = withInstall(Calendar);
  21842. const cardProps = buildProps({
  21843. header: {
  21844. type: String,
  21845. default: ""
  21846. },
  21847. footer: {
  21848. type: String,
  21849. default: ""
  21850. },
  21851. bodyStyle: {
  21852. type: definePropType([String, Object, Array]),
  21853. default: ""
  21854. },
  21855. headerClass: String,
  21856. bodyClass: String,
  21857. footerClass: String,
  21858. shadow: {
  21859. type: String,
  21860. values: ["always", "hover", "never"],
  21861. default: void 0
  21862. }
  21863. });
  21864. const cardContextKey = Symbol("cardContextKey");
  21865. const __default__$1y = defineComponent({
  21866. name: "ElCard"
  21867. });
  21868. const _sfc_main$1_ = /* @__PURE__ */ defineComponent({
  21869. ...__default__$1y,
  21870. props: cardProps,
  21871. setup(__props) {
  21872. const globalConfig = useGlobalConfig("card");
  21873. const ns = useNamespace("card");
  21874. return (_ctx, _cache) => {
  21875. var _a;
  21876. return openBlock(), createElementBlock("div", {
  21877. class: normalizeClass([
  21878. unref(ns).b(),
  21879. unref(ns).is(`${_ctx.shadow || ((_a = unref(globalConfig)) == null ? void 0 : _a.shadow) || "always"}-shadow`)
  21880. ])
  21881. }, [
  21882. _ctx.$slots.header || _ctx.header ? (openBlock(), createElementBlock("div", {
  21883. key: 0,
  21884. class: normalizeClass([unref(ns).e("header"), _ctx.headerClass])
  21885. }, [
  21886. renderSlot(_ctx.$slots, "header", {}, () => [
  21887. createTextVNode(toDisplayString(_ctx.header), 1)
  21888. ])
  21889. ], 2)) : createCommentVNode("v-if", true),
  21890. createElementVNode("div", {
  21891. class: normalizeClass([unref(ns).e("body"), _ctx.bodyClass]),
  21892. style: normalizeStyle(_ctx.bodyStyle)
  21893. }, [
  21894. renderSlot(_ctx.$slots, "default")
  21895. ], 6),
  21896. _ctx.$slots.footer || _ctx.footer ? (openBlock(), createElementBlock("div", {
  21897. key: 1,
  21898. class: normalizeClass([unref(ns).e("footer"), _ctx.footerClass])
  21899. }, [
  21900. renderSlot(_ctx.$slots, "footer", {}, () => [
  21901. createTextVNode(toDisplayString(_ctx.footer), 1)
  21902. ])
  21903. ], 2)) : createCommentVNode("v-if", true)
  21904. ], 2);
  21905. };
  21906. }
  21907. });
  21908. var Card = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "card.vue"]]);
  21909. const ElCard = withInstall(Card);
  21910. const carouselProps = buildProps({
  21911. initialIndex: {
  21912. type: Number,
  21913. default: 0
  21914. },
  21915. height: {
  21916. type: String,
  21917. default: ""
  21918. },
  21919. trigger: {
  21920. type: String,
  21921. values: ["hover", "click"],
  21922. default: "hover"
  21923. },
  21924. autoplay: {
  21925. type: Boolean,
  21926. default: true
  21927. },
  21928. interval: {
  21929. type: Number,
  21930. default: 3e3
  21931. },
  21932. indicatorPosition: {
  21933. type: String,
  21934. values: ["", "none", "outside"],
  21935. default: ""
  21936. },
  21937. arrow: {
  21938. type: String,
  21939. values: ["always", "hover", "never"],
  21940. default: "hover"
  21941. },
  21942. type: {
  21943. type: String,
  21944. values: ["", "card"],
  21945. default: ""
  21946. },
  21947. cardScale: {
  21948. type: Number,
  21949. default: 0.83
  21950. },
  21951. loop: {
  21952. type: Boolean,
  21953. default: true
  21954. },
  21955. direction: {
  21956. type: String,
  21957. values: ["horizontal", "vertical"],
  21958. default: "horizontal"
  21959. },
  21960. pauseOnHover: {
  21961. type: Boolean,
  21962. default: true
  21963. },
  21964. motionBlur: Boolean
  21965. });
  21966. const carouselEmits = {
  21967. change: (current, prev) => [current, prev].every(isNumber)
  21968. };
  21969. const carouselContextKey = Symbol("carouselContextKey");
  21970. const CAROUSEL_ITEM_NAME = "ElCarouselItem";
  21971. const THROTTLE_TIME = 300;
  21972. const useCarousel = (props, emit, componentName) => {
  21973. const {
  21974. children: items,
  21975. addChild: addItem,
  21976. removeChild: removeItem,
  21977. ChildrenSorter: ItemsSorter
  21978. } = useOrderedChildren(getCurrentInstance(), CAROUSEL_ITEM_NAME);
  21979. const slots = useSlots();
  21980. const activeIndex = ref(-1);
  21981. const timer = ref(null);
  21982. const hover = ref(false);
  21983. const root = ref();
  21984. const containerHeight = ref(0);
  21985. const isItemsTwoLength = ref(true);
  21986. const arrowDisplay = computed(() => props.arrow !== "never" && !unref(isVertical));
  21987. const hasLabel = computed(() => {
  21988. return items.value.some((item) => item.props.label.toString().length > 0);
  21989. });
  21990. const isCardType = computed(() => props.type === "card");
  21991. const isVertical = computed(() => props.direction === "vertical");
  21992. const containerStyle = computed(() => {
  21993. if (props.height !== "auto") {
  21994. return {
  21995. height: props.height
  21996. };
  21997. }
  21998. return {
  21999. height: `${containerHeight.value}px`,
  22000. overflow: "hidden"
  22001. };
  22002. });
  22003. const throttledArrowClick = throttle((index) => {
  22004. setActiveItem(index);
  22005. }, THROTTLE_TIME, { trailing: true });
  22006. const throttledIndicatorHover = throttle((index) => {
  22007. handleIndicatorHover(index);
  22008. }, THROTTLE_TIME);
  22009. const isTwoLengthShow = (index) => {
  22010. if (!isItemsTwoLength.value)
  22011. return true;
  22012. return activeIndex.value <= 1 ? index <= 1 : index > 1;
  22013. };
  22014. function pauseTimer() {
  22015. if (timer.value) {
  22016. clearInterval(timer.value);
  22017. timer.value = null;
  22018. }
  22019. }
  22020. function startTimer() {
  22021. if (props.interval <= 0 || !props.autoplay || timer.value)
  22022. return;
  22023. timer.value = setInterval(() => playSlides(), props.interval);
  22024. }
  22025. const playSlides = () => {
  22026. if (activeIndex.value < items.value.length - 1) {
  22027. activeIndex.value = activeIndex.value + 1;
  22028. } else if (props.loop) {
  22029. activeIndex.value = 0;
  22030. }
  22031. };
  22032. function setActiveItem(index) {
  22033. if (isString$1(index)) {
  22034. const filteredItems = items.value.filter((item) => item.props.name === index);
  22035. if (filteredItems.length > 0) {
  22036. index = items.value.indexOf(filteredItems[0]);
  22037. }
  22038. }
  22039. index = Number(index);
  22040. if (Number.isNaN(index) || index !== Math.floor(index)) {
  22041. debugWarn(componentName, "index must be integer.");
  22042. return;
  22043. }
  22044. const itemCount = items.value.length;
  22045. const oldIndex = activeIndex.value;
  22046. if (index < 0) {
  22047. activeIndex.value = props.loop ? itemCount - 1 : 0;
  22048. } else if (index >= itemCount) {
  22049. activeIndex.value = props.loop ? 0 : itemCount - 1;
  22050. } else {
  22051. activeIndex.value = index;
  22052. }
  22053. if (oldIndex === activeIndex.value) {
  22054. resetItemPosition(oldIndex);
  22055. }
  22056. resetTimer();
  22057. }
  22058. function resetItemPosition(oldIndex) {
  22059. items.value.forEach((item, index) => {
  22060. item.translateItem(index, activeIndex.value, oldIndex);
  22061. });
  22062. }
  22063. function itemInStage(item, index) {
  22064. var _a, _b, _c, _d;
  22065. const _items = unref(items);
  22066. const itemCount = _items.length;
  22067. if (itemCount === 0 || !item.states.inStage)
  22068. return false;
  22069. const nextItemIndex = index + 1;
  22070. const prevItemIndex = index - 1;
  22071. const lastItemIndex = itemCount - 1;
  22072. const isLastItemActive = _items[lastItemIndex].states.active;
  22073. const isFirstItemActive = _items[0].states.active;
  22074. const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
  22075. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  22076. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
  22077. return "left";
  22078. } else if (index === 0 && isLastItemActive || isPrevItemActive) {
  22079. return "right";
  22080. }
  22081. return false;
  22082. }
  22083. function handleMouseEnter() {
  22084. hover.value = true;
  22085. if (props.pauseOnHover) {
  22086. pauseTimer();
  22087. }
  22088. }
  22089. function handleMouseLeave() {
  22090. hover.value = false;
  22091. startTimer();
  22092. }
  22093. function handleButtonEnter(arrow) {
  22094. if (unref(isVertical))
  22095. return;
  22096. items.value.forEach((item, index) => {
  22097. if (arrow === itemInStage(item, index)) {
  22098. item.states.hover = true;
  22099. }
  22100. });
  22101. }
  22102. function handleButtonLeave() {
  22103. if (unref(isVertical))
  22104. return;
  22105. items.value.forEach((item) => {
  22106. item.states.hover = false;
  22107. });
  22108. }
  22109. function handleIndicatorClick(index) {
  22110. activeIndex.value = index;
  22111. }
  22112. function handleIndicatorHover(index) {
  22113. if (props.trigger === "hover" && index !== activeIndex.value) {
  22114. activeIndex.value = index;
  22115. }
  22116. }
  22117. function prev() {
  22118. setActiveItem(activeIndex.value - 1);
  22119. }
  22120. function next() {
  22121. setActiveItem(activeIndex.value + 1);
  22122. }
  22123. function resetTimer() {
  22124. pauseTimer();
  22125. if (!props.pauseOnHover)
  22126. startTimer();
  22127. }
  22128. function setContainerHeight(height) {
  22129. if (props.height !== "auto")
  22130. return;
  22131. containerHeight.value = height;
  22132. }
  22133. function PlaceholderItem() {
  22134. var _a;
  22135. const defaultSlots = (_a = slots.default) == null ? void 0 : _a.call(slots);
  22136. if (!defaultSlots)
  22137. return null;
  22138. const flatSlots = flattedChildren(defaultSlots);
  22139. const normalizeSlots = flatSlots.filter((slot) => {
  22140. return isVNode(slot) && slot.type.name === CAROUSEL_ITEM_NAME;
  22141. });
  22142. if ((normalizeSlots == null ? void 0 : normalizeSlots.length) === 2 && props.loop && !isCardType.value) {
  22143. isItemsTwoLength.value = true;
  22144. return normalizeSlots;
  22145. }
  22146. isItemsTwoLength.value = false;
  22147. return null;
  22148. }
  22149. watch(() => activeIndex.value, (current, prev2) => {
  22150. resetItemPosition(prev2);
  22151. if (isItemsTwoLength.value) {
  22152. current = current % 2;
  22153. prev2 = prev2 % 2;
  22154. }
  22155. if (prev2 > -1) {
  22156. emit(CHANGE_EVENT, current, prev2);
  22157. }
  22158. });
  22159. const exposeActiveIndex = computed({
  22160. get: () => {
  22161. return isItemsTwoLength.value ? activeIndex.value % 2 : activeIndex.value;
  22162. },
  22163. set: (value) => activeIndex.value = value
  22164. });
  22165. watch(() => props.autoplay, (autoplay) => {
  22166. autoplay ? startTimer() : pauseTimer();
  22167. });
  22168. watch(() => props.loop, () => {
  22169. setActiveItem(activeIndex.value);
  22170. });
  22171. watch(() => props.interval, () => {
  22172. resetTimer();
  22173. });
  22174. const resizeObserver = shallowRef();
  22175. onMounted(() => {
  22176. watch(() => items.value, () => {
  22177. if (items.value.length > 0)
  22178. setActiveItem(props.initialIndex);
  22179. }, {
  22180. immediate: true
  22181. });
  22182. resizeObserver.value = useResizeObserver(root.value, () => {
  22183. resetItemPosition();
  22184. });
  22185. startTimer();
  22186. });
  22187. onBeforeUnmount(() => {
  22188. pauseTimer();
  22189. if (root.value && resizeObserver.value)
  22190. resizeObserver.value.stop();
  22191. });
  22192. provide(carouselContextKey, {
  22193. root,
  22194. isCardType,
  22195. isVertical,
  22196. items,
  22197. loop: props.loop,
  22198. cardScale: props.cardScale,
  22199. addItem,
  22200. removeItem,
  22201. setActiveItem,
  22202. setContainerHeight
  22203. });
  22204. return {
  22205. root,
  22206. activeIndex,
  22207. exposeActiveIndex,
  22208. arrowDisplay,
  22209. hasLabel,
  22210. hover,
  22211. isCardType,
  22212. items,
  22213. isVertical,
  22214. containerStyle,
  22215. isItemsTwoLength,
  22216. handleButtonEnter,
  22217. handleButtonLeave,
  22218. handleIndicatorClick,
  22219. handleMouseEnter,
  22220. handleMouseLeave,
  22221. setActiveItem,
  22222. prev,
  22223. next,
  22224. PlaceholderItem,
  22225. isTwoLengthShow,
  22226. ItemsSorter,
  22227. throttledArrowClick,
  22228. throttledIndicatorHover
  22229. };
  22230. };
  22231. const COMPONENT_NAME$g = "ElCarousel";
  22232. const __default__$1x = defineComponent({
  22233. name: COMPONENT_NAME$g
  22234. });
  22235. const _sfc_main$1Z = /* @__PURE__ */ defineComponent({
  22236. ...__default__$1x,
  22237. props: carouselProps,
  22238. emits: carouselEmits,
  22239. setup(__props, { expose, emit }) {
  22240. const props = __props;
  22241. const {
  22242. root,
  22243. activeIndex,
  22244. exposeActiveIndex,
  22245. arrowDisplay,
  22246. hasLabel,
  22247. hover,
  22248. isCardType,
  22249. items,
  22250. isVertical,
  22251. containerStyle,
  22252. handleButtonEnter,
  22253. handleButtonLeave,
  22254. handleIndicatorClick,
  22255. handleMouseEnter,
  22256. handleMouseLeave,
  22257. setActiveItem,
  22258. prev,
  22259. next,
  22260. PlaceholderItem,
  22261. isTwoLengthShow,
  22262. ItemsSorter,
  22263. throttledArrowClick,
  22264. throttledIndicatorHover
  22265. } = useCarousel(props, emit, COMPONENT_NAME$g);
  22266. const ns = useNamespace("carousel");
  22267. const { t } = useLocale();
  22268. const carouselClasses = computed(() => {
  22269. const classes = [ns.b(), ns.m(props.direction)];
  22270. if (unref(isCardType)) {
  22271. classes.push(ns.m("card"));
  22272. }
  22273. return classes;
  22274. });
  22275. const indicatorsClasses = computed(() => {
  22276. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  22277. if (unref(hasLabel)) {
  22278. classes.push(ns.em("indicators", "labels"));
  22279. }
  22280. if (props.indicatorPosition === "outside") {
  22281. classes.push(ns.em("indicators", "outside"));
  22282. }
  22283. if (unref(isVertical)) {
  22284. classes.push(ns.em("indicators", "right"));
  22285. }
  22286. return classes;
  22287. });
  22288. function handleTransitionStart(e) {
  22289. if (!props.motionBlur)
  22290. return;
  22291. const kls = unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`;
  22292. e.currentTarget.classList.add(kls);
  22293. }
  22294. function handleTransitionEnd(e) {
  22295. if (!props.motionBlur)
  22296. return;
  22297. const kls = unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`;
  22298. e.currentTarget.classList.remove(kls);
  22299. }
  22300. expose({
  22301. activeIndex: exposeActiveIndex,
  22302. setActiveItem,
  22303. prev,
  22304. next
  22305. });
  22306. return (_ctx, _cache) => {
  22307. return openBlock(), createElementBlock("div", {
  22308. ref_key: "root",
  22309. ref: root,
  22310. class: normalizeClass(unref(carouselClasses)),
  22311. onMouseenter: withModifiers(unref(handleMouseEnter), ["stop"]),
  22312. onMouseleave: withModifiers(unref(handleMouseLeave), ["stop"])
  22313. }, [
  22314. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  22315. key: 0,
  22316. name: "carousel-arrow-left",
  22317. persisted: ""
  22318. }, {
  22319. default: withCtx(() => [
  22320. withDirectives(createElementVNode("button", {
  22321. type: "button",
  22322. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "left")]),
  22323. "aria-label": unref(t)("el.carousel.leftArrow"),
  22324. onMouseenter: ($event) => unref(handleButtonEnter)("left"),
  22325. onMouseleave: unref(handleButtonLeave),
  22326. onClick: withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) - 1), ["stop"])
  22327. }, [
  22328. createVNode(unref(ElIcon), null, {
  22329. default: withCtx(() => [
  22330. createVNode(unref(arrow_left_default))
  22331. ]),
  22332. _: 1
  22333. })
  22334. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  22335. [vShow, (_ctx.arrow === "always" || unref(hover)) && (_ctx.loop || unref(activeIndex) > 0)]
  22336. ])
  22337. ]),
  22338. _: 1
  22339. })) : createCommentVNode("v-if", true),
  22340. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  22341. key: 1,
  22342. name: "carousel-arrow-right",
  22343. persisted: ""
  22344. }, {
  22345. default: withCtx(() => [
  22346. withDirectives(createElementVNode("button", {
  22347. type: "button",
  22348. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "right")]),
  22349. "aria-label": unref(t)("el.carousel.rightArrow"),
  22350. onMouseenter: ($event) => unref(handleButtonEnter)("right"),
  22351. onMouseleave: unref(handleButtonLeave),
  22352. onClick: withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) + 1), ["stop"])
  22353. }, [
  22354. createVNode(unref(ElIcon), null, {
  22355. default: withCtx(() => [
  22356. createVNode(unref(arrow_right_default))
  22357. ]),
  22358. _: 1
  22359. })
  22360. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  22361. [
  22362. vShow,
  22363. (_ctx.arrow === "always" || unref(hover)) && (_ctx.loop || unref(activeIndex) < unref(items).length - 1)
  22364. ]
  22365. ])
  22366. ]),
  22367. _: 1
  22368. })) : createCommentVNode("v-if", true),
  22369. createElementVNode("div", {
  22370. class: normalizeClass(unref(ns).e("container")),
  22371. style: normalizeStyle(unref(containerStyle)),
  22372. onTransitionstart: handleTransitionStart,
  22373. onTransitionend: handleTransitionEnd
  22374. }, [
  22375. createVNode(unref(PlaceholderItem)),
  22376. renderSlot(_ctx.$slots, "default")
  22377. ], 38),
  22378. createVNode(unref(ItemsSorter), null, {
  22379. default: withCtx(() => [
  22380. _ctx.indicatorPosition !== "none" ? (openBlock(), createElementBlock("ul", {
  22381. key: 0,
  22382. class: normalizeClass(unref(indicatorsClasses))
  22383. }, [
  22384. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item, index) => {
  22385. return withDirectives((openBlock(), createElementBlock("li", {
  22386. key: index,
  22387. class: normalizeClass([
  22388. unref(ns).e("indicator"),
  22389. unref(ns).em("indicator", _ctx.direction),
  22390. unref(ns).is("active", index === unref(activeIndex))
  22391. ]),
  22392. onMouseenter: ($event) => unref(throttledIndicatorHover)(index),
  22393. onClick: withModifiers(($event) => unref(handleIndicatorClick)(index), ["stop"])
  22394. }, [
  22395. createElementVNode("button", {
  22396. class: normalizeClass(unref(ns).e("button")),
  22397. "aria-label": unref(t)("el.carousel.indicator", { index: index + 1 })
  22398. }, [
  22399. unref(hasLabel) ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(item.props.label), 1)) : createCommentVNode("v-if", true)
  22400. ], 10, ["aria-label"])
  22401. ], 42, ["onMouseenter", "onClick"])), [
  22402. [vShow, unref(isTwoLengthShow)(index)]
  22403. ]);
  22404. }), 128))
  22405. ], 2)) : createCommentVNode("v-if", true)
  22406. ]),
  22407. _: 1
  22408. }),
  22409. _ctx.motionBlur ? (openBlock(), createElementBlock("svg", {
  22410. key: 2,
  22411. xmlns: "http://www.w3.org/2000/svg",
  22412. version: "1.1",
  22413. style: { "display": "none" }
  22414. }, [
  22415. createElementVNode("defs", null, [
  22416. createElementVNode("filter", { id: "elCarouselHorizontal" }, [
  22417. createElementVNode("feGaussianBlur", {
  22418. in: "SourceGraphic",
  22419. stdDeviation: "12,0"
  22420. })
  22421. ]),
  22422. createElementVNode("filter", { id: "elCarouselVertical" }, [
  22423. createElementVNode("feGaussianBlur", {
  22424. in: "SourceGraphic",
  22425. stdDeviation: "0,10"
  22426. })
  22427. ])
  22428. ])
  22429. ])) : createCommentVNode("v-if", true)
  22430. ], 42, ["onMouseenter", "onMouseleave"]);
  22431. };
  22432. }
  22433. });
  22434. var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "carousel.vue"]]);
  22435. const carouselItemProps = buildProps({
  22436. name: { type: String, default: "" },
  22437. label: {
  22438. type: [String, Number],
  22439. default: ""
  22440. }
  22441. });
  22442. const useCarouselItem = (props) => {
  22443. const carouselContext = inject(carouselContextKey);
  22444. const instance = getCurrentInstance();
  22445. if (!carouselContext) {
  22446. debugWarn(CAROUSEL_ITEM_NAME, "usage: <el-carousel></el-carousel-item></el-carousel>");
  22447. }
  22448. if (!instance) {
  22449. debugWarn(CAROUSEL_ITEM_NAME, "compositional hook can only be invoked inside setups");
  22450. }
  22451. const carouselItemRef = ref();
  22452. const hover = ref(false);
  22453. const translate = ref(0);
  22454. const scale = ref(1);
  22455. const active = ref(false);
  22456. const ready = ref(false);
  22457. const inStage = ref(false);
  22458. const animating = ref(false);
  22459. const { isCardType, isVertical, cardScale } = carouselContext;
  22460. function processIndex(index, activeIndex, length) {
  22461. const lastItemIndex = length - 1;
  22462. const prevItemIndex = activeIndex - 1;
  22463. const nextItemIndex = activeIndex + 1;
  22464. const halfItemIndex = length / 2;
  22465. if (activeIndex === 0 && index === lastItemIndex) {
  22466. return -1;
  22467. } else if (activeIndex === lastItemIndex && index === 0) {
  22468. return length;
  22469. } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
  22470. return length + 1;
  22471. } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
  22472. return -2;
  22473. }
  22474. return index;
  22475. }
  22476. function calcCardTranslate(index, activeIndex) {
  22477. var _a, _b;
  22478. const parentWidth = unref(isVertical) ? ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetHeight) || 0 : ((_b = carouselContext.root.value) == null ? void 0 : _b.offsetWidth) || 0;
  22479. if (inStage.value) {
  22480. return parentWidth * ((2 - cardScale) * (index - activeIndex) + 1) / 4;
  22481. } else if (index < activeIndex) {
  22482. return -(1 + cardScale) * parentWidth / 4;
  22483. } else {
  22484. return (3 + cardScale) * parentWidth / 4;
  22485. }
  22486. }
  22487. function calcTranslate(index, activeIndex, isVertical2) {
  22488. const rootEl = carouselContext.root.value;
  22489. if (!rootEl)
  22490. return 0;
  22491. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  22492. return distance * (index - activeIndex);
  22493. }
  22494. const translateItem = (index, activeIndex, oldIndex) => {
  22495. var _a;
  22496. const _isCardType = unref(isCardType);
  22497. const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
  22498. const isActive = index === activeIndex;
  22499. if (!_isCardType && !isUndefined(oldIndex)) {
  22500. animating.value = isActive || index === oldIndex;
  22501. }
  22502. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  22503. index = processIndex(index, activeIndex, carouselItemLength);
  22504. }
  22505. const _isVertical = unref(isVertical);
  22506. active.value = isActive;
  22507. if (_isCardType) {
  22508. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  22509. translate.value = calcCardTranslate(index, activeIndex);
  22510. scale.value = unref(active) ? 1 : cardScale;
  22511. } else {
  22512. translate.value = calcTranslate(index, activeIndex, _isVertical);
  22513. }
  22514. ready.value = true;
  22515. if (isActive && carouselItemRef.value) {
  22516. carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
  22517. }
  22518. };
  22519. function handleItemClick() {
  22520. if (carouselContext && unref(isCardType)) {
  22521. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  22522. carouselContext.setActiveItem(index);
  22523. }
  22524. }
  22525. const carouselItemContext = {
  22526. props,
  22527. states: reactive({
  22528. hover,
  22529. translate,
  22530. scale,
  22531. active,
  22532. ready,
  22533. inStage,
  22534. animating
  22535. }),
  22536. uid: instance.uid,
  22537. getVnode: () => instance.vnode,
  22538. translateItem
  22539. };
  22540. carouselContext.addItem(carouselItemContext);
  22541. onBeforeUnmount(() => {
  22542. carouselContext.removeItem(carouselItemContext);
  22543. });
  22544. return {
  22545. carouselItemRef,
  22546. active,
  22547. animating,
  22548. hover,
  22549. inStage,
  22550. isVertical,
  22551. translate,
  22552. isCardType,
  22553. scale,
  22554. ready,
  22555. handleItemClick
  22556. };
  22557. };
  22558. const __default__$1w = defineComponent({
  22559. name: CAROUSEL_ITEM_NAME
  22560. });
  22561. const _sfc_main$1Y = /* @__PURE__ */ defineComponent({
  22562. ...__default__$1w,
  22563. props: carouselItemProps,
  22564. setup(__props) {
  22565. const props = __props;
  22566. const ns = useNamespace("carousel");
  22567. const {
  22568. carouselItemRef,
  22569. active,
  22570. animating,
  22571. hover,
  22572. inStage,
  22573. isVertical,
  22574. translate,
  22575. isCardType,
  22576. scale,
  22577. ready,
  22578. handleItemClick
  22579. } = useCarouselItem(props);
  22580. const itemKls = computed(() => [
  22581. ns.e("item"),
  22582. ns.is("active", active.value),
  22583. ns.is("in-stage", inStage.value),
  22584. ns.is("hover", hover.value),
  22585. ns.is("animating", animating.value),
  22586. {
  22587. [ns.em("item", "card")]: isCardType.value,
  22588. [ns.em("item", "card-vertical")]: isCardType.value && isVertical.value
  22589. }
  22590. ]);
  22591. const itemStyle = computed(() => {
  22592. const translateType = `translate${unref(isVertical) ? "Y" : "X"}`;
  22593. const _translate = `${translateType}(${unref(translate)}px)`;
  22594. const _scale = `scale(${unref(scale)})`;
  22595. const transform = [_translate, _scale].join(" ");
  22596. return {
  22597. transform
  22598. };
  22599. });
  22600. return (_ctx, _cache) => {
  22601. return withDirectives((openBlock(), createElementBlock("div", {
  22602. ref_key: "carouselItemRef",
  22603. ref: carouselItemRef,
  22604. class: normalizeClass(unref(itemKls)),
  22605. style: normalizeStyle(unref(itemStyle)),
  22606. onClick: unref(handleItemClick)
  22607. }, [
  22608. unref(isCardType) ? withDirectives((openBlock(), createElementBlock("div", {
  22609. key: 0,
  22610. class: normalizeClass(unref(ns).e("mask"))
  22611. }, null, 2)), [
  22612. [vShow, !unref(active)]
  22613. ]) : createCommentVNode("v-if", true),
  22614. renderSlot(_ctx.$slots, "default")
  22615. ], 14, ["onClick"])), [
  22616. [vShow, unref(ready)]
  22617. ]);
  22618. };
  22619. }
  22620. });
  22621. var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "carousel-item.vue"]]);
  22622. const ElCarousel = withInstall(Carousel, {
  22623. CarouselItem
  22624. });
  22625. const ElCarouselItem = withNoopInstall(CarouselItem);
  22626. const checkboxProps = {
  22627. modelValue: {
  22628. type: [Number, String, Boolean],
  22629. default: void 0
  22630. },
  22631. label: {
  22632. type: [String, Boolean, Number, Object],
  22633. default: void 0
  22634. },
  22635. value: {
  22636. type: [String, Boolean, Number, Object],
  22637. default: void 0
  22638. },
  22639. indeterminate: Boolean,
  22640. disabled: Boolean,
  22641. checked: Boolean,
  22642. name: {
  22643. type: String,
  22644. default: void 0
  22645. },
  22646. trueValue: {
  22647. type: [String, Number],
  22648. default: void 0
  22649. },
  22650. falseValue: {
  22651. type: [String, Number],
  22652. default: void 0
  22653. },
  22654. trueLabel: {
  22655. type: [String, Number],
  22656. default: void 0
  22657. },
  22658. falseLabel: {
  22659. type: [String, Number],
  22660. default: void 0
  22661. },
  22662. id: {
  22663. type: String,
  22664. default: void 0
  22665. },
  22666. border: Boolean,
  22667. size: useSizeProp,
  22668. tabindex: [String, Number],
  22669. validateEvent: {
  22670. type: Boolean,
  22671. default: true
  22672. },
  22673. ...useAriaProps(["ariaControls"])
  22674. };
  22675. const checkboxEmits = {
  22676. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  22677. change: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  22678. };
  22679. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  22680. const useCheckboxDisabled = ({
  22681. model,
  22682. isChecked
  22683. }) => {
  22684. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  22685. const isLimitDisabled = computed(() => {
  22686. var _a, _b;
  22687. const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
  22688. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  22689. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  22690. });
  22691. const isDisabled = useFormDisabled(computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  22692. return {
  22693. isDisabled,
  22694. isLimitDisabled
  22695. };
  22696. };
  22697. const useCheckboxEvent = (props, {
  22698. model,
  22699. isLimitExceeded,
  22700. hasOwnLabel,
  22701. isDisabled,
  22702. isLabeledByFormItem
  22703. }) => {
  22704. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  22705. const { formItem } = useFormItem();
  22706. const { emit } = getCurrentInstance();
  22707. function getLabeledValue(value) {
  22708. var _a, _b, _c, _d;
  22709. return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
  22710. }
  22711. function emitChangeEvent(checked, e) {
  22712. emit(CHANGE_EVENT, getLabeledValue(checked), e);
  22713. }
  22714. function handleChange(e) {
  22715. if (isLimitExceeded.value)
  22716. return;
  22717. const target = e.target;
  22718. emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
  22719. }
  22720. async function onClickRoot(e) {
  22721. if (isLimitExceeded.value)
  22722. return;
  22723. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  22724. const eventTargets = e.composedPath();
  22725. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  22726. if (!hasLabel) {
  22727. model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
  22728. await nextTick();
  22729. emitChangeEvent(model.value, e);
  22730. }
  22731. }
  22732. }
  22733. const validateEvent = computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  22734. watch(() => props.modelValue, () => {
  22735. if (validateEvent.value) {
  22736. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  22737. }
  22738. });
  22739. return {
  22740. handleChange,
  22741. onClickRoot
  22742. };
  22743. };
  22744. const useCheckboxModel = (props) => {
  22745. const selfModel = ref(false);
  22746. const { emit } = getCurrentInstance();
  22747. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  22748. const isGroup = computed(() => isUndefined(checkboxGroup) === false);
  22749. const isLimitExceeded = ref(false);
  22750. const model = computed({
  22751. get() {
  22752. var _a, _b;
  22753. return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  22754. },
  22755. set(val) {
  22756. var _a, _b;
  22757. if (isGroup.value && isArray$1(val)) {
  22758. isLimitExceeded.value = ((_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value) && val.length > model.value.length;
  22759. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  22760. } else {
  22761. emit(UPDATE_MODEL_EVENT, val);
  22762. selfModel.value = val;
  22763. }
  22764. }
  22765. });
  22766. return {
  22767. model,
  22768. isGroup,
  22769. isLimitExceeded
  22770. };
  22771. };
  22772. const useCheckboxStatus = (props, slots, { model }) => {
  22773. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  22774. const isFocused = ref(false);
  22775. const actualValue = computed(() => {
  22776. if (!isPropAbsent(props.value)) {
  22777. return props.value;
  22778. }
  22779. return props.label;
  22780. });
  22781. const isChecked = computed(() => {
  22782. const value = model.value;
  22783. if (isBoolean(value)) {
  22784. return value;
  22785. } else if (isArray$1(value)) {
  22786. if (isObject$1(actualValue.value)) {
  22787. return value.map(toRaw).some((o) => isEqual$1(o, actualValue.value));
  22788. } else {
  22789. return value.map(toRaw).includes(actualValue.value);
  22790. }
  22791. } else if (value !== null && value !== void 0) {
  22792. return value === props.trueValue || value === props.trueLabel;
  22793. } else {
  22794. return !!value;
  22795. }
  22796. });
  22797. const checkboxButtonSize = useFormSize(computed(() => {
  22798. var _a;
  22799. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  22800. }), {
  22801. prop: true
  22802. });
  22803. const checkboxSize = useFormSize(computed(() => {
  22804. var _a;
  22805. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  22806. }));
  22807. const hasOwnLabel = computed(() => {
  22808. return !!slots.default || !isPropAbsent(actualValue.value);
  22809. });
  22810. return {
  22811. checkboxButtonSize,
  22812. isChecked,
  22813. isFocused,
  22814. checkboxSize,
  22815. hasOwnLabel,
  22816. actualValue
  22817. };
  22818. };
  22819. const useCheckbox = (props, slots) => {
  22820. const { formItem: elFormItem } = useFormItem();
  22821. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  22822. const {
  22823. isFocused,
  22824. isChecked,
  22825. checkboxButtonSize,
  22826. checkboxSize,
  22827. hasOwnLabel,
  22828. actualValue
  22829. } = useCheckboxStatus(props, slots, { model });
  22830. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  22831. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  22832. formItemContext: elFormItem,
  22833. disableIdGeneration: hasOwnLabel,
  22834. disableIdManagement: isGroup
  22835. });
  22836. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  22837. model,
  22838. isLimitExceeded,
  22839. hasOwnLabel,
  22840. isDisabled,
  22841. isLabeledByFormItem
  22842. });
  22843. const setStoreValue = () => {
  22844. function addToStore() {
  22845. var _a, _b;
  22846. if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
  22847. model.value.push(actualValue.value);
  22848. } else {
  22849. model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
  22850. }
  22851. }
  22852. props.checked && addToStore();
  22853. };
  22854. setStoreValue();
  22855. useDeprecated({
  22856. from: "label act as value",
  22857. replacement: "value",
  22858. version: "3.0.0",
  22859. scope: "el-checkbox",
  22860. ref: "https://element-plus.org/en-US/component/checkbox.html"
  22861. }, computed(() => isGroup.value && isPropAbsent(props.value)));
  22862. useDeprecated({
  22863. from: "true-label",
  22864. replacement: "true-value",
  22865. version: "3.0.0",
  22866. scope: "el-checkbox",
  22867. ref: "https://element-plus.org/en-US/component/checkbox.html"
  22868. }, computed(() => !!props.trueLabel));
  22869. useDeprecated({
  22870. from: "false-label",
  22871. replacement: "false-value",
  22872. version: "3.0.0",
  22873. scope: "el-checkbox",
  22874. ref: "https://element-plus.org/en-US/component/checkbox.html"
  22875. }, computed(() => !!props.falseLabel));
  22876. return {
  22877. inputId,
  22878. isLabeledByFormItem,
  22879. isChecked,
  22880. isDisabled,
  22881. isFocused,
  22882. checkboxButtonSize,
  22883. checkboxSize,
  22884. hasOwnLabel,
  22885. model,
  22886. actualValue,
  22887. handleChange,
  22888. onClickRoot
  22889. };
  22890. };
  22891. const __default__$1v = defineComponent({
  22892. name: "ElCheckbox"
  22893. });
  22894. const _sfc_main$1X = /* @__PURE__ */ defineComponent({
  22895. ...__default__$1v,
  22896. props: checkboxProps,
  22897. emits: checkboxEmits,
  22898. setup(__props) {
  22899. const props = __props;
  22900. const slots = useSlots();
  22901. const {
  22902. inputId,
  22903. isLabeledByFormItem,
  22904. isChecked,
  22905. isDisabled,
  22906. isFocused,
  22907. checkboxSize,
  22908. hasOwnLabel,
  22909. model,
  22910. actualValue,
  22911. handleChange,
  22912. onClickRoot
  22913. } = useCheckbox(props, slots);
  22914. const inputBindings = computed(() => {
  22915. var _a, _b, _c, _d;
  22916. if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) {
  22917. return {
  22918. "true-value": (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true,
  22919. "false-value": (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false
  22920. };
  22921. }
  22922. return {
  22923. value: actualValue.value
  22924. };
  22925. });
  22926. const ns = useNamespace("checkbox");
  22927. const compKls = computed(() => {
  22928. return [
  22929. ns.b(),
  22930. ns.m(checkboxSize.value),
  22931. ns.is("disabled", isDisabled.value),
  22932. ns.is("bordered", props.border),
  22933. ns.is("checked", isChecked.value)
  22934. ];
  22935. });
  22936. const spanKls = computed(() => {
  22937. return [
  22938. ns.e("input"),
  22939. ns.is("disabled", isDisabled.value),
  22940. ns.is("checked", isChecked.value),
  22941. ns.is("indeterminate", props.indeterminate),
  22942. ns.is("focus", isFocused.value)
  22943. ];
  22944. });
  22945. return (_ctx, _cache) => {
  22946. return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
  22947. class: normalizeClass(unref(compKls)),
  22948. "aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
  22949. onClick: unref(onClickRoot)
  22950. }, {
  22951. default: withCtx(() => [
  22952. createElementVNode("span", {
  22953. class: normalizeClass(unref(spanKls))
  22954. }, [
  22955. withDirectives(createElementVNode("input", mergeProps({
  22956. id: unref(inputId),
  22957. "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
  22958. class: unref(ns).e("original"),
  22959. type: "checkbox",
  22960. indeterminate: _ctx.indeterminate,
  22961. name: _ctx.name,
  22962. tabindex: _ctx.tabindex,
  22963. disabled: unref(isDisabled)
  22964. }, unref(inputBindings), {
  22965. onChange: unref(handleChange),
  22966. onFocus: ($event) => isFocused.value = true,
  22967. onBlur: ($event) => isFocused.value = false,
  22968. onClick: withModifiers(() => {
  22969. }, ["stop"])
  22970. }), null, 16, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "onChange", "onFocus", "onBlur", "onClick"]), [
  22971. [vModelCheckbox, unref(model)]
  22972. ]),
  22973. createElementVNode("span", {
  22974. class: normalizeClass(unref(ns).e("inner"))
  22975. }, null, 2)
  22976. ], 2),
  22977. unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
  22978. key: 0,
  22979. class: normalizeClass(unref(ns).e("label"))
  22980. }, [
  22981. renderSlot(_ctx.$slots, "default"),
  22982. !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  22983. createTextVNode(toDisplayString(_ctx.label), 1)
  22984. ], 64)) : createCommentVNode("v-if", true)
  22985. ], 2)) : createCommentVNode("v-if", true)
  22986. ]),
  22987. _: 3
  22988. }, 8, ["class", "aria-controls", "onClick"]);
  22989. };
  22990. }
  22991. });
  22992. var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "checkbox.vue"]]);
  22993. const __default__$1u = defineComponent({
  22994. name: "ElCheckboxButton"
  22995. });
  22996. const _sfc_main$1W = /* @__PURE__ */ defineComponent({
  22997. ...__default__$1u,
  22998. props: checkboxProps,
  22999. emits: checkboxEmits,
  23000. setup(__props) {
  23001. const props = __props;
  23002. const slots = useSlots();
  23003. const {
  23004. isFocused,
  23005. isChecked,
  23006. isDisabled,
  23007. checkboxButtonSize,
  23008. model,
  23009. actualValue,
  23010. handleChange
  23011. } = useCheckbox(props, slots);
  23012. const inputBindings = computed(() => {
  23013. var _a, _b, _c, _d;
  23014. if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) {
  23015. return {
  23016. "true-value": (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true,
  23017. "false-value": (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false
  23018. };
  23019. }
  23020. return {
  23021. value: actualValue.value
  23022. };
  23023. });
  23024. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  23025. const ns = useNamespace("checkbox");
  23026. const activeStyle = computed(() => {
  23027. var _a, _b, _c, _d;
  23028. const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
  23029. return {
  23030. backgroundColor: fillValue,
  23031. borderColor: fillValue,
  23032. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  23033. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  23034. };
  23035. });
  23036. const labelKls = computed(() => {
  23037. return [
  23038. ns.b("button"),
  23039. ns.bm("button", checkboxButtonSize.value),
  23040. ns.is("disabled", isDisabled.value),
  23041. ns.is("checked", isChecked.value),
  23042. ns.is("focus", isFocused.value)
  23043. ];
  23044. });
  23045. return (_ctx, _cache) => {
  23046. return openBlock(), createElementBlock("label", {
  23047. class: normalizeClass(unref(labelKls))
  23048. }, [
  23049. withDirectives(createElementVNode("input", mergeProps({
  23050. "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
  23051. class: unref(ns).be("button", "original"),
  23052. type: "checkbox",
  23053. name: _ctx.name,
  23054. tabindex: _ctx.tabindex,
  23055. disabled: unref(isDisabled)
  23056. }, unref(inputBindings), {
  23057. onChange: unref(handleChange),
  23058. onFocus: ($event) => isFocused.value = true,
  23059. onBlur: ($event) => isFocused.value = false,
  23060. onClick: withModifiers(() => {
  23061. }, ["stop"])
  23062. }), null, 16, ["onUpdate:modelValue", "name", "tabindex", "disabled", "onChange", "onFocus", "onBlur", "onClick"]), [
  23063. [vModelCheckbox, unref(model)]
  23064. ]),
  23065. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  23066. key: 0,
  23067. class: normalizeClass(unref(ns).be("button", "inner")),
  23068. style: normalizeStyle(unref(isChecked) ? unref(activeStyle) : void 0)
  23069. }, [
  23070. renderSlot(_ctx.$slots, "default", {}, () => [
  23071. createTextVNode(toDisplayString(_ctx.label), 1)
  23072. ])
  23073. ], 6)) : createCommentVNode("v-if", true)
  23074. ], 2);
  23075. };
  23076. }
  23077. });
  23078. var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "checkbox-button.vue"]]);
  23079. const checkboxGroupProps = buildProps({
  23080. modelValue: {
  23081. type: definePropType(Array),
  23082. default: () => []
  23083. },
  23084. disabled: Boolean,
  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: {
  23099. type: definePropType(Array)
  23100. },
  23101. props: {
  23102. type: definePropType(Object),
  23103. default: () => checkboxDefaultProps
  23104. },
  23105. type: {
  23106. type: String,
  23107. values: ["checkbox", "button"],
  23108. default: "checkbox"
  23109. },
  23110. ...useAriaProps(["ariaLabel"])
  23111. });
  23112. const checkboxGroupEmits = {
  23113. [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
  23114. change: (val) => isArray$1(val)
  23115. };
  23116. const checkboxDefaultProps = {
  23117. label: "label",
  23118. value: "value",
  23119. disabled: "disabled"
  23120. };
  23121. const __default__$1t = defineComponent({
  23122. name: "ElCheckboxGroup"
  23123. });
  23124. const _sfc_main$1V = /* @__PURE__ */ defineComponent({
  23125. ...__default__$1t,
  23126. props: checkboxGroupProps,
  23127. emits: checkboxGroupEmits,
  23128. setup(__props, { emit }) {
  23129. const props = __props;
  23130. const ns = useNamespace("checkbox");
  23131. const { formItem } = useFormItem();
  23132. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  23133. formItemContext: formItem
  23134. });
  23135. const changeEvent = async (value) => {
  23136. emit(UPDATE_MODEL_EVENT, value);
  23137. await nextTick();
  23138. emit(CHANGE_EVENT, value);
  23139. };
  23140. const modelValue = computed({
  23141. get() {
  23142. return props.modelValue;
  23143. },
  23144. set(val) {
  23145. changeEvent(val);
  23146. }
  23147. });
  23148. const aliasProps = computed(() => ({
  23149. ...checkboxDefaultProps,
  23150. ...props.props
  23151. }));
  23152. const getOptionProps = (option) => {
  23153. const { label, value, disabled } = aliasProps.value;
  23154. const base = {
  23155. label: option[label],
  23156. value: option[value],
  23157. disabled: option[disabled]
  23158. };
  23159. return { ...omit(option, [label, value, disabled]), ...base };
  23160. };
  23161. const optionComponent = computed(() => props.type === "button" ? CheckboxButton : Checkbox);
  23162. provide(checkboxGroupContextKey, {
  23163. ...pick(toRefs(props), [
  23164. "size",
  23165. "min",
  23166. "max",
  23167. "disabled",
  23168. "validateEvent",
  23169. "fill",
  23170. "textColor"
  23171. ]),
  23172. modelValue,
  23173. changeEvent
  23174. });
  23175. watch(() => props.modelValue, (newVal, oldValue) => {
  23176. if (props.validateEvent && !isEqual$1(newVal, oldValue)) {
  23177. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  23178. }
  23179. });
  23180. return (_ctx, _cache) => {
  23181. var _a;
  23182. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  23183. id: unref(groupId),
  23184. class: normalizeClass(unref(ns).b("group")),
  23185. role: "group",
  23186. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
  23187. "aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItem)) == null ? void 0 : _a.labelId : void 0
  23188. }, {
  23189. default: withCtx(() => [
  23190. renderSlot(_ctx.$slots, "default", {}, () => [
  23191. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
  23192. return openBlock(), createBlock(resolveDynamicComponent(unref(optionComponent)), mergeProps({ key: index }, getOptionProps(item)), null, 16);
  23193. }), 128))
  23194. ])
  23195. ]),
  23196. _: 3
  23197. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  23198. };
  23199. }
  23200. });
  23201. var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "checkbox-group.vue"]]);
  23202. const ElCheckbox = withInstall(Checkbox, {
  23203. CheckboxButton,
  23204. CheckboxGroup
  23205. });
  23206. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  23207. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  23208. const radioPropsBase = buildProps({
  23209. modelValue: {
  23210. type: [String, Number, Boolean],
  23211. default: void 0
  23212. },
  23213. size: useSizeProp,
  23214. disabled: Boolean,
  23215. label: {
  23216. type: [String, Number, Boolean],
  23217. default: void 0
  23218. },
  23219. value: {
  23220. type: [String, Number, Boolean],
  23221. default: void 0
  23222. },
  23223. name: {
  23224. type: String,
  23225. default: void 0
  23226. }
  23227. });
  23228. const radioProps = buildProps({
  23229. ...radioPropsBase,
  23230. border: Boolean
  23231. });
  23232. const radioEmits = {
  23233. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  23234. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  23235. };
  23236. const radioGroupKey = Symbol("radioGroupKey");
  23237. const useRadio = (props, emit) => {
  23238. const radioRef = ref();
  23239. const radioGroup = inject(radioGroupKey, void 0);
  23240. const isGroup = computed(() => !!radioGroup);
  23241. const actualValue = computed(() => {
  23242. if (!isPropAbsent(props.value)) {
  23243. return props.value;
  23244. }
  23245. return props.label;
  23246. });
  23247. const modelValue = computed({
  23248. get() {
  23249. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  23250. },
  23251. set(val) {
  23252. if (isGroup.value) {
  23253. radioGroup.changeEvent(val);
  23254. } else {
  23255. emit && emit(UPDATE_MODEL_EVENT, val);
  23256. }
  23257. radioRef.value.checked = props.modelValue === actualValue.value;
  23258. }
  23259. });
  23260. const size = useFormSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
  23261. const disabled = useFormDisabled(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  23262. const focus = ref(false);
  23263. const tabIndex = computed(() => {
  23264. return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
  23265. });
  23266. useDeprecated({
  23267. from: "label act as value",
  23268. replacement: "value",
  23269. version: "3.0.0",
  23270. scope: "el-radio",
  23271. ref: "https://element-plus.org/en-US/component/radio.html"
  23272. }, computed(() => isGroup.value && isPropAbsent(props.value)));
  23273. return {
  23274. radioRef,
  23275. isGroup,
  23276. radioGroup,
  23277. focus,
  23278. size,
  23279. disabled,
  23280. tabIndex,
  23281. modelValue,
  23282. actualValue
  23283. };
  23284. };
  23285. const __default__$1s = defineComponent({
  23286. name: "ElRadio"
  23287. });
  23288. const _sfc_main$1U = /* @__PURE__ */ defineComponent({
  23289. ...__default__$1s,
  23290. props: radioProps,
  23291. emits: radioEmits,
  23292. setup(__props, { emit }) {
  23293. const props = __props;
  23294. const ns = useNamespace("radio");
  23295. const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio(props, emit);
  23296. function handleChange() {
  23297. nextTick(() => emit(CHANGE_EVENT, modelValue.value));
  23298. }
  23299. return (_ctx, _cache) => {
  23300. var _a;
  23301. return openBlock(), createElementBlock("label", {
  23302. class: normalizeClass([
  23303. unref(ns).b(),
  23304. unref(ns).is("disabled", unref(disabled)),
  23305. unref(ns).is("focus", unref(focus)),
  23306. unref(ns).is("bordered", _ctx.border),
  23307. unref(ns).is("checked", unref(modelValue) === unref(actualValue)),
  23308. unref(ns).m(unref(size))
  23309. ])
  23310. }, [
  23311. createElementVNode("span", {
  23312. class: normalizeClass([
  23313. unref(ns).e("input"),
  23314. unref(ns).is("disabled", unref(disabled)),
  23315. unref(ns).is("checked", unref(modelValue) === unref(actualValue))
  23316. ])
  23317. }, [
  23318. withDirectives(createElementVNode("input", {
  23319. ref_key: "radioRef",
  23320. ref: radioRef,
  23321. "onUpdate:modelValue": ($event) => isRef(modelValue) ? modelValue.value = $event : null,
  23322. class: normalizeClass(unref(ns).e("original")),
  23323. value: unref(actualValue),
  23324. name: _ctx.name || ((_a = unref(radioGroup)) == null ? void 0 : _a.name),
  23325. disabled: unref(disabled),
  23326. checked: unref(modelValue) === unref(actualValue),
  23327. type: "radio",
  23328. onFocus: ($event) => focus.value = true,
  23329. onBlur: ($event) => focus.value = false,
  23330. onChange: handleChange,
  23331. onClick: withModifiers(() => {
  23332. }, ["stop"])
  23333. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
  23334. [vModelRadio, unref(modelValue)]
  23335. ]),
  23336. createElementVNode("span", {
  23337. class: normalizeClass(unref(ns).e("inner"))
  23338. }, null, 2)
  23339. ], 2),
  23340. createElementVNode("span", {
  23341. class: normalizeClass(unref(ns).e("label")),
  23342. onKeydown: withModifiers(() => {
  23343. }, ["stop"])
  23344. }, [
  23345. renderSlot(_ctx.$slots, "default", {}, () => [
  23346. createTextVNode(toDisplayString(_ctx.label), 1)
  23347. ])
  23348. ], 42, ["onKeydown"])
  23349. ], 2);
  23350. };
  23351. }
  23352. });
  23353. var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "radio.vue"]]);
  23354. const radioButtonProps = buildProps({
  23355. ...radioPropsBase
  23356. });
  23357. const __default__$1r = defineComponent({
  23358. name: "ElRadioButton"
  23359. });
  23360. const _sfc_main$1T = /* @__PURE__ */ defineComponent({
  23361. ...__default__$1r,
  23362. props: radioButtonProps,
  23363. setup(__props) {
  23364. const props = __props;
  23365. const ns = useNamespace("radio");
  23366. const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio(props);
  23367. const activeStyle = computed(() => {
  23368. return {
  23369. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  23370. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  23371. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  23372. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  23373. };
  23374. });
  23375. return (_ctx, _cache) => {
  23376. var _a;
  23377. return openBlock(), createElementBlock("label", {
  23378. class: normalizeClass([
  23379. unref(ns).b("button"),
  23380. unref(ns).is("active", unref(modelValue) === unref(actualValue)),
  23381. unref(ns).is("disabled", unref(disabled)),
  23382. unref(ns).is("focus", unref(focus)),
  23383. unref(ns).bm("button", unref(size))
  23384. ])
  23385. }, [
  23386. withDirectives(createElementVNode("input", {
  23387. ref_key: "radioRef",
  23388. ref: radioRef,
  23389. "onUpdate:modelValue": ($event) => isRef(modelValue) ? modelValue.value = $event : null,
  23390. class: normalizeClass(unref(ns).be("button", "original-radio")),
  23391. value: unref(actualValue),
  23392. type: "radio",
  23393. name: _ctx.name || ((_a = unref(radioGroup)) == null ? void 0 : _a.name),
  23394. disabled: unref(disabled),
  23395. onFocus: ($event) => focus.value = true,
  23396. onBlur: ($event) => focus.value = false,
  23397. onClick: withModifiers(() => {
  23398. }, ["stop"])
  23399. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
  23400. [vModelRadio, unref(modelValue)]
  23401. ]),
  23402. createElementVNode("span", {
  23403. class: normalizeClass(unref(ns).be("button", "inner")),
  23404. style: normalizeStyle(unref(modelValue) === unref(actualValue) ? unref(activeStyle) : {}),
  23405. onKeydown: withModifiers(() => {
  23406. }, ["stop"])
  23407. }, [
  23408. renderSlot(_ctx.$slots, "default", {}, () => [
  23409. createTextVNode(toDisplayString(_ctx.label), 1)
  23410. ])
  23411. ], 46, ["onKeydown"])
  23412. ], 2);
  23413. };
  23414. }
  23415. });
  23416. var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["__file", "radio-button.vue"]]);
  23417. const radioGroupProps = buildProps({
  23418. id: {
  23419. type: String,
  23420. default: void 0
  23421. },
  23422. size: useSizeProp,
  23423. disabled: Boolean,
  23424. modelValue: {
  23425. type: [String, Number, Boolean],
  23426. default: void 0
  23427. },
  23428. fill: {
  23429. type: String,
  23430. default: ""
  23431. },
  23432. textColor: {
  23433. type: String,
  23434. default: ""
  23435. },
  23436. name: {
  23437. type: String,
  23438. default: void 0
  23439. },
  23440. validateEvent: {
  23441. type: Boolean,
  23442. default: true
  23443. },
  23444. options: {
  23445. type: definePropType(Array)
  23446. },
  23447. props: {
  23448. type: definePropType(Object),
  23449. default: () => radioDefaultProps
  23450. },
  23451. type: {
  23452. type: String,
  23453. values: ["radio", "button"],
  23454. default: "radio"
  23455. },
  23456. ...useAriaProps(["ariaLabel"])
  23457. });
  23458. const radioGroupEmits = radioEmits;
  23459. const radioDefaultProps = {
  23460. label: "label",
  23461. value: "value",
  23462. disabled: "disabled"
  23463. };
  23464. const __default__$1q = defineComponent({
  23465. name: "ElRadioGroup"
  23466. });
  23467. const _sfc_main$1S = /* @__PURE__ */ defineComponent({
  23468. ...__default__$1q,
  23469. props: radioGroupProps,
  23470. emits: radioGroupEmits,
  23471. setup(__props, { emit }) {
  23472. const props = __props;
  23473. const ns = useNamespace("radio");
  23474. const radioId = useId();
  23475. const radioGroupRef = ref();
  23476. const { formItem } = useFormItem();
  23477. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  23478. formItemContext: formItem
  23479. });
  23480. const changeEvent = (value) => {
  23481. emit(UPDATE_MODEL_EVENT, value);
  23482. nextTick(() => emit(CHANGE_EVENT, value));
  23483. };
  23484. onMounted(() => {
  23485. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  23486. const firstLabel = radios[0];
  23487. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  23488. firstLabel.tabIndex = 0;
  23489. }
  23490. });
  23491. const name = computed(() => {
  23492. return props.name || radioId.value;
  23493. });
  23494. const aliasProps = computed(() => ({
  23495. ...radioDefaultProps,
  23496. ...props.props
  23497. }));
  23498. const getOptionProps = (option) => {
  23499. const { label, value, disabled } = aliasProps.value;
  23500. const base = {
  23501. label: option[label],
  23502. value: option[value],
  23503. disabled: option[disabled]
  23504. };
  23505. return { ...omit(option, [label, value, disabled]), ...base };
  23506. };
  23507. const optionComponent = computed(() => props.type === "button" ? RadioButton : Radio);
  23508. provide(radioGroupKey, reactive({
  23509. ...toRefs(props),
  23510. changeEvent,
  23511. name
  23512. }));
  23513. watch(() => props.modelValue, (newVal, oldValue) => {
  23514. if (props.validateEvent && !isEqual$1(newVal, oldValue)) {
  23515. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  23516. }
  23517. });
  23518. return (_ctx, _cache) => {
  23519. return openBlock(), createElementBlock("div", {
  23520. id: unref(groupId),
  23521. ref_key: "radioGroupRef",
  23522. ref: radioGroupRef,
  23523. class: normalizeClass(unref(ns).b("group")),
  23524. role: "radiogroup",
  23525. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "radio-group" : void 0,
  23526. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  23527. }, [
  23528. renderSlot(_ctx.$slots, "default", {}, () => [
  23529. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
  23530. return openBlock(), createBlock(resolveDynamicComponent(unref(optionComponent)), mergeProps({ key: index }, getOptionProps(item)), null, 16);
  23531. }), 128))
  23532. ])
  23533. ], 10, ["id", "aria-label", "aria-labelledby"]);
  23534. };
  23535. }
  23536. });
  23537. var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["__file", "radio-group.vue"]]);
  23538. const ElRadio = withInstall(Radio, {
  23539. RadioButton,
  23540. RadioGroup
  23541. });
  23542. const ElRadioGroup = withNoopInstall(RadioGroup);
  23543. const ElRadioButton = withNoopInstall(RadioButton);
  23544. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  23545. function isVNodeEmpty(vnodes) {
  23546. return !!(isArray$1(vnodes) ? vnodes.every(({
  23547. type
  23548. }) => type === Comment) : (vnodes == null ? void 0 : vnodes.type) === Comment);
  23549. }
  23550. var NodeContent$1 = defineComponent({
  23551. name: "NodeContent",
  23552. props: {
  23553. node: {
  23554. type: Object,
  23555. required: true
  23556. }
  23557. },
  23558. setup(props) {
  23559. const ns = useNamespace("cascader-node");
  23560. const {
  23561. renderLabelFn
  23562. } = inject(CASCADER_PANEL_INJECTION_KEY);
  23563. const {
  23564. node
  23565. } = props;
  23566. const {
  23567. data,
  23568. label: nodeLabel
  23569. } = node;
  23570. const label = () => {
  23571. const renderLabel = renderLabelFn == null ? void 0 : renderLabelFn({
  23572. node,
  23573. data
  23574. });
  23575. return isVNodeEmpty(renderLabel) ? nodeLabel : renderLabel != null ? renderLabel : nodeLabel;
  23576. };
  23577. return () => createVNode("span", {
  23578. "class": ns.e("label")
  23579. }, [label()]);
  23580. }
  23581. });
  23582. const __default__$1p = defineComponent({
  23583. name: "ElCascaderNode"
  23584. });
  23585. const _sfc_main$1R = /* @__PURE__ */ defineComponent({
  23586. ...__default__$1p,
  23587. props: {
  23588. node: {
  23589. type: Object,
  23590. required: true
  23591. },
  23592. menuId: String
  23593. },
  23594. emits: ["expand"],
  23595. setup(__props, { emit }) {
  23596. const props = __props;
  23597. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  23598. const ns = useNamespace("cascader-node");
  23599. const isHoverMenu = computed(() => panel.isHoverMenu);
  23600. const multiple = computed(() => panel.config.multiple);
  23601. const checkStrictly = computed(() => panel.config.checkStrictly);
  23602. const showPrefix = computed(() => panel.config.showPrefix);
  23603. const checkedNodeId = computed(() => {
  23604. var _a;
  23605. return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid;
  23606. });
  23607. const isDisabled = computed(() => props.node.isDisabled);
  23608. const isLeaf = computed(() => props.node.isLeaf);
  23609. const expandable = computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  23610. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  23611. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  23612. const isInPath = (node) => {
  23613. var _a;
  23614. const { level, uid } = props.node;
  23615. return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid;
  23616. };
  23617. const doExpand = () => {
  23618. if (inExpandingPath.value)
  23619. return;
  23620. panel.expandNode(props.node);
  23621. };
  23622. const doCheck = (checked) => {
  23623. const { node } = props;
  23624. if (checked === node.checked)
  23625. return;
  23626. panel.handleCheckChange(node, checked);
  23627. };
  23628. const doLoad = () => {
  23629. panel.lazyLoad(props.node, () => {
  23630. if (!isLeaf.value)
  23631. doExpand();
  23632. });
  23633. };
  23634. const handleHoverExpand = (e) => {
  23635. if (!isHoverMenu.value)
  23636. return;
  23637. handleExpand();
  23638. !isLeaf.value && emit("expand", e);
  23639. };
  23640. const handleExpand = () => {
  23641. const { node } = props;
  23642. if (!expandable.value || node.loading)
  23643. return;
  23644. node.loaded ? doExpand() : doLoad();
  23645. };
  23646. const handleClick = () => {
  23647. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  23648. handleCheck(true);
  23649. } else if ((panel.config.checkOnClickNode && (multiple.value || checkStrictly.value) || isLeaf.value && panel.config.checkOnClickLeaf) && !isDisabled.value) {
  23650. handleSelectCheck(!props.node.checked);
  23651. } else if (!isHoverMenu.value) {
  23652. handleExpand();
  23653. }
  23654. };
  23655. const handleSelectCheck = (checked) => {
  23656. if (checkStrictly.value) {
  23657. doCheck(checked);
  23658. if (props.node.loaded) {
  23659. doExpand();
  23660. }
  23661. } else {
  23662. handleCheck(checked);
  23663. }
  23664. };
  23665. const handleCheck = (checked) => {
  23666. if (!props.node.loaded) {
  23667. doLoad();
  23668. } else {
  23669. doCheck(checked);
  23670. !checkStrictly.value && doExpand();
  23671. }
  23672. };
  23673. return (_ctx, _cache) => {
  23674. return openBlock(), createElementBlock("li", {
  23675. id: `${__props.menuId}-${__props.node.uid}`,
  23676. role: "menuitem",
  23677. "aria-haspopup": !unref(isLeaf),
  23678. "aria-owns": unref(isLeaf) ? void 0 : __props.menuId,
  23679. "aria-expanded": unref(inExpandingPath),
  23680. tabindex: unref(expandable) ? -1 : void 0,
  23681. class: normalizeClass([
  23682. unref(ns).b(),
  23683. unref(ns).is("selectable", unref(checkStrictly)),
  23684. unref(ns).is("active", __props.node.checked),
  23685. unref(ns).is("disabled", !unref(expandable)),
  23686. unref(inExpandingPath) && "in-active-path",
  23687. unref(inCheckedPath) && "in-checked-path"
  23688. ]),
  23689. onMouseenter: handleHoverExpand,
  23690. onFocus: handleHoverExpand,
  23691. onClick: handleClick
  23692. }, [
  23693. createCommentVNode(" prefix "),
  23694. unref(multiple) && unref(showPrefix) ? (openBlock(), createBlock(unref(ElCheckbox), {
  23695. key: 0,
  23696. "model-value": __props.node.checked,
  23697. indeterminate: __props.node.indeterminate,
  23698. disabled: unref(isDisabled),
  23699. onClick: withModifiers(() => {
  23700. }, ["stop"]),
  23701. "onUpdate:modelValue": handleSelectCheck
  23702. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : unref(checkStrictly) && unref(showPrefix) ? (openBlock(), createBlock(unref(ElRadio), {
  23703. key: 1,
  23704. "model-value": unref(checkedNodeId),
  23705. label: __props.node.uid,
  23706. disabled: unref(isDisabled),
  23707. "onUpdate:modelValue": handleSelectCheck,
  23708. onClick: withModifiers(() => {
  23709. }, ["stop"])
  23710. }, {
  23711. default: withCtx(() => [
  23712. 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 "),
  23713. createElementVNode("span")
  23714. ]),
  23715. _: 1
  23716. }, 8, ["model-value", "label", "disabled", "onClick"])) : unref(isLeaf) && __props.node.checked ? (openBlock(), createBlock(unref(ElIcon), {
  23717. key: 2,
  23718. class: normalizeClass(unref(ns).e("prefix"))
  23719. }, {
  23720. default: withCtx(() => [
  23721. createVNode(unref(check_default))
  23722. ]),
  23723. _: 1
  23724. }, 8, ["class"])) : createCommentVNode("v-if", true),
  23725. createCommentVNode(" content "),
  23726. createVNode(unref(NodeContent$1), { node: __props.node }, null, 8, ["node"]),
  23727. createCommentVNode(" postfix "),
  23728. !unref(isLeaf) ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  23729. __props.node.loading ? (openBlock(), createBlock(unref(ElIcon), {
  23730. key: 0,
  23731. class: normalizeClass([unref(ns).is("loading"), unref(ns).e("postfix")])
  23732. }, {
  23733. default: withCtx(() => [
  23734. createVNode(unref(loading_default))
  23735. ]),
  23736. _: 1
  23737. }, 8, ["class"])) : (openBlock(), createBlock(unref(ElIcon), {
  23738. key: 1,
  23739. class: normalizeClass(["arrow-right", unref(ns).e("postfix")])
  23740. }, {
  23741. default: withCtx(() => [
  23742. createVNode(unref(arrow_right_default))
  23743. ]),
  23744. _: 1
  23745. }, 8, ["class"]))
  23746. ], 64)) : createCommentVNode("v-if", true)
  23747. ], 42, ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"]);
  23748. };
  23749. }
  23750. });
  23751. var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["__file", "node.vue"]]);
  23752. const __default__$1o = defineComponent({
  23753. name: "ElCascaderMenu"
  23754. });
  23755. const _sfc_main$1Q = /* @__PURE__ */ defineComponent({
  23756. ...__default__$1o,
  23757. props: {
  23758. nodes: {
  23759. type: Array,
  23760. required: true
  23761. },
  23762. index: {
  23763. type: Number,
  23764. required: true
  23765. }
  23766. },
  23767. setup(__props) {
  23768. const props = __props;
  23769. const instance = getCurrentInstance();
  23770. const ns = useNamespace("cascader-menu");
  23771. const { t } = useLocale();
  23772. const id = useId();
  23773. let activeNode;
  23774. let hoverTimer;
  23775. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  23776. const hoverZone = ref();
  23777. const isEmpty = computed(() => !props.nodes.length);
  23778. const isLoading = computed(() => !panel.initialLoaded);
  23779. const menuId = computed(() => `${id.value}-${props.index}`);
  23780. const handleExpand = (e) => {
  23781. activeNode = e.target;
  23782. };
  23783. const handleMouseMove = (e) => {
  23784. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  23785. return;
  23786. if (activeNode.contains(e.target)) {
  23787. clearHoverTimer();
  23788. const el = instance.vnode.el;
  23789. const { left } = el.getBoundingClientRect();
  23790. const { offsetWidth, offsetHeight } = el;
  23791. const startX = e.clientX - left;
  23792. const top = activeNode.offsetTop;
  23793. const bottom = top + activeNode.offsetHeight;
  23794. hoverZone.value.innerHTML = `
  23795. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  23796. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  23797. `;
  23798. } else if (!hoverTimer) {
  23799. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  23800. }
  23801. };
  23802. const clearHoverTimer = () => {
  23803. if (!hoverTimer)
  23804. return;
  23805. clearTimeout(hoverTimer);
  23806. hoverTimer = void 0;
  23807. };
  23808. const clearHoverZone = () => {
  23809. if (!hoverZone.value)
  23810. return;
  23811. hoverZone.value.innerHTML = "";
  23812. clearHoverTimer();
  23813. };
  23814. return (_ctx, _cache) => {
  23815. return openBlock(), createBlock(unref(ElScrollbar), {
  23816. key: unref(menuId),
  23817. tag: "ul",
  23818. role: "menu",
  23819. class: normalizeClass(unref(ns).b()),
  23820. "wrap-class": unref(ns).e("wrap"),
  23821. "view-class": [unref(ns).e("list"), unref(ns).is("empty", unref(isEmpty))],
  23822. onMousemove: handleMouseMove,
  23823. onMouseleave: clearHoverZone
  23824. }, {
  23825. default: withCtx(() => {
  23826. var _a;
  23827. return [
  23828. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.nodes, (node) => {
  23829. return openBlock(), createBlock(ElCascaderNode, {
  23830. key: node.uid,
  23831. node,
  23832. "menu-id": unref(menuId),
  23833. onExpand: handleExpand
  23834. }, null, 8, ["node", "menu-id"]);
  23835. }), 128)),
  23836. unref(isLoading) ? (openBlock(), createElementBlock("div", {
  23837. key: 0,
  23838. class: normalizeClass(unref(ns).e("empty-text"))
  23839. }, [
  23840. createVNode(unref(ElIcon), {
  23841. size: "14",
  23842. class: normalizeClass(unref(ns).is("loading"))
  23843. }, {
  23844. default: withCtx(() => [
  23845. createVNode(unref(loading_default))
  23846. ]),
  23847. _: 1
  23848. }, 8, ["class"]),
  23849. createTextVNode(" " + toDisplayString(unref(t)("el.cascader.loading")), 1)
  23850. ], 2)) : unref(isEmpty) ? (openBlock(), createElementBlock("div", {
  23851. key: 1,
  23852. class: normalizeClass(unref(ns).e("empty-text"))
  23853. }, [
  23854. renderSlot(_ctx.$slots, "empty", {}, () => [
  23855. createTextVNode(toDisplayString(unref(t)("el.cascader.noData")), 1)
  23856. ])
  23857. ], 2)) : ((_a = unref(panel)) == null ? void 0 : _a.isHoverMenu) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  23858. createCommentVNode(" eslint-disable-next-line vue/html-self-closing "),
  23859. (openBlock(), createElementBlock("svg", {
  23860. ref_key: "hoverZone",
  23861. ref: hoverZone,
  23862. class: normalizeClass(unref(ns).e("hover-zone"))
  23863. }, null, 2))
  23864. ], 2112)) : createCommentVNode("v-if", true)
  23865. ];
  23866. }),
  23867. _: 3
  23868. }, 8, ["class", "wrap-class", "view-class"]);
  23869. };
  23870. }
  23871. });
  23872. var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["__file", "menu.vue"]]);
  23873. let uid = 0;
  23874. const calculatePathNodes = (node) => {
  23875. const nodes = [node];
  23876. let { parent } = node;
  23877. while (parent) {
  23878. nodes.unshift(parent);
  23879. parent = parent.parent;
  23880. }
  23881. return nodes;
  23882. };
  23883. class Node$3 {
  23884. constructor(data, config, parent, root = false) {
  23885. this.data = data;
  23886. this.config = config;
  23887. this.parent = parent;
  23888. this.root = root;
  23889. this.uid = uid++;
  23890. this.checked = false;
  23891. this.indeterminate = false;
  23892. this.loading = false;
  23893. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  23894. const childrenData = data[childrenKey];
  23895. const pathNodes = calculatePathNodes(this);
  23896. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  23897. this.value = data[valueKey];
  23898. this.label = data[labelKey];
  23899. this.pathNodes = pathNodes;
  23900. this.pathValues = pathNodes.map((node) => node.value);
  23901. this.pathLabels = pathNodes.map((node) => node.label);
  23902. this.childrenData = childrenData;
  23903. this.children = (childrenData || []).map((child) => new Node$3(child, config, this));
  23904. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  23905. this.text = "";
  23906. }
  23907. get isDisabled() {
  23908. const { data, parent, config } = this;
  23909. const { disabled, checkStrictly } = config;
  23910. const isDisabled = isFunction$1(disabled) ? disabled(data, this) : !!data[disabled];
  23911. return isDisabled || !checkStrictly && !!(parent == null ? void 0 : parent.isDisabled);
  23912. }
  23913. get isLeaf() {
  23914. const { data, config, childrenData, loaded } = this;
  23915. const { lazy, leaf } = config;
  23916. const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf];
  23917. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(isArray$1(childrenData) && childrenData.length) : !!isLeaf;
  23918. }
  23919. get valueByOption() {
  23920. return this.config.emitPath ? this.pathValues : this.value;
  23921. }
  23922. appendChild(childData) {
  23923. const { childrenData, children } = this;
  23924. const node = new Node$3(childData, this.config, this);
  23925. if (isArray$1(childrenData)) {
  23926. childrenData.push(childData);
  23927. } else {
  23928. this.childrenData = [childData];
  23929. }
  23930. children.push(node);
  23931. return node;
  23932. }
  23933. calcText(allLevels, separator) {
  23934. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  23935. this.text = text;
  23936. return text;
  23937. }
  23938. broadcast(checked) {
  23939. this.children.forEach((child) => {
  23940. var _a;
  23941. if (child) {
  23942. child.broadcast(checked);
  23943. (_a = child.onParentCheck) == null ? void 0 : _a.call(child, checked);
  23944. }
  23945. });
  23946. }
  23947. emit() {
  23948. var _a;
  23949. const { parent } = this;
  23950. if (parent) {
  23951. (_a = parent.onChildCheck) == null ? void 0 : _a.call(parent);
  23952. parent.emit();
  23953. }
  23954. }
  23955. onParentCheck(checked) {
  23956. if (!this.isDisabled) {
  23957. this.setCheckState(checked);
  23958. }
  23959. }
  23960. onChildCheck() {
  23961. const { children } = this;
  23962. const validChildren = children.filter((child) => !child.isDisabled);
  23963. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  23964. this.setCheckState(checked);
  23965. }
  23966. setCheckState(checked) {
  23967. const totalNum = this.children.length;
  23968. const checkedNum = this.children.reduce((c, p) => {
  23969. const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  23970. return c + num;
  23971. }, 0);
  23972. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  23973. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  23974. }
  23975. doCheck(checked) {
  23976. if (this.checked === checked)
  23977. return;
  23978. const { checkStrictly, multiple } = this.config;
  23979. if (checkStrictly || !multiple) {
  23980. this.checked = checked;
  23981. } else {
  23982. this.broadcast(checked);
  23983. this.setCheckState(checked);
  23984. this.emit();
  23985. }
  23986. }
  23987. }
  23988. var Node$4 = Node$3;
  23989. const flatNodes = (nodes, leafOnly) => {
  23990. return nodes.reduce((res, node) => {
  23991. if (node.isLeaf) {
  23992. res.push(node);
  23993. } else {
  23994. !leafOnly && res.push(node);
  23995. res = res.concat(flatNodes(node.children, leafOnly));
  23996. }
  23997. return res;
  23998. }, []);
  23999. };
  24000. class Store {
  24001. constructor(data, config) {
  24002. this.config = config;
  24003. const nodes = (data || []).map((nodeData) => new Node$4(nodeData, this.config));
  24004. this.nodes = nodes;
  24005. this.allNodes = flatNodes(nodes, false);
  24006. this.leafNodes = flatNodes(nodes, true);
  24007. }
  24008. getNodes() {
  24009. return this.nodes;
  24010. }
  24011. getFlattedNodes(leafOnly) {
  24012. return leafOnly ? this.leafNodes : this.allNodes;
  24013. }
  24014. appendNode(nodeData, parentNode) {
  24015. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$4(nodeData, this.config);
  24016. if (!parentNode)
  24017. this.nodes.push(node);
  24018. this.appendAllNodesAndLeafNodes(node);
  24019. }
  24020. appendNodes(nodeDataList, parentNode) {
  24021. if (nodeDataList.length > 0) {
  24022. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  24023. } else {
  24024. parentNode && parentNode.isLeaf && this.leafNodes.push(parentNode);
  24025. }
  24026. }
  24027. appendAllNodesAndLeafNodes(node) {
  24028. this.allNodes.push(node);
  24029. node.isLeaf && this.leafNodes.push(node);
  24030. if (node.children) {
  24031. node.children.forEach((subNode) => {
  24032. this.appendAllNodesAndLeafNodes(subNode);
  24033. });
  24034. }
  24035. }
  24036. getNodeByValue(value, leafOnly = false) {
  24037. if (isPropAbsent(value))
  24038. return null;
  24039. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  24040. return node || null;
  24041. }
  24042. getSameNode(node) {
  24043. if (!node)
  24044. return null;
  24045. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  24046. return node_ || null;
  24047. }
  24048. }
  24049. const CommonProps = buildProps({
  24050. modelValue: {
  24051. type: definePropType([Number, String, Array, Object])
  24052. },
  24053. options: {
  24054. type: definePropType(Array),
  24055. default: () => []
  24056. },
  24057. props: {
  24058. type: definePropType(Object),
  24059. default: () => ({})
  24060. }
  24061. });
  24062. const DefaultProps = {
  24063. expandTrigger: "click",
  24064. multiple: false,
  24065. checkStrictly: false,
  24066. emitPath: true,
  24067. lazy: false,
  24068. lazyLoad: NOOP,
  24069. value: "value",
  24070. label: "label",
  24071. children: "children",
  24072. leaf: "leaf",
  24073. disabled: "disabled",
  24074. hoverThreshold: 500,
  24075. checkOnClickNode: false,
  24076. checkOnClickLeaf: true,
  24077. showPrefix: true
  24078. };
  24079. const cascaderPanelProps = buildProps({
  24080. ...CommonProps,
  24081. border: {
  24082. type: Boolean,
  24083. default: true
  24084. },
  24085. renderLabel: {
  24086. type: Function
  24087. }
  24088. });
  24089. const emitChangeFn$2 = (value) => true;
  24090. const cascaderPanelEmits = {
  24091. [UPDATE_MODEL_EVENT]: emitChangeFn$2,
  24092. [CHANGE_EVENT]: emitChangeFn$2,
  24093. close: () => true,
  24094. "expand-change": (value) => value
  24095. };
  24096. const useCascaderConfig = (props) => {
  24097. return computed(() => ({
  24098. ...DefaultProps,
  24099. ...props.props
  24100. }));
  24101. };
  24102. const getMenuIndex = (el) => {
  24103. if (!el)
  24104. return 0;
  24105. const pieces = el.id.split("-");
  24106. return Number(pieces[pieces.length - 2]);
  24107. };
  24108. const checkNode = (el) => {
  24109. if (!el)
  24110. return;
  24111. const input = el.querySelector("input");
  24112. if (input) {
  24113. input.click();
  24114. } else if (isLeaf(el)) {
  24115. el.click();
  24116. }
  24117. };
  24118. const sortByOriginalOrder = (oldNodes, newNodes) => {
  24119. const newNodesCopy = newNodes.slice(0);
  24120. const newIds = newNodesCopy.map((node) => node.uid);
  24121. const res = oldNodes.reduce((acc, item) => {
  24122. const index = newIds.indexOf(item.uid);
  24123. if (index > -1) {
  24124. acc.push(item);
  24125. newNodesCopy.splice(index, 1);
  24126. newIds.splice(index, 1);
  24127. }
  24128. return acc;
  24129. }, []);
  24130. res.push(...newNodesCopy);
  24131. return res;
  24132. };
  24133. const __default__$1n = defineComponent({
  24134. name: "ElCascaderPanel",
  24135. inheritAttrs: false
  24136. });
  24137. const _sfc_main$1P = /* @__PURE__ */ defineComponent({
  24138. ...__default__$1n,
  24139. props: cascaderPanelProps,
  24140. emits: cascaderPanelEmits,
  24141. setup(__props, { expose, emit }) {
  24142. const props = __props;
  24143. let manualChecked = false;
  24144. const ns = useNamespace("cascader");
  24145. const config = useCascaderConfig(props);
  24146. const slots = useSlots();
  24147. let store;
  24148. const initialLoaded = ref(true);
  24149. const initialLoadedOnce = ref(false);
  24150. const menuList = ref([]);
  24151. const checkedValue = ref();
  24152. const menus = ref([]);
  24153. const expandingNode = ref();
  24154. const checkedNodes = ref([]);
  24155. const isHoverMenu = computed(() => config.value.expandTrigger === "hover");
  24156. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  24157. const initStore = () => {
  24158. const { options } = props;
  24159. const cfg = config.value;
  24160. manualChecked = false;
  24161. store = new Store(options, cfg);
  24162. menus.value = [store.getNodes()];
  24163. if (cfg.lazy && isEmpty(props.options)) {
  24164. initialLoaded.value = false;
  24165. lazyLoad(void 0, (list) => {
  24166. if (list) {
  24167. store = new Store(list, cfg);
  24168. menus.value = [store.getNodes()];
  24169. }
  24170. initialLoaded.value = true;
  24171. syncCheckedValue(false, true);
  24172. });
  24173. } else {
  24174. syncCheckedValue(false, true);
  24175. }
  24176. };
  24177. const lazyLoad = (node, cb) => {
  24178. const cfg = config.value;
  24179. node = node || new Node$4({}, cfg, void 0, true);
  24180. node.loading = true;
  24181. const resolve = (dataList) => {
  24182. const _node = node;
  24183. const parent = _node.root ? null : _node;
  24184. _node.loading = false;
  24185. _node.loaded = true;
  24186. _node.childrenData = _node.childrenData || [];
  24187. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  24188. dataList && (cb == null ? void 0 : cb(dataList));
  24189. if (node.level === 0) {
  24190. initialLoadedOnce.value = true;
  24191. }
  24192. };
  24193. const reject = () => {
  24194. node.loading = false;
  24195. node.loaded = false;
  24196. if (node.level === 0) {
  24197. initialLoaded.value = true;
  24198. }
  24199. };
  24200. cfg.lazyLoad(node, resolve, reject);
  24201. };
  24202. const expandNode = (node, silent) => {
  24203. var _a;
  24204. const { level } = node;
  24205. const newMenus = menus.value.slice(0, level);
  24206. let newExpandingNode;
  24207. if (node.isLeaf) {
  24208. newExpandingNode = node.pathNodes[level - 2];
  24209. } else {
  24210. newExpandingNode = node;
  24211. newMenus.push(node.children);
  24212. }
  24213. if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  24214. expandingNode.value = node;
  24215. menus.value = newMenus;
  24216. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  24217. }
  24218. };
  24219. const handleCheckChange = (node, checked, emitClose = true) => {
  24220. const { checkStrictly, multiple } = config.value;
  24221. const oldNode = checkedNodes.value[0];
  24222. manualChecked = true;
  24223. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  24224. node.doCheck(checked);
  24225. calculateCheckedValue();
  24226. emitClose && !multiple && !checkStrictly && emit("close");
  24227. !emitClose && !multiple && expandParentNode(node);
  24228. };
  24229. const expandParentNode = (node) => {
  24230. if (!node)
  24231. return;
  24232. node = node.parent;
  24233. expandParentNode(node);
  24234. node && expandNode(node);
  24235. };
  24236. const getFlattedNodes = (leafOnly) => store == null ? void 0 : store.getFlattedNodes(leafOnly);
  24237. const getCheckedNodes = (leafOnly) => {
  24238. var _a;
  24239. return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter(({ checked }) => checked !== false);
  24240. };
  24241. const clearCheckedNodes = () => {
  24242. checkedNodes.value.forEach((node) => node.doCheck(false));
  24243. calculateCheckedValue();
  24244. menus.value = menus.value.slice(0, 1);
  24245. expandingNode.value = void 0;
  24246. emit("expand-change", []);
  24247. };
  24248. const calculateCheckedValue = () => {
  24249. var _a;
  24250. const { checkStrictly, multiple } = config.value;
  24251. const oldNodes = checkedNodes.value;
  24252. const newNodes = getCheckedNodes(!checkStrictly);
  24253. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  24254. const values = nodes.map((node) => node.valueByOption);
  24255. checkedNodes.value = nodes;
  24256. checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null;
  24257. };
  24258. const syncCheckedValue = (loaded = false, forced = false) => {
  24259. const { modelValue } = props;
  24260. const { lazy, multiple, checkStrictly } = config.value;
  24261. const leafOnly = !checkStrictly;
  24262. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  24263. return;
  24264. if (lazy && !loaded) {
  24265. const values = unique(flattenDeep(castArray(modelValue)));
  24266. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  24267. if (nodes.length) {
  24268. nodes.forEach((node) => {
  24269. lazyLoad(node, () => syncCheckedValue(false, forced));
  24270. });
  24271. } else {
  24272. syncCheckedValue(true, forced);
  24273. }
  24274. } else {
  24275. const values = multiple ? castArray(modelValue) : [modelValue];
  24276. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  24277. syncMenuState(nodes, forced);
  24278. checkedValue.value = cloneDeep(modelValue != null ? modelValue : void 0);
  24279. }
  24280. };
  24281. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  24282. const { checkStrictly } = config.value;
  24283. const oldNodes = checkedNodes.value;
  24284. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  24285. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  24286. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  24287. if (newExpandingNode) {
  24288. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  24289. } else {
  24290. expandingNode.value = void 0;
  24291. }
  24292. oldNodes.forEach((node) => node.doCheck(false));
  24293. reactive(newNodes).forEach((node) => node.doCheck(true));
  24294. checkedNodes.value = newNodes;
  24295. nextTick(scrollToExpandingNode);
  24296. };
  24297. const scrollToExpandingNode = () => {
  24298. if (!isClient)
  24299. return;
  24300. menuList.value.forEach((menu) => {
  24301. const menuElement = menu == null ? void 0 : menu.$el;
  24302. if (menuElement) {
  24303. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  24304. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}:last-child`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  24305. scrollIntoView(container, activeNode);
  24306. }
  24307. });
  24308. };
  24309. const handleKeyDown = (e) => {
  24310. const target = e.target;
  24311. const code = getEventCode(e);
  24312. switch (code) {
  24313. case EVENT_CODE.up:
  24314. case EVENT_CODE.down: {
  24315. e.preventDefault();
  24316. const distance = code === EVENT_CODE.up ? -1 : 1;
  24317. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  24318. break;
  24319. }
  24320. case EVENT_CODE.left: {
  24321. e.preventDefault();
  24322. const preMenu = menuList.value[getMenuIndex(target) - 1];
  24323. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  24324. focusNode(expandedNode);
  24325. break;
  24326. }
  24327. case EVENT_CODE.right: {
  24328. e.preventDefault();
  24329. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  24330. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  24331. focusNode(firstNode);
  24332. break;
  24333. }
  24334. case EVENT_CODE.enter:
  24335. case EVENT_CODE.numpadEnter:
  24336. checkNode(target);
  24337. break;
  24338. }
  24339. };
  24340. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  24341. config,
  24342. expandingNode,
  24343. checkedNodes,
  24344. isHoverMenu,
  24345. initialLoaded,
  24346. renderLabelFn,
  24347. lazyLoad,
  24348. expandNode,
  24349. handleCheckChange
  24350. }));
  24351. watch(config, (newVal, oldVal) => {
  24352. if (isEqual$1(newVal, oldVal))
  24353. return;
  24354. initStore();
  24355. }, {
  24356. immediate: true
  24357. });
  24358. watch(() => props.options, initStore, {
  24359. deep: true
  24360. });
  24361. watch(() => props.modelValue, () => {
  24362. manualChecked = false;
  24363. syncCheckedValue();
  24364. }, {
  24365. deep: true
  24366. });
  24367. watch(() => checkedValue.value, (val) => {
  24368. if (!isEqual$1(val, props.modelValue)) {
  24369. emit(UPDATE_MODEL_EVENT, val);
  24370. emit(CHANGE_EVENT, val);
  24371. }
  24372. });
  24373. const loadLazyRootNodes = () => {
  24374. if (initialLoadedOnce.value)
  24375. return;
  24376. initStore();
  24377. };
  24378. onBeforeUpdate(() => menuList.value = []);
  24379. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  24380. expose({
  24381. menuList,
  24382. menus,
  24383. checkedNodes,
  24384. handleKeyDown,
  24385. handleCheckChange,
  24386. getFlattedNodes,
  24387. getCheckedNodes,
  24388. clearCheckedNodes,
  24389. calculateCheckedValue,
  24390. scrollToExpandingNode,
  24391. loadLazyRootNodes
  24392. });
  24393. return (_ctx, _cache) => {
  24394. return openBlock(), createElementBlock("div", {
  24395. class: normalizeClass([unref(ns).b("panel"), unref(ns).is("bordered", _ctx.border)]),
  24396. onKeydown: handleKeyDown
  24397. }, [
  24398. (openBlock(true), createElementBlock(Fragment, null, renderList(menus.value, (menu, index) => {
  24399. return openBlock(), createBlock(ElCascaderMenu, {
  24400. key: index,
  24401. ref_for: true,
  24402. ref: (item) => menuList.value[index] = item,
  24403. index,
  24404. nodes: [...menu]
  24405. }, {
  24406. empty: withCtx(() => [
  24407. renderSlot(_ctx.$slots, "empty")
  24408. ]),
  24409. _: 2
  24410. }, 1032, ["index", "nodes"]);
  24411. }), 128))
  24412. ], 34);
  24413. };
  24414. }
  24415. });
  24416. var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["__file", "index.vue"]]);
  24417. const ElCascaderPanel = withInstall(CascaderPanel);
  24418. const tagProps = buildProps({
  24419. type: {
  24420. type: String,
  24421. values: ["primary", "success", "info", "warning", "danger"],
  24422. default: "primary"
  24423. },
  24424. closable: Boolean,
  24425. disableTransitions: Boolean,
  24426. hit: Boolean,
  24427. color: String,
  24428. size: {
  24429. type: String,
  24430. values: componentSizes
  24431. },
  24432. effect: {
  24433. type: String,
  24434. values: ["dark", "light", "plain"],
  24435. default: "light"
  24436. },
  24437. round: Boolean
  24438. });
  24439. const tagEmits = {
  24440. close: (evt) => evt instanceof MouseEvent,
  24441. click: (evt) => evt instanceof MouseEvent
  24442. };
  24443. const __default__$1m = defineComponent({
  24444. name: "ElTag"
  24445. });
  24446. const _sfc_main$1O = /* @__PURE__ */ defineComponent({
  24447. ...__default__$1m,
  24448. props: tagProps,
  24449. emits: tagEmits,
  24450. setup(__props, { emit }) {
  24451. const props = __props;
  24452. const tagSize = useFormSize();
  24453. const ns = useNamespace("tag");
  24454. const containerKls = computed(() => {
  24455. const { type, hit, effect, closable, round } = props;
  24456. return [
  24457. ns.b(),
  24458. ns.is("closable", closable),
  24459. ns.m(type || "primary"),
  24460. ns.m(tagSize.value),
  24461. ns.m(effect),
  24462. ns.is("hit", hit),
  24463. ns.is("round", round)
  24464. ];
  24465. });
  24466. const handleClose = (event) => {
  24467. emit("close", event);
  24468. };
  24469. const handleClick = (event) => {
  24470. emit("click", event);
  24471. };
  24472. const handleVNodeMounted = (vnode) => {
  24473. var _a, _b, _c;
  24474. if ((_c = (_b = (_a = vnode == null ? void 0 : vnode.component) == null ? void 0 : _a.subTree) == null ? void 0 : _b.component) == null ? void 0 : _c.bum) {
  24475. vnode.component.subTree.component.bum = null;
  24476. }
  24477. };
  24478. return (_ctx, _cache) => {
  24479. return _ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  24480. key: 0,
  24481. class: normalizeClass(unref(containerKls)),
  24482. style: normalizeStyle({ backgroundColor: _ctx.color }),
  24483. onClick: handleClick
  24484. }, [
  24485. createElementVNode("span", {
  24486. class: normalizeClass(unref(ns).e("content"))
  24487. }, [
  24488. renderSlot(_ctx.$slots, "default")
  24489. ], 2),
  24490. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  24491. key: 0,
  24492. class: normalizeClass(unref(ns).e("close")),
  24493. onClick: withModifiers(handleClose, ["stop"])
  24494. }, {
  24495. default: withCtx(() => [
  24496. createVNode(unref(close_default))
  24497. ]),
  24498. _: 1
  24499. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  24500. ], 6)) : (openBlock(), createBlock(Transition, {
  24501. key: 1,
  24502. name: `${unref(ns).namespace.value}-zoom-in-center`,
  24503. appear: "",
  24504. onVnodeMounted: handleVNodeMounted
  24505. }, {
  24506. default: withCtx(() => [
  24507. createElementVNode("span", {
  24508. class: normalizeClass(unref(containerKls)),
  24509. style: normalizeStyle({ backgroundColor: _ctx.color }),
  24510. onClick: handleClick
  24511. }, [
  24512. createElementVNode("span", {
  24513. class: normalizeClass(unref(ns).e("content"))
  24514. }, [
  24515. renderSlot(_ctx.$slots, "default")
  24516. ], 2),
  24517. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  24518. key: 0,
  24519. class: normalizeClass(unref(ns).e("close")),
  24520. onClick: withModifiers(handleClose, ["stop"])
  24521. }, {
  24522. default: withCtx(() => [
  24523. createVNode(unref(close_default))
  24524. ]),
  24525. _: 1
  24526. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  24527. ], 6)
  24528. ]),
  24529. _: 3
  24530. }, 8, ["name"]));
  24531. };
  24532. }
  24533. });
  24534. var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["__file", "tag.vue"]]);
  24535. const ElTag = withInstall(Tag);
  24536. const cascaderProps = buildProps({
  24537. ...CommonProps,
  24538. size: useSizeProp,
  24539. placeholder: String,
  24540. disabled: Boolean,
  24541. clearable: Boolean,
  24542. clearIcon: {
  24543. type: iconPropType,
  24544. default: circle_close_default
  24545. },
  24546. filterable: Boolean,
  24547. filterMethod: {
  24548. type: definePropType(Function),
  24549. default: (node, keyword) => node.text.includes(keyword)
  24550. },
  24551. separator: {
  24552. type: String,
  24553. default: " / "
  24554. },
  24555. showAllLevels: {
  24556. type: Boolean,
  24557. default: true
  24558. },
  24559. collapseTags: Boolean,
  24560. maxCollapseTags: {
  24561. type: Number,
  24562. default: 1
  24563. },
  24564. collapseTagsTooltip: Boolean,
  24565. maxCollapseTagsTooltipHeight: {
  24566. type: [String, Number]
  24567. },
  24568. debounce: {
  24569. type: Number,
  24570. default: 300
  24571. },
  24572. beforeFilter: {
  24573. type: definePropType(Function),
  24574. default: () => true
  24575. },
  24576. placement: {
  24577. type: definePropType(String),
  24578. values: Ee,
  24579. default: "bottom-start"
  24580. },
  24581. fallbackPlacements: {
  24582. type: definePropType(Array),
  24583. default: ["bottom-start", "bottom", "top-start", "top", "right", "left"]
  24584. },
  24585. popperClass: useTooltipContentProps.popperClass,
  24586. popperStyle: useTooltipContentProps.popperStyle,
  24587. teleported: useTooltipContentProps.teleported,
  24588. effect: {
  24589. type: definePropType(String),
  24590. default: "light"
  24591. },
  24592. tagType: { ...tagProps.type, default: "info" },
  24593. tagEffect: { ...tagProps.effect, default: "light" },
  24594. validateEvent: {
  24595. type: Boolean,
  24596. default: true
  24597. },
  24598. persistent: {
  24599. type: Boolean,
  24600. default: true
  24601. },
  24602. showCheckedStrategy: {
  24603. type: String,
  24604. values: ["parent", "child"],
  24605. default: "child"
  24606. },
  24607. checkOnClickNode: Boolean,
  24608. showPrefix: {
  24609. type: Boolean,
  24610. default: true
  24611. },
  24612. ...useEmptyValuesProps
  24613. });
  24614. const emitChangeFn$1 = (value) => true;
  24615. const cascaderEmits = {
  24616. [UPDATE_MODEL_EVENT]: emitChangeFn$1,
  24617. [CHANGE_EVENT]: emitChangeFn$1,
  24618. focus: (evt) => evt instanceof FocusEvent,
  24619. blur: (evt) => evt instanceof FocusEvent,
  24620. clear: () => true,
  24621. visibleChange: (val) => isBoolean(val),
  24622. expandChange: (val) => !!val,
  24623. removeTag: (val) => !!val
  24624. };
  24625. const __default__$1l = defineComponent({
  24626. name: "ElCascader"
  24627. });
  24628. const _sfc_main$1N = /* @__PURE__ */ defineComponent({
  24629. ...__default__$1l,
  24630. props: cascaderProps,
  24631. emits: cascaderEmits,
  24632. setup(__props, { expose, emit }) {
  24633. const props = __props;
  24634. const popperOptions = {
  24635. modifiers: [
  24636. {
  24637. name: "arrowPosition",
  24638. enabled: true,
  24639. phase: "main",
  24640. fn: ({ state }) => {
  24641. const { modifiersData, placement } = state;
  24642. if (["right", "left", "bottom", "top"].includes(placement))
  24643. return;
  24644. if (modifiersData.arrow) {
  24645. modifiersData.arrow.x = 35;
  24646. }
  24647. },
  24648. requires: ["arrow"]
  24649. }
  24650. ]
  24651. };
  24652. const attrs = useAttrs$1();
  24653. let inputInitialHeight = 0;
  24654. let pressDeleteCount = 0;
  24655. const nsCascader = useNamespace("cascader");
  24656. const nsInput = useNamespace("input");
  24657. const { t } = useLocale();
  24658. const { formItem } = useFormItem();
  24659. const isDisabled = useFormDisabled();
  24660. const { valueOnClear } = useEmptyValues(props);
  24661. const { isComposing, handleComposition } = useComposition({
  24662. afterComposition(event) {
  24663. var _a;
  24664. const text = (_a = event.target) == null ? void 0 : _a.value;
  24665. handleInput(text);
  24666. }
  24667. });
  24668. const tooltipRef = ref();
  24669. const tagTooltipRef = ref();
  24670. const inputRef = ref();
  24671. const tagWrapper = ref();
  24672. const cascaderPanelRef = ref();
  24673. const suggestionPanel = ref();
  24674. const popperVisible = ref(false);
  24675. const inputHover = ref(false);
  24676. const filtering = ref(false);
  24677. const inputValue = ref("");
  24678. const searchInputValue = ref("");
  24679. const tags = ref([]);
  24680. const suggestions = ref([]);
  24681. const showTagList = computed(() => {
  24682. if (!props.props.multiple) {
  24683. return [];
  24684. }
  24685. return props.collapseTags ? tags.value.slice(0, props.maxCollapseTags) : tags.value;
  24686. });
  24687. const collapseTagList = computed(() => {
  24688. if (!props.props.multiple) {
  24689. return [];
  24690. }
  24691. return props.collapseTags ? tags.value.slice(props.maxCollapseTags) : [];
  24692. });
  24693. const cascaderStyle = computed(() => {
  24694. return attrs.style;
  24695. });
  24696. const inputPlaceholder = computed(() => {
  24697. var _a;
  24698. return (_a = props.placeholder) != null ? _a : t("el.cascader.placeholder");
  24699. });
  24700. const currentPlaceholder = computed(() => searchInputValue.value || tags.value.length > 0 || isComposing.value ? "" : inputPlaceholder.value);
  24701. const realSize = useFormSize();
  24702. const tagSize = computed(() => realSize.value === "small" ? "small" : "default");
  24703. const multiple = computed(() => !!props.props.multiple);
  24704. const readonly = computed(() => !props.filterable || multiple.value);
  24705. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  24706. const checkedNodes = computed(() => {
  24707. var _a;
  24708. return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || [];
  24709. });
  24710. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  24711. disabled: isDisabled,
  24712. beforeBlur(event) {
  24713. var _a, _b;
  24714. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  24715. },
  24716. afterBlur() {
  24717. var _a;
  24718. if (props.validateEvent) {
  24719. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
  24720. }
  24721. }
  24722. });
  24723. const clearBtnVisible = computed(() => {
  24724. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value && !isFocused.value)
  24725. return false;
  24726. return !!checkedNodes.value.length;
  24727. });
  24728. const presentText = computed(() => {
  24729. const { showAllLevels, separator } = props;
  24730. const nodes = checkedNodes.value;
  24731. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  24732. });
  24733. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  24734. const checkedValue = computed({
  24735. get() {
  24736. return cloneDeep(props.modelValue);
  24737. },
  24738. set(val) {
  24739. const value = val != null ? val : valueOnClear.value;
  24740. emit(UPDATE_MODEL_EVENT, value);
  24741. emit(CHANGE_EVENT, value);
  24742. if (props.validateEvent) {
  24743. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  24744. }
  24745. }
  24746. });
  24747. const cascaderKls = computed(() => {
  24748. return [
  24749. nsCascader.b(),
  24750. nsCascader.m(realSize.value),
  24751. nsCascader.is("disabled", isDisabled.value),
  24752. attrs.class
  24753. ];
  24754. });
  24755. const cascaderIconKls = computed(() => {
  24756. return [
  24757. nsInput.e("icon"),
  24758. "icon-arrow-down",
  24759. nsCascader.is("reverse", popperVisible.value)
  24760. ];
  24761. });
  24762. const inputClass = computed(() => nsCascader.is("focus", isFocused.value));
  24763. const contentRef = computed(() => {
  24764. var _a, _b;
  24765. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  24766. });
  24767. const handleClickOutside = (event) => {
  24768. if (isFocused.value) {
  24769. const _event = new FocusEvent("blur", event);
  24770. handleBlur(_event);
  24771. }
  24772. togglePopperVisible(false);
  24773. };
  24774. const togglePopperVisible = (visible) => {
  24775. var _a, _b, _c;
  24776. if (isDisabled.value)
  24777. return;
  24778. visible = visible != null ? visible : !popperVisible.value;
  24779. if (visible !== popperVisible.value) {
  24780. popperVisible.value = visible;
  24781. (_b = (_a = inputRef.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  24782. if (visible) {
  24783. updatePopperPosition();
  24784. nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode);
  24785. } else if (props.filterable) {
  24786. syncPresentTextValue();
  24787. }
  24788. emit("visibleChange", visible);
  24789. }
  24790. };
  24791. const updatePopperPosition = () => {
  24792. nextTick(() => {
  24793. var _a;
  24794. (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  24795. });
  24796. };
  24797. const hideSuggestionPanel = () => {
  24798. filtering.value = false;
  24799. };
  24800. const genTag = (node) => {
  24801. const { showAllLevels, separator } = props;
  24802. return {
  24803. node,
  24804. key: node.uid,
  24805. text: node.calcText(showAllLevels, separator),
  24806. hitState: false,
  24807. closable: !isDisabled.value && !node.isDisabled
  24808. };
  24809. };
  24810. const deleteTag = (tag) => {
  24811. var _a;
  24812. const node = tag.node;
  24813. node.doCheck(false);
  24814. (_a = cascaderPanelRef.value) == null ? void 0 : _a.calculateCheckedValue();
  24815. emit("removeTag", node.valueByOption);
  24816. };
  24817. const getStrategyCheckedNodes = () => {
  24818. switch (props.showCheckedStrategy) {
  24819. case "child":
  24820. return checkedNodes.value;
  24821. case "parent": {
  24822. const clickedNodes = getCheckedNodes(false);
  24823. const clickedNodesValue = clickedNodes.map((o) => o.value);
  24824. const parentNodes = clickedNodes.filter((o) => !o.parent || !clickedNodesValue.includes(o.parent.value));
  24825. return parentNodes;
  24826. }
  24827. default:
  24828. return [];
  24829. }
  24830. };
  24831. const calculatePresentTags = () => {
  24832. if (!multiple.value)
  24833. return;
  24834. const nodes = getStrategyCheckedNodes();
  24835. const allTags = [];
  24836. nodes.forEach((node) => allTags.push(genTag(node)));
  24837. tags.value = allTags;
  24838. };
  24839. const calculateSuggestions = () => {
  24840. var _a, _b;
  24841. const { filterMethod, showAllLevels, separator } = props;
  24842. const res = (_b = (_a = cascaderPanelRef.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  24843. if (node.isDisabled)
  24844. return false;
  24845. node.calcText(showAllLevels, separator);
  24846. return filterMethod(node, searchKeyword.value);
  24847. });
  24848. if (multiple.value) {
  24849. tags.value.forEach((tag) => {
  24850. tag.hitState = false;
  24851. });
  24852. }
  24853. filtering.value = true;
  24854. suggestions.value = res;
  24855. updatePopperPosition();
  24856. };
  24857. const focusFirstNode = () => {
  24858. var _a;
  24859. let firstNode;
  24860. if (filtering.value && suggestionPanel.value) {
  24861. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  24862. } else {
  24863. firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  24864. }
  24865. if (firstNode) {
  24866. firstNode.focus();
  24867. !filtering.value && firstNode.click();
  24868. }
  24869. };
  24870. const updateStyle = () => {
  24871. var _a, _b;
  24872. const inputInner = (_a = inputRef.value) == null ? void 0 : _a.input;
  24873. const tagWrapperEl = tagWrapper.value;
  24874. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  24875. if (!isClient || !inputInner)
  24876. return;
  24877. if (suggestionPanelEl) {
  24878. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  24879. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  24880. }
  24881. if (tagWrapperEl) {
  24882. const { offsetHeight } = tagWrapperEl;
  24883. const height = tags.value.length > 0 ? `${Math.max(offsetHeight, inputInitialHeight) - 2}px` : `${inputInitialHeight}px`;
  24884. inputInner.style.height = height;
  24885. updatePopperPosition();
  24886. }
  24887. };
  24888. const getCheckedNodes = (leafOnly) => {
  24889. var _a;
  24890. return (_a = cascaderPanelRef.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
  24891. };
  24892. const handleExpandChange = (value) => {
  24893. updatePopperPosition();
  24894. emit("expandChange", value);
  24895. };
  24896. const handleKeyDown = (e) => {
  24897. if (isComposing.value)
  24898. return;
  24899. const code = getEventCode(e);
  24900. switch (code) {
  24901. case EVENT_CODE.enter:
  24902. case EVENT_CODE.numpadEnter:
  24903. togglePopperVisible();
  24904. break;
  24905. case EVENT_CODE.down:
  24906. togglePopperVisible(true);
  24907. nextTick(focusFirstNode);
  24908. e.preventDefault();
  24909. break;
  24910. case EVENT_CODE.esc:
  24911. if (popperVisible.value === true) {
  24912. e.preventDefault();
  24913. e.stopPropagation();
  24914. togglePopperVisible(false);
  24915. }
  24916. break;
  24917. case EVENT_CODE.tab:
  24918. togglePopperVisible(false);
  24919. break;
  24920. }
  24921. };
  24922. const handleClear = () => {
  24923. var _a;
  24924. (_a = cascaderPanelRef.value) == null ? void 0 : _a.clearCheckedNodes();
  24925. if (!popperVisible.value && props.filterable) {
  24926. syncPresentTextValue();
  24927. }
  24928. togglePopperVisible(false);
  24929. emit("clear");
  24930. };
  24931. const syncPresentTextValue = () => {
  24932. const { value } = presentText;
  24933. inputValue.value = value;
  24934. searchInputValue.value = value;
  24935. };
  24936. const handleSuggestionClick = (node) => {
  24937. var _a, _b;
  24938. const { checked } = node;
  24939. if (multiple.value) {
  24940. (_a = cascaderPanelRef.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
  24941. } else {
  24942. !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  24943. togglePopperVisible(false);
  24944. }
  24945. };
  24946. const handleSuggestionKeyDown = (e) => {
  24947. const target = e.target;
  24948. const code = getEventCode(e);
  24949. switch (code) {
  24950. case EVENT_CODE.up:
  24951. case EVENT_CODE.down: {
  24952. e.preventDefault();
  24953. const distance = code === EVENT_CODE.up ? -1 : 1;
  24954. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  24955. break;
  24956. }
  24957. case EVENT_CODE.enter:
  24958. case EVENT_CODE.numpadEnter:
  24959. target.click();
  24960. break;
  24961. }
  24962. };
  24963. const handleDelete = () => {
  24964. const lastTag = tags.value[tags.value.length - 1];
  24965. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  24966. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.value.length > 1)
  24967. return;
  24968. if (lastTag.hitState) {
  24969. deleteTag(lastTag);
  24970. } else {
  24971. lastTag.hitState = true;
  24972. }
  24973. };
  24974. const debounce = computed(() => props.debounce);
  24975. const handleFilter = useDebounceFn(() => {
  24976. const { value } = searchKeyword;
  24977. if (!value)
  24978. return;
  24979. const passed = props.beforeFilter(value);
  24980. if (isPromise(passed)) {
  24981. passed.then(calculateSuggestions).catch(() => {
  24982. });
  24983. } else if (passed !== false) {
  24984. calculateSuggestions();
  24985. } else {
  24986. hideSuggestionPanel();
  24987. }
  24988. }, debounce);
  24989. const handleInput = (val, e) => {
  24990. !popperVisible.value && togglePopperVisible(true);
  24991. if (e == null ? void 0 : e.isComposing)
  24992. return;
  24993. val ? handleFilter() : hideSuggestionPanel();
  24994. };
  24995. const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  24996. watch(filtering, updatePopperPosition);
  24997. watch([
  24998. checkedNodes,
  24999. isDisabled,
  25000. () => props.collapseTags,
  25001. () => props.maxCollapseTags
  25002. ], calculatePresentTags);
  25003. watch(tags, () => {
  25004. nextTick(() => updateStyle());
  25005. });
  25006. watch(realSize, async () => {
  25007. await nextTick();
  25008. const inputInner = inputRef.value.input;
  25009. inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
  25010. updateStyle();
  25011. });
  25012. watch(presentText, syncPresentTextValue, { immediate: true });
  25013. watch(() => popperVisible.value, (val) => {
  25014. var _a;
  25015. if (val && props.props.lazy && props.props.lazyLoad) {
  25016. (_a = cascaderPanelRef.value) == null ? void 0 : _a.loadLazyRootNodes();
  25017. }
  25018. });
  25019. onMounted(() => {
  25020. const inputInner = inputRef.value.input;
  25021. const inputInnerHeight = getInputInnerHeight(inputInner);
  25022. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  25023. useResizeObserver(inputInner, updateStyle);
  25024. });
  25025. expose({
  25026. getCheckedNodes,
  25027. cascaderPanelRef,
  25028. togglePopperVisible,
  25029. contentRef,
  25030. presentText
  25031. });
  25032. return (_ctx, _cache) => {
  25033. return openBlock(), createBlock(unref(ElTooltip), {
  25034. ref_key: "tooltipRef",
  25035. ref: tooltipRef,
  25036. visible: popperVisible.value,
  25037. teleported: _ctx.teleported,
  25038. "popper-class": [unref(nsCascader).e("dropdown"), _ctx.popperClass],
  25039. "popper-style": _ctx.popperStyle,
  25040. "popper-options": popperOptions,
  25041. "fallback-placements": _ctx.fallbackPlacements,
  25042. "stop-popper-mouse-event": false,
  25043. "gpu-acceleration": false,
  25044. placement: _ctx.placement,
  25045. transition: `${unref(nsCascader).namespace.value}-zoom-in-top`,
  25046. effect: _ctx.effect,
  25047. pure: "",
  25048. persistent: _ctx.persistent,
  25049. onHide: hideSuggestionPanel
  25050. }, {
  25051. default: withCtx(() => [
  25052. withDirectives((openBlock(), createElementBlock("div", {
  25053. ref_key: "wrapperRef",
  25054. ref: wrapperRef,
  25055. class: normalizeClass(unref(cascaderKls)),
  25056. style: normalizeStyle(unref(cascaderStyle)),
  25057. onClick: () => togglePopperVisible(unref(readonly) ? void 0 : true),
  25058. onKeydown: handleKeyDown,
  25059. onMouseenter: ($event) => inputHover.value = true,
  25060. onMouseleave: ($event) => inputHover.value = false
  25061. }, [
  25062. createVNode(unref(ElInput), {
  25063. ref_key: "inputRef",
  25064. ref: inputRef,
  25065. modelValue: inputValue.value,
  25066. "onUpdate:modelValue": ($event) => inputValue.value = $event,
  25067. placeholder: unref(currentPlaceholder),
  25068. readonly: unref(readonly),
  25069. disabled: unref(isDisabled),
  25070. "validate-event": false,
  25071. size: unref(realSize),
  25072. class: normalizeClass(unref(inputClass)),
  25073. tabindex: unref(multiple) && _ctx.filterable && !unref(isDisabled) ? -1 : void 0,
  25074. onCompositionstart: unref(handleComposition),
  25075. onCompositionupdate: unref(handleComposition),
  25076. onCompositionend: unref(handleComposition),
  25077. onInput: handleInput
  25078. }, createSlots({
  25079. suffix: withCtx(() => [
  25080. unref(clearBtnVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  25081. key: "clear",
  25082. class: normalizeClass([unref(nsInput).e("icon"), "icon-circle-close"]),
  25083. onClick: withModifiers(handleClear, ["stop"])
  25084. }, {
  25085. default: withCtx(() => [
  25086. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  25087. ]),
  25088. _: 1
  25089. }, 8, ["class", "onClick"])) : (openBlock(), createBlock(unref(ElIcon), {
  25090. key: "arrow-down",
  25091. class: normalizeClass(unref(cascaderIconKls)),
  25092. onClick: withModifiers(($event) => togglePopperVisible(), ["stop"])
  25093. }, {
  25094. default: withCtx(() => [
  25095. createVNode(unref(arrow_down_default))
  25096. ]),
  25097. _: 1
  25098. }, 8, ["class", "onClick"]))
  25099. ]),
  25100. _: 2
  25101. }, [
  25102. _ctx.$slots.prefix ? {
  25103. name: "prefix",
  25104. fn: withCtx(() => [
  25105. renderSlot(_ctx.$slots, "prefix")
  25106. ])
  25107. } : void 0
  25108. ]), 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  25109. unref(multiple) ? (openBlock(), createElementBlock("div", {
  25110. key: 0,
  25111. ref_key: "tagWrapper",
  25112. ref: tagWrapper,
  25113. class: normalizeClass([
  25114. unref(nsCascader).e("tags"),
  25115. unref(nsCascader).is("validate", Boolean(unref(validateState)))
  25116. ])
  25117. }, [
  25118. renderSlot(_ctx.$slots, "tag", {
  25119. data: tags.value,
  25120. deleteTag
  25121. }, () => [
  25122. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(showTagList), (tag) => {
  25123. return openBlock(), createBlock(unref(ElTag), {
  25124. key: tag.key,
  25125. type: _ctx.tagType,
  25126. size: unref(tagSize),
  25127. effect: _ctx.tagEffect,
  25128. hit: tag.hitState,
  25129. closable: tag.closable,
  25130. "disable-transitions": "",
  25131. onClose: ($event) => deleteTag(tag)
  25132. }, {
  25133. default: withCtx(() => [
  25134. createElementVNode("span", null, toDisplayString(tag.text), 1)
  25135. ]),
  25136. _: 2
  25137. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]);
  25138. }), 128))
  25139. ]),
  25140. _ctx.collapseTags && tags.value.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(unref(ElTooltip), {
  25141. key: 0,
  25142. ref_key: "tagTooltipRef",
  25143. ref: tagTooltipRef,
  25144. disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
  25145. "fallback-placements": ["bottom", "top", "right", "left"],
  25146. placement: "bottom",
  25147. "popper-class": _ctx.popperClass,
  25148. "popper-style": _ctx.popperStyle,
  25149. effect: _ctx.effect,
  25150. persistent: _ctx.persistent
  25151. }, {
  25152. default: withCtx(() => [
  25153. createVNode(unref(ElTag), {
  25154. closable: false,
  25155. size: unref(tagSize),
  25156. type: _ctx.tagType,
  25157. effect: _ctx.tagEffect,
  25158. "disable-transitions": ""
  25159. }, {
  25160. default: withCtx(() => [
  25161. createElementVNode("span", {
  25162. class: normalizeClass(unref(nsCascader).e("tags-text"))
  25163. }, " + " + toDisplayString(tags.value.length - _ctx.maxCollapseTags), 3)
  25164. ]),
  25165. _: 1
  25166. }, 8, ["size", "type", "effect"])
  25167. ]),
  25168. content: withCtx(() => [
  25169. createVNode(unref(ElScrollbar), { "max-height": _ctx.maxCollapseTagsTooltipHeight }, {
  25170. default: withCtx(() => [
  25171. createElementVNode("div", {
  25172. class: normalizeClass(unref(nsCascader).e("collapse-tags"))
  25173. }, [
  25174. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(collapseTagList), (tag, idx) => {
  25175. return openBlock(), createElementBlock("div", {
  25176. key: idx,
  25177. class: normalizeClass(unref(nsCascader).e("collapse-tag"))
  25178. }, [
  25179. (openBlock(), createBlock(unref(ElTag), {
  25180. key: tag.key,
  25181. class: "in-tooltip",
  25182. type: _ctx.tagType,
  25183. size: unref(tagSize),
  25184. effect: _ctx.tagEffect,
  25185. hit: tag.hitState,
  25186. closable: tag.closable,
  25187. "disable-transitions": "",
  25188. onClose: ($event) => deleteTag(tag)
  25189. }, {
  25190. default: withCtx(() => [
  25191. createElementVNode("span", null, toDisplayString(tag.text), 1)
  25192. ]),
  25193. _: 2
  25194. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]))
  25195. ], 2);
  25196. }), 128))
  25197. ], 2)
  25198. ]),
  25199. _: 1
  25200. }, 8, ["max-height"])
  25201. ]),
  25202. _: 1
  25203. }, 8, ["disabled", "popper-class", "popper-style", "effect", "persistent"])) : createCommentVNode("v-if", true),
  25204. _ctx.filterable && !unref(isDisabled) ? withDirectives((openBlock(), createElementBlock("input", {
  25205. key: 1,
  25206. "onUpdate:modelValue": ($event) => searchInputValue.value = $event,
  25207. type: "text",
  25208. class: normalizeClass(unref(nsCascader).e("search-input")),
  25209. placeholder: unref(presentText) ? "" : unref(inputPlaceholder),
  25210. onInput: (e) => handleInput(searchInputValue.value, e),
  25211. onClick: withModifiers(($event) => togglePopperVisible(true), ["stop"]),
  25212. onKeydown: withKeys(handleDelete, ["delete"]),
  25213. onCompositionstart: unref(handleComposition),
  25214. onCompositionupdate: unref(handleComposition),
  25215. onCompositionend: unref(handleComposition)
  25216. }, null, 42, ["onUpdate:modelValue", "placeholder", "onInput", "onClick", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend"])), [
  25217. [vModelText, searchInputValue.value]
  25218. ]) : createCommentVNode("v-if", true)
  25219. ], 2)) : createCommentVNode("v-if", true)
  25220. ], 46, ["onClick", "onMouseenter", "onMouseleave"])), [
  25221. [unref(ClickOutside), handleClickOutside, unref(contentRef)]
  25222. ])
  25223. ]),
  25224. content: withCtx(() => [
  25225. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  25226. key: 0,
  25227. class: normalizeClass(unref(nsCascader).e("header")),
  25228. onClick: withModifiers(() => {
  25229. }, ["stop"])
  25230. }, [
  25231. renderSlot(_ctx.$slots, "header")
  25232. ], 10, ["onClick"])) : createCommentVNode("v-if", true),
  25233. withDirectives(createVNode(unref(ElCascaderPanel), {
  25234. ref_key: "cascaderPanelRef",
  25235. ref: cascaderPanelRef,
  25236. modelValue: unref(checkedValue),
  25237. "onUpdate:modelValue": ($event) => isRef(checkedValue) ? checkedValue.value = $event : null,
  25238. options: _ctx.options,
  25239. props: props.props,
  25240. border: false,
  25241. "render-label": _ctx.$slots.default,
  25242. onExpandChange: handleExpandChange,
  25243. onClose: ($event) => _ctx.$nextTick(() => togglePopperVisible(false))
  25244. }, {
  25245. empty: withCtx(() => [
  25246. renderSlot(_ctx.$slots, "empty")
  25247. ]),
  25248. _: 3
  25249. }, 8, ["modelValue", "onUpdate:modelValue", "options", "props", "render-label", "onClose"]), [
  25250. [vShow, !filtering.value]
  25251. ]),
  25252. _ctx.filterable ? withDirectives((openBlock(), createBlock(unref(ElScrollbar), {
  25253. key: 1,
  25254. ref_key: "suggestionPanel",
  25255. ref: suggestionPanel,
  25256. tag: "ul",
  25257. class: normalizeClass(unref(nsCascader).e("suggestion-panel")),
  25258. "view-class": unref(nsCascader).e("suggestion-list"),
  25259. onKeydown: handleSuggestionKeyDown
  25260. }, {
  25261. default: withCtx(() => [
  25262. suggestions.value.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(suggestions.value, (item) => {
  25263. return openBlock(), createElementBlock("li", {
  25264. key: item.uid,
  25265. class: normalizeClass([
  25266. unref(nsCascader).e("suggestion-item"),
  25267. unref(nsCascader).is("checked", item.checked)
  25268. ]),
  25269. tabindex: -1,
  25270. onClick: ($event) => handleSuggestionClick(item)
  25271. }, [
  25272. renderSlot(_ctx.$slots, "suggestion-item", { item }, () => [
  25273. createElementVNode("span", null, toDisplayString(item.text), 1),
  25274. item.checked ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  25275. default: withCtx(() => [
  25276. createVNode(unref(check_default))
  25277. ]),
  25278. _: 1
  25279. })) : createCommentVNode("v-if", true)
  25280. ])
  25281. ], 10, ["onClick"]);
  25282. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  25283. createElementVNode("li", {
  25284. class: normalizeClass(unref(nsCascader).e("empty-text"))
  25285. }, toDisplayString(unref(t)("el.cascader.noMatch")), 3)
  25286. ])
  25287. ]),
  25288. _: 3
  25289. }, 8, ["class", "view-class"])), [
  25290. [vShow, filtering.value]
  25291. ]) : createCommentVNode("v-if", true),
  25292. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  25293. key: 2,
  25294. class: normalizeClass(unref(nsCascader).e("footer")),
  25295. onClick: withModifiers(() => {
  25296. }, ["stop"])
  25297. }, [
  25298. renderSlot(_ctx.$slots, "footer")
  25299. ], 10, ["onClick"])) : createCommentVNode("v-if", true)
  25300. ]),
  25301. _: 3
  25302. }, 8, ["visible", "teleported", "popper-class", "popper-style", "fallback-placements", "placement", "transition", "effect", "persistent"]);
  25303. };
  25304. }
  25305. });
  25306. var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["__file", "cascader.vue"]]);
  25307. const ElCascader = withInstall(Cascader);
  25308. const checkTagProps = buildProps({
  25309. checked: Boolean,
  25310. disabled: Boolean,
  25311. type: {
  25312. type: String,
  25313. values: ["primary", "success", "info", "warning", "danger"],
  25314. default: "primary"
  25315. }
  25316. });
  25317. const checkTagEmits = {
  25318. "update:checked": (value) => isBoolean(value),
  25319. [CHANGE_EVENT]: (value) => isBoolean(value)
  25320. };
  25321. const __default__$1k = defineComponent({
  25322. name: "ElCheckTag"
  25323. });
  25324. const _sfc_main$1M = /* @__PURE__ */ defineComponent({
  25325. ...__default__$1k,
  25326. props: checkTagProps,
  25327. emits: checkTagEmits,
  25328. setup(__props, { emit }) {
  25329. const props = __props;
  25330. const ns = useNamespace("check-tag");
  25331. const containerKls = computed(() => [
  25332. ns.b(),
  25333. ns.is("checked", props.checked),
  25334. ns.is("disabled", props.disabled),
  25335. ns.m(props.type || "primary")
  25336. ]);
  25337. const handleChange = () => {
  25338. if (props.disabled)
  25339. return;
  25340. const checked = !props.checked;
  25341. emit(CHANGE_EVENT, checked);
  25342. emit("update:checked", checked);
  25343. };
  25344. return (_ctx, _cache) => {
  25345. return openBlock(), createElementBlock("span", {
  25346. class: normalizeClass(unref(containerKls)),
  25347. onClick: handleChange
  25348. }, [
  25349. renderSlot(_ctx.$slots, "default")
  25350. ], 2);
  25351. };
  25352. }
  25353. });
  25354. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["__file", "check-tag.vue"]]);
  25355. const ElCheckTag = withInstall(CheckTag);
  25356. const rowContextKey = Symbol("rowContextKey");
  25357. const RowJustify = [
  25358. "start",
  25359. "center",
  25360. "end",
  25361. "space-around",
  25362. "space-between",
  25363. "space-evenly"
  25364. ];
  25365. const RowAlign = ["top", "middle", "bottom"];
  25366. const rowProps = buildProps({
  25367. tag: {
  25368. type: String,
  25369. default: "div"
  25370. },
  25371. gutter: {
  25372. type: Number,
  25373. default: 0
  25374. },
  25375. justify: {
  25376. type: String,
  25377. values: RowJustify,
  25378. default: "start"
  25379. },
  25380. align: {
  25381. type: String,
  25382. values: RowAlign
  25383. }
  25384. });
  25385. const __default__$1j = defineComponent({
  25386. name: "ElRow"
  25387. });
  25388. const _sfc_main$1L = /* @__PURE__ */ defineComponent({
  25389. ...__default__$1j,
  25390. props: rowProps,
  25391. setup(__props) {
  25392. const props = __props;
  25393. const ns = useNamespace("row");
  25394. const gutter = computed(() => props.gutter);
  25395. provide(rowContextKey, {
  25396. gutter
  25397. });
  25398. const style = computed(() => {
  25399. const styles = {};
  25400. if (!props.gutter) {
  25401. return styles;
  25402. }
  25403. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  25404. return styles;
  25405. });
  25406. const rowKls = computed(() => [
  25407. ns.b(),
  25408. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  25409. ns.is(`align-${props.align}`, !!props.align)
  25410. ]);
  25411. return (_ctx, _cache) => {
  25412. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  25413. class: normalizeClass(unref(rowKls)),
  25414. style: normalizeStyle(unref(style))
  25415. }, {
  25416. default: withCtx(() => [
  25417. renderSlot(_ctx.$slots, "default")
  25418. ]),
  25419. _: 3
  25420. }, 8, ["class", "style"]);
  25421. };
  25422. }
  25423. });
  25424. var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "row.vue"]]);
  25425. const ElRow = withInstall(Row$1);
  25426. const colProps = buildProps({
  25427. tag: {
  25428. type: String,
  25429. default: "div"
  25430. },
  25431. span: {
  25432. type: Number,
  25433. default: 24
  25434. },
  25435. offset: {
  25436. type: Number,
  25437. default: 0
  25438. },
  25439. pull: {
  25440. type: Number,
  25441. default: 0
  25442. },
  25443. push: {
  25444. type: Number,
  25445. default: 0
  25446. },
  25447. xs: {
  25448. type: definePropType([Number, Object]),
  25449. default: () => mutable({})
  25450. },
  25451. sm: {
  25452. type: definePropType([Number, Object]),
  25453. default: () => mutable({})
  25454. },
  25455. md: {
  25456. type: definePropType([Number, Object]),
  25457. default: () => mutable({})
  25458. },
  25459. lg: {
  25460. type: definePropType([Number, Object]),
  25461. default: () => mutable({})
  25462. },
  25463. xl: {
  25464. type: definePropType([Number, Object]),
  25465. default: () => mutable({})
  25466. }
  25467. });
  25468. const __default__$1i = defineComponent({
  25469. name: "ElCol"
  25470. });
  25471. const _sfc_main$1K = /* @__PURE__ */ defineComponent({
  25472. ...__default__$1i,
  25473. props: colProps,
  25474. setup(__props) {
  25475. const props = __props;
  25476. const { gutter } = inject(rowContextKey, { gutter: computed(() => 0) });
  25477. const ns = useNamespace("col");
  25478. const style = computed(() => {
  25479. const styles = {};
  25480. if (gutter.value) {
  25481. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  25482. }
  25483. return styles;
  25484. });
  25485. const colKls = computed(() => {
  25486. const classes = [];
  25487. const pos = ["span", "offset", "pull", "push"];
  25488. pos.forEach((prop) => {
  25489. const size = props[prop];
  25490. if (isNumber(size)) {
  25491. if (prop === "span")
  25492. classes.push(ns.b(`${props[prop]}`));
  25493. else if (size > 0)
  25494. classes.push(ns.b(`${prop}-${props[prop]}`));
  25495. }
  25496. });
  25497. const sizes = ["xs", "sm", "md", "lg", "xl"];
  25498. sizes.forEach((size) => {
  25499. if (isNumber(props[size])) {
  25500. classes.push(ns.b(`${size}-${props[size]}`));
  25501. } else if (isObject$1(props[size])) {
  25502. Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  25503. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  25504. });
  25505. }
  25506. });
  25507. if (gutter.value) {
  25508. classes.push(ns.is("guttered"));
  25509. }
  25510. return [ns.b(), classes];
  25511. });
  25512. return (_ctx, _cache) => {
  25513. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  25514. class: normalizeClass(unref(colKls)),
  25515. style: normalizeStyle(unref(style))
  25516. }, {
  25517. default: withCtx(() => [
  25518. renderSlot(_ctx.$slots, "default")
  25519. ]),
  25520. _: 3
  25521. }, 8, ["class", "style"]);
  25522. };
  25523. }
  25524. });
  25525. var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "col.vue"]]);
  25526. const ElCol = withInstall(Col);
  25527. const emitChangeFn = (value) => isNumber(value) || isString$1(value) || isArray$1(value);
  25528. const collapseProps = buildProps({
  25529. accordion: Boolean,
  25530. modelValue: {
  25531. type: definePropType([Array, String, Number]),
  25532. default: () => mutable([])
  25533. },
  25534. expandIconPosition: {
  25535. type: definePropType([String]),
  25536. default: "right"
  25537. },
  25538. beforeCollapse: {
  25539. type: definePropType(Function)
  25540. }
  25541. });
  25542. const collapseEmits = {
  25543. [UPDATE_MODEL_EVENT]: emitChangeFn,
  25544. [CHANGE_EVENT]: emitChangeFn
  25545. };
  25546. const collapseContextKey = Symbol("collapseContextKey");
  25547. const SCOPE$3 = "ElCollapse";
  25548. const useCollapse = (props, emit) => {
  25549. const activeNames = ref(castArray$1(props.modelValue));
  25550. const setActiveNames = (_activeNames) => {
  25551. activeNames.value = _activeNames;
  25552. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  25553. emit(UPDATE_MODEL_EVENT, value);
  25554. emit(CHANGE_EVENT, value);
  25555. };
  25556. const handleChange = (name) => {
  25557. if (props.accordion) {
  25558. setActiveNames([activeNames.value[0] === name ? "" : name]);
  25559. } else {
  25560. const _activeNames = [...activeNames.value];
  25561. const index = _activeNames.indexOf(name);
  25562. if (index > -1) {
  25563. _activeNames.splice(index, 1);
  25564. } else {
  25565. _activeNames.push(name);
  25566. }
  25567. setActiveNames(_activeNames);
  25568. }
  25569. };
  25570. const handleItemClick = async (name) => {
  25571. const { beforeCollapse } = props;
  25572. if (!beforeCollapse) {
  25573. handleChange(name);
  25574. return;
  25575. }
  25576. const shouldChange = beforeCollapse(name);
  25577. const isPromiseOrBool = [
  25578. isPromise(shouldChange),
  25579. isBoolean(shouldChange)
  25580. ].includes(true);
  25581. if (!isPromiseOrBool) {
  25582. throwError(SCOPE$3, "beforeCollapse must return type `Promise<boolean>` or `boolean`");
  25583. }
  25584. if (isPromise(shouldChange)) {
  25585. shouldChange.then((result) => {
  25586. if (result !== false) {
  25587. handleChange(name);
  25588. }
  25589. }).catch((e) => {
  25590. debugWarn(SCOPE$3, `some error occurred: ${e}`);
  25591. });
  25592. } else if (shouldChange) {
  25593. handleChange(name);
  25594. }
  25595. };
  25596. watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  25597. provide(collapseContextKey, {
  25598. activeNames,
  25599. handleItemClick
  25600. });
  25601. return {
  25602. activeNames,
  25603. setActiveNames
  25604. };
  25605. };
  25606. const useCollapseDOM = (props) => {
  25607. const ns = useNamespace("collapse");
  25608. const rootKls = computed(() => [
  25609. ns.b(),
  25610. ns.b(`icon-position-${props.expandIconPosition}`)
  25611. ]);
  25612. return {
  25613. rootKls
  25614. };
  25615. };
  25616. const __default__$1h = defineComponent({
  25617. name: "ElCollapse"
  25618. });
  25619. const _sfc_main$1J = /* @__PURE__ */ defineComponent({
  25620. ...__default__$1h,
  25621. props: collapseProps,
  25622. emits: collapseEmits,
  25623. setup(__props, { expose, emit }) {
  25624. const props = __props;
  25625. const { activeNames, setActiveNames } = useCollapse(props, emit);
  25626. const { rootKls } = useCollapseDOM(props);
  25627. expose({
  25628. activeNames,
  25629. setActiveNames
  25630. });
  25631. return (_ctx, _cache) => {
  25632. return openBlock(), createElementBlock("div", {
  25633. class: normalizeClass(unref(rootKls))
  25634. }, [
  25635. renderSlot(_ctx.$slots, "default")
  25636. ], 2);
  25637. };
  25638. }
  25639. });
  25640. var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "collapse.vue"]]);
  25641. const __default__$1g = defineComponent({
  25642. name: "ElCollapseTransition"
  25643. });
  25644. const _sfc_main$1I = /* @__PURE__ */ defineComponent({
  25645. ...__default__$1g,
  25646. setup(__props) {
  25647. const ns = useNamespace("collapse-transition");
  25648. const reset = (el) => {
  25649. el.style.maxHeight = "";
  25650. el.style.overflow = el.dataset.oldOverflow;
  25651. el.style.paddingTop = el.dataset.oldPaddingTop;
  25652. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  25653. };
  25654. const on = {
  25655. beforeEnter(el) {
  25656. if (!el.dataset)
  25657. el.dataset = {};
  25658. el.dataset.oldPaddingTop = el.style.paddingTop;
  25659. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  25660. if (el.style.height)
  25661. el.dataset.elExistsHeight = el.style.height;
  25662. el.style.maxHeight = 0;
  25663. el.style.paddingTop = 0;
  25664. el.style.paddingBottom = 0;
  25665. },
  25666. enter(el) {
  25667. requestAnimationFrame(() => {
  25668. el.dataset.oldOverflow = el.style.overflow;
  25669. if (el.dataset.elExistsHeight) {
  25670. el.style.maxHeight = el.dataset.elExistsHeight;
  25671. } else if (el.scrollHeight !== 0) {
  25672. el.style.maxHeight = `${el.scrollHeight}px`;
  25673. } else {
  25674. el.style.maxHeight = 0;
  25675. }
  25676. el.style.paddingTop = el.dataset.oldPaddingTop;
  25677. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  25678. el.style.overflow = "hidden";
  25679. });
  25680. },
  25681. afterEnter(el) {
  25682. el.style.maxHeight = "";
  25683. el.style.overflow = el.dataset.oldOverflow;
  25684. },
  25685. enterCancelled(el) {
  25686. reset(el);
  25687. },
  25688. beforeLeave(el) {
  25689. if (!el.dataset)
  25690. el.dataset = {};
  25691. el.dataset.oldPaddingTop = el.style.paddingTop;
  25692. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  25693. el.dataset.oldOverflow = el.style.overflow;
  25694. el.style.maxHeight = `${el.scrollHeight}px`;
  25695. el.style.overflow = "hidden";
  25696. },
  25697. leave(el) {
  25698. if (el.scrollHeight !== 0) {
  25699. el.style.maxHeight = 0;
  25700. el.style.paddingTop = 0;
  25701. el.style.paddingBottom = 0;
  25702. }
  25703. },
  25704. afterLeave(el) {
  25705. reset(el);
  25706. },
  25707. leaveCancelled(el) {
  25708. reset(el);
  25709. }
  25710. };
  25711. return (_ctx, _cache) => {
  25712. return openBlock(), createBlock(Transition, mergeProps({
  25713. name: unref(ns).b()
  25714. }, toHandlers(on)), {
  25715. default: withCtx(() => [
  25716. renderSlot(_ctx.$slots, "default")
  25717. ]),
  25718. _: 3
  25719. }, 16, ["name"]);
  25720. };
  25721. }
  25722. });
  25723. var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "collapse-transition.vue"]]);
  25724. const ElCollapseTransition = withInstall(CollapseTransition);
  25725. const collapseItemProps = buildProps({
  25726. title: {
  25727. type: String,
  25728. default: ""
  25729. },
  25730. name: {
  25731. type: definePropType([String, Number]),
  25732. default: void 0
  25733. },
  25734. icon: {
  25735. type: iconPropType,
  25736. default: arrow_right_default
  25737. },
  25738. disabled: Boolean
  25739. });
  25740. const useCollapseItem = (props) => {
  25741. const collapse = inject(collapseContextKey);
  25742. const { namespace } = useNamespace("collapse");
  25743. const focusing = ref(false);
  25744. const isClick = ref(false);
  25745. const idInjection = useIdInjection();
  25746. const id = computed(() => idInjection.current++);
  25747. const name = computed(() => {
  25748. var _a;
  25749. return (_a = props.name) != null ? _a : `${namespace.value}-id-${idInjection.prefix}-${unref(id)}`;
  25750. });
  25751. const isActive = computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(unref(name)));
  25752. const handleFocus = () => {
  25753. setTimeout(() => {
  25754. if (!isClick.value) {
  25755. focusing.value = true;
  25756. } else {
  25757. isClick.value = false;
  25758. }
  25759. }, 50);
  25760. };
  25761. const handleHeaderClick = (e) => {
  25762. if (props.disabled)
  25763. return;
  25764. const target = e.target;
  25765. if (target == null ? void 0 : target.closest("input, textarea, select"))
  25766. return;
  25767. collapse == null ? void 0 : collapse.handleItemClick(unref(name));
  25768. focusing.value = false;
  25769. isClick.value = true;
  25770. };
  25771. const handleEnterClick = (e) => {
  25772. const target = e.target;
  25773. if (target == null ? void 0 : target.closest("input, textarea, select"))
  25774. return;
  25775. e.preventDefault();
  25776. collapse == null ? void 0 : collapse.handleItemClick(unref(name));
  25777. };
  25778. return {
  25779. focusing,
  25780. id,
  25781. isActive,
  25782. handleFocus,
  25783. handleHeaderClick,
  25784. handleEnterClick
  25785. };
  25786. };
  25787. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  25788. const ns = useNamespace("collapse");
  25789. const rootKls = computed(() => [
  25790. ns.b("item"),
  25791. ns.is("active", unref(isActive)),
  25792. ns.is("disabled", props.disabled)
  25793. ]);
  25794. const headKls = computed(() => [
  25795. ns.be("item", "header"),
  25796. ns.is("active", unref(isActive)),
  25797. { focusing: unref(focusing) && !props.disabled }
  25798. ]);
  25799. const arrowKls = computed(() => [
  25800. ns.be("item", "arrow"),
  25801. ns.is("active", unref(isActive))
  25802. ]);
  25803. const itemTitleKls = computed(() => [ns.be("item", "title")]);
  25804. const itemWrapperKls = computed(() => ns.be("item", "wrap"));
  25805. const itemContentKls = computed(() => ns.be("item", "content"));
  25806. const scopedContentId = computed(() => ns.b(`content-${unref(id)}`));
  25807. const scopedHeadId = computed(() => ns.b(`head-${unref(id)}`));
  25808. return {
  25809. itemTitleKls,
  25810. arrowKls,
  25811. headKls,
  25812. rootKls,
  25813. itemWrapperKls,
  25814. itemContentKls,
  25815. scopedContentId,
  25816. scopedHeadId
  25817. };
  25818. };
  25819. const __default__$1f = defineComponent({
  25820. name: "ElCollapseItem"
  25821. });
  25822. const _sfc_main$1H = /* @__PURE__ */ defineComponent({
  25823. ...__default__$1f,
  25824. props: collapseItemProps,
  25825. setup(__props, { expose }) {
  25826. const props = __props;
  25827. const {
  25828. focusing,
  25829. id,
  25830. isActive,
  25831. handleFocus,
  25832. handleHeaderClick,
  25833. handleEnterClick
  25834. } = useCollapseItem(props);
  25835. const {
  25836. arrowKls,
  25837. headKls,
  25838. rootKls,
  25839. itemTitleKls,
  25840. itemWrapperKls,
  25841. itemContentKls,
  25842. scopedContentId,
  25843. scopedHeadId
  25844. } = useCollapseItemDOM(props, { focusing, isActive, id });
  25845. expose({
  25846. isActive
  25847. });
  25848. return (_ctx, _cache) => {
  25849. return openBlock(), createElementBlock("div", {
  25850. class: normalizeClass(unref(rootKls))
  25851. }, [
  25852. createElementVNode("div", {
  25853. id: unref(scopedHeadId),
  25854. class: normalizeClass(unref(headKls)),
  25855. "aria-expanded": unref(isActive),
  25856. "aria-controls": unref(scopedContentId),
  25857. "aria-describedby": unref(scopedContentId),
  25858. tabindex: _ctx.disabled ? void 0 : 0,
  25859. "aria-disabled": _ctx.disabled,
  25860. role: "button",
  25861. onClick: unref(handleHeaderClick),
  25862. onKeydown: withKeys(withModifiers(unref(handleEnterClick), ["stop"]), ["space", "enter"]),
  25863. onFocus: unref(handleFocus),
  25864. onBlur: ($event) => focusing.value = false
  25865. }, [
  25866. createElementVNode("span", {
  25867. class: normalizeClass(unref(itemTitleKls))
  25868. }, [
  25869. renderSlot(_ctx.$slots, "title", { isActive: unref(isActive) }, () => [
  25870. createTextVNode(toDisplayString(_ctx.title), 1)
  25871. ])
  25872. ], 2),
  25873. renderSlot(_ctx.$slots, "icon", { isActive: unref(isActive) }, () => [
  25874. createVNode(unref(ElIcon), {
  25875. class: normalizeClass(unref(arrowKls))
  25876. }, {
  25877. default: withCtx(() => [
  25878. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  25879. ]),
  25880. _: 1
  25881. }, 8, ["class"])
  25882. ])
  25883. ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "aria-disabled", "onClick", "onKeydown", "onFocus", "onBlur"]),
  25884. createVNode(unref(ElCollapseTransition), null, {
  25885. default: withCtx(() => [
  25886. withDirectives(createElementVNode("div", {
  25887. id: unref(scopedContentId),
  25888. role: "region",
  25889. class: normalizeClass(unref(itemWrapperKls)),
  25890. "aria-hidden": !unref(isActive),
  25891. "aria-labelledby": unref(scopedHeadId)
  25892. }, [
  25893. createElementVNode("div", {
  25894. class: normalizeClass(unref(itemContentKls))
  25895. }, [
  25896. renderSlot(_ctx.$slots, "default")
  25897. ], 2)
  25898. ], 10, ["id", "aria-hidden", "aria-labelledby"]), [
  25899. [vShow, unref(isActive)]
  25900. ])
  25901. ]),
  25902. _: 3
  25903. })
  25904. ], 2);
  25905. };
  25906. }
  25907. });
  25908. var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["__file", "collapse-item.vue"]]);
  25909. const ElCollapse = withInstall(Collapse, {
  25910. CollapseItem
  25911. });
  25912. const ElCollapseItem = withNoopInstall(CollapseItem);
  25913. const alphaSliderProps = buildProps({
  25914. color: {
  25915. type: definePropType(Object),
  25916. required: true
  25917. },
  25918. vertical: Boolean,
  25919. disabled: Boolean
  25920. });
  25921. const hueSliderProps = alphaSliderProps;
  25922. let isDragging = false;
  25923. function draggable(element, options) {
  25924. if (!isClient)
  25925. return;
  25926. const moveFn = function(event) {
  25927. var _a;
  25928. (_a = options.drag) == null ? void 0 : _a.call(options, event);
  25929. };
  25930. const upFn = function(event) {
  25931. var _a;
  25932. document.removeEventListener("mousemove", moveFn);
  25933. document.removeEventListener("mouseup", upFn);
  25934. document.removeEventListener("touchmove", moveFn);
  25935. document.removeEventListener("touchend", upFn);
  25936. document.onselectstart = null;
  25937. document.ondragstart = null;
  25938. isDragging = false;
  25939. (_a = options.end) == null ? void 0 : _a.call(options, event);
  25940. };
  25941. const downFn = function(event) {
  25942. var _a;
  25943. if (isDragging)
  25944. return;
  25945. document.onselectstart = () => false;
  25946. document.ondragstart = () => false;
  25947. document.addEventListener("mousemove", moveFn);
  25948. document.addEventListener("mouseup", upFn);
  25949. document.addEventListener("touchmove", moveFn);
  25950. document.addEventListener("touchend", upFn);
  25951. isDragging = true;
  25952. (_a = options.start) == null ? void 0 : _a.call(options, event);
  25953. };
  25954. element.addEventListener("mousedown", downFn);
  25955. element.addEventListener("touchstart", downFn, { passive: false });
  25956. }
  25957. const useSlider = (props, { key, minValue, maxValue }) => {
  25958. const instance = getCurrentInstance();
  25959. const thumb = shallowRef();
  25960. const bar = shallowRef();
  25961. const currentValue = computed(() => props.color.get(key));
  25962. function handleClick(event) {
  25963. var _a;
  25964. if (props.disabled)
  25965. return;
  25966. const target = event.target;
  25967. if (target !== thumb.value) {
  25968. handleDrag(event);
  25969. }
  25970. (_a = thumb.value) == null ? void 0 : _a.focus();
  25971. }
  25972. function handleDrag(event) {
  25973. if (!bar.value || !thumb.value || props.disabled)
  25974. return;
  25975. const el = instance.vnode.el;
  25976. const rect = el.getBoundingClientRect();
  25977. const { clientX, clientY } = getClientXY(event);
  25978. let value;
  25979. if (!props.vertical) {
  25980. let left = clientX - rect.left;
  25981. left = Math.max(thumb.value.offsetWidth / 2, left);
  25982. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  25983. value = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * maxValue);
  25984. } else {
  25985. let top = clientY - rect.top;
  25986. top = Math.max(thumb.value.offsetHeight / 2, top);
  25987. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  25988. value = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * maxValue);
  25989. }
  25990. props.color.set(key, value);
  25991. }
  25992. function handleKeydown(event) {
  25993. if (props.disabled)
  25994. return;
  25995. const { shiftKey } = event;
  25996. const code = getEventCode(event);
  25997. const step = shiftKey ? 10 : 1;
  25998. const reverse = key === "hue" ? -1 : 1;
  25999. let isPreventDefault = true;
  26000. switch (code) {
  26001. case EVENT_CODE.left:
  26002. case EVENT_CODE.down:
  26003. incrementPosition(-step * reverse);
  26004. break;
  26005. case EVENT_CODE.right:
  26006. case EVENT_CODE.up:
  26007. incrementPosition(step * reverse);
  26008. break;
  26009. case EVENT_CODE.home:
  26010. props.color.set(key, key === "hue" ? maxValue : minValue);
  26011. break;
  26012. case EVENT_CODE.end:
  26013. props.color.set(key, key === "hue" ? minValue : maxValue);
  26014. break;
  26015. case EVENT_CODE.pageDown:
  26016. incrementPosition(-4 * reverse);
  26017. break;
  26018. case EVENT_CODE.pageUp:
  26019. incrementPosition(4 * reverse);
  26020. break;
  26021. default:
  26022. isPreventDefault = false;
  26023. break;
  26024. }
  26025. isPreventDefault && event.preventDefault();
  26026. }
  26027. function incrementPosition(step) {
  26028. let next = currentValue.value + step;
  26029. next = next < minValue ? minValue : next > maxValue ? maxValue : next;
  26030. props.color.set(key, next);
  26031. }
  26032. return {
  26033. thumb,
  26034. bar,
  26035. currentValue,
  26036. handleDrag,
  26037. handleClick,
  26038. handleKeydown
  26039. };
  26040. };
  26041. const useSliderDOM = (props, {
  26042. namespace,
  26043. maxValue,
  26044. bar,
  26045. thumb,
  26046. currentValue,
  26047. handleDrag,
  26048. getBackground
  26049. }) => {
  26050. const instance = getCurrentInstance();
  26051. const ns = useNamespace(namespace);
  26052. const thumbLeft = ref(0);
  26053. const thumbTop = ref(0);
  26054. const background = ref();
  26055. function getThumbLeft() {
  26056. if (!thumb.value)
  26057. return 0;
  26058. if (props.vertical)
  26059. return 0;
  26060. const el = instance.vnode.el;
  26061. const value = currentValue.value;
  26062. if (!el)
  26063. return 0;
  26064. return Math.round(value * (el.offsetWidth - thumb.value.offsetWidth / 2) / maxValue);
  26065. }
  26066. function getThumbTop() {
  26067. if (!thumb.value)
  26068. return 0;
  26069. const el = instance.vnode.el;
  26070. if (!props.vertical)
  26071. return 0;
  26072. const value = currentValue.value;
  26073. if (!el)
  26074. return 0;
  26075. return Math.round(value * (el.offsetHeight - thumb.value.offsetHeight / 2) / maxValue);
  26076. }
  26077. function update() {
  26078. thumbLeft.value = getThumbLeft();
  26079. thumbTop.value = getThumbTop();
  26080. background.value = getBackground == null ? void 0 : getBackground();
  26081. }
  26082. onMounted(() => {
  26083. if (!bar.value || !thumb.value)
  26084. return;
  26085. const dragConfig = {
  26086. drag: (event) => {
  26087. handleDrag(event);
  26088. },
  26089. end: (event) => {
  26090. handleDrag(event);
  26091. }
  26092. };
  26093. draggable(bar.value, dragConfig);
  26094. draggable(thumb.value, dragConfig);
  26095. update();
  26096. });
  26097. watch(currentValue, () => update());
  26098. watch(() => props.color.value, () => update());
  26099. const rootKls = computed(() => [
  26100. ns.b(),
  26101. ns.is("vertical", props.vertical),
  26102. ns.is("disabled", props.disabled)
  26103. ]);
  26104. const barKls = computed(() => ns.e("bar"));
  26105. const thumbKls = computed(() => ns.e("thumb"));
  26106. const barStyle = computed(() => ({ background: background.value }));
  26107. const thumbStyle = computed(() => ({
  26108. left: addUnit(thumbLeft.value),
  26109. top: addUnit(thumbTop.value)
  26110. }));
  26111. return {
  26112. rootKls,
  26113. barKls,
  26114. barStyle,
  26115. thumbKls,
  26116. thumbStyle,
  26117. thumbLeft,
  26118. thumbTop,
  26119. update
  26120. };
  26121. };
  26122. const minValue$1 = 0;
  26123. const maxValue$1 = 100;
  26124. const __default__$1e = defineComponent({
  26125. name: "ElColorAlphaSlider"
  26126. });
  26127. const _sfc_main$1G = /* @__PURE__ */ defineComponent({
  26128. ...__default__$1e,
  26129. props: alphaSliderProps,
  26130. setup(__props, { expose }) {
  26131. const props = __props;
  26132. const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, { key: "alpha", minValue: minValue$1, maxValue: maxValue$1 });
  26133. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useSliderDOM(props, {
  26134. namespace: "color-alpha-slider",
  26135. maxValue: maxValue$1,
  26136. currentValue,
  26137. bar,
  26138. thumb,
  26139. handleDrag,
  26140. getBackground
  26141. });
  26142. const { t } = useLocale();
  26143. const ariaLabel = computed(() => t("el.colorpicker.alphaLabel"));
  26144. const ariaValuetext = computed(() => {
  26145. return t("el.colorpicker.alphaDescription", {
  26146. alpha: currentValue.value,
  26147. color: props.color.value
  26148. });
  26149. });
  26150. function getBackground() {
  26151. if (props.color && props.color.value) {
  26152. const { r, g, b } = props.color.toRgb();
  26153. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  26154. }
  26155. return "";
  26156. }
  26157. expose({
  26158. update,
  26159. bar,
  26160. thumb
  26161. });
  26162. return (_ctx, _cache) => {
  26163. return openBlock(), createElementBlock("div", {
  26164. class: normalizeClass(unref(rootKls))
  26165. }, [
  26166. createElementVNode("div", {
  26167. ref_key: "bar",
  26168. ref: bar,
  26169. class: normalizeClass(unref(barKls)),
  26170. style: normalizeStyle(unref(barStyle)),
  26171. onClick: unref(handleClick)
  26172. }, null, 14, ["onClick"]),
  26173. createElementVNode("div", {
  26174. ref_key: "thumb",
  26175. ref: thumb,
  26176. class: normalizeClass(unref(thumbKls)),
  26177. style: normalizeStyle(unref(thumbStyle)),
  26178. "aria-label": unref(ariaLabel),
  26179. "aria-valuenow": unref(currentValue),
  26180. "aria-valuetext": unref(ariaValuetext),
  26181. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  26182. "aria-valuemin": minValue$1,
  26183. "aria-valuemax": maxValue$1,
  26184. role: "slider",
  26185. tabindex: "0",
  26186. onKeydown: unref(handleKeydown)
  26187. }, null, 46, ["aria-label", "aria-valuenow", "aria-valuetext", "aria-orientation", "onKeydown"])
  26188. ], 2);
  26189. };
  26190. }
  26191. });
  26192. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["__file", "alpha-slider.vue"]]);
  26193. const minValue = 0;
  26194. const maxValue = 360;
  26195. const __default__$1d = defineComponent({
  26196. name: "ElColorHueSlider"
  26197. });
  26198. const _sfc_main$1F = /* @__PURE__ */ defineComponent({
  26199. ...__default__$1d,
  26200. props: hueSliderProps,
  26201. setup(__props, { expose }) {
  26202. const props = __props;
  26203. const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, { key: "hue", minValue, maxValue });
  26204. const { rootKls, barKls, thumbKls, thumbStyle, thumbTop, update } = useSliderDOM(props, {
  26205. namespace: "color-hue-slider",
  26206. maxValue,
  26207. currentValue,
  26208. bar,
  26209. thumb,
  26210. handleDrag
  26211. });
  26212. const { t } = useLocale();
  26213. const ariaLabel = computed(() => t("el.colorpicker.hueLabel"));
  26214. const ariaValuetext = computed(() => {
  26215. return t("el.colorpicker.hueDescription", {
  26216. hue: currentValue.value,
  26217. color: props.color.value
  26218. });
  26219. });
  26220. expose({
  26221. bar,
  26222. thumb,
  26223. thumbTop,
  26224. update
  26225. });
  26226. return (_ctx, _cache) => {
  26227. return openBlock(), createElementBlock("div", {
  26228. class: normalizeClass(unref(rootKls))
  26229. }, [
  26230. createElementVNode("div", {
  26231. ref_key: "bar",
  26232. ref: bar,
  26233. class: normalizeClass(unref(barKls)),
  26234. onClick: unref(handleClick)
  26235. }, null, 10, ["onClick"]),
  26236. createElementVNode("div", {
  26237. ref_key: "thumb",
  26238. ref: thumb,
  26239. class: normalizeClass(unref(thumbKls)),
  26240. style: normalizeStyle(unref(thumbStyle)),
  26241. "aria-label": unref(ariaLabel),
  26242. "aria-valuenow": unref(currentValue),
  26243. "aria-valuetext": unref(ariaValuetext),
  26244. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  26245. "aria-valuemin": minValue,
  26246. "aria-valuemax": maxValue,
  26247. role: "slider",
  26248. tabindex: "0",
  26249. onKeydown: unref(handleKeydown)
  26250. }, null, 46, ["aria-label", "aria-valuenow", "aria-valuetext", "aria-orientation", "onKeydown"])
  26251. ], 2);
  26252. };
  26253. }
  26254. });
  26255. var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["__file", "hue-slider.vue"]]);
  26256. const predefineProps = buildProps({
  26257. colors: {
  26258. type: definePropType(Array),
  26259. required: true
  26260. },
  26261. color: {
  26262. type: definePropType(Object),
  26263. required: true
  26264. },
  26265. enableAlpha: {
  26266. type: Boolean,
  26267. required: true
  26268. },
  26269. disabled: Boolean
  26270. });
  26271. const colorPickerPanelProps = buildProps({
  26272. modelValue: {
  26273. type: definePropType(String),
  26274. default: void 0
  26275. },
  26276. border: {
  26277. type: Boolean,
  26278. default: true
  26279. },
  26280. showAlpha: Boolean,
  26281. colorFormat: String,
  26282. disabled: Boolean,
  26283. predefine: {
  26284. type: definePropType(Array)
  26285. },
  26286. validateEvent: {
  26287. type: Boolean,
  26288. default: true
  26289. }
  26290. });
  26291. const colorPickerPanelEmits = {
  26292. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val)
  26293. };
  26294. const ROOT_COMMON_COLOR_INJECTION_KEY = Symbol("colorCommonPickerKey");
  26295. const colorPickerPanelContextKey = Symbol("colorPickerPanelContextKey");
  26296. class Color {
  26297. constructor(options = {}) {
  26298. this._hue = 0;
  26299. this._saturation = 100;
  26300. this._value = 100;
  26301. this._alpha = 100;
  26302. this._tiny = new TinyColor();
  26303. this._isValid = false;
  26304. this.enableAlpha = false;
  26305. this.format = "";
  26306. this.value = "";
  26307. for (const option in options) {
  26308. if (hasOwn(options, option)) {
  26309. this[option] = options[option];
  26310. }
  26311. }
  26312. if (options.value) {
  26313. this.fromString(options.value);
  26314. } else {
  26315. this.doOnChange();
  26316. }
  26317. }
  26318. set(prop, value) {
  26319. if (arguments.length === 1 && typeof prop === "object") {
  26320. for (const p in prop) {
  26321. if (hasOwn(prop, p)) {
  26322. this.set(p, prop[p]);
  26323. }
  26324. }
  26325. return;
  26326. }
  26327. this[`_${prop}`] = value;
  26328. this._isValid = true;
  26329. this.doOnChange();
  26330. }
  26331. get(prop) {
  26332. if (["hue", "saturation", "value", "alpha"].includes(prop)) {
  26333. return Math.round(this[`_${prop}`]);
  26334. }
  26335. return this[`_${prop}`];
  26336. }
  26337. toRgb() {
  26338. return this._isValid ? this._tiny.toRgb() : { r: 255, g: 255, b: 255, a: 0 };
  26339. }
  26340. fromString(value) {
  26341. const color = new TinyColor(value);
  26342. this._isValid = color.isValid;
  26343. if (color.isValid) {
  26344. const { h, s, v, a } = color.toHsv();
  26345. this._hue = h;
  26346. this._saturation = s * 100;
  26347. this._value = v * 100;
  26348. this._alpha = a * 100;
  26349. } else {
  26350. this._hue = 0;
  26351. this._saturation = 100;
  26352. this._value = 100;
  26353. this._alpha = 100;
  26354. }
  26355. this.doOnChange();
  26356. }
  26357. clear() {
  26358. this._isValid = false;
  26359. this.value = "";
  26360. this._hue = 0;
  26361. this._saturation = 100;
  26362. this._value = 100;
  26363. this._alpha = 100;
  26364. }
  26365. compare(color) {
  26366. const compareColor = new TinyColor({
  26367. h: color._hue,
  26368. s: color._saturation / 100,
  26369. v: color._value / 100,
  26370. a: color._alpha / 100
  26371. });
  26372. return this._tiny.equals(compareColor);
  26373. }
  26374. doOnChange() {
  26375. const { _hue, _saturation, _value, _alpha, format, enableAlpha } = this;
  26376. let _format = format || (enableAlpha ? "rgb" : "hex");
  26377. if (format === "hex" && enableAlpha) {
  26378. _format = "hex8";
  26379. }
  26380. this._tiny = new TinyColor({
  26381. h: _hue,
  26382. s: _saturation / 100,
  26383. v: _value / 100,
  26384. a: _alpha / 100
  26385. });
  26386. this.value = this._isValid ? this._tiny.toString(_format) : "";
  26387. }
  26388. }
  26389. const usePredefine = (props) => {
  26390. const { currentColor } = inject(colorPickerPanelContextKey);
  26391. const rgbaColors = ref(parseColors(props.colors, props.color));
  26392. watch(() => currentColor.value, (val) => {
  26393. const color = new Color({
  26394. value: val,
  26395. enableAlpha: props.enableAlpha
  26396. });
  26397. rgbaColors.value.forEach((item) => {
  26398. item.selected = color.compare(item);
  26399. });
  26400. });
  26401. watchEffect(() => {
  26402. rgbaColors.value = parseColors(props.colors, props.color);
  26403. });
  26404. function handleSelect(index) {
  26405. props.color.fromString(props.colors[index]);
  26406. }
  26407. function parseColors(colors, color) {
  26408. return colors.map((value) => {
  26409. const c = new Color({
  26410. value,
  26411. enableAlpha: props.enableAlpha
  26412. });
  26413. c.selected = c.compare(color);
  26414. return c;
  26415. });
  26416. }
  26417. return {
  26418. rgbaColors,
  26419. handleSelect
  26420. };
  26421. };
  26422. const usePredefineDOM = (props) => {
  26423. const ns = useNamespace("color-predefine");
  26424. const rootKls = computed(() => [ns.b(), ns.is("disabled", props.disabled)]);
  26425. const colorsKls = computed(() => ns.e("colors"));
  26426. function colorSelectorKls(item) {
  26427. return [
  26428. ns.e("color-selector"),
  26429. ns.is("alpha", item.get("alpha") < 100),
  26430. { selected: item.selected }
  26431. ];
  26432. }
  26433. return {
  26434. rootKls,
  26435. colorsKls,
  26436. colorSelectorKls
  26437. };
  26438. };
  26439. const __default__$1c = defineComponent({
  26440. name: "ElColorPredefine"
  26441. });
  26442. const _sfc_main$1E = /* @__PURE__ */ defineComponent({
  26443. ...__default__$1c,
  26444. props: predefineProps,
  26445. setup(__props) {
  26446. const props = __props;
  26447. const { rgbaColors, handleSelect } = usePredefine(props);
  26448. const { rootKls, colorsKls, colorSelectorKls } = usePredefineDOM(props);
  26449. const { t } = useLocale();
  26450. const ariaLabel = (value) => {
  26451. return t("el.colorpicker.predefineDescription", { value });
  26452. };
  26453. return (_ctx, _cache) => {
  26454. return openBlock(), createElementBlock("div", {
  26455. class: normalizeClass(unref(rootKls))
  26456. }, [
  26457. createElementVNode("div", {
  26458. class: normalizeClass(unref(colorsKls))
  26459. }, [
  26460. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rgbaColors), (item, index) => {
  26461. return openBlock(), createElementBlock("button", {
  26462. key: _ctx.colors[index],
  26463. type: "button",
  26464. disabled: _ctx.disabled,
  26465. "aria-label": ariaLabel(item.value),
  26466. class: normalizeClass(unref(colorSelectorKls)(item)),
  26467. onClick: ($event) => unref(handleSelect)(index)
  26468. }, [
  26469. createElementVNode("div", {
  26470. style: normalizeStyle({ backgroundColor: item.value })
  26471. }, null, 4)
  26472. ], 10, ["disabled", "aria-label", "onClick"]);
  26473. }), 128))
  26474. ], 2)
  26475. ], 2);
  26476. };
  26477. }
  26478. });
  26479. var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["__file", "predefine.vue"]]);
  26480. const svPanelProps = buildProps({
  26481. color: {
  26482. type: definePropType(Object),
  26483. required: true
  26484. },
  26485. disabled: Boolean
  26486. });
  26487. const useSvPanel = (props) => {
  26488. const instance = getCurrentInstance();
  26489. const cursorRef = ref();
  26490. const cursorTop = ref(0);
  26491. const cursorLeft = ref(0);
  26492. const background = ref("hsl(0, 100%, 50%)");
  26493. const saturation = computed(() => props.color.get("saturation"));
  26494. const brightness = computed(() => props.color.get("value"));
  26495. const hue = computed(() => props.color.get("hue"));
  26496. function handleClick(event) {
  26497. var _a;
  26498. if (props.disabled)
  26499. return;
  26500. const target = event.target;
  26501. if (target !== cursorRef.value) {
  26502. handleDrag(event);
  26503. }
  26504. (_a = cursorRef.value) == null ? void 0 : _a.focus({ preventScroll: true });
  26505. }
  26506. function handleDrag(event) {
  26507. if (props.disabled)
  26508. return;
  26509. const el = instance.vnode.el;
  26510. const rect = el.getBoundingClientRect();
  26511. const { clientX, clientY } = getClientXY(event);
  26512. let left = clientX - rect.left;
  26513. let top = clientY - rect.top;
  26514. left = Math.max(0, left);
  26515. left = Math.min(left, rect.width);
  26516. top = Math.max(0, top);
  26517. top = Math.min(top, rect.height);
  26518. cursorLeft.value = left;
  26519. cursorTop.value = top;
  26520. props.color.set({
  26521. saturation: left / rect.width * 100,
  26522. value: 100 - top / rect.height * 100
  26523. });
  26524. }
  26525. function handleKeydown(event) {
  26526. if (props.disabled)
  26527. return;
  26528. const { shiftKey } = event;
  26529. const code = getEventCode(event);
  26530. const step = shiftKey ? 10 : 1;
  26531. let isPreventDefault = true;
  26532. switch (code) {
  26533. case EVENT_CODE.left:
  26534. incrementSaturation(-step);
  26535. break;
  26536. case EVENT_CODE.right:
  26537. incrementSaturation(step);
  26538. break;
  26539. case EVENT_CODE.up:
  26540. incrementBrightness(step);
  26541. break;
  26542. case EVENT_CODE.down:
  26543. incrementBrightness(-step);
  26544. break;
  26545. default:
  26546. isPreventDefault = false;
  26547. break;
  26548. }
  26549. isPreventDefault && event.preventDefault();
  26550. }
  26551. function incrementSaturation(step) {
  26552. let next = saturation.value + step;
  26553. next = next < 0 ? 0 : next > 100 ? 100 : next;
  26554. props.color.set("saturation", next);
  26555. }
  26556. function incrementBrightness(step) {
  26557. let next = brightness.value + step;
  26558. next = next < 0 ? 0 : next > 100 ? 100 : next;
  26559. props.color.set("value", next);
  26560. }
  26561. return {
  26562. cursorRef,
  26563. cursorTop,
  26564. cursorLeft,
  26565. background,
  26566. saturation,
  26567. brightness,
  26568. hue,
  26569. handleClick,
  26570. handleDrag,
  26571. handleKeydown
  26572. };
  26573. };
  26574. const useSvPanelDOM = (props, {
  26575. cursorTop,
  26576. cursorLeft,
  26577. background,
  26578. handleDrag
  26579. }) => {
  26580. const instance = getCurrentInstance();
  26581. const ns = useNamespace("color-svpanel");
  26582. function update() {
  26583. const saturation = props.color.get("saturation");
  26584. const brightness = props.color.get("value");
  26585. const el = instance.vnode.el;
  26586. const { clientWidth: width, clientHeight: height } = el;
  26587. cursorLeft.value = saturation * width / 100;
  26588. cursorTop.value = (100 - brightness) * height / 100;
  26589. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  26590. }
  26591. onMounted(() => {
  26592. draggable(instance.vnode.el, {
  26593. drag: (event) => {
  26594. handleDrag(event);
  26595. },
  26596. end: (event) => {
  26597. handleDrag(event);
  26598. }
  26599. });
  26600. update();
  26601. });
  26602. watch([
  26603. () => props.color.get("hue"),
  26604. () => props.color.get("value"),
  26605. () => props.color.value
  26606. ], () => update());
  26607. const rootKls = computed(() => ns.b());
  26608. const cursorKls = computed(() => ns.e("cursor"));
  26609. const rootStyle = computed(() => ({
  26610. backgroundColor: background.value
  26611. }));
  26612. const cursorStyle = computed(() => ({
  26613. top: addUnit(cursorTop.value),
  26614. left: addUnit(cursorLeft.value)
  26615. }));
  26616. return {
  26617. rootKls,
  26618. cursorKls,
  26619. rootStyle,
  26620. cursorStyle,
  26621. update
  26622. };
  26623. };
  26624. const __default__$1b = defineComponent({
  26625. name: "ElSvPanel"
  26626. });
  26627. const _sfc_main$1D = /* @__PURE__ */ defineComponent({
  26628. ...__default__$1b,
  26629. props: svPanelProps,
  26630. setup(__props, { expose }) {
  26631. const props = __props;
  26632. const {
  26633. cursorRef,
  26634. cursorTop,
  26635. cursorLeft,
  26636. background,
  26637. saturation,
  26638. brightness,
  26639. handleClick,
  26640. handleDrag,
  26641. handleKeydown
  26642. } = useSvPanel(props);
  26643. const { rootKls, cursorKls, rootStyle, cursorStyle, update } = useSvPanelDOM(props, {
  26644. cursorTop,
  26645. cursorLeft,
  26646. background,
  26647. handleDrag
  26648. });
  26649. const { t } = useLocale();
  26650. const ariaLabel = computed(() => t("el.colorpicker.svLabel"));
  26651. const ariaValuetext = computed(() => {
  26652. return t("el.colorpicker.svDescription", {
  26653. saturation: saturation.value,
  26654. brightness: brightness.value,
  26655. color: props.color.value
  26656. });
  26657. });
  26658. expose({
  26659. update
  26660. });
  26661. return (_ctx, _cache) => {
  26662. return openBlock(), createElementBlock("div", {
  26663. class: normalizeClass(unref(rootKls)),
  26664. style: normalizeStyle(unref(rootStyle)),
  26665. onClick: unref(handleClick)
  26666. }, [
  26667. createElementVNode("div", {
  26668. ref_key: "cursorRef",
  26669. ref: cursorRef,
  26670. class: normalizeClass(unref(cursorKls)),
  26671. style: normalizeStyle(unref(cursorStyle)),
  26672. tabindex: "0",
  26673. role: "slider",
  26674. "aria-valuemin": "0,0",
  26675. "aria-valuemax": "100,100",
  26676. "aria-label": unref(ariaLabel),
  26677. "aria-valuenow": `${unref(saturation)},${unref(brightness)}`,
  26678. "aria-valuetext": unref(ariaValuetext),
  26679. onKeydown: unref(handleKeydown)
  26680. }, null, 46, ["aria-label", "aria-valuenow", "aria-valuetext", "onKeydown"])
  26681. ], 14, ["onClick"]);
  26682. };
  26683. }
  26684. });
  26685. var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__file", "sv-panel.vue"]]);
  26686. const useCommonColor = (props, emit) => {
  26687. const color = reactive(new Color({
  26688. enableAlpha: props.showAlpha,
  26689. format: props.colorFormat || "",
  26690. value: props.modelValue
  26691. }));
  26692. watch(() => [props.colorFormat, props.showAlpha], () => {
  26693. color.enableAlpha = props.showAlpha;
  26694. color.format = props.colorFormat || color.format;
  26695. color.doOnChange();
  26696. emit(UPDATE_MODEL_EVENT, color.value);
  26697. });
  26698. return {
  26699. color
  26700. };
  26701. };
  26702. const __default__$1a = defineComponent({
  26703. name: "ElColorPickerPanel"
  26704. });
  26705. const _sfc_main$1C = /* @__PURE__ */ defineComponent({
  26706. ...__default__$1a,
  26707. props: colorPickerPanelProps,
  26708. emits: colorPickerPanelEmits,
  26709. setup(__props, { expose, emit }) {
  26710. const props = __props;
  26711. const ns = useNamespace("color-picker-panel");
  26712. const { formItem } = useFormItem();
  26713. const disabled = useFormDisabled();
  26714. const hueRef = ref();
  26715. const svRef = ref();
  26716. const alphaRef = ref();
  26717. const inputRef = ref();
  26718. const customInput = ref("");
  26719. const { color } = inject(ROOT_COMMON_COLOR_INJECTION_KEY, () => useCommonColor(props, emit), true);
  26720. function handleConfirm() {
  26721. color.fromString(customInput.value);
  26722. if (color.value !== customInput.value) {
  26723. customInput.value = color.value;
  26724. }
  26725. }
  26726. function handleFocusout() {
  26727. var _a;
  26728. if (props.validateEvent) {
  26729. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
  26730. }
  26731. }
  26732. function update() {
  26733. var _a, _b, _c;
  26734. (_a = hueRef.value) == null ? void 0 : _a.update();
  26735. (_b = svRef.value) == null ? void 0 : _b.update();
  26736. (_c = alphaRef.value) == null ? void 0 : _c.update();
  26737. }
  26738. onMounted(() => {
  26739. if (props.modelValue) {
  26740. customInput.value = color.value;
  26741. }
  26742. nextTick(update);
  26743. });
  26744. watch(() => props.modelValue, (newVal) => {
  26745. if (newVal !== color.value) {
  26746. newVal ? color.fromString(newVal) : color.clear();
  26747. }
  26748. });
  26749. watch(() => color.value, (val) => {
  26750. emit(UPDATE_MODEL_EVENT, val);
  26751. customInput.value = val;
  26752. if (props.validateEvent) {
  26753. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  26754. }
  26755. });
  26756. provide(colorPickerPanelContextKey, {
  26757. currentColor: computed(() => color.value)
  26758. });
  26759. expose({
  26760. color,
  26761. inputRef,
  26762. update
  26763. });
  26764. return (_ctx, _cache) => {
  26765. return openBlock(), createElementBlock("div", {
  26766. class: normalizeClass([unref(ns).b(), unref(ns).is("disabled", unref(disabled)), unref(ns).is("border", _ctx.border)]),
  26767. onFocusout: handleFocusout
  26768. }, [
  26769. createElementVNode("div", {
  26770. class: normalizeClass(unref(ns).e("wrapper"))
  26771. }, [
  26772. createVNode(HueSlider, {
  26773. ref_key: "hueRef",
  26774. ref: hueRef,
  26775. class: "hue-slider",
  26776. color: unref(color),
  26777. vertical: "",
  26778. disabled: unref(disabled)
  26779. }, null, 8, ["color", "disabled"]),
  26780. createVNode(SvPanel, {
  26781. ref_key: "svRef",
  26782. ref: svRef,
  26783. color: unref(color),
  26784. disabled: unref(disabled)
  26785. }, null, 8, ["color", "disabled"])
  26786. ], 2),
  26787. _ctx.showAlpha ? (openBlock(), createBlock(AlphaSlider, {
  26788. key: 0,
  26789. ref_key: "alphaRef",
  26790. ref: alphaRef,
  26791. color: unref(color),
  26792. disabled: unref(disabled)
  26793. }, null, 8, ["color", "disabled"])) : createCommentVNode("v-if", true),
  26794. _ctx.predefine ? (openBlock(), createBlock(Predefine, {
  26795. key: 1,
  26796. ref: "predefine",
  26797. "enable-alpha": _ctx.showAlpha,
  26798. color: unref(color),
  26799. colors: _ctx.predefine,
  26800. disabled: unref(disabled)
  26801. }, null, 8, ["enable-alpha", "color", "colors", "disabled"])) : createCommentVNode("v-if", true),
  26802. createElementVNode("div", {
  26803. class: normalizeClass(unref(ns).e("footer"))
  26804. }, [
  26805. createVNode(unref(ElInput), {
  26806. ref_key: "inputRef",
  26807. ref: inputRef,
  26808. modelValue: customInput.value,
  26809. "onUpdate:modelValue": ($event) => customInput.value = $event,
  26810. "validate-event": false,
  26811. size: "small",
  26812. disabled: unref(disabled),
  26813. onChange: handleConfirm
  26814. }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
  26815. renderSlot(_ctx.$slots, "footer")
  26816. ], 2)
  26817. ], 34);
  26818. };
  26819. }
  26820. });
  26821. var ColorPickerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__file", "color-picker-panel.vue"]]);
  26822. const ElColorPickerPanel = withInstall(ColorPickerPanel);
  26823. const colorPickerProps = buildProps({
  26824. persistent: {
  26825. type: Boolean,
  26826. default: true
  26827. },
  26828. modelValue: {
  26829. type: definePropType(String),
  26830. default: void 0
  26831. },
  26832. id: String,
  26833. showAlpha: Boolean,
  26834. colorFormat: String,
  26835. disabled: Boolean,
  26836. size: useSizeProp,
  26837. popperClass: useTooltipContentProps.popperClass,
  26838. popperStyle: useTooltipContentProps.popperStyle,
  26839. tabindex: {
  26840. type: [String, Number],
  26841. default: 0
  26842. },
  26843. teleported: useTooltipContentProps.teleported,
  26844. appendTo: useTooltipContentProps.appendTo,
  26845. predefine: {
  26846. type: definePropType(Array)
  26847. },
  26848. validateEvent: {
  26849. type: Boolean,
  26850. default: true
  26851. },
  26852. ...useEmptyValuesProps,
  26853. ...useAriaProps(["ariaLabel"])
  26854. });
  26855. const colorPickerEmits = {
  26856. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val),
  26857. [CHANGE_EVENT]: (val) => isString$1(val) || isNil(val),
  26858. activeChange: (val) => isString$1(val) || isNil(val),
  26859. focus: (evt) => evt instanceof FocusEvent,
  26860. blur: (evt) => evt instanceof FocusEvent
  26861. };
  26862. const __default__$19 = defineComponent({
  26863. name: "ElColorPicker"
  26864. });
  26865. const _sfc_main$1B = /* @__PURE__ */ defineComponent({
  26866. ...__default__$19,
  26867. props: colorPickerProps,
  26868. emits: colorPickerEmits,
  26869. setup(__props, { expose, emit }) {
  26870. const props = __props;
  26871. const { t } = useLocale();
  26872. const ns = useNamespace("color");
  26873. const { formItem } = useFormItem();
  26874. const colorSize = useFormSize();
  26875. const colorDisabled = useFormDisabled();
  26876. const { valueOnClear, isEmptyValue } = useEmptyValues(props, null);
  26877. const commonColor = useCommonColor(props, emit);
  26878. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  26879. formItemContext: formItem
  26880. });
  26881. const popper = ref();
  26882. const triggerRef = ref();
  26883. const pickerPanelRef = ref();
  26884. const showPicker = ref(false);
  26885. const showPanelColor = ref(false);
  26886. let shouldActiveChange = true;
  26887. const { isFocused, handleFocus, handleBlur } = useFocusController(triggerRef, {
  26888. disabled: colorDisabled,
  26889. beforeBlur(event) {
  26890. var _a;
  26891. return (_a = popper.value) == null ? void 0 : _a.isFocusInsideContent(event);
  26892. },
  26893. afterBlur() {
  26894. var _a;
  26895. setShowPicker(false);
  26896. resetColor();
  26897. if (props.validateEvent) {
  26898. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
  26899. }
  26900. }
  26901. });
  26902. const color = reactiveComputed(() => {
  26903. var _a, _b;
  26904. return (_b = (_a = pickerPanelRef.value) == null ? void 0 : _a.color) != null ? _b : commonColor.color;
  26905. });
  26906. const panelProps = computed(() => pick(props, Object.keys(colorPickerPanelProps)));
  26907. const displayedColor = computed(() => {
  26908. if (!props.modelValue && !showPanelColor.value) {
  26909. return "transparent";
  26910. }
  26911. return displayedRgb(color, props.showAlpha);
  26912. });
  26913. const currentColor = computed(() => {
  26914. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  26915. });
  26916. const buttonAriaLabel = computed(() => {
  26917. return !isLabeledByFormItem.value ? props.ariaLabel || t("el.colorpicker.defaultLabel") : void 0;
  26918. });
  26919. const buttonAriaLabelledby = computed(() => {
  26920. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  26921. });
  26922. const btnKls = computed(() => {
  26923. return [
  26924. ns.b("picker"),
  26925. ns.is("disabled", colorDisabled.value),
  26926. ns.bm("picker", colorSize.value),
  26927. ns.is("focused", isFocused.value)
  26928. ];
  26929. });
  26930. function displayedRgb(color2, showAlpha) {
  26931. const { r, g, b, a } = color2.toRgb();
  26932. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${a})` : `rgb(${r}, ${g}, ${b})`;
  26933. }
  26934. function setShowPicker(value) {
  26935. showPicker.value = value;
  26936. }
  26937. const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
  26938. function show() {
  26939. if (colorDisabled.value)
  26940. return;
  26941. setShowPicker(true);
  26942. }
  26943. function hide() {
  26944. debounceSetShowPicker(false);
  26945. resetColor();
  26946. }
  26947. function resetColor() {
  26948. nextTick(() => {
  26949. if (props.modelValue) {
  26950. color.fromString(props.modelValue);
  26951. } else {
  26952. color.value = "";
  26953. nextTick(() => {
  26954. showPanelColor.value = false;
  26955. });
  26956. }
  26957. });
  26958. }
  26959. function handleTrigger() {
  26960. if (colorDisabled.value)
  26961. return;
  26962. if (showPicker.value) {
  26963. resetColor();
  26964. }
  26965. debounceSetShowPicker(!showPicker.value);
  26966. }
  26967. function confirmValue() {
  26968. const value = isEmptyValue(color.value) ? valueOnClear.value : color.value;
  26969. emit(UPDATE_MODEL_EVENT, value);
  26970. emit(CHANGE_EVENT, value);
  26971. if (props.validateEvent) {
  26972. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  26973. }
  26974. debounceSetShowPicker(false);
  26975. nextTick(() => {
  26976. const newColor = new Color({
  26977. enableAlpha: props.showAlpha,
  26978. format: props.colorFormat || "",
  26979. value: props.modelValue
  26980. });
  26981. if (!color.compare(newColor)) {
  26982. resetColor();
  26983. }
  26984. });
  26985. }
  26986. function clear() {
  26987. debounceSetShowPicker(false);
  26988. emit(UPDATE_MODEL_EVENT, valueOnClear.value);
  26989. emit(CHANGE_EVENT, valueOnClear.value);
  26990. if (props.modelValue !== valueOnClear.value && props.validateEvent) {
  26991. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  26992. }
  26993. resetColor();
  26994. }
  26995. function handleShowTooltip() {
  26996. var _a, _b;
  26997. (_b = (_a = pickerPanelRef == null ? void 0 : pickerPanelRef.value) == null ? void 0 : _a.inputRef) == null ? void 0 : _b.focus();
  26998. }
  26999. function handleClickOutside() {
  27000. if (!showPicker.value)
  27001. return;
  27002. hide();
  27003. isFocused.value && focus();
  27004. }
  27005. function handleEsc(event) {
  27006. event.preventDefault();
  27007. event.stopPropagation();
  27008. setShowPicker(false);
  27009. resetColor();
  27010. }
  27011. function handleKeyDown(event) {
  27012. const code = getEventCode(event);
  27013. switch (code) {
  27014. case EVENT_CODE.enter:
  27015. case EVENT_CODE.numpadEnter:
  27016. case EVENT_CODE.space:
  27017. event.preventDefault();
  27018. event.stopPropagation();
  27019. show();
  27020. break;
  27021. case EVENT_CODE.esc:
  27022. handleEsc(event);
  27023. break;
  27024. }
  27025. }
  27026. function focus() {
  27027. triggerRef.value.focus();
  27028. }
  27029. function blur() {
  27030. triggerRef.value.blur();
  27031. }
  27032. watch(() => currentColor.value, (val) => {
  27033. shouldActiveChange && emit("activeChange", val);
  27034. shouldActiveChange = true;
  27035. });
  27036. watch(() => color.value, () => {
  27037. if (!props.modelValue && !showPanelColor.value) {
  27038. showPanelColor.value = true;
  27039. }
  27040. });
  27041. watch(() => props.modelValue, (newVal) => {
  27042. if (!newVal) {
  27043. showPanelColor.value = false;
  27044. } else if (newVal && newVal !== color.value) {
  27045. shouldActiveChange = false;
  27046. color.fromString(newVal);
  27047. }
  27048. });
  27049. watch(() => showPicker.value, () => {
  27050. var _a;
  27051. nextTick((_a = pickerPanelRef.value) == null ? void 0 : _a.update);
  27052. });
  27053. provide(ROOT_COMMON_COLOR_INJECTION_KEY, commonColor);
  27054. expose({
  27055. color,
  27056. show,
  27057. hide,
  27058. focus,
  27059. blur
  27060. });
  27061. return (_ctx, _cache) => {
  27062. return openBlock(), createBlock(unref(ElTooltip), {
  27063. ref_key: "popper",
  27064. ref: popper,
  27065. visible: showPicker.value,
  27066. "show-arrow": false,
  27067. "fallback-placements": ["bottom", "top", "right", "left"],
  27068. offset: 0,
  27069. "gpu-acceleration": false,
  27070. "popper-class": [unref(ns).be("picker", "panel"), _ctx.popperClass],
  27071. "popper-style": _ctx.popperStyle,
  27072. "stop-popper-mouse-event": false,
  27073. pure: "",
  27074. loop: "",
  27075. role: "dialog",
  27076. effect: "light",
  27077. trigger: "click",
  27078. teleported: _ctx.teleported,
  27079. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  27080. persistent: _ctx.persistent,
  27081. "append-to": _ctx.appendTo,
  27082. onShow: handleShowTooltip,
  27083. onHide: ($event) => setShowPicker(false)
  27084. }, {
  27085. content: withCtx(() => [
  27086. withDirectives((openBlock(), createBlock(unref(ElColorPickerPanel), mergeProps({
  27087. ref_key: "pickerPanelRef",
  27088. ref: pickerPanelRef
  27089. }, unref(panelProps), {
  27090. border: false,
  27091. "validate-event": false,
  27092. onKeydown: withKeys(handleEsc, ["esc"])
  27093. }), {
  27094. footer: withCtx(() => [
  27095. createElementVNode("div", null, [
  27096. createVNode(unref(ElButton), {
  27097. class: normalizeClass(unref(ns).be("footer", "link-btn")),
  27098. text: "",
  27099. size: "small",
  27100. onClick: clear
  27101. }, {
  27102. default: withCtx(() => [
  27103. createTextVNode(toDisplayString(unref(t)("el.colorpicker.clear")), 1)
  27104. ]),
  27105. _: 1
  27106. }, 8, ["class"]),
  27107. createVNode(unref(ElButton), {
  27108. plain: "",
  27109. size: "small",
  27110. class: normalizeClass(unref(ns).be("footer", "btn")),
  27111. onClick: confirmValue
  27112. }, {
  27113. default: withCtx(() => [
  27114. createTextVNode(toDisplayString(unref(t)("el.colorpicker.confirm")), 1)
  27115. ]),
  27116. _: 1
  27117. }, 8, ["class"])
  27118. ])
  27119. ]),
  27120. _: 1
  27121. }, 16, ["onKeydown"])), [
  27122. [unref(ClickOutside), handleClickOutside, triggerRef.value]
  27123. ])
  27124. ]),
  27125. default: withCtx(() => [
  27126. createElementVNode("div", mergeProps({
  27127. id: unref(buttonId),
  27128. ref_key: "triggerRef",
  27129. ref: triggerRef
  27130. }, _ctx.$attrs, {
  27131. class: unref(btnKls),
  27132. role: "button",
  27133. "aria-label": unref(buttonAriaLabel),
  27134. "aria-labelledby": unref(buttonAriaLabelledby),
  27135. "aria-description": unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  27136. "aria-disabled": unref(colorDisabled),
  27137. tabindex: unref(colorDisabled) ? void 0 : _ctx.tabindex,
  27138. onKeydown: handleKeyDown,
  27139. onFocus: unref(handleFocus),
  27140. onBlur: unref(handleBlur)
  27141. }), [
  27142. createElementVNode("div", {
  27143. class: normalizeClass(unref(ns).be("picker", "trigger")),
  27144. onClick: handleTrigger
  27145. }, [
  27146. createElementVNode("span", {
  27147. class: normalizeClass([unref(ns).be("picker", "color"), unref(ns).is("alpha", _ctx.showAlpha)])
  27148. }, [
  27149. createElementVNode("span", {
  27150. class: normalizeClass(unref(ns).be("picker", "color-inner")),
  27151. style: normalizeStyle({
  27152. backgroundColor: unref(displayedColor)
  27153. })
  27154. }, [
  27155. withDirectives(createVNode(unref(ElIcon), {
  27156. class: normalizeClass([unref(ns).be("picker", "icon"), unref(ns).is("icon-arrow-down")])
  27157. }, {
  27158. default: withCtx(() => [
  27159. createVNode(unref(arrow_down_default))
  27160. ]),
  27161. _: 1
  27162. }, 8, ["class"]), [
  27163. [vShow, _ctx.modelValue || showPanelColor.value]
  27164. ]),
  27165. withDirectives(createVNode(unref(ElIcon), {
  27166. class: normalizeClass([unref(ns).be("picker", "empty"), unref(ns).is("icon-close")])
  27167. }, {
  27168. default: withCtx(() => [
  27169. createVNode(unref(close_default))
  27170. ]),
  27171. _: 1
  27172. }, 8, ["class"]), [
  27173. [vShow, !_ctx.modelValue && !showPanelColor.value]
  27174. ])
  27175. ], 6)
  27176. ], 2)
  27177. ], 2)
  27178. ], 16, ["id", "aria-label", "aria-labelledby", "aria-description", "aria-disabled", "tabindex", "onFocus", "onBlur"])
  27179. ]),
  27180. _: 1
  27181. }, 8, ["visible", "popper-class", "popper-style", "teleported", "transition", "persistent", "append-to", "onHide"]);
  27182. };
  27183. }
  27184. });
  27185. var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__file", "color-picker.vue"]]);
  27186. const ElColorPicker = withInstall(ColorPicker);
  27187. const __default__$18 = defineComponent({
  27188. name: "ElContainer"
  27189. });
  27190. const _sfc_main$1A = /* @__PURE__ */ defineComponent({
  27191. ...__default__$18,
  27192. props: buildProps({
  27193. direction: {
  27194. type: String,
  27195. values: ["horizontal", "vertical"]
  27196. }
  27197. }),
  27198. setup(__props) {
  27199. const props = __props;
  27200. const slots = useSlots();
  27201. const ns = useNamespace("container");
  27202. const isVertical = computed(() => {
  27203. if (props.direction === "vertical") {
  27204. return true;
  27205. } else if (props.direction === "horizontal") {
  27206. return false;
  27207. }
  27208. if (slots && slots.default) {
  27209. const vNodes = slots.default();
  27210. return vNodes.some((vNode) => {
  27211. const tag = vNode.type.name;
  27212. return tag === "ElHeader" || tag === "ElFooter";
  27213. });
  27214. } else {
  27215. return false;
  27216. }
  27217. });
  27218. return (_ctx, _cache) => {
  27219. return openBlock(), createElementBlock("section", {
  27220. class: normalizeClass([unref(ns).b(), unref(ns).is("vertical", unref(isVertical))])
  27221. }, [
  27222. renderSlot(_ctx.$slots, "default")
  27223. ], 2);
  27224. };
  27225. }
  27226. });
  27227. var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__file", "container.vue"]]);
  27228. const __default__$17 = defineComponent({
  27229. name: "ElAside"
  27230. });
  27231. const _sfc_main$1z = /* @__PURE__ */ defineComponent({
  27232. ...__default__$17,
  27233. props: {
  27234. width: {
  27235. type: String,
  27236. default: null
  27237. }
  27238. },
  27239. setup(__props) {
  27240. const props = __props;
  27241. const ns = useNamespace("aside");
  27242. const style = computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  27243. return (_ctx, _cache) => {
  27244. return openBlock(), createElementBlock("aside", {
  27245. class: normalizeClass(unref(ns).b()),
  27246. style: normalizeStyle(unref(style))
  27247. }, [
  27248. renderSlot(_ctx.$slots, "default")
  27249. ], 6);
  27250. };
  27251. }
  27252. });
  27253. var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "aside.vue"]]);
  27254. const __default__$16 = defineComponent({
  27255. name: "ElFooter"
  27256. });
  27257. const _sfc_main$1y = /* @__PURE__ */ defineComponent({
  27258. ...__default__$16,
  27259. props: {
  27260. height: {
  27261. type: String,
  27262. default: null
  27263. }
  27264. },
  27265. setup(__props) {
  27266. const props = __props;
  27267. const ns = useNamespace("footer");
  27268. const style = computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  27269. return (_ctx, _cache) => {
  27270. return openBlock(), createElementBlock("footer", {
  27271. class: normalizeClass(unref(ns).b()),
  27272. style: normalizeStyle(unref(style))
  27273. }, [
  27274. renderSlot(_ctx.$slots, "default")
  27275. ], 6);
  27276. };
  27277. }
  27278. });
  27279. var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "footer.vue"]]);
  27280. const __default__$15 = defineComponent({
  27281. name: "ElHeader"
  27282. });
  27283. const _sfc_main$1x = /* @__PURE__ */ defineComponent({
  27284. ...__default__$15,
  27285. props: {
  27286. height: {
  27287. type: String,
  27288. default: null
  27289. }
  27290. },
  27291. setup(__props) {
  27292. const props = __props;
  27293. const ns = useNamespace("header");
  27294. const style = computed(() => {
  27295. return props.height ? ns.cssVarBlock({
  27296. height: props.height
  27297. }) : {};
  27298. });
  27299. return (_ctx, _cache) => {
  27300. return openBlock(), createElementBlock("header", {
  27301. class: normalizeClass(unref(ns).b()),
  27302. style: normalizeStyle(unref(style))
  27303. }, [
  27304. renderSlot(_ctx.$slots, "default")
  27305. ], 6);
  27306. };
  27307. }
  27308. });
  27309. var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "header.vue"]]);
  27310. const __default__$14 = defineComponent({
  27311. name: "ElMain"
  27312. });
  27313. const _sfc_main$1w = /* @__PURE__ */ defineComponent({
  27314. ...__default__$14,
  27315. setup(__props) {
  27316. const ns = useNamespace("main");
  27317. return (_ctx, _cache) => {
  27318. return openBlock(), createElementBlock("main", {
  27319. class: normalizeClass(unref(ns).b())
  27320. }, [
  27321. renderSlot(_ctx.$slots, "default")
  27322. ], 2);
  27323. };
  27324. }
  27325. });
  27326. var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "main.vue"]]);
  27327. const ElContainer = withInstall(Container, {
  27328. Aside,
  27329. Footer: Footer$2,
  27330. Header: Header$1,
  27331. Main
  27332. });
  27333. const ElAside = withNoopInstall(Aside);
  27334. const ElFooter = withNoopInstall(Footer$2);
  27335. const ElHeader = withNoopInstall(Header$1);
  27336. const ElMain = withNoopInstall(Main);
  27337. var advancedFormat$1 = {exports: {}};
  27338. (function(module, exports) {
  27339. !function(e, t) {
  27340. module.exports = t() ;
  27341. }(commonjsGlobal, function() {
  27342. return function(e, t) {
  27343. var r = t.prototype, n = r.format;
  27344. r.format = function(e2) {
  27345. var t2 = this, r2 = this.$locale();
  27346. if (!this.isValid())
  27347. return n.bind(this)(e2);
  27348. var s = this.$utils(), a = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e3) {
  27349. switch (e3) {
  27350. case "Q":
  27351. return Math.ceil((t2.$M + 1) / 3);
  27352. case "Do":
  27353. return r2.ordinal(t2.$D);
  27354. case "gggg":
  27355. return t2.weekYear();
  27356. case "GGGG":
  27357. return t2.isoWeekYear();
  27358. case "wo":
  27359. return r2.ordinal(t2.week(), "W");
  27360. case "w":
  27361. case "ww":
  27362. return s.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  27363. case "W":
  27364. case "WW":
  27365. return s.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  27366. case "k":
  27367. case "kk":
  27368. return s.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  27369. case "X":
  27370. return Math.floor(t2.$d.getTime() / 1e3);
  27371. case "x":
  27372. return t2.$d.getTime();
  27373. case "z":
  27374. return "[" + t2.offsetName() + "]";
  27375. case "zzz":
  27376. return "[" + t2.offsetName("long") + "]";
  27377. default:
  27378. return e3;
  27379. }
  27380. });
  27381. return n.bind(this)(a);
  27382. };
  27383. };
  27384. });
  27385. })(advancedFormat$1);
  27386. var advancedFormat = advancedFormat$1.exports;
  27387. var weekOfYear$1 = {exports: {}};
  27388. (function(module, exports) {
  27389. !function(e, t) {
  27390. module.exports = t() ;
  27391. }(commonjsGlobal, function() {
  27392. var e = "week", t = "year";
  27393. return function(i, n, r) {
  27394. var f = n.prototype;
  27395. f.week = function(i2) {
  27396. if (i2 === void 0 && (i2 = null), i2 !== null)
  27397. return this.add(7 * (i2 - this.week()), "day");
  27398. var n2 = this.$locale().yearStart || 1;
  27399. if (this.month() === 11 && this.date() > 25) {
  27400. var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
  27401. if (f2.isBefore(s))
  27402. return 1;
  27403. }
  27404. var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
  27405. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  27406. }, f.weeks = function(e2) {
  27407. return e2 === void 0 && (e2 = null), this.week(e2);
  27408. };
  27409. };
  27410. });
  27411. })(weekOfYear$1);
  27412. var weekOfYear = weekOfYear$1.exports;
  27413. var weekYear$1 = {exports: {}};
  27414. (function(module, exports) {
  27415. !function(e, t) {
  27416. module.exports = t() ;
  27417. }(commonjsGlobal, function() {
  27418. return function(e, t) {
  27419. t.prototype.weekYear = function() {
  27420. var e2 = this.month(), t2 = this.week(), n = this.year();
  27421. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  27422. };
  27423. };
  27424. });
  27425. })(weekYear$1);
  27426. var weekYear = weekYear$1.exports;
  27427. var dayOfYear$1 = {exports: {}};
  27428. (function(module, exports) {
  27429. !function(e, t) {
  27430. module.exports = t() ;
  27431. }(commonjsGlobal, function() {
  27432. return function(e, t, n) {
  27433. t.prototype.dayOfYear = function(e2) {
  27434. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  27435. return e2 == null ? t2 : this.add(e2 - t2, "day");
  27436. };
  27437. };
  27438. });
  27439. })(dayOfYear$1);
  27440. var dayOfYear = dayOfYear$1.exports;
  27441. var isSameOrAfter$1 = {exports: {}};
  27442. (function(module, exports) {
  27443. !function(e, t) {
  27444. module.exports = t() ;
  27445. }(commonjsGlobal, function() {
  27446. return function(e, t) {
  27447. t.prototype.isSameOrAfter = function(e2, t2) {
  27448. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  27449. };
  27450. };
  27451. });
  27452. })(isSameOrAfter$1);
  27453. var isSameOrAfter = isSameOrAfter$1.exports;
  27454. var isSameOrBefore$1 = {exports: {}};
  27455. (function(module, exports) {
  27456. !function(e, i) {
  27457. module.exports = i() ;
  27458. }(commonjsGlobal, function() {
  27459. return function(e, i) {
  27460. i.prototype.isSameOrBefore = function(e2, i2) {
  27461. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  27462. };
  27463. };
  27464. });
  27465. })(isSameOrBefore$1);
  27466. var isSameOrBefore = isSameOrBefore$1.exports;
  27467. const datePickerPanelProps = buildProps({
  27468. valueFormat: String,
  27469. dateFormat: String,
  27470. timeFormat: String,
  27471. disabled: Boolean,
  27472. modelValue: {
  27473. type: definePropType([Date, Array, String, Number]),
  27474. default: ""
  27475. },
  27476. defaultValue: {
  27477. type: definePropType([Date, Array])
  27478. },
  27479. defaultTime: {
  27480. type: definePropType([Date, Array])
  27481. },
  27482. isRange: Boolean,
  27483. ...disabledTimeListsProps,
  27484. disabledDate: {
  27485. type: Function
  27486. },
  27487. cellClassName: {
  27488. type: Function
  27489. },
  27490. shortcuts: {
  27491. type: Array,
  27492. default: () => []
  27493. },
  27494. arrowControl: Boolean,
  27495. unlinkPanels: Boolean,
  27496. showNow: {
  27497. type: Boolean,
  27498. default: true
  27499. },
  27500. showConfirm: Boolean,
  27501. showFooter: Boolean,
  27502. showWeekNumber: Boolean,
  27503. type: {
  27504. type: definePropType(String),
  27505. default: "date"
  27506. },
  27507. clearable: {
  27508. type: Boolean,
  27509. default: true
  27510. },
  27511. border: {
  27512. type: Boolean,
  27513. default: true
  27514. }
  27515. });
  27516. const ROOT_PICKER_INJECTION_KEY = Symbol("rootPickerContextKey");
  27517. const ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY = "ElIsDefaultFormat";
  27518. const selectionModes = [
  27519. "date",
  27520. "dates",
  27521. "year",
  27522. "years",
  27523. "month",
  27524. "months",
  27525. "week",
  27526. "range"
  27527. ];
  27528. const datePickerSharedProps = buildProps({
  27529. cellClassName: {
  27530. type: definePropType(Function)
  27531. },
  27532. disabledDate: {
  27533. type: definePropType(Function)
  27534. },
  27535. date: {
  27536. type: definePropType(Object),
  27537. required: true
  27538. },
  27539. minDate: {
  27540. type: definePropType(Object)
  27541. },
  27542. maxDate: {
  27543. type: definePropType(Object)
  27544. },
  27545. parsedValue: {
  27546. type: definePropType([Object, Array])
  27547. },
  27548. rangeState: {
  27549. type: definePropType(Object),
  27550. default: () => ({
  27551. endDate: null,
  27552. selecting: false
  27553. })
  27554. },
  27555. disabled: Boolean
  27556. });
  27557. const panelSharedProps = buildProps({
  27558. type: {
  27559. type: definePropType(String),
  27560. required: true,
  27561. values: datePickTypes
  27562. },
  27563. dateFormat: String,
  27564. timeFormat: String,
  27565. showNow: {
  27566. type: Boolean,
  27567. default: true
  27568. },
  27569. showConfirm: Boolean,
  27570. showFooter: {
  27571. type: Boolean,
  27572. default: true
  27573. },
  27574. showWeekNumber: Boolean,
  27575. border: Boolean,
  27576. disabled: Boolean
  27577. });
  27578. const panelRangeSharedProps = buildProps({
  27579. unlinkPanels: Boolean,
  27580. visible: {
  27581. type: Boolean,
  27582. default: true
  27583. },
  27584. showConfirm: Boolean,
  27585. showFooter: {
  27586. type: Boolean,
  27587. default: true
  27588. },
  27589. border: Boolean,
  27590. disabled: Boolean,
  27591. parsedValue: {
  27592. type: definePropType(Array)
  27593. }
  27594. });
  27595. const selectionModeWithDefault = (mode) => {
  27596. return {
  27597. type: String,
  27598. values: selectionModes,
  27599. default: mode
  27600. };
  27601. };
  27602. const panelDatePickProps = buildProps({
  27603. ...panelSharedProps,
  27604. parsedValue: {
  27605. type: definePropType([Object, Array])
  27606. },
  27607. visible: {
  27608. type: Boolean,
  27609. default: true
  27610. },
  27611. format: {
  27612. type: String,
  27613. default: ""
  27614. }
  27615. });
  27616. const isValidRange = (range) => {
  27617. if (!isArray$1(range))
  27618. return false;
  27619. const [left, right] = range;
  27620. return dayjs.isDayjs(left) && dayjs.isDayjs(right) && dayjs(left).isValid() && dayjs(right).isValid() && left.isSameOrBefore(right);
  27621. };
  27622. const getDefaultValue = (defaultValue, { lang, step = 1, unit, unlinkPanels }) => {
  27623. let start;
  27624. if (isArray$1(defaultValue)) {
  27625. let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
  27626. if (!unlinkPanels) {
  27627. right = left.add(step, unit);
  27628. }
  27629. return [left, right];
  27630. } else if (defaultValue) {
  27631. start = dayjs(defaultValue);
  27632. } else {
  27633. start = dayjs();
  27634. }
  27635. start = start.locale(lang);
  27636. return [start, start.add(step, unit)];
  27637. };
  27638. const buildPickerTable = (dimension, rows, {
  27639. columnIndexOffset,
  27640. startDate,
  27641. nextEndDate,
  27642. now,
  27643. unit,
  27644. relativeDateGetter,
  27645. setCellMetadata,
  27646. setRowMetadata
  27647. }) => {
  27648. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  27649. const row = rows[rowIndex];
  27650. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  27651. let cell = row[columnIndex + columnIndexOffset];
  27652. if (!cell) {
  27653. cell = {
  27654. row: rowIndex,
  27655. column: columnIndex,
  27656. type: "normal",
  27657. inRange: false,
  27658. start: false,
  27659. end: false
  27660. };
  27661. }
  27662. const index = rowIndex * dimension.column + columnIndex;
  27663. const nextStartDate = relativeDateGetter(index);
  27664. cell.dayjs = nextStartDate;
  27665. cell.date = nextStartDate.toDate();
  27666. cell.timestamp = nextStartDate.valueOf();
  27667. cell.type = "normal";
  27668. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  27669. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  27670. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  27671. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  27672. } else {
  27673. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  27674. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  27675. }
  27676. const isToday = nextStartDate.isSame(now, unit);
  27677. if (isToday) {
  27678. cell.type = "today";
  27679. }
  27680. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  27681. row[columnIndex + columnIndexOffset] = cell;
  27682. }
  27683. setRowMetadata == null ? void 0 : setRowMetadata(row);
  27684. }
  27685. };
  27686. const datesInMonth = (date, year, month, lang) => {
  27687. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year).hour(date.hour()).minute(date.minute()).second(date.second());
  27688. const numOfDays = firstDay.daysInMonth();
  27689. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  27690. };
  27691. const getValidDateOfMonth = (date, year, month, lang, disabledDate) => {
  27692. const _value = dayjs().year(year).month(month).startOf("month").hour(date.hour()).minute(date.minute()).second(date.second());
  27693. const _date = datesInMonth(date, year, month, lang).find((date2) => {
  27694. return !(disabledDate == null ? void 0 : disabledDate(date2));
  27695. });
  27696. if (_date) {
  27697. return dayjs(_date).locale(lang);
  27698. }
  27699. return _value.locale(lang);
  27700. };
  27701. const getValidDateOfYear = (value, lang, disabledDate) => {
  27702. const year = value.year();
  27703. if (!(disabledDate == null ? void 0 : disabledDate(value.toDate()))) {
  27704. return value.locale(lang);
  27705. }
  27706. const month = value.month();
  27707. if (!datesInMonth(value, year, month, lang).every(disabledDate)) {
  27708. return getValidDateOfMonth(value, year, month, lang, disabledDate);
  27709. }
  27710. for (let i = 0; i < 12; i++) {
  27711. if (!datesInMonth(value, year, i, lang).every(disabledDate)) {
  27712. return getValidDateOfMonth(value, year, i, lang, disabledDate);
  27713. }
  27714. }
  27715. return value;
  27716. };
  27717. const correctlyParseUserInput = (value, format, lang, defaultFormat) => {
  27718. if (isArray$1(value)) {
  27719. return value.map((v) => correctlyParseUserInput(v, format, lang, defaultFormat));
  27720. }
  27721. if (isString$1(value)) {
  27722. const dayjsValue = (defaultFormat == null ? void 0 : defaultFormat.value) ? dayjs(value) : dayjs(value, format);
  27723. if (!dayjsValue.isValid()) {
  27724. return dayjsValue;
  27725. }
  27726. }
  27727. return dayjs(value, format).locale(lang);
  27728. };
  27729. const basicDateTableProps = buildProps({
  27730. ...datePickerSharedProps,
  27731. showWeekNumber: Boolean,
  27732. selectionMode: selectionModeWithDefault("date")
  27733. });
  27734. const basicDateTableEmits = ["changerange", "pick", "select"];
  27735. const isNormalDay = (type = "") => {
  27736. return ["normal", "today"].includes(type);
  27737. };
  27738. const useBasicDateTable = (props, emit) => {
  27739. const { lang } = useLocale();
  27740. const tbodyRef = ref();
  27741. const currentCellRef = ref();
  27742. const lastRow = ref();
  27743. const lastColumn = ref();
  27744. const tableRows = ref([[], [], [], [], [], []]);
  27745. let focusWithClick = false;
  27746. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  27747. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  27748. const offsetDay = computed(() => {
  27749. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  27750. });
  27751. const startDate = computed(() => {
  27752. const startDayOfMonth = props.date.startOf("month");
  27753. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  27754. });
  27755. const WEEKS = computed(() => {
  27756. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  27757. });
  27758. const hasCurrent = computed(() => {
  27759. return flatten(unref(rows)).some((row) => {
  27760. return row.isCurrent;
  27761. });
  27762. });
  27763. const days = computed(() => {
  27764. const startOfMonth = props.date.startOf("month");
  27765. const startOfMonthDay = startOfMonth.day() || 7;
  27766. const dateCountOfMonth = startOfMonth.daysInMonth();
  27767. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  27768. return {
  27769. startOfMonthDay,
  27770. dateCountOfMonth,
  27771. dateCountOfLastMonth
  27772. };
  27773. });
  27774. const selectedDate = computed(() => {
  27775. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  27776. });
  27777. const setDateText = (cell, { count, rowIndex, columnIndex }) => {
  27778. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = unref(days);
  27779. const offset = unref(offsetDay);
  27780. if (rowIndex >= 0 && rowIndex <= 1) {
  27781. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  27782. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  27783. cell.text = count;
  27784. return true;
  27785. } else {
  27786. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  27787. cell.type = "prev-month";
  27788. }
  27789. } else {
  27790. if (count <= dateCountOfMonth) {
  27791. cell.text = count;
  27792. } else {
  27793. cell.text = count - dateCountOfMonth;
  27794. cell.type = "next-month";
  27795. }
  27796. return true;
  27797. }
  27798. return false;
  27799. };
  27800. const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
  27801. const { disabledDate, cellClassName } = props;
  27802. const _selectedDate = unref(selectedDate);
  27803. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  27804. const cellDate = cell.dayjs.toDate();
  27805. cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
  27806. cell.isSelected = !!cell.selected;
  27807. cell.isCurrent = isCurrent(cell);
  27808. cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
  27809. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  27810. return shouldIncrement;
  27811. };
  27812. const setRowMetadata = (row) => {
  27813. if (props.selectionMode === "week") {
  27814. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  27815. const isActive = isWeekActive(row[start + 1]);
  27816. row[start].inRange = isActive;
  27817. row[start].start = isActive;
  27818. row[end].inRange = isActive;
  27819. row[end].end = isActive;
  27820. }
  27821. };
  27822. const rows = computed(() => {
  27823. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  27824. const offset = unref(offsetDay);
  27825. const rows_ = unref(tableRows);
  27826. const dateUnit = "day";
  27827. let count = 1;
  27828. buildPickerTable({ row: 6, column: 7 }, rows_, {
  27829. startDate: minDate,
  27830. columnIndexOffset: showWeekNumber ? 1 : 0,
  27831. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  27832. now: dayjs().locale(unref(lang)).startOf(dateUnit),
  27833. unit: dateUnit,
  27834. relativeDateGetter: (idx) => unref(startDate).add(idx - offset, dateUnit),
  27835. setCellMetadata: (...args) => {
  27836. if (setCellMetadata(...args, count)) {
  27837. count += 1;
  27838. }
  27839. },
  27840. setRowMetadata
  27841. });
  27842. if (showWeekNumber) {
  27843. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  27844. if (rows_[rowIndex][1].dayjs) {
  27845. rows_[rowIndex][0] = {
  27846. type: "week",
  27847. text: rows_[rowIndex][1].dayjs.week()
  27848. };
  27849. }
  27850. }
  27851. }
  27852. return rows_;
  27853. });
  27854. watch(() => props.date, async () => {
  27855. var _a;
  27856. if ((_a = unref(tbodyRef)) == null ? void 0 : _a.contains(document.activeElement)) {
  27857. await nextTick();
  27858. await focus();
  27859. }
  27860. });
  27861. const focus = async () => {
  27862. var _a;
  27863. return (_a = unref(currentCellRef)) == null ? void 0 : _a.focus();
  27864. };
  27865. const isCurrent = (cell) => {
  27866. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  27867. };
  27868. const cellMatchesDate = (cell, date) => {
  27869. if (!date)
  27870. return false;
  27871. return dayjs(date).locale(unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
  27872. };
  27873. const getDateOfCell = (row, column) => {
  27874. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - unref(offsetDay);
  27875. return unref(startDate).add(offsetFromStart, "day");
  27876. };
  27877. const handleMouseMove = (event) => {
  27878. var _a;
  27879. if (!props.rangeState.selecting)
  27880. return;
  27881. let target = event.target;
  27882. if (target.tagName === "SPAN") {
  27883. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  27884. }
  27885. if (target.tagName === "DIV") {
  27886. target = target.parentNode;
  27887. }
  27888. if (target.tagName !== "TD")
  27889. return;
  27890. const row = target.parentNode.rowIndex - 1;
  27891. const column = target.cellIndex;
  27892. if (unref(rows)[row][column].disabled)
  27893. return;
  27894. if (row !== unref(lastRow) || column !== unref(lastColumn)) {
  27895. lastRow.value = row;
  27896. lastColumn.value = column;
  27897. emit("changerange", {
  27898. selecting: true,
  27899. endDate: getDateOfCell(row, column)
  27900. });
  27901. }
  27902. };
  27903. const isSelectedCell = (cell) => {
  27904. return !unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  27905. };
  27906. const handleFocus = (event) => {
  27907. if (focusWithClick || unref(hasCurrent) || props.selectionMode !== "date")
  27908. return;
  27909. handlePickDate(event, true);
  27910. };
  27911. const handleMouseDown = (event) => {
  27912. const target = event.target.closest("td");
  27913. if (!target)
  27914. return;
  27915. focusWithClick = true;
  27916. };
  27917. const handleMouseUp = (event) => {
  27918. const target = event.target.closest("td");
  27919. if (!target)
  27920. return;
  27921. focusWithClick = false;
  27922. };
  27923. const handleRangePick = (newDate) => {
  27924. if (!props.rangeState.selecting || !props.minDate) {
  27925. emit("pick", { minDate: newDate, maxDate: null });
  27926. emit("select", true);
  27927. } else {
  27928. if (newDate >= props.minDate) {
  27929. emit("pick", { minDate: props.minDate, maxDate: newDate });
  27930. } else {
  27931. emit("pick", { minDate: newDate, maxDate: props.minDate });
  27932. }
  27933. emit("select", false);
  27934. }
  27935. };
  27936. const handleWeekPick = (newDate) => {
  27937. const weekNumber = newDate.week();
  27938. const value = `${newDate.year()}w${weekNumber}`;
  27939. emit("pick", {
  27940. year: newDate.year(),
  27941. week: weekNumber,
  27942. value,
  27943. date: newDate.startOf("week")
  27944. });
  27945. };
  27946. const handleDatesPick = (newDate, selected) => {
  27947. const newValue = selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  27948. emit("pick", newValue);
  27949. };
  27950. const handlePickDate = (event, isKeyboardMovement = false) => {
  27951. if (props.disabled)
  27952. return;
  27953. const target = event.target.closest("td");
  27954. if (!target)
  27955. return;
  27956. const row = target.parentNode.rowIndex - 1;
  27957. const column = target.cellIndex;
  27958. const cell = unref(rows)[row][column];
  27959. if (cell.disabled || cell.type === "week")
  27960. return;
  27961. const newDate = getDateOfCell(row, column);
  27962. switch (props.selectionMode) {
  27963. case "range": {
  27964. handleRangePick(newDate);
  27965. break;
  27966. }
  27967. case "date": {
  27968. emit("pick", newDate, isKeyboardMovement);
  27969. break;
  27970. }
  27971. case "week": {
  27972. handleWeekPick(newDate);
  27973. break;
  27974. }
  27975. case "dates": {
  27976. handleDatesPick(newDate, !!cell.selected);
  27977. break;
  27978. }
  27979. }
  27980. };
  27981. const isWeekActive = (cell) => {
  27982. if (props.selectionMode !== "week")
  27983. return false;
  27984. let newDate = props.date.startOf("day");
  27985. if (cell.type === "prev-month") {
  27986. newDate = newDate.subtract(1, "month");
  27987. }
  27988. if (cell.type === "next-month") {
  27989. newDate = newDate.add(1, "month");
  27990. }
  27991. newDate = newDate.date(Number.parseInt(cell.text, 10));
  27992. if (props.parsedValue && !isArray$1(props.parsedValue)) {
  27993. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  27994. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  27995. return weekDate.isSame(newDate, "day");
  27996. }
  27997. return false;
  27998. };
  27999. return {
  28000. WEEKS,
  28001. rows,
  28002. tbodyRef,
  28003. currentCellRef,
  28004. focus,
  28005. isCurrent,
  28006. isWeekActive,
  28007. isSelectedCell,
  28008. handlePickDate,
  28009. handleMouseUp,
  28010. handleMouseDown,
  28011. handleMouseMove,
  28012. handleFocus
  28013. };
  28014. };
  28015. const useBasicDateTableDOM = (props, {
  28016. isCurrent,
  28017. isWeekActive
  28018. }) => {
  28019. const ns = useNamespace("date-table");
  28020. const { t } = useLocale();
  28021. const tableKls = computed(() => [
  28022. ns.b(),
  28023. ns.is("week-mode", props.selectionMode === "week" && !props.disabled)
  28024. ]);
  28025. const tableLabel = computed(() => t("el.datepicker.dateTablePrompt"));
  28026. const getCellClasses = (cell) => {
  28027. const classes = [];
  28028. if (isNormalDay(cell.type) && !cell.disabled) {
  28029. classes.push("available");
  28030. if (cell.type === "today") {
  28031. classes.push("today");
  28032. }
  28033. } else {
  28034. classes.push(cell.type);
  28035. }
  28036. if (isCurrent(cell)) {
  28037. classes.push("current");
  28038. }
  28039. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  28040. classes.push("in-range");
  28041. if (cell.start) {
  28042. classes.push("start-date");
  28043. }
  28044. if (cell.end) {
  28045. classes.push("end-date");
  28046. }
  28047. }
  28048. if (cell.disabled || props.disabled) {
  28049. classes.push("disabled");
  28050. }
  28051. if (cell.selected) {
  28052. classes.push("selected");
  28053. }
  28054. if (cell.customClass) {
  28055. classes.push(cell.customClass);
  28056. }
  28057. return classes.join(" ");
  28058. };
  28059. const getRowKls = (cell) => [
  28060. ns.e("row"),
  28061. { current: isWeekActive(cell) }
  28062. ];
  28063. return {
  28064. tableKls,
  28065. tableLabel,
  28066. weekHeaderClass: ns.e("week-header"),
  28067. getCellClasses,
  28068. getRowKls,
  28069. t
  28070. };
  28071. };
  28072. const basicCellProps = buildProps({
  28073. cell: {
  28074. type: definePropType(Object)
  28075. }
  28076. });
  28077. var ElDatePickerCell = defineComponent({
  28078. name: "ElDatePickerCell",
  28079. props: basicCellProps,
  28080. setup(props) {
  28081. const ns = useNamespace("date-table-cell");
  28082. const {
  28083. slots
  28084. } = inject(ROOT_PICKER_INJECTION_KEY);
  28085. return () => {
  28086. const {
  28087. cell
  28088. } = props;
  28089. return renderSlot(slots, "default", {
  28090. ...cell
  28091. }, () => {
  28092. var _a;
  28093. return [createVNode("div", {
  28094. "class": ns.b()
  28095. }, [createVNode("span", {
  28096. "class": ns.e("text")
  28097. }, [(_a = cell == null ? void 0 : cell.renderText) != null ? _a : cell == null ? void 0 : cell.text])])];
  28098. });
  28099. };
  28100. }
  28101. });
  28102. const _sfc_main$1v = /* @__PURE__ */ defineComponent({
  28103. __name: "basic-date-table",
  28104. props: basicDateTableProps,
  28105. emits: basicDateTableEmits,
  28106. setup(__props, { expose, emit }) {
  28107. const props = __props;
  28108. const {
  28109. WEEKS,
  28110. rows,
  28111. tbodyRef,
  28112. currentCellRef,
  28113. focus,
  28114. isCurrent,
  28115. isWeekActive,
  28116. isSelectedCell,
  28117. handlePickDate,
  28118. handleMouseUp,
  28119. handleMouseDown,
  28120. handleMouseMove,
  28121. handleFocus
  28122. } = useBasicDateTable(props, emit);
  28123. const { tableLabel, tableKls, getCellClasses, getRowKls, weekHeaderClass, t } = useBasicDateTableDOM(props, {
  28124. isCurrent,
  28125. isWeekActive
  28126. });
  28127. let isUnmounting = false;
  28128. onBeforeUnmount(() => {
  28129. isUnmounting = true;
  28130. });
  28131. expose({
  28132. focus
  28133. });
  28134. return (_ctx, _cache) => {
  28135. return openBlock(), createElementBlock("table", {
  28136. "aria-label": unref(tableLabel),
  28137. class: normalizeClass(unref(tableKls)),
  28138. cellspacing: "0",
  28139. cellpadding: "0",
  28140. role: "grid",
  28141. onClick: unref(handlePickDate),
  28142. onMousemove: unref(handleMouseMove),
  28143. onMousedown: unref(handleMouseDown),
  28144. onMouseup: unref(handleMouseUp)
  28145. }, [
  28146. createElementVNode("tbody", {
  28147. ref_key: "tbodyRef",
  28148. ref: tbodyRef
  28149. }, [
  28150. createElementVNode("tr", null, [
  28151. _ctx.showWeekNumber ? (openBlock(), createElementBlock("th", {
  28152. key: 0,
  28153. scope: "col",
  28154. class: normalizeClass(unref(weekHeaderClass))
  28155. }, null, 2)) : createCommentVNode("v-if", true),
  28156. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(WEEKS), (week, key) => {
  28157. return openBlock(), createElementBlock("th", {
  28158. key,
  28159. "aria-label": unref(t)("el.datepicker.weeksFull." + week),
  28160. scope: "col"
  28161. }, toDisplayString(unref(t)("el.datepicker.weeks." + week)), 9, ["aria-label"]);
  28162. }), 128))
  28163. ]),
  28164. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
  28165. return openBlock(), createElementBlock("tr", {
  28166. key: rowKey,
  28167. class: normalizeClass(unref(getRowKls)(_ctx.showWeekNumber ? row[2] : row[1]))
  28168. }, [
  28169. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, columnKey) => {
  28170. return openBlock(), createElementBlock("td", {
  28171. key: `${rowKey}.${columnKey}`,
  28172. ref_for: true,
  28173. ref: (el) => !unref(isUnmounting) && unref(isSelectedCell)(cell) && (currentCellRef.value = el),
  28174. class: normalizeClass(unref(getCellClasses)(cell)),
  28175. "aria-current": cell.isCurrent ? "date" : void 0,
  28176. "aria-selected": cell.isCurrent,
  28177. tabindex: unref(isSelectedCell)(cell) ? 0 : -1,
  28178. onFocus: unref(handleFocus)
  28179. }, [
  28180. createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  28181. ], 42, ["aria-current", "aria-selected", "tabindex", "onFocus"]);
  28182. }), 128))
  28183. ], 2);
  28184. }), 128))
  28185. ], 512)
  28186. ], 42, ["aria-label", "onClick", "onMousemove", "onMousedown", "onMouseup"]);
  28187. };
  28188. }
  28189. });
  28190. var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["__file", "basic-date-table.vue"]]);
  28191. const basicMonthTableProps = buildProps({
  28192. ...datePickerSharedProps,
  28193. selectionMode: selectionModeWithDefault("month")
  28194. });
  28195. const _sfc_main$1u = /* @__PURE__ */ defineComponent({
  28196. __name: "basic-month-table",
  28197. props: basicMonthTableProps,
  28198. emits: ["changerange", "pick", "select"],
  28199. setup(__props, { expose, emit }) {
  28200. const props = __props;
  28201. const ns = useNamespace("month-table");
  28202. const { t, lang } = useLocale();
  28203. const tbodyRef = ref();
  28204. const currentCellRef = ref();
  28205. const months = ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  28206. const tableRows = ref([[], [], []]);
  28207. const lastRow = ref();
  28208. const lastColumn = ref();
  28209. const rows = computed(() => {
  28210. var _a, _b, _c;
  28211. const rows2 = tableRows.value;
  28212. const now = dayjs().locale(lang.value).startOf("month");
  28213. for (let i = 0; i < 3; i++) {
  28214. const row = rows2[i];
  28215. for (let j = 0; j < 4; j++) {
  28216. const cell = row[j] || (row[j] = {
  28217. row: i,
  28218. column: j,
  28219. type: "normal",
  28220. inRange: false,
  28221. start: false,
  28222. end: false,
  28223. text: -1,
  28224. disabled: false,
  28225. isSelected: false,
  28226. customClass: void 0,
  28227. date: void 0,
  28228. dayjs: void 0,
  28229. isCurrent: void 0,
  28230. selected: void 0,
  28231. renderText: void 0,
  28232. timestamp: void 0
  28233. });
  28234. cell.type = "normal";
  28235. const index = i * 4 + j;
  28236. const calTime = props.date.startOf("year").month(index);
  28237. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  28238. 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"));
  28239. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  28240. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  28241. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  28242. } else {
  28243. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  28244. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  28245. }
  28246. const isToday = now.isSame(calTime);
  28247. if (isToday) {
  28248. cell.type = "today";
  28249. }
  28250. const cellDate = calTime.toDate();
  28251. cell.text = index;
  28252. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, cellDate)) || false;
  28253. cell.date = cellDate;
  28254. cell.customClass = (_c = props.cellClassName) == null ? void 0 : _c.call(props, cellDate);
  28255. cell.dayjs = calTime;
  28256. cell.timestamp = calTime.valueOf();
  28257. cell.isSelected = isSelectedCell(cell);
  28258. }
  28259. }
  28260. return rows2;
  28261. });
  28262. const focus = () => {
  28263. var _a;
  28264. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  28265. };
  28266. const getCellStyle = (cell) => {
  28267. const style = {};
  28268. const year = props.date.year();
  28269. const today = /* @__PURE__ */ new Date();
  28270. const month = cell.text;
  28271. style.disabled = props.disabled || (props.disabledDate ? datesInMonth(props.date, year, month, lang.value).every(props.disabledDate) : false);
  28272. style.current = castArray(props.parsedValue).some((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month);
  28273. style.today = today.getFullYear() === year && today.getMonth() === month;
  28274. if (cell.customClass) {
  28275. style[cell.customClass] = true;
  28276. }
  28277. if (cell.inRange) {
  28278. style["in-range"] = true;
  28279. if (cell.start) {
  28280. style["start-date"] = true;
  28281. }
  28282. if (cell.end) {
  28283. style["end-date"] = true;
  28284. }
  28285. }
  28286. return style;
  28287. };
  28288. const isSelectedCell = (cell) => {
  28289. const year = props.date.year();
  28290. const month = cell.text;
  28291. return castArray(props.date).some((date) => date.year() === year && date.month() === month);
  28292. };
  28293. const handleMouseMove = (event) => {
  28294. var _a;
  28295. if (!props.rangeState.selecting)
  28296. return;
  28297. let target = event.target;
  28298. if (target.tagName === "SPAN") {
  28299. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  28300. }
  28301. if (target.tagName === "DIV") {
  28302. target = target.parentNode;
  28303. }
  28304. if (target.tagName !== "TD")
  28305. return;
  28306. const row = target.parentNode.rowIndex;
  28307. const column = target.cellIndex;
  28308. if (rows.value[row][column].disabled)
  28309. return;
  28310. if (row !== lastRow.value || column !== lastColumn.value) {
  28311. lastRow.value = row;
  28312. lastColumn.value = column;
  28313. emit("changerange", {
  28314. selecting: true,
  28315. endDate: props.date.startOf("year").month(row * 4 + column)
  28316. });
  28317. }
  28318. };
  28319. const handleMonthTableClick = (event) => {
  28320. var _a;
  28321. if (props.disabled)
  28322. return;
  28323. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  28324. if ((target == null ? void 0 : target.tagName) !== "TD")
  28325. return;
  28326. if (hasClass(target, "disabled"))
  28327. return;
  28328. const column = target.cellIndex;
  28329. const row = target.parentNode.rowIndex;
  28330. const month = row * 4 + column;
  28331. const newDate = props.date.startOf("year").month(month);
  28332. if (props.selectionMode === "months") {
  28333. if (event.type === "keydown") {
  28334. emit("pick", castArray(props.parsedValue), false);
  28335. return;
  28336. }
  28337. const newMonth = getValidDateOfMonth(props.date, props.date.year(), month, lang.value, props.disabledDate);
  28338. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== newMonth.year() || (d == null ? void 0 : d.month()) !== newMonth.month()) : castArray(props.parsedValue).concat([dayjs(newMonth)]);
  28339. emit("pick", newValue);
  28340. } else if (props.selectionMode === "range") {
  28341. if (!props.rangeState.selecting) {
  28342. emit("pick", { minDate: newDate, maxDate: null });
  28343. emit("select", true);
  28344. } else {
  28345. if (props.minDate && newDate >= props.minDate) {
  28346. emit("pick", { minDate: props.minDate, maxDate: newDate });
  28347. } else {
  28348. emit("pick", { minDate: newDate, maxDate: props.minDate });
  28349. }
  28350. emit("select", false);
  28351. }
  28352. } else {
  28353. emit("pick", month);
  28354. }
  28355. };
  28356. watch(() => props.date, async () => {
  28357. var _a, _b;
  28358. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  28359. await nextTick();
  28360. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  28361. }
  28362. });
  28363. expose({
  28364. focus
  28365. });
  28366. return (_ctx, _cache) => {
  28367. return openBlock(), createElementBlock("table", {
  28368. role: "grid",
  28369. "aria-label": unref(t)("el.datepicker.monthTablePrompt"),
  28370. class: normalizeClass(unref(ns).b()),
  28371. onClick: handleMonthTableClick,
  28372. onMousemove: handleMouseMove
  28373. }, [
  28374. createElementVNode("tbody", {
  28375. ref_key: "tbodyRef",
  28376. ref: tbodyRef
  28377. }, [
  28378. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, key) => {
  28379. return openBlock(), createElementBlock("tr", { key }, [
  28380. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  28381. return openBlock(), createElementBlock("td", {
  28382. key: key_,
  28383. ref_for: true,
  28384. ref: (el) => cell.isSelected && (currentCellRef.value = el),
  28385. class: normalizeClass(getCellStyle(cell)),
  28386. "aria-selected": !!cell.isSelected,
  28387. "aria-label": unref(t)(`el.datepicker.month${+cell.text + 1}`),
  28388. tabindex: cell.isSelected ? 0 : -1,
  28389. onKeydown: [
  28390. withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  28391. withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  28392. ]
  28393. }, [
  28394. createVNode(unref(ElDatePickerCell), {
  28395. cell: {
  28396. ...cell,
  28397. renderText: unref(t)("el.datepicker.months." + months.value[cell.text])
  28398. }
  28399. }, null, 8, ["cell"])
  28400. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  28401. }), 128))
  28402. ]);
  28403. }), 128))
  28404. ], 512)
  28405. ], 42, ["aria-label"]);
  28406. };
  28407. }
  28408. });
  28409. var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["__file", "basic-month-table.vue"]]);
  28410. const basicYearTableProps = buildProps({
  28411. ...datePickerSharedProps,
  28412. selectionMode: selectionModeWithDefault("year")
  28413. });
  28414. const _sfc_main$1t = /* @__PURE__ */ defineComponent({
  28415. __name: "basic-year-table",
  28416. props: basicYearTableProps,
  28417. emits: ["changerange", "pick", "select"],
  28418. setup(__props, { expose, emit }) {
  28419. const props = __props;
  28420. const datesInYear = (year, lang2) => {
  28421. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  28422. const lastDay = firstDay.endOf("year");
  28423. const numOfDays = lastDay.dayOfYear();
  28424. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  28425. };
  28426. const ns = useNamespace("year-table");
  28427. const { t, lang } = useLocale();
  28428. const tbodyRef = ref();
  28429. const currentCellRef = ref();
  28430. const startYear = computed(() => {
  28431. return Math.floor(props.date.year() / 10) * 10;
  28432. });
  28433. const tableRows = ref([[], [], []]);
  28434. const lastRow = ref();
  28435. const lastColumn = ref();
  28436. const rows = computed(() => {
  28437. var _a, _b, _c;
  28438. const rows2 = tableRows.value;
  28439. const now = dayjs().locale(lang.value).startOf("year");
  28440. for (let i = 0; i < 3; i++) {
  28441. const row = rows2[i];
  28442. for (let j = 0; j < 4; j++) {
  28443. if (i * 4 + j >= 10) {
  28444. break;
  28445. }
  28446. let cell = row[j];
  28447. if (!cell) {
  28448. cell = {
  28449. row: i,
  28450. column: j,
  28451. type: "normal",
  28452. inRange: false,
  28453. start: false,
  28454. end: false,
  28455. text: -1,
  28456. disabled: false,
  28457. isSelected: false,
  28458. customClass: void 0,
  28459. date: void 0,
  28460. dayjs: void 0,
  28461. isCurrent: void 0,
  28462. selected: void 0,
  28463. renderText: void 0,
  28464. timestamp: void 0
  28465. };
  28466. }
  28467. cell.type = "normal";
  28468. const index = i * 4 + j + startYear.value;
  28469. const calTime = dayjs().year(index);
  28470. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  28471. 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"));
  28472. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  28473. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  28474. cell.end = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  28475. } else {
  28476. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  28477. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  28478. }
  28479. const isToday = now.isSame(calTime);
  28480. if (isToday) {
  28481. cell.type = "today";
  28482. }
  28483. cell.text = index;
  28484. const cellDate = calTime.toDate();
  28485. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, cellDate)) || false;
  28486. cell.date = cellDate;
  28487. cell.customClass = (_c = props.cellClassName) == null ? void 0 : _c.call(props, cellDate);
  28488. cell.dayjs = calTime;
  28489. cell.timestamp = calTime.valueOf();
  28490. cell.isSelected = isSelectedCell(cell);
  28491. row[j] = cell;
  28492. }
  28493. }
  28494. return rows2;
  28495. });
  28496. const focus = () => {
  28497. var _a;
  28498. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  28499. };
  28500. const getCellKls = (cell) => {
  28501. const kls = {};
  28502. const today = dayjs().locale(lang.value);
  28503. const year = cell.text;
  28504. kls.disabled = props.disabled || (props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false);
  28505. kls.today = today.year() === year;
  28506. kls.current = castArray(props.parsedValue).some((d) => d.year() === year);
  28507. if (cell.customClass) {
  28508. kls[cell.customClass] = true;
  28509. }
  28510. if (cell.inRange) {
  28511. kls["in-range"] = true;
  28512. if (cell.start) {
  28513. kls["start-date"] = true;
  28514. }
  28515. if (cell.end) {
  28516. kls["end-date"] = true;
  28517. }
  28518. }
  28519. return kls;
  28520. };
  28521. const isSelectedCell = (cell) => {
  28522. const year = cell.text;
  28523. return castArray(props.date).some((date) => date.year() === year);
  28524. };
  28525. const handleYearTableClick = (event) => {
  28526. var _a;
  28527. if (props.disabled)
  28528. return;
  28529. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  28530. if (!target || !target.textContent || hasClass(target, "disabled"))
  28531. return;
  28532. const column = target.cellIndex;
  28533. const row = target.parentNode.rowIndex;
  28534. const selectedYear = row * 4 + column + startYear.value;
  28535. const newDate = dayjs().year(selectedYear);
  28536. if (props.selectionMode === "range") {
  28537. if (!props.rangeState.selecting) {
  28538. emit("pick", { minDate: newDate, maxDate: null });
  28539. emit("select", true);
  28540. } else {
  28541. if (props.minDate && newDate >= props.minDate) {
  28542. emit("pick", { minDate: props.minDate, maxDate: newDate });
  28543. } else {
  28544. emit("pick", { minDate: newDate, maxDate: props.minDate });
  28545. }
  28546. emit("select", false);
  28547. }
  28548. } else if (props.selectionMode === "years") {
  28549. if (event.type === "keydown") {
  28550. emit("pick", castArray(props.parsedValue), false);
  28551. return;
  28552. }
  28553. const vaildYear = getValidDateOfYear(newDate.startOf("year"), lang.value, props.disabledDate);
  28554. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== selectedYear) : castArray(props.parsedValue).concat([vaildYear]);
  28555. emit("pick", newValue);
  28556. } else {
  28557. emit("pick", selectedYear);
  28558. }
  28559. };
  28560. const handleMouseMove = (event) => {
  28561. var _a;
  28562. if (!props.rangeState.selecting)
  28563. return;
  28564. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  28565. if (!target)
  28566. return;
  28567. const row = target.parentNode.rowIndex;
  28568. const column = target.cellIndex;
  28569. if (rows.value[row][column].disabled)
  28570. return;
  28571. if (row !== lastRow.value || column !== lastColumn.value) {
  28572. lastRow.value = row;
  28573. lastColumn.value = column;
  28574. emit("changerange", {
  28575. selecting: true,
  28576. endDate: dayjs().year(startYear.value).add(row * 4 + column, "year")
  28577. });
  28578. }
  28579. };
  28580. watch(() => props.date, async () => {
  28581. var _a, _b;
  28582. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  28583. await nextTick();
  28584. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  28585. }
  28586. });
  28587. expose({
  28588. focus
  28589. });
  28590. return (_ctx, _cache) => {
  28591. return openBlock(), createElementBlock("table", {
  28592. role: "grid",
  28593. "aria-label": unref(t)("el.datepicker.yearTablePrompt"),
  28594. class: normalizeClass(unref(ns).b()),
  28595. onClick: handleYearTableClick,
  28596. onMousemove: handleMouseMove
  28597. }, [
  28598. createElementVNode("tbody", {
  28599. ref_key: "tbodyRef",
  28600. ref: tbodyRef
  28601. }, [
  28602. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
  28603. return openBlock(), createElementBlock("tr", { key: rowKey }, [
  28604. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, cellKey) => {
  28605. return openBlock(), createElementBlock("td", {
  28606. key: `${rowKey}_${cellKey}`,
  28607. ref_for: true,
  28608. ref: (el) => cell.isSelected && (currentCellRef.value = el),
  28609. class: normalizeClass(["available", getCellKls(cell)]),
  28610. "aria-selected": cell.isSelected,
  28611. "aria-label": String(cell.text),
  28612. tabindex: cell.isSelected ? 0 : -1,
  28613. onKeydown: [
  28614. withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  28615. withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  28616. ]
  28617. }, [
  28618. createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  28619. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  28620. }), 128))
  28621. ]);
  28622. }), 128))
  28623. ], 512)
  28624. ], 42, ["aria-label"]);
  28625. };
  28626. }
  28627. });
  28628. var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__file", "basic-year-table.vue"]]);
  28629. const _sfc_main$1s = /* @__PURE__ */ defineComponent({
  28630. __name: "panel-date-pick",
  28631. props: panelDatePickProps,
  28632. emits: ["pick", "set-picker-option", "panel-change"],
  28633. setup(__props, { emit: contextEmit }) {
  28634. const props = __props;
  28635. const timeWithinRange = (_, __, ___) => true;
  28636. const ppNs = useNamespace("picker-panel");
  28637. const dpNs = useNamespace("date-picker");
  28638. const attrs = useAttrs$1();
  28639. const slots = useSlots();
  28640. const { t, lang } = useLocale();
  28641. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  28642. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  28643. const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
  28644. const defaultValue = toRef(pickerBase.props, "defaultValue");
  28645. const currentViewRef = ref();
  28646. const innerDate = ref(dayjs().locale(lang.value));
  28647. const isChangeToNow = ref(false);
  28648. let isShortcut = false;
  28649. const defaultTimeD = computed(() => {
  28650. return dayjs(defaultTime).locale(lang.value);
  28651. });
  28652. const month = computed(() => {
  28653. return innerDate.value.month();
  28654. });
  28655. const year = computed(() => {
  28656. return innerDate.value.year();
  28657. });
  28658. const selectableRange = ref([]);
  28659. const userInputDate = ref(null);
  28660. const userInputTime = ref(null);
  28661. const checkDateWithinRange = (date) => {
  28662. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  28663. };
  28664. const formatEmit = (emitDayjs) => {
  28665. if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) {
  28666. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  28667. }
  28668. if (showTime.value)
  28669. return emitDayjs.millisecond(0);
  28670. return emitDayjs.startOf("day");
  28671. };
  28672. const emit = (value, ...args) => {
  28673. if (!value) {
  28674. contextEmit("pick", value, ...args);
  28675. } else if (isArray$1(value)) {
  28676. const dates = value.map(formatEmit);
  28677. contextEmit("pick", dates, ...args);
  28678. } else {
  28679. contextEmit("pick", formatEmit(value), ...args);
  28680. }
  28681. userInputDate.value = null;
  28682. userInputTime.value = null;
  28683. isChangeToNow.value = false;
  28684. isShortcut = false;
  28685. };
  28686. const handleDatePick = async (value, keepOpen) => {
  28687. if (selectionMode.value === "date" && dayjs.isDayjs(value)) {
  28688. const parsedDateValue = extractFirst(props.parsedValue);
  28689. let newDate = parsedDateValue ? parsedDateValue.year(value.year()).month(value.month()).date(value.date()) : value;
  28690. if (!checkDateWithinRange(newDate)) {
  28691. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  28692. }
  28693. innerDate.value = newDate;
  28694. emit(newDate, showTime.value || keepOpen);
  28695. } else if (selectionMode.value === "week") {
  28696. emit(value.date);
  28697. } else if (selectionMode.value === "dates") {
  28698. emit(value, true);
  28699. }
  28700. };
  28701. const moveByMonth = (forward) => {
  28702. const action = forward ? "add" : "subtract";
  28703. innerDate.value = innerDate.value[action](1, "month");
  28704. handlePanelChange("month");
  28705. };
  28706. const moveByYear = (forward) => {
  28707. const currentDate = innerDate.value;
  28708. const action = forward ? "add" : "subtract";
  28709. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  28710. handlePanelChange("year");
  28711. };
  28712. const currentView = ref("date");
  28713. const yearLabel = computed(() => {
  28714. const yearTranslation = t("el.datepicker.year");
  28715. if (currentView.value === "year") {
  28716. const startYear = Math.floor(year.value / 10) * 10;
  28717. if (yearTranslation) {
  28718. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  28719. }
  28720. return `${startYear} - ${startYear + 9}`;
  28721. }
  28722. return `${year.value} ${yearTranslation}`;
  28723. });
  28724. const handleShortcutClick = (shortcut) => {
  28725. const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  28726. if (shortcutValue) {
  28727. isShortcut = true;
  28728. emit(dayjs(shortcutValue).locale(lang.value));
  28729. return;
  28730. }
  28731. if (shortcut.onClick) {
  28732. shortcut.onClick({
  28733. attrs,
  28734. slots,
  28735. emit: contextEmit
  28736. });
  28737. }
  28738. };
  28739. const selectionMode = computed(() => {
  28740. const { type } = props;
  28741. if (["week", "month", "months", "year", "years", "dates"].includes(type))
  28742. return type;
  28743. return "date";
  28744. });
  28745. const isMultipleType = computed(() => {
  28746. return selectionMode.value === "dates" || selectionMode.value === "months" || selectionMode.value === "years";
  28747. });
  28748. const keyboardMode = computed(() => {
  28749. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  28750. });
  28751. const hasShortcuts = computed(() => !!shortcuts.length);
  28752. const handleMonthPick = async (month2, keepOpen) => {
  28753. if (selectionMode.value === "month") {
  28754. innerDate.value = getValidDateOfMonth(innerDate.value, innerDate.value.year(), month2, lang.value, disabledDate);
  28755. emit(innerDate.value, false);
  28756. } else if (selectionMode.value === "months") {
  28757. emit(month2, keepOpen != null ? keepOpen : true);
  28758. } else {
  28759. innerDate.value = getValidDateOfMonth(innerDate.value, innerDate.value.year(), month2, lang.value, disabledDate);
  28760. currentView.value = "date";
  28761. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  28762. emit(innerDate.value, true);
  28763. await nextTick();
  28764. handleFocusPicker();
  28765. }
  28766. }
  28767. handlePanelChange("month");
  28768. };
  28769. const handleYearPick = async (year2, keepOpen) => {
  28770. if (selectionMode.value === "year") {
  28771. const data = innerDate.value.startOf("year").year(year2);
  28772. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  28773. emit(innerDate.value, false);
  28774. } else if (selectionMode.value === "years") {
  28775. emit(year2, keepOpen != null ? keepOpen : true);
  28776. } else {
  28777. const data = innerDate.value.year(year2);
  28778. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  28779. currentView.value = "month";
  28780. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  28781. emit(innerDate.value, true);
  28782. await nextTick();
  28783. handleFocusPicker();
  28784. }
  28785. }
  28786. handlePanelChange("year");
  28787. };
  28788. const showPicker = async (view) => {
  28789. if (props.disabled)
  28790. return;
  28791. currentView.value = view;
  28792. await nextTick();
  28793. handleFocusPicker();
  28794. };
  28795. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  28796. const footerVisible = computed(() => {
  28797. const showDateFooter = showTime.value || selectionMode.value === "dates";
  28798. const showYearFooter = selectionMode.value === "years";
  28799. const showMonthFooter = selectionMode.value === "months";
  28800. const isDateView = currentView.value === "date";
  28801. const isYearView = currentView.value === "year";
  28802. const isMonthView = currentView.value === "month";
  28803. return showDateFooter && isDateView || showYearFooter && isYearView || showMonthFooter && isMonthView;
  28804. });
  28805. const footerFilled = computed(() => !isMultipleType.value && props.showNow || props.showConfirm);
  28806. const disabledConfirm = computed(() => {
  28807. if (!disabledDate)
  28808. return false;
  28809. if (!props.parsedValue)
  28810. return true;
  28811. if (isArray$1(props.parsedValue)) {
  28812. return disabledDate(props.parsedValue[0].toDate());
  28813. }
  28814. return disabledDate(props.parsedValue.toDate());
  28815. });
  28816. const onConfirm = () => {
  28817. if (isMultipleType.value) {
  28818. emit(props.parsedValue);
  28819. } else {
  28820. let result = extractFirst(props.parsedValue);
  28821. if (!result) {
  28822. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  28823. const defaultValueD = getDefaultValue();
  28824. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  28825. }
  28826. innerDate.value = result;
  28827. emit(result);
  28828. }
  28829. };
  28830. const disabledNow = computed(() => {
  28831. if (!disabledDate)
  28832. return false;
  28833. return disabledDate(dayjs().locale(lang.value).toDate());
  28834. });
  28835. const changeToNow = () => {
  28836. const now = dayjs().locale(lang.value);
  28837. const nowDate = now.toDate();
  28838. isChangeToNow.value = true;
  28839. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  28840. innerDate.value = dayjs().locale(lang.value);
  28841. emit(innerDate.value);
  28842. }
  28843. };
  28844. const timeFormat = computed(() => {
  28845. return props.timeFormat || extractTimeFormat(props.format) || DEFAULT_FORMATS_TIME;
  28846. });
  28847. const dateFormat = computed(() => {
  28848. return props.dateFormat || extractDateFormat(props.format) || DEFAULT_FORMATS_DATE;
  28849. });
  28850. const visibleTime = computed(() => {
  28851. if (userInputTime.value)
  28852. return userInputTime.value;
  28853. if (!props.parsedValue && !defaultValue.value)
  28854. return;
  28855. const dateValue = extractFirst(props.parsedValue) || innerDate.value;
  28856. return dateValue.format(timeFormat.value);
  28857. });
  28858. const visibleDate = computed(() => {
  28859. if (userInputDate.value)
  28860. return userInputDate.value;
  28861. if (!props.parsedValue && !defaultValue.value)
  28862. return;
  28863. const dateValue = extractFirst(props.parsedValue) || innerDate.value;
  28864. return dateValue.format(dateFormat.value);
  28865. });
  28866. const timePickerVisible = ref(false);
  28867. const onTimePickerInputFocus = () => {
  28868. timePickerVisible.value = true;
  28869. };
  28870. const handleTimePickClose = () => {
  28871. timePickerVisible.value = false;
  28872. };
  28873. const getUnits = (date) => {
  28874. return {
  28875. hour: date.hour(),
  28876. minute: date.minute(),
  28877. second: date.second(),
  28878. year: date.year(),
  28879. month: date.month(),
  28880. date: date.date()
  28881. };
  28882. };
  28883. const handleTimePick = (value, visible, first) => {
  28884. const { hour, minute, second } = getUnits(value);
  28885. const parsedDateValue = extractFirst(props.parsedValue);
  28886. const newDate = parsedDateValue ? parsedDateValue.hour(hour).minute(minute).second(second) : value;
  28887. innerDate.value = newDate;
  28888. emit(innerDate.value, true);
  28889. if (!first) {
  28890. timePickerVisible.value = visible;
  28891. }
  28892. };
  28893. const handleVisibleTimeChange = (value) => {
  28894. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  28895. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  28896. const { year: year2, month: month2, date } = getUnits(innerDate.value);
  28897. innerDate.value = newDate.year(year2).month(month2).date(date);
  28898. userInputTime.value = null;
  28899. timePickerVisible.value = false;
  28900. emit(innerDate.value, true);
  28901. }
  28902. };
  28903. const handleVisibleDateChange = (value) => {
  28904. const newDate = correctlyParseUserInput(value, dateFormat.value, lang.value, isDefaultFormat);
  28905. if (newDate.isValid()) {
  28906. if (disabledDate && disabledDate(newDate.toDate())) {
  28907. return;
  28908. }
  28909. const { hour, minute, second } = getUnits(innerDate.value);
  28910. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  28911. userInputDate.value = null;
  28912. emit(innerDate.value, true);
  28913. }
  28914. };
  28915. const isValidValue = (date) => {
  28916. return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  28917. };
  28918. const parseUserInput = (value) => {
  28919. return correctlyParseUserInput(value, props.format, lang.value, isDefaultFormat);
  28920. };
  28921. const getDefaultValue = () => {
  28922. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  28923. if (!defaultValue.value) {
  28924. const defaultTimeDValue = defaultTimeD.value;
  28925. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  28926. }
  28927. return parseDate;
  28928. };
  28929. const handleFocusPicker = () => {
  28930. var _a;
  28931. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  28932. (_a = currentViewRef.value) == null ? void 0 : _a.focus();
  28933. }
  28934. };
  28935. const _handleFocusPicker = () => {
  28936. handleFocusPicker();
  28937. if (selectionMode.value === "week") {
  28938. handleKeyControl(EVENT_CODE.down);
  28939. }
  28940. };
  28941. const handleKeydownTable = (event) => {
  28942. const code = getEventCode(event);
  28943. const validCode = [
  28944. EVENT_CODE.up,
  28945. EVENT_CODE.down,
  28946. EVENT_CODE.left,
  28947. EVENT_CODE.right,
  28948. EVENT_CODE.home,
  28949. EVENT_CODE.end,
  28950. EVENT_CODE.pageUp,
  28951. EVENT_CODE.pageDown
  28952. ];
  28953. if (validCode.includes(code)) {
  28954. handleKeyControl(code);
  28955. event.stopPropagation();
  28956. event.preventDefault();
  28957. }
  28958. if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  28959. event.preventDefault();
  28960. emit(innerDate.value, false);
  28961. }
  28962. };
  28963. const handleKeyControl = (code) => {
  28964. var _a;
  28965. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  28966. const mapping = {
  28967. year: {
  28968. [up]: -4,
  28969. [down]: 4,
  28970. [left]: -1,
  28971. [right]: 1,
  28972. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  28973. },
  28974. month: {
  28975. [up]: -4,
  28976. [down]: 4,
  28977. [left]: -1,
  28978. [right]: 1,
  28979. offset: (date, step) => date.setMonth(date.getMonth() + step)
  28980. },
  28981. week: {
  28982. [up]: -1,
  28983. [down]: 1,
  28984. [left]: -1,
  28985. [right]: 1,
  28986. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  28987. },
  28988. date: {
  28989. [up]: -7,
  28990. [down]: 7,
  28991. [left]: -1,
  28992. [right]: 1,
  28993. [home]: (date) => -date.getDay(),
  28994. [end]: (date) => -date.getDay() + 6,
  28995. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  28996. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  28997. offset: (date, step) => date.setDate(date.getDate() + step)
  28998. }
  28999. };
  29000. const newDate = innerDate.value.toDate();
  29001. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  29002. const map = mapping[keyboardMode.value];
  29003. if (!map)
  29004. return;
  29005. map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
  29006. if (disabledDate && disabledDate(newDate)) {
  29007. break;
  29008. }
  29009. const result = dayjs(newDate).locale(lang.value);
  29010. innerDate.value = result;
  29011. contextEmit("pick", result, true);
  29012. break;
  29013. }
  29014. };
  29015. const handlePanelChange = (mode) => {
  29016. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  29017. };
  29018. watch(() => selectionMode.value, (val) => {
  29019. if (["month", "year"].includes(val)) {
  29020. currentView.value = val;
  29021. return;
  29022. } else if (val === "years") {
  29023. currentView.value = "year";
  29024. return;
  29025. } else if (val === "months") {
  29026. currentView.value = "month";
  29027. return;
  29028. }
  29029. currentView.value = "date";
  29030. }, { immediate: true });
  29031. watch(() => defaultValue.value, (val) => {
  29032. if (val) {
  29033. innerDate.value = getDefaultValue();
  29034. }
  29035. }, { immediate: true });
  29036. watch(() => props.parsedValue, (val) => {
  29037. if (val) {
  29038. if (isMultipleType.value)
  29039. return;
  29040. if (isArray$1(val))
  29041. return;
  29042. innerDate.value = val;
  29043. } else {
  29044. innerDate.value = getDefaultValue();
  29045. }
  29046. }, { immediate: true });
  29047. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  29048. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  29049. contextEmit("set-picker-option", ["handleFocusPicker", _handleFocusPicker]);
  29050. return (_ctx, _cache) => {
  29051. return openBlock(), createElementBlock("div", {
  29052. class: normalizeClass([
  29053. unref(ppNs).b(),
  29054. unref(dpNs).b(),
  29055. unref(ppNs).is("border", _ctx.border),
  29056. unref(ppNs).is("disabled", _ctx.disabled),
  29057. {
  29058. "has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
  29059. "has-time": unref(showTime)
  29060. }
  29061. ])
  29062. }, [
  29063. createElementVNode("div", {
  29064. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  29065. }, [
  29066. renderSlot(_ctx.$slots, "sidebar", {
  29067. class: normalizeClass(unref(ppNs).e("sidebar"))
  29068. }),
  29069. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  29070. key: 0,
  29071. class: normalizeClass(unref(ppNs).e("sidebar"))
  29072. }, [
  29073. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  29074. return openBlock(), createElementBlock("button", {
  29075. key,
  29076. type: "button",
  29077. disabled: _ctx.disabled,
  29078. class: normalizeClass(unref(ppNs).e("shortcut")),
  29079. onClick: ($event) => handleShortcutClick(shortcut)
  29080. }, toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
  29081. }), 128))
  29082. ], 2)) : createCommentVNode("v-if", true),
  29083. createElementVNode("div", {
  29084. class: normalizeClass(unref(ppNs).e("body"))
  29085. }, [
  29086. unref(showTime) ? (openBlock(), createElementBlock("div", {
  29087. key: 0,
  29088. class: normalizeClass(unref(dpNs).e("time-header"))
  29089. }, [
  29090. createElementVNode("span", {
  29091. class: normalizeClass(unref(dpNs).e("editor-wrap"))
  29092. }, [
  29093. createVNode(unref(ElInput), {
  29094. placeholder: unref(t)("el.datepicker.selectDate"),
  29095. "model-value": unref(visibleDate),
  29096. size: "small",
  29097. "validate-event": false,
  29098. disabled: _ctx.disabled,
  29099. onInput: (val) => userInputDate.value = val,
  29100. onChange: handleVisibleDateChange
  29101. }, null, 8, ["placeholder", "model-value", "disabled", "onInput"])
  29102. ], 2),
  29103. withDirectives((openBlock(), createElementBlock("span", {
  29104. class: normalizeClass(unref(dpNs).e("editor-wrap"))
  29105. }, [
  29106. createVNode(unref(ElInput), {
  29107. placeholder: unref(t)("el.datepicker.selectTime"),
  29108. "model-value": unref(visibleTime),
  29109. size: "small",
  29110. "validate-event": false,
  29111. disabled: _ctx.disabled,
  29112. onFocus: onTimePickerInputFocus,
  29113. onInput: (val) => userInputTime.value = val,
  29114. onChange: handleVisibleTimeChange
  29115. }, null, 8, ["placeholder", "model-value", "disabled", "onInput"]),
  29116. createVNode(unref(TimePickPanel), {
  29117. visible: timePickerVisible.value,
  29118. format: unref(timeFormat),
  29119. "parsed-value": innerDate.value,
  29120. onPick: handleTimePick
  29121. }, null, 8, ["visible", "format", "parsed-value"])
  29122. ], 2)), [
  29123. [unref(ClickOutside), handleTimePickClose]
  29124. ])
  29125. ], 2)) : createCommentVNode("v-if", true),
  29126. withDirectives(createElementVNode("div", {
  29127. class: normalizeClass([
  29128. unref(dpNs).e("header"),
  29129. (currentView.value === "year" || currentView.value === "month") && unref(dpNs).em("header", "bordered")
  29130. ])
  29131. }, [
  29132. createElementVNode("span", {
  29133. class: normalizeClass(unref(dpNs).e("prev-btn"))
  29134. }, [
  29135. createElementVNode("button", {
  29136. type: "button",
  29137. "aria-label": unref(t)(`el.datepicker.prevYear`),
  29138. class: normalizeClass(["d-arrow-left", unref(ppNs).e("icon-btn")]),
  29139. disabled: _ctx.disabled,
  29140. onClick: ($event) => moveByYear(false)
  29141. }, [
  29142. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  29143. createVNode(unref(ElIcon), null, {
  29144. default: withCtx(() => [
  29145. createVNode(unref(d_arrow_left_default))
  29146. ]),
  29147. _: 1
  29148. })
  29149. ])
  29150. ], 10, ["aria-label", "disabled", "onClick"]),
  29151. withDirectives(createElementVNode("button", {
  29152. type: "button",
  29153. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  29154. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  29155. disabled: _ctx.disabled,
  29156. onClick: ($event) => moveByMonth(false)
  29157. }, [
  29158. renderSlot(_ctx.$slots, "prev-month", {}, () => [
  29159. createVNode(unref(ElIcon), null, {
  29160. default: withCtx(() => [
  29161. createVNode(unref(arrow_left_default))
  29162. ]),
  29163. _: 1
  29164. })
  29165. ])
  29166. ], 10, ["aria-label", "disabled", "onClick"]), [
  29167. [vShow, currentView.value === "date"]
  29168. ])
  29169. ], 2),
  29170. createElementVNode("span", {
  29171. role: "button",
  29172. class: normalizeClass(unref(dpNs).e("header-label")),
  29173. "aria-live": "polite",
  29174. tabindex: "0",
  29175. onKeydown: withKeys(($event) => showPicker("year"), ["enter"]),
  29176. onClick: ($event) => showPicker("year")
  29177. }, toDisplayString(unref(yearLabel)), 43, ["onKeydown", "onClick"]),
  29178. withDirectives(createElementVNode("span", {
  29179. role: "button",
  29180. "aria-live": "polite",
  29181. tabindex: "0",
  29182. class: normalizeClass([
  29183. unref(dpNs).e("header-label"),
  29184. { active: currentView.value === "month" }
  29185. ]),
  29186. onKeydown: withKeys(($event) => showPicker("month"), ["enter"]),
  29187. onClick: ($event) => showPicker("month")
  29188. }, toDisplayString(unref(t)(`el.datepicker.month${unref(month) + 1}`)), 43, ["onKeydown", "onClick"]), [
  29189. [vShow, currentView.value === "date"]
  29190. ]),
  29191. createElementVNode("span", {
  29192. class: normalizeClass(unref(dpNs).e("next-btn"))
  29193. }, [
  29194. withDirectives(createElementVNode("button", {
  29195. type: "button",
  29196. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  29197. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  29198. disabled: _ctx.disabled,
  29199. onClick: ($event) => moveByMonth(true)
  29200. }, [
  29201. renderSlot(_ctx.$slots, "next-month", {}, () => [
  29202. createVNode(unref(ElIcon), null, {
  29203. default: withCtx(() => [
  29204. createVNode(unref(arrow_right_default))
  29205. ]),
  29206. _: 1
  29207. })
  29208. ])
  29209. ], 10, ["aria-label", "disabled", "onClick"]), [
  29210. [vShow, currentView.value === "date"]
  29211. ]),
  29212. createElementVNode("button", {
  29213. type: "button",
  29214. "aria-label": unref(t)(`el.datepicker.nextYear`),
  29215. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  29216. disabled: _ctx.disabled,
  29217. onClick: ($event) => moveByYear(true)
  29218. }, [
  29219. renderSlot(_ctx.$slots, "next-year", {}, () => [
  29220. createVNode(unref(ElIcon), null, {
  29221. default: withCtx(() => [
  29222. createVNode(unref(d_arrow_right_default))
  29223. ]),
  29224. _: 1
  29225. })
  29226. ])
  29227. ], 10, ["aria-label", "disabled", "onClick"])
  29228. ], 2)
  29229. ], 2), [
  29230. [vShow, currentView.value !== "time"]
  29231. ]),
  29232. createElementVNode("div", {
  29233. class: normalizeClass(unref(ppNs).e("content")),
  29234. onKeydown: handleKeydownTable
  29235. }, [
  29236. currentView.value === "date" ? (openBlock(), createBlock(DateTable, {
  29237. key: 0,
  29238. ref_key: "currentViewRef",
  29239. ref: currentViewRef,
  29240. "selection-mode": unref(selectionMode),
  29241. date: innerDate.value,
  29242. "parsed-value": _ctx.parsedValue,
  29243. "disabled-date": unref(disabledDate),
  29244. disabled: _ctx.disabled,
  29245. "cell-class-name": unref(cellClassName),
  29246. "show-week-number": _ctx.showWeekNumber,
  29247. onPick: handleDatePick
  29248. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "disabled", "cell-class-name", "show-week-number"])) : createCommentVNode("v-if", true),
  29249. currentView.value === "year" ? (openBlock(), createBlock(YearTable, {
  29250. key: 1,
  29251. ref_key: "currentViewRef",
  29252. ref: currentViewRef,
  29253. "selection-mode": unref(selectionMode),
  29254. date: innerDate.value,
  29255. "disabled-date": unref(disabledDate),
  29256. disabled: _ctx.disabled,
  29257. "parsed-value": _ctx.parsedValue,
  29258. "cell-class-name": unref(cellClassName),
  29259. onPick: handleYearPick
  29260. }, null, 8, ["selection-mode", "date", "disabled-date", "disabled", "parsed-value", "cell-class-name"])) : createCommentVNode("v-if", true),
  29261. currentView.value === "month" ? (openBlock(), createBlock(MonthTable, {
  29262. key: 2,
  29263. ref_key: "currentViewRef",
  29264. ref: currentViewRef,
  29265. "selection-mode": unref(selectionMode),
  29266. date: innerDate.value,
  29267. "parsed-value": _ctx.parsedValue,
  29268. "disabled-date": unref(disabledDate),
  29269. disabled: _ctx.disabled,
  29270. "cell-class-name": unref(cellClassName),
  29271. onPick: handleMonthPick
  29272. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "disabled", "cell-class-name"])) : createCommentVNode("v-if", true)
  29273. ], 34)
  29274. ], 2)
  29275. ], 2),
  29276. _ctx.showFooter && unref(footerVisible) && unref(footerFilled) ? (openBlock(), createElementBlock("div", {
  29277. key: 0,
  29278. class: normalizeClass(unref(ppNs).e("footer"))
  29279. }, [
  29280. withDirectives(createVNode(unref(ElButton), {
  29281. text: "",
  29282. size: "small",
  29283. class: normalizeClass(unref(ppNs).e("link-btn")),
  29284. disabled: unref(disabledNow),
  29285. onClick: changeToNow
  29286. }, {
  29287. default: withCtx(() => [
  29288. createTextVNode(toDisplayString(unref(t)("el.datepicker.now")), 1)
  29289. ]),
  29290. _: 1
  29291. }, 8, ["class", "disabled"]), [
  29292. [vShow, !unref(isMultipleType) && _ctx.showNow]
  29293. ]),
  29294. _ctx.showConfirm ? (openBlock(), createBlock(unref(ElButton), {
  29295. key: 0,
  29296. plain: "",
  29297. size: "small",
  29298. class: normalizeClass(unref(ppNs).e("link-btn")),
  29299. disabled: unref(disabledConfirm),
  29300. onClick: onConfirm
  29301. }, {
  29302. default: withCtx(() => [
  29303. createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
  29304. ]),
  29305. _: 1
  29306. }, 8, ["class", "disabled"])) : createCommentVNode("v-if", true)
  29307. ], 2)) : createCommentVNode("v-if", true)
  29308. ], 2);
  29309. };
  29310. }
  29311. });
  29312. var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["__file", "panel-date-pick.vue"]]);
  29313. const panelDateRangeProps = buildProps({
  29314. ...panelSharedProps,
  29315. ...panelRangeSharedProps
  29316. });
  29317. const useShortcut = (lang) => {
  29318. const { emit } = getCurrentInstance();
  29319. const attrs = useAttrs$1();
  29320. const slots = useSlots();
  29321. const handleShortcutClick = (shortcut) => {
  29322. const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  29323. if (shortcutValues) {
  29324. emit("pick", [
  29325. dayjs(shortcutValues[0]).locale(lang.value),
  29326. dayjs(shortcutValues[1]).locale(lang.value)
  29327. ]);
  29328. return;
  29329. }
  29330. if (shortcut.onClick) {
  29331. shortcut.onClick({
  29332. attrs,
  29333. slots,
  29334. emit
  29335. });
  29336. }
  29337. };
  29338. return handleShortcutClick;
  29339. };
  29340. const useRangePicker = (props, {
  29341. defaultValue,
  29342. defaultTime,
  29343. leftDate,
  29344. rightDate,
  29345. step,
  29346. unit,
  29347. sortDates
  29348. }) => {
  29349. const { emit } = getCurrentInstance();
  29350. const { pickerNs } = inject(ROOT_PICKER_INJECTION_KEY);
  29351. const drpNs = useNamespace("date-range-picker");
  29352. const { t, lang } = useLocale();
  29353. const handleShortcutClick = useShortcut(lang);
  29354. const minDate = ref();
  29355. const maxDate = ref();
  29356. const rangeState = ref({
  29357. endDate: null,
  29358. selecting: false
  29359. });
  29360. const handleChangeRange = (val) => {
  29361. rangeState.value = val;
  29362. };
  29363. const handleRangeConfirm = (visible = false) => {
  29364. const _minDate = unref(minDate);
  29365. const _maxDate = unref(maxDate);
  29366. if (isValidRange([_minDate, _maxDate])) {
  29367. emit("pick", [_minDate, _maxDate], visible);
  29368. }
  29369. };
  29370. const onSelect = (selecting) => {
  29371. rangeState.value.selecting = selecting;
  29372. if (!selecting) {
  29373. rangeState.value.endDate = null;
  29374. }
  29375. };
  29376. const parseValue = (parsedValue) => {
  29377. if (isArray$1(parsedValue) && parsedValue.length === 2) {
  29378. const [start, end] = parsedValue;
  29379. minDate.value = start;
  29380. leftDate.value = start;
  29381. maxDate.value = end;
  29382. sortDates(unref(minDate), unref(maxDate));
  29383. } else {
  29384. restoreDefault();
  29385. }
  29386. };
  29387. const restoreDefault = () => {
  29388. let [start, end] = getDefaultValue(unref(defaultValue), {
  29389. lang: unref(lang),
  29390. step,
  29391. unit,
  29392. unlinkPanels: props.unlinkPanels
  29393. });
  29394. const getShift = (day) => {
  29395. return day.diff(day.startOf("d"), "ms");
  29396. };
  29397. const maybeTimes = unref(defaultTime);
  29398. if (maybeTimes) {
  29399. let leftShift = 0;
  29400. let rightShift = 0;
  29401. if (isArray$1(maybeTimes)) {
  29402. const [timeStart, timeEnd] = maybeTimes.map(dayjs);
  29403. leftShift = getShift(timeStart);
  29404. rightShift = getShift(timeEnd);
  29405. } else {
  29406. const shift = getShift(dayjs(maybeTimes));
  29407. leftShift = shift;
  29408. rightShift = shift;
  29409. }
  29410. start = start.startOf("d").add(leftShift, "ms");
  29411. end = end.startOf("d").add(rightShift, "ms");
  29412. }
  29413. minDate.value = void 0;
  29414. maxDate.value = void 0;
  29415. leftDate.value = start;
  29416. rightDate.value = end;
  29417. };
  29418. watch(defaultValue, (val) => {
  29419. if (val) {
  29420. restoreDefault();
  29421. }
  29422. }, { immediate: true });
  29423. watch(() => props.parsedValue, (parsedValue) => {
  29424. if (!(parsedValue == null ? void 0 : parsedValue.length) || !isEqual$1(parsedValue, [minDate.value, maxDate.value])) {
  29425. parseValue(parsedValue);
  29426. }
  29427. }, {
  29428. immediate: true
  29429. });
  29430. watch(() => props.visible, () => {
  29431. if (props.visible) {
  29432. parseValue(props.parsedValue);
  29433. }
  29434. }, { immediate: true });
  29435. return {
  29436. minDate,
  29437. maxDate,
  29438. rangeState,
  29439. lang,
  29440. ppNs: pickerNs,
  29441. drpNs,
  29442. handleChangeRange,
  29443. handleRangeConfirm,
  29444. handleShortcutClick,
  29445. onSelect,
  29446. parseValue,
  29447. t
  29448. };
  29449. };
  29450. const usePanelDateRange = (props, emit, leftDate, rightDate) => {
  29451. const leftCurrentView = ref("date");
  29452. const leftCurrentViewRef = ref();
  29453. const rightCurrentView = ref("date");
  29454. const rightCurrentViewRef = ref();
  29455. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  29456. const { disabledDate } = pickerBase.props;
  29457. const { t, lang } = useLocale();
  29458. const leftYear = computed(() => {
  29459. return leftDate.value.year();
  29460. });
  29461. const leftMonth = computed(() => {
  29462. return leftDate.value.month();
  29463. });
  29464. const rightYear = computed(() => {
  29465. return rightDate.value.year();
  29466. });
  29467. const rightMonth = computed(() => {
  29468. return rightDate.value.month();
  29469. });
  29470. function computedYearLabel(currentView, yearValue) {
  29471. const yearTranslation = t("el.datepicker.year");
  29472. if (currentView.value === "year") {
  29473. const startYear = Math.floor(yearValue.value / 10) * 10;
  29474. return yearTranslation ? `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}` : `${startYear} - ${startYear + 9}`;
  29475. }
  29476. return `${yearValue.value} ${yearTranslation}`;
  29477. }
  29478. function focusPicker(currentViewRef) {
  29479. currentViewRef == null ? void 0 : currentViewRef.focus();
  29480. }
  29481. async function showPicker(pickerType, view) {
  29482. if (props.disabled)
  29483. return;
  29484. const currentView = pickerType === "left" ? leftCurrentView : rightCurrentView;
  29485. const currentViewRef = pickerType === "left" ? leftCurrentViewRef : rightCurrentViewRef;
  29486. currentView.value = view;
  29487. await nextTick();
  29488. focusPicker(currentViewRef.value);
  29489. }
  29490. async function handlePick(mode, pickerType, value) {
  29491. if (props.disabled)
  29492. return;
  29493. const isLeftPicker = pickerType === "left";
  29494. const startDate = isLeftPicker ? leftDate : rightDate;
  29495. const endDate = isLeftPicker ? rightDate : leftDate;
  29496. const currentView = isLeftPicker ? leftCurrentView : rightCurrentView;
  29497. const currentViewRef = isLeftPicker ? leftCurrentViewRef : rightCurrentViewRef;
  29498. if (mode === "year") {
  29499. const data = startDate.value.year(value);
  29500. startDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  29501. }
  29502. if (mode === "month") {
  29503. startDate.value = getValidDateOfMonth(startDate.value, startDate.value.year(), value, lang.value, disabledDate);
  29504. }
  29505. if (!props.unlinkPanels) {
  29506. endDate.value = pickerType === "left" ? startDate.value.add(1, "month") : startDate.value.subtract(1, "month");
  29507. }
  29508. currentView.value = mode === "year" ? "month" : "date";
  29509. await nextTick();
  29510. focusPicker(currentViewRef.value);
  29511. handlePanelChange(mode);
  29512. }
  29513. function handlePanelChange(mode) {
  29514. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  29515. }
  29516. function adjustDateByView(currentView, date, forward) {
  29517. const action = forward ? "add" : "subtract";
  29518. return currentView === "year" ? date[action](10, "year") : date[action](1, "year");
  29519. }
  29520. return {
  29521. leftCurrentView,
  29522. rightCurrentView,
  29523. leftCurrentViewRef,
  29524. rightCurrentViewRef,
  29525. leftYear,
  29526. rightYear,
  29527. leftMonth,
  29528. rightMonth,
  29529. leftYearLabel: computed(() => computedYearLabel(leftCurrentView, leftYear)),
  29530. rightYearLabel: computed(() => computedYearLabel(rightCurrentView, rightYear)),
  29531. showLeftPicker: (view) => showPicker("left", view),
  29532. showRightPicker: (view) => showPicker("right", view),
  29533. handleLeftYearPick: (year) => handlePick("year", "left", year),
  29534. handleRightYearPick: (year) => handlePick("year", "right", year),
  29535. handleLeftMonthPick: (month) => handlePick("month", "left", month),
  29536. handleRightMonthPick: (month) => handlePick("month", "right", month),
  29537. handlePanelChange,
  29538. adjustDateByView
  29539. };
  29540. };
  29541. const unit$2 = "month";
  29542. const _sfc_main$1r = /* @__PURE__ */ defineComponent({
  29543. __name: "panel-date-range",
  29544. props: panelDateRangeProps,
  29545. emits: [
  29546. "pick",
  29547. "set-picker-option",
  29548. "calendar-change",
  29549. "panel-change"
  29550. ],
  29551. setup(__props, { emit }) {
  29552. const props = __props;
  29553. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  29554. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  29555. const { disabledDate, cellClassName, defaultTime, clearable } = pickerBase.props;
  29556. const format = toRef(pickerBase.props, "format");
  29557. const shortcuts = toRef(pickerBase.props, "shortcuts");
  29558. const defaultValue = toRef(pickerBase.props, "defaultValue");
  29559. const { lang } = useLocale();
  29560. const leftDate = ref(dayjs().locale(lang.value));
  29561. const rightDate = ref(dayjs().locale(lang.value).add(1, unit$2));
  29562. const {
  29563. minDate,
  29564. maxDate,
  29565. rangeState,
  29566. ppNs,
  29567. drpNs,
  29568. handleChangeRange,
  29569. handleRangeConfirm,
  29570. handleShortcutClick,
  29571. onSelect,
  29572. parseValue,
  29573. t
  29574. } = useRangePicker(props, {
  29575. defaultValue,
  29576. defaultTime,
  29577. leftDate,
  29578. rightDate,
  29579. unit: unit$2,
  29580. sortDates
  29581. });
  29582. watch(() => props.visible, (visible) => {
  29583. if (!visible && rangeState.value.selecting) {
  29584. parseValue(props.parsedValue);
  29585. onSelect(false);
  29586. }
  29587. });
  29588. const dateUserInput = ref({
  29589. min: null,
  29590. max: null
  29591. });
  29592. const timeUserInput = ref({
  29593. min: null,
  29594. max: null
  29595. });
  29596. const {
  29597. leftCurrentView,
  29598. rightCurrentView,
  29599. leftCurrentViewRef,
  29600. rightCurrentViewRef,
  29601. leftYear,
  29602. rightYear,
  29603. leftMonth,
  29604. rightMonth,
  29605. leftYearLabel,
  29606. rightYearLabel,
  29607. showLeftPicker,
  29608. showRightPicker,
  29609. handleLeftYearPick,
  29610. handleRightYearPick,
  29611. handleLeftMonthPick,
  29612. handleRightMonthPick,
  29613. handlePanelChange,
  29614. adjustDateByView
  29615. } = usePanelDateRange(props, emit, leftDate, rightDate);
  29616. const hasShortcuts = computed(() => !!shortcuts.value.length);
  29617. const minVisibleDate = computed(() => {
  29618. if (dateUserInput.value.min !== null)
  29619. return dateUserInput.value.min;
  29620. if (minDate.value)
  29621. return minDate.value.format(dateFormat.value);
  29622. return "";
  29623. });
  29624. const maxVisibleDate = computed(() => {
  29625. if (dateUserInput.value.max !== null)
  29626. return dateUserInput.value.max;
  29627. if (maxDate.value || minDate.value)
  29628. return (maxDate.value || minDate.value).format(dateFormat.value);
  29629. return "";
  29630. });
  29631. const minVisibleTime = computed(() => {
  29632. if (timeUserInput.value.min !== null)
  29633. return timeUserInput.value.min;
  29634. if (minDate.value)
  29635. return minDate.value.format(timeFormat.value);
  29636. return "";
  29637. });
  29638. const maxVisibleTime = computed(() => {
  29639. if (timeUserInput.value.max !== null)
  29640. return timeUserInput.value.max;
  29641. if (maxDate.value || minDate.value)
  29642. return (maxDate.value || minDate.value).format(timeFormat.value);
  29643. return "";
  29644. });
  29645. const timeFormat = computed(() => {
  29646. return props.timeFormat || extractTimeFormat(format.value || "") || DEFAULT_FORMATS_TIME;
  29647. });
  29648. const dateFormat = computed(() => {
  29649. return props.dateFormat || extractDateFormat(format.value || "") || DEFAULT_FORMATS_DATE;
  29650. });
  29651. const isValidValue = (date) => {
  29652. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  29653. };
  29654. const leftPrevYear = () => {
  29655. leftDate.value = adjustDateByView(leftCurrentView.value, leftDate.value, false);
  29656. if (!props.unlinkPanels) {
  29657. rightDate.value = leftDate.value.add(1, "month");
  29658. }
  29659. handlePanelChange("year");
  29660. };
  29661. const leftPrevMonth = () => {
  29662. leftDate.value = leftDate.value.subtract(1, "month");
  29663. if (!props.unlinkPanels) {
  29664. rightDate.value = leftDate.value.add(1, "month");
  29665. }
  29666. handlePanelChange("month");
  29667. };
  29668. const rightNextYear = () => {
  29669. if (!props.unlinkPanels) {
  29670. leftDate.value = adjustDateByView(rightCurrentView.value, leftDate.value, true);
  29671. rightDate.value = leftDate.value.add(1, "month");
  29672. } else {
  29673. rightDate.value = adjustDateByView(rightCurrentView.value, rightDate.value, true);
  29674. }
  29675. handlePanelChange("year");
  29676. };
  29677. const rightNextMonth = () => {
  29678. if (!props.unlinkPanels) {
  29679. leftDate.value = leftDate.value.add(1, "month");
  29680. rightDate.value = leftDate.value.add(1, "month");
  29681. } else {
  29682. rightDate.value = rightDate.value.add(1, "month");
  29683. }
  29684. handlePanelChange("month");
  29685. };
  29686. const leftNextYear = () => {
  29687. leftDate.value = adjustDateByView(leftCurrentView.value, leftDate.value, true);
  29688. handlePanelChange("year");
  29689. };
  29690. const leftNextMonth = () => {
  29691. leftDate.value = leftDate.value.add(1, "month");
  29692. handlePanelChange("month");
  29693. };
  29694. const rightPrevYear = () => {
  29695. rightDate.value = adjustDateByView(rightCurrentView.value, rightDate.value, false);
  29696. handlePanelChange("year");
  29697. };
  29698. const rightPrevMonth = () => {
  29699. rightDate.value = rightDate.value.subtract(1, "month");
  29700. handlePanelChange("month");
  29701. };
  29702. const enableMonthArrow = computed(() => {
  29703. const nextMonth = (leftMonth.value + 1) % 12;
  29704. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  29705. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  29706. });
  29707. const enableYearArrow = computed(() => {
  29708. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  29709. });
  29710. const btnDisabled = computed(() => {
  29711. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  29712. });
  29713. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  29714. const formatEmit = (emitDayjs, index) => {
  29715. if (!emitDayjs)
  29716. return;
  29717. if (defaultTime) {
  29718. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  29719. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  29720. }
  29721. return emitDayjs;
  29722. };
  29723. const handleRangePick = (val, close = true) => {
  29724. const min_ = val.minDate;
  29725. const max_ = val.maxDate;
  29726. const minDate_ = formatEmit(min_, 0);
  29727. const maxDate_ = formatEmit(max_, 1);
  29728. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  29729. return;
  29730. }
  29731. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  29732. maxDate.value = maxDate_;
  29733. minDate.value = minDate_;
  29734. if (!showTime.value && close) {
  29735. close = !minDate_ || !maxDate_;
  29736. }
  29737. handleRangeConfirm(close);
  29738. };
  29739. const minTimePickerVisible = ref(false);
  29740. const maxTimePickerVisible = ref(false);
  29741. const handleMinTimeClose = () => {
  29742. minTimePickerVisible.value = false;
  29743. };
  29744. const handleMaxTimeClose = () => {
  29745. maxTimePickerVisible.value = false;
  29746. };
  29747. const handleDateInput = (value, type) => {
  29748. dateUserInput.value[type] = value;
  29749. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  29750. if (parsedValueD.isValid()) {
  29751. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  29752. return;
  29753. }
  29754. if (type === "min") {
  29755. leftDate.value = parsedValueD;
  29756. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  29757. if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
  29758. rightDate.value = parsedValueD.add(1, "month");
  29759. maxDate.value = minDate.value.add(1, "month");
  29760. }
  29761. } else {
  29762. rightDate.value = parsedValueD;
  29763. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  29764. if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
  29765. leftDate.value = parsedValueD.subtract(1, "month");
  29766. minDate.value = maxDate.value.subtract(1, "month");
  29767. }
  29768. }
  29769. sortDates(minDate.value, maxDate.value);
  29770. handleRangeConfirm(true);
  29771. }
  29772. };
  29773. const handleDateChange = (_, type) => {
  29774. dateUserInput.value[type] = null;
  29775. };
  29776. const handleTimeInput = (value, type) => {
  29777. timeUserInput.value[type] = value;
  29778. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  29779. if (parsedValueD.isValid()) {
  29780. if (type === "min") {
  29781. minTimePickerVisible.value = true;
  29782. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  29783. leftDate.value = minDate.value;
  29784. } else {
  29785. maxTimePickerVisible.value = true;
  29786. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  29787. rightDate.value = maxDate.value;
  29788. }
  29789. }
  29790. };
  29791. const handleTimeChange = (_value, type) => {
  29792. timeUserInput.value[type] = null;
  29793. if (type === "min") {
  29794. leftDate.value = minDate.value;
  29795. minTimePickerVisible.value = false;
  29796. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  29797. maxDate.value = minDate.value;
  29798. }
  29799. } else {
  29800. rightDate.value = maxDate.value;
  29801. maxTimePickerVisible.value = false;
  29802. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  29803. minDate.value = maxDate.value;
  29804. }
  29805. }
  29806. handleRangeConfirm(true);
  29807. };
  29808. const handleMinTimePick = (value, visible, first) => {
  29809. if (timeUserInput.value.min)
  29810. return;
  29811. if (value) {
  29812. leftDate.value = value;
  29813. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  29814. }
  29815. if (!first) {
  29816. minTimePickerVisible.value = visible;
  29817. }
  29818. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  29819. maxDate.value = minDate.value;
  29820. rightDate.value = value;
  29821. nextTick(() => {
  29822. parseValue(props.parsedValue);
  29823. });
  29824. }
  29825. handleRangeConfirm(true);
  29826. };
  29827. const handleMaxTimePick = (value, visible, first) => {
  29828. if (timeUserInput.value.max)
  29829. return;
  29830. if (value) {
  29831. rightDate.value = value;
  29832. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  29833. }
  29834. if (!first) {
  29835. maxTimePickerVisible.value = visible;
  29836. }
  29837. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  29838. minDate.value = maxDate.value;
  29839. }
  29840. handleRangeConfirm(true);
  29841. };
  29842. const handleClear = () => {
  29843. let valueOnClear = null;
  29844. if (pickerBase == null ? void 0 : pickerBase.emptyValues) {
  29845. valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  29846. }
  29847. leftDate.value = getDefaultValue(unref(defaultValue), {
  29848. lang: unref(lang),
  29849. unit: "month",
  29850. unlinkPanels: props.unlinkPanels
  29851. })[0];
  29852. rightDate.value = leftDate.value.add(1, "month");
  29853. maxDate.value = void 0;
  29854. minDate.value = void 0;
  29855. handleRangeConfirm(true);
  29856. emit("pick", valueOnClear);
  29857. };
  29858. const parseUserInput = (value) => {
  29859. return correctlyParseUserInput(value, format.value || "", lang.value, isDefaultFormat);
  29860. };
  29861. function sortDates(minDate2, maxDate2) {
  29862. if (props.unlinkPanels && maxDate2) {
  29863. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  29864. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  29865. const maxDateYear = maxDate2.year();
  29866. const maxDateMonth = maxDate2.month();
  29867. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$2) : maxDate2;
  29868. } else {
  29869. rightDate.value = leftDate.value.add(1, unit$2);
  29870. if (maxDate2) {
  29871. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  29872. }
  29873. }
  29874. }
  29875. emit("set-picker-option", ["isValidValue", isValidValue]);
  29876. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  29877. emit("set-picker-option", ["handleClear", handleClear]);
  29878. return (_ctx, _cache) => {
  29879. return openBlock(), createElementBlock("div", {
  29880. class: normalizeClass([
  29881. unref(ppNs).b(),
  29882. unref(drpNs).b(),
  29883. unref(ppNs).is("border", _ctx.border),
  29884. unref(ppNs).is("disabled", _ctx.disabled),
  29885. {
  29886. "has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
  29887. "has-time": unref(showTime)
  29888. }
  29889. ])
  29890. }, [
  29891. createElementVNode("div", {
  29892. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  29893. }, [
  29894. renderSlot(_ctx.$slots, "sidebar", {
  29895. class: normalizeClass(unref(ppNs).e("sidebar"))
  29896. }),
  29897. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  29898. key: 0,
  29899. class: normalizeClass(unref(ppNs).e("sidebar"))
  29900. }, [
  29901. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  29902. return openBlock(), createElementBlock("button", {
  29903. key,
  29904. type: "button",
  29905. disabled: _ctx.disabled,
  29906. class: normalizeClass(unref(ppNs).e("shortcut")),
  29907. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  29908. }, toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
  29909. }), 128))
  29910. ], 2)) : createCommentVNode("v-if", true),
  29911. createElementVNode("div", {
  29912. class: normalizeClass(unref(ppNs).e("body"))
  29913. }, [
  29914. unref(showTime) ? (openBlock(), createElementBlock("div", {
  29915. key: 0,
  29916. class: normalizeClass(unref(drpNs).e("time-header"))
  29917. }, [
  29918. createElementVNode("span", {
  29919. class: normalizeClass(unref(drpNs).e("editors-wrap"))
  29920. }, [
  29921. createElementVNode("span", {
  29922. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  29923. }, [
  29924. createVNode(unref(ElInput), {
  29925. size: "small",
  29926. disabled: unref(rangeState).selecting || _ctx.disabled,
  29927. placeholder: unref(t)("el.datepicker.startDate"),
  29928. class: normalizeClass(unref(drpNs).e("editor")),
  29929. "model-value": unref(minVisibleDate),
  29930. "validate-event": false,
  29931. onInput: (val) => handleDateInput(val, "min"),
  29932. onChange: (val) => handleDateChange(val, "min")
  29933. }, null, 8, ["disabled", "placeholder", "class", "model-value", "onInput", "onChange"])
  29934. ], 2),
  29935. withDirectives((openBlock(), createElementBlock("span", {
  29936. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  29937. }, [
  29938. createVNode(unref(ElInput), {
  29939. size: "small",
  29940. class: normalizeClass(unref(drpNs).e("editor")),
  29941. disabled: unref(rangeState).selecting || _ctx.disabled,
  29942. placeholder: unref(t)("el.datepicker.startTime"),
  29943. "model-value": unref(minVisibleTime),
  29944. "validate-event": false,
  29945. onFocus: ($event) => minTimePickerVisible.value = true,
  29946. onInput: (val) => handleTimeInput(val, "min"),
  29947. onChange: (val) => handleTimeChange(val, "min")
  29948. }, null, 8, ["class", "disabled", "placeholder", "model-value", "onFocus", "onInput", "onChange"]),
  29949. createVNode(unref(TimePickPanel), {
  29950. visible: minTimePickerVisible.value,
  29951. format: unref(timeFormat),
  29952. "datetime-role": "start",
  29953. "parsed-value": leftDate.value,
  29954. onPick: handleMinTimePick
  29955. }, null, 8, ["visible", "format", "parsed-value"])
  29956. ], 2)), [
  29957. [unref(ClickOutside), handleMinTimeClose]
  29958. ])
  29959. ], 2),
  29960. createElementVNode("span", null, [
  29961. createVNode(unref(ElIcon), null, {
  29962. default: withCtx(() => [
  29963. createVNode(unref(arrow_right_default))
  29964. ]),
  29965. _: 1
  29966. })
  29967. ]),
  29968. createElementVNode("span", {
  29969. class: normalizeClass([unref(drpNs).e("editors-wrap"), "is-right"])
  29970. }, [
  29971. createElementVNode("span", {
  29972. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  29973. }, [
  29974. createVNode(unref(ElInput), {
  29975. size: "small",
  29976. class: normalizeClass(unref(drpNs).e("editor")),
  29977. disabled: unref(rangeState).selecting || _ctx.disabled,
  29978. placeholder: unref(t)("el.datepicker.endDate"),
  29979. "model-value": unref(maxVisibleDate),
  29980. readonly: !unref(minDate),
  29981. "validate-event": false,
  29982. onInput: (val) => handleDateInput(val, "max"),
  29983. onChange: (val) => handleDateChange(val, "max")
  29984. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onInput", "onChange"])
  29985. ], 2),
  29986. withDirectives((openBlock(), createElementBlock("span", {
  29987. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  29988. }, [
  29989. createVNode(unref(ElInput), {
  29990. size: "small",
  29991. class: normalizeClass(unref(drpNs).e("editor")),
  29992. disabled: unref(rangeState).selecting || _ctx.disabled,
  29993. placeholder: unref(t)("el.datepicker.endTime"),
  29994. "model-value": unref(maxVisibleTime),
  29995. readonly: !unref(minDate),
  29996. "validate-event": false,
  29997. onFocus: ($event) => unref(minDate) && (maxTimePickerVisible.value = true),
  29998. onInput: (val) => handleTimeInput(val, "max"),
  29999. onChange: (val) => handleTimeChange(val, "max")
  30000. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onFocus", "onInput", "onChange"]),
  30001. createVNode(unref(TimePickPanel), {
  30002. "datetime-role": "end",
  30003. visible: maxTimePickerVisible.value,
  30004. format: unref(timeFormat),
  30005. "parsed-value": rightDate.value,
  30006. onPick: handleMaxTimePick
  30007. }, null, 8, ["visible", "format", "parsed-value"])
  30008. ], 2)), [
  30009. [unref(ClickOutside), handleMaxTimeClose]
  30010. ])
  30011. ], 2)
  30012. ], 2)) : createCommentVNode("v-if", true),
  30013. createElementVNode("div", {
  30014. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
  30015. }, [
  30016. createElementVNode("div", {
  30017. class: normalizeClass(unref(drpNs).e("header"))
  30018. }, [
  30019. createElementVNode("button", {
  30020. type: "button",
  30021. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  30022. "aria-label": unref(t)(`el.datepicker.prevYear`),
  30023. disabled: _ctx.disabled,
  30024. onClick: leftPrevYear
  30025. }, [
  30026. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30027. createVNode(unref(ElIcon), null, {
  30028. default: withCtx(() => [
  30029. createVNode(unref(d_arrow_left_default))
  30030. ]),
  30031. _: 1
  30032. })
  30033. ])
  30034. ], 10, ["aria-label", "disabled"]),
  30035. withDirectives(createElementVNode("button", {
  30036. type: "button",
  30037. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  30038. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  30039. disabled: _ctx.disabled,
  30040. onClick: leftPrevMonth
  30041. }, [
  30042. renderSlot(_ctx.$slots, "prev-month", {}, () => [
  30043. createVNode(unref(ElIcon), null, {
  30044. default: withCtx(() => [
  30045. createVNode(unref(arrow_left_default))
  30046. ]),
  30047. _: 1
  30048. })
  30049. ])
  30050. ], 10, ["aria-label", "disabled"]), [
  30051. [vShow, unref(leftCurrentView) === "date"]
  30052. ]),
  30053. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  30054. key: 0,
  30055. type: "button",
  30056. disabled: !unref(enableYearArrow) || _ctx.disabled,
  30057. class: normalizeClass([[
  30058. unref(ppNs).e("icon-btn"),
  30059. unref(ppNs).is("disabled", !unref(enableYearArrow) || _ctx.disabled)
  30060. ], "d-arrow-right"]),
  30061. "aria-label": unref(t)(`el.datepicker.nextYear`),
  30062. onClick: leftNextYear
  30063. }, [
  30064. renderSlot(_ctx.$slots, "next-year", {}, () => [
  30065. createVNode(unref(ElIcon), null, {
  30066. default: withCtx(() => [
  30067. createVNode(unref(d_arrow_right_default))
  30068. ]),
  30069. _: 1
  30070. })
  30071. ])
  30072. ], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  30073. _ctx.unlinkPanels && unref(leftCurrentView) === "date" ? (openBlock(), createElementBlock("button", {
  30074. key: 1,
  30075. type: "button",
  30076. disabled: !unref(enableMonthArrow) || _ctx.disabled,
  30077. class: normalizeClass([[
  30078. unref(ppNs).e("icon-btn"),
  30079. unref(ppNs).is("disabled", !unref(enableMonthArrow) || _ctx.disabled)
  30080. ], "arrow-right"]),
  30081. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  30082. onClick: leftNextMonth
  30083. }, [
  30084. renderSlot(_ctx.$slots, "next-month", {}, () => [
  30085. createVNode(unref(ElIcon), null, {
  30086. default: withCtx(() => [
  30087. createVNode(unref(arrow_right_default))
  30088. ]),
  30089. _: 1
  30090. })
  30091. ])
  30092. ], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  30093. createElementVNode("div", null, [
  30094. createElementVNode("span", {
  30095. role: "button",
  30096. class: normalizeClass(unref(drpNs).e("header-label")),
  30097. "aria-live": "polite",
  30098. tabindex: "0",
  30099. onKeydown: withKeys(($event) => unref(showLeftPicker)("year"), ["enter"]),
  30100. onClick: ($event) => unref(showLeftPicker)("year")
  30101. }, toDisplayString(unref(leftYearLabel)), 43, ["onKeydown", "onClick"]),
  30102. withDirectives(createElementVNode("span", {
  30103. role: "button",
  30104. "aria-live": "polite",
  30105. tabindex: "0",
  30106. class: normalizeClass([
  30107. unref(drpNs).e("header-label"),
  30108. { active: unref(leftCurrentView) === "month" }
  30109. ]),
  30110. onKeydown: withKeys(($event) => unref(showLeftPicker)("month"), ["enter"]),
  30111. onClick: ($event) => unref(showLeftPicker)("month")
  30112. }, toDisplayString(unref(t)(`el.datepicker.month${leftDate.value.month() + 1}`)), 43, ["onKeydown", "onClick"]), [
  30113. [vShow, unref(leftCurrentView) === "date"]
  30114. ])
  30115. ])
  30116. ], 2),
  30117. unref(leftCurrentView) === "date" ? (openBlock(), createBlock(DateTable, {
  30118. key: 0,
  30119. ref_key: "leftCurrentViewRef",
  30120. ref: leftCurrentViewRef,
  30121. "selection-mode": "range",
  30122. date: leftDate.value,
  30123. "min-date": unref(minDate),
  30124. "max-date": unref(maxDate),
  30125. "range-state": unref(rangeState),
  30126. "disabled-date": unref(disabledDate),
  30127. "cell-class-name": unref(cellClassName),
  30128. "show-week-number": _ctx.showWeekNumber,
  30129. disabled: _ctx.disabled,
  30130. onChangerange: unref(handleChangeRange),
  30131. onPick: handleRangePick,
  30132. onSelect: unref(onSelect)
  30133. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "show-week-number", "disabled", "onChangerange", "onSelect"])) : createCommentVNode("v-if", true),
  30134. unref(leftCurrentView) === "year" ? (openBlock(), createBlock(YearTable, {
  30135. key: 1,
  30136. ref_key: "leftCurrentViewRef",
  30137. ref: leftCurrentViewRef,
  30138. "selection-mode": "year",
  30139. date: leftDate.value,
  30140. "disabled-date": unref(disabledDate),
  30141. "parsed-value": _ctx.parsedValue,
  30142. disabled: _ctx.disabled,
  30143. onPick: unref(handleLeftYearPick)
  30144. }, null, 8, ["date", "disabled-date", "parsed-value", "disabled", "onPick"])) : createCommentVNode("v-if", true),
  30145. unref(leftCurrentView) === "month" ? (openBlock(), createBlock(MonthTable, {
  30146. key: 2,
  30147. ref_key: "leftCurrentViewRef",
  30148. ref: leftCurrentViewRef,
  30149. "selection-mode": "month",
  30150. date: leftDate.value,
  30151. "parsed-value": _ctx.parsedValue,
  30152. "disabled-date": unref(disabledDate),
  30153. disabled: _ctx.disabled,
  30154. onPick: unref(handleLeftMonthPick)
  30155. }, null, 8, ["date", "parsed-value", "disabled-date", "disabled", "onPick"])) : createCommentVNode("v-if", true)
  30156. ], 2),
  30157. createElementVNode("div", {
  30158. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
  30159. }, [
  30160. createElementVNode("div", {
  30161. class: normalizeClass([
  30162. unref(drpNs).e("header"),
  30163. unref(ppNs).is("disabled", !unref(enableYearArrow) || _ctx.disabled)
  30164. ])
  30165. }, [
  30166. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  30167. key: 0,
  30168. type: "button",
  30169. disabled: !unref(enableYearArrow) || _ctx.disabled,
  30170. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  30171. "aria-label": unref(t)(`el.datepicker.prevYear`),
  30172. onClick: rightPrevYear
  30173. }, [
  30174. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30175. createVNode(unref(ElIcon), null, {
  30176. default: withCtx(() => [
  30177. createVNode(unref(d_arrow_left_default))
  30178. ]),
  30179. _: 1
  30180. })
  30181. ])
  30182. ], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  30183. _ctx.unlinkPanels && unref(rightCurrentView) === "date" ? (openBlock(), createElementBlock("button", {
  30184. key: 1,
  30185. type: "button",
  30186. disabled: !unref(enableMonthArrow) || _ctx.disabled,
  30187. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  30188. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  30189. onClick: rightPrevMonth
  30190. }, [
  30191. renderSlot(_ctx.$slots, "prev-month", {}, () => [
  30192. createVNode(unref(ElIcon), null, {
  30193. default: withCtx(() => [
  30194. createVNode(unref(arrow_left_default))
  30195. ]),
  30196. _: 1
  30197. })
  30198. ])
  30199. ], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  30200. createElementVNode("button", {
  30201. type: "button",
  30202. "aria-label": unref(t)(`el.datepicker.nextYear`),
  30203. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  30204. disabled: _ctx.disabled,
  30205. onClick: rightNextYear
  30206. }, [
  30207. renderSlot(_ctx.$slots, "next-year", {}, () => [
  30208. createVNode(unref(ElIcon), null, {
  30209. default: withCtx(() => [
  30210. createVNode(unref(d_arrow_right_default))
  30211. ]),
  30212. _: 1
  30213. })
  30214. ])
  30215. ], 10, ["aria-label", "disabled"]),
  30216. withDirectives(createElementVNode("button", {
  30217. type: "button",
  30218. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  30219. disabled: _ctx.disabled,
  30220. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  30221. onClick: rightNextMonth
  30222. }, [
  30223. renderSlot(_ctx.$slots, "next-month", {}, () => [
  30224. createVNode(unref(ElIcon), null, {
  30225. default: withCtx(() => [
  30226. createVNode(unref(arrow_right_default))
  30227. ]),
  30228. _: 1
  30229. })
  30230. ])
  30231. ], 10, ["disabled", "aria-label"]), [
  30232. [vShow, unref(rightCurrentView) === "date"]
  30233. ]),
  30234. createElementVNode("div", null, [
  30235. createElementVNode("span", {
  30236. role: "button",
  30237. class: normalizeClass(unref(drpNs).e("header-label")),
  30238. "aria-live": "polite",
  30239. tabindex: "0",
  30240. onKeydown: withKeys(($event) => unref(showRightPicker)("year"), ["enter"]),
  30241. onClick: ($event) => unref(showRightPicker)("year")
  30242. }, toDisplayString(unref(rightYearLabel)), 43, ["onKeydown", "onClick"]),
  30243. withDirectives(createElementVNode("span", {
  30244. role: "button",
  30245. "aria-live": "polite",
  30246. tabindex: "0",
  30247. class: normalizeClass([
  30248. unref(drpNs).e("header-label"),
  30249. { active: unref(rightCurrentView) === "month" }
  30250. ]),
  30251. onKeydown: withKeys(($event) => unref(showRightPicker)("month"), ["enter"]),
  30252. onClick: ($event) => unref(showRightPicker)("month")
  30253. }, toDisplayString(unref(t)(`el.datepicker.month${rightDate.value.month() + 1}`)), 43, ["onKeydown", "onClick"]), [
  30254. [vShow, unref(rightCurrentView) === "date"]
  30255. ])
  30256. ])
  30257. ], 2),
  30258. unref(rightCurrentView) === "date" ? (openBlock(), createBlock(DateTable, {
  30259. key: 0,
  30260. ref_key: "rightCurrentViewRef",
  30261. ref: rightCurrentViewRef,
  30262. "selection-mode": "range",
  30263. date: rightDate.value,
  30264. "min-date": unref(minDate),
  30265. "max-date": unref(maxDate),
  30266. "range-state": unref(rangeState),
  30267. "disabled-date": unref(disabledDate),
  30268. "cell-class-name": unref(cellClassName),
  30269. "show-week-number": _ctx.showWeekNumber,
  30270. disabled: _ctx.disabled,
  30271. onChangerange: unref(handleChangeRange),
  30272. onPick: handleRangePick,
  30273. onSelect: unref(onSelect)
  30274. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "show-week-number", "disabled", "onChangerange", "onSelect"])) : createCommentVNode("v-if", true),
  30275. unref(rightCurrentView) === "year" ? (openBlock(), createBlock(YearTable, {
  30276. key: 1,
  30277. ref_key: "rightCurrentViewRef",
  30278. ref: rightCurrentViewRef,
  30279. "selection-mode": "year",
  30280. date: rightDate.value,
  30281. "disabled-date": unref(disabledDate),
  30282. "parsed-value": _ctx.parsedValue,
  30283. disabled: _ctx.disabled,
  30284. onPick: unref(handleRightYearPick)
  30285. }, null, 8, ["date", "disabled-date", "parsed-value", "disabled", "onPick"])) : createCommentVNode("v-if", true),
  30286. unref(rightCurrentView) === "month" ? (openBlock(), createBlock(MonthTable, {
  30287. key: 2,
  30288. ref_key: "rightCurrentViewRef",
  30289. ref: rightCurrentViewRef,
  30290. "selection-mode": "month",
  30291. date: rightDate.value,
  30292. "parsed-value": _ctx.parsedValue,
  30293. "disabled-date": unref(disabledDate),
  30294. disabled: _ctx.disabled,
  30295. onPick: unref(handleRightMonthPick)
  30296. }, null, 8, ["date", "parsed-value", "disabled-date", "disabled", "onPick"])) : createCommentVNode("v-if", true)
  30297. ], 2)
  30298. ], 2)
  30299. ], 2),
  30300. _ctx.showFooter && unref(showTime) && (_ctx.showConfirm || unref(clearable)) ? (openBlock(), createElementBlock("div", {
  30301. key: 0,
  30302. class: normalizeClass(unref(ppNs).e("footer"))
  30303. }, [
  30304. unref(clearable) ? (openBlock(), createBlock(unref(ElButton), {
  30305. key: 0,
  30306. text: "",
  30307. size: "small",
  30308. class: normalizeClass(unref(ppNs).e("link-btn")),
  30309. onClick: handleClear
  30310. }, {
  30311. default: withCtx(() => [
  30312. createTextVNode(toDisplayString(unref(t)("el.datepicker.clear")), 1)
  30313. ]),
  30314. _: 1
  30315. }, 8, ["class"])) : createCommentVNode("v-if", true),
  30316. _ctx.showConfirm ? (openBlock(), createBlock(unref(ElButton), {
  30317. key: 1,
  30318. plain: "",
  30319. size: "small",
  30320. class: normalizeClass(unref(ppNs).e("link-btn")),
  30321. disabled: unref(btnDisabled),
  30322. onClick: ($event) => unref(handleRangeConfirm)(false)
  30323. }, {
  30324. default: withCtx(() => [
  30325. createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
  30326. ]),
  30327. _: 1
  30328. }, 8, ["class", "disabled", "onClick"])) : createCommentVNode("v-if", true)
  30329. ], 2)) : createCommentVNode("v-if", true)
  30330. ], 2);
  30331. };
  30332. }
  30333. });
  30334. var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "panel-date-range.vue"]]);
  30335. const panelMonthRangeProps = buildProps({
  30336. ...panelRangeSharedProps
  30337. });
  30338. const panelMonthRangeEmits = [
  30339. "pick",
  30340. "set-picker-option",
  30341. "calendar-change"
  30342. ];
  30343. const useMonthRangeHeader = ({
  30344. unlinkPanels,
  30345. leftDate,
  30346. rightDate
  30347. }) => {
  30348. const { t } = useLocale();
  30349. const leftPrevYear = () => {
  30350. leftDate.value = leftDate.value.subtract(1, "year");
  30351. if (!unlinkPanels.value) {
  30352. rightDate.value = rightDate.value.subtract(1, "year");
  30353. }
  30354. };
  30355. const rightNextYear = () => {
  30356. if (!unlinkPanels.value) {
  30357. leftDate.value = leftDate.value.add(1, "year");
  30358. }
  30359. rightDate.value = rightDate.value.add(1, "year");
  30360. };
  30361. const leftNextYear = () => {
  30362. leftDate.value = leftDate.value.add(1, "year");
  30363. };
  30364. const rightPrevYear = () => {
  30365. rightDate.value = rightDate.value.subtract(1, "year");
  30366. };
  30367. const leftLabel = computed(() => {
  30368. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  30369. });
  30370. const rightLabel = computed(() => {
  30371. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  30372. });
  30373. const leftYear = computed(() => {
  30374. return leftDate.value.year();
  30375. });
  30376. const rightYear = computed(() => {
  30377. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  30378. });
  30379. return {
  30380. leftPrevYear,
  30381. rightNextYear,
  30382. leftNextYear,
  30383. rightPrevYear,
  30384. leftLabel,
  30385. rightLabel,
  30386. leftYear,
  30387. rightYear
  30388. };
  30389. };
  30390. const unit$1 = "year";
  30391. const __default__$13 = defineComponent({
  30392. name: "DatePickerMonthRange"
  30393. });
  30394. const _sfc_main$1q = /* @__PURE__ */ defineComponent({
  30395. ...__default__$13,
  30396. props: panelMonthRangeProps,
  30397. emits: panelMonthRangeEmits,
  30398. setup(__props, { emit }) {
  30399. const props = __props;
  30400. const { lang } = useLocale();
  30401. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  30402. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  30403. const { shortcuts, disabledDate, cellClassName } = pickerBase.props;
  30404. const format = toRef(pickerBase.props, "format");
  30405. const defaultValue = toRef(pickerBase.props, "defaultValue");
  30406. const leftDate = ref(dayjs().locale(lang.value));
  30407. const rightDate = ref(dayjs().locale(lang.value).add(1, unit$1));
  30408. const {
  30409. minDate,
  30410. maxDate,
  30411. rangeState,
  30412. ppNs,
  30413. drpNs,
  30414. handleChangeRange,
  30415. handleRangeConfirm,
  30416. handleShortcutClick,
  30417. onSelect,
  30418. parseValue
  30419. } = useRangePicker(props, {
  30420. defaultValue,
  30421. leftDate,
  30422. rightDate,
  30423. unit: unit$1,
  30424. sortDates
  30425. });
  30426. const hasShortcuts = computed(() => !!shortcuts.length);
  30427. const {
  30428. leftPrevYear,
  30429. rightNextYear,
  30430. leftNextYear,
  30431. rightPrevYear,
  30432. leftLabel,
  30433. rightLabel,
  30434. leftYear,
  30435. rightYear
  30436. } = useMonthRangeHeader({
  30437. unlinkPanels: toRef(props, "unlinkPanels"),
  30438. leftDate,
  30439. rightDate
  30440. });
  30441. const enableYearArrow = computed(() => {
  30442. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  30443. });
  30444. const handleRangePick = (val, close = true) => {
  30445. const minDate_ = val.minDate;
  30446. const maxDate_ = val.maxDate;
  30447. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  30448. return;
  30449. }
  30450. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  30451. maxDate.value = maxDate_;
  30452. minDate.value = minDate_;
  30453. if (!close)
  30454. return;
  30455. handleRangeConfirm();
  30456. };
  30457. const handleClear = () => {
  30458. let valueOnClear = null;
  30459. if (pickerBase == null ? void 0 : pickerBase.emptyValues) {
  30460. valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  30461. }
  30462. leftDate.value = getDefaultValue(unref(defaultValue), {
  30463. lang: unref(lang),
  30464. unit: "year",
  30465. unlinkPanels: props.unlinkPanels
  30466. })[0];
  30467. rightDate.value = leftDate.value.add(1, "year");
  30468. emit("pick", valueOnClear);
  30469. };
  30470. const parseUserInput = (value) => {
  30471. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  30472. };
  30473. function sortDates(minDate2, maxDate2) {
  30474. if (props.unlinkPanels && maxDate2) {
  30475. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  30476. const maxDateYear = maxDate2.year();
  30477. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit$1) : maxDate2;
  30478. } else {
  30479. rightDate.value = leftDate.value.add(1, unit$1);
  30480. }
  30481. }
  30482. watch(() => props.visible, (visible) => {
  30483. if (!visible && rangeState.value.selecting) {
  30484. parseValue(props.parsedValue);
  30485. onSelect(false);
  30486. }
  30487. });
  30488. emit("set-picker-option", ["isValidValue", isValidRange]);
  30489. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  30490. emit("set-picker-option", ["handleClear", handleClear]);
  30491. return (_ctx, _cache) => {
  30492. return openBlock(), createElementBlock("div", {
  30493. class: normalizeClass([
  30494. unref(ppNs).b(),
  30495. unref(drpNs).b(),
  30496. unref(ppNs).is("border", _ctx.border),
  30497. unref(ppNs).is("disabled", _ctx.disabled),
  30498. {
  30499. "has-sidebar": Boolean(_ctx.$slots.sidebar) || unref(hasShortcuts)
  30500. }
  30501. ])
  30502. }, [
  30503. createElementVNode("div", {
  30504. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  30505. }, [
  30506. renderSlot(_ctx.$slots, "sidebar", {
  30507. class: normalizeClass(unref(ppNs).e("sidebar"))
  30508. }),
  30509. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  30510. key: 0,
  30511. class: normalizeClass(unref(ppNs).e("sidebar"))
  30512. }, [
  30513. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  30514. return openBlock(), createElementBlock("button", {
  30515. key,
  30516. type: "button",
  30517. class: normalizeClass(unref(ppNs).e("shortcut")),
  30518. disabled: _ctx.disabled,
  30519. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  30520. }, toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
  30521. }), 128))
  30522. ], 2)) : createCommentVNode("v-if", true),
  30523. createElementVNode("div", {
  30524. class: normalizeClass(unref(ppNs).e("body"))
  30525. }, [
  30526. createElementVNode("div", {
  30527. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
  30528. }, [
  30529. createElementVNode("div", {
  30530. class: normalizeClass(unref(drpNs).e("header"))
  30531. }, [
  30532. createElementVNode("button", {
  30533. type: "button",
  30534. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  30535. disabled: _ctx.disabled,
  30536. onClick: unref(leftPrevYear)
  30537. }, [
  30538. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30539. createVNode(unref(ElIcon), null, {
  30540. default: withCtx(() => [
  30541. createVNode(unref(d_arrow_left_default))
  30542. ]),
  30543. _: 1
  30544. })
  30545. ])
  30546. ], 10, ["disabled", "onClick"]),
  30547. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  30548. key: 0,
  30549. type: "button",
  30550. disabled: !unref(enableYearArrow) || _ctx.disabled,
  30551. class: normalizeClass([[
  30552. unref(ppNs).e("icon-btn"),
  30553. unref(ppNs).is("disabled", !unref(enableYearArrow))
  30554. ], "d-arrow-right"]),
  30555. onClick: unref(leftNextYear)
  30556. }, [
  30557. renderSlot(_ctx.$slots, "next-year", {}, () => [
  30558. createVNode(unref(ElIcon), null, {
  30559. default: withCtx(() => [
  30560. createVNode(unref(d_arrow_right_default))
  30561. ]),
  30562. _: 1
  30563. })
  30564. ])
  30565. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  30566. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  30567. ], 2),
  30568. createVNode(MonthTable, {
  30569. "selection-mode": "range",
  30570. date: leftDate.value,
  30571. "min-date": unref(minDate),
  30572. "max-date": unref(maxDate),
  30573. "range-state": unref(rangeState),
  30574. "disabled-date": unref(disabledDate),
  30575. disabled: _ctx.disabled,
  30576. "cell-class-name": unref(cellClassName),
  30577. onChangerange: unref(handleChangeRange),
  30578. onPick: handleRangePick,
  30579. onSelect: unref(onSelect)
  30580. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
  30581. ], 2),
  30582. createElementVNode("div", {
  30583. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
  30584. }, [
  30585. createElementVNode("div", {
  30586. class: normalizeClass(unref(drpNs).e("header"))
  30587. }, [
  30588. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  30589. key: 0,
  30590. type: "button",
  30591. disabled: !unref(enableYearArrow) || _ctx.disabled,
  30592. class: normalizeClass([[
  30593. unref(ppNs).e("icon-btn"),
  30594. unref(ppNs).is("disabled", !unref(enableYearArrow))
  30595. ], "d-arrow-left"]),
  30596. onClick: unref(rightPrevYear)
  30597. }, [
  30598. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30599. createVNode(unref(ElIcon), null, {
  30600. default: withCtx(() => [
  30601. createVNode(unref(d_arrow_left_default))
  30602. ]),
  30603. _: 1
  30604. })
  30605. ])
  30606. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  30607. createElementVNode("button", {
  30608. type: "button",
  30609. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  30610. disabled: _ctx.disabled,
  30611. onClick: unref(rightNextYear)
  30612. }, [
  30613. renderSlot(_ctx.$slots, "next-year", {}, () => [
  30614. createVNode(unref(ElIcon), null, {
  30615. default: withCtx(() => [
  30616. createVNode(unref(d_arrow_right_default))
  30617. ]),
  30618. _: 1
  30619. })
  30620. ])
  30621. ], 10, ["disabled", "onClick"]),
  30622. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  30623. ], 2),
  30624. createVNode(MonthTable, {
  30625. "selection-mode": "range",
  30626. date: rightDate.value,
  30627. "min-date": unref(minDate),
  30628. "max-date": unref(maxDate),
  30629. "range-state": unref(rangeState),
  30630. "disabled-date": unref(disabledDate),
  30631. disabled: _ctx.disabled,
  30632. "cell-class-name": unref(cellClassName),
  30633. onChangerange: unref(handleChangeRange),
  30634. onPick: handleRangePick,
  30635. onSelect: unref(onSelect)
  30636. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
  30637. ], 2)
  30638. ], 2)
  30639. ], 2)
  30640. ], 2);
  30641. };
  30642. }
  30643. });
  30644. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "panel-month-range.vue"]]);
  30645. const panelYearRangeProps = buildProps({
  30646. ...panelRangeSharedProps
  30647. });
  30648. const panelYearRangeEmits = [
  30649. "pick",
  30650. "set-picker-option",
  30651. "calendar-change"
  30652. ];
  30653. const useYearRangeHeader = ({
  30654. unlinkPanels,
  30655. leftDate,
  30656. rightDate
  30657. }) => {
  30658. const leftPrevYear = () => {
  30659. leftDate.value = leftDate.value.subtract(10, "year");
  30660. if (!unlinkPanels.value) {
  30661. rightDate.value = rightDate.value.subtract(10, "year");
  30662. }
  30663. };
  30664. const rightNextYear = () => {
  30665. if (!unlinkPanels.value) {
  30666. leftDate.value = leftDate.value.add(10, "year");
  30667. }
  30668. rightDate.value = rightDate.value.add(10, "year");
  30669. };
  30670. const leftNextYear = () => {
  30671. leftDate.value = leftDate.value.add(10, "year");
  30672. };
  30673. const rightPrevYear = () => {
  30674. rightDate.value = rightDate.value.subtract(10, "year");
  30675. };
  30676. const leftLabel = computed(() => {
  30677. const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10;
  30678. return `${leftStartDate}-${leftStartDate + 9}`;
  30679. });
  30680. const rightLabel = computed(() => {
  30681. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  30682. return `${rightStartDate}-${rightStartDate + 9}`;
  30683. });
  30684. const leftYear = computed(() => {
  30685. const leftEndDate = Math.floor(leftDate.value.year() / 10) * 10 + 9;
  30686. return leftEndDate;
  30687. });
  30688. const rightYear = computed(() => {
  30689. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  30690. return rightStartDate;
  30691. });
  30692. return {
  30693. leftPrevYear,
  30694. rightNextYear,
  30695. leftNextYear,
  30696. rightPrevYear,
  30697. leftLabel,
  30698. rightLabel,
  30699. leftYear,
  30700. rightYear
  30701. };
  30702. };
  30703. const step = 10;
  30704. const unit = "year";
  30705. const __default__$12 = defineComponent({
  30706. name: "DatePickerYearRange"
  30707. });
  30708. const _sfc_main$1p = /* @__PURE__ */ defineComponent({
  30709. ...__default__$12,
  30710. props: panelYearRangeProps,
  30711. emits: panelYearRangeEmits,
  30712. setup(__props, { emit }) {
  30713. const props = __props;
  30714. const { lang } = useLocale();
  30715. const leftDate = ref(dayjs().locale(lang.value));
  30716. const rightDate = ref(dayjs().locale(lang.value).add(step, unit));
  30717. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  30718. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  30719. const { shortcuts, disabledDate, cellClassName } = pickerBase.props;
  30720. const format = toRef(pickerBase.props, "format");
  30721. const defaultValue = toRef(pickerBase.props, "defaultValue");
  30722. const {
  30723. minDate,
  30724. maxDate,
  30725. rangeState,
  30726. ppNs,
  30727. drpNs,
  30728. handleChangeRange,
  30729. handleRangeConfirm,
  30730. handleShortcutClick,
  30731. onSelect,
  30732. parseValue
  30733. } = useRangePicker(props, {
  30734. defaultValue,
  30735. leftDate,
  30736. rightDate,
  30737. step,
  30738. unit,
  30739. sortDates
  30740. });
  30741. const {
  30742. leftPrevYear,
  30743. rightNextYear,
  30744. leftNextYear,
  30745. rightPrevYear,
  30746. leftLabel,
  30747. rightLabel,
  30748. leftYear,
  30749. rightYear
  30750. } = useYearRangeHeader({
  30751. unlinkPanels: toRef(props, "unlinkPanels"),
  30752. leftDate,
  30753. rightDate
  30754. });
  30755. const hasShortcuts = computed(() => !!shortcuts.length);
  30756. const panelKls = computed(() => [
  30757. ppNs.b(),
  30758. drpNs.b(),
  30759. ppNs.is("border", props.border),
  30760. ppNs.is("disabled", props.disabled),
  30761. {
  30762. "has-sidebar": Boolean(useSlots().sidebar) || hasShortcuts.value
  30763. }
  30764. ]);
  30765. const leftPanelKls = computed(() => {
  30766. return {
  30767. content: [ppNs.e("content"), drpNs.e("content"), "is-left"],
  30768. arrowLeftBtn: [ppNs.e("icon-btn"), "d-arrow-left"],
  30769. arrowRightBtn: [
  30770. ppNs.e("icon-btn"),
  30771. ppNs.is("disabled", !enableYearArrow.value),
  30772. "d-arrow-right"
  30773. ]
  30774. };
  30775. });
  30776. const rightPanelKls = computed(() => {
  30777. return {
  30778. content: [ppNs.e("content"), drpNs.e("content"), "is-right"],
  30779. arrowLeftBtn: [
  30780. ppNs.e("icon-btn"),
  30781. ppNs.is("disabled", !enableYearArrow.value),
  30782. "d-arrow-left"
  30783. ],
  30784. arrowRightBtn: [ppNs.e("icon-btn"), "d-arrow-right"]
  30785. };
  30786. });
  30787. const enableYearArrow = computed(() => {
  30788. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  30789. });
  30790. const handleRangePick = (val, close = true) => {
  30791. const minDate_ = val.minDate;
  30792. const maxDate_ = val.maxDate;
  30793. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  30794. return;
  30795. }
  30796. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  30797. maxDate.value = maxDate_;
  30798. minDate.value = minDate_;
  30799. if (!close)
  30800. return;
  30801. handleRangeConfirm();
  30802. };
  30803. const parseUserInput = (value) => {
  30804. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  30805. };
  30806. const isValidValue = (date) => {
  30807. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  30808. };
  30809. const handleClear = () => {
  30810. let valueOnClear = null;
  30811. if (pickerBase == null ? void 0 : pickerBase.emptyValues) {
  30812. valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  30813. }
  30814. const defaultArr = getDefaultValue(unref(defaultValue), {
  30815. lang: unref(lang),
  30816. step,
  30817. unit,
  30818. unlinkPanels: props.unlinkPanels
  30819. });
  30820. leftDate.value = defaultArr[0];
  30821. rightDate.value = defaultArr[1];
  30822. emit("pick", valueOnClear);
  30823. };
  30824. function sortDates(minDate2, maxDate2) {
  30825. if (props.unlinkPanels && maxDate2) {
  30826. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  30827. const maxDateYear = maxDate2.year();
  30828. rightDate.value = minDateYear + step > maxDateYear ? maxDate2.add(step, unit) : maxDate2;
  30829. } else {
  30830. rightDate.value = leftDate.value.add(step, unit);
  30831. }
  30832. }
  30833. watch(() => props.visible, (visible) => {
  30834. if (!visible && rangeState.value.selecting) {
  30835. parseValue(props.parsedValue);
  30836. onSelect(false);
  30837. }
  30838. });
  30839. emit("set-picker-option", ["isValidValue", isValidValue]);
  30840. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  30841. emit("set-picker-option", ["handleClear", handleClear]);
  30842. return (_ctx, _cache) => {
  30843. return openBlock(), createElementBlock("div", {
  30844. class: normalizeClass(unref(panelKls))
  30845. }, [
  30846. createElementVNode("div", {
  30847. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  30848. }, [
  30849. renderSlot(_ctx.$slots, "sidebar", {
  30850. class: normalizeClass(unref(ppNs).e("sidebar"))
  30851. }),
  30852. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  30853. key: 0,
  30854. class: normalizeClass(unref(ppNs).e("sidebar"))
  30855. }, [
  30856. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  30857. return openBlock(), createElementBlock("button", {
  30858. key,
  30859. type: "button",
  30860. class: normalizeClass(unref(ppNs).e("shortcut")),
  30861. disabled: _ctx.disabled,
  30862. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  30863. }, toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
  30864. }), 128))
  30865. ], 2)) : createCommentVNode("v-if", true),
  30866. createElementVNode("div", {
  30867. class: normalizeClass(unref(ppNs).e("body"))
  30868. }, [
  30869. createElementVNode("div", {
  30870. class: normalizeClass(unref(leftPanelKls).content)
  30871. }, [
  30872. createElementVNode("div", {
  30873. class: normalizeClass(unref(drpNs).e("header"))
  30874. }, [
  30875. createElementVNode("button", {
  30876. type: "button",
  30877. class: normalizeClass(unref(leftPanelKls).arrowLeftBtn),
  30878. disabled: _ctx.disabled,
  30879. onClick: unref(leftPrevYear)
  30880. }, [
  30881. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30882. createVNode(unref(ElIcon), null, {
  30883. default: withCtx(() => [
  30884. createVNode(unref(d_arrow_left_default))
  30885. ]),
  30886. _: 1
  30887. })
  30888. ])
  30889. ], 10, ["disabled", "onClick"]),
  30890. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  30891. key: 0,
  30892. type: "button",
  30893. disabled: !unref(enableYearArrow) || _ctx.disabled,
  30894. class: normalizeClass(unref(leftPanelKls).arrowRightBtn),
  30895. onClick: unref(leftNextYear)
  30896. }, [
  30897. renderSlot(_ctx.$slots, "next-year", {}, () => [
  30898. createVNode(unref(ElIcon), null, {
  30899. default: withCtx(() => [
  30900. createVNode(unref(d_arrow_right_default))
  30901. ]),
  30902. _: 1
  30903. })
  30904. ])
  30905. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  30906. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  30907. ], 2),
  30908. createVNode(YearTable, {
  30909. "selection-mode": "range",
  30910. date: leftDate.value,
  30911. "min-date": unref(minDate),
  30912. "max-date": unref(maxDate),
  30913. "range-state": unref(rangeState),
  30914. "disabled-date": unref(disabledDate),
  30915. disabled: _ctx.disabled,
  30916. "cell-class-name": unref(cellClassName),
  30917. onChangerange: unref(handleChangeRange),
  30918. onPick: handleRangePick,
  30919. onSelect: unref(onSelect)
  30920. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
  30921. ], 2),
  30922. createElementVNode("div", {
  30923. class: normalizeClass(unref(rightPanelKls).content)
  30924. }, [
  30925. createElementVNode("div", {
  30926. class: normalizeClass(unref(drpNs).e("header"))
  30927. }, [
  30928. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  30929. key: 0,
  30930. type: "button",
  30931. disabled: !unref(enableYearArrow) || _ctx.disabled,
  30932. class: normalizeClass(unref(rightPanelKls).arrowLeftBtn),
  30933. onClick: unref(rightPrevYear)
  30934. }, [
  30935. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30936. createVNode(unref(ElIcon), null, {
  30937. default: withCtx(() => [
  30938. createVNode(unref(d_arrow_left_default))
  30939. ]),
  30940. _: 1
  30941. })
  30942. ])
  30943. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  30944. createElementVNode("button", {
  30945. type: "button",
  30946. class: normalizeClass(unref(rightPanelKls).arrowRightBtn),
  30947. disabled: _ctx.disabled,
  30948. onClick: unref(rightNextYear)
  30949. }, [
  30950. renderSlot(_ctx.$slots, "next-year", {}, () => [
  30951. createVNode(unref(ElIcon), null, {
  30952. default: withCtx(() => [
  30953. createVNode(unref(d_arrow_right_default))
  30954. ]),
  30955. _: 1
  30956. })
  30957. ])
  30958. ], 10, ["disabled", "onClick"]),
  30959. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  30960. ], 2),
  30961. createVNode(YearTable, {
  30962. "selection-mode": "range",
  30963. date: rightDate.value,
  30964. "min-date": unref(minDate),
  30965. "max-date": unref(maxDate),
  30966. "range-state": unref(rangeState),
  30967. "disabled-date": unref(disabledDate),
  30968. disabled: _ctx.disabled,
  30969. "cell-class-name": unref(cellClassName),
  30970. onChangerange: unref(handleChangeRange),
  30971. onPick: handleRangePick,
  30972. onSelect: unref(onSelect)
  30973. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
  30974. ], 2)
  30975. ], 2)
  30976. ], 2)
  30977. ], 2);
  30978. };
  30979. }
  30980. });
  30981. var YearRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "panel-year-range.vue"]]);
  30982. const getPanel = function(type) {
  30983. switch (type) {
  30984. case "daterange":
  30985. case "datetimerange": {
  30986. return DateRangePickPanel;
  30987. }
  30988. case "monthrange": {
  30989. return MonthRangePickPanel;
  30990. }
  30991. case "yearrange": {
  30992. return YearRangePickPanel;
  30993. }
  30994. default: {
  30995. return DatePickPanel;
  30996. }
  30997. }
  30998. };
  30999. function _isSlot$7(s) {
  31000. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  31001. }
  31002. dayjs.extend(localeData);
  31003. dayjs.extend(advancedFormat);
  31004. dayjs.extend(customParseFormat);
  31005. dayjs.extend(weekOfYear);
  31006. dayjs.extend(weekYear);
  31007. dayjs.extend(dayOfYear);
  31008. dayjs.extend(isSameOrAfter);
  31009. dayjs.extend(isSameOrBefore);
  31010. var DatePickerPanel = defineComponent({
  31011. name: "ElDatePickerPanel",
  31012. install: null,
  31013. props: datePickerPanelProps,
  31014. emits: [UPDATE_MODEL_EVENT, "calendar-change", "panel-change", "visible-change", "pick"],
  31015. setup(props, {
  31016. slots,
  31017. emit
  31018. }) {
  31019. const ns = useNamespace("picker-panel");
  31020. const pickerInjection = inject(PICKER_BASE_INJECTION_KEY, void 0);
  31021. if (isUndefined(pickerInjection)) {
  31022. const _props = reactive({
  31023. ...toRefs(props)
  31024. });
  31025. provide(PICKER_BASE_INJECTION_KEY, {
  31026. props: _props
  31027. });
  31028. }
  31029. provide(ROOT_PICKER_INJECTION_KEY, {
  31030. slots,
  31031. pickerNs: ns
  31032. });
  31033. const {
  31034. parsedValue,
  31035. onCalendarChange,
  31036. onPanelChange,
  31037. onSetPickerOption,
  31038. onPick
  31039. } = inject(ROOT_COMMON_PICKER_INJECTION_KEY, () => useCommonPicker(props, emit), true);
  31040. return () => {
  31041. const Component = getPanel(props.type);
  31042. return createVNode(Component, mergeProps(props, {
  31043. "parsedValue": parsedValue.value,
  31044. "onSet-picker-option": onSetPickerOption,
  31045. "onCalendar-change": onCalendarChange,
  31046. "onPanel-change": onPanelChange,
  31047. "onPick": onPick
  31048. }), _isSlot$7(slots) ? slots : {
  31049. default: () => [slots]
  31050. });
  31051. };
  31052. }
  31053. });
  31054. const ElDatePickerPanel = withInstall(DatePickerPanel);
  31055. const datePickerProps = buildProps({
  31056. ...timePickerDefaultProps,
  31057. type: {
  31058. type: definePropType(String),
  31059. default: "date"
  31060. }
  31061. });
  31062. function _isSlot$6(s) {
  31063. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  31064. }
  31065. var DatePicker = defineComponent({
  31066. name: "ElDatePicker",
  31067. install: null,
  31068. props: datePickerProps,
  31069. emits: [UPDATE_MODEL_EVENT],
  31070. setup(props, {
  31071. expose,
  31072. emit,
  31073. slots
  31074. }) {
  31075. const isDefaultFormat = computed(() => {
  31076. return !props.format;
  31077. });
  31078. provide(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, isDefaultFormat);
  31079. provide(PICKER_POPPER_OPTIONS_INJECTION_KEY, reactive(toRef(props, "popperOptions")));
  31080. const commonPicker = ref();
  31081. const refProps = {
  31082. focus: () => {
  31083. var _a;
  31084. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  31085. },
  31086. blur: () => {
  31087. var _a;
  31088. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  31089. },
  31090. handleOpen: () => {
  31091. var _a;
  31092. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  31093. },
  31094. handleClose: () => {
  31095. var _a;
  31096. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  31097. }
  31098. };
  31099. expose(refProps);
  31100. const onModelValueUpdated = (val) => {
  31101. emit(UPDATE_MODEL_EVENT, val);
  31102. };
  31103. return () => {
  31104. var _a;
  31105. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  31106. return createVNode(CommonPicker, mergeProps(props, {
  31107. "format": format,
  31108. "type": props.type,
  31109. "ref": commonPicker,
  31110. "onUpdate:modelValue": onModelValueUpdated
  31111. }), {
  31112. default: (scopedProps) => createVNode(ElDatePickerPanel, mergeProps({
  31113. "border": false
  31114. }, scopedProps), _isSlot$6(slots) ? slots : {
  31115. default: () => [slots]
  31116. }),
  31117. "range-separator": slots["range-separator"]
  31118. });
  31119. };
  31120. }
  31121. });
  31122. const ElDatePicker = withInstall(DatePicker);
  31123. const descriptionsKey = Symbol("elDescriptions");
  31124. var ElDescriptionsCell = defineComponent({
  31125. name: "ElDescriptionsCell",
  31126. props: {
  31127. cell: {
  31128. type: Object
  31129. },
  31130. tag: {
  31131. type: String,
  31132. default: "td"
  31133. },
  31134. type: {
  31135. type: String
  31136. }
  31137. },
  31138. setup() {
  31139. const descriptions = inject(descriptionsKey, {});
  31140. return {
  31141. descriptions
  31142. };
  31143. },
  31144. render() {
  31145. var _a;
  31146. const item = getNormalizedProps(this.cell);
  31147. const directives = (((_a = this.cell) == null ? void 0 : _a.dirs) || []).map((dire) => {
  31148. const { dir, arg, modifiers, value } = dire;
  31149. return [dir, value, arg, modifiers];
  31150. });
  31151. const { border, direction } = this.descriptions;
  31152. const isVertical = direction === "vertical";
  31153. const renderLabel = () => {
  31154. var _a2, _b, _c;
  31155. return ((_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b)) || item.label;
  31156. };
  31157. const renderContent = () => {
  31158. var _a2, _b, _c;
  31159. return (_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.default) == null ? void 0 : _c.call(_b);
  31160. };
  31161. const span = item.span;
  31162. const rowspan = item.rowspan;
  31163. const align = item.align ? `is-${item.align}` : "";
  31164. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  31165. const className = item.className;
  31166. const labelClassName = item.labelClassName;
  31167. const width = this.type === "label" ? item.labelWidth || this.descriptions.labelWidth || item.width : item.width;
  31168. const style = {
  31169. width: addUnit(width),
  31170. minWidth: addUnit(item.minWidth)
  31171. };
  31172. const ns = useNamespace("descriptions");
  31173. switch (this.type) {
  31174. case "label":
  31175. return withDirectives(h$1(this.tag, {
  31176. style,
  31177. class: [
  31178. ns.e("cell"),
  31179. ns.e("label"),
  31180. ns.is("bordered-label", border),
  31181. ns.is("vertical-label", isVertical),
  31182. labelAlign,
  31183. labelClassName
  31184. ],
  31185. colSpan: isVertical ? span : 1,
  31186. rowspan: isVertical ? 1 : rowspan
  31187. }, renderLabel()), directives);
  31188. case "content":
  31189. return withDirectives(h$1(this.tag, {
  31190. style,
  31191. class: [
  31192. ns.e("cell"),
  31193. ns.e("content"),
  31194. ns.is("bordered-content", border),
  31195. ns.is("vertical-content", isVertical),
  31196. align,
  31197. className
  31198. ],
  31199. colSpan: isVertical ? span : span * 2 - 1,
  31200. rowspan: isVertical ? rowspan * 2 - 1 : rowspan
  31201. }, renderContent()), directives);
  31202. default: {
  31203. const label = renderLabel();
  31204. const labelStyle = {};
  31205. const width2 = addUnit(item.labelWidth || this.descriptions.labelWidth);
  31206. if (width2) {
  31207. labelStyle.width = width2;
  31208. labelStyle.display = "inline-block";
  31209. }
  31210. return withDirectives(h$1("td", {
  31211. style,
  31212. class: [ns.e("cell"), align],
  31213. colSpan: span,
  31214. rowspan
  31215. }, [
  31216. !isNil(label) ? h$1("span", {
  31217. style: labelStyle,
  31218. class: [ns.e("label"), labelClassName]
  31219. }, label) : void 0,
  31220. h$1("span", {
  31221. class: [ns.e("content"), className]
  31222. }, renderContent())
  31223. ]), directives);
  31224. }
  31225. }
  31226. }
  31227. });
  31228. const descriptionsRowProps = buildProps({
  31229. row: {
  31230. type: definePropType(Array),
  31231. default: () => []
  31232. }
  31233. });
  31234. const __default__$11 = defineComponent({
  31235. name: "ElDescriptionsRow"
  31236. });
  31237. const _sfc_main$1o = /* @__PURE__ */ defineComponent({
  31238. ...__default__$11,
  31239. props: descriptionsRowProps,
  31240. setup(__props) {
  31241. const descriptions = inject(descriptionsKey, {});
  31242. return (_ctx, _cache) => {
  31243. return unref(descriptions).direction === "vertical" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  31244. createElementVNode("tr", null, [
  31245. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  31246. return openBlock(), createBlock(unref(ElDescriptionsCell), {
  31247. key: `tr1-${_index}`,
  31248. cell,
  31249. tag: "th",
  31250. type: "label"
  31251. }, null, 8, ["cell"]);
  31252. }), 128))
  31253. ]),
  31254. createElementVNode("tr", null, [
  31255. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  31256. return openBlock(), createBlock(unref(ElDescriptionsCell), {
  31257. key: `tr2-${_index}`,
  31258. cell,
  31259. tag: "td",
  31260. type: "content"
  31261. }, null, 8, ["cell"]);
  31262. }), 128))
  31263. ])
  31264. ], 64)) : (openBlock(), createElementBlock("tr", { key: 1 }, [
  31265. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  31266. return openBlock(), createElementBlock(Fragment, {
  31267. key: `tr3-${_index}`
  31268. }, [
  31269. unref(descriptions).border ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  31270. createVNode(unref(ElDescriptionsCell), {
  31271. cell,
  31272. tag: "td",
  31273. type: "label"
  31274. }, null, 8, ["cell"]),
  31275. createVNode(unref(ElDescriptionsCell), {
  31276. cell,
  31277. tag: "td",
  31278. type: "content"
  31279. }, null, 8, ["cell"])
  31280. ], 64)) : (openBlock(), createBlock(unref(ElDescriptionsCell), {
  31281. key: 1,
  31282. cell,
  31283. tag: "td",
  31284. type: "both"
  31285. }, null, 8, ["cell"]))
  31286. ], 64);
  31287. }), 128))
  31288. ]));
  31289. };
  31290. }
  31291. });
  31292. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "descriptions-row.vue"]]);
  31293. const descriptionProps = buildProps({
  31294. border: Boolean,
  31295. column: {
  31296. type: Number,
  31297. default: 3
  31298. },
  31299. direction: {
  31300. type: String,
  31301. values: ["horizontal", "vertical"],
  31302. default: "horizontal"
  31303. },
  31304. size: useSizeProp,
  31305. title: {
  31306. type: String,
  31307. default: ""
  31308. },
  31309. extra: {
  31310. type: String,
  31311. default: ""
  31312. },
  31313. labelWidth: {
  31314. type: [String, Number],
  31315. default: ""
  31316. }
  31317. });
  31318. const COMPONENT_NAME$f = "ElDescriptionsItem";
  31319. const __default__$10 = defineComponent({
  31320. name: "ElDescriptions"
  31321. });
  31322. const _sfc_main$1n = /* @__PURE__ */ defineComponent({
  31323. ...__default__$10,
  31324. props: descriptionProps,
  31325. setup(__props) {
  31326. const props = __props;
  31327. const ns = useNamespace("descriptions");
  31328. const descriptionsSize = useFormSize();
  31329. const slots = useSlots();
  31330. provide(descriptionsKey, props);
  31331. const descriptionKls = computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  31332. const filledNode = (node, span, count, isLast = false) => {
  31333. if (!node.props) {
  31334. node.props = {};
  31335. }
  31336. if (span > count) {
  31337. node.props.span = count;
  31338. }
  31339. if (isLast) {
  31340. node.props.span = span;
  31341. }
  31342. return node;
  31343. };
  31344. const getRows = () => {
  31345. if (!slots.default)
  31346. return [];
  31347. const children = flattedChildren(slots.default()).filter((node) => {
  31348. var _a;
  31349. return ((_a = node == null ? void 0 : node.type) == null ? void 0 : _a.name) === COMPONENT_NAME$f;
  31350. });
  31351. const rows = [];
  31352. let temp = [];
  31353. let count = props.column;
  31354. let totalSpan = 0;
  31355. const rowspanTemp = [];
  31356. children.forEach((node, index) => {
  31357. var _a, _b, _c;
  31358. const span = ((_a = node.props) == null ? void 0 : _a.span) || 1;
  31359. const rowspan = ((_b = node.props) == null ? void 0 : _b.rowspan) || 1;
  31360. const rowNo = rows.length;
  31361. rowspanTemp[rowNo] || (rowspanTemp[rowNo] = 0);
  31362. if (rowspan > 1) {
  31363. for (let i = 1; i < rowspan; i++) {
  31364. rowspanTemp[_c = rowNo + i] || (rowspanTemp[_c] = 0);
  31365. rowspanTemp[rowNo + i]++;
  31366. totalSpan++;
  31367. }
  31368. }
  31369. if (rowspanTemp[rowNo] > 0) {
  31370. count -= rowspanTemp[rowNo];
  31371. rowspanTemp[rowNo] = 0;
  31372. }
  31373. if (index < children.length - 1) {
  31374. totalSpan += span > count ? count : span;
  31375. }
  31376. if (index === children.length - 1) {
  31377. const lastSpan = props.column - totalSpan % props.column;
  31378. temp.push(filledNode(node, lastSpan, count, true));
  31379. rows.push(temp);
  31380. return;
  31381. }
  31382. if (span < count) {
  31383. count -= span;
  31384. temp.push(node);
  31385. } else {
  31386. temp.push(filledNode(node, span, count));
  31387. rows.push(temp);
  31388. count = props.column;
  31389. temp = [];
  31390. }
  31391. });
  31392. return rows;
  31393. };
  31394. return (_ctx, _cache) => {
  31395. return openBlock(), createElementBlock("div", {
  31396. class: normalizeClass(unref(descriptionKls))
  31397. }, [
  31398. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  31399. key: 0,
  31400. class: normalizeClass(unref(ns).e("header"))
  31401. }, [
  31402. createElementVNode("div", {
  31403. class: normalizeClass(unref(ns).e("title"))
  31404. }, [
  31405. renderSlot(_ctx.$slots, "title", {}, () => [
  31406. createTextVNode(toDisplayString(_ctx.title), 1)
  31407. ])
  31408. ], 2),
  31409. createElementVNode("div", {
  31410. class: normalizeClass(unref(ns).e("extra"))
  31411. }, [
  31412. renderSlot(_ctx.$slots, "extra", {}, () => [
  31413. createTextVNode(toDisplayString(_ctx.extra), 1)
  31414. ])
  31415. ], 2)
  31416. ], 2)) : createCommentVNode("v-if", true),
  31417. createElementVNode("div", {
  31418. class: normalizeClass(unref(ns).e("body"))
  31419. }, [
  31420. createElementVNode("table", {
  31421. class: normalizeClass([unref(ns).e("table"), unref(ns).is("bordered", _ctx.border)])
  31422. }, [
  31423. createElementVNode("tbody", null, [
  31424. (openBlock(true), createElementBlock(Fragment, null, renderList(getRows(), (row, _index) => {
  31425. return openBlock(), createBlock(ElDescriptionsRow, {
  31426. key: _index,
  31427. row
  31428. }, null, 8, ["row"]);
  31429. }), 128))
  31430. ])
  31431. ], 2)
  31432. ], 2)
  31433. ], 2);
  31434. };
  31435. }
  31436. });
  31437. var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "description.vue"]]);
  31438. const descriptionItemProps = buildProps({
  31439. label: {
  31440. type: String,
  31441. default: ""
  31442. },
  31443. span: {
  31444. type: Number,
  31445. default: 1
  31446. },
  31447. rowspan: {
  31448. type: Number,
  31449. default: 1
  31450. },
  31451. width: {
  31452. type: [String, Number],
  31453. default: ""
  31454. },
  31455. minWidth: {
  31456. type: [String, Number],
  31457. default: ""
  31458. },
  31459. labelWidth: {
  31460. type: [String, Number],
  31461. default: ""
  31462. },
  31463. align: {
  31464. type: String,
  31465. values: columnAlignment,
  31466. default: "left"
  31467. },
  31468. labelAlign: {
  31469. type: String,
  31470. values: columnAlignment
  31471. },
  31472. className: {
  31473. type: String,
  31474. default: ""
  31475. },
  31476. labelClassName: {
  31477. type: String,
  31478. default: ""
  31479. }
  31480. });
  31481. const DescriptionItem = defineComponent({
  31482. name: COMPONENT_NAME$f,
  31483. props: descriptionItemProps
  31484. });
  31485. const ElDescriptions = withInstall(Descriptions, {
  31486. DescriptionsItem: DescriptionItem
  31487. });
  31488. const ElDescriptionsItem = withNoopInstall(DescriptionItem);
  31489. const overlayProps = buildProps({
  31490. mask: {
  31491. type: Boolean,
  31492. default: true
  31493. },
  31494. customMaskEvent: Boolean,
  31495. overlayClass: {
  31496. type: definePropType([
  31497. String,
  31498. Array,
  31499. Object
  31500. ])
  31501. },
  31502. zIndex: {
  31503. type: definePropType([String, Number])
  31504. }
  31505. });
  31506. const overlayEmits = {
  31507. click: (evt) => evt instanceof MouseEvent
  31508. };
  31509. const BLOCK = "overlay";
  31510. var Overlay$1 = defineComponent({
  31511. name: "ElOverlay",
  31512. props: overlayProps,
  31513. emits: overlayEmits,
  31514. setup(props, { slots, emit }) {
  31515. const ns = useNamespace(BLOCK);
  31516. const onMaskClick = (e) => {
  31517. emit("click", e);
  31518. };
  31519. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  31520. return () => {
  31521. return props.mask ? createVNode("div", {
  31522. class: [ns.b(), props.overlayClass],
  31523. style: {
  31524. zIndex: props.zIndex
  31525. },
  31526. onClick,
  31527. onMousedown,
  31528. onMouseup
  31529. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h$1("div", {
  31530. class: props.overlayClass,
  31531. style: {
  31532. zIndex: props.zIndex,
  31533. position: "fixed",
  31534. top: "0px",
  31535. right: "0px",
  31536. bottom: "0px",
  31537. left: "0px"
  31538. }
  31539. }, [renderSlot(slots, "default")]);
  31540. };
  31541. }
  31542. });
  31543. const ElOverlay = Overlay$1;
  31544. const dialogInjectionKey = Symbol("dialogInjectionKey");
  31545. const DEFAULT_DIALOG_TRANSITION = "dialog-fade";
  31546. const dialogContentProps = buildProps({
  31547. center: Boolean,
  31548. alignCenter: {
  31549. type: Boolean,
  31550. default: void 0
  31551. },
  31552. closeIcon: {
  31553. type: iconPropType
  31554. },
  31555. draggable: {
  31556. type: Boolean,
  31557. default: void 0
  31558. },
  31559. overflow: {
  31560. type: Boolean,
  31561. default: void 0
  31562. },
  31563. fullscreen: Boolean,
  31564. headerClass: String,
  31565. bodyClass: String,
  31566. footerClass: String,
  31567. showClose: {
  31568. type: Boolean,
  31569. default: true
  31570. },
  31571. title: {
  31572. type: String,
  31573. default: ""
  31574. },
  31575. ariaLevel: {
  31576. type: String,
  31577. default: "2"
  31578. }
  31579. });
  31580. const dialogContentEmits = {
  31581. close: () => true
  31582. };
  31583. const __default__$$ = defineComponent({ name: "ElDialogContent" });
  31584. const _sfc_main$1m = /* @__PURE__ */ defineComponent({
  31585. ...__default__$$,
  31586. props: dialogContentProps,
  31587. emits: dialogContentEmits,
  31588. setup(__props, { expose }) {
  31589. const props = __props;
  31590. const { t } = useLocale();
  31591. const { Close } = CloseComponents;
  31592. const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey);
  31593. const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY);
  31594. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  31595. const draggable = computed(() => !!props.draggable);
  31596. const overflow = computed(() => !!props.overflow);
  31597. const { resetPosition, updatePosition, isDragging } = useDraggable(dialogRef, headerRef, draggable, overflow);
  31598. const dialogKls = computed(() => [
  31599. ns.b(),
  31600. ns.is("fullscreen", props.fullscreen),
  31601. ns.is("draggable", draggable.value),
  31602. ns.is("dragging", isDragging.value),
  31603. ns.is("align-center", !!props.alignCenter),
  31604. { [ns.m("center")]: props.center }
  31605. ]);
  31606. expose({
  31607. resetPosition,
  31608. updatePosition
  31609. });
  31610. return (_ctx, _cache) => {
  31611. return openBlock(), createElementBlock("div", {
  31612. ref: unref(composedDialogRef),
  31613. class: normalizeClass(unref(dialogKls)),
  31614. style: normalizeStyle(unref(style)),
  31615. tabindex: "-1"
  31616. }, [
  31617. createElementVNode("header", {
  31618. ref_key: "headerRef",
  31619. ref: headerRef,
  31620. class: normalizeClass([unref(ns).e("header"), _ctx.headerClass, { "show-close": _ctx.showClose }])
  31621. }, [
  31622. renderSlot(_ctx.$slots, "header", {}, () => [
  31623. createElementVNode("span", {
  31624. role: "heading",
  31625. "aria-level": _ctx.ariaLevel,
  31626. class: normalizeClass(unref(ns).e("title"))
  31627. }, toDisplayString(_ctx.title), 11, ["aria-level"])
  31628. ]),
  31629. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  31630. key: 0,
  31631. "aria-label": unref(t)("el.dialog.close"),
  31632. class: normalizeClass(unref(ns).e("headerbtn")),
  31633. type: "button",
  31634. onClick: ($event) => _ctx.$emit("close")
  31635. }, [
  31636. createVNode(unref(ElIcon), {
  31637. class: normalizeClass(unref(ns).e("close"))
  31638. }, {
  31639. default: withCtx(() => [
  31640. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  31641. ]),
  31642. _: 1
  31643. }, 8, ["class"])
  31644. ], 10, ["aria-label", "onClick"])) : createCommentVNode("v-if", true)
  31645. ], 2),
  31646. createElementVNode("div", {
  31647. id: unref(bodyId),
  31648. class: normalizeClass([unref(ns).e("body"), _ctx.bodyClass])
  31649. }, [
  31650. renderSlot(_ctx.$slots, "default")
  31651. ], 10, ["id"]),
  31652. _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", {
  31653. key: 0,
  31654. class: normalizeClass([unref(ns).e("footer"), _ctx.footerClass])
  31655. }, [
  31656. renderSlot(_ctx.$slots, "footer")
  31657. ], 2)) : createCommentVNode("v-if", true)
  31658. ], 6);
  31659. };
  31660. }
  31661. });
  31662. var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "dialog-content.vue"]]);
  31663. const dialogProps = buildProps({
  31664. ...dialogContentProps,
  31665. appendToBody: Boolean,
  31666. appendTo: {
  31667. type: teleportProps.to.type,
  31668. default: "body"
  31669. },
  31670. beforeClose: {
  31671. type: definePropType(Function)
  31672. },
  31673. destroyOnClose: Boolean,
  31674. closeOnClickModal: {
  31675. type: Boolean,
  31676. default: true
  31677. },
  31678. closeOnPressEscape: {
  31679. type: Boolean,
  31680. default: true
  31681. },
  31682. lockScroll: {
  31683. type: Boolean,
  31684. default: true
  31685. },
  31686. modal: {
  31687. type: Boolean,
  31688. default: true
  31689. },
  31690. modalPenetrable: Boolean,
  31691. openDelay: {
  31692. type: Number,
  31693. default: 0
  31694. },
  31695. closeDelay: {
  31696. type: Number,
  31697. default: 0
  31698. },
  31699. top: {
  31700. type: String
  31701. },
  31702. modelValue: Boolean,
  31703. modalClass: String,
  31704. headerClass: String,
  31705. bodyClass: String,
  31706. footerClass: String,
  31707. width: {
  31708. type: [String, Number]
  31709. },
  31710. zIndex: {
  31711. type: Number
  31712. },
  31713. trapFocus: Boolean,
  31714. headerAriaLevel: {
  31715. type: String,
  31716. default: "2"
  31717. },
  31718. transition: {
  31719. type: definePropType([String, Object]),
  31720. default: void 0
  31721. }
  31722. });
  31723. const dialogEmits = {
  31724. open: () => true,
  31725. opened: () => true,
  31726. close: () => true,
  31727. closed: () => true,
  31728. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  31729. openAutoFocus: () => true,
  31730. closeAutoFocus: () => true
  31731. };
  31732. const dialogContextKey = Symbol("dialogContextKey");
  31733. const COMPONENT_NAME$e = "ElDialog";
  31734. const useDialog = (props, targetRef) => {
  31735. var _a;
  31736. const instance = getCurrentInstance();
  31737. const emit = instance.emit;
  31738. const { nextZIndex } = useZIndex();
  31739. let lastPosition = "";
  31740. const titleId = useId();
  31741. const bodyId = useId();
  31742. const visible = ref(false);
  31743. const closed = ref(false);
  31744. const rendered = ref(false);
  31745. const zIndex = ref((_a = props.zIndex) != null ? _a : nextZIndex());
  31746. let openTimer = void 0;
  31747. let closeTimer = void 0;
  31748. const config = useGlobalConfig();
  31749. const namespace = computed(() => {
  31750. var _a2, _b;
  31751. return (_b = (_a2 = config.value) == null ? void 0 : _a2.namespace) != null ? _b : defaultNamespace;
  31752. });
  31753. const globalConfig = computed(() => {
  31754. var _a2;
  31755. return (_a2 = config.value) == null ? void 0 : _a2.dialog;
  31756. });
  31757. const style = computed(() => {
  31758. const style2 = {};
  31759. const varPrefix = `--${namespace.value}-dialog`;
  31760. if (!props.fullscreen) {
  31761. if (props.top) {
  31762. style2[`${varPrefix}-margin-top`] = props.top;
  31763. }
  31764. if (props.width) {
  31765. style2[`${varPrefix}-width`] = addUnit(props.width);
  31766. }
  31767. }
  31768. return style2;
  31769. });
  31770. const _draggable = computed(() => {
  31771. var _a2, _b, _c;
  31772. return ((_c = (_b = props.draggable) != null ? _b : (_a2 = globalConfig.value) == null ? void 0 : _a2.draggable) != null ? _c : false) && !props.fullscreen;
  31773. });
  31774. const _alignCenter = computed(() => {
  31775. var _a2, _b, _c;
  31776. return (_c = (_b = props.alignCenter) != null ? _b : (_a2 = globalConfig.value) == null ? void 0 : _a2.alignCenter) != null ? _c : false;
  31777. });
  31778. const _overflow = computed(() => {
  31779. var _a2, _b, _c;
  31780. return (_c = (_b = props.overflow) != null ? _b : (_a2 = globalConfig.value) == null ? void 0 : _a2.overflow) != null ? _c : false;
  31781. });
  31782. const overlayDialogStyle = computed(() => {
  31783. if (_alignCenter.value) {
  31784. return { display: "flex" };
  31785. }
  31786. return {};
  31787. });
  31788. const transitionConfig = computed(() => {
  31789. var _a2, _b, _c;
  31790. const transition = (_c = (_b = props.transition) != null ? _b : (_a2 = globalConfig.value) == null ? void 0 : _a2.transition) != null ? _c : DEFAULT_DIALOG_TRANSITION;
  31791. const baseConfig = {
  31792. name: transition,
  31793. onAfterEnter: afterEnter,
  31794. onBeforeLeave: beforeLeave,
  31795. onAfterLeave: afterLeave
  31796. };
  31797. if (isObject$1(transition)) {
  31798. const config2 = { ...transition };
  31799. const _mergeHook = (userHook, defaultHook) => {
  31800. return (el) => {
  31801. if (isArray$1(userHook)) {
  31802. userHook.forEach((fn) => {
  31803. if (isFunction$1(fn))
  31804. fn(el);
  31805. });
  31806. } else if (isFunction$1(userHook)) {
  31807. userHook(el);
  31808. }
  31809. defaultHook();
  31810. };
  31811. };
  31812. config2.onAfterEnter = _mergeHook(config2.onAfterEnter, afterEnter);
  31813. config2.onBeforeLeave = _mergeHook(config2.onBeforeLeave, beforeLeave);
  31814. config2.onAfterLeave = _mergeHook(config2.onAfterLeave, afterLeave);
  31815. if (!config2.name) {
  31816. config2.name = DEFAULT_DIALOG_TRANSITION;
  31817. debugWarn(COMPONENT_NAME$e, `transition.name is missing when using object syntax, fallback to '${DEFAULT_DIALOG_TRANSITION}'`);
  31818. }
  31819. return config2;
  31820. }
  31821. return baseConfig;
  31822. });
  31823. function afterEnter() {
  31824. emit("opened");
  31825. }
  31826. function afterLeave() {
  31827. emit("closed");
  31828. emit(UPDATE_MODEL_EVENT, false);
  31829. if (props.destroyOnClose) {
  31830. rendered.value = false;
  31831. }
  31832. }
  31833. function beforeLeave() {
  31834. emit("close");
  31835. }
  31836. function open() {
  31837. closeTimer == null ? void 0 : closeTimer();
  31838. openTimer == null ? void 0 : openTimer();
  31839. if (props.openDelay && props.openDelay > 0) {
  31840. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  31841. } else {
  31842. doOpen();
  31843. }
  31844. }
  31845. function close() {
  31846. openTimer == null ? void 0 : openTimer();
  31847. closeTimer == null ? void 0 : closeTimer();
  31848. if (props.closeDelay && props.closeDelay > 0) {
  31849. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  31850. } else {
  31851. doClose();
  31852. }
  31853. }
  31854. function handleClose() {
  31855. function hide(shouldCancel) {
  31856. if (shouldCancel)
  31857. return;
  31858. closed.value = true;
  31859. visible.value = false;
  31860. }
  31861. if (props.beforeClose) {
  31862. props.beforeClose(hide);
  31863. } else {
  31864. close();
  31865. }
  31866. }
  31867. function onModalClick() {
  31868. if (props.closeOnClickModal) {
  31869. handleClose();
  31870. }
  31871. }
  31872. function doOpen() {
  31873. if (!isClient)
  31874. return;
  31875. visible.value = true;
  31876. }
  31877. function doClose() {
  31878. visible.value = false;
  31879. }
  31880. function onOpenAutoFocus() {
  31881. emit("openAutoFocus");
  31882. }
  31883. function onCloseAutoFocus() {
  31884. emit("closeAutoFocus");
  31885. }
  31886. function onFocusoutPrevented(event) {
  31887. var _a2;
  31888. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  31889. event.preventDefault();
  31890. }
  31891. }
  31892. if (props.lockScroll) {
  31893. useLockscreen(visible);
  31894. }
  31895. function onCloseRequested() {
  31896. if (props.closeOnPressEscape) {
  31897. handleClose();
  31898. }
  31899. }
  31900. watch(() => props.zIndex, () => {
  31901. var _a2;
  31902. zIndex.value = (_a2 = props.zIndex) != null ? _a2 : nextZIndex();
  31903. });
  31904. watch(() => props.modelValue, (val) => {
  31905. var _a2;
  31906. if (val) {
  31907. closed.value = false;
  31908. open();
  31909. rendered.value = true;
  31910. zIndex.value = (_a2 = props.zIndex) != null ? _a2 : nextZIndex();
  31911. nextTick(() => {
  31912. emit("open");
  31913. if (targetRef.value) {
  31914. targetRef.value.parentElement.scrollTop = 0;
  31915. targetRef.value.parentElement.scrollLeft = 0;
  31916. targetRef.value.scrollTop = 0;
  31917. }
  31918. });
  31919. } else {
  31920. if (visible.value) {
  31921. close();
  31922. }
  31923. }
  31924. });
  31925. watch(() => props.fullscreen, (val) => {
  31926. if (!targetRef.value)
  31927. return;
  31928. if (val) {
  31929. lastPosition = targetRef.value.style.transform;
  31930. targetRef.value.style.transform = "";
  31931. } else {
  31932. targetRef.value.style.transform = lastPosition;
  31933. }
  31934. });
  31935. onMounted(() => {
  31936. if (props.modelValue) {
  31937. visible.value = true;
  31938. rendered.value = true;
  31939. open();
  31940. }
  31941. });
  31942. return {
  31943. afterEnter,
  31944. afterLeave,
  31945. beforeLeave,
  31946. handleClose,
  31947. onModalClick,
  31948. close,
  31949. doClose,
  31950. onOpenAutoFocus,
  31951. onCloseAutoFocus,
  31952. onCloseRequested,
  31953. onFocusoutPrevented,
  31954. titleId,
  31955. bodyId,
  31956. closed,
  31957. style,
  31958. overlayDialogStyle,
  31959. rendered,
  31960. visible,
  31961. zIndex,
  31962. transitionConfig,
  31963. _draggable,
  31964. _alignCenter,
  31965. _overflow
  31966. };
  31967. };
  31968. const __default__$_ = defineComponent({
  31969. name: "ElDialog",
  31970. inheritAttrs: false
  31971. });
  31972. const _sfc_main$1l = /* @__PURE__ */ defineComponent({
  31973. ...__default__$_,
  31974. props: dialogProps,
  31975. emits: dialogEmits,
  31976. setup(__props, { expose }) {
  31977. const props = __props;
  31978. const slots = useSlots();
  31979. useDeprecated({
  31980. scope: "el-dialog",
  31981. from: "the title slot",
  31982. replacement: "the header slot",
  31983. version: "3.0.0",
  31984. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  31985. }, computed(() => !!slots.title));
  31986. const ns = useNamespace("dialog");
  31987. const dialogRef = ref();
  31988. const headerRef = ref();
  31989. const dialogContentRef = ref();
  31990. const {
  31991. visible,
  31992. titleId,
  31993. bodyId,
  31994. style,
  31995. overlayDialogStyle,
  31996. rendered,
  31997. transitionConfig,
  31998. zIndex,
  31999. _draggable,
  32000. _alignCenter,
  32001. _overflow,
  32002. handleClose,
  32003. onModalClick,
  32004. onOpenAutoFocus,
  32005. onCloseAutoFocus,
  32006. onCloseRequested,
  32007. onFocusoutPrevented
  32008. } = useDialog(props, dialogRef);
  32009. provide(dialogInjectionKey, {
  32010. dialogRef,
  32011. headerRef,
  32012. bodyId,
  32013. ns,
  32014. rendered,
  32015. style
  32016. });
  32017. const overlayEvent = useSameTarget(onModalClick);
  32018. const penetrable = computed(() => props.modalPenetrable && !props.modal && !props.fullscreen);
  32019. const resetPosition = () => {
  32020. var _a;
  32021. (_a = dialogContentRef.value) == null ? void 0 : _a.resetPosition();
  32022. };
  32023. expose({
  32024. visible,
  32025. dialogContentRef,
  32026. resetPosition,
  32027. handleClose
  32028. });
  32029. return (_ctx, _cache) => {
  32030. return openBlock(), createBlock(unref(ElTeleport$1), {
  32031. to: _ctx.appendTo,
  32032. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  32033. }, {
  32034. default: withCtx(() => [
  32035. createVNode(Transition, mergeProps(unref(transitionConfig), { persisted: "" }), {
  32036. default: withCtx(() => {
  32037. var _a;
  32038. return [
  32039. withDirectives(createVNode(unref(ElOverlay), {
  32040. "custom-mask-event": "",
  32041. mask: _ctx.modal,
  32042. "overlay-class": [
  32043. (_a = _ctx.modalClass) != null ? _a : "",
  32044. `${unref(ns).namespace.value}-modal-dialog`,
  32045. unref(ns).is("penetrable", unref(penetrable))
  32046. ],
  32047. "z-index": unref(zIndex)
  32048. }, {
  32049. default: withCtx(() => [
  32050. createElementVNode("div", {
  32051. role: "dialog",
  32052. "aria-modal": "true",
  32053. "aria-label": _ctx.title || void 0,
  32054. "aria-labelledby": !_ctx.title ? unref(titleId) : void 0,
  32055. "aria-describedby": unref(bodyId),
  32056. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  32057. style: normalizeStyle(unref(overlayDialogStyle)),
  32058. onClick: unref(overlayEvent).onClick,
  32059. onMousedown: unref(overlayEvent).onMousedown,
  32060. onMouseup: unref(overlayEvent).onMouseup
  32061. }, [
  32062. createVNode(unref(ElFocusTrap), {
  32063. loop: "",
  32064. trapped: unref(visible),
  32065. "focus-start-el": "container",
  32066. onFocusAfterTrapped: unref(onOpenAutoFocus),
  32067. onFocusAfterReleased: unref(onCloseAutoFocus),
  32068. onFocusoutPrevented: unref(onFocusoutPrevented),
  32069. onReleaseRequested: unref(onCloseRequested)
  32070. }, {
  32071. default: withCtx(() => [
  32072. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, mergeProps({
  32073. key: 0,
  32074. ref_key: "dialogContentRef",
  32075. ref: dialogContentRef
  32076. }, _ctx.$attrs, {
  32077. center: _ctx.center,
  32078. "align-center": unref(_alignCenter),
  32079. "close-icon": _ctx.closeIcon,
  32080. draggable: unref(_draggable),
  32081. overflow: unref(_overflow),
  32082. fullscreen: _ctx.fullscreen,
  32083. "header-class": _ctx.headerClass,
  32084. "body-class": _ctx.bodyClass,
  32085. "footer-class": _ctx.footerClass,
  32086. "show-close": _ctx.showClose,
  32087. title: _ctx.title,
  32088. "aria-level": _ctx.headerAriaLevel,
  32089. onClose: unref(handleClose)
  32090. }), createSlots({
  32091. header: withCtx(() => [
  32092. !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  32093. key: 0,
  32094. close: unref(handleClose),
  32095. titleId: unref(titleId),
  32096. titleClass: unref(ns).e("title")
  32097. }) : renderSlot(_ctx.$slots, "title", { key: 1 })
  32098. ]),
  32099. default: withCtx(() => [
  32100. renderSlot(_ctx.$slots, "default")
  32101. ]),
  32102. _: 2
  32103. }, [
  32104. _ctx.$slots.footer ? {
  32105. name: "footer",
  32106. fn: withCtx(() => [
  32107. renderSlot(_ctx.$slots, "footer")
  32108. ])
  32109. } : void 0
  32110. ]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "header-class", "body-class", "footer-class", "show-close", "title", "aria-level", "onClose"])) : createCommentVNode("v-if", true)
  32111. ]),
  32112. _: 3
  32113. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  32114. ], 46, ["aria-label", "aria-labelledby", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  32115. ]),
  32116. _: 3
  32117. }, 8, ["mask", "overlay-class", "z-index"]), [
  32118. [vShow, unref(visible)]
  32119. ])
  32120. ];
  32121. }),
  32122. _: 3
  32123. }, 16)
  32124. ]),
  32125. _: 3
  32126. }, 8, ["to", "disabled"]);
  32127. };
  32128. }
  32129. });
  32130. var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["__file", "dialog.vue"]]);
  32131. const ElDialog = withInstall(Dialog);
  32132. const dividerProps = buildProps({
  32133. direction: {
  32134. type: String,
  32135. values: ["horizontal", "vertical"],
  32136. default: "horizontal"
  32137. },
  32138. contentPosition: {
  32139. type: String,
  32140. values: ["left", "center", "right"],
  32141. default: "center"
  32142. },
  32143. borderStyle: {
  32144. type: definePropType(String),
  32145. default: "solid"
  32146. }
  32147. });
  32148. const __default__$Z = defineComponent({
  32149. name: "ElDivider"
  32150. });
  32151. const _sfc_main$1k = /* @__PURE__ */ defineComponent({
  32152. ...__default__$Z,
  32153. props: dividerProps,
  32154. setup(__props) {
  32155. const props = __props;
  32156. const ns = useNamespace("divider");
  32157. const dividerStyle = computed(() => {
  32158. return ns.cssVar({
  32159. "border-style": props.borderStyle
  32160. });
  32161. });
  32162. return (_ctx, _cache) => {
  32163. return openBlock(), createElementBlock("div", {
  32164. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
  32165. style: normalizeStyle(unref(dividerStyle)),
  32166. role: "separator"
  32167. }, [
  32168. _ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  32169. key: 0,
  32170. class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
  32171. }, [
  32172. renderSlot(_ctx.$slots, "default")
  32173. ], 2)) : createCommentVNode("v-if", true)
  32174. ], 6);
  32175. };
  32176. }
  32177. });
  32178. var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__file", "divider.vue"]]);
  32179. const ElDivider = withInstall(Divider);
  32180. const drawerProps = buildProps({
  32181. ...dialogProps,
  32182. direction: {
  32183. type: String,
  32184. default: "rtl",
  32185. values: ["ltr", "rtl", "ttb", "btt"]
  32186. },
  32187. resizable: Boolean,
  32188. size: {
  32189. type: [String, Number],
  32190. default: "30%"
  32191. },
  32192. withHeader: {
  32193. type: Boolean,
  32194. default: true
  32195. },
  32196. modalFade: {
  32197. type: Boolean,
  32198. default: true
  32199. },
  32200. headerAriaLevel: {
  32201. type: String,
  32202. default: "2"
  32203. }
  32204. });
  32205. const drawerEmits = dialogEmits;
  32206. function useResizable(props, target) {
  32207. const { width, height } = useWindowSize();
  32208. const isHorizontal = computed(() => ["ltr", "rtl"].includes(props.direction));
  32209. const sign = computed(() => ["ltr", "ttb"].includes(props.direction) ? 1 : -1);
  32210. const windowSize = computed(() => isHorizontal.value ? width.value : height.value);
  32211. const getSize = computed(() => {
  32212. return clamp$2(startSize.value + sign.value * offset.value, 4, windowSize.value);
  32213. });
  32214. const startSize = ref(0);
  32215. const offset = ref(0);
  32216. const isResizing = ref(false);
  32217. const hasStartedDragging = ref(false);
  32218. let startPos = [];
  32219. let cleanups = [];
  32220. const getActualSize = () => {
  32221. var _a;
  32222. const drawerEl = (_a = target.value) == null ? void 0 : _a.closest('[aria-modal="true"]');
  32223. if (drawerEl) {
  32224. return isHorizontal.value ? drawerEl.offsetWidth : drawerEl.offsetHeight;
  32225. }
  32226. return 100;
  32227. };
  32228. watch(() => [props.size, props.resizable], () => {
  32229. hasStartedDragging.value = false;
  32230. startSize.value = 0;
  32231. offset.value = 0;
  32232. onMouseUp();
  32233. });
  32234. const onMousedown = (e) => {
  32235. if (!props.resizable)
  32236. return;
  32237. if (!hasStartedDragging.value) {
  32238. startSize.value = getActualSize();
  32239. hasStartedDragging.value = true;
  32240. }
  32241. startPos = [e.pageX, e.pageY];
  32242. isResizing.value = true;
  32243. cleanups.push(useEventListener(window, "mouseup", onMouseUp), useEventListener(window, "mousemove", onMouseMove));
  32244. };
  32245. const onMouseMove = (e) => {
  32246. const { pageX, pageY } = e;
  32247. const offsetX = pageX - startPos[0];
  32248. const offsetY = pageY - startPos[1];
  32249. offset.value = isHorizontal.value ? offsetX : offsetY;
  32250. };
  32251. const onMouseUp = () => {
  32252. startPos = [];
  32253. startSize.value = getSize.value;
  32254. offset.value = 0;
  32255. isResizing.value = false;
  32256. cleanups.forEach((cleanup2) => cleanup2 == null ? void 0 : cleanup2());
  32257. cleanups = [];
  32258. };
  32259. const cleanup = useEventListener(target, "mousedown", onMousedown);
  32260. onBeforeUnmount(() => {
  32261. cleanup();
  32262. onMouseUp();
  32263. });
  32264. return {
  32265. size: computed(() => {
  32266. return hasStartedDragging.value ? `${getSize.value}px` : addUnit(props.size);
  32267. }),
  32268. isResizing,
  32269. isHorizontal
  32270. };
  32271. }
  32272. const __default__$Y = defineComponent({
  32273. name: "ElDrawer",
  32274. inheritAttrs: false
  32275. });
  32276. const _sfc_main$1j = /* @__PURE__ */ defineComponent({
  32277. ...__default__$Y,
  32278. props: drawerProps,
  32279. emits: drawerEmits,
  32280. setup(__props, { expose }) {
  32281. const props = __props;
  32282. const slots = useSlots();
  32283. useDeprecated({
  32284. scope: "el-drawer",
  32285. from: "the title slot",
  32286. replacement: "the header slot",
  32287. version: "3.0.0",
  32288. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  32289. }, computed(() => !!slots.title));
  32290. const drawerRef = ref();
  32291. const focusStartRef = ref();
  32292. const draggerRef = ref();
  32293. const ns = useNamespace("drawer");
  32294. const { t } = useLocale();
  32295. const {
  32296. afterEnter,
  32297. afterLeave,
  32298. beforeLeave,
  32299. visible,
  32300. rendered,
  32301. titleId,
  32302. bodyId,
  32303. zIndex,
  32304. onModalClick,
  32305. onOpenAutoFocus,
  32306. onCloseAutoFocus,
  32307. onFocusoutPrevented,
  32308. onCloseRequested,
  32309. handleClose
  32310. } = useDialog(props, drawerRef);
  32311. const { isHorizontal, size, isResizing } = useResizable(props, draggerRef);
  32312. const penetrable = computed(() => props.modalPenetrable && !props.modal);
  32313. expose({
  32314. handleClose,
  32315. afterEnter,
  32316. afterLeave
  32317. });
  32318. return (_ctx, _cache) => {
  32319. return openBlock(), createBlock(unref(ElTeleport$1), {
  32320. to: _ctx.appendTo,
  32321. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  32322. }, {
  32323. default: withCtx(() => [
  32324. createVNode(Transition, {
  32325. name: unref(ns).b("fade"),
  32326. onAfterEnter: unref(afterEnter),
  32327. onAfterLeave: unref(afterLeave),
  32328. onBeforeLeave: unref(beforeLeave),
  32329. persisted: ""
  32330. }, {
  32331. default: withCtx(() => {
  32332. var _a;
  32333. return [
  32334. withDirectives(createVNode(unref(ElOverlay), {
  32335. mask: _ctx.modal,
  32336. "overlay-class": [
  32337. unref(ns).is("drawer"),
  32338. (_a = _ctx.modalClass) != null ? _a : "",
  32339. `${unref(ns).namespace.value}-modal-drawer`,
  32340. unref(ns).is("penetrable", unref(penetrable))
  32341. ],
  32342. "z-index": unref(zIndex),
  32343. onClick: unref(onModalClick)
  32344. }, {
  32345. default: withCtx(() => [
  32346. createVNode(unref(ElFocusTrap), {
  32347. loop: "",
  32348. trapped: unref(visible),
  32349. "focus-trap-el": drawerRef.value,
  32350. "focus-start-el": focusStartRef.value,
  32351. onFocusAfterTrapped: unref(onOpenAutoFocus),
  32352. onFocusAfterReleased: unref(onCloseAutoFocus),
  32353. onFocusoutPrevented: unref(onFocusoutPrevented),
  32354. onReleaseRequested: unref(onCloseRequested)
  32355. }, {
  32356. default: withCtx(() => [
  32357. createElementVNode("div", mergeProps({
  32358. ref_key: "drawerRef",
  32359. ref: drawerRef,
  32360. "aria-modal": "true",
  32361. "aria-label": _ctx.title || void 0,
  32362. "aria-labelledby": !_ctx.title ? unref(titleId) : void 0,
  32363. "aria-describedby": unref(bodyId)
  32364. }, _ctx.$attrs, {
  32365. class: [
  32366. unref(ns).b(),
  32367. _ctx.direction,
  32368. unref(visible) && "open",
  32369. unref(ns).is("dragging", unref(isResizing))
  32370. ],
  32371. style: { [unref(isHorizontal) ? "width" : "height"]: unref(size) },
  32372. role: "dialog",
  32373. onClick: withModifiers(() => {
  32374. }, ["stop"])
  32375. }), [
  32376. createElementVNode("span", {
  32377. ref_key: "focusStartRef",
  32378. ref: focusStartRef,
  32379. class: normalizeClass(unref(ns).e("sr-focus")),
  32380. tabindex: "-1"
  32381. }, null, 2),
  32382. _ctx.withHeader ? (openBlock(), createElementBlock("header", {
  32383. key: 0,
  32384. class: normalizeClass([unref(ns).e("header"), _ctx.headerClass])
  32385. }, [
  32386. !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  32387. key: 0,
  32388. close: unref(handleClose),
  32389. titleId: unref(titleId),
  32390. titleClass: unref(ns).e("title")
  32391. }, () => [
  32392. createElementVNode("span", {
  32393. id: unref(titleId),
  32394. role: "heading",
  32395. "aria-level": _ctx.headerAriaLevel,
  32396. class: normalizeClass(unref(ns).e("title"))
  32397. }, toDisplayString(_ctx.title), 11, ["id", "aria-level"])
  32398. ]) : renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  32399. createCommentVNode(" DEPRECATED SLOT ")
  32400. ]),
  32401. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  32402. key: 2,
  32403. "aria-label": unref(t)("el.drawer.close"),
  32404. class: normalizeClass(unref(ns).e("close-btn")),
  32405. type: "button",
  32406. onClick: unref(handleClose)
  32407. }, [
  32408. createVNode(unref(ElIcon), {
  32409. class: normalizeClass(unref(ns).e("close"))
  32410. }, {
  32411. default: withCtx(() => [
  32412. createVNode(unref(close_default))
  32413. ]),
  32414. _: 1
  32415. }, 8, ["class"])
  32416. ], 10, ["aria-label", "onClick"])) : createCommentVNode("v-if", true)
  32417. ], 2)) : createCommentVNode("v-if", true),
  32418. unref(rendered) ? (openBlock(), createElementBlock("div", {
  32419. key: 1,
  32420. id: unref(bodyId),
  32421. class: normalizeClass([unref(ns).e("body"), _ctx.bodyClass])
  32422. }, [
  32423. renderSlot(_ctx.$slots, "default")
  32424. ], 10, ["id"])) : createCommentVNode("v-if", true),
  32425. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  32426. key: 2,
  32427. class: normalizeClass([unref(ns).e("footer"), _ctx.footerClass])
  32428. }, [
  32429. renderSlot(_ctx.$slots, "footer")
  32430. ], 2)) : createCommentVNode("v-if", true),
  32431. _ctx.resizable ? (openBlock(), createElementBlock("div", {
  32432. key: 3,
  32433. ref_key: "draggerRef",
  32434. ref: draggerRef,
  32435. style: normalizeStyle({ zIndex: unref(zIndex) }),
  32436. class: normalizeClass(unref(ns).e("dragger"))
  32437. }, null, 6)) : createCommentVNode("v-if", true)
  32438. ], 16, ["aria-label", "aria-labelledby", "aria-describedby", "onClick"])
  32439. ]),
  32440. _: 3
  32441. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  32442. ]),
  32443. _: 3
  32444. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  32445. [vShow, unref(visible)]
  32446. ])
  32447. ];
  32448. }),
  32449. _: 3
  32450. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  32451. ]),
  32452. _: 3
  32453. }, 8, ["to", "disabled"]);
  32454. };
  32455. }
  32456. });
  32457. var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["__file", "drawer.vue"]]);
  32458. const ElDrawer = withInstall(Drawer);
  32459. const _sfc_main$1i = defineComponent({
  32460. inheritAttrs: false
  32461. });
  32462. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  32463. return renderSlot(_ctx.$slots, "default");
  32464. }
  32465. var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["render", _sfc_render$k], ["__file", "collection.vue"]]);
  32466. const _sfc_main$1h = defineComponent({
  32467. name: "ElCollectionItem",
  32468. inheritAttrs: false
  32469. });
  32470. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  32471. return renderSlot(_ctx.$slots, "default");
  32472. }
  32473. var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["render", _sfc_render$j], ["__file", "collection-item.vue"]]);
  32474. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  32475. const createCollectionWithScope = (name) => {
  32476. const COLLECTION_NAME = `El${name}Collection`;
  32477. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  32478. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  32479. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  32480. const ElCollection = {
  32481. ...Collection,
  32482. name: COLLECTION_NAME,
  32483. setup() {
  32484. const collectionRef = ref();
  32485. const itemMap = /* @__PURE__ */ new Map();
  32486. const getItems = () => {
  32487. const collectionEl = unref(collectionRef);
  32488. if (!collectionEl)
  32489. return [];
  32490. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  32491. const items = [...itemMap.values()];
  32492. return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  32493. };
  32494. provide(COLLECTION_INJECTION_KEY, {
  32495. itemMap,
  32496. getItems,
  32497. collectionRef
  32498. });
  32499. }
  32500. };
  32501. const ElCollectionItem = {
  32502. ...CollectionItem,
  32503. name: COLLECTION_ITEM_NAME,
  32504. setup(_, { attrs }) {
  32505. const collectionItemRef = ref();
  32506. const collectionInjection = inject(COLLECTION_INJECTION_KEY, void 0);
  32507. provide(COLLECTION_ITEM_INJECTION_KEY, {
  32508. collectionItemRef
  32509. });
  32510. onMounted(() => {
  32511. const collectionItemEl = unref(collectionItemRef);
  32512. if (collectionItemEl) {
  32513. collectionInjection.itemMap.set(collectionItemEl, {
  32514. ref: collectionItemEl,
  32515. ...attrs
  32516. });
  32517. }
  32518. });
  32519. onBeforeUnmount(() => {
  32520. const collectionItemEl = unref(collectionItemRef);
  32521. collectionInjection.itemMap.delete(collectionItemEl);
  32522. });
  32523. }
  32524. };
  32525. return {
  32526. COLLECTION_INJECTION_KEY,
  32527. COLLECTION_ITEM_INJECTION_KEY,
  32528. ElCollection,
  32529. ElCollectionItem
  32530. };
  32531. };
  32532. const rovingFocusGroupProps = buildProps({
  32533. style: { type: definePropType([String, Array, Object]) },
  32534. currentTabId: {
  32535. type: definePropType(String)
  32536. },
  32537. defaultCurrentTabId: String,
  32538. loop: Boolean,
  32539. dir: {
  32540. type: String,
  32541. values: ["ltr", "rtl"],
  32542. default: "ltr"
  32543. },
  32544. orientation: {
  32545. type: definePropType(String)
  32546. },
  32547. onBlur: Function,
  32548. onFocus: Function,
  32549. onMousedown: Function
  32550. });
  32551. const {
  32552. ElCollection,
  32553. ElCollectionItem,
  32554. COLLECTION_INJECTION_KEY,
  32555. COLLECTION_ITEM_INJECTION_KEY
  32556. } = createCollectionWithScope("RovingFocusGroup");
  32557. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  32558. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  32559. const MAP_KEY_TO_FOCUS_INTENT = {
  32560. ArrowLeft: "prev",
  32561. ArrowUp: "prev",
  32562. ArrowRight: "next",
  32563. ArrowDown: "next",
  32564. PageUp: "first",
  32565. Home: "first",
  32566. PageDown: "last",
  32567. End: "last"
  32568. };
  32569. const getDirectionAwareKey = (key, dir) => {
  32570. if (dir !== "rtl")
  32571. return key;
  32572. switch (key) {
  32573. case EVENT_CODE.right:
  32574. return EVENT_CODE.left;
  32575. case EVENT_CODE.left:
  32576. return EVENT_CODE.right;
  32577. default:
  32578. return key;
  32579. }
  32580. };
  32581. const getFocusIntent = (event, orientation, dir) => {
  32582. const code = getEventCode(event);
  32583. const key = getDirectionAwareKey(code, dir);
  32584. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  32585. return void 0;
  32586. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  32587. return void 0;
  32588. return MAP_KEY_TO_FOCUS_INTENT[key];
  32589. };
  32590. const reorderArray = (array, atIdx) => {
  32591. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  32592. };
  32593. const focusFirst = (elements) => {
  32594. const { activeElement: prevActive } = document;
  32595. for (const element of elements) {
  32596. if (element === prevActive)
  32597. return;
  32598. element.focus();
  32599. if (prevActive !== document.activeElement)
  32600. return;
  32601. }
  32602. };
  32603. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  32604. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  32605. const EVT_OPTS = { bubbles: false, cancelable: true };
  32606. const _sfc_main$1g = defineComponent({
  32607. name: "ElRovingFocusGroupImpl",
  32608. inheritAttrs: false,
  32609. props: rovingFocusGroupProps,
  32610. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  32611. setup(props, { emit }) {
  32612. var _a;
  32613. const currentTabbedId = ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null);
  32614. const isBackingOut = ref(false);
  32615. const isClickFocus = ref(false);
  32616. const rovingFocusGroupRef = ref();
  32617. const { getItems } = inject(COLLECTION_INJECTION_KEY, void 0);
  32618. const rovingFocusGroupRootStyle = computed(() => {
  32619. return [
  32620. {
  32621. outline: "none"
  32622. },
  32623. props.style
  32624. ];
  32625. });
  32626. const onItemFocus = (tabbedId) => {
  32627. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  32628. };
  32629. const onItemShiftTab = () => {
  32630. isBackingOut.value = true;
  32631. };
  32632. const onMousedown = composeEventHandlers((e) => {
  32633. var _a2;
  32634. (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e);
  32635. }, () => {
  32636. isClickFocus.value = true;
  32637. });
  32638. const onFocus = composeEventHandlers((e) => {
  32639. var _a2;
  32640. (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
  32641. }, (e) => {
  32642. const isKeyboardFocus = !unref(isClickFocus);
  32643. const { target, currentTarget } = e;
  32644. if (target === currentTarget && isKeyboardFocus && !unref(isBackingOut)) {
  32645. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  32646. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  32647. if (!entryFocusEvt.defaultPrevented) {
  32648. const items = getItems().filter((item) => item.focusable);
  32649. const activeItem = items.find((item) => item.active);
  32650. const currentItem = items.find((item) => item.id === unref(currentTabbedId));
  32651. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  32652. const candidateNodes = candidates.map((item) => item.ref);
  32653. focusFirst(candidateNodes);
  32654. }
  32655. }
  32656. isClickFocus.value = false;
  32657. });
  32658. const onBlur = composeEventHandlers((e) => {
  32659. var _a2;
  32660. (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e);
  32661. }, () => {
  32662. isBackingOut.value = false;
  32663. });
  32664. const handleEntryFocus = (...args) => {
  32665. emit("entryFocus", ...args);
  32666. };
  32667. const onKeydown = (e) => {
  32668. const focusIntent = getFocusIntent(e);
  32669. if (focusIntent) {
  32670. e.preventDefault();
  32671. const items = getItems().filter((item) => item.focusable);
  32672. let elements = items.map((item) => item.ref);
  32673. switch (focusIntent) {
  32674. case "last": {
  32675. elements.reverse();
  32676. break;
  32677. }
  32678. case "prev":
  32679. case "next": {
  32680. if (focusIntent === "prev") {
  32681. elements.reverse();
  32682. }
  32683. const currentIdx = elements.indexOf(e.currentTarget);
  32684. elements = props.loop ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  32685. break;
  32686. }
  32687. }
  32688. nextTick(() => {
  32689. focusFirst(elements);
  32690. });
  32691. }
  32692. };
  32693. provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  32694. currentTabbedId: readonly(currentTabbedId),
  32695. loop: toRef(props, "loop"),
  32696. tabIndex: computed(() => {
  32697. return unref(isBackingOut) ? -1 : 0;
  32698. }),
  32699. rovingFocusGroupRef,
  32700. rovingFocusGroupRootStyle,
  32701. orientation: toRef(props, "orientation"),
  32702. dir: toRef(props, "dir"),
  32703. onItemFocus,
  32704. onItemShiftTab,
  32705. onBlur,
  32706. onFocus,
  32707. onMousedown,
  32708. onKeydown
  32709. });
  32710. watch(() => props.currentTabId, (val) => {
  32711. currentTabbedId.value = val != null ? val : null;
  32712. });
  32713. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  32714. }
  32715. });
  32716. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  32717. return renderSlot(_ctx.$slots, "default");
  32718. }
  32719. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["render", _sfc_render$i], ["__file", "roving-focus-group-impl.vue"]]);
  32720. const _sfc_main$1f = defineComponent({
  32721. name: "ElRovingFocusGroup",
  32722. components: {
  32723. ElFocusGroupCollection: ElCollection,
  32724. ElRovingFocusGroupImpl
  32725. }
  32726. });
  32727. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  32728. const _component_el_roving_focus_group_impl = resolveComponent("el-roving-focus-group-impl");
  32729. const _component_el_focus_group_collection = resolveComponent("el-focus-group-collection");
  32730. return openBlock(), createBlock(_component_el_focus_group_collection, null, {
  32731. default: withCtx(() => [
  32732. createVNode(_component_el_roving_focus_group_impl, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
  32733. default: withCtx(() => [
  32734. renderSlot(_ctx.$slots, "default")
  32735. ]),
  32736. _: 3
  32737. }, 16)
  32738. ]),
  32739. _: 3
  32740. });
  32741. }
  32742. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["render", _sfc_render$h], ["__file", "roving-focus-group.vue"]]);
  32743. const _sfc_main$1e = defineComponent({
  32744. components: {
  32745. ElRovingFocusCollectionItem: ElCollectionItem
  32746. },
  32747. props: {
  32748. focusable: {
  32749. type: Boolean,
  32750. default: true
  32751. },
  32752. active: Boolean
  32753. },
  32754. emits: ["mousedown", "focus", "keydown"],
  32755. setup(props, { emit }) {
  32756. const { currentTabbedId, onItemFocus, onItemShiftTab, onKeydown } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  32757. const id = useId();
  32758. const rovingFocusGroupItemRef = ref();
  32759. const handleMousedown = composeEventHandlers((e) => {
  32760. emit("mousedown", e);
  32761. }, (e) => {
  32762. if (!props.focusable) {
  32763. e.preventDefault();
  32764. } else {
  32765. onItemFocus(unref(id));
  32766. }
  32767. });
  32768. const handleFocus = composeEventHandlers((e) => {
  32769. emit("focus", e);
  32770. }, () => {
  32771. onItemFocus(unref(id));
  32772. });
  32773. const handleKeydown = composeEventHandlers((e) => {
  32774. emit("keydown", e);
  32775. }, (e) => {
  32776. const { shiftKey, target, currentTarget } = e;
  32777. const code = getEventCode(e);
  32778. if (code === EVENT_CODE.tab && shiftKey) {
  32779. onItemShiftTab();
  32780. return;
  32781. }
  32782. if (target !== currentTarget)
  32783. return;
  32784. onKeydown(e);
  32785. });
  32786. const isCurrentTab = computed(() => currentTabbedId.value === unref(id));
  32787. provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  32788. rovingFocusGroupItemRef,
  32789. tabIndex: computed(() => unref(isCurrentTab) ? 0 : -1),
  32790. handleMousedown,
  32791. handleFocus,
  32792. handleKeydown
  32793. });
  32794. return {
  32795. id,
  32796. handleKeydown,
  32797. handleFocus,
  32798. handleMousedown
  32799. };
  32800. }
  32801. });
  32802. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  32803. const _component_el_roving_focus_collection_item = resolveComponent("el-roving-focus-collection-item");
  32804. return openBlock(), createBlock(_component_el_roving_focus_collection_item, {
  32805. id: _ctx.id,
  32806. focusable: _ctx.focusable,
  32807. active: _ctx.active
  32808. }, {
  32809. default: withCtx(() => [
  32810. renderSlot(_ctx.$slots, "default")
  32811. ]),
  32812. _: 3
  32813. }, 8, ["id", "focusable", "active"]);
  32814. }
  32815. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["render", _sfc_render$g], ["__file", "roving-focus-item.vue"]]);
  32816. const dropdownProps = buildProps({
  32817. trigger: {
  32818. ...useTooltipTriggerProps.trigger,
  32819. type: definePropType([
  32820. String,
  32821. Array
  32822. ])
  32823. },
  32824. triggerKeys: {
  32825. type: definePropType(Array),
  32826. default: () => [
  32827. EVENT_CODE.enter,
  32828. EVENT_CODE.numpadEnter,
  32829. EVENT_CODE.space,
  32830. EVENT_CODE.down
  32831. ]
  32832. },
  32833. virtualTriggering: useTooltipTriggerProps.virtualTriggering,
  32834. virtualRef: useTooltipTriggerProps.virtualRef,
  32835. effect: {
  32836. ...useTooltipContentProps.effect,
  32837. default: "light"
  32838. },
  32839. type: {
  32840. type: definePropType(String)
  32841. },
  32842. placement: {
  32843. type: definePropType(String),
  32844. default: "bottom"
  32845. },
  32846. popperOptions: {
  32847. type: definePropType(Object),
  32848. default: () => ({})
  32849. },
  32850. id: String,
  32851. size: {
  32852. type: String,
  32853. default: ""
  32854. },
  32855. splitButton: Boolean,
  32856. hideOnClick: {
  32857. type: Boolean,
  32858. default: true
  32859. },
  32860. loop: {
  32861. type: Boolean,
  32862. default: true
  32863. },
  32864. showArrow: {
  32865. type: Boolean,
  32866. default: true
  32867. },
  32868. showTimeout: {
  32869. type: Number,
  32870. default: 150
  32871. },
  32872. hideTimeout: {
  32873. type: Number,
  32874. default: 150
  32875. },
  32876. tabindex: {
  32877. type: definePropType([Number, String]),
  32878. default: 0
  32879. },
  32880. maxHeight: {
  32881. type: definePropType([Number, String]),
  32882. default: ""
  32883. },
  32884. popperClass: useTooltipContentProps.popperClass,
  32885. popperStyle: useTooltipContentProps.popperStyle,
  32886. disabled: Boolean,
  32887. role: {
  32888. type: String,
  32889. values: roleTypes,
  32890. default: "menu"
  32891. },
  32892. buttonProps: {
  32893. type: definePropType(Object)
  32894. },
  32895. teleported: useTooltipContentProps.teleported,
  32896. persistent: {
  32897. type: Boolean,
  32898. default: true
  32899. }
  32900. });
  32901. const dropdownItemProps = buildProps({
  32902. command: {
  32903. type: [Object, String, Number],
  32904. default: () => ({})
  32905. },
  32906. disabled: Boolean,
  32907. divided: Boolean,
  32908. textValue: String,
  32909. icon: {
  32910. type: iconPropType
  32911. }
  32912. });
  32913. const dropdownMenuProps = buildProps({
  32914. onKeydown: { type: definePropType(Function) }
  32915. });
  32916. const FIRST_KEYS = [
  32917. EVENT_CODE.down,
  32918. EVENT_CODE.pageDown,
  32919. EVENT_CODE.home
  32920. ];
  32921. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  32922. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  32923. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  32924. const DROPDOWN_INSTANCE_INJECTION_KEY = "elDropdown";
  32925. const { ButtonGroup: ElButtonGroup } = ElButton;
  32926. const _sfc_main$1d = defineComponent({
  32927. name: "ElDropdown",
  32928. components: {
  32929. ElButton,
  32930. ElButtonGroup,
  32931. ElScrollbar,
  32932. ElTooltip,
  32933. ElRovingFocusGroup,
  32934. ElOnlyChild: OnlyChild,
  32935. ElIcon,
  32936. ArrowDown: arrow_down_default
  32937. },
  32938. props: dropdownProps,
  32939. emits: ["visible-change", "click", "command"],
  32940. setup(props, { emit }) {
  32941. const _instance = getCurrentInstance();
  32942. const ns = useNamespace("dropdown");
  32943. const { t } = useLocale();
  32944. const triggeringElementRef = ref();
  32945. const referenceElementRef = ref();
  32946. const popperRef = ref();
  32947. const contentRef = ref();
  32948. const scrollbar = ref(null);
  32949. const currentTabId = ref(null);
  32950. const isUsingKeyboard = ref(false);
  32951. const wrapStyle = computed(() => ({
  32952. maxHeight: addUnit(props.maxHeight)
  32953. }));
  32954. const dropdownTriggerKls = computed(() => [ns.m(dropdownSize.value)]);
  32955. const trigger = computed(() => castArray$1(props.trigger));
  32956. const defaultTriggerId = useId().value;
  32957. const triggerId = computed(() => props.id || defaultTriggerId);
  32958. function handleClick() {
  32959. var _a;
  32960. (_a = popperRef.value) == null ? void 0 : _a.onClose(void 0, 0);
  32961. }
  32962. function handleClose() {
  32963. var _a;
  32964. (_a = popperRef.value) == null ? void 0 : _a.onClose();
  32965. }
  32966. function handleOpen() {
  32967. var _a;
  32968. (_a = popperRef.value) == null ? void 0 : _a.onOpen();
  32969. }
  32970. const dropdownSize = useFormSize();
  32971. function commandHandler(...args) {
  32972. emit("command", ...args);
  32973. }
  32974. function onItemEnter() {
  32975. }
  32976. function onItemLeave() {
  32977. const contentEl = unref(contentRef);
  32978. trigger.value.includes("hover") && (contentEl == null ? void 0 : contentEl.focus({
  32979. preventScroll: true
  32980. }));
  32981. currentTabId.value = null;
  32982. }
  32983. function handleCurrentTabIdChange(id) {
  32984. currentTabId.value = id;
  32985. }
  32986. function handleBeforeShowTooltip() {
  32987. emit("visible-change", true);
  32988. }
  32989. function handleShowTooltip(event) {
  32990. var _a;
  32991. isUsingKeyboard.value = (event == null ? void 0 : event.type) === "keydown";
  32992. (_a = contentRef.value) == null ? void 0 : _a.focus();
  32993. }
  32994. function handleBeforeHideTooltip() {
  32995. emit("visible-change", false);
  32996. }
  32997. provide(DROPDOWN_INJECTION_KEY, {
  32998. contentRef,
  32999. role: computed(() => props.role),
  33000. triggerId,
  33001. isUsingKeyboard,
  33002. onItemEnter,
  33003. onItemLeave,
  33004. handleClose
  33005. });
  33006. provide(DROPDOWN_INSTANCE_INJECTION_KEY, {
  33007. instance: _instance,
  33008. dropdownSize,
  33009. handleClick,
  33010. commandHandler,
  33011. trigger: toRef(props, "trigger"),
  33012. hideOnClick: toRef(props, "hideOnClick")
  33013. });
  33014. const handlerMainButtonClick = (event) => {
  33015. emit("click", event);
  33016. };
  33017. return {
  33018. t,
  33019. ns,
  33020. scrollbar,
  33021. wrapStyle,
  33022. dropdownTriggerKls,
  33023. dropdownSize,
  33024. triggerId,
  33025. currentTabId,
  33026. handleCurrentTabIdChange,
  33027. handlerMainButtonClick,
  33028. handleClose,
  33029. handleOpen,
  33030. handleBeforeShowTooltip,
  33031. handleShowTooltip,
  33032. handleBeforeHideTooltip,
  33033. popperRef,
  33034. contentRef,
  33035. triggeringElementRef,
  33036. referenceElementRef
  33037. };
  33038. }
  33039. });
  33040. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  33041. var _a;
  33042. const _component_el_roving_focus_group = resolveComponent("el-roving-focus-group");
  33043. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  33044. const _component_el_only_child = resolveComponent("el-only-child");
  33045. const _component_el_tooltip = resolveComponent("el-tooltip");
  33046. const _component_el_button = resolveComponent("el-button");
  33047. const _component_arrow_down = resolveComponent("arrow-down");
  33048. const _component_el_icon = resolveComponent("el-icon");
  33049. const _component_el_button_group = resolveComponent("el-button-group");
  33050. return openBlock(), createElementBlock("div", {
  33051. class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  33052. }, [
  33053. createVNode(_component_el_tooltip, {
  33054. ref: "popperRef",
  33055. role: _ctx.role,
  33056. effect: _ctx.effect,
  33057. "fallback-placements": ["bottom", "top"],
  33058. "popper-options": _ctx.popperOptions,
  33059. "gpu-acceleration": false,
  33060. placement: _ctx.placement,
  33061. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  33062. "popper-style": _ctx.popperStyle,
  33063. trigger: _ctx.trigger,
  33064. "trigger-keys": _ctx.triggerKeys,
  33065. "trigger-target-el": _ctx.contentRef,
  33066. "show-arrow": _ctx.showArrow,
  33067. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  33068. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  33069. "virtual-ref": (_a = _ctx.virtualRef) != null ? _a : _ctx.triggeringElementRef,
  33070. "virtual-triggering": _ctx.virtualTriggering || _ctx.splitButton,
  33071. disabled: _ctx.disabled,
  33072. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  33073. teleported: _ctx.teleported,
  33074. pure: "",
  33075. "focus-on-target": "",
  33076. persistent: _ctx.persistent,
  33077. onBeforeShow: _ctx.handleBeforeShowTooltip,
  33078. onShow: _ctx.handleShowTooltip,
  33079. onBeforeHide: _ctx.handleBeforeHideTooltip
  33080. }, createSlots({
  33081. content: withCtx(() => [
  33082. createVNode(_component_el_scrollbar, {
  33083. ref: "scrollbar",
  33084. "wrap-style": _ctx.wrapStyle,
  33085. tag: "div",
  33086. "view-class": _ctx.ns.e("list")
  33087. }, {
  33088. default: withCtx(() => [
  33089. createVNode(_component_el_roving_focus_group, {
  33090. loop: _ctx.loop,
  33091. "current-tab-id": _ctx.currentTabId,
  33092. orientation: "horizontal",
  33093. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange
  33094. }, {
  33095. default: withCtx(() => [
  33096. renderSlot(_ctx.$slots, "dropdown")
  33097. ]),
  33098. _: 3
  33099. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange"])
  33100. ]),
  33101. _: 3
  33102. }, 8, ["wrap-style", "view-class"])
  33103. ]),
  33104. _: 2
  33105. }, [
  33106. !_ctx.splitButton ? {
  33107. name: "default",
  33108. fn: withCtx(() => [
  33109. createVNode(_component_el_only_child, {
  33110. id: _ctx.triggerId,
  33111. ref: "triggeringElementRef",
  33112. role: "button",
  33113. tabindex: _ctx.tabindex
  33114. }, {
  33115. default: withCtx(() => [
  33116. renderSlot(_ctx.$slots, "default")
  33117. ]),
  33118. _: 3
  33119. }, 8, ["id", "tabindex"])
  33120. ])
  33121. } : void 0
  33122. ]), 1032, ["role", "effect", "popper-options", "placement", "popper-class", "popper-style", "trigger", "trigger-keys", "trigger-target-el", "show-arrow", "show-after", "hide-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported", "persistent", "onBeforeShow", "onShow", "onBeforeHide"]),
  33123. _ctx.splitButton ? (openBlock(), createBlock(_component_el_button_group, { key: 0 }, {
  33124. default: withCtx(() => [
  33125. createVNode(_component_el_button, mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  33126. size: _ctx.dropdownSize,
  33127. type: _ctx.type,
  33128. disabled: _ctx.disabled,
  33129. tabindex: _ctx.tabindex,
  33130. onClick: _ctx.handlerMainButtonClick
  33131. }), {
  33132. default: withCtx(() => [
  33133. renderSlot(_ctx.$slots, "default")
  33134. ]),
  33135. _: 3
  33136. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  33137. createVNode(_component_el_button, mergeProps({
  33138. id: _ctx.triggerId,
  33139. ref: "triggeringElementRef"
  33140. }, _ctx.buttonProps, {
  33141. role: "button",
  33142. size: _ctx.dropdownSize,
  33143. type: _ctx.type,
  33144. class: _ctx.ns.e("caret-button"),
  33145. disabled: _ctx.disabled,
  33146. tabindex: _ctx.tabindex,
  33147. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  33148. }), {
  33149. default: withCtx(() => [
  33150. createVNode(_component_el_icon, {
  33151. class: normalizeClass(_ctx.ns.e("icon"))
  33152. }, {
  33153. default: withCtx(() => [
  33154. createVNode(_component_arrow_down)
  33155. ]),
  33156. _: 1
  33157. }, 8, ["class"])
  33158. ]),
  33159. _: 1
  33160. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  33161. ]),
  33162. _: 3
  33163. })) : createCommentVNode("v-if", true)
  33164. ], 2);
  33165. }
  33166. var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["render", _sfc_render$f], ["__file", "dropdown.vue"]]);
  33167. const _sfc_main$1c = defineComponent({
  33168. name: "DropdownItemImpl",
  33169. components: {
  33170. ElIcon
  33171. },
  33172. props: dropdownItemProps,
  33173. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  33174. setup(_, { emit }) {
  33175. const ns = useNamespace("dropdown");
  33176. const { role: menuRole } = inject(DROPDOWN_INJECTION_KEY, void 0);
  33177. const { collectionItemRef: rovingFocusCollectionItemRef } = inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  33178. const {
  33179. rovingFocusGroupItemRef,
  33180. tabIndex,
  33181. handleFocus,
  33182. handleKeydown: handleItemKeydown,
  33183. handleMousedown
  33184. } = inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  33185. const itemRef = composeRefs(rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  33186. const role = computed(() => {
  33187. if (menuRole.value === "menu") {
  33188. return "menuitem";
  33189. } else if (menuRole.value === "navigation") {
  33190. return "link";
  33191. }
  33192. return "button";
  33193. });
  33194. const handleKeydown = composeEventHandlers((e) => {
  33195. const code = getEventCode(e);
  33196. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(code)) {
  33197. e.preventDefault();
  33198. e.stopImmediatePropagation();
  33199. emit("clickimpl", e);
  33200. return true;
  33201. }
  33202. }, handleItemKeydown);
  33203. return {
  33204. ns,
  33205. itemRef,
  33206. dataset: {
  33207. [COLLECTION_ITEM_SIGN]: ""
  33208. },
  33209. role,
  33210. tabIndex,
  33211. handleFocus,
  33212. handleKeydown,
  33213. handleMousedown
  33214. };
  33215. }
  33216. });
  33217. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  33218. const _component_el_icon = resolveComponent("el-icon");
  33219. return openBlock(), createElementBlock(Fragment, null, [
  33220. _ctx.divided ? (openBlock(), createElementBlock("li", {
  33221. key: 0,
  33222. role: "separator",
  33223. class: normalizeClass(_ctx.ns.bem("menu", "item", "divided"))
  33224. }, null, 2)) : createCommentVNode("v-if", true),
  33225. createElementVNode("li", mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  33226. "aria-disabled": _ctx.disabled,
  33227. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  33228. tabindex: _ctx.tabIndex,
  33229. role: _ctx.role,
  33230. onClick: (e) => _ctx.$emit("clickimpl", e),
  33231. onFocus: _ctx.handleFocus,
  33232. onKeydown: withModifiers(_ctx.handleKeydown, ["self"]),
  33233. onMousedown: _ctx.handleMousedown,
  33234. onPointermove: (e) => _ctx.$emit("pointermove", e),
  33235. onPointerleave: (e) => _ctx.$emit("pointerleave", e)
  33236. }), [
  33237. _ctx.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  33238. default: withCtx(() => [
  33239. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  33240. ]),
  33241. _: 1
  33242. })) : createCommentVNode("v-if", true),
  33243. renderSlot(_ctx.$slots, "default")
  33244. ], 16, ["aria-disabled", "tabindex", "role", "onClick", "onFocus", "onKeydown", "onMousedown", "onPointermove", "onPointerleave"])
  33245. ], 64);
  33246. }
  33247. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["render", _sfc_render$e], ["__file", "dropdown-item-impl.vue"]]);
  33248. const useDropdown = () => {
  33249. const elDropdown = inject(DROPDOWN_INSTANCE_INJECTION_KEY, {});
  33250. const _elDropdownSize = computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  33251. return {
  33252. elDropdown,
  33253. _elDropdownSize
  33254. };
  33255. };
  33256. const _sfc_main$1b = defineComponent({
  33257. name: "ElDropdownItem",
  33258. components: {
  33259. ElRovingFocusItem,
  33260. ElDropdownItemImpl
  33261. },
  33262. inheritAttrs: false,
  33263. props: dropdownItemProps,
  33264. emits: ["pointermove", "pointerleave", "click"],
  33265. setup(props, { emit, attrs }) {
  33266. const { elDropdown } = useDropdown();
  33267. const _instance = getCurrentInstance();
  33268. const { onItemEnter, onItemLeave } = inject(DROPDOWN_INJECTION_KEY, void 0);
  33269. const handlePointerMove = composeEventHandlers((e) => {
  33270. emit("pointermove", e);
  33271. return e.defaultPrevented;
  33272. }, whenMouse((e) => {
  33273. if (props.disabled) {
  33274. onItemLeave(e);
  33275. return;
  33276. }
  33277. const target = e.currentTarget;
  33278. if (target === document.activeElement || target.contains(document.activeElement)) {
  33279. return;
  33280. }
  33281. onItemEnter(e);
  33282. if (!e.defaultPrevented) {
  33283. target == null ? void 0 : target.focus({
  33284. preventScroll: true
  33285. });
  33286. }
  33287. }));
  33288. const handlePointerLeave = composeEventHandlers((e) => {
  33289. emit("pointerleave", e);
  33290. return e.defaultPrevented;
  33291. }, whenMouse(onItemLeave));
  33292. const handleClick = composeEventHandlers((e) => {
  33293. if (props.disabled) {
  33294. return;
  33295. }
  33296. emit("click", e);
  33297. return e.type !== "keydown" && e.defaultPrevented;
  33298. }, (e) => {
  33299. var _a, _b, _c;
  33300. if (props.disabled) {
  33301. e.stopImmediatePropagation();
  33302. return;
  33303. }
  33304. if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) {
  33305. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  33306. }
  33307. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  33308. });
  33309. const propsAndAttrs = computed(() => ({ ...props, ...attrs }));
  33310. return {
  33311. handleClick,
  33312. handlePointerMove,
  33313. handlePointerLeave,
  33314. propsAndAttrs
  33315. };
  33316. }
  33317. });
  33318. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  33319. const _component_el_dropdown_item_impl = resolveComponent("el-dropdown-item-impl");
  33320. const _component_el_roving_focus_item = resolveComponent("el-roving-focus-item");
  33321. return openBlock(), createBlock(_component_el_roving_focus_item, {
  33322. focusable: !_ctx.disabled
  33323. }, {
  33324. default: withCtx(() => [
  33325. createVNode(_component_el_dropdown_item_impl, mergeProps(_ctx.propsAndAttrs, {
  33326. onPointerleave: _ctx.handlePointerLeave,
  33327. onPointermove: _ctx.handlePointerMove,
  33328. onClickimpl: _ctx.handleClick
  33329. }), {
  33330. default: withCtx(() => [
  33331. renderSlot(_ctx.$slots, "default")
  33332. ]),
  33333. _: 3
  33334. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  33335. ]),
  33336. _: 3
  33337. }, 8, ["focusable"]);
  33338. }
  33339. var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["render", _sfc_render$d], ["__file", "dropdown-item.vue"]]);
  33340. const _sfc_main$1a = defineComponent({
  33341. name: "ElDropdownMenu",
  33342. props: dropdownMenuProps,
  33343. setup(props) {
  33344. const ns = useNamespace("dropdown");
  33345. const { _elDropdownSize } = useDropdown();
  33346. const size = _elDropdownSize.value;
  33347. const { contentRef, role, triggerId, isUsingKeyboard, handleClose } = inject(DROPDOWN_INJECTION_KEY, void 0);
  33348. const {
  33349. rovingFocusGroupRef,
  33350. rovingFocusGroupRootStyle,
  33351. onBlur,
  33352. onFocus,
  33353. onKeydown,
  33354. onMousedown
  33355. } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  33356. const { collectionRef: rovingFocusGroupCollectionRef } = inject(COLLECTION_INJECTION_KEY, void 0);
  33357. const dropdownKls = computed(() => {
  33358. return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
  33359. });
  33360. const dropdownListWrapperRef = composeRefs(contentRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  33361. const handleKeydown = composeEventHandlers((e) => {
  33362. var _a;
  33363. (_a = props.onKeydown) == null ? void 0 : _a.call(props, e);
  33364. }, (e) => {
  33365. const { currentTarget, target } = e;
  33366. const code = getEventCode(e);
  33367. currentTarget.contains(target);
  33368. if (EVENT_CODE.tab === code) {
  33369. return handleClose();
  33370. }
  33371. onKeydown(e);
  33372. });
  33373. function handleFocus(e) {
  33374. isUsingKeyboard.value && onFocus(e);
  33375. }
  33376. return {
  33377. size,
  33378. rovingFocusGroupRootStyle,
  33379. dropdownKls,
  33380. role,
  33381. triggerId,
  33382. dropdownListWrapperRef,
  33383. handleKeydown,
  33384. onBlur,
  33385. handleFocus,
  33386. onMousedown
  33387. };
  33388. }
  33389. });
  33390. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  33391. return openBlock(), createElementBlock("ul", {
  33392. ref: _ctx.dropdownListWrapperRef,
  33393. class: normalizeClass(_ctx.dropdownKls),
  33394. style: normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  33395. tabindex: -1,
  33396. role: _ctx.role,
  33397. "aria-labelledby": _ctx.triggerId,
  33398. onFocusin: _ctx.handleFocus,
  33399. onFocusout: _ctx.onBlur,
  33400. onKeydown: withModifiers(_ctx.handleKeydown, ["self"]),
  33401. onMousedown: withModifiers(_ctx.onMousedown, ["self"])
  33402. }, [
  33403. renderSlot(_ctx.$slots, "default")
  33404. ], 46, ["role", "aria-labelledby", "onFocusin", "onFocusout", "onKeydown", "onMousedown"]);
  33405. }
  33406. var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["render", _sfc_render$c], ["__file", "dropdown-menu.vue"]]);
  33407. const ElDropdown = withInstall(Dropdown, {
  33408. DropdownItem,
  33409. DropdownMenu
  33410. });
  33411. const ElDropdownItem = withNoopInstall(DropdownItem);
  33412. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  33413. const __default__$X = defineComponent({
  33414. name: "ImgEmpty"
  33415. });
  33416. const _sfc_main$19 = /* @__PURE__ */ defineComponent({
  33417. ...__default__$X,
  33418. setup(__props) {
  33419. const ns = useNamespace("empty");
  33420. const id = useId();
  33421. return (_ctx, _cache) => {
  33422. return openBlock(), createElementBlock("svg", {
  33423. viewBox: "0 0 79 86",
  33424. version: "1.1",
  33425. xmlns: "http://www.w3.org/2000/svg",
  33426. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  33427. }, [
  33428. createElementVNode("defs", null, [
  33429. createElementVNode("linearGradient", {
  33430. id: `linearGradient-1-${unref(id)}`,
  33431. x1: "38.8503086%",
  33432. y1: "0%",
  33433. x2: "61.1496914%",
  33434. y2: "100%"
  33435. }, [
  33436. createElementVNode("stop", {
  33437. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  33438. offset: "0%"
  33439. }, null, 8, ["stop-color"]),
  33440. createElementVNode("stop", {
  33441. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-4")})`,
  33442. offset: "100%"
  33443. }, null, 8, ["stop-color"])
  33444. ], 8, ["id"]),
  33445. createElementVNode("linearGradient", {
  33446. id: `linearGradient-2-${unref(id)}`,
  33447. x1: "0%",
  33448. y1: "9.5%",
  33449. x2: "100%",
  33450. y2: "90.5%"
  33451. }, [
  33452. createElementVNode("stop", {
  33453. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  33454. offset: "0%"
  33455. }, null, 8, ["stop-color"]),
  33456. createElementVNode("stop", {
  33457. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-6")})`,
  33458. offset: "100%"
  33459. }, null, 8, ["stop-color"])
  33460. ], 8, ["id"]),
  33461. createElementVNode("rect", {
  33462. id: `path-3-${unref(id)}`,
  33463. x: "0",
  33464. y: "0",
  33465. width: "17",
  33466. height: "36"
  33467. }, null, 8, ["id"])
  33468. ]),
  33469. createElementVNode("g", {
  33470. stroke: "none",
  33471. "stroke-width": "1",
  33472. fill: "none",
  33473. "fill-rule": "evenodd"
  33474. }, [
  33475. createElementVNode("g", { transform: "translate(-1268.000000, -535.000000)" }, [
  33476. createElementVNode("g", { transform: "translate(1268.000000, 535.000000)" }, [
  33477. createElementVNode("path", {
  33478. 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",
  33479. fill: `var(${unref(ns).cssVarBlockName("fill-color-3")})`
  33480. }, null, 8, ["fill"]),
  33481. createElementVNode("polygon", {
  33482. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  33483. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  33484. points: "13 58 53 58 42 45 2 45"
  33485. }, null, 8, ["fill"]),
  33486. createElementVNode("g", { transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)" }, [
  33487. createElementVNode("polygon", {
  33488. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  33489. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  33490. points: "2.84078316e-14 3 18 3 23 7 5 7"
  33491. }, null, 8, ["fill"]),
  33492. createElementVNode("polygon", {
  33493. fill: `var(${unref(ns).cssVarBlockName("fill-color-5")})`,
  33494. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  33495. }, null, 8, ["fill"]),
  33496. createElementVNode("rect", {
  33497. fill: `url(#linearGradient-1-${unref(id)})`,
  33498. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  33499. x: "38",
  33500. y: "7",
  33501. width: "17",
  33502. height: "36"
  33503. }, null, 8, ["fill"]),
  33504. createElementVNode("polygon", {
  33505. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  33506. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  33507. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  33508. }, null, 8, ["fill"])
  33509. ]),
  33510. createElementVNode("rect", {
  33511. fill: `url(#linearGradient-2-${unref(id)})`,
  33512. x: "13",
  33513. y: "45",
  33514. width: "40",
  33515. height: "36"
  33516. }, null, 8, ["fill"]),
  33517. createElementVNode("g", { transform: "translate(53.000000, 45.000000)" }, [
  33518. createElementVNode("use", {
  33519. fill: `var(${unref(ns).cssVarBlockName("fill-color-8")})`,
  33520. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  33521. "xlink:href": `#path-3-${unref(id)}`
  33522. }, null, 8, ["fill", "xlink:href"]),
  33523. createElementVNode("polygon", {
  33524. fill: `var(${unref(ns).cssVarBlockName("fill-color-9")})`,
  33525. mask: `url(#mask-4-${unref(id)})`,
  33526. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  33527. points: "7 0 24 0 20 18 7 16.5"
  33528. }, null, 8, ["fill", "mask"])
  33529. ]),
  33530. createElementVNode("polygon", {
  33531. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  33532. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  33533. points: "62 45 79 45 70 58 53 58"
  33534. }, null, 8, ["fill"])
  33535. ])
  33536. ])
  33537. ])
  33538. ]);
  33539. };
  33540. }
  33541. });
  33542. var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["__file", "img-empty.vue"]]);
  33543. const emptyProps = buildProps({
  33544. image: {
  33545. type: String,
  33546. default: ""
  33547. },
  33548. imageSize: Number,
  33549. description: {
  33550. type: String,
  33551. default: ""
  33552. }
  33553. });
  33554. const __default__$W = defineComponent({
  33555. name: "ElEmpty"
  33556. });
  33557. const _sfc_main$18 = /* @__PURE__ */ defineComponent({
  33558. ...__default__$W,
  33559. props: emptyProps,
  33560. setup(__props) {
  33561. const props = __props;
  33562. const { t } = useLocale();
  33563. const ns = useNamespace("empty");
  33564. const emptyDescription = computed(() => props.description || t("el.table.emptyText"));
  33565. const imageStyle = computed(() => ({
  33566. width: addUnit(props.imageSize)
  33567. }));
  33568. return (_ctx, _cache) => {
  33569. return openBlock(), createElementBlock("div", {
  33570. class: normalizeClass(unref(ns).b())
  33571. }, [
  33572. createElementVNode("div", {
  33573. class: normalizeClass(unref(ns).e("image")),
  33574. style: normalizeStyle(unref(imageStyle))
  33575. }, [
  33576. _ctx.image ? (openBlock(), createElementBlock("img", {
  33577. key: 0,
  33578. src: _ctx.image,
  33579. ondragstart: "return false"
  33580. }, null, 8, ["src"])) : renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  33581. createVNode(ImgEmpty)
  33582. ])
  33583. ], 6),
  33584. createElementVNode("div", {
  33585. class: normalizeClass(unref(ns).e("description"))
  33586. }, [
  33587. _ctx.$slots.description ? renderSlot(_ctx.$slots, "description", { key: 0 }) : (openBlock(), createElementBlock("p", { key: 1 }, toDisplayString(unref(emptyDescription)), 1))
  33588. ], 2),
  33589. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  33590. key: 0,
  33591. class: normalizeClass(unref(ns).e("bottom"))
  33592. }, [
  33593. renderSlot(_ctx.$slots, "default")
  33594. ], 2)) : createCommentVNode("v-if", true)
  33595. ], 2);
  33596. };
  33597. }
  33598. });
  33599. var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["__file", "empty.vue"]]);
  33600. const ElEmpty = withInstall(Empty);
  33601. const imageViewerProps = buildProps({
  33602. urlList: {
  33603. type: definePropType(Array),
  33604. default: () => mutable([])
  33605. },
  33606. zIndex: {
  33607. type: Number
  33608. },
  33609. initialIndex: {
  33610. type: Number,
  33611. default: 0
  33612. },
  33613. infinite: {
  33614. type: Boolean,
  33615. default: true
  33616. },
  33617. hideOnClickModal: Boolean,
  33618. teleported: Boolean,
  33619. closeOnPressEscape: {
  33620. type: Boolean,
  33621. default: true
  33622. },
  33623. zoomRate: {
  33624. type: Number,
  33625. default: 1.2
  33626. },
  33627. scale: {
  33628. type: Number,
  33629. default: 1
  33630. },
  33631. minScale: {
  33632. type: Number,
  33633. default: 0.2
  33634. },
  33635. maxScale: {
  33636. type: Number,
  33637. default: 7
  33638. },
  33639. showProgress: Boolean,
  33640. crossorigin: {
  33641. type: definePropType(String)
  33642. }
  33643. });
  33644. const imageViewerEmits = {
  33645. close: () => true,
  33646. error: (evt) => evt instanceof Event,
  33647. switch: (index) => isNumber(index),
  33648. rotate: (deg) => isNumber(deg)
  33649. };
  33650. const __default__$V = defineComponent({
  33651. name: "ElImageViewer"
  33652. });
  33653. const _sfc_main$17 = /* @__PURE__ */ defineComponent({
  33654. ...__default__$V,
  33655. props: imageViewerProps,
  33656. emits: imageViewerEmits,
  33657. setup(__props, { expose, emit }) {
  33658. var _a;
  33659. const props = __props;
  33660. const modes = {
  33661. CONTAIN: {
  33662. name: "contain",
  33663. icon: markRaw(full_screen_default)
  33664. },
  33665. ORIGINAL: {
  33666. name: "original",
  33667. icon: markRaw(scale_to_original_default)
  33668. }
  33669. };
  33670. let stopWheelListener;
  33671. let prevOverflow = "";
  33672. const { t } = useLocale();
  33673. const ns = useNamespace("image-viewer");
  33674. const { nextZIndex } = useZIndex();
  33675. const wrapper = ref();
  33676. const imgRef = ref();
  33677. const scopeEventListener = effectScope();
  33678. const scaleClamped = computed(() => {
  33679. const { scale, minScale, maxScale } = props;
  33680. return clamp$2(scale, minScale, maxScale);
  33681. });
  33682. const loading = ref(true);
  33683. const loadError = ref(false);
  33684. const activeIndex = ref(props.initialIndex);
  33685. const mode = shallowRef(modes.CONTAIN);
  33686. const transform = ref({
  33687. scale: scaleClamped.value,
  33688. deg: 0,
  33689. offsetX: 0,
  33690. offsetY: 0,
  33691. enableTransition: false
  33692. });
  33693. const zIndex = ref((_a = props.zIndex) != null ? _a : nextZIndex());
  33694. const isSingle = computed(() => {
  33695. const { urlList } = props;
  33696. return urlList.length <= 1;
  33697. });
  33698. const isFirst = computed(() => activeIndex.value === 0);
  33699. const isLast = computed(() => activeIndex.value === props.urlList.length - 1);
  33700. const currentImg = computed(() => props.urlList[activeIndex.value]);
  33701. const arrowPrevKls = computed(() => [
  33702. ns.e("btn"),
  33703. ns.e("prev"),
  33704. ns.is("disabled", !props.infinite && isFirst.value)
  33705. ]);
  33706. const arrowNextKls = computed(() => [
  33707. ns.e("btn"),
  33708. ns.e("next"),
  33709. ns.is("disabled", !props.infinite && isLast.value)
  33710. ]);
  33711. const imgStyle = computed(() => {
  33712. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  33713. let translateX = offsetX / scale;
  33714. let translateY = offsetY / scale;
  33715. const radian = deg * Math.PI / 180;
  33716. const cosRadian = Math.cos(radian);
  33717. const sinRadian = Math.sin(radian);
  33718. translateX = translateX * cosRadian + translateY * sinRadian;
  33719. translateY = translateY * cosRadian - offsetX / scale * sinRadian;
  33720. const style = {
  33721. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  33722. transition: enableTransition ? "transform .3s" : ""
  33723. };
  33724. if (mode.value.name === modes.CONTAIN.name) {
  33725. style.maxWidth = style.maxHeight = "100%";
  33726. }
  33727. return style;
  33728. });
  33729. const progress = computed(() => `${activeIndex.value + 1} / ${props.urlList.length}`);
  33730. function hide() {
  33731. unregisterEventListener();
  33732. stopWheelListener == null ? void 0 : stopWheelListener();
  33733. document.body.style.overflow = prevOverflow;
  33734. emit("close");
  33735. }
  33736. function registerEventListener() {
  33737. const keydownHandler = throttle((e) => {
  33738. const code = getEventCode(e);
  33739. switch (code) {
  33740. case EVENT_CODE.esc:
  33741. props.closeOnPressEscape && hide();
  33742. break;
  33743. case EVENT_CODE.space:
  33744. toggleMode();
  33745. break;
  33746. case EVENT_CODE.left:
  33747. prev();
  33748. break;
  33749. case EVENT_CODE.up:
  33750. handleActions("zoomIn");
  33751. break;
  33752. case EVENT_CODE.right:
  33753. next();
  33754. break;
  33755. case EVENT_CODE.down:
  33756. handleActions("zoomOut");
  33757. break;
  33758. }
  33759. });
  33760. const mousewheelHandler = throttle((e) => {
  33761. const delta = e.deltaY || e.deltaX;
  33762. handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
  33763. zoomRate: props.zoomRate,
  33764. enableTransition: false
  33765. });
  33766. });
  33767. scopeEventListener.run(() => {
  33768. useEventListener(document, "keydown", keydownHandler);
  33769. useEventListener(document, "wheel", mousewheelHandler);
  33770. });
  33771. }
  33772. function unregisterEventListener() {
  33773. scopeEventListener.stop();
  33774. }
  33775. function handleImgLoad() {
  33776. loading.value = false;
  33777. }
  33778. function handleImgError(e) {
  33779. loadError.value = true;
  33780. loading.value = false;
  33781. emit("error", e);
  33782. e.target.alt = t("el.image.error");
  33783. }
  33784. function handleMouseDown(e) {
  33785. if (loading.value || e.button !== 0 || !wrapper.value)
  33786. return;
  33787. transform.value.enableTransition = false;
  33788. const { offsetX, offsetY } = transform.value;
  33789. const startX = e.pageX;
  33790. const startY = e.pageY;
  33791. const dragHandler = throttle((ev) => {
  33792. transform.value = {
  33793. ...transform.value,
  33794. offsetX: offsetX + ev.pageX - startX,
  33795. offsetY: offsetY + ev.pageY - startY
  33796. };
  33797. });
  33798. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  33799. useEventListener(document, "mouseup", () => {
  33800. removeMousemove();
  33801. });
  33802. e.preventDefault();
  33803. }
  33804. function reset() {
  33805. transform.value = {
  33806. scale: scaleClamped.value,
  33807. deg: 0,
  33808. offsetX: 0,
  33809. offsetY: 0,
  33810. enableTransition: false
  33811. };
  33812. }
  33813. function toggleMode() {
  33814. if (loading.value || loadError.value)
  33815. return;
  33816. const modeNames = keysOf(modes);
  33817. const modeValues = Object.values(modes);
  33818. const currentMode = mode.value.name;
  33819. const index = modeValues.findIndex((i) => i.name === currentMode);
  33820. const nextIndex = (index + 1) % modeNames.length;
  33821. mode.value = modes[modeNames[nextIndex]];
  33822. reset();
  33823. }
  33824. function setActiveItem(index) {
  33825. loadError.value = false;
  33826. const len = props.urlList.length;
  33827. activeIndex.value = (index + len) % len;
  33828. }
  33829. function prev() {
  33830. if (isFirst.value && !props.infinite)
  33831. return;
  33832. setActiveItem(activeIndex.value - 1);
  33833. }
  33834. function next() {
  33835. if (isLast.value && !props.infinite)
  33836. return;
  33837. setActiveItem(activeIndex.value + 1);
  33838. }
  33839. function handleActions(action, options = {}) {
  33840. if (loading.value || loadError.value)
  33841. return;
  33842. const { minScale, maxScale } = props;
  33843. const { zoomRate, rotateDeg, enableTransition } = {
  33844. zoomRate: props.zoomRate,
  33845. rotateDeg: 90,
  33846. enableTransition: true,
  33847. ...options
  33848. };
  33849. switch (action) {
  33850. case "zoomOut":
  33851. if (transform.value.scale > minScale) {
  33852. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  33853. }
  33854. break;
  33855. case "zoomIn":
  33856. if (transform.value.scale < maxScale) {
  33857. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  33858. }
  33859. break;
  33860. case "clockwise":
  33861. transform.value.deg += rotateDeg;
  33862. emit("rotate", transform.value.deg);
  33863. break;
  33864. case "anticlockwise":
  33865. transform.value.deg -= rotateDeg;
  33866. emit("rotate", transform.value.deg);
  33867. break;
  33868. }
  33869. transform.value.enableTransition = enableTransition;
  33870. }
  33871. function onFocusoutPrevented(event) {
  33872. var _a2;
  33873. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  33874. event.preventDefault();
  33875. }
  33876. }
  33877. function onCloseRequested() {
  33878. if (props.closeOnPressEscape) {
  33879. hide();
  33880. }
  33881. }
  33882. function wheelHandler(e) {
  33883. if (!e.ctrlKey)
  33884. return;
  33885. if (e.deltaY < 0) {
  33886. e.preventDefault();
  33887. return false;
  33888. } else if (e.deltaY > 0) {
  33889. e.preventDefault();
  33890. return false;
  33891. }
  33892. }
  33893. watch(() => scaleClamped.value, (val) => {
  33894. transform.value.scale = val;
  33895. });
  33896. watch(currentImg, () => {
  33897. nextTick(() => {
  33898. const $img = imgRef.value;
  33899. if (!($img == null ? void 0 : $img.complete)) {
  33900. loading.value = true;
  33901. }
  33902. });
  33903. });
  33904. watch(activeIndex, (val) => {
  33905. reset();
  33906. emit("switch", val);
  33907. });
  33908. onMounted(() => {
  33909. registerEventListener();
  33910. stopWheelListener = useEventListener("wheel", wheelHandler, {
  33911. passive: false
  33912. });
  33913. prevOverflow = document.body.style.overflow;
  33914. document.body.style.overflow = "hidden";
  33915. });
  33916. expose({
  33917. setActiveItem
  33918. });
  33919. return (_ctx, _cache) => {
  33920. return openBlock(), createBlock(unref(ElTeleport$1), {
  33921. to: "body",
  33922. disabled: !_ctx.teleported
  33923. }, {
  33924. default: withCtx(() => [
  33925. createVNode(Transition, {
  33926. name: "viewer-fade",
  33927. appear: ""
  33928. }, {
  33929. default: withCtx(() => [
  33930. createElementVNode("div", {
  33931. ref_key: "wrapper",
  33932. ref: wrapper,
  33933. tabindex: -1,
  33934. class: normalizeClass(unref(ns).e("wrapper")),
  33935. style: normalizeStyle({ zIndex: zIndex.value })
  33936. }, [
  33937. createVNode(unref(ElFocusTrap), {
  33938. loop: "",
  33939. trapped: "",
  33940. "focus-trap-el": wrapper.value,
  33941. "focus-start-el": "container",
  33942. onFocusoutPrevented,
  33943. onReleaseRequested: onCloseRequested
  33944. }, {
  33945. default: withCtx(() => [
  33946. createElementVNode("div", {
  33947. class: normalizeClass(unref(ns).e("mask")),
  33948. onClick: withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"])
  33949. }, null, 10, ["onClick"]),
  33950. createCommentVNode(" CLOSE "),
  33951. createElementVNode("span", {
  33952. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  33953. onClick: hide
  33954. }, [
  33955. createVNode(unref(ElIcon), null, {
  33956. default: withCtx(() => [
  33957. createVNode(unref(close_default))
  33958. ]),
  33959. _: 1
  33960. })
  33961. ], 2),
  33962. createCommentVNode(" ARROW "),
  33963. !unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  33964. createElementVNode("span", {
  33965. class: normalizeClass(unref(arrowPrevKls)),
  33966. onClick: prev
  33967. }, [
  33968. createVNode(unref(ElIcon), null, {
  33969. default: withCtx(() => [
  33970. createVNode(unref(arrow_left_default))
  33971. ]),
  33972. _: 1
  33973. })
  33974. ], 2),
  33975. createElementVNode("span", {
  33976. class: normalizeClass(unref(arrowNextKls)),
  33977. onClick: next
  33978. }, [
  33979. createVNode(unref(ElIcon), null, {
  33980. default: withCtx(() => [
  33981. createVNode(unref(arrow_right_default))
  33982. ]),
  33983. _: 1
  33984. })
  33985. ], 2)
  33986. ], 64)) : createCommentVNode("v-if", true),
  33987. _ctx.$slots.progress || _ctx.showProgress ? (openBlock(), createElementBlock("div", {
  33988. key: 1,
  33989. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("progress")])
  33990. }, [
  33991. renderSlot(_ctx.$slots, "progress", {
  33992. activeIndex: activeIndex.value,
  33993. total: _ctx.urlList.length
  33994. }, () => [
  33995. createTextVNode(toDisplayString(unref(progress)), 1)
  33996. ])
  33997. ], 2)) : createCommentVNode("v-if", true),
  33998. createCommentVNode(" ACTIONS "),
  33999. createElementVNode("div", {
  34000. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
  34001. }, [
  34002. createElementVNode("div", {
  34003. class: normalizeClass(unref(ns).e("actions__inner"))
  34004. }, [
  34005. renderSlot(_ctx.$slots, "toolbar", {
  34006. actions: handleActions,
  34007. prev,
  34008. next,
  34009. reset: toggleMode,
  34010. activeIndex: activeIndex.value,
  34011. setActiveItem
  34012. }, () => [
  34013. createVNode(unref(ElIcon), {
  34014. onClick: ($event) => handleActions("zoomOut")
  34015. }, {
  34016. default: withCtx(() => [
  34017. createVNode(unref(zoom_out_default))
  34018. ]),
  34019. _: 1
  34020. }, 8, ["onClick"]),
  34021. createVNode(unref(ElIcon), {
  34022. onClick: ($event) => handleActions("zoomIn")
  34023. }, {
  34024. default: withCtx(() => [
  34025. createVNode(unref(zoom_in_default))
  34026. ]),
  34027. _: 1
  34028. }, 8, ["onClick"]),
  34029. createElementVNode("i", {
  34030. class: normalizeClass(unref(ns).e("actions__divider"))
  34031. }, null, 2),
  34032. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  34033. default: withCtx(() => [
  34034. (openBlock(), createBlock(resolveDynamicComponent(unref(mode).icon)))
  34035. ]),
  34036. _: 1
  34037. }),
  34038. createElementVNode("i", {
  34039. class: normalizeClass(unref(ns).e("actions__divider"))
  34040. }, null, 2),
  34041. createVNode(unref(ElIcon), {
  34042. onClick: ($event) => handleActions("anticlockwise")
  34043. }, {
  34044. default: withCtx(() => [
  34045. createVNode(unref(refresh_left_default))
  34046. ]),
  34047. _: 1
  34048. }, 8, ["onClick"]),
  34049. createVNode(unref(ElIcon), {
  34050. onClick: ($event) => handleActions("clockwise")
  34051. }, {
  34052. default: withCtx(() => [
  34053. createVNode(unref(refresh_right_default))
  34054. ]),
  34055. _: 1
  34056. }, 8, ["onClick"])
  34057. ])
  34058. ], 2)
  34059. ], 2),
  34060. createCommentVNode(" CANVAS "),
  34061. createElementVNode("div", {
  34062. class: normalizeClass(unref(ns).e("canvas"))
  34063. }, [
  34064. loadError.value && _ctx.$slots["viewer-error"] ? renderSlot(_ctx.$slots, "viewer-error", {
  34065. key: 0,
  34066. activeIndex: activeIndex.value,
  34067. src: unref(currentImg)
  34068. }) : (openBlock(), createElementBlock("img", {
  34069. ref_key: "imgRef",
  34070. ref: imgRef,
  34071. key: unref(currentImg),
  34072. src: unref(currentImg),
  34073. style: normalizeStyle(unref(imgStyle)),
  34074. class: normalizeClass(unref(ns).e("img")),
  34075. crossorigin: _ctx.crossorigin,
  34076. onLoad: handleImgLoad,
  34077. onError: handleImgError,
  34078. onMousedown: handleMouseDown
  34079. }, null, 46, ["src", "crossorigin"]))
  34080. ], 2),
  34081. renderSlot(_ctx.$slots, "default")
  34082. ]),
  34083. _: 3
  34084. }, 8, ["focus-trap-el"])
  34085. ], 6)
  34086. ]),
  34087. _: 3
  34088. })
  34089. ]),
  34090. _: 3
  34091. }, 8, ["disabled"]);
  34092. };
  34093. }
  34094. });
  34095. var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__file", "image-viewer.vue"]]);
  34096. const ElImageViewer = withInstall(ImageViewer);
  34097. const imageProps = buildProps({
  34098. hideOnClickModal: Boolean,
  34099. src: {
  34100. type: String,
  34101. default: ""
  34102. },
  34103. fit: {
  34104. type: String,
  34105. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  34106. default: ""
  34107. },
  34108. loading: {
  34109. type: String,
  34110. values: ["eager", "lazy"]
  34111. },
  34112. lazy: Boolean,
  34113. scrollContainer: {
  34114. type: definePropType([String, Object])
  34115. },
  34116. previewSrcList: {
  34117. type: definePropType(Array),
  34118. default: () => mutable([])
  34119. },
  34120. previewTeleported: Boolean,
  34121. zIndex: {
  34122. type: Number
  34123. },
  34124. initialIndex: {
  34125. type: Number,
  34126. default: 0
  34127. },
  34128. infinite: {
  34129. type: Boolean,
  34130. default: true
  34131. },
  34132. closeOnPressEscape: {
  34133. type: Boolean,
  34134. default: true
  34135. },
  34136. zoomRate: {
  34137. type: Number,
  34138. default: 1.2
  34139. },
  34140. scale: {
  34141. type: Number,
  34142. default: 1
  34143. },
  34144. minScale: {
  34145. type: Number,
  34146. default: 0.2
  34147. },
  34148. maxScale: {
  34149. type: Number,
  34150. default: 7
  34151. },
  34152. showProgress: Boolean,
  34153. crossorigin: {
  34154. type: definePropType(String)
  34155. }
  34156. });
  34157. const imageEmits = {
  34158. load: (evt) => evt instanceof Event,
  34159. error: (evt) => evt instanceof Event,
  34160. switch: (val) => isNumber(val),
  34161. close: () => true,
  34162. show: () => true
  34163. };
  34164. const __default__$U = defineComponent({
  34165. name: "ElImage",
  34166. inheritAttrs: false
  34167. });
  34168. const _sfc_main$16 = /* @__PURE__ */ defineComponent({
  34169. ...__default__$U,
  34170. props: imageProps,
  34171. emits: imageEmits,
  34172. setup(__props, { expose, emit }) {
  34173. const props = __props;
  34174. const { t } = useLocale();
  34175. const ns = useNamespace("image");
  34176. const rawAttrs = useAttrs$1();
  34177. const containerAttrs = computed(() => {
  34178. return fromPairs(Object.entries(rawAttrs).filter(([key]) => /^(data-|on[A-Z])/i.test(key) || ["id", "style"].includes(key)));
  34179. });
  34180. const imgAttrs = useAttrs({
  34181. excludeListeners: true,
  34182. excludeKeys: computed(() => {
  34183. return Object.keys(containerAttrs.value);
  34184. })
  34185. });
  34186. const imageSrc = ref();
  34187. const hasLoadError = ref(false);
  34188. const isLoading = ref(true);
  34189. const showViewer = ref(false);
  34190. const container = ref();
  34191. const _scrollContainer = ref();
  34192. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  34193. let stopScrollListener;
  34194. const imageKls = computed(() => [
  34195. ns.e("inner"),
  34196. preview.value && ns.e("preview"),
  34197. isLoading.value && ns.is("loading")
  34198. ]);
  34199. const imageStyle = computed(() => {
  34200. const { fit } = props;
  34201. if (isClient && fit) {
  34202. return { objectFit: fit };
  34203. }
  34204. return {};
  34205. });
  34206. const preview = computed(() => {
  34207. const { previewSrcList } = props;
  34208. return isArray$1(previewSrcList) && previewSrcList.length > 0;
  34209. });
  34210. const imageIndex = computed(() => {
  34211. const { previewSrcList, initialIndex } = props;
  34212. let previewIndex = initialIndex;
  34213. if (initialIndex > previewSrcList.length - 1) {
  34214. previewIndex = 0;
  34215. }
  34216. return previewIndex;
  34217. });
  34218. const isManual = computed(() => {
  34219. if (props.loading === "eager")
  34220. return false;
  34221. return !supportLoading && props.loading === "lazy" || props.lazy;
  34222. });
  34223. const loadImage = () => {
  34224. if (!isClient)
  34225. return;
  34226. isLoading.value = true;
  34227. hasLoadError.value = false;
  34228. imageSrc.value = props.src;
  34229. };
  34230. function handleLoad(event) {
  34231. isLoading.value = false;
  34232. hasLoadError.value = false;
  34233. emit("load", event);
  34234. }
  34235. function handleError(event) {
  34236. isLoading.value = false;
  34237. hasLoadError.value = true;
  34238. emit("error", event);
  34239. }
  34240. function handleLazyLoad(isIntersecting) {
  34241. if (isIntersecting) {
  34242. loadImage();
  34243. removeLazyLoadListener();
  34244. }
  34245. }
  34246. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
  34247. async function addLazyLoadListener() {
  34248. var _a;
  34249. if (!isClient)
  34250. return;
  34251. await nextTick();
  34252. const { scrollContainer } = props;
  34253. if (isElement$2(scrollContainer)) {
  34254. _scrollContainer.value = scrollContainer;
  34255. } else if (isString$1(scrollContainer) && scrollContainer !== "") {
  34256. _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
  34257. } else if (container.value) {
  34258. const scrollContainer2 = getScrollContainer(container.value);
  34259. _scrollContainer.value = isWindow$1(scrollContainer2) ? void 0 : scrollContainer2;
  34260. }
  34261. const { stop } = useIntersectionObserver(container, ([entry]) => {
  34262. lazyLoadHandler(entry.isIntersecting);
  34263. }, { root: _scrollContainer });
  34264. stopScrollListener = stop;
  34265. }
  34266. function removeLazyLoadListener() {
  34267. if (!isClient || !lazyLoadHandler)
  34268. return;
  34269. stopScrollListener == null ? void 0 : stopScrollListener();
  34270. _scrollContainer.value = void 0;
  34271. stopScrollListener = void 0;
  34272. }
  34273. function clickHandler() {
  34274. if (!preview.value)
  34275. return;
  34276. showViewer.value = true;
  34277. emit("show");
  34278. }
  34279. function closeViewer() {
  34280. showViewer.value = false;
  34281. emit("close");
  34282. }
  34283. function switchViewer(val) {
  34284. emit("switch", val);
  34285. }
  34286. watch(() => props.src, () => {
  34287. if (isManual.value) {
  34288. isLoading.value = true;
  34289. hasLoadError.value = false;
  34290. removeLazyLoadListener();
  34291. addLazyLoadListener();
  34292. } else {
  34293. loadImage();
  34294. }
  34295. });
  34296. onMounted(() => {
  34297. if (isManual.value) {
  34298. addLazyLoadListener();
  34299. } else {
  34300. loadImage();
  34301. }
  34302. });
  34303. expose({
  34304. showPreview: clickHandler
  34305. });
  34306. return (_ctx, _cache) => {
  34307. return openBlock(), createElementBlock("div", mergeProps({
  34308. ref_key: "container",
  34309. ref: container
  34310. }, unref(containerAttrs), {
  34311. class: [unref(ns).b(), _ctx.$attrs.class]
  34312. }), [
  34313. hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 0 }, () => [
  34314. createElementVNode("div", {
  34315. class: normalizeClass(unref(ns).e("error"))
  34316. }, toDisplayString(unref(t)("el.image.error")), 3)
  34317. ]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  34318. imageSrc.value !== void 0 ? (openBlock(), createElementBlock("img", mergeProps({ key: 0 }, unref(imgAttrs), {
  34319. src: imageSrc.value,
  34320. loading: _ctx.loading,
  34321. style: unref(imageStyle),
  34322. class: unref(imageKls),
  34323. crossorigin: _ctx.crossorigin,
  34324. onClick: clickHandler,
  34325. onLoad: handleLoad,
  34326. onError: handleError
  34327. }), null, 16, ["src", "loading", "crossorigin"])) : createCommentVNode("v-if", true),
  34328. isLoading.value ? (openBlock(), createElementBlock("div", {
  34329. key: 1,
  34330. class: normalizeClass(unref(ns).e("wrapper"))
  34331. }, [
  34332. renderSlot(_ctx.$slots, "placeholder", {}, () => [
  34333. createElementVNode("div", {
  34334. class: normalizeClass(unref(ns).e("placeholder"))
  34335. }, null, 2)
  34336. ])
  34337. ], 2)) : createCommentVNode("v-if", true)
  34338. ], 64)),
  34339. unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  34340. showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  34341. key: 0,
  34342. "z-index": _ctx.zIndex,
  34343. "initial-index": unref(imageIndex),
  34344. infinite: _ctx.infinite,
  34345. "zoom-rate": _ctx.zoomRate,
  34346. "min-scale": _ctx.minScale,
  34347. "max-scale": _ctx.maxScale,
  34348. "show-progress": _ctx.showProgress,
  34349. "url-list": _ctx.previewSrcList,
  34350. scale: _ctx.scale,
  34351. crossorigin: _ctx.crossorigin,
  34352. "hide-on-click-modal": _ctx.hideOnClickModal,
  34353. teleported: _ctx.previewTeleported,
  34354. "close-on-press-escape": _ctx.closeOnPressEscape,
  34355. onClose: closeViewer,
  34356. onSwitch: switchViewer
  34357. }, createSlots({
  34358. toolbar: withCtx((toolbar) => [
  34359. renderSlot(_ctx.$slots, "toolbar", normalizeProps(guardReactiveProps(toolbar)))
  34360. ]),
  34361. default: withCtx(() => [
  34362. _ctx.$slots.viewer ? (openBlock(), createElementBlock("div", { key: 0 }, [
  34363. renderSlot(_ctx.$slots, "viewer")
  34364. ])) : createCommentVNode("v-if", true)
  34365. ]),
  34366. _: 2
  34367. }, [
  34368. _ctx.$slots.progress ? {
  34369. name: "progress",
  34370. fn: withCtx((progress) => [
  34371. renderSlot(_ctx.$slots, "progress", normalizeProps(guardReactiveProps(progress)))
  34372. ])
  34373. } : void 0,
  34374. _ctx.$slots["viewer-error"] ? {
  34375. name: "viewer-error",
  34376. fn: withCtx((viewerError) => [
  34377. renderSlot(_ctx.$slots, "viewer-error", normalizeProps(guardReactiveProps(viewerError)))
  34378. ])
  34379. } : void 0
  34380. ]), 1032, ["z-index", "initial-index", "infinite", "zoom-rate", "min-scale", "max-scale", "show-progress", "url-list", "scale", "crossorigin", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : createCommentVNode("v-if", true)
  34381. ], 64)) : createCommentVNode("v-if", true)
  34382. ], 16);
  34383. };
  34384. }
  34385. });
  34386. var Image$1 = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__file", "image.vue"]]);
  34387. const ElImage = withInstall(Image$1);
  34388. const inputNumberProps = buildProps({
  34389. id: {
  34390. type: String,
  34391. default: void 0
  34392. },
  34393. step: {
  34394. type: Number,
  34395. default: 1
  34396. },
  34397. stepStrictly: Boolean,
  34398. max: {
  34399. type: Number,
  34400. default: Number.MAX_SAFE_INTEGER
  34401. },
  34402. min: {
  34403. type: Number,
  34404. default: Number.MIN_SAFE_INTEGER
  34405. },
  34406. modelValue: {
  34407. type: [Number, null]
  34408. },
  34409. readonly: Boolean,
  34410. disabled: Boolean,
  34411. size: useSizeProp,
  34412. controls: {
  34413. type: Boolean,
  34414. default: true
  34415. },
  34416. controlsPosition: {
  34417. type: String,
  34418. default: "",
  34419. values: ["", "right"]
  34420. },
  34421. valueOnClear: {
  34422. type: [String, Number, null],
  34423. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  34424. default: null
  34425. },
  34426. name: String,
  34427. placeholder: String,
  34428. precision: {
  34429. type: Number,
  34430. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  34431. },
  34432. validateEvent: {
  34433. type: Boolean,
  34434. default: true
  34435. },
  34436. ...useAriaProps(["ariaLabel"]),
  34437. inputmode: {
  34438. type: definePropType(String),
  34439. default: void 0
  34440. },
  34441. align: {
  34442. type: definePropType(String),
  34443. default: "center"
  34444. },
  34445. disabledScientific: Boolean
  34446. });
  34447. const inputNumberEmits = {
  34448. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  34449. blur: (e) => e instanceof FocusEvent,
  34450. focus: (e) => e instanceof FocusEvent,
  34451. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  34452. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  34453. };
  34454. const __default__$T = defineComponent({
  34455. name: "ElInputNumber"
  34456. });
  34457. const _sfc_main$15 = /* @__PURE__ */ defineComponent({
  34458. ...__default__$T,
  34459. props: inputNumberProps,
  34460. emits: inputNumberEmits,
  34461. setup(__props, { expose, emit }) {
  34462. const props = __props;
  34463. const { t } = useLocale();
  34464. const ns = useNamespace("input-number");
  34465. const input = ref();
  34466. const data = reactive({
  34467. currentValue: props.modelValue,
  34468. userInput: null
  34469. });
  34470. const { formItem } = useFormItem();
  34471. const minDisabled = computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  34472. const maxDisabled = computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  34473. const numPrecision = computed(() => {
  34474. const stepPrecision = getPrecision(props.step);
  34475. if (!isUndefined(props.precision)) {
  34476. if (stepPrecision > props.precision) {
  34477. debugWarn("InputNumber", "precision should not be less than the decimal places of step");
  34478. }
  34479. return props.precision;
  34480. } else {
  34481. return Math.max(getPrecision(props.modelValue), stepPrecision);
  34482. }
  34483. });
  34484. const controlsAtRight = computed(() => {
  34485. return props.controls && props.controlsPosition === "right";
  34486. });
  34487. const inputNumberSize = useFormSize();
  34488. const inputNumberDisabled = useFormDisabled();
  34489. const displayValue = computed(() => {
  34490. if (data.userInput !== null) {
  34491. return data.userInput;
  34492. }
  34493. let currentValue = data.currentValue;
  34494. if (isNil(currentValue))
  34495. return "";
  34496. if (isNumber(currentValue)) {
  34497. if (Number.isNaN(currentValue))
  34498. return "";
  34499. if (!isUndefined(props.precision)) {
  34500. currentValue = currentValue.toFixed(props.precision);
  34501. }
  34502. }
  34503. return currentValue;
  34504. });
  34505. const toPrecision = (num, pre) => {
  34506. if (isUndefined(pre))
  34507. pre = numPrecision.value;
  34508. if (pre === 0)
  34509. return Math.round(num);
  34510. let snum = String(num);
  34511. const pointPos = snum.indexOf(".");
  34512. if (pointPos === -1)
  34513. return num;
  34514. const nums = snum.replace(".", "").split("");
  34515. const datum = nums[pointPos + pre];
  34516. if (!datum)
  34517. return num;
  34518. const length = snum.length;
  34519. if (snum.charAt(length - 1) === "5") {
  34520. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  34521. }
  34522. return Number.parseFloat(Number(snum).toFixed(pre));
  34523. };
  34524. const getPrecision = (value) => {
  34525. if (isNil(value))
  34526. return 0;
  34527. const valueString = value.toString();
  34528. const dotPosition = valueString.indexOf(".");
  34529. let precision = 0;
  34530. if (dotPosition !== -1) {
  34531. precision = valueString.length - dotPosition - 1;
  34532. }
  34533. return precision;
  34534. };
  34535. const ensurePrecision = (val, coefficient = 1) => {
  34536. if (!isNumber(val))
  34537. return data.currentValue;
  34538. if (val >= Number.MAX_SAFE_INTEGER && coefficient === 1) {
  34539. debugWarn("InputNumber", "The value has reached the maximum safe integer limit.");
  34540. return val;
  34541. } else if (val <= Number.MIN_SAFE_INTEGER && coefficient === -1) {
  34542. debugWarn("InputNumber", "The value has reached the minimum safe integer limit.");
  34543. return val;
  34544. }
  34545. return toPrecision(val + props.step * coefficient);
  34546. };
  34547. const handleKeydown = (event) => {
  34548. const code = getEventCode(event);
  34549. const key = getEventKey(event);
  34550. if (props.disabledScientific && ["e", "E"].includes(key)) {
  34551. event.preventDefault();
  34552. return;
  34553. }
  34554. switch (code) {
  34555. case EVENT_CODE.up: {
  34556. event.preventDefault();
  34557. increase();
  34558. break;
  34559. }
  34560. case EVENT_CODE.down: {
  34561. event.preventDefault();
  34562. decrease();
  34563. break;
  34564. }
  34565. }
  34566. };
  34567. const increase = () => {
  34568. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  34569. return;
  34570. const value = Number(displayValue.value) || 0;
  34571. const newVal = ensurePrecision(value);
  34572. setCurrentValue(newVal);
  34573. emit(INPUT_EVENT, data.currentValue);
  34574. setCurrentValueToModelValue();
  34575. };
  34576. const decrease = () => {
  34577. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  34578. return;
  34579. const value = Number(displayValue.value) || 0;
  34580. const newVal = ensurePrecision(value, -1);
  34581. setCurrentValue(newVal);
  34582. emit(INPUT_EVENT, data.currentValue);
  34583. setCurrentValueToModelValue();
  34584. };
  34585. const verifyValue = (value, update) => {
  34586. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  34587. if (max < min) {
  34588. throwError("InputNumber", "min should not be greater than max.");
  34589. }
  34590. let newVal = Number(value);
  34591. if (isNil(value) || Number.isNaN(newVal)) {
  34592. return null;
  34593. }
  34594. if (value === "") {
  34595. if (valueOnClear === null) {
  34596. return null;
  34597. }
  34598. newVal = isString$1(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
  34599. }
  34600. if (stepStrictly) {
  34601. newVal = toPrecision(Math.round(toPrecision(newVal / step)) * step, precision);
  34602. if (newVal !== value) {
  34603. update && emit(UPDATE_MODEL_EVENT, newVal);
  34604. }
  34605. }
  34606. if (!isUndefined(precision)) {
  34607. newVal = toPrecision(newVal, precision);
  34608. }
  34609. if (newVal > max || newVal < min) {
  34610. newVal = newVal > max ? max : min;
  34611. update && emit(UPDATE_MODEL_EVENT, newVal);
  34612. }
  34613. return newVal;
  34614. };
  34615. const setCurrentValue = (value, emitChange = true) => {
  34616. var _a;
  34617. const oldVal = data.currentValue;
  34618. const newVal = verifyValue(value);
  34619. if (!emitChange) {
  34620. emit(UPDATE_MODEL_EVENT, newVal);
  34621. return;
  34622. }
  34623. if (oldVal === newVal && value)
  34624. return;
  34625. data.userInput = null;
  34626. emit(UPDATE_MODEL_EVENT, newVal);
  34627. if (oldVal !== newVal) {
  34628. emit(CHANGE_EVENT, newVal, oldVal);
  34629. }
  34630. if (props.validateEvent) {
  34631. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn(err));
  34632. }
  34633. data.currentValue = newVal;
  34634. };
  34635. const handleInput = (value) => {
  34636. data.userInput = value;
  34637. const newVal = value === "" ? null : Number(value);
  34638. emit(INPUT_EVENT, newVal);
  34639. setCurrentValue(newVal, false);
  34640. };
  34641. const handleInputChange = (value) => {
  34642. const newVal = value !== "" ? Number(value) : "";
  34643. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  34644. setCurrentValue(newVal);
  34645. }
  34646. setCurrentValueToModelValue();
  34647. data.userInput = null;
  34648. };
  34649. const focus = () => {
  34650. var _a, _b;
  34651. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  34652. };
  34653. const blur = () => {
  34654. var _a, _b;
  34655. (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  34656. };
  34657. const handleFocus = (event) => {
  34658. emit("focus", event);
  34659. };
  34660. const handleBlur = (event) => {
  34661. var _a, _b;
  34662. data.userInput = null;
  34663. if (data.currentValue === null && ((_a = input.value) == null ? void 0 : _a.input)) {
  34664. input.value.input.value = "";
  34665. }
  34666. emit("blur", event);
  34667. if (props.validateEvent) {
  34668. (_b = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _b.call(formItem, "blur").catch((err) => debugWarn(err));
  34669. }
  34670. };
  34671. const setCurrentValueToModelValue = () => {
  34672. if (data.currentValue !== props.modelValue) {
  34673. data.currentValue = props.modelValue;
  34674. }
  34675. };
  34676. const handleWheel = (e) => {
  34677. if (document.activeElement === e.target)
  34678. e.preventDefault();
  34679. };
  34680. watch(() => props.modelValue, (value, oldValue) => {
  34681. const newValue = verifyValue(value, true);
  34682. if (data.userInput === null && newValue !== oldValue) {
  34683. data.currentValue = newValue;
  34684. }
  34685. }, { immediate: true });
  34686. watch(() => props.precision, () => {
  34687. data.currentValue = verifyValue(props.modelValue);
  34688. });
  34689. onMounted(() => {
  34690. var _a;
  34691. const { min, max, modelValue } = props;
  34692. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  34693. innerInput.setAttribute("role", "spinbutton");
  34694. if (Number.isFinite(max)) {
  34695. innerInput.setAttribute("aria-valuemax", String(max));
  34696. } else {
  34697. innerInput.removeAttribute("aria-valuemax");
  34698. }
  34699. if (Number.isFinite(min)) {
  34700. innerInput.setAttribute("aria-valuemin", String(min));
  34701. } else {
  34702. innerInput.removeAttribute("aria-valuemin");
  34703. }
  34704. innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
  34705. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  34706. if (!isNumber(modelValue) && modelValue != null) {
  34707. let val = Number(modelValue);
  34708. if (Number.isNaN(val)) {
  34709. val = null;
  34710. }
  34711. emit(UPDATE_MODEL_EVENT, val);
  34712. }
  34713. innerInput.addEventListener("wheel", handleWheel, { passive: false });
  34714. });
  34715. onUpdated(() => {
  34716. var _a, _b;
  34717. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  34718. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${(_b = data.currentValue) != null ? _b : ""}`);
  34719. });
  34720. expose({
  34721. focus,
  34722. blur
  34723. });
  34724. return (_ctx, _cache) => {
  34725. return openBlock(), createElementBlock("div", {
  34726. class: normalizeClass([
  34727. unref(ns).b(),
  34728. unref(ns).m(unref(inputNumberSize)),
  34729. unref(ns).is("disabled", unref(inputNumberDisabled)),
  34730. unref(ns).is("without-controls", !_ctx.controls),
  34731. unref(ns).is("controls-right", unref(controlsAtRight)),
  34732. unref(ns).is(_ctx.align, !!_ctx.align)
  34733. ]),
  34734. onDragstart: withModifiers(() => {
  34735. }, ["prevent"])
  34736. }, [
  34737. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  34738. key: 0,
  34739. role: "button",
  34740. "aria-label": unref(t)("el.inputNumber.decrease"),
  34741. class: normalizeClass([unref(ns).e("decrease"), unref(ns).is("disabled", unref(minDisabled))]),
  34742. onKeydown: withKeys(decrease, ["enter"])
  34743. }, [
  34744. renderSlot(_ctx.$slots, "decrease-icon", {}, () => [
  34745. createVNode(unref(ElIcon), null, {
  34746. default: withCtx(() => [
  34747. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_down_default), { key: 0 })) : (openBlock(), createBlock(unref(minus_default), { key: 1 }))
  34748. ]),
  34749. _: 1
  34750. })
  34751. ])
  34752. ], 42, ["aria-label", "onKeydown"])), [
  34753. [unref(vRepeatClick), decrease]
  34754. ]) : createCommentVNode("v-if", true),
  34755. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  34756. key: 1,
  34757. role: "button",
  34758. "aria-label": unref(t)("el.inputNumber.increase"),
  34759. class: normalizeClass([unref(ns).e("increase"), unref(ns).is("disabled", unref(maxDisabled))]),
  34760. onKeydown: withKeys(increase, ["enter"])
  34761. }, [
  34762. renderSlot(_ctx.$slots, "increase-icon", {}, () => [
  34763. createVNode(unref(ElIcon), null, {
  34764. default: withCtx(() => [
  34765. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(plus_default), { key: 1 }))
  34766. ]),
  34767. _: 1
  34768. })
  34769. ])
  34770. ], 42, ["aria-label", "onKeydown"])), [
  34771. [unref(vRepeatClick), increase]
  34772. ]) : createCommentVNode("v-if", true),
  34773. createVNode(unref(ElInput), {
  34774. id: _ctx.id,
  34775. ref_key: "input",
  34776. ref: input,
  34777. type: "number",
  34778. step: _ctx.step,
  34779. "model-value": unref(displayValue),
  34780. placeholder: _ctx.placeholder,
  34781. readonly: _ctx.readonly,
  34782. disabled: unref(inputNumberDisabled),
  34783. size: unref(inputNumberSize),
  34784. max: _ctx.max,
  34785. min: _ctx.min,
  34786. name: _ctx.name,
  34787. "aria-label": _ctx.ariaLabel,
  34788. "validate-event": false,
  34789. inputmode: _ctx.inputmode,
  34790. onKeydown: handleKeydown,
  34791. onBlur: handleBlur,
  34792. onFocus: handleFocus,
  34793. onInput: handleInput,
  34794. onChange: handleInputChange
  34795. }, createSlots({
  34796. _: 2
  34797. }, [
  34798. _ctx.$slots.prefix ? {
  34799. name: "prefix",
  34800. fn: withCtx(() => [
  34801. renderSlot(_ctx.$slots, "prefix")
  34802. ])
  34803. } : void 0,
  34804. _ctx.$slots.suffix ? {
  34805. name: "suffix",
  34806. fn: withCtx(() => [
  34807. renderSlot(_ctx.$slots, "suffix")
  34808. ])
  34809. } : void 0
  34810. ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "inputmode"])
  34811. ], 42, ["onDragstart"]);
  34812. };
  34813. }
  34814. });
  34815. var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__file", "input-number.vue"]]);
  34816. const ElInputNumber = withInstall(InputNumber);
  34817. const inputTagProps = buildProps({
  34818. modelValue: {
  34819. type: definePropType(Array)
  34820. },
  34821. max: Number,
  34822. tagType: { ...tagProps.type, default: "info" },
  34823. tagEffect: tagProps.effect,
  34824. trigger: {
  34825. type: definePropType(String),
  34826. default: EVENT_CODE.enter
  34827. },
  34828. draggable: Boolean,
  34829. delimiter: {
  34830. type: [String, RegExp],
  34831. default: ""
  34832. },
  34833. size: useSizeProp,
  34834. clearable: Boolean,
  34835. clearIcon: {
  34836. type: iconPropType,
  34837. default: circle_close_default
  34838. },
  34839. disabled: {
  34840. type: Boolean,
  34841. default: void 0
  34842. },
  34843. validateEvent: {
  34844. type: Boolean,
  34845. default: true
  34846. },
  34847. readonly: Boolean,
  34848. autofocus: Boolean,
  34849. id: {
  34850. type: String,
  34851. default: void 0
  34852. },
  34853. tabindex: {
  34854. type: [String, Number],
  34855. default: 0
  34856. },
  34857. maxlength: {
  34858. type: [String, Number]
  34859. },
  34860. minlength: {
  34861. type: [String, Number]
  34862. },
  34863. placeholder: String,
  34864. autocomplete: {
  34865. type: definePropType(String),
  34866. default: "off"
  34867. },
  34868. saveOnBlur: {
  34869. type: Boolean,
  34870. default: true
  34871. },
  34872. collapseTags: Boolean,
  34873. collapseTagsTooltip: Boolean,
  34874. maxCollapseTags: {
  34875. type: Number,
  34876. default: 1
  34877. },
  34878. ariaLabel: String
  34879. });
  34880. const inputTagEmits = {
  34881. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  34882. [CHANGE_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  34883. [INPUT_EVENT]: (value) => isString$1(value),
  34884. "add-tag": (value) => isString$1(value) || isArray$1(value),
  34885. "remove-tag": (value, index) => isString$1(value) && isNumber(index),
  34886. "drag-tag": (oldIndex, newIndex, value) => isNumber(oldIndex) && isNumber(newIndex) && isString$1(value),
  34887. focus: (evt) => evt instanceof FocusEvent,
  34888. blur: (evt) => evt instanceof FocusEvent,
  34889. clear: () => true
  34890. };
  34891. function useDragTag({
  34892. wrapperRef,
  34893. handleDragged,
  34894. afterDragged
  34895. }) {
  34896. const ns = useNamespace("input-tag");
  34897. const dropIndicatorRef = shallowRef();
  34898. const showDropIndicator = ref(false);
  34899. let draggingIndex;
  34900. let draggingTag;
  34901. let dropIndex;
  34902. let dropType;
  34903. function getTagClassName(index) {
  34904. return `.${ns.e("inner")} .${ns.namespace.value}-tag:nth-child(${index + 1})`;
  34905. }
  34906. function handleDragStart(event, index) {
  34907. draggingIndex = index;
  34908. draggingTag = wrapperRef.value.querySelector(getTagClassName(index));
  34909. if (draggingTag) {
  34910. draggingTag.style.opacity = "0.5";
  34911. }
  34912. event.dataTransfer.effectAllowed = "move";
  34913. }
  34914. function handleDragOver(event, index) {
  34915. dropIndex = index;
  34916. event.preventDefault();
  34917. event.dataTransfer.dropEffect = "move";
  34918. if (isUndefined(draggingIndex) || draggingIndex === index) {
  34919. showDropIndicator.value = false;
  34920. return;
  34921. }
  34922. const dropPosition = wrapperRef.value.querySelector(getTagClassName(index)).getBoundingClientRect();
  34923. const dropPrev = !(draggingIndex + 1 === index);
  34924. const dropNext = !(draggingIndex - 1 === index);
  34925. const distance = event.clientX - dropPosition.left;
  34926. const prevPercent = dropPrev ? dropNext ? 0.5 : 1 : -1;
  34927. const nextPercent = dropNext ? dropPrev ? 0.5 : 0 : 1;
  34928. if (distance <= dropPosition.width * prevPercent) {
  34929. dropType = "before";
  34930. } else if (distance > dropPosition.width * nextPercent) {
  34931. dropType = "after";
  34932. } else {
  34933. dropType = void 0;
  34934. }
  34935. const innerEl = wrapperRef.value.querySelector(`.${ns.e("inner")}`);
  34936. const innerPosition = innerEl.getBoundingClientRect();
  34937. const gap = Number.parseFloat(getStyle(innerEl, "gap")) / 2;
  34938. const indicatorTop = dropPosition.top - innerPosition.top;
  34939. let indicatorLeft = -9999;
  34940. if (dropType === "before") {
  34941. indicatorLeft = Math.max(dropPosition.left - innerPosition.left - gap, Math.floor(-gap / 2));
  34942. } else if (dropType === "after") {
  34943. const left = dropPosition.right - innerPosition.left;
  34944. indicatorLeft = left + (innerPosition.width === left ? Math.floor(gap / 2) : gap);
  34945. }
  34946. setStyle(dropIndicatorRef.value, {
  34947. top: `${indicatorTop}px`,
  34948. left: `${indicatorLeft}px`
  34949. });
  34950. showDropIndicator.value = !!dropType;
  34951. }
  34952. function handleDragEnd(event) {
  34953. event.preventDefault();
  34954. if (draggingTag) {
  34955. draggingTag.style.opacity = "";
  34956. }
  34957. if (dropType && !isUndefined(draggingIndex) && !isUndefined(dropIndex) && draggingIndex !== dropIndex) {
  34958. handleDragged(draggingIndex, dropIndex, dropType);
  34959. }
  34960. showDropIndicator.value = false;
  34961. draggingIndex = void 0;
  34962. draggingTag = null;
  34963. dropIndex = void 0;
  34964. dropType = void 0;
  34965. afterDragged == null ? void 0 : afterDragged();
  34966. }
  34967. return {
  34968. dropIndicatorRef,
  34969. showDropIndicator,
  34970. handleDragStart,
  34971. handleDragOver,
  34972. handleDragEnd
  34973. };
  34974. }
  34975. function useHovering() {
  34976. const hovering = ref(false);
  34977. const handleMouseEnter = () => {
  34978. hovering.value = true;
  34979. };
  34980. const handleMouseLeave = () => {
  34981. hovering.value = false;
  34982. };
  34983. return {
  34984. hovering,
  34985. handleMouseEnter,
  34986. handleMouseLeave
  34987. };
  34988. }
  34989. function useInputTag({ props, emit, formItem }) {
  34990. const disabled = useFormDisabled();
  34991. const size = useFormSize();
  34992. const inputRef = shallowRef();
  34993. const inputValue = ref();
  34994. const tagTooltipRef = ref();
  34995. const tagSize = computed(() => {
  34996. return ["small"].includes(size.value) ? "small" : "default";
  34997. });
  34998. const placeholder = computed(() => {
  34999. var _a;
  35000. return ((_a = props.modelValue) == null ? void 0 : _a.length) ? void 0 : props.placeholder;
  35001. });
  35002. const closable = computed(() => !(props.readonly || disabled.value));
  35003. const inputLimit = computed(() => {
  35004. var _a, _b;
  35005. return isUndefined(props.max) ? false : ((_b = (_a = props.modelValue) == null ? void 0 : _a.length) != null ? _b : 0) >= props.max;
  35006. });
  35007. const showTagList = computed(() => {
  35008. var _a;
  35009. return props.collapseTags ? (_a = props.modelValue) == null ? void 0 : _a.slice(0, props.maxCollapseTags) : props.modelValue;
  35010. });
  35011. const collapseTagList = computed(() => {
  35012. var _a;
  35013. return props.collapseTags ? (_a = props.modelValue) == null ? void 0 : _a.slice(props.maxCollapseTags) : [];
  35014. });
  35015. const addTagsEmit = (value) => {
  35016. var _a;
  35017. const list = [...(_a = props.modelValue) != null ? _a : [], ...castArray$1(value)];
  35018. emit(UPDATE_MODEL_EVENT, list);
  35019. emit(CHANGE_EVENT, list);
  35020. emit("add-tag", value);
  35021. inputValue.value = void 0;
  35022. };
  35023. const getDelimitedTags = (input) => {
  35024. var _a, _b;
  35025. const tags = input.split(props.delimiter).filter((val) => val && val !== input);
  35026. if (props.max) {
  35027. const maxInsert = props.max - ((_b = (_a = props.modelValue) == null ? void 0 : _a.length) != null ? _b : 0);
  35028. tags.splice(maxInsert);
  35029. }
  35030. return tags.length === 1 ? tags[0] : tags;
  35031. };
  35032. const handleInput = (event) => {
  35033. if (inputLimit.value) {
  35034. inputValue.value = void 0;
  35035. return;
  35036. }
  35037. if (isComposing.value)
  35038. return;
  35039. if (props.delimiter && inputValue.value) {
  35040. const tags = getDelimitedTags(inputValue.value);
  35041. if (tags.length) {
  35042. addTagsEmit(tags);
  35043. }
  35044. }
  35045. emit(INPUT_EVENT, event.target.value);
  35046. };
  35047. const handleKeydown = (event) => {
  35048. var _a;
  35049. if (isComposing.value)
  35050. return;
  35051. const code = getEventCode(event);
  35052. switch (code) {
  35053. case props.trigger:
  35054. event.preventDefault();
  35055. event.stopPropagation();
  35056. handleAddTag();
  35057. break;
  35058. case EVENT_CODE.numpadEnter:
  35059. if (props.trigger === EVENT_CODE.enter) {
  35060. event.preventDefault();
  35061. event.stopPropagation();
  35062. handleAddTag();
  35063. }
  35064. break;
  35065. case EVENT_CODE.backspace:
  35066. if (!inputValue.value && ((_a = props.modelValue) == null ? void 0 : _a.length)) {
  35067. event.preventDefault();
  35068. event.stopPropagation();
  35069. handleRemoveTag(props.modelValue.length - 1);
  35070. }
  35071. break;
  35072. }
  35073. };
  35074. const handleKeyup = (event) => {
  35075. if (isComposing.value || !isAndroid())
  35076. return;
  35077. const code = getEventCode(event);
  35078. switch (code) {
  35079. case EVENT_CODE.space:
  35080. if (props.trigger === EVENT_CODE.space) {
  35081. event.preventDefault();
  35082. event.stopPropagation();
  35083. handleAddTag();
  35084. }
  35085. break;
  35086. }
  35087. };
  35088. const handleAddTag = () => {
  35089. var _a;
  35090. const value = (_a = inputValue.value) == null ? void 0 : _a.trim();
  35091. if (!value || inputLimit.value)
  35092. return;
  35093. addTagsEmit(value);
  35094. };
  35095. const handleRemoveTag = (index) => {
  35096. var _a;
  35097. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  35098. const [item] = value.splice(index, 1);
  35099. emit(UPDATE_MODEL_EVENT, value);
  35100. emit(CHANGE_EVENT, value);
  35101. emit("remove-tag", item, index);
  35102. };
  35103. const handleClear = () => {
  35104. inputValue.value = void 0;
  35105. emit(UPDATE_MODEL_EVENT, void 0);
  35106. emit(CHANGE_EVENT, void 0);
  35107. emit("clear");
  35108. };
  35109. const handleDragged = (draggingIndex, dropIndex, type) => {
  35110. var _a;
  35111. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  35112. const [draggedItem] = value.splice(draggingIndex, 1);
  35113. const step = dropIndex > draggingIndex && type === "before" ? -1 : dropIndex < draggingIndex && type === "after" ? 1 : 0;
  35114. value.splice(dropIndex + step, 0, draggedItem);
  35115. emit(UPDATE_MODEL_EVENT, value);
  35116. emit(CHANGE_EVENT, value);
  35117. emit("drag-tag", draggingIndex, dropIndex + step, draggedItem);
  35118. };
  35119. const focus = () => {
  35120. var _a;
  35121. (_a = inputRef.value) == null ? void 0 : _a.focus();
  35122. };
  35123. const blur = () => {
  35124. var _a;
  35125. (_a = inputRef.value) == null ? void 0 : _a.blur();
  35126. };
  35127. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  35128. disabled,
  35129. beforeBlur(event) {
  35130. var _a;
  35131. return (_a = tagTooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  35132. },
  35133. afterBlur() {
  35134. var _a;
  35135. if (props.saveOnBlur) {
  35136. handleAddTag();
  35137. } else {
  35138. inputValue.value = void 0;
  35139. }
  35140. if (props.validateEvent) {
  35141. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
  35142. }
  35143. }
  35144. });
  35145. const {
  35146. isComposing,
  35147. handleCompositionStart,
  35148. handleCompositionUpdate,
  35149. handleCompositionEnd
  35150. } = useComposition({ afterComposition: handleInput });
  35151. watch(() => props.modelValue, () => {
  35152. var _a;
  35153. if (props.validateEvent) {
  35154. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, CHANGE_EVENT).catch((err) => debugWarn(err));
  35155. }
  35156. });
  35157. return {
  35158. inputRef,
  35159. wrapperRef,
  35160. tagTooltipRef,
  35161. isFocused,
  35162. isComposing,
  35163. inputValue,
  35164. size,
  35165. tagSize,
  35166. placeholder,
  35167. closable,
  35168. disabled,
  35169. inputLimit,
  35170. showTagList,
  35171. collapseTagList,
  35172. handleDragged,
  35173. handleInput,
  35174. handleKeydown,
  35175. handleKeyup,
  35176. handleAddTag,
  35177. handleRemoveTag,
  35178. handleClear,
  35179. handleCompositionStart,
  35180. handleCompositionUpdate,
  35181. handleCompositionEnd,
  35182. focus,
  35183. blur
  35184. };
  35185. }
  35186. function useInputTagDom({
  35187. props,
  35188. isFocused,
  35189. hovering,
  35190. disabled,
  35191. inputValue,
  35192. size,
  35193. validateState,
  35194. validateIcon,
  35195. needStatusIcon
  35196. }) {
  35197. const attrs = useAttrs$1();
  35198. const slots = useSlots();
  35199. const ns = useNamespace("input-tag");
  35200. const nsInput = useNamespace("input");
  35201. const containerKls = computed(() => [
  35202. ns.b(),
  35203. ns.is("focused", isFocused.value),
  35204. ns.is("hovering", hovering.value),
  35205. ns.is("disabled", disabled.value),
  35206. ns.m(size.value),
  35207. ns.e("wrapper"),
  35208. attrs.class
  35209. ]);
  35210. const containerStyle = computed(() => [attrs.style]);
  35211. const innerKls = computed(() => {
  35212. var _a, _b;
  35213. return [
  35214. ns.e("inner"),
  35215. ns.is("draggable", props.draggable),
  35216. ns.is("left-space", !((_a = props.modelValue) == null ? void 0 : _a.length) && !slots.prefix),
  35217. ns.is("right-space", !((_b = props.modelValue) == null ? void 0 : _b.length) && !showSuffix.value)
  35218. ];
  35219. });
  35220. const showClear = computed(() => {
  35221. var _a;
  35222. return props.clearable && !disabled.value && !props.readonly && (((_a = props.modelValue) == null ? void 0 : _a.length) || inputValue.value) && (isFocused.value || hovering.value);
  35223. });
  35224. const showSuffix = computed(() => {
  35225. return slots.suffix || showClear.value || validateState.value && validateIcon.value && needStatusIcon.value;
  35226. });
  35227. return {
  35228. ns,
  35229. nsInput,
  35230. containerKls,
  35231. containerStyle,
  35232. innerKls,
  35233. showClear,
  35234. showSuffix
  35235. };
  35236. }
  35237. const __default__$S = defineComponent({
  35238. name: "ElInputTag",
  35239. inheritAttrs: false
  35240. });
  35241. const _sfc_main$14 = /* @__PURE__ */ defineComponent({
  35242. ...__default__$S,
  35243. props: inputTagProps,
  35244. emits: inputTagEmits,
  35245. setup(__props, { expose, emit }) {
  35246. const props = __props;
  35247. const attrs = useAttrs();
  35248. const slots = useSlots();
  35249. const { form, formItem } = useFormItem();
  35250. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  35251. const needStatusIcon = computed(() => {
  35252. var _a;
  35253. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  35254. });
  35255. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  35256. const validateIcon = computed(() => {
  35257. return validateState.value && ValidateComponentsMap[validateState.value];
  35258. });
  35259. const {
  35260. inputRef,
  35261. wrapperRef,
  35262. tagTooltipRef,
  35263. isFocused,
  35264. inputValue,
  35265. size,
  35266. tagSize,
  35267. placeholder,
  35268. closable,
  35269. disabled,
  35270. showTagList,
  35271. collapseTagList,
  35272. handleDragged,
  35273. handleInput,
  35274. handleKeydown,
  35275. handleKeyup,
  35276. handleRemoveTag,
  35277. handleClear,
  35278. handleCompositionStart,
  35279. handleCompositionUpdate,
  35280. handleCompositionEnd,
  35281. focus,
  35282. blur
  35283. } = useInputTag({ props, emit, formItem });
  35284. const { hovering, handleMouseEnter, handleMouseLeave } = useHovering();
  35285. const { calculatorRef, inputStyle } = useCalcInputWidth();
  35286. const {
  35287. dropIndicatorRef,
  35288. showDropIndicator,
  35289. handleDragStart,
  35290. handleDragOver,
  35291. handleDragEnd
  35292. } = useDragTag({ wrapperRef, handleDragged, afterDragged: focus });
  35293. const {
  35294. ns,
  35295. nsInput,
  35296. containerKls,
  35297. containerStyle,
  35298. innerKls,
  35299. showClear,
  35300. showSuffix
  35301. } = useInputTagDom({
  35302. props,
  35303. hovering,
  35304. isFocused,
  35305. inputValue,
  35306. disabled,
  35307. size,
  35308. validateState,
  35309. validateIcon,
  35310. needStatusIcon
  35311. });
  35312. expose({
  35313. focus,
  35314. blur
  35315. });
  35316. return (_ctx, _cache) => {
  35317. return openBlock(), createElementBlock("div", {
  35318. ref_key: "wrapperRef",
  35319. ref: wrapperRef,
  35320. class: normalizeClass(unref(containerKls)),
  35321. style: normalizeStyle(unref(containerStyle)),
  35322. onMouseenter: unref(handleMouseEnter),
  35323. onMouseleave: unref(handleMouseLeave)
  35324. }, [
  35325. unref(slots).prefix ? (openBlock(), createElementBlock("div", {
  35326. key: 0,
  35327. class: normalizeClass(unref(ns).e("prefix"))
  35328. }, [
  35329. renderSlot(_ctx.$slots, "prefix")
  35330. ], 2)) : createCommentVNode("v-if", true),
  35331. createElementVNode("div", {
  35332. class: normalizeClass(unref(innerKls))
  35333. }, [
  35334. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(showTagList), (item, index) => {
  35335. return openBlock(), createBlock(unref(ElTag), {
  35336. key: index,
  35337. size: unref(tagSize),
  35338. closable: unref(closable),
  35339. type: _ctx.tagType,
  35340. effect: _ctx.tagEffect,
  35341. draggable: unref(closable) && _ctx.draggable,
  35342. "disable-transitions": "",
  35343. onClose: ($event) => unref(handleRemoveTag)(index),
  35344. onDragstart: (event) => unref(handleDragStart)(event, index),
  35345. onDragover: (event) => unref(handleDragOver)(event, index),
  35346. onDragend: unref(handleDragEnd),
  35347. onDrop: withModifiers(() => {
  35348. }, ["stop"])
  35349. }, {
  35350. default: withCtx(() => [
  35351. renderSlot(_ctx.$slots, "tag", {
  35352. value: item,
  35353. index
  35354. }, () => [
  35355. createTextVNode(toDisplayString(item), 1)
  35356. ])
  35357. ]),
  35358. _: 2
  35359. }, 1032, ["size", "closable", "type", "effect", "draggable", "onClose", "onDragstart", "onDragover", "onDragend", "onDrop"]);
  35360. }), 128)),
  35361. _ctx.collapseTags && _ctx.modelValue && _ctx.modelValue.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(unref(ElTooltip), {
  35362. key: 0,
  35363. ref_key: "tagTooltipRef",
  35364. ref: tagTooltipRef,
  35365. disabled: !_ctx.collapseTagsTooltip,
  35366. "fallback-placements": ["bottom", "top", "right", "left"],
  35367. effect: _ctx.tagEffect,
  35368. placement: "bottom"
  35369. }, {
  35370. default: withCtx(() => [
  35371. createVNode(unref(ElTag), {
  35372. closable: false,
  35373. size: unref(tagSize),
  35374. type: _ctx.tagType,
  35375. effect: _ctx.tagEffect,
  35376. "disable-transitions": ""
  35377. }, {
  35378. default: withCtx(() => [
  35379. createTextVNode(" + " + toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 1)
  35380. ]),
  35381. _: 1
  35382. }, 8, ["size", "type", "effect"])
  35383. ]),
  35384. content: withCtx(() => [
  35385. createElementVNode("div", {
  35386. class: normalizeClass(unref(ns).e("input-tag-list"))
  35387. }, [
  35388. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(collapseTagList), (item, index) => {
  35389. return openBlock(), createBlock(unref(ElTag), {
  35390. key: index,
  35391. size: unref(tagSize),
  35392. closable: unref(closable),
  35393. type: _ctx.tagType,
  35394. effect: _ctx.tagEffect,
  35395. "disable-transitions": "",
  35396. onClose: ($event) => unref(handleRemoveTag)(index + _ctx.maxCollapseTags)
  35397. }, {
  35398. default: withCtx(() => [
  35399. renderSlot(_ctx.$slots, "tag", {
  35400. value: item,
  35401. index: index + _ctx.maxCollapseTags
  35402. }, () => [
  35403. createTextVNode(toDisplayString(item), 1)
  35404. ])
  35405. ]),
  35406. _: 2
  35407. }, 1032, ["size", "closable", "type", "effect", "onClose"]);
  35408. }), 128))
  35409. ], 2)
  35410. ]),
  35411. _: 3
  35412. }, 8, ["disabled", "effect"])) : createCommentVNode("v-if", true),
  35413. createElementVNode("div", {
  35414. class: normalizeClass(unref(ns).e("input-wrapper"))
  35415. }, [
  35416. withDirectives(createElementVNode("input", mergeProps({
  35417. id: unref(inputId),
  35418. ref_key: "inputRef",
  35419. ref: inputRef,
  35420. "onUpdate:modelValue": ($event) => isRef(inputValue) ? inputValue.value = $event : null
  35421. }, unref(attrs), {
  35422. type: "text",
  35423. minlength: _ctx.minlength,
  35424. maxlength: _ctx.maxlength,
  35425. disabled: unref(disabled),
  35426. readonly: _ctx.readonly,
  35427. autocomplete: _ctx.autocomplete,
  35428. tabindex: _ctx.tabindex,
  35429. placeholder: unref(placeholder),
  35430. autofocus: _ctx.autofocus,
  35431. ariaLabel: _ctx.ariaLabel,
  35432. class: unref(ns).e("input"),
  35433. style: unref(inputStyle),
  35434. onCompositionstart: unref(handleCompositionStart),
  35435. onCompositionupdate: unref(handleCompositionUpdate),
  35436. onCompositionend: unref(handleCompositionEnd),
  35437. onInput: unref(handleInput),
  35438. onKeydown: unref(handleKeydown),
  35439. onKeyup: unref(handleKeyup)
  35440. }), null, 16, ["id", "onUpdate:modelValue", "minlength", "maxlength", "disabled", "readonly", "autocomplete", "tabindex", "placeholder", "autofocus", "ariaLabel", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onKeydown", "onKeyup"]), [
  35441. [vModelText, unref(inputValue)]
  35442. ]),
  35443. createElementVNode("span", {
  35444. ref_key: "calculatorRef",
  35445. ref: calculatorRef,
  35446. "aria-hidden": "true",
  35447. class: normalizeClass(unref(ns).e("input-calculator")),
  35448. textContent: toDisplayString(unref(inputValue))
  35449. }, null, 10, ["textContent"])
  35450. ], 2),
  35451. withDirectives(createElementVNode("div", {
  35452. ref_key: "dropIndicatorRef",
  35453. ref: dropIndicatorRef,
  35454. class: normalizeClass(unref(ns).e("drop-indicator"))
  35455. }, null, 2), [
  35456. [vShow, unref(showDropIndicator)]
  35457. ])
  35458. ], 2),
  35459. unref(showSuffix) ? (openBlock(), createElementBlock("div", {
  35460. key: 1,
  35461. class: normalizeClass(unref(ns).e("suffix"))
  35462. }, [
  35463. renderSlot(_ctx.$slots, "suffix"),
  35464. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  35465. key: 0,
  35466. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("clear")]),
  35467. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  35468. onClick: unref(handleClear)
  35469. }, {
  35470. default: withCtx(() => [
  35471. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  35472. ]),
  35473. _: 1
  35474. }, 8, ["class", "onMousedown", "onClick"])) : createCommentVNode("v-if", true),
  35475. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  35476. key: 1,
  35477. class: normalizeClass([
  35478. unref(nsInput).e("icon"),
  35479. unref(nsInput).e("validateIcon"),
  35480. unref(nsInput).is("loading", unref(validateState) === "validating")
  35481. ])
  35482. }, {
  35483. default: withCtx(() => [
  35484. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  35485. ]),
  35486. _: 1
  35487. }, 8, ["class"])) : createCommentVNode("v-if", true)
  35488. ], 2)) : createCommentVNode("v-if", true)
  35489. ], 46, ["onMouseenter", "onMouseleave"]);
  35490. };
  35491. }
  35492. });
  35493. var InputTag = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__file", "input-tag.vue"]]);
  35494. const ElInputTag = withInstall(InputTag);
  35495. const linkProps = buildProps({
  35496. type: {
  35497. type: String,
  35498. values: ["primary", "success", "warning", "info", "danger", "default"],
  35499. default: void 0
  35500. },
  35501. underline: {
  35502. type: [Boolean, String],
  35503. values: [true, false, "always", "never", "hover"],
  35504. default: void 0
  35505. },
  35506. disabled: Boolean,
  35507. href: { type: String, default: "" },
  35508. target: {
  35509. type: String,
  35510. default: "_self"
  35511. },
  35512. icon: {
  35513. type: iconPropType
  35514. }
  35515. });
  35516. const linkEmits = {
  35517. click: (evt) => evt instanceof MouseEvent
  35518. };
  35519. const __default__$R = defineComponent({
  35520. name: "ElLink"
  35521. });
  35522. const _sfc_main$13 = /* @__PURE__ */ defineComponent({
  35523. ...__default__$R,
  35524. props: linkProps,
  35525. emits: linkEmits,
  35526. setup(__props, { emit }) {
  35527. const props = __props;
  35528. const globalConfig = useGlobalConfig("link");
  35529. useDeprecated({
  35530. scope: "el-link",
  35531. from: "The underline option (boolean)",
  35532. replacement: "'always' | 'hover' | 'never'",
  35533. version: "3.0.0",
  35534. ref: "https://element-plus.org/en-US/component/link.html#underline"
  35535. }, computed(() => isBoolean(props.underline)));
  35536. const ns = useNamespace("link");
  35537. const linkKls = computed(() => {
  35538. var _a, _b, _c;
  35539. return [
  35540. ns.b(),
  35541. ns.m((_c = (_b = props.type) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.type) != null ? _c : "default"),
  35542. ns.is("disabled", props.disabled),
  35543. ns.is("underline", underline.value === "always"),
  35544. ns.is("hover-underline", underline.value === "hover" && !props.disabled)
  35545. ];
  35546. });
  35547. const underline = computed(() => {
  35548. var _a, _b, _c;
  35549. if (isBoolean(props.underline)) {
  35550. return props.underline ? "hover" : "never";
  35551. } else
  35552. return (_c = (_b = props.underline) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.underline) != null ? _c : "hover";
  35553. });
  35554. function handleClick(event) {
  35555. if (!props.disabled)
  35556. emit("click", event);
  35557. }
  35558. return (_ctx, _cache) => {
  35559. return openBlock(), createElementBlock("a", {
  35560. class: normalizeClass(unref(linkKls)),
  35561. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  35562. target: _ctx.disabled || !_ctx.href ? void 0 : _ctx.target,
  35563. onClick: handleClick
  35564. }, [
  35565. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  35566. default: withCtx(() => [
  35567. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  35568. ]),
  35569. _: 1
  35570. })) : createCommentVNode("v-if", true),
  35571. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  35572. key: 1,
  35573. class: normalizeClass(unref(ns).e("inner"))
  35574. }, [
  35575. renderSlot(_ctx.$slots, "default")
  35576. ], 2)) : createCommentVNode("v-if", true),
  35577. _ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 2 }) : createCommentVNode("v-if", true)
  35578. ], 10, ["href", "target"]);
  35579. };
  35580. }
  35581. });
  35582. var Link = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["__file", "link.vue"]]);
  35583. const ElLink = withInstall(Link);
  35584. class SubMenu$1 {
  35585. constructor(parent, domNode) {
  35586. this.parent = parent;
  35587. this.domNode = domNode;
  35588. this.subIndex = 0;
  35589. this.subIndex = 0;
  35590. this.init();
  35591. }
  35592. init() {
  35593. this.subMenuItems = this.domNode.querySelectorAll("li");
  35594. this.addListeners();
  35595. }
  35596. gotoSubIndex(idx) {
  35597. if (idx === this.subMenuItems.length) {
  35598. idx = 0;
  35599. } else if (idx < 0) {
  35600. idx = this.subMenuItems.length - 1;
  35601. }
  35602. this.subMenuItems[idx].focus();
  35603. this.subIndex = idx;
  35604. }
  35605. addListeners() {
  35606. const parentNode = this.parent.domNode;
  35607. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  35608. el.addEventListener("keydown", (event) => {
  35609. const code = getEventCode(event);
  35610. let prevDef = false;
  35611. switch (code) {
  35612. case EVENT_CODE.down: {
  35613. this.gotoSubIndex(this.subIndex + 1);
  35614. prevDef = true;
  35615. break;
  35616. }
  35617. case EVENT_CODE.up: {
  35618. this.gotoSubIndex(this.subIndex - 1);
  35619. prevDef = true;
  35620. break;
  35621. }
  35622. case EVENT_CODE.tab: {
  35623. triggerEvent(parentNode, "mouseleave");
  35624. break;
  35625. }
  35626. case EVENT_CODE.enter:
  35627. case EVENT_CODE.numpadEnter:
  35628. case EVENT_CODE.space: {
  35629. prevDef = true;
  35630. event.currentTarget.click();
  35631. break;
  35632. }
  35633. }
  35634. if (prevDef) {
  35635. event.preventDefault();
  35636. event.stopPropagation();
  35637. }
  35638. return false;
  35639. });
  35640. });
  35641. }
  35642. }
  35643. var SubMenu$2 = SubMenu$1;
  35644. class MenuItem$1 {
  35645. constructor(domNode, namespace) {
  35646. this.domNode = domNode;
  35647. this.submenu = null;
  35648. this.submenu = null;
  35649. this.init(namespace);
  35650. }
  35651. init(namespace) {
  35652. this.domNode.setAttribute("tabindex", "0");
  35653. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  35654. if (menuChild) {
  35655. this.submenu = new SubMenu$2(this, menuChild);
  35656. }
  35657. this.addListeners();
  35658. }
  35659. addListeners() {
  35660. this.domNode.addEventListener("keydown", (event) => {
  35661. const code = getEventCode(event);
  35662. let prevDef = false;
  35663. switch (code) {
  35664. case EVENT_CODE.down: {
  35665. triggerEvent(event.currentTarget, "mouseenter");
  35666. this.submenu && this.submenu.gotoSubIndex(0);
  35667. prevDef = true;
  35668. break;
  35669. }
  35670. case EVENT_CODE.up: {
  35671. triggerEvent(event.currentTarget, "mouseenter");
  35672. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  35673. prevDef = true;
  35674. break;
  35675. }
  35676. case EVENT_CODE.tab: {
  35677. triggerEvent(event.currentTarget, "mouseleave");
  35678. break;
  35679. }
  35680. case EVENT_CODE.enter:
  35681. case EVENT_CODE.numpadEnter:
  35682. case EVENT_CODE.space: {
  35683. prevDef = true;
  35684. event.currentTarget.click();
  35685. break;
  35686. }
  35687. }
  35688. if (prevDef) {
  35689. event.preventDefault();
  35690. }
  35691. });
  35692. }
  35693. }
  35694. var MenuItem$2 = MenuItem$1;
  35695. class Menu$1 {
  35696. constructor(domNode, namespace) {
  35697. this.domNode = domNode;
  35698. this.init(namespace);
  35699. }
  35700. init(namespace) {
  35701. const menuChildren = this.domNode.childNodes;
  35702. Array.from(menuChildren).forEach((child) => {
  35703. if (child.nodeType === 1) {
  35704. new MenuItem$2(child, namespace);
  35705. }
  35706. });
  35707. }
  35708. }
  35709. var Menubar = Menu$1;
  35710. const __default__$Q = defineComponent({
  35711. name: "ElMenuCollapseTransition"
  35712. });
  35713. const _sfc_main$12 = /* @__PURE__ */ defineComponent({
  35714. ...__default__$Q,
  35715. setup(__props) {
  35716. const ns = useNamespace("menu");
  35717. const listeners = {
  35718. onBeforeEnter: (el) => el.style.opacity = "0.2",
  35719. onEnter(el, done) {
  35720. addClass(el, `${ns.namespace.value}-opacity-transition`);
  35721. el.style.opacity = "1";
  35722. done();
  35723. },
  35724. onAfterEnter(el) {
  35725. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  35726. el.style.opacity = "";
  35727. },
  35728. onBeforeLeave(el) {
  35729. if (!el.dataset)
  35730. el.dataset = {};
  35731. if (hasClass(el, ns.m("collapse"))) {
  35732. removeClass(el, ns.m("collapse"));
  35733. el.dataset.oldOverflow = el.style.overflow;
  35734. el.dataset.scrollWidth = el.clientWidth.toString();
  35735. addClass(el, ns.m("collapse"));
  35736. } else {
  35737. addClass(el, ns.m("collapse"));
  35738. el.dataset.oldOverflow = el.style.overflow;
  35739. el.dataset.scrollWidth = el.clientWidth.toString();
  35740. removeClass(el, ns.m("collapse"));
  35741. }
  35742. el.style.width = `${el.scrollWidth}px`;
  35743. el.style.overflow = "hidden";
  35744. },
  35745. onLeave(el) {
  35746. addClass(el, "horizontal-collapse-transition");
  35747. el.style.width = `${el.dataset.scrollWidth}px`;
  35748. }
  35749. };
  35750. return (_ctx, _cache) => {
  35751. return openBlock(), createBlock(Transition, mergeProps({ mode: "out-in" }, unref(listeners)), {
  35752. default: withCtx(() => [
  35753. renderSlot(_ctx.$slots, "default")
  35754. ]),
  35755. _: 3
  35756. }, 16);
  35757. };
  35758. }
  35759. });
  35760. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__file", "menu-collapse-transition.vue"]]);
  35761. function useMenu(instance, currentIndex) {
  35762. const indexPath = computed(() => {
  35763. let parent = instance.parent;
  35764. const path = [currentIndex.value];
  35765. while (parent.type.name !== "ElMenu") {
  35766. if (parent.props.index) {
  35767. path.unshift(parent.props.index);
  35768. }
  35769. parent = parent.parent;
  35770. }
  35771. return path;
  35772. });
  35773. const parentMenu = computed(() => {
  35774. let parent = instance.parent;
  35775. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  35776. parent = parent.parent;
  35777. }
  35778. return parent;
  35779. });
  35780. return {
  35781. parentMenu,
  35782. indexPath
  35783. };
  35784. }
  35785. function useMenuColor(props) {
  35786. const menuBarColor = computed(() => {
  35787. const color = props.backgroundColor;
  35788. return color ? new TinyColor(color).shade(20).toString() : "";
  35789. });
  35790. return menuBarColor;
  35791. }
  35792. const useMenuCssVar = (props, level) => {
  35793. const ns = useNamespace("menu");
  35794. return computed(() => ns.cssVarBlock({
  35795. "text-color": props.textColor || "",
  35796. "hover-text-color": props.textColor || "",
  35797. "bg-color": props.backgroundColor || "",
  35798. "hover-bg-color": useMenuColor(props).value || "",
  35799. "active-color": props.activeTextColor || "",
  35800. level: `${level}`
  35801. }));
  35802. };
  35803. const MENU_INJECTION_KEY = "rootMenu";
  35804. const SUB_MENU_INJECTION_KEY = "subMenu:";
  35805. const subMenuProps = buildProps({
  35806. index: {
  35807. type: String,
  35808. required: true
  35809. },
  35810. showTimeout: Number,
  35811. hideTimeout: Number,
  35812. popperClass: String,
  35813. popperStyle: {
  35814. type: definePropType([String, Object])
  35815. },
  35816. disabled: Boolean,
  35817. teleported: {
  35818. type: Boolean,
  35819. default: void 0
  35820. },
  35821. popperOffset: Number,
  35822. expandCloseIcon: {
  35823. type: iconPropType
  35824. },
  35825. expandOpenIcon: {
  35826. type: iconPropType
  35827. },
  35828. collapseCloseIcon: {
  35829. type: iconPropType
  35830. },
  35831. collapseOpenIcon: {
  35832. type: iconPropType
  35833. }
  35834. });
  35835. const COMPONENT_NAME$d = "ElSubMenu";
  35836. var SubMenu = defineComponent({
  35837. name: COMPONENT_NAME$d,
  35838. props: subMenuProps,
  35839. setup(props, { slots, expose }) {
  35840. const instance = getCurrentInstance();
  35841. const { indexPath, parentMenu } = useMenu(instance, computed(() => props.index));
  35842. const nsMenu = useNamespace("menu");
  35843. const nsSubMenu = useNamespace("sub-menu");
  35844. const rootMenu = inject(MENU_INJECTION_KEY);
  35845. if (!rootMenu)
  35846. throwError(COMPONENT_NAME$d, "can not inject root menu");
  35847. const subMenu = inject(`${SUB_MENU_INJECTION_KEY}${parentMenu.value.uid}`);
  35848. if (!subMenu)
  35849. throwError(COMPONENT_NAME$d, "can not inject sub menu");
  35850. const items = ref({});
  35851. const subMenus = ref({});
  35852. let timeout;
  35853. const mouseInChild = ref(false);
  35854. const verticalTitleRef = ref();
  35855. const vPopper = ref();
  35856. const isFirstLevel = computed(() => subMenu.level === 0);
  35857. const currentPlacement = computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  35858. const subMenuTitleIcon = computed(() => {
  35859. const isExpandedMode = mode.value === "horizontal" && isFirstLevel.value || mode.value === "vertical" && !rootMenu.props.collapse;
  35860. if (isExpandedMode) {
  35861. if (props.expandCloseIcon && props.expandOpenIcon) {
  35862. return opened.value ? props.expandOpenIcon : props.expandCloseIcon;
  35863. }
  35864. return arrow_down_default;
  35865. } else {
  35866. if (props.collapseCloseIcon && props.collapseOpenIcon) {
  35867. return opened.value ? props.collapseOpenIcon : props.collapseCloseIcon;
  35868. }
  35869. return arrow_right_default;
  35870. }
  35871. });
  35872. const appendToBody = computed(() => {
  35873. const value = props.teleported;
  35874. return isUndefined(value) ? isFirstLevel.value : value;
  35875. });
  35876. const menuTransitionName = computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  35877. const fallbackPlacements = computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  35878. "bottom-start",
  35879. "bottom-end",
  35880. "top-start",
  35881. "top-end",
  35882. "right-start",
  35883. "left-start"
  35884. ] : [
  35885. "right-start",
  35886. "right",
  35887. "right-end",
  35888. "left-start",
  35889. "bottom-start",
  35890. "bottom-end",
  35891. "top-start",
  35892. "top-end"
  35893. ]);
  35894. const opened = computed(() => rootMenu.openedMenus.includes(props.index));
  35895. const active = computed(() => [...Object.values(items.value), ...Object.values(subMenus.value)].some(({ active: active2 }) => active2));
  35896. const mode = computed(() => rootMenu.props.mode);
  35897. const persistent = computed(() => rootMenu.props.persistent);
  35898. const item = reactive({
  35899. index: props.index,
  35900. indexPath,
  35901. active
  35902. });
  35903. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  35904. const subMenuPopperOffset = computed(() => {
  35905. var _a;
  35906. return (_a = props.popperOffset) != null ? _a : rootMenu.props.popperOffset;
  35907. });
  35908. const subMenuPopperClass = computed(() => {
  35909. var _a;
  35910. return (_a = props.popperClass) != null ? _a : rootMenu.props.popperClass;
  35911. });
  35912. const subMenuPopperStyle = computed(() => {
  35913. var _a;
  35914. return (_a = props.popperStyle) != null ? _a : rootMenu.props.popperStyle;
  35915. });
  35916. const subMenuShowTimeout = computed(() => {
  35917. var _a;
  35918. return (_a = props.showTimeout) != null ? _a : rootMenu.props.showTimeout;
  35919. });
  35920. const subMenuHideTimeout = computed(() => {
  35921. var _a;
  35922. return (_a = props.hideTimeout) != null ? _a : rootMenu.props.hideTimeout;
  35923. });
  35924. const doDestroy = () => {
  35925. var _a, _b, _c;
  35926. return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  35927. };
  35928. const handleCollapseToggle = (value) => {
  35929. if (!value) {
  35930. doDestroy();
  35931. }
  35932. };
  35933. const handleClick = () => {
  35934. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  35935. return;
  35936. rootMenu.handleSubMenuClick({
  35937. index: props.index,
  35938. indexPath: indexPath.value,
  35939. active: active.value
  35940. });
  35941. };
  35942. const handleMouseenter = (event, showTimeout = subMenuShowTimeout.value) => {
  35943. var _a;
  35944. if (event.type === "focus")
  35945. return;
  35946. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  35947. subMenu.mouseInChild.value = true;
  35948. return;
  35949. }
  35950. subMenu.mouseInChild.value = true;
  35951. timeout == null ? void 0 : timeout();
  35952. ({ stop: timeout } = useTimeoutFn(() => {
  35953. rootMenu.openMenu(props.index, indexPath.value);
  35954. }, showTimeout));
  35955. if (appendToBody.value) {
  35956. (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
  35957. }
  35958. if (event.type === "mouseenter" && event.target) {
  35959. nextTick(() => {
  35960. focusElement(event.target, { preventScroll: true });
  35961. });
  35962. }
  35963. };
  35964. const handleMouseleave = (deepDispatch = false) => {
  35965. var _a;
  35966. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  35967. subMenu.mouseInChild.value = false;
  35968. return;
  35969. }
  35970. timeout == null ? void 0 : timeout();
  35971. subMenu.mouseInChild.value = false;
  35972. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), subMenuHideTimeout.value));
  35973. if (appendToBody.value && deepDispatch) {
  35974. (_a = subMenu.handleMouseleave) == null ? void 0 : _a.call(subMenu, true);
  35975. }
  35976. };
  35977. watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  35978. {
  35979. const addSubMenu = (item2) => {
  35980. subMenus.value[item2.index] = item2;
  35981. };
  35982. const removeSubMenu = (item2) => {
  35983. delete subMenus.value[item2.index];
  35984. };
  35985. provide(`${SUB_MENU_INJECTION_KEY}${instance.uid}`, {
  35986. addSubMenu,
  35987. removeSubMenu,
  35988. handleMouseleave,
  35989. mouseInChild,
  35990. level: subMenu.level + 1
  35991. });
  35992. }
  35993. expose({
  35994. opened
  35995. });
  35996. onMounted(() => {
  35997. rootMenu.addSubMenu(item);
  35998. subMenu.addSubMenu(item);
  35999. });
  36000. onBeforeUnmount(() => {
  36001. subMenu.removeSubMenu(item);
  36002. rootMenu.removeSubMenu(item);
  36003. });
  36004. return () => {
  36005. var _a;
  36006. const titleTag = [
  36007. (_a = slots.title) == null ? void 0 : _a.call(slots),
  36008. h$1(ElIcon, {
  36009. class: nsSubMenu.e("icon-arrow"),
  36010. style: {
  36011. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  36012. }
  36013. }, {
  36014. default: () => isString$1(subMenuTitleIcon.value) ? h$1(instance.appContext.components[subMenuTitleIcon.value]) : h$1(subMenuTitleIcon.value)
  36015. })
  36016. ];
  36017. const child = rootMenu.isMenuPopup ? h$1(ElTooltip, {
  36018. ref: vPopper,
  36019. visible: opened.value,
  36020. effect: "light",
  36021. pure: true,
  36022. offset: subMenuPopperOffset.value,
  36023. showArrow: false,
  36024. persistent: persistent.value,
  36025. popperClass: subMenuPopperClass.value,
  36026. popperStyle: subMenuPopperStyle.value,
  36027. placement: currentPlacement.value,
  36028. teleported: appendToBody.value,
  36029. fallbackPlacements: fallbackPlacements.value,
  36030. transition: menuTransitionName.value,
  36031. gpuAcceleration: false
  36032. }, {
  36033. content: () => {
  36034. var _a2;
  36035. return h$1("div", {
  36036. class: [
  36037. nsMenu.m(mode.value),
  36038. nsMenu.m("popup-container"),
  36039. subMenuPopperClass.value
  36040. ],
  36041. onMouseenter: (evt) => handleMouseenter(evt, 100),
  36042. onMouseleave: () => handleMouseleave(true),
  36043. onFocus: (evt) => handleMouseenter(evt, 100)
  36044. }, [
  36045. h$1("ul", {
  36046. class: [
  36047. nsMenu.b(),
  36048. nsMenu.m("popup"),
  36049. nsMenu.m(`popup-${currentPlacement.value}`)
  36050. ],
  36051. style: ulStyle.value
  36052. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
  36053. ]);
  36054. },
  36055. default: () => h$1("div", {
  36056. class: nsSubMenu.e("title"),
  36057. onClick: handleClick
  36058. }, titleTag)
  36059. }) : h$1(Fragment, {}, [
  36060. h$1("div", {
  36061. class: nsSubMenu.e("title"),
  36062. ref: verticalTitleRef,
  36063. onClick: handleClick
  36064. }, titleTag),
  36065. h$1(ElCollapseTransition, {}, {
  36066. default: () => {
  36067. var _a2;
  36068. return withDirectives(h$1("ul", {
  36069. role: "menu",
  36070. class: [nsMenu.b(), nsMenu.m("inline")],
  36071. style: ulStyle.value
  36072. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vShow, opened.value]]);
  36073. }
  36074. })
  36075. ]);
  36076. return h$1("li", {
  36077. class: [
  36078. nsSubMenu.b(),
  36079. nsSubMenu.is("active", active.value),
  36080. nsSubMenu.is("opened", opened.value),
  36081. nsSubMenu.is("disabled", props.disabled)
  36082. ],
  36083. role: "menuitem",
  36084. ariaHaspopup: true,
  36085. ariaExpanded: opened.value,
  36086. onMouseenter: handleMouseenter,
  36087. onMouseleave: () => handleMouseleave(),
  36088. onFocus: handleMouseenter
  36089. }, [child]);
  36090. };
  36091. }
  36092. });
  36093. const menuProps = buildProps({
  36094. mode: {
  36095. type: String,
  36096. values: ["horizontal", "vertical"],
  36097. default: "vertical"
  36098. },
  36099. defaultActive: {
  36100. type: String,
  36101. default: ""
  36102. },
  36103. defaultOpeneds: {
  36104. type: definePropType(Array),
  36105. default: () => mutable([])
  36106. },
  36107. uniqueOpened: Boolean,
  36108. router: Boolean,
  36109. menuTrigger: {
  36110. type: String,
  36111. values: ["hover", "click"],
  36112. default: "hover"
  36113. },
  36114. collapse: Boolean,
  36115. backgroundColor: String,
  36116. textColor: String,
  36117. activeTextColor: String,
  36118. closeOnClickOutside: Boolean,
  36119. collapseTransition: {
  36120. type: Boolean,
  36121. default: true
  36122. },
  36123. ellipsis: {
  36124. type: Boolean,
  36125. default: true
  36126. },
  36127. popperOffset: {
  36128. type: Number,
  36129. default: 6
  36130. },
  36131. ellipsisIcon: {
  36132. type: iconPropType,
  36133. default: () => more_default
  36134. },
  36135. popperEffect: {
  36136. type: definePropType(String),
  36137. default: "dark"
  36138. },
  36139. popperClass: String,
  36140. popperStyle: {
  36141. type: definePropType([String, Object])
  36142. },
  36143. showTimeout: {
  36144. type: Number,
  36145. default: 300
  36146. },
  36147. hideTimeout: {
  36148. type: Number,
  36149. default: 300
  36150. },
  36151. persistent: {
  36152. type: Boolean,
  36153. default: true
  36154. }
  36155. });
  36156. const checkIndexPath = (indexPath) => isArray$1(indexPath) && indexPath.every((path) => isString$1(path));
  36157. const menuEmits = {
  36158. close: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  36159. open: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  36160. select: (index, indexPath, item, routerResult) => isString$1(index) && checkIndexPath(indexPath) && isObject$1(item) && (isUndefined(routerResult) || routerResult instanceof Promise)
  36161. };
  36162. var Menu = defineComponent({
  36163. name: "ElMenu",
  36164. props: menuProps,
  36165. emits: menuEmits,
  36166. setup(props, { emit, slots, expose }) {
  36167. const instance = getCurrentInstance();
  36168. const router = instance.appContext.config.globalProperties.$router;
  36169. const menu = ref();
  36170. const subMenu = ref();
  36171. const nsMenu = useNamespace("menu");
  36172. const nsSubMenu = useNamespace("sub-menu");
  36173. let moreItemWidth = 64;
  36174. const sliceIndex = ref(-1);
  36175. const openedMenus = ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  36176. const activeIndex = ref(props.defaultActive);
  36177. const items = ref({});
  36178. const subMenus = ref({});
  36179. const isMenuPopup = computed(() => props.mode === "horizontal" || props.mode === "vertical" && props.collapse);
  36180. const initMenu = () => {
  36181. const activeItem = activeIndex.value && items.value[activeIndex.value];
  36182. if (!activeItem || props.mode === "horizontal" || props.collapse)
  36183. return;
  36184. const indexPath = activeItem.indexPath;
  36185. indexPath.forEach((index) => {
  36186. const subMenu2 = subMenus.value[index];
  36187. subMenu2 && openMenu(index, subMenu2.indexPath);
  36188. });
  36189. };
  36190. const openMenu = (index, indexPath) => {
  36191. if (openedMenus.value.includes(index))
  36192. return;
  36193. if (props.uniqueOpened) {
  36194. openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2));
  36195. }
  36196. openedMenus.value.push(index);
  36197. emit("open", index, indexPath);
  36198. };
  36199. const close = (index) => {
  36200. const i = openedMenus.value.indexOf(index);
  36201. if (i !== -1) {
  36202. openedMenus.value.splice(i, 1);
  36203. }
  36204. };
  36205. const closeMenu = (index, indexPath) => {
  36206. close(index);
  36207. emit("close", index, indexPath);
  36208. };
  36209. const handleSubMenuClick = ({
  36210. index,
  36211. indexPath
  36212. }) => {
  36213. const isOpened = openedMenus.value.includes(index);
  36214. isOpened ? closeMenu(index, indexPath) : openMenu(index, indexPath);
  36215. };
  36216. const handleMenuItemClick = (menuItem) => {
  36217. if (props.mode === "horizontal" || props.collapse) {
  36218. openedMenus.value = [];
  36219. }
  36220. const { index, indexPath } = menuItem;
  36221. if (isNil(index) || isNil(indexPath))
  36222. return;
  36223. if (props.router && router) {
  36224. const route = menuItem.route || index;
  36225. const routerResult = router.push(route).then((res) => {
  36226. if (!res)
  36227. activeIndex.value = index;
  36228. return res;
  36229. });
  36230. emit("select", index, indexPath, { index, indexPath, route }, routerResult);
  36231. } else {
  36232. activeIndex.value = index;
  36233. emit("select", index, indexPath, { index, indexPath });
  36234. }
  36235. };
  36236. const updateActiveIndex = (val) => {
  36237. var _a;
  36238. const itemsInData = items.value;
  36239. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  36240. activeIndex.value = (_a = item == null ? void 0 : item.index) != null ? _a : val;
  36241. };
  36242. const calcMenuItemWidth = (menuItem) => {
  36243. const computedStyle = getComputedStyle(menuItem);
  36244. const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
  36245. const marginRight = Number.parseInt(computedStyle.marginRight, 10);
  36246. return menuItem.offsetWidth + marginLeft + marginRight || 0;
  36247. };
  36248. const calcSliceIndex = () => {
  36249. var _a, _b;
  36250. if (!menu.value)
  36251. return -1;
  36252. const items2 = Array.from((_b = (_a = menu.value) == null ? void 0 : _a.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#comment" && (item.nodeName !== "#text" || item.nodeValue));
  36253. const computedMenuStyle = getComputedStyle(menu.value);
  36254. const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
  36255. const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
  36256. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  36257. let calcWidth = 0;
  36258. let sliceIndex2 = 0;
  36259. items2.forEach((item, index) => {
  36260. calcWidth += calcMenuItemWidth(item);
  36261. if (calcWidth <= menuWidth - moreItemWidth) {
  36262. sliceIndex2 = index + 1;
  36263. }
  36264. });
  36265. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  36266. };
  36267. const getIndexPath = (index) => subMenus.value[index].indexPath;
  36268. const debounce = (fn, wait = 33.34) => {
  36269. let timer;
  36270. return () => {
  36271. timer && clearTimeout(timer);
  36272. timer = setTimeout(() => {
  36273. fn();
  36274. }, wait);
  36275. };
  36276. };
  36277. let isFirstTimeRender = true;
  36278. const handleResize = () => {
  36279. const el = unrefElement(subMenu);
  36280. if (el)
  36281. moreItemWidth = calcMenuItemWidth(el) || 64;
  36282. if (sliceIndex.value === calcSliceIndex())
  36283. return;
  36284. const callback = () => {
  36285. sliceIndex.value = -1;
  36286. nextTick(() => {
  36287. sliceIndex.value = calcSliceIndex();
  36288. });
  36289. };
  36290. isFirstTimeRender ? callback() : debounce(callback)();
  36291. isFirstTimeRender = false;
  36292. };
  36293. watch(() => props.defaultActive, (currentActive) => {
  36294. if (!items.value[currentActive]) {
  36295. activeIndex.value = "";
  36296. }
  36297. updateActiveIndex(currentActive);
  36298. });
  36299. watch(() => props.collapse, (value) => {
  36300. if (value)
  36301. openedMenus.value = [];
  36302. });
  36303. watch(items.value, initMenu);
  36304. let resizeStopper;
  36305. watchEffect(() => {
  36306. if (props.mode === "horizontal" && props.ellipsis)
  36307. resizeStopper = useResizeObserver(menu, handleResize).stop;
  36308. else
  36309. resizeStopper == null ? void 0 : resizeStopper();
  36310. });
  36311. const mouseInChild = ref(false);
  36312. {
  36313. const addSubMenu = (item) => {
  36314. subMenus.value[item.index] = item;
  36315. };
  36316. const removeSubMenu = (item) => {
  36317. delete subMenus.value[item.index];
  36318. };
  36319. const addMenuItem = (item) => {
  36320. items.value[item.index] = item;
  36321. };
  36322. const removeMenuItem = (item) => {
  36323. delete items.value[item.index];
  36324. };
  36325. provide(MENU_INJECTION_KEY, reactive({
  36326. props,
  36327. openedMenus,
  36328. items,
  36329. subMenus,
  36330. activeIndex,
  36331. isMenuPopup,
  36332. addMenuItem,
  36333. removeMenuItem,
  36334. addSubMenu,
  36335. removeSubMenu,
  36336. openMenu,
  36337. closeMenu,
  36338. handleMenuItemClick,
  36339. handleSubMenuClick
  36340. }));
  36341. provide(`${SUB_MENU_INJECTION_KEY}${instance.uid}`, {
  36342. addSubMenu,
  36343. removeSubMenu,
  36344. mouseInChild,
  36345. level: 0
  36346. });
  36347. }
  36348. onMounted(() => {
  36349. if (props.mode === "horizontal") {
  36350. new Menubar(instance.vnode.el, nsMenu.namespace.value);
  36351. }
  36352. });
  36353. {
  36354. const open = (index) => {
  36355. const { indexPath } = subMenus.value[index];
  36356. indexPath.forEach((i) => openMenu(i, indexPath));
  36357. };
  36358. expose({
  36359. open,
  36360. close,
  36361. updateActiveIndex,
  36362. handleResize
  36363. });
  36364. }
  36365. const ulStyle = useMenuCssVar(props, 0);
  36366. return () => {
  36367. var _a, _b;
  36368. let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
  36369. const vShowMore = [];
  36370. if (props.mode === "horizontal" && menu.value) {
  36371. const originalSlot = flattedChildren(slot).filter((vnode) => {
  36372. return (vnode == null ? void 0 : vnode.shapeFlag) !== 8;
  36373. });
  36374. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  36375. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  36376. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  36377. slot = slotDefault;
  36378. vShowMore.push(h$1(SubMenu, {
  36379. ref: subMenu,
  36380. index: "sub-menu-more",
  36381. class: nsSubMenu.e("hide-arrow"),
  36382. popperOffset: props.popperOffset
  36383. }, {
  36384. title: () => h$1(ElIcon, {
  36385. class: nsSubMenu.e("icon-more")
  36386. }, {
  36387. default: () => h$1(props.ellipsisIcon)
  36388. }),
  36389. default: () => slotMore
  36390. }));
  36391. }
  36392. }
  36393. const directives = props.closeOnClickOutside ? [
  36394. [
  36395. ClickOutside,
  36396. () => {
  36397. if (!openedMenus.value.length)
  36398. return;
  36399. if (!mouseInChild.value) {
  36400. openedMenus.value.forEach((openedMenu) => emit("close", openedMenu, getIndexPath(openedMenu)));
  36401. openedMenus.value = [];
  36402. }
  36403. }
  36404. ]
  36405. ] : [];
  36406. const vMenu = withDirectives(h$1("ul", {
  36407. key: String(props.collapse),
  36408. role: "menubar",
  36409. ref: menu,
  36410. style: ulStyle.value,
  36411. class: {
  36412. [nsMenu.b()]: true,
  36413. [nsMenu.m(props.mode)]: true,
  36414. [nsMenu.m("collapse")]: props.collapse
  36415. }
  36416. }, [...slot, ...vShowMore]), directives);
  36417. if (props.collapseTransition && props.mode === "vertical") {
  36418. return h$1(ElMenuCollapseTransition, () => vMenu);
  36419. }
  36420. return vMenu;
  36421. };
  36422. }
  36423. });
  36424. const menuItemProps = buildProps({
  36425. index: {
  36426. type: definePropType([String, null]),
  36427. default: null
  36428. },
  36429. route: {
  36430. type: definePropType([String, Object])
  36431. },
  36432. disabled: Boolean
  36433. });
  36434. const menuItemEmits = {
  36435. click: (item) => isString$1(item.index) && isArray$1(item.indexPath)
  36436. };
  36437. const COMPONENT_NAME$c = "ElMenuItem";
  36438. const __default__$P = defineComponent({
  36439. name: COMPONENT_NAME$c
  36440. });
  36441. const _sfc_main$11 = /* @__PURE__ */ defineComponent({
  36442. ...__default__$P,
  36443. props: menuItemProps,
  36444. emits: menuItemEmits,
  36445. setup(__props, { expose, emit }) {
  36446. const props = __props;
  36447. isPropAbsent(props.index) && debugWarn(COMPONENT_NAME$c, 'Missing required prop: "index"');
  36448. const instance = getCurrentInstance();
  36449. const rootMenu = inject(MENU_INJECTION_KEY);
  36450. const nsMenu = useNamespace("menu");
  36451. const nsMenuItem = useNamespace("menu-item");
  36452. if (!rootMenu)
  36453. throwError(COMPONENT_NAME$c, "can not inject root menu");
  36454. const { parentMenu, indexPath } = useMenu(instance, toRef(props, "index"));
  36455. const subMenu = inject(`${SUB_MENU_INJECTION_KEY}${parentMenu.value.uid}`);
  36456. if (!subMenu)
  36457. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  36458. const active = computed(() => props.index === rootMenu.activeIndex);
  36459. const item = reactive({
  36460. index: props.index,
  36461. indexPath,
  36462. active
  36463. });
  36464. const handleClick = () => {
  36465. if (!props.disabled) {
  36466. rootMenu.handleMenuItemClick({
  36467. index: props.index,
  36468. indexPath: indexPath.value,
  36469. route: props.route
  36470. });
  36471. emit("click", item);
  36472. }
  36473. };
  36474. onMounted(() => {
  36475. subMenu.addSubMenu(item);
  36476. rootMenu.addMenuItem(item);
  36477. });
  36478. onBeforeUnmount(() => {
  36479. subMenu.removeSubMenu(item);
  36480. rootMenu.removeMenuItem(item);
  36481. });
  36482. expose({
  36483. parentMenu,
  36484. rootMenu,
  36485. active,
  36486. nsMenu,
  36487. nsMenuItem,
  36488. handleClick
  36489. });
  36490. return (_ctx, _cache) => {
  36491. return openBlock(), createElementBlock("li", {
  36492. class: normalizeClass([
  36493. unref(nsMenuItem).b(),
  36494. unref(nsMenuItem).is("active", unref(active)),
  36495. unref(nsMenuItem).is("disabled", _ctx.disabled)
  36496. ]),
  36497. role: "menuitem",
  36498. tabindex: "-1",
  36499. onClick: handleClick
  36500. }, [
  36501. unref(parentMenu).type.name === "ElMenu" && unref(rootMenu).props.collapse && _ctx.$slots.title ? (openBlock(), createBlock(unref(ElTooltip), {
  36502. key: 0,
  36503. effect: unref(rootMenu).props.popperEffect,
  36504. placement: "right",
  36505. "fallback-placements": ["left"],
  36506. persistent: unref(rootMenu).props.persistent,
  36507. "focus-on-target": ""
  36508. }, {
  36509. content: withCtx(() => [
  36510. renderSlot(_ctx.$slots, "title")
  36511. ]),
  36512. default: withCtx(() => [
  36513. createElementVNode("div", {
  36514. class: normalizeClass(unref(nsMenu).be("tooltip", "trigger"))
  36515. }, [
  36516. renderSlot(_ctx.$slots, "default")
  36517. ], 2)
  36518. ]),
  36519. _: 3
  36520. }, 8, ["effect", "persistent"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  36521. renderSlot(_ctx.$slots, "default"),
  36522. renderSlot(_ctx.$slots, "title")
  36523. ], 64))
  36524. ], 2);
  36525. };
  36526. }
  36527. });
  36528. var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__file", "menu-item.vue"]]);
  36529. const menuItemGroupProps = {
  36530. title: String
  36531. };
  36532. const __default__$O = defineComponent({
  36533. name: "ElMenuItemGroup"
  36534. });
  36535. const _sfc_main$10 = /* @__PURE__ */ defineComponent({
  36536. ...__default__$O,
  36537. props: menuItemGroupProps,
  36538. setup(__props) {
  36539. const ns = useNamespace("menu-item-group");
  36540. return (_ctx, _cache) => {
  36541. return openBlock(), createElementBlock("li", {
  36542. class: normalizeClass(unref(ns).b())
  36543. }, [
  36544. createElementVNode("div", {
  36545. class: normalizeClass(unref(ns).e("title"))
  36546. }, [
  36547. !_ctx.$slots.title ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  36548. createTextVNode(toDisplayString(_ctx.title), 1)
  36549. ], 64)) : renderSlot(_ctx.$slots, "title", { key: 1 })
  36550. ], 2),
  36551. createElementVNode("ul", null, [
  36552. renderSlot(_ctx.$slots, "default")
  36553. ])
  36554. ], 2);
  36555. };
  36556. }
  36557. });
  36558. var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__file", "menu-item-group.vue"]]);
  36559. const ElMenu = withInstall(Menu, {
  36560. MenuItem,
  36561. MenuItemGroup,
  36562. SubMenu
  36563. });
  36564. const ElMenuItem = withNoopInstall(MenuItem);
  36565. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  36566. const ElSubMenu = withNoopInstall(SubMenu);
  36567. const pageHeaderProps = buildProps({
  36568. icon: {
  36569. type: iconPropType,
  36570. default: () => back_default
  36571. },
  36572. title: String,
  36573. content: {
  36574. type: String,
  36575. default: ""
  36576. }
  36577. });
  36578. const pageHeaderEmits = {
  36579. back: () => true
  36580. };
  36581. const __default__$N = defineComponent({
  36582. name: "ElPageHeader"
  36583. });
  36584. const _sfc_main$$ = /* @__PURE__ */ defineComponent({
  36585. ...__default__$N,
  36586. props: pageHeaderProps,
  36587. emits: pageHeaderEmits,
  36588. setup(__props, { emit }) {
  36589. const { t } = useLocale();
  36590. const ns = useNamespace("page-header");
  36591. function handleClick() {
  36592. emit("back");
  36593. }
  36594. return (_ctx, _cache) => {
  36595. return openBlock(), createElementBlock("div", {
  36596. class: normalizeClass([
  36597. unref(ns).b(),
  36598. unref(ns).is("contentful", !!_ctx.$slots.default),
  36599. {
  36600. [unref(ns).m("has-breadcrumb")]: !!_ctx.$slots.breadcrumb,
  36601. [unref(ns).m("has-extra")]: !!_ctx.$slots.extra
  36602. }
  36603. ])
  36604. }, [
  36605. _ctx.$slots.breadcrumb ? (openBlock(), createElementBlock("div", {
  36606. key: 0,
  36607. class: normalizeClass(unref(ns).e("breadcrumb"))
  36608. }, [
  36609. renderSlot(_ctx.$slots, "breadcrumb")
  36610. ], 2)) : createCommentVNode("v-if", true),
  36611. createElementVNode("div", {
  36612. class: normalizeClass(unref(ns).e("header"))
  36613. }, [
  36614. createElementVNode("div", {
  36615. class: normalizeClass(unref(ns).e("left"))
  36616. }, [
  36617. createElementVNode("div", {
  36618. class: normalizeClass(unref(ns).e("back")),
  36619. role: "button",
  36620. tabindex: "0",
  36621. onClick: handleClick
  36622. }, [
  36623. _ctx.icon || _ctx.$slots.icon ? (openBlock(), createElementBlock("div", {
  36624. key: 0,
  36625. "aria-label": _ctx.title || unref(t)("el.pageHeader.title"),
  36626. class: normalizeClass(unref(ns).e("icon"))
  36627. }, [
  36628. renderSlot(_ctx.$slots, "icon", {}, () => [
  36629. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  36630. default: withCtx(() => [
  36631. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  36632. ]),
  36633. _: 1
  36634. })) : createCommentVNode("v-if", true)
  36635. ])
  36636. ], 10, ["aria-label"])) : createCommentVNode("v-if", true),
  36637. createElementVNode("div", {
  36638. class: normalizeClass(unref(ns).e("title"))
  36639. }, [
  36640. renderSlot(_ctx.$slots, "title", {}, () => [
  36641. createTextVNode(toDisplayString(_ctx.title || unref(t)("el.pageHeader.title")), 1)
  36642. ])
  36643. ], 2)
  36644. ], 2),
  36645. createVNode(unref(ElDivider), { direction: "vertical" }),
  36646. createElementVNode("div", {
  36647. class: normalizeClass(unref(ns).e("content"))
  36648. }, [
  36649. renderSlot(_ctx.$slots, "content", {}, () => [
  36650. createTextVNode(toDisplayString(_ctx.content), 1)
  36651. ])
  36652. ], 2)
  36653. ], 2),
  36654. _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  36655. key: 0,
  36656. class: normalizeClass(unref(ns).e("extra"))
  36657. }, [
  36658. renderSlot(_ctx.$slots, "extra")
  36659. ], 2)) : createCommentVNode("v-if", true)
  36660. ], 2),
  36661. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  36662. key: 1,
  36663. class: normalizeClass(unref(ns).e("main"))
  36664. }, [
  36665. renderSlot(_ctx.$slots, "default")
  36666. ], 2)) : createCommentVNode("v-if", true)
  36667. ], 2);
  36668. };
  36669. }
  36670. });
  36671. var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["__file", "page-header.vue"]]);
  36672. const ElPageHeader = withInstall(PageHeader);
  36673. const elPaginationKey = Symbol("elPaginationKey");
  36674. const paginationPrevProps = buildProps({
  36675. disabled: Boolean,
  36676. currentPage: {
  36677. type: Number,
  36678. default: 1
  36679. },
  36680. prevText: {
  36681. type: String
  36682. },
  36683. prevIcon: {
  36684. type: iconPropType
  36685. }
  36686. });
  36687. const paginationPrevEmits = {
  36688. click: (evt) => evt instanceof MouseEvent
  36689. };
  36690. const __default__$M = defineComponent({
  36691. name: "ElPaginationPrev"
  36692. });
  36693. const _sfc_main$_ = /* @__PURE__ */ defineComponent({
  36694. ...__default__$M,
  36695. props: paginationPrevProps,
  36696. emits: paginationPrevEmits,
  36697. setup(__props) {
  36698. const props = __props;
  36699. const { t } = useLocale();
  36700. const internalDisabled = computed(() => props.disabled || props.currentPage <= 1);
  36701. return (_ctx, _cache) => {
  36702. return openBlock(), createElementBlock("button", {
  36703. type: "button",
  36704. class: "btn-prev",
  36705. disabled: unref(internalDisabled),
  36706. "aria-label": _ctx.prevText || unref(t)("el.pagination.prev"),
  36707. "aria-disabled": unref(internalDisabled),
  36708. onClick: ($event) => _ctx.$emit("click", $event)
  36709. }, [
  36710. _ctx.prevText ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.prevText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  36711. default: withCtx(() => [
  36712. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prevIcon)))
  36713. ]),
  36714. _: 1
  36715. }))
  36716. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  36717. };
  36718. }
  36719. });
  36720. var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__file", "prev.vue"]]);
  36721. const paginationNextProps = buildProps({
  36722. disabled: Boolean,
  36723. currentPage: {
  36724. type: Number,
  36725. default: 1
  36726. },
  36727. pageCount: {
  36728. type: Number,
  36729. default: 50
  36730. },
  36731. nextText: {
  36732. type: String
  36733. },
  36734. nextIcon: {
  36735. type: iconPropType
  36736. }
  36737. });
  36738. const __default__$L = defineComponent({
  36739. name: "ElPaginationNext"
  36740. });
  36741. const _sfc_main$Z = /* @__PURE__ */ defineComponent({
  36742. ...__default__$L,
  36743. props: paginationNextProps,
  36744. emits: ["click"],
  36745. setup(__props) {
  36746. const props = __props;
  36747. const { t } = useLocale();
  36748. const internalDisabled = computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  36749. return (_ctx, _cache) => {
  36750. return openBlock(), createElementBlock("button", {
  36751. type: "button",
  36752. class: "btn-next",
  36753. disabled: unref(internalDisabled),
  36754. "aria-label": _ctx.nextText || unref(t)("el.pagination.next"),
  36755. "aria-disabled": unref(internalDisabled),
  36756. onClick: ($event) => _ctx.$emit("click", $event)
  36757. }, [
  36758. _ctx.nextText ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.nextText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  36759. default: withCtx(() => [
  36760. (openBlock(), createBlock(resolveDynamicComponent(_ctx.nextIcon)))
  36761. ]),
  36762. _: 1
  36763. }))
  36764. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  36765. };
  36766. }
  36767. });
  36768. var Next = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__file", "next.vue"]]);
  36769. const defaultProps$5 = {
  36770. label: "label",
  36771. value: "value",
  36772. disabled: "disabled",
  36773. options: "options"
  36774. };
  36775. function useProps(props) {
  36776. const aliasProps = computed(() => ({ ...defaultProps$5, ...props.props }));
  36777. const getLabel = (option) => get(option, aliasProps.value.label);
  36778. const getValue = (option) => get(option, aliasProps.value.value);
  36779. const getDisabled = (option) => get(option, aliasProps.value.disabled);
  36780. const getOptions = (option) => get(option, aliasProps.value.options);
  36781. return {
  36782. aliasProps,
  36783. getLabel,
  36784. getValue,
  36785. getDisabled,
  36786. getOptions
  36787. };
  36788. }
  36789. const selectGroupKey = Symbol("ElSelectGroup");
  36790. const selectKey = Symbol("ElSelect");
  36791. const COMPONENT_NAME$b = "ElOption";
  36792. const optionProps = buildProps({
  36793. value: {
  36794. type: [String, Number, Boolean, Object],
  36795. required: true
  36796. },
  36797. label: {
  36798. type: [String, Number]
  36799. },
  36800. created: Boolean,
  36801. disabled: Boolean
  36802. });
  36803. function useOption$1(props, states) {
  36804. const select = inject(selectKey);
  36805. if (!select) {
  36806. throwError(COMPONENT_NAME$b, "usage: <el-select><el-option /></el-select/>");
  36807. }
  36808. const selectGroup = inject(selectGroupKey, { disabled: false });
  36809. const itemSelected = computed(() => {
  36810. return contains(castArray$1(select.props.modelValue), props.value);
  36811. });
  36812. const limitReached = computed(() => {
  36813. var _a;
  36814. if (select.props.multiple) {
  36815. const modelValue = castArray$1((_a = select.props.modelValue) != null ? _a : []);
  36816. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  36817. } else {
  36818. return false;
  36819. }
  36820. });
  36821. const currentLabel = computed(() => {
  36822. var _a;
  36823. return (_a = props.label) != null ? _a : isObject$1(props.value) ? "" : props.value;
  36824. });
  36825. const currentValue = computed(() => {
  36826. return props.value || props.label || "";
  36827. });
  36828. const isDisabled = computed(() => {
  36829. return props.disabled || states.groupDisabled || limitReached.value;
  36830. });
  36831. const instance = getCurrentInstance();
  36832. const contains = (arr = [], target) => {
  36833. if (!isObject$1(props.value)) {
  36834. return arr && arr.includes(target);
  36835. } else {
  36836. const valueKey = select.props.valueKey;
  36837. return arr && arr.some((item) => {
  36838. return toRaw(get(item, valueKey)) === get(target, valueKey);
  36839. });
  36840. }
  36841. };
  36842. const hoverItem = () => {
  36843. if (!props.disabled && !selectGroup.disabled) {
  36844. select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
  36845. }
  36846. };
  36847. const updateOption = (query) => {
  36848. const regexp = new RegExp(escapeStringRegexp(query), "i");
  36849. states.visible = regexp.test(String(currentLabel.value)) || props.created;
  36850. };
  36851. watch(() => currentLabel.value, () => {
  36852. if (!props.created && !select.props.remote)
  36853. select.setSelected();
  36854. });
  36855. watch(() => props.value, (val, oldVal) => {
  36856. const { remote, valueKey } = select.props;
  36857. const shouldUpdate = remote ? val !== oldVal : !isEqual$1(val, oldVal);
  36858. if (shouldUpdate) {
  36859. select.onOptionDestroy(oldVal, instance.proxy);
  36860. select.onOptionCreate(instance.proxy);
  36861. }
  36862. if (!props.created && !remote) {
  36863. if (valueKey && isObject$1(val) && isObject$1(oldVal) && val[valueKey] === oldVal[valueKey]) {
  36864. return;
  36865. }
  36866. select.setSelected();
  36867. }
  36868. });
  36869. watch(() => selectGroup.disabled, () => {
  36870. states.groupDisabled = selectGroup.disabled;
  36871. }, { immediate: true });
  36872. return {
  36873. select,
  36874. currentLabel,
  36875. currentValue,
  36876. itemSelected,
  36877. isDisabled,
  36878. hoverItem,
  36879. updateOption
  36880. };
  36881. }
  36882. const _sfc_main$Y = defineComponent({
  36883. name: COMPONENT_NAME$b,
  36884. componentName: COMPONENT_NAME$b,
  36885. props: optionProps,
  36886. setup(props) {
  36887. const ns = useNamespace("select");
  36888. const id = useId();
  36889. const containerKls = computed(() => [
  36890. ns.be("dropdown", "item"),
  36891. ns.is("disabled", unref(isDisabled)),
  36892. ns.is("selected", unref(itemSelected)),
  36893. ns.is("hovering", unref(hover))
  36894. ]);
  36895. const states = reactive({
  36896. index: -1,
  36897. groupDisabled: false,
  36898. visible: true,
  36899. hover: false
  36900. });
  36901. const {
  36902. currentLabel,
  36903. itemSelected,
  36904. isDisabled,
  36905. select,
  36906. hoverItem,
  36907. updateOption
  36908. } = useOption$1(props, states);
  36909. const { visible, hover } = toRefs(states);
  36910. const vm = getCurrentInstance().proxy;
  36911. select.onOptionCreate(vm);
  36912. onBeforeUnmount(() => {
  36913. const key = vm.value;
  36914. nextTick(() => {
  36915. const { selected: selectedOptions } = select.states;
  36916. const doesSelected = selectedOptions.some((item) => {
  36917. return item.value === vm.value;
  36918. });
  36919. if (select.states.cachedOptions.get(key) === vm && !doesSelected) {
  36920. select.states.cachedOptions.delete(key);
  36921. }
  36922. });
  36923. select.onOptionDestroy(key, vm);
  36924. });
  36925. function selectOptionClick() {
  36926. if (!isDisabled.value) {
  36927. select.handleOptionSelect(vm);
  36928. }
  36929. }
  36930. return {
  36931. ns,
  36932. id,
  36933. containerKls,
  36934. currentLabel,
  36935. itemSelected,
  36936. isDisabled,
  36937. select,
  36938. visible,
  36939. hover,
  36940. states,
  36941. hoverItem,
  36942. updateOption,
  36943. selectOptionClick
  36944. };
  36945. }
  36946. });
  36947. function _sfc_render$b(_ctx, _cache) {
  36948. return withDirectives((openBlock(), createElementBlock("li", {
  36949. id: _ctx.id,
  36950. class: normalizeClass(_ctx.containerKls),
  36951. role: "option",
  36952. "aria-disabled": _ctx.isDisabled || void 0,
  36953. "aria-selected": _ctx.itemSelected,
  36954. onMousemove: _ctx.hoverItem,
  36955. onClick: withModifiers(_ctx.selectOptionClick, ["stop"])
  36956. }, [
  36957. renderSlot(_ctx.$slots, "default", {}, () => [
  36958. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  36959. ])
  36960. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"])), [
  36961. [vShow, _ctx.visible]
  36962. ]);
  36963. }
  36964. var Option = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["render", _sfc_render$b], ["__file", "option.vue"]]);
  36965. const _sfc_main$X = defineComponent({
  36966. name: "ElSelectDropdown",
  36967. componentName: "ElSelectDropdown",
  36968. setup() {
  36969. const select = inject(selectKey);
  36970. const ns = useNamespace("select");
  36971. const popperClass = computed(() => select.props.popperClass);
  36972. const isMultiple = computed(() => select.props.multiple);
  36973. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  36974. const minWidth = ref("");
  36975. function updateMinWidth() {
  36976. var _a;
  36977. const offsetWidth = (_a = select.selectRef) == null ? void 0 : _a.offsetWidth;
  36978. if (offsetWidth) {
  36979. minWidth.value = `${offsetWidth - BORDER_HORIZONTAL_WIDTH}px`;
  36980. } else {
  36981. minWidth.value = "";
  36982. }
  36983. }
  36984. onMounted(() => {
  36985. updateMinWidth();
  36986. useResizeObserver(select.selectRef, updateMinWidth);
  36987. });
  36988. return {
  36989. ns,
  36990. minWidth,
  36991. popperClass,
  36992. isMultiple,
  36993. isFitInputWidth
  36994. };
  36995. }
  36996. });
  36997. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  36998. return openBlock(), createElementBlock("div", {
  36999. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  37000. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  37001. }, [
  37002. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  37003. key: 0,
  37004. class: normalizeClass(_ctx.ns.be("dropdown", "header"))
  37005. }, [
  37006. renderSlot(_ctx.$slots, "header")
  37007. ], 2)) : createCommentVNode("v-if", true),
  37008. renderSlot(_ctx.$slots, "default"),
  37009. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  37010. key: 1,
  37011. class: normalizeClass(_ctx.ns.be("dropdown", "footer"))
  37012. }, [
  37013. renderSlot(_ctx.$slots, "footer")
  37014. ], 2)) : createCommentVNode("v-if", true)
  37015. ], 6);
  37016. }
  37017. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]);
  37018. const useSelect$3 = (props, emit) => {
  37019. const { t } = useLocale();
  37020. const contentId = useId();
  37021. const nsSelect = useNamespace("select");
  37022. const nsInput = useNamespace("input");
  37023. const states = reactive({
  37024. inputValue: "",
  37025. options: /* @__PURE__ */ new Map(),
  37026. cachedOptions: /* @__PURE__ */ new Map(),
  37027. optionValues: [],
  37028. selected: [],
  37029. selectionWidth: 0,
  37030. collapseItemWidth: 0,
  37031. selectedLabel: "",
  37032. hoveringIndex: -1,
  37033. previousQuery: null,
  37034. inputHovering: false,
  37035. menuVisibleOnFocus: false,
  37036. isBeforeHide: false
  37037. });
  37038. const selectRef = ref();
  37039. const selectionRef = ref();
  37040. const tooltipRef = ref();
  37041. const tagTooltipRef = ref();
  37042. const inputRef = ref();
  37043. const prefixRef = ref();
  37044. const suffixRef = ref();
  37045. const menuRef = ref();
  37046. const tagMenuRef = ref();
  37047. const collapseItemRef = ref();
  37048. const scrollbarRef = ref();
  37049. const expanded = ref(false);
  37050. const hoverOption = ref();
  37051. const debouncing = ref(false);
  37052. const { form, formItem } = useFormItem();
  37053. const { inputId } = useFormItemInputId(props, {
  37054. formItemContext: formItem
  37055. });
  37056. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  37057. const {
  37058. isComposing,
  37059. handleCompositionStart,
  37060. handleCompositionUpdate,
  37061. handleCompositionEnd
  37062. } = useComposition({
  37063. afterComposition: (e) => onInput(e)
  37064. });
  37065. const selectDisabled = computed(() => props.disabled || !!(form == null ? void 0 : form.disabled));
  37066. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  37067. disabled: selectDisabled,
  37068. afterFocus() {
  37069. if (props.automaticDropdown && !expanded.value) {
  37070. expanded.value = true;
  37071. states.menuVisibleOnFocus = true;
  37072. }
  37073. },
  37074. beforeBlur(event) {
  37075. var _a, _b;
  37076. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  37077. },
  37078. afterBlur() {
  37079. var _a;
  37080. expanded.value = false;
  37081. states.menuVisibleOnFocus = false;
  37082. if (props.validateEvent) {
  37083. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
  37084. }
  37085. }
  37086. });
  37087. const hasModelValue = computed(() => {
  37088. return isArray$1(props.modelValue) ? props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  37089. });
  37090. const needStatusIcon = computed(() => {
  37091. var _a;
  37092. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  37093. });
  37094. const showClearBtn = computed(() => {
  37095. return props.clearable && !selectDisabled.value && hasModelValue.value && (isFocused.value || states.inputHovering);
  37096. });
  37097. const iconComponent = computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  37098. const iconReverse = computed(() => nsSelect.is("reverse", !!(iconComponent.value && expanded.value)));
  37099. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  37100. const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  37101. const debounce = computed(() => props.remote ? props.debounce : 0);
  37102. const isRemoteSearchEmpty = computed(() => props.remote && !states.inputValue && states.options.size === 0);
  37103. const emptyText = computed(() => {
  37104. if (props.loading) {
  37105. return props.loadingText || t("el.select.loading");
  37106. } else {
  37107. if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) {
  37108. return props.noMatchText || t("el.select.noMatch");
  37109. }
  37110. if (states.options.size === 0) {
  37111. return props.noDataText || t("el.select.noData");
  37112. }
  37113. }
  37114. return null;
  37115. });
  37116. const filteredOptionsCount = computed(() => optionsArray.value.filter((option) => option.visible).length);
  37117. const optionsArray = computed(() => {
  37118. const list = Array.from(states.options.values());
  37119. const newList = [];
  37120. states.optionValues.forEach((item) => {
  37121. const index = list.findIndex((i) => i.value === item);
  37122. if (index > -1) {
  37123. newList.push(list[index]);
  37124. }
  37125. });
  37126. return newList.length >= list.length ? newList : list;
  37127. });
  37128. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  37129. const showNewOption = computed(() => {
  37130. const hasExistingOption = optionsArray.value.filter((option) => {
  37131. return !option.created;
  37132. }).some((option) => {
  37133. return option.currentLabel === states.inputValue;
  37134. });
  37135. return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
  37136. });
  37137. const updateOptions = () => {
  37138. if (props.filterable && isFunction$1(props.filterMethod))
  37139. return;
  37140. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  37141. return;
  37142. optionsArray.value.forEach((option) => {
  37143. var _a;
  37144. (_a = option.updateOption) == null ? void 0 : _a.call(option, states.inputValue);
  37145. });
  37146. };
  37147. const selectSize = useFormSize();
  37148. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  37149. const dropdownMenuVisible = computed({
  37150. get() {
  37151. return expanded.value && (props.loading || !isRemoteSearchEmpty.value) && (!debouncing.value || !isEmpty(states.previousQuery));
  37152. },
  37153. set(val) {
  37154. expanded.value = val;
  37155. }
  37156. });
  37157. const shouldShowPlaceholder = computed(() => {
  37158. if (props.multiple && !isUndefined(props.modelValue)) {
  37159. return castArray$1(props.modelValue).length === 0 && !states.inputValue;
  37160. }
  37161. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  37162. return props.filterable || isUndefined(value) ? !states.inputValue : true;
  37163. });
  37164. const currentPlaceholder = computed(() => {
  37165. var _a;
  37166. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  37167. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  37168. });
  37169. const mouseEnterEventName = computed(() => isIOS ? null : "mouseenter");
  37170. watch(() => props.modelValue, (val, oldVal) => {
  37171. if (props.multiple) {
  37172. if (props.filterable && !props.reserveKeyword) {
  37173. states.inputValue = "";
  37174. handleQueryChange("");
  37175. }
  37176. }
  37177. setSelected();
  37178. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  37179. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  37180. }
  37181. }, {
  37182. flush: "post",
  37183. deep: true
  37184. });
  37185. watch(() => expanded.value, (val) => {
  37186. if (val) {
  37187. handleQueryChange(states.inputValue);
  37188. } else {
  37189. states.inputValue = "";
  37190. states.previousQuery = null;
  37191. states.isBeforeHide = true;
  37192. }
  37193. emit("visible-change", val);
  37194. });
  37195. watch(() => states.options.entries(), () => {
  37196. if (!isClient)
  37197. return;
  37198. setSelected();
  37199. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  37200. checkDefaultFirstOption();
  37201. }
  37202. }, {
  37203. flush: "post"
  37204. });
  37205. watch([() => states.hoveringIndex, optionsArray], ([val]) => {
  37206. if (isNumber(val) && val > -1) {
  37207. hoverOption.value = optionsArray.value[val] || {};
  37208. } else {
  37209. hoverOption.value = {};
  37210. }
  37211. optionsArray.value.forEach((option) => {
  37212. option.hover = hoverOption.value === option;
  37213. });
  37214. });
  37215. watchEffect(() => {
  37216. if (states.isBeforeHide)
  37217. return;
  37218. updateOptions();
  37219. });
  37220. const handleQueryChange = (val) => {
  37221. if (states.previousQuery === val || isComposing.value) {
  37222. return;
  37223. }
  37224. states.previousQuery = val;
  37225. if (props.filterable && isFunction$1(props.filterMethod)) {
  37226. props.filterMethod(val);
  37227. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  37228. props.remoteMethod(val);
  37229. }
  37230. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  37231. nextTick(checkDefaultFirstOption);
  37232. } else {
  37233. nextTick(updateHoveringIndex);
  37234. }
  37235. };
  37236. const checkDefaultFirstOption = () => {
  37237. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  37238. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  37239. const firstOriginOption = optionsInDropdown[0];
  37240. const valueList = optionsArray.value.map((item) => item.value);
  37241. states.hoveringIndex = getValueIndex(valueList, userCreatedOption || firstOriginOption);
  37242. };
  37243. const setSelected = () => {
  37244. if (!props.multiple) {
  37245. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  37246. const option = getOption(value);
  37247. states.selectedLabel = option.currentLabel;
  37248. states.selected = [option];
  37249. return;
  37250. } else {
  37251. states.selectedLabel = "";
  37252. }
  37253. const result = [];
  37254. if (!isUndefined(props.modelValue)) {
  37255. castArray$1(props.modelValue).forEach((value) => {
  37256. result.push(getOption(value));
  37257. });
  37258. }
  37259. states.selected = result;
  37260. };
  37261. const getOption = (value) => {
  37262. let option;
  37263. const isObjectValue = isPlainObject$1(value);
  37264. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  37265. const cachedOption = cachedOptionsArray.value[i];
  37266. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  37267. if (isEqualValue) {
  37268. option = {
  37269. index: optionsArray.value.filter((opt) => !opt.created).indexOf(cachedOption),
  37270. value,
  37271. currentLabel: cachedOption.currentLabel,
  37272. get isDisabled() {
  37273. return cachedOption.isDisabled;
  37274. }
  37275. };
  37276. break;
  37277. }
  37278. }
  37279. if (option)
  37280. return option;
  37281. const label = isObjectValue ? value.label : value != null ? value : "";
  37282. const newOption = {
  37283. index: -1,
  37284. value,
  37285. currentLabel: label
  37286. };
  37287. return newOption;
  37288. };
  37289. const updateHoveringIndex = () => {
  37290. states.hoveringIndex = optionsArray.value.findIndex((item) => states.selected.some((selected) => getValueKey(selected) === getValueKey(item)));
  37291. };
  37292. const resetSelectionWidth = () => {
  37293. states.selectionWidth = Number.parseFloat(window.getComputedStyle(selectionRef.value).width);
  37294. };
  37295. const resetCollapseItemWidth = () => {
  37296. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  37297. };
  37298. const updateTooltip = () => {
  37299. var _a, _b;
  37300. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  37301. };
  37302. const updateTagTooltip = () => {
  37303. var _a, _b;
  37304. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  37305. };
  37306. const onInputChange = () => {
  37307. if (states.inputValue.length > 0 && !expanded.value) {
  37308. expanded.value = true;
  37309. }
  37310. handleQueryChange(states.inputValue);
  37311. };
  37312. const onInput = (event) => {
  37313. states.inputValue = event.target.value;
  37314. if (props.remote) {
  37315. debouncing.value = true;
  37316. debouncedOnInputChange();
  37317. } else {
  37318. return onInputChange();
  37319. }
  37320. };
  37321. const debouncedOnInputChange = useDebounceFn(() => {
  37322. onInputChange();
  37323. debouncing.value = false;
  37324. }, debounce);
  37325. const emitChange = (val) => {
  37326. if (!isEqual$1(props.modelValue, val)) {
  37327. emit(CHANGE_EVENT, val);
  37328. }
  37329. };
  37330. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => {
  37331. const option = states.cachedOptions.get(it);
  37332. return option && !option.disabled && !option.states.groupDisabled;
  37333. });
  37334. const deletePrevTag = (e) => {
  37335. const code = getEventCode(e);
  37336. if (!props.multiple)
  37337. return;
  37338. if (code === EVENT_CODE.delete)
  37339. return;
  37340. if (e.target.value.length <= 0) {
  37341. const value = castArray$1(props.modelValue).slice();
  37342. const lastNotDisabledIndex = getLastNotDisabledIndex(value);
  37343. if (lastNotDisabledIndex < 0)
  37344. return;
  37345. const removeTagValue = value[lastNotDisabledIndex];
  37346. value.splice(lastNotDisabledIndex, 1);
  37347. emit(UPDATE_MODEL_EVENT, value);
  37348. emitChange(value);
  37349. emit("remove-tag", removeTagValue);
  37350. }
  37351. };
  37352. const deleteTag = (event, tag) => {
  37353. const index = states.selected.indexOf(tag);
  37354. if (index > -1 && !selectDisabled.value) {
  37355. const value = castArray$1(props.modelValue).slice();
  37356. value.splice(index, 1);
  37357. emit(UPDATE_MODEL_EVENT, value);
  37358. emitChange(value);
  37359. emit("remove-tag", tag.value);
  37360. }
  37361. event.stopPropagation();
  37362. focus();
  37363. };
  37364. const deleteSelected = (event) => {
  37365. event.stopPropagation();
  37366. const value = props.multiple ? [] : valueOnClear.value;
  37367. if (props.multiple) {
  37368. for (const item of states.selected) {
  37369. if (item.isDisabled)
  37370. value.push(item.value);
  37371. }
  37372. }
  37373. emit(UPDATE_MODEL_EVENT, value);
  37374. emitChange(value);
  37375. states.hoveringIndex = -1;
  37376. expanded.value = false;
  37377. emit("clear");
  37378. focus();
  37379. };
  37380. const handleOptionSelect = (option) => {
  37381. var _a;
  37382. if (props.multiple) {
  37383. const value = castArray$1((_a = props.modelValue) != null ? _a : []).slice();
  37384. const optionIndex = getValueIndex(value, option);
  37385. if (optionIndex > -1) {
  37386. value.splice(optionIndex, 1);
  37387. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  37388. value.push(option.value);
  37389. }
  37390. emit(UPDATE_MODEL_EVENT, value);
  37391. emitChange(value);
  37392. if (option.created) {
  37393. handleQueryChange("");
  37394. }
  37395. if (props.filterable && !props.reserveKeyword) {
  37396. states.inputValue = "";
  37397. }
  37398. } else {
  37399. !isEqual$1(props.modelValue, option.value) && emit(UPDATE_MODEL_EVENT, option.value);
  37400. emitChange(option.value);
  37401. expanded.value = false;
  37402. }
  37403. focus();
  37404. if (expanded.value)
  37405. return;
  37406. nextTick(() => {
  37407. scrollToOption(option);
  37408. });
  37409. };
  37410. const getValueIndex = (arr, option) => {
  37411. if (isUndefined(option))
  37412. return -1;
  37413. if (!isObject$1(option.value))
  37414. return arr.indexOf(option.value);
  37415. return arr.findIndex((item) => {
  37416. return isEqual$1(get(item, props.valueKey), getValueKey(option));
  37417. });
  37418. };
  37419. const scrollToOption = (option) => {
  37420. var _a, _b, _c, _d, _e;
  37421. const targetOption = isArray$1(option) ? option[0] : option;
  37422. let target = null;
  37423. if (!isNil(targetOption == null ? void 0 : targetOption.value)) {
  37424. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  37425. if (options.length > 0) {
  37426. target = options[0].$el;
  37427. }
  37428. }
  37429. if (tooltipRef.value && target) {
  37430. const menu = (_d = (_c = (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${nsSelect.be("dropdown", "wrap")}`);
  37431. if (menu) {
  37432. scrollIntoView(menu, target);
  37433. }
  37434. }
  37435. (_e = scrollbarRef.value) == null ? void 0 : _e.handleScroll();
  37436. };
  37437. const onOptionCreate = (vm) => {
  37438. states.options.set(vm.value, vm);
  37439. states.cachedOptions.set(vm.value, vm);
  37440. };
  37441. const onOptionDestroy = (key, vm) => {
  37442. if (states.options.get(key) === vm) {
  37443. states.options.delete(key);
  37444. }
  37445. };
  37446. const popperRef = computed(() => {
  37447. var _a, _b;
  37448. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  37449. });
  37450. const handleMenuEnter = () => {
  37451. states.isBeforeHide = false;
  37452. nextTick(() => {
  37453. var _a;
  37454. (_a = scrollbarRef.value) == null ? void 0 : _a.update();
  37455. scrollToOption(states.selected);
  37456. });
  37457. };
  37458. const focus = () => {
  37459. var _a;
  37460. (_a = inputRef.value) == null ? void 0 : _a.focus();
  37461. };
  37462. const blur = () => {
  37463. var _a;
  37464. if (expanded.value) {
  37465. expanded.value = false;
  37466. nextTick(() => {
  37467. var _a2;
  37468. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  37469. });
  37470. return;
  37471. }
  37472. (_a = inputRef.value) == null ? void 0 : _a.blur();
  37473. };
  37474. const handleClearClick = (event) => {
  37475. deleteSelected(event);
  37476. };
  37477. const handleClickOutside = (event) => {
  37478. expanded.value = false;
  37479. if (isFocused.value) {
  37480. const _event = new FocusEvent("blur", event);
  37481. nextTick(() => handleBlur(_event));
  37482. }
  37483. };
  37484. const handleEsc = () => {
  37485. if (states.inputValue.length > 0) {
  37486. states.inputValue = "";
  37487. } else {
  37488. expanded.value = false;
  37489. }
  37490. };
  37491. const toggleMenu = () => {
  37492. if (selectDisabled.value)
  37493. return;
  37494. if (isIOS)
  37495. states.inputHovering = true;
  37496. if (states.menuVisibleOnFocus) {
  37497. states.menuVisibleOnFocus = false;
  37498. } else {
  37499. expanded.value = !expanded.value;
  37500. }
  37501. };
  37502. const selectOption = () => {
  37503. if (!expanded.value) {
  37504. toggleMenu();
  37505. } else {
  37506. const option = optionsArray.value[states.hoveringIndex];
  37507. if (option && !option.isDisabled) {
  37508. handleOptionSelect(option);
  37509. }
  37510. }
  37511. };
  37512. const getValueKey = (item) => {
  37513. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  37514. };
  37515. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.isDisabled));
  37516. const showTagList = computed(() => {
  37517. if (!props.multiple) {
  37518. return [];
  37519. }
  37520. return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
  37521. });
  37522. const collapseTagList = computed(() => {
  37523. if (!props.multiple) {
  37524. return [];
  37525. }
  37526. return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
  37527. });
  37528. const navigateOptions = (direction) => {
  37529. if (!expanded.value) {
  37530. expanded.value = true;
  37531. return;
  37532. }
  37533. if (states.options.size === 0 || filteredOptionsCount.value === 0 || isComposing.value)
  37534. return;
  37535. if (!optionsAllDisabled.value) {
  37536. if (direction === "next") {
  37537. states.hoveringIndex++;
  37538. if (states.hoveringIndex === states.options.size) {
  37539. states.hoveringIndex = 0;
  37540. }
  37541. } else if (direction === "prev") {
  37542. states.hoveringIndex--;
  37543. if (states.hoveringIndex < 0) {
  37544. states.hoveringIndex = states.options.size - 1;
  37545. }
  37546. }
  37547. const option = optionsArray.value[states.hoveringIndex];
  37548. if (option.isDisabled || !option.visible) {
  37549. navigateOptions(direction);
  37550. }
  37551. nextTick(() => scrollToOption(hoverOption.value));
  37552. }
  37553. };
  37554. const findFocusableIndex = (arr, start, step, len) => {
  37555. for (let i = start; i >= 0 && i < len; i += step) {
  37556. const obj = arr[i];
  37557. if (!(obj == null ? void 0 : obj.isDisabled) && (obj == null ? void 0 : obj.visible)) {
  37558. return i;
  37559. }
  37560. }
  37561. return null;
  37562. };
  37563. const focusOption = (targetIndex, mode) => {
  37564. var _a;
  37565. const len = states.options.size;
  37566. if (len === 0)
  37567. return;
  37568. const start = clamp$1(targetIndex, 0, len - 1);
  37569. const options = optionsArray.value;
  37570. const direction = mode === "up" ? -1 : 1;
  37571. const newIndex = (_a = findFocusableIndex(options, start, direction, len)) != null ? _a : findFocusableIndex(options, start - direction, -direction, len);
  37572. if (newIndex != null) {
  37573. states.hoveringIndex = newIndex;
  37574. nextTick(() => scrollToOption(hoverOption.value));
  37575. }
  37576. };
  37577. const handleKeydown = (e) => {
  37578. const code = getEventCode(e);
  37579. let isPreventDefault = true;
  37580. switch (code) {
  37581. case EVENT_CODE.up:
  37582. navigateOptions("prev");
  37583. break;
  37584. case EVENT_CODE.down:
  37585. navigateOptions("next");
  37586. break;
  37587. case EVENT_CODE.enter:
  37588. selectOption();
  37589. break;
  37590. case EVENT_CODE.esc:
  37591. handleEsc();
  37592. break;
  37593. case EVENT_CODE.backspace:
  37594. isPreventDefault = false;
  37595. deletePrevTag(e);
  37596. return;
  37597. case EVENT_CODE.home:
  37598. if (!expanded.value)
  37599. return;
  37600. focusOption(0, "down");
  37601. break;
  37602. case EVENT_CODE.end:
  37603. if (!expanded.value)
  37604. return;
  37605. focusOption(states.options.size - 1, "up");
  37606. break;
  37607. case EVENT_CODE.pageUp:
  37608. if (!expanded.value)
  37609. return;
  37610. focusOption(states.hoveringIndex - 10, "up");
  37611. break;
  37612. case EVENT_CODE.pageDown:
  37613. if (!expanded.value)
  37614. return;
  37615. focusOption(states.hoveringIndex + 10, "down");
  37616. break;
  37617. default:
  37618. isPreventDefault = false;
  37619. break;
  37620. }
  37621. if (isPreventDefault) {
  37622. e.preventDefault();
  37623. e.stopPropagation();
  37624. }
  37625. };
  37626. const getGapWidth = () => {
  37627. if (!selectionRef.value)
  37628. return 0;
  37629. const style = window.getComputedStyle(selectionRef.value);
  37630. return Number.parseFloat(style.gap || "6px");
  37631. };
  37632. const tagStyle = computed(() => {
  37633. const gapWidth = getGapWidth();
  37634. const inputSlotWidth = props.filterable ? gapWidth + MINIMUM_INPUT_WIDTH : 0;
  37635. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.selectionWidth - inputSlotWidth;
  37636. return { maxWidth: `${maxWidth}px` };
  37637. });
  37638. const collapseTagStyle = computed(() => {
  37639. return { maxWidth: `${states.selectionWidth}px` };
  37640. });
  37641. const popupScroll = (data) => {
  37642. emit("popup-scroll", data);
  37643. };
  37644. useResizeObserver(selectionRef, resetSelectionWidth);
  37645. useResizeObserver(wrapperRef, updateTooltip);
  37646. useResizeObserver(tagMenuRef, updateTagTooltip);
  37647. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  37648. let stop;
  37649. watch(() => dropdownMenuVisible.value, (newVal) => {
  37650. if (newVal) {
  37651. stop = useResizeObserver(menuRef, updateTooltip).stop;
  37652. } else {
  37653. stop == null ? void 0 : stop();
  37654. stop = void 0;
  37655. }
  37656. });
  37657. onMounted(() => {
  37658. setSelected();
  37659. });
  37660. return {
  37661. inputId,
  37662. contentId,
  37663. nsSelect,
  37664. nsInput,
  37665. states,
  37666. isFocused,
  37667. expanded,
  37668. optionsArray,
  37669. hoverOption,
  37670. selectSize,
  37671. filteredOptionsCount,
  37672. updateTooltip,
  37673. updateTagTooltip,
  37674. debouncedOnInputChange,
  37675. onInput,
  37676. deletePrevTag,
  37677. deleteTag,
  37678. deleteSelected,
  37679. handleOptionSelect,
  37680. scrollToOption,
  37681. hasModelValue,
  37682. shouldShowPlaceholder,
  37683. currentPlaceholder,
  37684. mouseEnterEventName,
  37685. needStatusIcon,
  37686. showClearBtn,
  37687. iconComponent,
  37688. iconReverse,
  37689. validateState,
  37690. validateIcon,
  37691. showNewOption,
  37692. updateOptions,
  37693. collapseTagSize,
  37694. setSelected,
  37695. selectDisabled,
  37696. emptyText,
  37697. handleCompositionStart,
  37698. handleCompositionUpdate,
  37699. handleCompositionEnd,
  37700. handleKeydown,
  37701. onOptionCreate,
  37702. onOptionDestroy,
  37703. handleMenuEnter,
  37704. focus,
  37705. blur,
  37706. handleClearClick,
  37707. handleClickOutside,
  37708. handleEsc,
  37709. toggleMenu,
  37710. selectOption,
  37711. getValueKey,
  37712. navigateOptions,
  37713. dropdownMenuVisible,
  37714. showTagList,
  37715. collapseTagList,
  37716. popupScroll,
  37717. getOption,
  37718. tagStyle,
  37719. collapseTagStyle,
  37720. popperRef,
  37721. inputRef,
  37722. tooltipRef,
  37723. tagTooltipRef,
  37724. prefixRef,
  37725. suffixRef,
  37726. selectRef,
  37727. wrapperRef,
  37728. selectionRef,
  37729. scrollbarRef,
  37730. menuRef,
  37731. tagMenuRef,
  37732. collapseItemRef
  37733. };
  37734. };
  37735. var ElOptions = defineComponent({
  37736. name: "ElOptions",
  37737. setup(_, { slots }) {
  37738. const select = inject(selectKey);
  37739. let cachedValueList = [];
  37740. return () => {
  37741. var _a, _b;
  37742. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  37743. const valueList = [];
  37744. function filterOptions(children2) {
  37745. if (!isArray$1(children2))
  37746. return;
  37747. children2.forEach((item) => {
  37748. var _a2, _b2, _c, _d;
  37749. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  37750. if (name === "ElOptionGroup") {
  37751. filterOptions(!isString$1(item.children) && !isArray$1(item.children) && isFunction$1((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
  37752. } else if (name === "ElOption") {
  37753. valueList.push((_d = item.props) == null ? void 0 : _d.value);
  37754. } else if (isArray$1(item.children)) {
  37755. filterOptions(item.children);
  37756. }
  37757. });
  37758. }
  37759. if (children.length) {
  37760. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  37761. }
  37762. if (!isEqual$1(valueList, cachedValueList)) {
  37763. cachedValueList = valueList;
  37764. if (select) {
  37765. select.states.optionValues = valueList;
  37766. }
  37767. }
  37768. return children;
  37769. };
  37770. }
  37771. });
  37772. const selectProps = buildProps({
  37773. name: String,
  37774. id: String,
  37775. modelValue: {
  37776. type: definePropType([
  37777. Array,
  37778. String,
  37779. Number,
  37780. Boolean,
  37781. Object
  37782. ]),
  37783. default: void 0
  37784. },
  37785. autocomplete: {
  37786. type: String,
  37787. default: "off"
  37788. },
  37789. automaticDropdown: Boolean,
  37790. size: useSizeProp,
  37791. effect: {
  37792. type: definePropType(String),
  37793. default: "light"
  37794. },
  37795. disabled: Boolean,
  37796. clearable: Boolean,
  37797. filterable: Boolean,
  37798. allowCreate: Boolean,
  37799. loading: Boolean,
  37800. popperClass: {
  37801. type: String,
  37802. default: ""
  37803. },
  37804. popperStyle: {
  37805. type: definePropType([String, Object])
  37806. },
  37807. popperOptions: {
  37808. type: definePropType(Object),
  37809. default: () => ({})
  37810. },
  37811. remote: Boolean,
  37812. debounce: {
  37813. type: Number,
  37814. default: 300
  37815. },
  37816. loadingText: String,
  37817. noMatchText: String,
  37818. noDataText: String,
  37819. remoteMethod: {
  37820. type: definePropType(Function)
  37821. },
  37822. filterMethod: {
  37823. type: definePropType(Function)
  37824. },
  37825. multiple: Boolean,
  37826. multipleLimit: {
  37827. type: Number,
  37828. default: 0
  37829. },
  37830. placeholder: {
  37831. type: String
  37832. },
  37833. defaultFirstOption: Boolean,
  37834. reserveKeyword: {
  37835. type: Boolean,
  37836. default: true
  37837. },
  37838. valueKey: {
  37839. type: String,
  37840. default: "value"
  37841. },
  37842. collapseTags: Boolean,
  37843. collapseTagsTooltip: Boolean,
  37844. maxCollapseTags: {
  37845. type: Number,
  37846. default: 1
  37847. },
  37848. teleported: useTooltipContentProps.teleported,
  37849. persistent: {
  37850. type: Boolean,
  37851. default: true
  37852. },
  37853. clearIcon: {
  37854. type: iconPropType,
  37855. default: circle_close_default
  37856. },
  37857. fitInputWidth: Boolean,
  37858. suffixIcon: {
  37859. type: iconPropType,
  37860. default: arrow_down_default
  37861. },
  37862. tagType: { ...tagProps.type, default: "info" },
  37863. tagEffect: { ...tagProps.effect, default: "light" },
  37864. validateEvent: {
  37865. type: Boolean,
  37866. default: true
  37867. },
  37868. remoteShowSuffix: Boolean,
  37869. showArrow: {
  37870. type: Boolean,
  37871. default: true
  37872. },
  37873. offset: {
  37874. type: Number,
  37875. default: 12
  37876. },
  37877. placement: {
  37878. type: definePropType(String),
  37879. values: Ee,
  37880. default: "bottom-start"
  37881. },
  37882. fallbackPlacements: {
  37883. type: definePropType(Array),
  37884. default: ["bottom-start", "top-start", "right", "left"]
  37885. },
  37886. tabindex: {
  37887. type: [String, Number],
  37888. default: 0
  37889. },
  37890. appendTo: useTooltipContentProps.appendTo,
  37891. options: {
  37892. type: definePropType(Array)
  37893. },
  37894. props: {
  37895. type: definePropType(Object),
  37896. default: () => defaultProps$5
  37897. },
  37898. ...useEmptyValuesProps,
  37899. ...useAriaProps(["ariaLabel"])
  37900. });
  37901. const selectEmits = {
  37902. [UPDATE_MODEL_EVENT]: (val) => true,
  37903. [CHANGE_EVENT]: (val) => true,
  37904. "popup-scroll": scrollbarEmits.scroll,
  37905. "remove-tag": (val) => true,
  37906. "visible-change": (visible) => true,
  37907. focus: (evt) => evt instanceof FocusEvent,
  37908. blur: (evt) => evt instanceof FocusEvent,
  37909. clear: () => true
  37910. };
  37911. const _sfc_main$W = defineComponent({
  37912. name: "ElOptionGroup",
  37913. componentName: "ElOptionGroup",
  37914. props: {
  37915. label: String,
  37916. disabled: Boolean
  37917. },
  37918. setup(props) {
  37919. const ns = useNamespace("select");
  37920. const groupRef = ref();
  37921. const instance = getCurrentInstance();
  37922. const children = ref([]);
  37923. provide(selectGroupKey, reactive({
  37924. ...toRefs(props)
  37925. }));
  37926. const visible = computed(() => children.value.some((option) => option.visible === true));
  37927. const isOption = (node) => {
  37928. var _a;
  37929. return node.type.name === "ElOption" && !!((_a = node.component) == null ? void 0 : _a.proxy);
  37930. };
  37931. const flattedChildren = (node) => {
  37932. const nodes = castArray$1(node);
  37933. const children2 = [];
  37934. nodes.forEach((child) => {
  37935. var _a;
  37936. if (!isVNode(child))
  37937. return;
  37938. if (isOption(child)) {
  37939. children2.push(child.component.proxy);
  37940. } else if (isArray$1(child.children) && child.children.length) {
  37941. children2.push(...flattedChildren(child.children));
  37942. } else if ((_a = child.component) == null ? void 0 : _a.subTree) {
  37943. children2.push(...flattedChildren(child.component.subTree));
  37944. }
  37945. });
  37946. return children2;
  37947. };
  37948. const updateChildren = () => {
  37949. children.value = flattedChildren(instance.subTree);
  37950. };
  37951. onMounted(() => {
  37952. updateChildren();
  37953. });
  37954. useMutationObserver(groupRef, updateChildren, {
  37955. attributes: true,
  37956. subtree: true,
  37957. childList: true
  37958. });
  37959. return {
  37960. groupRef,
  37961. visible,
  37962. ns
  37963. };
  37964. }
  37965. });
  37966. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  37967. return withDirectives((openBlock(), createElementBlock("ul", {
  37968. ref: "groupRef",
  37969. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  37970. }, [
  37971. createElementVNode("li", {
  37972. class: normalizeClass(_ctx.ns.be("group", "title"))
  37973. }, toDisplayString(_ctx.label), 3),
  37974. createElementVNode("li", null, [
  37975. createElementVNode("ul", {
  37976. class: normalizeClass(_ctx.ns.b("group"))
  37977. }, [
  37978. renderSlot(_ctx.$slots, "default")
  37979. ], 2)
  37980. ])
  37981. ], 2)), [
  37982. [vShow, _ctx.visible]
  37983. ]);
  37984. }
  37985. var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["render", _sfc_render$9], ["__file", "option-group.vue"]]);
  37986. const COMPONENT_NAME$a = "ElSelect";
  37987. const _sfc_main$V = defineComponent({
  37988. name: COMPONENT_NAME$a,
  37989. componentName: COMPONENT_NAME$a,
  37990. components: {
  37991. ElSelectMenu: ElSelectMenu$1,
  37992. ElOption: Option,
  37993. ElOptions,
  37994. ElOptionGroup: OptionGroup,
  37995. ElTag,
  37996. ElScrollbar,
  37997. ElTooltip,
  37998. ElIcon
  37999. },
  38000. directives: { ClickOutside },
  38001. props: selectProps,
  38002. emits: [
  38003. UPDATE_MODEL_EVENT,
  38004. CHANGE_EVENT,
  38005. "remove-tag",
  38006. "clear",
  38007. "visible-change",
  38008. "focus",
  38009. "blur",
  38010. "popup-scroll"
  38011. ],
  38012. setup(props, { emit, slots }) {
  38013. const instance = getCurrentInstance();
  38014. const originalWarnHandler = instance.appContext.config.warnHandler;
  38015. instance.appContext.config.warnHandler = (...args) => {
  38016. if (!args[0] || args[0].includes('Slot "default" invoked outside of the render function')) {
  38017. return;
  38018. }
  38019. console.warn(...args);
  38020. };
  38021. const modelValue = computed(() => {
  38022. const { modelValue: rawModelValue, multiple } = props;
  38023. const fallback = multiple ? [] : void 0;
  38024. if (isArray$1(rawModelValue)) {
  38025. return multiple ? rawModelValue : fallback;
  38026. }
  38027. return multiple ? fallback : rawModelValue;
  38028. });
  38029. const _props = reactive({
  38030. ...toRefs(props),
  38031. modelValue
  38032. });
  38033. const API = useSelect$3(_props, emit);
  38034. const { calculatorRef, inputStyle } = useCalcInputWidth();
  38035. const { getLabel, getValue, getOptions, getDisabled } = useProps(props);
  38036. const getOptionProps = (option) => ({
  38037. label: getLabel(option),
  38038. value: getValue(option),
  38039. disabled: getDisabled(option)
  38040. });
  38041. const flatTreeSelectData = (data) => {
  38042. return data.reduce((acc, item) => {
  38043. acc.push(item);
  38044. if (item.children && item.children.length > 0) {
  38045. acc.push(...flatTreeSelectData(item.children));
  38046. }
  38047. return acc;
  38048. }, []);
  38049. };
  38050. const manuallyRenderSlots = (vnodes) => {
  38051. const children = flattedChildren(vnodes || []);
  38052. children.forEach((item) => {
  38053. var _a;
  38054. if (isObject$1(item) && (item.type.name === "ElOption" || item.type.name === "ElTree")) {
  38055. const _name = item.type.name;
  38056. if (_name === "ElTree") {
  38057. const treeData = ((_a = item.props) == null ? void 0 : _a.data) || [];
  38058. const flatData = flatTreeSelectData(treeData);
  38059. flatData.forEach((treeItem) => {
  38060. treeItem.currentLabel = treeItem.label || (isObject$1(treeItem.value) ? "" : treeItem.value);
  38061. API.onOptionCreate(treeItem);
  38062. });
  38063. } else if (_name === "ElOption") {
  38064. const obj = { ...item.props };
  38065. obj.currentLabel = obj.label || (isObject$1(obj.value) ? "" : obj.value);
  38066. API.onOptionCreate(obj);
  38067. }
  38068. }
  38069. });
  38070. };
  38071. watch(() => {
  38072. var _a;
  38073. return [(_a = slots.default) == null ? void 0 : _a.call(slots), modelValue.value];
  38074. }, () => {
  38075. var _a;
  38076. if (props.persistent || API.states.options.size > 0) {
  38077. return;
  38078. }
  38079. manuallyRenderSlots((_a = slots.default) == null ? void 0 : _a.call(slots));
  38080. }, {
  38081. immediate: true
  38082. });
  38083. provide(selectKey, reactive({
  38084. props: _props,
  38085. states: API.states,
  38086. selectRef: API.selectRef,
  38087. optionsArray: API.optionsArray,
  38088. setSelected: API.setSelected,
  38089. handleOptionSelect: API.handleOptionSelect,
  38090. onOptionCreate: API.onOptionCreate,
  38091. onOptionDestroy: API.onOptionDestroy
  38092. }));
  38093. const selectedLabel = computed(() => {
  38094. if (!props.multiple) {
  38095. return API.states.selectedLabel;
  38096. }
  38097. return API.states.selected.map((i) => i.currentLabel);
  38098. });
  38099. onBeforeUnmount(() => {
  38100. instance.appContext.config.warnHandler = originalWarnHandler;
  38101. });
  38102. return {
  38103. ...API,
  38104. modelValue,
  38105. selectedLabel,
  38106. calculatorRef,
  38107. inputStyle,
  38108. getLabel,
  38109. getValue,
  38110. getOptions,
  38111. getDisabled,
  38112. getOptionProps
  38113. };
  38114. }
  38115. });
  38116. function _sfc_render$8(_ctx, _cache) {
  38117. const _component_el_tag = resolveComponent("el-tag");
  38118. const _component_el_tooltip = resolveComponent("el-tooltip");
  38119. const _component_el_icon = resolveComponent("el-icon");
  38120. const _component_el_option = resolveComponent("el-option");
  38121. const _component_el_option_group = resolveComponent("el-option-group");
  38122. const _component_el_options = resolveComponent("el-options");
  38123. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  38124. const _component_el_select_menu = resolveComponent("el-select-menu");
  38125. const _directive_click_outside = resolveDirective("click-outside");
  38126. return withDirectives((openBlock(), createElementBlock("div", {
  38127. ref: "selectRef",
  38128. class: normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  38129. [toHandlerKey(_ctx.mouseEnterEventName)]: ($event) => _ctx.states.inputHovering = true,
  38130. onMouseleave: ($event) => _ctx.states.inputHovering = false
  38131. }, [
  38132. createVNode(_component_el_tooltip, {
  38133. ref: "tooltipRef",
  38134. visible: _ctx.dropdownMenuVisible,
  38135. placement: _ctx.placement,
  38136. teleported: _ctx.teleported,
  38137. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  38138. "popper-style": _ctx.popperStyle,
  38139. "popper-options": _ctx.popperOptions,
  38140. "fallback-placements": _ctx.fallbackPlacements,
  38141. effect: _ctx.effect,
  38142. pure: "",
  38143. trigger: "click",
  38144. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  38145. "stop-popper-mouse-event": false,
  38146. "gpu-acceleration": false,
  38147. persistent: _ctx.persistent,
  38148. "append-to": _ctx.appendTo,
  38149. "show-arrow": _ctx.showArrow,
  38150. offset: _ctx.offset,
  38151. onBeforeShow: _ctx.handleMenuEnter,
  38152. onHide: ($event) => _ctx.states.isBeforeHide = false
  38153. }, {
  38154. default: withCtx(() => {
  38155. var _a;
  38156. return [
  38157. createElementVNode("div", {
  38158. ref: "wrapperRef",
  38159. class: normalizeClass([
  38160. _ctx.nsSelect.e("wrapper"),
  38161. _ctx.nsSelect.is("focused", _ctx.isFocused),
  38162. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  38163. _ctx.nsSelect.is("filterable", _ctx.filterable),
  38164. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  38165. ]),
  38166. onClick: withModifiers(_ctx.toggleMenu, ["prevent"])
  38167. }, [
  38168. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
  38169. key: 0,
  38170. ref: "prefixRef",
  38171. class: normalizeClass(_ctx.nsSelect.e("prefix"))
  38172. }, [
  38173. renderSlot(_ctx.$slots, "prefix")
  38174. ], 2)) : createCommentVNode("v-if", true),
  38175. createElementVNode("div", {
  38176. ref: "selectionRef",
  38177. class: normalizeClass([
  38178. _ctx.nsSelect.e("selection"),
  38179. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)
  38180. ])
  38181. }, [
  38182. _ctx.multiple ? renderSlot(_ctx.$slots, "tag", {
  38183. key: 0,
  38184. data: _ctx.states.selected,
  38185. deleteTag: _ctx.deleteTag,
  38186. selectDisabled: _ctx.selectDisabled
  38187. }, () => [
  38188. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  38189. return openBlock(), createElementBlock("div", {
  38190. key: _ctx.getValueKey(item),
  38191. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  38192. }, [
  38193. createVNode(_component_el_tag, {
  38194. closable: !_ctx.selectDisabled && !item.isDisabled,
  38195. size: _ctx.collapseTagSize,
  38196. type: _ctx.tagType,
  38197. effect: _ctx.tagEffect,
  38198. "disable-transitions": "",
  38199. style: normalizeStyle(_ctx.tagStyle),
  38200. onClose: ($event) => _ctx.deleteTag($event, item)
  38201. }, {
  38202. default: withCtx(() => [
  38203. createElementVNode("span", {
  38204. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  38205. }, [
  38206. renderSlot(_ctx.$slots, "label", {
  38207. index: item.index,
  38208. label: item.currentLabel,
  38209. value: item.value
  38210. }, () => [
  38211. createTextVNode(toDisplayString(item.currentLabel), 1)
  38212. ])
  38213. ], 2)
  38214. ]),
  38215. _: 2
  38216. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  38217. ], 2);
  38218. }), 128)),
  38219. _ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
  38220. key: 0,
  38221. ref: "tagTooltipRef",
  38222. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  38223. "fallback-placements": ["bottom", "top", "right", "left"],
  38224. effect: _ctx.effect,
  38225. placement: "bottom",
  38226. "popper-class": _ctx.popperClass,
  38227. "popper-style": _ctx.popperStyle,
  38228. teleported: _ctx.teleported
  38229. }, {
  38230. default: withCtx(() => [
  38231. createElementVNode("div", {
  38232. ref: "collapseItemRef",
  38233. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  38234. }, [
  38235. createVNode(_component_el_tag, {
  38236. closable: false,
  38237. size: _ctx.collapseTagSize,
  38238. type: _ctx.tagType,
  38239. effect: _ctx.tagEffect,
  38240. "disable-transitions": "",
  38241. style: normalizeStyle(_ctx.collapseTagStyle)
  38242. }, {
  38243. default: withCtx(() => [
  38244. createElementVNode("span", {
  38245. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  38246. }, " + " + toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)
  38247. ]),
  38248. _: 1
  38249. }, 8, ["size", "type", "effect", "style"])
  38250. ], 2)
  38251. ]),
  38252. content: withCtx(() => [
  38253. createElementVNode("div", {
  38254. ref: "tagMenuRef",
  38255. class: normalizeClass(_ctx.nsSelect.e("selection"))
  38256. }, [
  38257. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
  38258. return openBlock(), createElementBlock("div", {
  38259. key: _ctx.getValueKey(item),
  38260. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  38261. }, [
  38262. createVNode(_component_el_tag, {
  38263. class: "in-tooltip",
  38264. closable: !_ctx.selectDisabled && !item.isDisabled,
  38265. size: _ctx.collapseTagSize,
  38266. type: _ctx.tagType,
  38267. effect: _ctx.tagEffect,
  38268. "disable-transitions": "",
  38269. onClose: ($event) => _ctx.deleteTag($event, item)
  38270. }, {
  38271. default: withCtx(() => [
  38272. createElementVNode("span", {
  38273. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  38274. }, [
  38275. renderSlot(_ctx.$slots, "label", {
  38276. index: item.index,
  38277. label: item.currentLabel,
  38278. value: item.value
  38279. }, () => [
  38280. createTextVNode(toDisplayString(item.currentLabel), 1)
  38281. ])
  38282. ], 2)
  38283. ]),
  38284. _: 2
  38285. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  38286. ], 2);
  38287. }), 128))
  38288. ], 2)
  38289. ]),
  38290. _: 3
  38291. }, 8, ["disabled", "effect", "popper-class", "popper-style", "teleported"])) : createCommentVNode("v-if", true)
  38292. ]) : createCommentVNode("v-if", true),
  38293. createElementVNode("div", {
  38294. class: normalizeClass([
  38295. _ctx.nsSelect.e("selected-item"),
  38296. _ctx.nsSelect.e("input-wrapper"),
  38297. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  38298. ])
  38299. }, [
  38300. withDirectives(createElementVNode("input", {
  38301. id: _ctx.inputId,
  38302. ref: "inputRef",
  38303. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  38304. type: "text",
  38305. name: _ctx.name,
  38306. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  38307. disabled: _ctx.selectDisabled,
  38308. autocomplete: _ctx.autocomplete,
  38309. style: normalizeStyle(_ctx.inputStyle),
  38310. tabindex: _ctx.tabindex,
  38311. role: "combobox",
  38312. readonly: !_ctx.filterable,
  38313. spellcheck: "false",
  38314. "aria-activedescendant": ((_a = _ctx.hoverOption) == null ? void 0 : _a.id) || "",
  38315. "aria-controls": _ctx.contentId,
  38316. "aria-expanded": _ctx.dropdownMenuVisible,
  38317. "aria-label": _ctx.ariaLabel,
  38318. "aria-autocomplete": "none",
  38319. "aria-haspopup": "listbox",
  38320. onKeydown: _ctx.handleKeydown,
  38321. onCompositionstart: _ctx.handleCompositionStart,
  38322. onCompositionupdate: _ctx.handleCompositionUpdate,
  38323. onCompositionend: _ctx.handleCompositionEnd,
  38324. onInput: _ctx.onInput,
  38325. onClick: withModifiers(_ctx.toggleMenu, ["stop"])
  38326. }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "tabindex", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
  38327. [vModelText, _ctx.states.inputValue]
  38328. ]),
  38329. _ctx.filterable ? (openBlock(), createElementBlock("span", {
  38330. key: 0,
  38331. ref: "calculatorRef",
  38332. "aria-hidden": "true",
  38333. class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
  38334. textContent: toDisplayString(_ctx.states.inputValue)
  38335. }, null, 10, ["textContent"])) : createCommentVNode("v-if", true)
  38336. ], 2),
  38337. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
  38338. key: 1,
  38339. class: normalizeClass([
  38340. _ctx.nsSelect.e("selected-item"),
  38341. _ctx.nsSelect.e("placeholder"),
  38342. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  38343. ])
  38344. }, [
  38345. _ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
  38346. key: 0,
  38347. index: _ctx.getOption(_ctx.modelValue).index,
  38348. label: _ctx.currentPlaceholder,
  38349. value: _ctx.modelValue
  38350. }, () => [
  38351. createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)
  38352. ]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.currentPlaceholder), 1))
  38353. ], 2)) : createCommentVNode("v-if", true)
  38354. ], 2),
  38355. createElementVNode("div", {
  38356. ref: "suffixRef",
  38357. class: normalizeClass(_ctx.nsSelect.e("suffix"))
  38358. }, [
  38359. _ctx.iconComponent && !_ctx.showClearBtn ? (openBlock(), createBlock(_component_el_icon, {
  38360. key: 0,
  38361. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  38362. }, {
  38363. default: withCtx(() => [
  38364. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  38365. ]),
  38366. _: 1
  38367. }, 8, ["class"])) : createCommentVNode("v-if", true),
  38368. _ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  38369. key: 1,
  38370. class: normalizeClass([
  38371. _ctx.nsSelect.e("caret"),
  38372. _ctx.nsSelect.e("icon"),
  38373. _ctx.nsSelect.e("clear")
  38374. ]),
  38375. onClick: _ctx.handleClearClick
  38376. }, {
  38377. default: withCtx(() => [
  38378. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  38379. ]),
  38380. _: 1
  38381. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  38382. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
  38383. key: 2,
  38384. class: normalizeClass([
  38385. _ctx.nsInput.e("icon"),
  38386. _ctx.nsInput.e("validateIcon"),
  38387. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  38388. ])
  38389. }, {
  38390. default: withCtx(() => [
  38391. (openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))
  38392. ]),
  38393. _: 1
  38394. }, 8, ["class"])) : createCommentVNode("v-if", true)
  38395. ], 2)
  38396. ], 10, ["onClick"])
  38397. ];
  38398. }),
  38399. content: withCtx(() => [
  38400. createVNode(_component_el_select_menu, { ref: "menuRef" }, {
  38401. default: withCtx(() => [
  38402. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  38403. key: 0,
  38404. class: normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  38405. onClick: withModifiers(() => {
  38406. }, ["stop"])
  38407. }, [
  38408. renderSlot(_ctx.$slots, "header")
  38409. ], 10, ["onClick"])) : createCommentVNode("v-if", true),
  38410. withDirectives(createVNode(_component_el_scrollbar, {
  38411. id: _ctx.contentId,
  38412. ref: "scrollbarRef",
  38413. tag: "ul",
  38414. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  38415. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  38416. class: normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
  38417. role: "listbox",
  38418. "aria-label": _ctx.ariaLabel,
  38419. "aria-orientation": "vertical",
  38420. onScroll: _ctx.popupScroll
  38421. }, {
  38422. default: withCtx(() => [
  38423. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  38424. key: 0,
  38425. value: _ctx.states.inputValue,
  38426. created: true
  38427. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  38428. createVNode(_component_el_options, null, {
  38429. default: withCtx(() => [
  38430. renderSlot(_ctx.$slots, "default", {}, () => [
  38431. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
  38432. var _a;
  38433. return openBlock(), createElementBlock(Fragment, { key: index }, [
  38434. ((_a = _ctx.getOptions(option)) == null ? void 0 : _a.length) ? (openBlock(), createBlock(_component_el_option_group, {
  38435. key: 0,
  38436. label: _ctx.getLabel(option),
  38437. disabled: _ctx.getDisabled(option)
  38438. }, {
  38439. default: withCtx(() => [
  38440. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.getOptions(option), (item) => {
  38441. return openBlock(), createBlock(_component_el_option, mergeProps({
  38442. key: _ctx.getValue(item)
  38443. }, _ctx.getOptionProps(item)), null, 16);
  38444. }), 128))
  38445. ]),
  38446. _: 2
  38447. }, 1032, ["label", "disabled"])) : (openBlock(), createBlock(_component_el_option, normalizeProps(mergeProps({ key: 1 }, _ctx.getOptionProps(option))), null, 16))
  38448. ], 64);
  38449. }), 128))
  38450. ])
  38451. ]),
  38452. _: 3
  38453. })
  38454. ]),
  38455. _: 3
  38456. }, 8, ["id", "wrap-class", "view-class", "class", "aria-label", "onScroll"]), [
  38457. [vShow, _ctx.states.options.size > 0 && !_ctx.loading]
  38458. ]),
  38459. _ctx.$slots.loading && _ctx.loading ? (openBlock(), createElementBlock("div", {
  38460. key: 1,
  38461. class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  38462. }, [
  38463. renderSlot(_ctx.$slots, "loading")
  38464. ], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (openBlock(), createElementBlock("div", {
  38465. key: 2,
  38466. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  38467. }, [
  38468. renderSlot(_ctx.$slots, "empty", {}, () => [
  38469. createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)
  38470. ])
  38471. ], 2)) : createCommentVNode("v-if", true),
  38472. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  38473. key: 3,
  38474. class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  38475. onClick: withModifiers(() => {
  38476. }, ["stop"])
  38477. }, [
  38478. renderSlot(_ctx.$slots, "footer")
  38479. ], 10, ["onClick"])) : createCommentVNode("v-if", true)
  38480. ]),
  38481. _: 3
  38482. }, 512)
  38483. ]),
  38484. _: 3
  38485. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-style", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  38486. ], 16, ["onMouseleave"])), [
  38487. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  38488. ]);
  38489. }
  38490. var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["render", _sfc_render$8], ["__file", "select.vue"]]);
  38491. const ElSelect = withInstall(Select$1, {
  38492. Option,
  38493. OptionGroup
  38494. });
  38495. const ElOption = withNoopInstall(Option);
  38496. const ElOptionGroup = withNoopInstall(OptionGroup);
  38497. const usePagination = () => inject(elPaginationKey, {});
  38498. const paginationSizesProps = buildProps({
  38499. pageSize: {
  38500. type: Number,
  38501. required: true
  38502. },
  38503. pageSizes: {
  38504. type: definePropType(Array),
  38505. default: () => mutable([10, 20, 30, 40, 50, 100])
  38506. },
  38507. popperClass: {
  38508. type: String
  38509. },
  38510. popperStyle: {
  38511. type: definePropType([String, Object])
  38512. },
  38513. disabled: Boolean,
  38514. teleported: Boolean,
  38515. size: {
  38516. type: String,
  38517. values: componentSizes
  38518. },
  38519. appendSizeTo: String
  38520. });
  38521. const __default__$K = defineComponent({
  38522. name: "ElPaginationSizes"
  38523. });
  38524. const _sfc_main$U = /* @__PURE__ */ defineComponent({
  38525. ...__default__$K,
  38526. props: paginationSizesProps,
  38527. emits: ["page-size-change"],
  38528. setup(__props, { emit }) {
  38529. const props = __props;
  38530. const { t } = useLocale();
  38531. const ns = useNamespace("pagination");
  38532. const pagination = usePagination();
  38533. const innerPageSize = ref(props.pageSize);
  38534. watch(() => props.pageSizes, (newVal, oldVal) => {
  38535. if (isEqual$1(newVal, oldVal))
  38536. return;
  38537. if (isArray$1(newVal)) {
  38538. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  38539. emit("page-size-change", pageSize);
  38540. }
  38541. });
  38542. watch(() => props.pageSize, (newVal) => {
  38543. innerPageSize.value = newVal;
  38544. });
  38545. const innerPageSizes = computed(() => props.pageSizes);
  38546. function handleChange(val) {
  38547. var _a;
  38548. if (val !== innerPageSize.value) {
  38549. innerPageSize.value = val;
  38550. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  38551. }
  38552. }
  38553. return (_ctx, _cache) => {
  38554. return openBlock(), createElementBlock("span", {
  38555. class: normalizeClass(unref(ns).e("sizes"))
  38556. }, [
  38557. createVNode(unref(ElSelect), {
  38558. "model-value": innerPageSize.value,
  38559. disabled: _ctx.disabled,
  38560. "popper-class": _ctx.popperClass,
  38561. "popper-style": _ctx.popperStyle,
  38562. size: _ctx.size,
  38563. teleported: _ctx.teleported,
  38564. "validate-event": false,
  38565. "append-to": _ctx.appendSizeTo,
  38566. onChange: handleChange
  38567. }, {
  38568. default: withCtx(() => [
  38569. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(innerPageSizes), (item) => {
  38570. return openBlock(), createBlock(unref(ElOption), {
  38571. key: item,
  38572. value: item,
  38573. label: item + unref(t)("el.pagination.pagesize")
  38574. }, null, 8, ["value", "label"]);
  38575. }), 128))
  38576. ]),
  38577. _: 1
  38578. }, 8, ["model-value", "disabled", "popper-class", "popper-style", "size", "teleported", "append-to"])
  38579. ], 2);
  38580. };
  38581. }
  38582. });
  38583. var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__file", "sizes.vue"]]);
  38584. const paginationJumperProps = buildProps({
  38585. size: {
  38586. type: String,
  38587. values: componentSizes
  38588. }
  38589. });
  38590. const __default__$J = defineComponent({
  38591. name: "ElPaginationJumper"
  38592. });
  38593. const _sfc_main$T = /* @__PURE__ */ defineComponent({
  38594. ...__default__$J,
  38595. props: paginationJumperProps,
  38596. setup(__props) {
  38597. const { t } = useLocale();
  38598. const ns = useNamespace("pagination");
  38599. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  38600. const userInput = ref();
  38601. const innerValue = computed(() => {
  38602. var _a;
  38603. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  38604. });
  38605. function handleInput(val) {
  38606. userInput.value = val ? +val : "";
  38607. }
  38608. function handleChange(val) {
  38609. val = Math.trunc(+val);
  38610. changeEvent == null ? void 0 : changeEvent(val);
  38611. userInput.value = void 0;
  38612. }
  38613. return (_ctx, _cache) => {
  38614. return openBlock(), createElementBlock("span", {
  38615. class: normalizeClass(unref(ns).e("jump")),
  38616. disabled: unref(disabled)
  38617. }, [
  38618. createElementVNode("span", {
  38619. class: normalizeClass([unref(ns).e("goto")])
  38620. }, toDisplayString(unref(t)("el.pagination.goto")), 3),
  38621. createVNode(unref(ElInput), {
  38622. size: _ctx.size,
  38623. class: normalizeClass([unref(ns).e("editor"), unref(ns).is("in-pagination")]),
  38624. min: 1,
  38625. max: unref(pageCount),
  38626. disabled: unref(disabled),
  38627. "model-value": unref(innerValue),
  38628. "validate-event": false,
  38629. "aria-label": unref(t)("el.pagination.page"),
  38630. type: "number",
  38631. "onUpdate:modelValue": handleInput,
  38632. onChange: handleChange
  38633. }, null, 8, ["size", "class", "max", "disabled", "model-value", "aria-label"]),
  38634. createElementVNode("span", {
  38635. class: normalizeClass([unref(ns).e("classifier")])
  38636. }, toDisplayString(unref(t)("el.pagination.pageClassifier")), 3)
  38637. ], 10, ["disabled"]);
  38638. };
  38639. }
  38640. });
  38641. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__file", "jumper.vue"]]);
  38642. const paginationTotalProps = buildProps({
  38643. total: {
  38644. type: Number,
  38645. default: 1e3
  38646. }
  38647. });
  38648. const __default__$I = defineComponent({
  38649. name: "ElPaginationTotal"
  38650. });
  38651. const _sfc_main$S = /* @__PURE__ */ defineComponent({
  38652. ...__default__$I,
  38653. props: paginationTotalProps,
  38654. setup(__props) {
  38655. const { t } = useLocale();
  38656. const ns = useNamespace("pagination");
  38657. const { disabled } = usePagination();
  38658. return (_ctx, _cache) => {
  38659. return openBlock(), createElementBlock("span", {
  38660. class: normalizeClass(unref(ns).e("total")),
  38661. disabled: unref(disabled)
  38662. }, toDisplayString(unref(t)("el.pagination.total", {
  38663. total: _ctx.total
  38664. })), 11, ["disabled"]);
  38665. };
  38666. }
  38667. });
  38668. var Total = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__file", "total.vue"]]);
  38669. const paginationPagerProps = buildProps({
  38670. currentPage: {
  38671. type: Number,
  38672. default: 1
  38673. },
  38674. pageCount: {
  38675. type: Number,
  38676. required: true
  38677. },
  38678. pagerCount: {
  38679. type: Number,
  38680. default: 7
  38681. },
  38682. disabled: Boolean
  38683. });
  38684. const __default__$H = defineComponent({
  38685. name: "ElPaginationPager"
  38686. });
  38687. const _sfc_main$R = /* @__PURE__ */ defineComponent({
  38688. ...__default__$H,
  38689. props: paginationPagerProps,
  38690. emits: [CHANGE_EVENT],
  38691. setup(__props, { emit }) {
  38692. const props = __props;
  38693. const nsPager = useNamespace("pager");
  38694. const nsIcon = useNamespace("icon");
  38695. const { t } = useLocale();
  38696. const showPrevMore = ref(false);
  38697. const showNextMore = ref(false);
  38698. const quickPrevHover = ref(false);
  38699. const quickNextHover = ref(false);
  38700. const quickPrevFocus = ref(false);
  38701. const quickNextFocus = ref(false);
  38702. const pagers = computed(() => {
  38703. const pagerCount = props.pagerCount;
  38704. const halfPagerCount = (pagerCount - 1) / 2;
  38705. const currentPage = Number(props.currentPage);
  38706. const pageCount = Number(props.pageCount);
  38707. let showPrevMore2 = false;
  38708. let showNextMore2 = false;
  38709. if (pageCount > pagerCount) {
  38710. if (currentPage > pagerCount - halfPagerCount) {
  38711. showPrevMore2 = true;
  38712. }
  38713. if (currentPage < pageCount - halfPagerCount) {
  38714. showNextMore2 = true;
  38715. }
  38716. }
  38717. const array = [];
  38718. if (showPrevMore2 && !showNextMore2) {
  38719. const startPage = pageCount - (pagerCount - 2);
  38720. for (let i = startPage; i < pageCount; i++) {
  38721. array.push(i);
  38722. }
  38723. } else if (!showPrevMore2 && showNextMore2) {
  38724. for (let i = 2; i < pagerCount; i++) {
  38725. array.push(i);
  38726. }
  38727. } else if (showPrevMore2 && showNextMore2) {
  38728. const offset = Math.floor(pagerCount / 2) - 1;
  38729. for (let i = currentPage - offset; i <= currentPage + offset; i++) {
  38730. array.push(i);
  38731. }
  38732. } else {
  38733. for (let i = 2; i < pageCount; i++) {
  38734. array.push(i);
  38735. }
  38736. }
  38737. return array;
  38738. });
  38739. const prevMoreKls = computed(() => [
  38740. "more",
  38741. "btn-quickprev",
  38742. nsIcon.b(),
  38743. nsPager.is("disabled", props.disabled)
  38744. ]);
  38745. const nextMoreKls = computed(() => [
  38746. "more",
  38747. "btn-quicknext",
  38748. nsIcon.b(),
  38749. nsPager.is("disabled", props.disabled)
  38750. ]);
  38751. const tabindex = computed(() => props.disabled ? -1 : 0);
  38752. watch(() => [props.pageCount, props.pagerCount, props.currentPage], ([pageCount, pagerCount, currentPage]) => {
  38753. const halfPagerCount = (pagerCount - 1) / 2;
  38754. let showPrev = false;
  38755. let showNext = false;
  38756. if (pageCount > pagerCount) {
  38757. showPrev = currentPage > pagerCount - halfPagerCount;
  38758. showNext = currentPage < pageCount - halfPagerCount;
  38759. }
  38760. quickPrevHover.value && (quickPrevHover.value = showPrev);
  38761. quickNextHover.value && (quickNextHover.value = showNext);
  38762. showPrevMore.value = showPrev;
  38763. showNextMore.value = showNext;
  38764. }, { immediate: true });
  38765. function onMouseEnter(forward = false) {
  38766. if (props.disabled)
  38767. return;
  38768. if (forward) {
  38769. quickPrevHover.value = true;
  38770. } else {
  38771. quickNextHover.value = true;
  38772. }
  38773. }
  38774. function onFocus(forward = false) {
  38775. if (forward) {
  38776. quickPrevFocus.value = true;
  38777. } else {
  38778. quickNextFocus.value = true;
  38779. }
  38780. }
  38781. function onEnter(e) {
  38782. const target = e.target;
  38783. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  38784. const newPage = Number(target.textContent);
  38785. if (newPage !== props.currentPage) {
  38786. emit(CHANGE_EVENT, newPage);
  38787. }
  38788. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  38789. onPagerClick(e);
  38790. }
  38791. }
  38792. function onPagerClick(event) {
  38793. const target = event.target;
  38794. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  38795. return;
  38796. }
  38797. let newPage = Number(target.textContent);
  38798. const pageCount = props.pageCount;
  38799. const currentPage = props.currentPage;
  38800. const pagerCountOffset = props.pagerCount - 2;
  38801. if (target.className.includes("more")) {
  38802. if (target.className.includes("quickprev")) {
  38803. newPage = currentPage - pagerCountOffset;
  38804. } else if (target.className.includes("quicknext")) {
  38805. newPage = currentPage + pagerCountOffset;
  38806. }
  38807. }
  38808. if (!Number.isNaN(+newPage)) {
  38809. if (newPage < 1) {
  38810. newPage = 1;
  38811. }
  38812. if (newPage > pageCount) {
  38813. newPage = pageCount;
  38814. }
  38815. }
  38816. if (newPage !== currentPage) {
  38817. emit(CHANGE_EVENT, newPage);
  38818. }
  38819. }
  38820. return (_ctx, _cache) => {
  38821. return openBlock(), createElementBlock("ul", {
  38822. class: normalizeClass(unref(nsPager).b()),
  38823. onClick: onPagerClick,
  38824. onKeyup: withKeys(onEnter, ["enter"])
  38825. }, [
  38826. _ctx.pageCount > 0 ? (openBlock(), createElementBlock("li", {
  38827. key: 0,
  38828. class: normalizeClass([[
  38829. unref(nsPager).is("active", _ctx.currentPage === 1),
  38830. unref(nsPager).is("disabled", _ctx.disabled)
  38831. ], "number"]),
  38832. "aria-current": _ctx.currentPage === 1,
  38833. "aria-label": unref(t)("el.pagination.currentPage", { pager: 1 }),
  38834. tabindex: unref(tabindex)
  38835. }, " 1 ", 10, ["aria-current", "aria-label", "tabindex"])) : createCommentVNode("v-if", true),
  38836. showPrevMore.value ? (openBlock(), createElementBlock("li", {
  38837. key: 1,
  38838. class: normalizeClass(unref(prevMoreKls)),
  38839. tabindex: unref(tabindex),
  38840. "aria-label": unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  38841. onMouseenter: ($event) => onMouseEnter(true),
  38842. onMouseleave: ($event) => quickPrevHover.value = false,
  38843. onFocus: ($event) => onFocus(true),
  38844. onBlur: ($event) => quickPrevFocus.value = false
  38845. }, [
  38846. (quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_left_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))
  38847. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : createCommentVNode("v-if", true),
  38848. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(pagers), (pager) => {
  38849. return openBlock(), createElementBlock("li", {
  38850. key: pager,
  38851. class: normalizeClass([[
  38852. unref(nsPager).is("active", _ctx.currentPage === pager),
  38853. unref(nsPager).is("disabled", _ctx.disabled)
  38854. ], "number"]),
  38855. "aria-current": _ctx.currentPage === pager,
  38856. "aria-label": unref(t)("el.pagination.currentPage", { pager }),
  38857. tabindex: unref(tabindex)
  38858. }, toDisplayString(pager), 11, ["aria-current", "aria-label", "tabindex"]);
  38859. }), 128)),
  38860. showNextMore.value ? (openBlock(), createElementBlock("li", {
  38861. key: 2,
  38862. class: normalizeClass(unref(nextMoreKls)),
  38863. tabindex: unref(tabindex),
  38864. "aria-label": unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  38865. onMouseenter: ($event) => onMouseEnter(),
  38866. onMouseleave: ($event) => quickNextHover.value = false,
  38867. onFocus: ($event) => onFocus(),
  38868. onBlur: ($event) => quickNextFocus.value = false
  38869. }, [
  38870. (quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_right_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))
  38871. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : createCommentVNode("v-if", true),
  38872. _ctx.pageCount > 1 ? (openBlock(), createElementBlock("li", {
  38873. key: 3,
  38874. class: normalizeClass([[
  38875. unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  38876. unref(nsPager).is("disabled", _ctx.disabled)
  38877. ], "number"]),
  38878. "aria-current": _ctx.currentPage === _ctx.pageCount,
  38879. "aria-label": unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  38880. tabindex: unref(tabindex)
  38881. }, toDisplayString(_ctx.pageCount), 11, ["aria-current", "aria-label", "tabindex"])) : createCommentVNode("v-if", true)
  38882. ], 42, ["onKeyup"]);
  38883. };
  38884. }
  38885. });
  38886. var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "pager.vue"]]);
  38887. const isAbsent = (v) => typeof v !== "number";
  38888. const paginationProps = buildProps({
  38889. pageSize: Number,
  38890. defaultPageSize: Number,
  38891. total: Number,
  38892. pageCount: Number,
  38893. pagerCount: {
  38894. type: Number,
  38895. validator: (value) => {
  38896. return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  38897. },
  38898. default: 7
  38899. },
  38900. currentPage: Number,
  38901. defaultCurrentPage: Number,
  38902. layout: {
  38903. type: String,
  38904. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  38905. },
  38906. pageSizes: {
  38907. type: definePropType(Array),
  38908. default: () => mutable([10, 20, 30, 40, 50, 100])
  38909. },
  38910. popperClass: {
  38911. type: String,
  38912. default: ""
  38913. },
  38914. popperStyle: {
  38915. type: definePropType([String, Object])
  38916. },
  38917. prevText: {
  38918. type: String,
  38919. default: ""
  38920. },
  38921. prevIcon: {
  38922. type: iconPropType,
  38923. default: () => arrow_left_default
  38924. },
  38925. nextText: {
  38926. type: String,
  38927. default: ""
  38928. },
  38929. nextIcon: {
  38930. type: iconPropType,
  38931. default: () => arrow_right_default
  38932. },
  38933. teleported: {
  38934. type: Boolean,
  38935. default: true
  38936. },
  38937. small: Boolean,
  38938. size: useSizeProp,
  38939. background: Boolean,
  38940. disabled: Boolean,
  38941. hideOnSinglePage: Boolean,
  38942. appendSizeTo: String
  38943. });
  38944. const paginationEmits = {
  38945. "update:current-page": (val) => isNumber(val),
  38946. "update:page-size": (val) => isNumber(val),
  38947. "size-change": (val) => isNumber(val),
  38948. change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
  38949. "current-change": (val) => isNumber(val),
  38950. "prev-click": (val) => isNumber(val),
  38951. "next-click": (val) => isNumber(val)
  38952. };
  38953. const componentName = "ElPagination";
  38954. var Pagination = defineComponent({
  38955. name: componentName,
  38956. props: paginationProps,
  38957. emits: paginationEmits,
  38958. setup(props, { emit, slots }) {
  38959. const { t } = useLocale();
  38960. const ns = useNamespace("pagination");
  38961. const vnodeProps = getCurrentInstance().vnode.props || {};
  38962. const _globalSize = useGlobalSize();
  38963. const _size = computed(() => {
  38964. var _a;
  38965. return props.small ? "small" : (_a = props.size) != null ? _a : _globalSize.value;
  38966. });
  38967. useDeprecated({
  38968. from: "small",
  38969. replacement: "size",
  38970. version: "3.0.0",
  38971. scope: "el-pagination",
  38972. ref: "https://element-plus.org/zh-CN/component/pagination.html"
  38973. }, computed(() => !!props.small));
  38974. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  38975. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  38976. const assertValidUsage = computed(() => {
  38977. if (isAbsent(props.total) && isAbsent(props.pageCount))
  38978. return false;
  38979. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  38980. return false;
  38981. if (props.layout.includes("sizes")) {
  38982. if (!isAbsent(props.pageCount)) {
  38983. if (!hasPageSizeListener)
  38984. return false;
  38985. } else if (!isAbsent(props.total)) {
  38986. if (!isAbsent(props.pageSize)) {
  38987. if (!hasPageSizeListener) {
  38988. return false;
  38989. }
  38990. }
  38991. }
  38992. }
  38993. return true;
  38994. });
  38995. const innerPageSize = ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  38996. const innerCurrentPage = ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  38997. const pageSizeBridge = computed({
  38998. get() {
  38999. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  39000. },
  39001. set(v) {
  39002. if (isAbsent(props.pageSize)) {
  39003. innerPageSize.value = v;
  39004. }
  39005. if (hasPageSizeListener) {
  39006. emit("update:page-size", v);
  39007. emit("size-change", v);
  39008. }
  39009. }
  39010. });
  39011. const pageCountBridge = computed(() => {
  39012. let pageCount = 0;
  39013. if (!isAbsent(props.pageCount)) {
  39014. pageCount = props.pageCount;
  39015. } else if (!isAbsent(props.total)) {
  39016. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  39017. }
  39018. return pageCount;
  39019. });
  39020. const currentPageBridge = computed({
  39021. get() {
  39022. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  39023. },
  39024. set(v) {
  39025. let newCurrentPage = v;
  39026. if (v < 1) {
  39027. newCurrentPage = 1;
  39028. } else if (v > pageCountBridge.value) {
  39029. newCurrentPage = pageCountBridge.value;
  39030. }
  39031. if (isAbsent(props.currentPage)) {
  39032. innerCurrentPage.value = newCurrentPage;
  39033. }
  39034. if (hasCurrentPageListener) {
  39035. emit("update:current-page", newCurrentPage);
  39036. emit("current-change", newCurrentPage);
  39037. }
  39038. }
  39039. });
  39040. watch(pageCountBridge, (val) => {
  39041. if (currentPageBridge.value > val)
  39042. currentPageBridge.value = val;
  39043. });
  39044. watch([currentPageBridge, pageSizeBridge], (value) => {
  39045. emit(CHANGE_EVENT, ...value);
  39046. }, { flush: "post" });
  39047. function handleCurrentChange(val) {
  39048. currentPageBridge.value = val;
  39049. }
  39050. function handleSizeChange(val) {
  39051. pageSizeBridge.value = val;
  39052. const newPageCount = pageCountBridge.value;
  39053. if (currentPageBridge.value > newPageCount) {
  39054. currentPageBridge.value = newPageCount;
  39055. }
  39056. }
  39057. function prev() {
  39058. if (props.disabled)
  39059. return;
  39060. currentPageBridge.value -= 1;
  39061. emit("prev-click", currentPageBridge.value);
  39062. }
  39063. function next() {
  39064. if (props.disabled)
  39065. return;
  39066. currentPageBridge.value += 1;
  39067. emit("next-click", currentPageBridge.value);
  39068. }
  39069. function addClass(element, cls) {
  39070. if (element) {
  39071. if (!element.props) {
  39072. element.props = {};
  39073. }
  39074. element.props.class = [element.props.class, cls].join(" ");
  39075. }
  39076. }
  39077. provide(elPaginationKey, {
  39078. pageCount: pageCountBridge,
  39079. disabled: computed(() => props.disabled),
  39080. currentPage: currentPageBridge,
  39081. changeEvent: handleCurrentChange,
  39082. handleSizeChange
  39083. });
  39084. return () => {
  39085. var _a, _b;
  39086. if (!assertValidUsage.value) {
  39087. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  39088. return null;
  39089. }
  39090. if (!props.layout)
  39091. return null;
  39092. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  39093. return null;
  39094. const rootChildren = [];
  39095. const rightWrapperChildren = [];
  39096. const rightWrapperRoot = h$1("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  39097. const TEMPLATE_MAP = {
  39098. prev: h$1(Prev, {
  39099. disabled: props.disabled,
  39100. currentPage: currentPageBridge.value,
  39101. prevText: props.prevText,
  39102. prevIcon: props.prevIcon,
  39103. onClick: prev
  39104. }),
  39105. jumper: h$1(Jumper, {
  39106. size: _size.value
  39107. }),
  39108. pager: h$1(Pager, {
  39109. currentPage: currentPageBridge.value,
  39110. pageCount: pageCountBridge.value,
  39111. pagerCount: props.pagerCount,
  39112. onChange: handleCurrentChange,
  39113. disabled: props.disabled
  39114. }),
  39115. next: h$1(Next, {
  39116. disabled: props.disabled,
  39117. currentPage: currentPageBridge.value,
  39118. pageCount: pageCountBridge.value,
  39119. nextText: props.nextText,
  39120. nextIcon: props.nextIcon,
  39121. onClick: next
  39122. }),
  39123. sizes: h$1(Sizes, {
  39124. pageSize: pageSizeBridge.value,
  39125. pageSizes: props.pageSizes,
  39126. popperClass: props.popperClass,
  39127. popperStyle: props.popperStyle,
  39128. disabled: props.disabled,
  39129. teleported: props.teleported,
  39130. size: _size.value,
  39131. appendSizeTo: props.appendSizeTo
  39132. }),
  39133. slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
  39134. total: h$1(Total, { total: isAbsent(props.total) ? 0 : props.total })
  39135. };
  39136. const components = props.layout.split(",").map((item) => item.trim());
  39137. let haveRightWrapper = false;
  39138. components.forEach((c) => {
  39139. if (c === "->") {
  39140. haveRightWrapper = true;
  39141. return;
  39142. }
  39143. if (!haveRightWrapper) {
  39144. rootChildren.push(TEMPLATE_MAP[c]);
  39145. } else {
  39146. rightWrapperChildren.push(TEMPLATE_MAP[c]);
  39147. }
  39148. });
  39149. addClass(rootChildren[0], ns.is("first"));
  39150. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  39151. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  39152. addClass(rightWrapperChildren[0], ns.is("first"));
  39153. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  39154. rootChildren.push(rightWrapperRoot);
  39155. }
  39156. return h$1("div", {
  39157. class: [
  39158. ns.b(),
  39159. ns.is("background", props.background),
  39160. ns.m(_size.value)
  39161. ]
  39162. }, rootChildren);
  39163. };
  39164. }
  39165. });
  39166. const ElPagination = withInstall(Pagination);
  39167. const popconfirmProps = buildProps({
  39168. title: String,
  39169. confirmButtonText: String,
  39170. cancelButtonText: String,
  39171. confirmButtonType: {
  39172. type: String,
  39173. values: buttonTypes,
  39174. default: "primary"
  39175. },
  39176. cancelButtonType: {
  39177. type: String,
  39178. values: buttonTypes,
  39179. default: "text"
  39180. },
  39181. icon: {
  39182. type: iconPropType,
  39183. default: () => question_filled_default
  39184. },
  39185. iconColor: {
  39186. type: String,
  39187. default: "#f90"
  39188. },
  39189. hideIcon: Boolean,
  39190. hideAfter: {
  39191. type: Number,
  39192. default: 200
  39193. },
  39194. effect: {
  39195. ...useTooltipContentProps.effect,
  39196. default: "light"
  39197. },
  39198. teleported: useTooltipContentProps.teleported,
  39199. persistent: useTooltipContentProps.persistent,
  39200. width: {
  39201. type: [String, Number],
  39202. default: 150
  39203. },
  39204. virtualTriggering: useTooltipTriggerProps.virtualTriggering,
  39205. virtualRef: useTooltipTriggerProps.virtualRef
  39206. });
  39207. const popconfirmEmits = {
  39208. confirm: (e) => e instanceof MouseEvent,
  39209. cancel: (e) => e instanceof MouseEvent
  39210. };
  39211. const __default__$G = defineComponent({
  39212. name: "ElPopconfirm"
  39213. });
  39214. const _sfc_main$Q = /* @__PURE__ */ defineComponent({
  39215. ...__default__$G,
  39216. props: popconfirmProps,
  39217. emits: popconfirmEmits,
  39218. setup(__props, { expose, emit }) {
  39219. const props = __props;
  39220. const { t } = useLocale();
  39221. const ns = useNamespace("popconfirm");
  39222. const tooltipRef = ref();
  39223. const rootRef = ref();
  39224. const popperRef = computed(() => {
  39225. var _a;
  39226. return (_a = unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  39227. });
  39228. const showPopper = () => {
  39229. var _a, _b;
  39230. (_b = (_a = rootRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  39231. };
  39232. const hidePopper = () => {
  39233. var _a, _b;
  39234. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
  39235. };
  39236. const style = computed(() => {
  39237. return {
  39238. width: addUnit(props.width)
  39239. };
  39240. });
  39241. const confirm = (e) => {
  39242. emit("confirm", e);
  39243. hidePopper();
  39244. };
  39245. const cancel = (e) => {
  39246. emit("cancel", e);
  39247. hidePopper();
  39248. };
  39249. const finalConfirmButtonText = computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  39250. const finalCancelButtonText = computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  39251. expose({
  39252. popperRef,
  39253. hide: hidePopper
  39254. });
  39255. return (_ctx, _cache) => {
  39256. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  39257. ref_key: "tooltipRef",
  39258. ref: tooltipRef,
  39259. trigger: "click",
  39260. effect: _ctx.effect
  39261. }, _ctx.$attrs, {
  39262. "popper-class": `${unref(ns).namespace.value}-popover`,
  39263. "popper-style": unref(style),
  39264. teleported: _ctx.teleported,
  39265. "fallback-placements": ["bottom", "top", "right", "left"],
  39266. "hide-after": _ctx.hideAfter,
  39267. persistent: _ctx.persistent,
  39268. loop: "",
  39269. onShow: showPopper
  39270. }), {
  39271. content: withCtx(() => [
  39272. createElementVNode("div", {
  39273. ref_key: "rootRef",
  39274. ref: rootRef,
  39275. tabindex: "-1",
  39276. class: normalizeClass(unref(ns).b())
  39277. }, [
  39278. createElementVNode("div", {
  39279. class: normalizeClass(unref(ns).e("main"))
  39280. }, [
  39281. !_ctx.hideIcon && _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  39282. key: 0,
  39283. class: normalizeClass(unref(ns).e("icon")),
  39284. style: normalizeStyle({ color: _ctx.iconColor })
  39285. }, {
  39286. default: withCtx(() => [
  39287. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  39288. ]),
  39289. _: 1
  39290. }, 8, ["class", "style"])) : createCommentVNode("v-if", true),
  39291. createTextVNode(" " + toDisplayString(_ctx.title), 1)
  39292. ], 2),
  39293. createElementVNode("div", {
  39294. class: normalizeClass(unref(ns).e("action"))
  39295. }, [
  39296. renderSlot(_ctx.$slots, "actions", {
  39297. confirm,
  39298. cancel
  39299. }, () => [
  39300. createVNode(unref(ElButton), {
  39301. size: "small",
  39302. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  39303. text: _ctx.cancelButtonType === "text",
  39304. onClick: cancel
  39305. }, {
  39306. default: withCtx(() => [
  39307. createTextVNode(toDisplayString(unref(finalCancelButtonText)), 1)
  39308. ]),
  39309. _: 1
  39310. }, 8, ["type", "text"]),
  39311. createVNode(unref(ElButton), {
  39312. size: "small",
  39313. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  39314. text: _ctx.confirmButtonType === "text",
  39315. onClick: confirm
  39316. }, {
  39317. default: withCtx(() => [
  39318. createTextVNode(toDisplayString(unref(finalConfirmButtonText)), 1)
  39319. ]),
  39320. _: 1
  39321. }, 8, ["type", "text"])
  39322. ])
  39323. ], 2)
  39324. ], 2)
  39325. ]),
  39326. default: withCtx(() => [
  39327. _ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
  39328. ]),
  39329. _: 3
  39330. }, 16, ["effect", "popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  39331. };
  39332. }
  39333. });
  39334. var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__file", "popconfirm.vue"]]);
  39335. const ElPopconfirm = withInstall(Popconfirm);
  39336. const popoverProps = buildProps({
  39337. trigger: useTooltipTriggerProps.trigger,
  39338. triggerKeys: useTooltipTriggerProps.triggerKeys,
  39339. placement: dropdownProps.placement,
  39340. disabled: useTooltipTriggerProps.disabled,
  39341. visible: useTooltipContentProps.visible,
  39342. transition: useTooltipContentProps.transition,
  39343. popperOptions: dropdownProps.popperOptions,
  39344. tabindex: dropdownProps.tabindex,
  39345. content: useTooltipContentProps.content,
  39346. popperStyle: useTooltipContentProps.popperStyle,
  39347. popperClass: useTooltipContentProps.popperClass,
  39348. enterable: {
  39349. ...useTooltipContentProps.enterable,
  39350. default: true
  39351. },
  39352. effect: {
  39353. ...useTooltipContentProps.effect,
  39354. default: "light"
  39355. },
  39356. teleported: useTooltipContentProps.teleported,
  39357. appendTo: useTooltipContentProps.appendTo,
  39358. title: String,
  39359. width: {
  39360. type: [String, Number],
  39361. default: 150
  39362. },
  39363. offset: {
  39364. type: Number,
  39365. default: void 0
  39366. },
  39367. showAfter: {
  39368. type: Number,
  39369. default: 0
  39370. },
  39371. hideAfter: {
  39372. type: Number,
  39373. default: 200
  39374. },
  39375. autoClose: {
  39376. type: Number,
  39377. default: 0
  39378. },
  39379. showArrow: {
  39380. type: Boolean,
  39381. default: true
  39382. },
  39383. persistent: {
  39384. type: Boolean,
  39385. default: true
  39386. },
  39387. "onUpdate:visible": {
  39388. type: Function
  39389. }
  39390. });
  39391. const popoverEmits = {
  39392. "update:visible": (value) => isBoolean(value),
  39393. "before-enter": () => true,
  39394. "before-leave": () => true,
  39395. "after-enter": () => true,
  39396. "after-leave": () => true
  39397. };
  39398. const updateEventKeyRaw = `onUpdate:visible`;
  39399. const __default__$F = defineComponent({
  39400. name: "ElPopover"
  39401. });
  39402. const _sfc_main$P = /* @__PURE__ */ defineComponent({
  39403. ...__default__$F,
  39404. props: popoverProps,
  39405. emits: popoverEmits,
  39406. setup(__props, { expose, emit }) {
  39407. const props = __props;
  39408. const onUpdateVisible = computed(() => {
  39409. return props[updateEventKeyRaw];
  39410. });
  39411. const ns = useNamespace("popover");
  39412. const tooltipRef = ref();
  39413. const popperRef = computed(() => {
  39414. var _a;
  39415. return (_a = unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  39416. });
  39417. const style = computed(() => {
  39418. return [
  39419. {
  39420. width: addUnit(props.width)
  39421. },
  39422. props.popperStyle
  39423. ];
  39424. });
  39425. const kls = computed(() => {
  39426. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  39427. });
  39428. const gpuAcceleration = computed(() => {
  39429. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  39430. });
  39431. const hide = () => {
  39432. var _a;
  39433. (_a = tooltipRef.value) == null ? void 0 : _a.hide();
  39434. };
  39435. const beforeEnter = () => {
  39436. emit("before-enter");
  39437. };
  39438. const beforeLeave = () => {
  39439. emit("before-leave");
  39440. };
  39441. const afterEnter = () => {
  39442. emit("after-enter");
  39443. };
  39444. const afterLeave = () => {
  39445. emit("update:visible", false);
  39446. emit("after-leave");
  39447. };
  39448. expose({
  39449. popperRef,
  39450. hide
  39451. });
  39452. return (_ctx, _cache) => {
  39453. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  39454. ref_key: "tooltipRef",
  39455. ref: tooltipRef
  39456. }, _ctx.$attrs, {
  39457. trigger: _ctx.trigger,
  39458. "trigger-keys": _ctx.triggerKeys,
  39459. placement: _ctx.placement,
  39460. disabled: _ctx.disabled,
  39461. visible: _ctx.visible,
  39462. transition: _ctx.transition,
  39463. "popper-options": _ctx.popperOptions,
  39464. tabindex: _ctx.tabindex,
  39465. content: _ctx.content,
  39466. offset: _ctx.offset,
  39467. "show-after": _ctx.showAfter,
  39468. "hide-after": _ctx.hideAfter,
  39469. "auto-close": _ctx.autoClose,
  39470. "show-arrow": _ctx.showArrow,
  39471. "aria-label": _ctx.title,
  39472. effect: _ctx.effect,
  39473. enterable: _ctx.enterable,
  39474. "popper-class": unref(kls),
  39475. "popper-style": unref(style),
  39476. teleported: _ctx.teleported,
  39477. "append-to": _ctx.appendTo,
  39478. persistent: _ctx.persistent,
  39479. "gpu-acceleration": unref(gpuAcceleration),
  39480. "onUpdate:visible": unref(onUpdateVisible),
  39481. onBeforeShow: beforeEnter,
  39482. onBeforeHide: beforeLeave,
  39483. onShow: afterEnter,
  39484. onHide: afterLeave
  39485. }), {
  39486. content: withCtx(() => [
  39487. _ctx.title ? (openBlock(), createElementBlock("div", {
  39488. key: 0,
  39489. class: normalizeClass(unref(ns).e("title")),
  39490. role: "title"
  39491. }, toDisplayString(_ctx.title), 3)) : createCommentVNode("v-if", true),
  39492. renderSlot(_ctx.$slots, "default", {}, () => [
  39493. createTextVNode(toDisplayString(_ctx.content), 1)
  39494. ])
  39495. ]),
  39496. default: withCtx(() => [
  39497. _ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
  39498. ]),
  39499. _: 3
  39500. }, 16, ["trigger", "trigger-keys", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "append-to", "persistent", "gpu-acceleration", "onUpdate:visible"]);
  39501. };
  39502. }
  39503. });
  39504. var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__file", "popover.vue"]]);
  39505. const attachEvents = (el, binding) => {
  39506. const popperComponent = binding.arg || binding.value;
  39507. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  39508. if (popover) {
  39509. popover.triggerRef = el;
  39510. }
  39511. };
  39512. var PopoverDirective = {
  39513. mounted(el, binding) {
  39514. attachEvents(el, binding);
  39515. },
  39516. updated(el, binding) {
  39517. attachEvents(el, binding);
  39518. }
  39519. };
  39520. const VPopover = "popover";
  39521. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  39522. const ElPopover = withInstall(Popover, {
  39523. directive: ElPopoverDirective
  39524. });
  39525. const progressProps = buildProps({
  39526. type: {
  39527. type: String,
  39528. default: "line",
  39529. values: ["line", "circle", "dashboard"]
  39530. },
  39531. percentage: {
  39532. type: Number,
  39533. default: 0,
  39534. validator: (val) => val >= 0 && val <= 100
  39535. },
  39536. status: {
  39537. type: String,
  39538. default: "",
  39539. values: ["", "success", "exception", "warning"]
  39540. },
  39541. indeterminate: Boolean,
  39542. duration: {
  39543. type: Number,
  39544. default: 3
  39545. },
  39546. strokeWidth: {
  39547. type: Number,
  39548. default: 6
  39549. },
  39550. strokeLinecap: {
  39551. type: definePropType(String),
  39552. default: "round"
  39553. },
  39554. textInside: Boolean,
  39555. width: {
  39556. type: Number,
  39557. default: 126
  39558. },
  39559. showText: {
  39560. type: Boolean,
  39561. default: true
  39562. },
  39563. color: {
  39564. type: definePropType([
  39565. String,
  39566. Array,
  39567. Function
  39568. ]),
  39569. default: ""
  39570. },
  39571. striped: Boolean,
  39572. stripedFlow: Boolean,
  39573. format: {
  39574. type: definePropType(Function),
  39575. default: (percentage) => `${percentage}%`
  39576. }
  39577. });
  39578. const __default__$E = defineComponent({
  39579. name: "ElProgress"
  39580. });
  39581. const _sfc_main$O = /* @__PURE__ */ defineComponent({
  39582. ...__default__$E,
  39583. props: progressProps,
  39584. setup(__props) {
  39585. const props = __props;
  39586. const STATUS_COLOR_MAP = {
  39587. success: "#13ce66",
  39588. exception: "#ff4949",
  39589. warning: "#e6a23c",
  39590. default: "#20a0ff"
  39591. };
  39592. const ns = useNamespace("progress");
  39593. const barStyle = computed(() => {
  39594. const barStyle2 = {
  39595. width: `${props.percentage}%`,
  39596. animationDuration: `${props.duration}s`
  39597. };
  39598. const color = getCurrentColor(props.percentage);
  39599. if (color.includes("gradient")) {
  39600. barStyle2.background = color;
  39601. } else {
  39602. barStyle2.backgroundColor = color;
  39603. }
  39604. return barStyle2;
  39605. });
  39606. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  39607. const radius = computed(() => {
  39608. if (["circle", "dashboard"].includes(props.type)) {
  39609. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  39610. }
  39611. return 0;
  39612. });
  39613. const trackPath = computed(() => {
  39614. const r = radius.value;
  39615. const isDashboard = props.type === "dashboard";
  39616. return `
  39617. M 50 50
  39618. m 0 ${isDashboard ? "" : "-"}${r}
  39619. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  39620. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  39621. `;
  39622. });
  39623. const perimeter = computed(() => 2 * Math.PI * radius.value);
  39624. const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
  39625. const strokeDashoffset = computed(() => {
  39626. const offset = -1 * perimeter.value * (1 - rate.value) / 2;
  39627. return `${offset}px`;
  39628. });
  39629. const trailPathStyle = computed(() => ({
  39630. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  39631. strokeDashoffset: strokeDashoffset.value
  39632. }));
  39633. const circlePathStyle = computed(() => ({
  39634. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  39635. strokeDashoffset: strokeDashoffset.value,
  39636. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  39637. }));
  39638. const stroke = computed(() => {
  39639. let ret;
  39640. if (props.color) {
  39641. ret = getCurrentColor(props.percentage);
  39642. } else {
  39643. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  39644. }
  39645. return ret;
  39646. });
  39647. const statusIcon = computed(() => {
  39648. if (props.status === "warning") {
  39649. return warning_filled_default;
  39650. }
  39651. if (props.type === "line") {
  39652. return props.status === "success" ? circle_check_default : circle_close_default;
  39653. } else {
  39654. return props.status === "success" ? check_default : close_default;
  39655. }
  39656. });
  39657. const progressTextSize = computed(() => {
  39658. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  39659. });
  39660. const content = computed(() => props.format(props.percentage));
  39661. function getColors(color) {
  39662. const span = 100 / color.length;
  39663. const seriesColors = color.map((seriesColor, index) => {
  39664. if (isString$1(seriesColor)) {
  39665. return {
  39666. color: seriesColor,
  39667. percentage: (index + 1) * span
  39668. };
  39669. }
  39670. return seriesColor;
  39671. });
  39672. return seriesColors.sort((a, b) => a.percentage - b.percentage);
  39673. }
  39674. const getCurrentColor = (percentage) => {
  39675. var _a;
  39676. const { color } = props;
  39677. if (isFunction$1(color)) {
  39678. return color(percentage);
  39679. } else if (isString$1(color)) {
  39680. return color;
  39681. } else {
  39682. const colors = getColors(color);
  39683. for (const color2 of colors) {
  39684. if (color2.percentage > percentage)
  39685. return color2.color;
  39686. }
  39687. return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
  39688. }
  39689. };
  39690. return (_ctx, _cache) => {
  39691. return openBlock(), createElementBlock("div", {
  39692. class: normalizeClass([
  39693. unref(ns).b(),
  39694. unref(ns).m(_ctx.type),
  39695. unref(ns).is(_ctx.status),
  39696. {
  39697. [unref(ns).m("without-text")]: !_ctx.showText,
  39698. [unref(ns).m("text-inside")]: _ctx.textInside
  39699. }
  39700. ]),
  39701. role: "progressbar",
  39702. "aria-valuenow": _ctx.percentage,
  39703. "aria-valuemin": "0",
  39704. "aria-valuemax": "100"
  39705. }, [
  39706. _ctx.type === "line" ? (openBlock(), createElementBlock("div", {
  39707. key: 0,
  39708. class: normalizeClass(unref(ns).b("bar"))
  39709. }, [
  39710. createElementVNode("div", {
  39711. class: normalizeClass(unref(ns).be("bar", "outer")),
  39712. style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  39713. }, [
  39714. createElementVNode("div", {
  39715. class: normalizeClass([
  39716. unref(ns).be("bar", "inner"),
  39717. { [unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
  39718. { [unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
  39719. { [unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
  39720. ]),
  39721. style: normalizeStyle(unref(barStyle))
  39722. }, [
  39723. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
  39724. key: 0,
  39725. class: normalizeClass(unref(ns).be("bar", "innerText"))
  39726. }, [
  39727. renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  39728. createElementVNode("span", null, toDisplayString(unref(content)), 1)
  39729. ])
  39730. ], 2)) : createCommentVNode("v-if", true)
  39731. ], 6)
  39732. ], 6)
  39733. ], 2)) : (openBlock(), createElementBlock("div", {
  39734. key: 1,
  39735. class: normalizeClass(unref(ns).b("circle")),
  39736. style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  39737. }, [
  39738. (openBlock(), createElementBlock("svg", { viewBox: "0 0 100 100" }, [
  39739. createElementVNode("path", {
  39740. class: normalizeClass(unref(ns).be("circle", "track")),
  39741. d: unref(trackPath),
  39742. stroke: `var(${unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  39743. "stroke-linecap": _ctx.strokeLinecap,
  39744. "stroke-width": unref(relativeStrokeWidth),
  39745. fill: "none",
  39746. style: normalizeStyle(unref(trailPathStyle))
  39747. }, null, 14, ["d", "stroke", "stroke-linecap", "stroke-width"]),
  39748. createElementVNode("path", {
  39749. class: normalizeClass(unref(ns).be("circle", "path")),
  39750. d: unref(trackPath),
  39751. stroke: unref(stroke),
  39752. fill: "none",
  39753. opacity: _ctx.percentage ? 1 : 0,
  39754. "stroke-linecap": _ctx.strokeLinecap,
  39755. "stroke-width": unref(relativeStrokeWidth),
  39756. style: normalizeStyle(unref(circlePathStyle))
  39757. }, null, 14, ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"])
  39758. ]))
  39759. ], 6)),
  39760. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
  39761. key: 2,
  39762. class: normalizeClass(unref(ns).e("text")),
  39763. style: normalizeStyle({ fontSize: `${unref(progressTextSize)}px` })
  39764. }, [
  39765. renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  39766. !_ctx.status ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(unref(content)), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  39767. default: withCtx(() => [
  39768. (openBlock(), createBlock(resolveDynamicComponent(unref(statusIcon))))
  39769. ]),
  39770. _: 1
  39771. }))
  39772. ])
  39773. ], 6)) : createCommentVNode("v-if", true)
  39774. ], 10, ["aria-valuenow"]);
  39775. };
  39776. }
  39777. });
  39778. var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__file", "progress.vue"]]);
  39779. const ElProgress = withInstall(Progress);
  39780. const rateProps = buildProps({
  39781. modelValue: {
  39782. type: Number,
  39783. default: 0
  39784. },
  39785. id: {
  39786. type: String,
  39787. default: void 0
  39788. },
  39789. lowThreshold: {
  39790. type: Number,
  39791. default: 2
  39792. },
  39793. highThreshold: {
  39794. type: Number,
  39795. default: 4
  39796. },
  39797. max: {
  39798. type: Number,
  39799. default: 5
  39800. },
  39801. colors: {
  39802. type: definePropType([Array, Object]),
  39803. default: () => mutable(["", "", ""])
  39804. },
  39805. voidColor: {
  39806. type: String,
  39807. default: ""
  39808. },
  39809. disabledVoidColor: {
  39810. type: String,
  39811. default: ""
  39812. },
  39813. icons: {
  39814. type: definePropType([Array, Object]),
  39815. default: () => [star_filled_default, star_filled_default, star_filled_default]
  39816. },
  39817. voidIcon: {
  39818. type: iconPropType,
  39819. default: () => star_default
  39820. },
  39821. disabledVoidIcon: {
  39822. type: iconPropType,
  39823. default: () => star_filled_default
  39824. },
  39825. disabled: Boolean,
  39826. allowHalf: Boolean,
  39827. showText: Boolean,
  39828. showScore: Boolean,
  39829. textColor: {
  39830. type: String,
  39831. default: ""
  39832. },
  39833. texts: {
  39834. type: definePropType(Array),
  39835. default: () => mutable([
  39836. "Extremely bad",
  39837. "Disappointed",
  39838. "Fair",
  39839. "Satisfied",
  39840. "Surprise"
  39841. ])
  39842. },
  39843. scoreTemplate: {
  39844. type: String,
  39845. default: "{value}"
  39846. },
  39847. size: useSizeProp,
  39848. clearable: Boolean,
  39849. ...useAriaProps(["ariaLabel"])
  39850. });
  39851. const rateEmits = {
  39852. [CHANGE_EVENT]: (value) => isNumber(value),
  39853. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  39854. };
  39855. const __default__$D = defineComponent({
  39856. name: "ElRate"
  39857. });
  39858. const _sfc_main$N = /* @__PURE__ */ defineComponent({
  39859. ...__default__$D,
  39860. props: rateProps,
  39861. emits: rateEmits,
  39862. setup(__props, { expose, emit }) {
  39863. const props = __props;
  39864. function getValueFromMap(value, map) {
  39865. const isExcludedObject = (val) => isObject$1(val);
  39866. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  39867. const val = map[key];
  39868. const excluded = isExcludedObject(val) ? val.excluded : false;
  39869. return excluded ? value < key : value <= key;
  39870. }).sort((a, b) => a - b);
  39871. const matchedValue = map[matchedKeys[0]];
  39872. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  39873. }
  39874. const formContext = inject(formContextKey, void 0);
  39875. const formItemContext = inject(formItemContextKey, void 0);
  39876. const rateSize = useFormSize();
  39877. const ns = useNamespace("rate");
  39878. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  39879. formItemContext
  39880. });
  39881. const currentValue = ref(props.modelValue);
  39882. const hoverIndex = ref(-1);
  39883. const pointerAtLeftHalf = ref(true);
  39884. const iconRefs = ref([]);
  39885. const iconClientWidths = computed(() => iconRefs.value.map((icon) => icon.$el.clientWidth));
  39886. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  39887. const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  39888. const rateStyles = computed(() => {
  39889. return ns.cssVarBlock({
  39890. "void-color": props.voidColor,
  39891. "disabled-void-color": props.disabledVoidColor,
  39892. "fill-color": activeColor.value
  39893. });
  39894. });
  39895. const text = computed(() => {
  39896. let result = "";
  39897. if (props.showScore) {
  39898. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  39899. } else if (props.showText) {
  39900. result = props.texts[Math.ceil(currentValue.value) - 1];
  39901. }
  39902. return result;
  39903. });
  39904. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  39905. const colorMap = computed(() => isArray$1(props.colors) ? {
  39906. [props.lowThreshold]: props.colors[0],
  39907. [props.highThreshold]: { value: props.colors[1], excluded: true },
  39908. [props.max]: props.colors[2]
  39909. } : props.colors);
  39910. const activeColor = computed(() => {
  39911. const color = getValueFromMap(currentValue.value, colorMap.value);
  39912. return isObject$1(color) ? "" : color;
  39913. });
  39914. const decimalStyle = computed(() => {
  39915. let width = "";
  39916. if (rateDisabled.value) {
  39917. width = `${valueDecimal.value}%`;
  39918. } else if (props.allowHalf) {
  39919. width = "50%";
  39920. }
  39921. return {
  39922. color: activeColor.value,
  39923. width
  39924. };
  39925. });
  39926. const componentMap = computed(() => {
  39927. let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons };
  39928. icons = markRaw(icons);
  39929. return isArray$1(icons) ? {
  39930. [props.lowThreshold]: icons[0],
  39931. [props.highThreshold]: {
  39932. value: icons[1],
  39933. excluded: true
  39934. },
  39935. [props.max]: icons[2]
  39936. } : icons;
  39937. });
  39938. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  39939. const voidComponent = computed(() => rateDisabled.value ? isString$1(props.disabledVoidIcon) ? props.disabledVoidIcon : markRaw(props.disabledVoidIcon) : isString$1(props.voidIcon) ? props.voidIcon : markRaw(props.voidIcon));
  39940. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  39941. function showDecimalIcon(item) {
  39942. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  39943. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  39944. return showWhenDisabled || showWhenAllowHalf;
  39945. }
  39946. function emitValue(value) {
  39947. if (props.clearable && value === props.modelValue) {
  39948. value = 0;
  39949. }
  39950. emit(UPDATE_MODEL_EVENT, value);
  39951. if (props.modelValue !== value) {
  39952. emit(CHANGE_EVENT, value);
  39953. }
  39954. }
  39955. function selectValue(value) {
  39956. if (rateDisabled.value) {
  39957. return;
  39958. }
  39959. if (props.allowHalf && pointerAtLeftHalf.value) {
  39960. emitValue(currentValue.value);
  39961. } else {
  39962. emitValue(value);
  39963. }
  39964. }
  39965. function handleKey(e) {
  39966. if (rateDisabled.value) {
  39967. return;
  39968. }
  39969. const code = getEventCode(e);
  39970. const step = props.allowHalf ? 0.5 : 1;
  39971. let _currentValue = currentValue.value;
  39972. switch (code) {
  39973. case EVENT_CODE.up:
  39974. case EVENT_CODE.right:
  39975. _currentValue += step;
  39976. break;
  39977. case EVENT_CODE.left:
  39978. case EVENT_CODE.down:
  39979. _currentValue -= step;
  39980. break;
  39981. }
  39982. _currentValue = clamp$1(_currentValue, 0, props.max);
  39983. if (_currentValue === currentValue.value) {
  39984. return;
  39985. }
  39986. e.stopPropagation();
  39987. e.preventDefault();
  39988. emit(UPDATE_MODEL_EVENT, _currentValue);
  39989. emit(CHANGE_EVENT, _currentValue);
  39990. return _currentValue;
  39991. }
  39992. function setCurrentValue(value, event) {
  39993. if (rateDisabled.value) {
  39994. return;
  39995. }
  39996. if (props.allowHalf && event) {
  39997. pointerAtLeftHalf.value = event.offsetX * 2 <= iconClientWidths.value[value - 1];
  39998. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  39999. } else {
  40000. currentValue.value = value;
  40001. }
  40002. hoverIndex.value = value;
  40003. }
  40004. function resetCurrentValue() {
  40005. if (rateDisabled.value) {
  40006. return;
  40007. }
  40008. if (props.allowHalf) {
  40009. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  40010. }
  40011. currentValue.value = props.modelValue;
  40012. hoverIndex.value = -1;
  40013. }
  40014. watch(() => props.modelValue, (val) => {
  40015. currentValue.value = val;
  40016. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  40017. });
  40018. if (!props.modelValue) {
  40019. emit(UPDATE_MODEL_EVENT, 0);
  40020. }
  40021. expose({
  40022. setCurrentValue,
  40023. resetCurrentValue
  40024. });
  40025. return (_ctx, _cache) => {
  40026. var _a;
  40027. return openBlock(), createElementBlock("div", {
  40028. id: unref(inputId),
  40029. class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
  40030. role: "slider",
  40031. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "rating" : void 0,
  40032. "aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
  40033. "aria-valuenow": currentValue.value,
  40034. "aria-valuetext": unref(text) || void 0,
  40035. "aria-valuemin": "0",
  40036. "aria-valuemax": _ctx.max,
  40037. tabindex: "0",
  40038. style: normalizeStyle(unref(rateStyles)),
  40039. onKeydown: handleKey
  40040. }, [
  40041. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
  40042. return openBlock(), createElementBlock("span", {
  40043. key,
  40044. class: normalizeClass(unref(ns).e("item")),
  40045. onMousemove: ($event) => setCurrentValue(item, $event),
  40046. onMouseleave: resetCurrentValue,
  40047. onClick: ($event) => selectValue(item)
  40048. }, [
  40049. createVNode(unref(ElIcon), {
  40050. ref_for: true,
  40051. ref_key: "iconRefs",
  40052. ref: iconRefs,
  40053. class: normalizeClass([
  40054. unref(ns).e("icon"),
  40055. { hover: hoverIndex.value === item },
  40056. unref(ns).is("active", item <= currentValue.value),
  40057. unref(ns).is("focus-visible", item === Math.ceil(currentValue.value || 1))
  40058. ])
  40059. }, {
  40060. default: withCtx(() => [
  40061. withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(activeComponent)), null, null, 512)), [
  40062. [vShow, !showDecimalIcon(item) && item <= currentValue.value]
  40063. ]),
  40064. withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), null, null, 512)), [
  40065. [vShow, !showDecimalIcon(item) && item > currentValue.value]
  40066. ]),
  40067. withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), {
  40068. class: normalizeClass([unref(ns).em("decimal", "box")])
  40069. }, null, 8, ["class"])), [
  40070. [vShow, showDecimalIcon(item)]
  40071. ]),
  40072. withDirectives(createVNode(unref(ElIcon), {
  40073. style: normalizeStyle(unref(decimalStyle)),
  40074. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  40075. }, {
  40076. default: withCtx(() => [
  40077. (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
  40078. ]),
  40079. _: 2
  40080. }, 1032, ["style", "class"]), [
  40081. [vShow, showDecimalIcon(item)]
  40082. ])
  40083. ]),
  40084. _: 2
  40085. }, 1032, ["class"])
  40086. ], 42, ["onMousemove", "onClick"]);
  40087. }), 128)),
  40088. _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
  40089. key: 0,
  40090. class: normalizeClass(unref(ns).e("text")),
  40091. style: normalizeStyle({ color: _ctx.textColor })
  40092. }, toDisplayString(unref(text)), 7)) : createCommentVNode("v-if", true)
  40093. ], 46, ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"]);
  40094. };
  40095. }
  40096. });
  40097. var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__file", "rate.vue"]]);
  40098. const ElRate = withInstall(Rate);
  40099. const IconMap = {
  40100. primary: "icon-primary",
  40101. success: "icon-success",
  40102. warning: "icon-warning",
  40103. error: "icon-error",
  40104. info: "icon-info"
  40105. };
  40106. const IconComponentMap = {
  40107. [IconMap.primary]: info_filled_default,
  40108. [IconMap.success]: circle_check_filled_default,
  40109. [IconMap.warning]: warning_filled_default,
  40110. [IconMap.error]: circle_close_filled_default,
  40111. [IconMap.info]: info_filled_default
  40112. };
  40113. const resultProps = buildProps({
  40114. title: {
  40115. type: String,
  40116. default: ""
  40117. },
  40118. subTitle: {
  40119. type: String,
  40120. default: ""
  40121. },
  40122. icon: {
  40123. type: String,
  40124. values: ["primary", "success", "warning", "info", "error"],
  40125. default: "info"
  40126. }
  40127. });
  40128. const __default__$C = defineComponent({
  40129. name: "ElResult"
  40130. });
  40131. const _sfc_main$M = /* @__PURE__ */ defineComponent({
  40132. ...__default__$C,
  40133. props: resultProps,
  40134. setup(__props) {
  40135. const props = __props;
  40136. const ns = useNamespace("result");
  40137. const resultIcon = computed(() => {
  40138. const icon = props.icon;
  40139. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  40140. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  40141. return {
  40142. class: iconClass,
  40143. component: iconComponent
  40144. };
  40145. });
  40146. return (_ctx, _cache) => {
  40147. return openBlock(), createElementBlock("div", {
  40148. class: normalizeClass(unref(ns).b())
  40149. }, [
  40150. createElementVNode("div", {
  40151. class: normalizeClass(unref(ns).e("icon"))
  40152. }, [
  40153. renderSlot(_ctx.$slots, "icon", {}, () => [
  40154. unref(resultIcon).component ? (openBlock(), createBlock(resolveDynamicComponent(unref(resultIcon).component), {
  40155. key: 0,
  40156. class: normalizeClass(unref(resultIcon).class)
  40157. }, null, 8, ["class"])) : createCommentVNode("v-if", true)
  40158. ])
  40159. ], 2),
  40160. _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
  40161. key: 0,
  40162. class: normalizeClass(unref(ns).e("title"))
  40163. }, [
  40164. renderSlot(_ctx.$slots, "title", {}, () => [
  40165. createElementVNode("p", null, toDisplayString(_ctx.title), 1)
  40166. ])
  40167. ], 2)) : createCommentVNode("v-if", true),
  40168. _ctx.subTitle || _ctx.$slots["sub-title"] ? (openBlock(), createElementBlock("div", {
  40169. key: 1,
  40170. class: normalizeClass(unref(ns).e("subtitle"))
  40171. }, [
  40172. renderSlot(_ctx.$slots, "sub-title", {}, () => [
  40173. createElementVNode("p", null, toDisplayString(_ctx.subTitle), 1)
  40174. ])
  40175. ], 2)) : createCommentVNode("v-if", true),
  40176. _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  40177. key: 2,
  40178. class: normalizeClass(unref(ns).e("extra"))
  40179. }, [
  40180. renderSlot(_ctx.$slots, "extra")
  40181. ], 2)) : createCommentVNode("v-if", true)
  40182. ], 2);
  40183. };
  40184. }
  40185. });
  40186. var Result = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__file", "result.vue"]]);
  40187. const ElResult = withInstall(Result);
  40188. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  40189. return typeof value === "number" && value !== value;
  40190. };
  40191. function isEqual(first, second) {
  40192. if (first === second) {
  40193. return true;
  40194. }
  40195. if (safeIsNaN(first) && safeIsNaN(second)) {
  40196. return true;
  40197. }
  40198. return false;
  40199. }
  40200. function areInputsEqual(newInputs, lastInputs) {
  40201. if (newInputs.length !== lastInputs.length) {
  40202. return false;
  40203. }
  40204. for (var i = 0; i < newInputs.length; i++) {
  40205. if (!isEqual(newInputs[i], lastInputs[i])) {
  40206. return false;
  40207. }
  40208. }
  40209. return true;
  40210. }
  40211. function memoizeOne(resultFn, isEqual2) {
  40212. if (isEqual2 === void 0) {
  40213. isEqual2 = areInputsEqual;
  40214. }
  40215. var cache = null;
  40216. function memoized() {
  40217. var newArgs = [];
  40218. for (var _i = 0; _i < arguments.length; _i++) {
  40219. newArgs[_i] = arguments[_i];
  40220. }
  40221. if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
  40222. return cache.lastResult;
  40223. }
  40224. var lastResult = resultFn.apply(this, newArgs);
  40225. cache = {
  40226. lastResult,
  40227. lastArgs: newArgs,
  40228. lastThis: this
  40229. };
  40230. return lastResult;
  40231. }
  40232. memoized.clear = function clear() {
  40233. cache = null;
  40234. };
  40235. return memoized;
  40236. }
  40237. const useCache = () => {
  40238. const vm = getCurrentInstance();
  40239. const props = vm.proxy.$props;
  40240. return computed(() => {
  40241. const _getItemStyleCache = (_, __, ___) => ({});
  40242. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  40243. });
  40244. };
  40245. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  40246. const ITEM_RENDER_EVT = "itemRendered";
  40247. const SCROLL_EVT = "scroll";
  40248. const FORWARD = "forward";
  40249. const BACKWARD = "backward";
  40250. const AUTO_ALIGNMENT = "auto";
  40251. const SMART_ALIGNMENT = "smart";
  40252. const START_ALIGNMENT = "start";
  40253. const CENTERED_ALIGNMENT = "center";
  40254. const END_ALIGNMENT = "end";
  40255. const HORIZONTAL = "horizontal";
  40256. const VERTICAL = "vertical";
  40257. const LTR = "ltr";
  40258. const RTL = "rtl";
  40259. const RTL_OFFSET_NAG = "negative";
  40260. const RTL_OFFSET_POS_ASC = "positive-ascending";
  40261. const RTL_OFFSET_POS_DESC = "positive-descending";
  40262. const ScrollbarDirKey = {
  40263. [HORIZONTAL]: "left",
  40264. [VERTICAL]: "top"
  40265. };
  40266. const SCROLLBAR_MIN_SIZE = 20;
  40267. const LayoutKeys = {
  40268. [HORIZONTAL]: "deltaX",
  40269. [VERTICAL]: "deltaY"
  40270. };
  40271. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  40272. let frameHandle;
  40273. let offset = 0;
  40274. const hasReachedEdge = (offset2) => {
  40275. const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value;
  40276. return edgeReached;
  40277. };
  40278. const onWheel = (e) => {
  40279. cAF(frameHandle);
  40280. const newOffset = e[LayoutKeys[layout.value]];
  40281. if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
  40282. return;
  40283. offset += newOffset;
  40284. if (!isFirefox()) {
  40285. e.preventDefault();
  40286. }
  40287. frameHandle = rAF(() => {
  40288. onWheelDelta(offset);
  40289. offset = 0;
  40290. });
  40291. };
  40292. return {
  40293. hasReachedEdge,
  40294. onWheel
  40295. };
  40296. };
  40297. var useWheel$1 = useWheel;
  40298. const itemSize$1 = buildProp({
  40299. type: definePropType([Number, Function]),
  40300. required: true
  40301. });
  40302. const estimatedItemSize = buildProp({
  40303. type: Number
  40304. });
  40305. const cache = buildProp({
  40306. type: Number,
  40307. default: 2
  40308. });
  40309. const direction = buildProp({
  40310. type: String,
  40311. values: ["ltr", "rtl"],
  40312. default: "ltr"
  40313. });
  40314. const initScrollOffset = buildProp({
  40315. type: Number,
  40316. default: 0
  40317. });
  40318. const total = buildProp({
  40319. type: Number,
  40320. required: true
  40321. });
  40322. const layout = buildProp({
  40323. type: String,
  40324. values: ["horizontal", "vertical"],
  40325. default: VERTICAL
  40326. });
  40327. const virtualizedProps = buildProps({
  40328. className: {
  40329. type: String,
  40330. default: ""
  40331. },
  40332. containerElement: {
  40333. type: definePropType([String, Object]),
  40334. default: "div"
  40335. },
  40336. data: {
  40337. type: definePropType(Array),
  40338. default: () => mutable([])
  40339. },
  40340. direction,
  40341. height: {
  40342. type: [String, Number],
  40343. required: true
  40344. },
  40345. innerElement: {
  40346. type: [String, Object],
  40347. default: "div"
  40348. },
  40349. innerProps: {
  40350. type: definePropType(Object),
  40351. default: () => ({})
  40352. },
  40353. style: {
  40354. type: definePropType([Object, String, Array])
  40355. },
  40356. useIsScrolling: Boolean,
  40357. width: {
  40358. type: [Number, String],
  40359. required: false
  40360. },
  40361. perfMode: {
  40362. type: Boolean,
  40363. default: true
  40364. },
  40365. scrollbarAlwaysOn: Boolean
  40366. });
  40367. const virtualizedListProps = buildProps({
  40368. cache,
  40369. estimatedItemSize,
  40370. layout,
  40371. initScrollOffset,
  40372. total,
  40373. itemSize: itemSize$1,
  40374. ...virtualizedProps
  40375. });
  40376. const scrollbarSize = {
  40377. type: Number,
  40378. default: 6
  40379. };
  40380. const startGap = { type: Number, default: 0 };
  40381. const endGap = { type: Number, default: 2 };
  40382. const virtualizedGridProps = buildProps({
  40383. columnCache: cache,
  40384. columnWidth: itemSize$1,
  40385. estimatedColumnWidth: estimatedItemSize,
  40386. estimatedRowHeight: estimatedItemSize,
  40387. initScrollLeft: initScrollOffset,
  40388. initScrollTop: initScrollOffset,
  40389. itemKey: {
  40390. type: definePropType(Function),
  40391. default: ({
  40392. columnIndex,
  40393. rowIndex
  40394. }) => `${rowIndex}:${columnIndex}`
  40395. },
  40396. rowCache: cache,
  40397. rowHeight: itemSize$1,
  40398. totalColumn: total,
  40399. totalRow: total,
  40400. hScrollbarSize: scrollbarSize,
  40401. vScrollbarSize: scrollbarSize,
  40402. scrollbarStartGap: startGap,
  40403. scrollbarEndGap: endGap,
  40404. role: String,
  40405. ...virtualizedProps
  40406. });
  40407. const virtualizedScrollbarProps = buildProps({
  40408. alwaysOn: Boolean,
  40409. class: String,
  40410. layout,
  40411. total,
  40412. ratio: {
  40413. type: Number,
  40414. required: true
  40415. },
  40416. clientSize: {
  40417. type: Number,
  40418. required: true
  40419. },
  40420. scrollFrom: {
  40421. type: Number,
  40422. required: true
  40423. },
  40424. scrollbarSize,
  40425. startGap,
  40426. endGap,
  40427. visible: Boolean
  40428. });
  40429. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  40430. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  40431. const isRTL = (dir) => dir === RTL;
  40432. let cachedRTLResult = null;
  40433. function getRTLOffsetType(recalculate = false) {
  40434. if (cachedRTLResult === null || recalculate) {
  40435. const outerDiv = document.createElement("div");
  40436. const outerStyle = outerDiv.style;
  40437. outerStyle.width = "50px";
  40438. outerStyle.height = "50px";
  40439. outerStyle.overflow = "scroll";
  40440. outerStyle.direction = "rtl";
  40441. const innerDiv = document.createElement("div");
  40442. const innerStyle = innerDiv.style;
  40443. innerStyle.width = "100px";
  40444. innerStyle.height = "100px";
  40445. outerDiv.appendChild(innerDiv);
  40446. document.body.appendChild(outerDiv);
  40447. if (outerDiv.scrollLeft > 0) {
  40448. cachedRTLResult = RTL_OFFSET_POS_DESC;
  40449. } else {
  40450. outerDiv.scrollLeft = 1;
  40451. if (outerDiv.scrollLeft === 0) {
  40452. cachedRTLResult = RTL_OFFSET_NAG;
  40453. } else {
  40454. cachedRTLResult = RTL_OFFSET_POS_ASC;
  40455. }
  40456. }
  40457. document.body.removeChild(outerDiv);
  40458. return cachedRTLResult;
  40459. }
  40460. return cachedRTLResult;
  40461. }
  40462. function renderThumbStyle({ move, size, bar }, layout) {
  40463. const style = {};
  40464. const translate = `translate${bar.axis}(${move}px)`;
  40465. style[bar.size] = size;
  40466. style.transform = translate;
  40467. if (layout === "horizontal") {
  40468. style.height = "100%";
  40469. } else {
  40470. style.width = "100%";
  40471. }
  40472. return style;
  40473. }
  40474. const ScrollBar = defineComponent({
  40475. name: "ElVirtualScrollBar",
  40476. props: virtualizedScrollbarProps,
  40477. emits: ["scroll", "start-move", "stop-move"],
  40478. setup(props, { emit }) {
  40479. const GAP = computed(() => props.startGap + props.endGap);
  40480. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  40481. const nsScrollbar = useNamespace("scrollbar");
  40482. const trackRef = ref();
  40483. const thumbRef = ref();
  40484. let frameHandle = null;
  40485. let onselectstartStore = null;
  40486. const state = reactive({
  40487. isDragging: false,
  40488. traveled: 0
  40489. });
  40490. const bar = computed(() => BAR_MAP[props.layout]);
  40491. const trackSize = computed(() => props.clientSize - unref(GAP));
  40492. const trackStyle = computed(() => ({
  40493. position: "absolute",
  40494. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  40495. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  40496. [ScrollbarDirKey[props.layout]]: "2px",
  40497. right: "2px",
  40498. bottom: "2px",
  40499. borderRadius: "4px"
  40500. }));
  40501. const thumbSize = computed(() => {
  40502. const ratio = props.ratio;
  40503. if (ratio >= 100) {
  40504. return Number.POSITIVE_INFINITY;
  40505. }
  40506. if (ratio >= 50) {
  40507. return ratio * trackSize.value / 100;
  40508. }
  40509. const SCROLLBAR_MAX_SIZE = trackSize.value / 3;
  40510. return Math.floor(Math.min(Math.max(ratio * trackSize.value / 100, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  40511. });
  40512. const thumbStyle = computed(() => {
  40513. if (!Number.isFinite(thumbSize.value)) {
  40514. return {
  40515. display: "none"
  40516. };
  40517. }
  40518. const thumb = `${thumbSize.value}px`;
  40519. const style = renderThumbStyle({
  40520. bar: bar.value,
  40521. size: thumb,
  40522. move: state.traveled
  40523. }, props.layout);
  40524. return style;
  40525. });
  40526. const totalSteps = computed(() => Math.ceil(props.clientSize - thumbSize.value - unref(GAP)));
  40527. const attachEvents = () => {
  40528. window.addEventListener("mousemove", onMouseMove);
  40529. window.addEventListener("mouseup", onMouseUp);
  40530. const thumbEl = unref(thumbRef);
  40531. if (!thumbEl)
  40532. return;
  40533. onselectstartStore = document.onselectstart;
  40534. document.onselectstart = () => false;
  40535. thumbEl.addEventListener("touchmove", onMouseMove, { passive: true });
  40536. thumbEl.addEventListener("touchend", onMouseUp);
  40537. };
  40538. const detachEvents = () => {
  40539. window.removeEventListener("mousemove", onMouseMove);
  40540. window.removeEventListener("mouseup", onMouseUp);
  40541. document.onselectstart = onselectstartStore;
  40542. onselectstartStore = null;
  40543. const thumbEl = unref(thumbRef);
  40544. if (!thumbEl)
  40545. return;
  40546. thumbEl.removeEventListener("touchmove", onMouseMove);
  40547. thumbEl.removeEventListener("touchend", onMouseUp);
  40548. };
  40549. const onThumbMouseDown = (e) => {
  40550. e.stopImmediatePropagation();
  40551. if (e.ctrlKey || [1, 2].includes(e.button)) {
  40552. return;
  40553. }
  40554. state.isDragging = true;
  40555. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  40556. emit("start-move");
  40557. attachEvents();
  40558. };
  40559. const onMouseUp = () => {
  40560. state.isDragging = false;
  40561. state[bar.value.axis] = 0;
  40562. emit("stop-move");
  40563. detachEvents();
  40564. };
  40565. const onMouseMove = (e) => {
  40566. const { isDragging } = state;
  40567. if (!isDragging)
  40568. return;
  40569. if (!thumbRef.value || !trackRef.value)
  40570. return;
  40571. const prevPage = state[bar.value.axis];
  40572. if (!prevPage)
  40573. return;
  40574. cAF(frameHandle);
  40575. const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  40576. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  40577. const distance = offset - thumbClickPosition;
  40578. frameHandle = rAF(() => {
  40579. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  40580. emit("scroll", distance, totalSteps.value);
  40581. });
  40582. };
  40583. const clickTrackHandler = (e) => {
  40584. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  40585. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  40586. const distance = offset - thumbHalf;
  40587. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  40588. emit("scroll", distance, totalSteps.value);
  40589. };
  40590. watch(() => props.scrollFrom, (v) => {
  40591. if (state.isDragging)
  40592. return;
  40593. state.traveled = Math.ceil(v * totalSteps.value);
  40594. });
  40595. onBeforeUnmount(() => {
  40596. detachEvents();
  40597. });
  40598. return () => {
  40599. return h$1("div", {
  40600. role: "presentation",
  40601. ref: trackRef,
  40602. class: [
  40603. nsVirtualScrollbar.b(),
  40604. props.class,
  40605. (props.alwaysOn || state.isDragging) && "always-on"
  40606. ],
  40607. style: trackStyle.value,
  40608. onMousedown: withModifiers(clickTrackHandler, ["stop", "prevent"]),
  40609. onTouchstartPrevent: onThumbMouseDown
  40610. }, h$1("div", {
  40611. ref: thumbRef,
  40612. class: nsScrollbar.e("thumb"),
  40613. style: thumbStyle.value,
  40614. onMousedown: onThumbMouseDown
  40615. }, []));
  40616. };
  40617. }
  40618. });
  40619. var Scrollbar = ScrollBar;
  40620. const createList = ({
  40621. name,
  40622. getOffset,
  40623. getItemSize,
  40624. getItemOffset,
  40625. getEstimatedTotalSize,
  40626. getStartIndexForOffset,
  40627. getStopIndexForStartIndex,
  40628. initCache,
  40629. clearCache,
  40630. validateProps
  40631. }) => {
  40632. return defineComponent({
  40633. name: name != null ? name : "ElVirtualList",
  40634. props: virtualizedListProps,
  40635. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  40636. setup(props, { emit, expose }) {
  40637. validateProps(props);
  40638. const instance = getCurrentInstance();
  40639. const ns = useNamespace("vl");
  40640. const dynamicSizeCache = ref(initCache(props, instance));
  40641. const getItemStyleCache = useCache();
  40642. const windowRef = ref();
  40643. const innerRef = ref();
  40644. const scrollbarRef = ref();
  40645. const states = ref({
  40646. isScrolling: false,
  40647. scrollDir: "forward",
  40648. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  40649. updateRequested: false,
  40650. isScrollbarDragging: false,
  40651. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  40652. });
  40653. const itemsToRender = computed(() => {
  40654. const { total, cache } = props;
  40655. const { isScrolling, scrollDir, scrollOffset } = unref(states);
  40656. if (total === 0) {
  40657. return [0, 0, 0, 0];
  40658. }
  40659. const startIndex = getStartIndexForOffset(props, scrollOffset, unref(dynamicSizeCache));
  40660. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, unref(dynamicSizeCache));
  40661. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  40662. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  40663. return [
  40664. Math.max(0, startIndex - cacheBackward),
  40665. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  40666. startIndex,
  40667. stopIndex
  40668. ];
  40669. });
  40670. const estimatedTotalSize = computed(() => getEstimatedTotalSize(props, unref(dynamicSizeCache)));
  40671. const _isHorizontal = computed(() => isHorizontal(props.layout));
  40672. const windowStyle = computed(() => [
  40673. {
  40674. position: "relative",
  40675. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  40676. WebkitOverflowScrolling: "touch",
  40677. willChange: "transform"
  40678. },
  40679. {
  40680. direction: props.direction,
  40681. height: isNumber(props.height) ? `${props.height}px` : props.height,
  40682. width: isNumber(props.width) ? `${props.width}px` : props.width
  40683. },
  40684. props.style
  40685. ]);
  40686. const innerStyle = computed(() => {
  40687. const size = unref(estimatedTotalSize);
  40688. const horizontal = unref(_isHorizontal);
  40689. return {
  40690. height: horizontal ? "100%" : `${size}px`,
  40691. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  40692. width: horizontal ? `${size}px` : "100%"
  40693. };
  40694. });
  40695. const clientSize = computed(() => _isHorizontal.value ? props.width : props.height);
  40696. const { onWheel } = useWheel$1({
  40697. atStartEdge: computed(() => states.value.scrollOffset <= 0),
  40698. atEndEdge: computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  40699. layout: computed(() => props.layout)
  40700. }, (offset) => {
  40701. var _a, _b;
  40702. (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a);
  40703. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  40704. });
  40705. useEventListener(windowRef, "wheel", onWheel, {
  40706. passive: false
  40707. });
  40708. const emitEvents = () => {
  40709. const { total } = props;
  40710. if (total > 0) {
  40711. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = unref(itemsToRender);
  40712. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  40713. }
  40714. const { scrollDir, scrollOffset, updateRequested } = unref(states);
  40715. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  40716. };
  40717. const scrollVertically = (e) => {
  40718. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  40719. const _states = unref(states);
  40720. if (_states.scrollOffset === scrollTop) {
  40721. return;
  40722. }
  40723. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  40724. states.value = {
  40725. ..._states,
  40726. isScrolling: true,
  40727. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  40728. scrollOffset,
  40729. updateRequested: false
  40730. };
  40731. nextTick(resetIsScrolling);
  40732. };
  40733. const scrollHorizontally = (e) => {
  40734. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  40735. const _states = unref(states);
  40736. if (_states.scrollOffset === scrollLeft) {
  40737. return;
  40738. }
  40739. const { direction } = props;
  40740. let scrollOffset = scrollLeft;
  40741. if (direction === RTL) {
  40742. switch (getRTLOffsetType()) {
  40743. case RTL_OFFSET_NAG: {
  40744. scrollOffset = -scrollLeft;
  40745. break;
  40746. }
  40747. case RTL_OFFSET_POS_DESC: {
  40748. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  40749. break;
  40750. }
  40751. }
  40752. }
  40753. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  40754. states.value = {
  40755. ..._states,
  40756. isScrolling: true,
  40757. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  40758. scrollOffset,
  40759. updateRequested: false
  40760. };
  40761. nextTick(resetIsScrolling);
  40762. };
  40763. const onScroll = (e) => {
  40764. unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  40765. emitEvents();
  40766. };
  40767. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  40768. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  40769. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  40770. };
  40771. const scrollTo = (offset) => {
  40772. offset = Math.max(offset, 0);
  40773. if (offset === unref(states).scrollOffset) {
  40774. return;
  40775. }
  40776. states.value = {
  40777. ...unref(states),
  40778. scrollOffset: offset,
  40779. scrollDir: getScrollDir(unref(states).scrollOffset, offset),
  40780. updateRequested: true
  40781. };
  40782. nextTick(resetIsScrolling);
  40783. };
  40784. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  40785. const { scrollOffset } = unref(states);
  40786. idx = Math.max(0, Math.min(idx, props.total - 1));
  40787. scrollTo(getOffset(props, idx, alignment, scrollOffset, unref(dynamicSizeCache)));
  40788. };
  40789. const getItemStyle = (idx) => {
  40790. const { direction, itemSize, layout } = props;
  40791. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  40792. let style;
  40793. if (hasOwn(itemStyleCache, String(idx))) {
  40794. style = itemStyleCache[idx];
  40795. } else {
  40796. const offset = getItemOffset(props, idx, unref(dynamicSizeCache));
  40797. const size = getItemSize(props, idx, unref(dynamicSizeCache));
  40798. const horizontal = unref(_isHorizontal);
  40799. const isRtl = direction === RTL;
  40800. const offsetHorizontal = horizontal ? offset : 0;
  40801. itemStyleCache[idx] = style = {
  40802. position: "absolute",
  40803. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  40804. right: isRtl ? `${offsetHorizontal}px` : void 0,
  40805. top: !horizontal ? `${offset}px` : 0,
  40806. height: !horizontal ? `${size}px` : "100%",
  40807. width: horizontal ? `${size}px` : "100%"
  40808. };
  40809. }
  40810. return style;
  40811. };
  40812. const resetIsScrolling = () => {
  40813. states.value.isScrolling = false;
  40814. nextTick(() => {
  40815. getItemStyleCache.value(-1, null, null);
  40816. });
  40817. };
  40818. const resetScrollTop = () => {
  40819. const window = windowRef.value;
  40820. if (window) {
  40821. window.scrollTop = 0;
  40822. }
  40823. };
  40824. onMounted(() => {
  40825. if (!isClient)
  40826. return;
  40827. const { initScrollOffset } = props;
  40828. const windowElement = unref(windowRef);
  40829. if (isNumber(initScrollOffset) && windowElement) {
  40830. if (unref(_isHorizontal)) {
  40831. windowElement.scrollLeft = initScrollOffset;
  40832. } else {
  40833. windowElement.scrollTop = initScrollOffset;
  40834. }
  40835. }
  40836. emitEvents();
  40837. });
  40838. onUpdated(() => {
  40839. const { direction, layout } = props;
  40840. const { scrollOffset, updateRequested } = unref(states);
  40841. const windowElement = unref(windowRef);
  40842. if (updateRequested && windowElement) {
  40843. if (layout === HORIZONTAL) {
  40844. if (direction === RTL) {
  40845. switch (getRTLOffsetType()) {
  40846. case RTL_OFFSET_NAG: {
  40847. windowElement.scrollLeft = -scrollOffset;
  40848. break;
  40849. }
  40850. case RTL_OFFSET_POS_ASC: {
  40851. windowElement.scrollLeft = scrollOffset;
  40852. break;
  40853. }
  40854. default: {
  40855. const { clientWidth, scrollWidth } = windowElement;
  40856. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  40857. break;
  40858. }
  40859. }
  40860. } else {
  40861. windowElement.scrollLeft = scrollOffset;
  40862. }
  40863. } else {
  40864. windowElement.scrollTop = scrollOffset;
  40865. }
  40866. }
  40867. });
  40868. onActivated(() => {
  40869. unref(windowRef).scrollTop = unref(states).scrollOffset;
  40870. });
  40871. const api = {
  40872. ns,
  40873. clientSize,
  40874. estimatedTotalSize,
  40875. windowStyle,
  40876. windowRef,
  40877. innerRef,
  40878. innerStyle,
  40879. itemsToRender,
  40880. scrollbarRef,
  40881. states,
  40882. getItemStyle,
  40883. onScroll,
  40884. onScrollbarScroll,
  40885. onWheel,
  40886. scrollTo,
  40887. scrollToItem,
  40888. resetScrollTop
  40889. };
  40890. expose({
  40891. windowRef,
  40892. innerRef,
  40893. getItemStyleCache,
  40894. scrollTo,
  40895. scrollToItem,
  40896. resetScrollTop,
  40897. states
  40898. });
  40899. return api;
  40900. },
  40901. render(ctx) {
  40902. var _a;
  40903. const {
  40904. $slots,
  40905. className,
  40906. clientSize,
  40907. containerElement,
  40908. data,
  40909. getItemStyle,
  40910. innerElement,
  40911. itemsToRender,
  40912. innerStyle,
  40913. layout,
  40914. total,
  40915. onScroll,
  40916. onScrollbarScroll,
  40917. states,
  40918. useIsScrolling,
  40919. windowStyle,
  40920. ns
  40921. } = ctx;
  40922. const [start, end] = itemsToRender;
  40923. const Container = resolveDynamicComponent(containerElement);
  40924. const Inner = resolveDynamicComponent(innerElement);
  40925. const children = [];
  40926. if (total > 0) {
  40927. for (let i = start; i <= end; i++) {
  40928. children.push(h$1(Fragment, { key: i }, (_a = $slots.default) == null ? void 0 : _a.call($slots, {
  40929. data,
  40930. index: i,
  40931. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  40932. style: getItemStyle(i)
  40933. })));
  40934. }
  40935. }
  40936. const InnerNode = [
  40937. h$1(Inner, mergeProps(ctx.innerProps, {
  40938. style: innerStyle,
  40939. ref: "innerRef"
  40940. }), !isString$1(Inner) ? {
  40941. default: () => children
  40942. } : children)
  40943. ];
  40944. const scrollbar = h$1(Scrollbar, {
  40945. ref: "scrollbarRef",
  40946. clientSize,
  40947. layout,
  40948. onScroll: onScrollbarScroll,
  40949. ratio: clientSize * 100 / this.estimatedTotalSize,
  40950. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  40951. total,
  40952. alwaysOn: states.scrollbarAlwaysOn
  40953. });
  40954. const listContainer = h$1(Container, {
  40955. class: [ns.e("window"), className],
  40956. style: windowStyle,
  40957. onScroll,
  40958. ref: "windowRef",
  40959. key: 0
  40960. }, !isString$1(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  40961. return h$1("div", {
  40962. key: 0,
  40963. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  40964. }, [listContainer, scrollbar]);
  40965. }
  40966. });
  40967. };
  40968. var createList$1 = createList;
  40969. const FixedSizeList = createList$1({
  40970. name: "ElFixedSizeList",
  40971. getItemOffset: ({ itemSize }, index) => index * itemSize,
  40972. getItemSize: ({ itemSize }) => itemSize,
  40973. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  40974. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  40975. const size = isHorizontal(layout) ? width : height;
  40976. const lastItemOffset = Math.max(0, total * itemSize - size);
  40977. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  40978. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  40979. if (alignment === SMART_ALIGNMENT) {
  40980. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  40981. alignment = AUTO_ALIGNMENT;
  40982. } else {
  40983. alignment = CENTERED_ALIGNMENT;
  40984. }
  40985. }
  40986. switch (alignment) {
  40987. case START_ALIGNMENT: {
  40988. return maxOffset;
  40989. }
  40990. case END_ALIGNMENT: {
  40991. return minOffset;
  40992. }
  40993. case CENTERED_ALIGNMENT: {
  40994. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  40995. if (middleOffset < Math.ceil(size / 2)) {
  40996. return 0;
  40997. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  40998. return lastItemOffset;
  40999. } else {
  41000. return middleOffset;
  41001. }
  41002. }
  41003. case AUTO_ALIGNMENT:
  41004. default: {
  41005. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  41006. return scrollOffset;
  41007. } else if (scrollOffset < minOffset) {
  41008. return minOffset;
  41009. } else {
  41010. return maxOffset;
  41011. }
  41012. }
  41013. }
  41014. },
  41015. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  41016. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  41017. const offset = startIndex * itemSize;
  41018. const size = isHorizontal(layout) ? width : height;
  41019. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  41020. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  41021. },
  41022. initCache() {
  41023. return void 0;
  41024. },
  41025. clearCache: true,
  41026. validateProps() {
  41027. }
  41028. });
  41029. var FixedSizeList$1 = FixedSizeList;
  41030. const getItemFromCache$1 = (props, index, listCache) => {
  41031. const { itemSize } = props;
  41032. const { items, lastVisitedIndex } = listCache;
  41033. if (index > lastVisitedIndex) {
  41034. let offset = 0;
  41035. if (lastVisitedIndex >= 0) {
  41036. const item = items[lastVisitedIndex];
  41037. offset = item.offset + item.size;
  41038. }
  41039. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  41040. const size = itemSize(i);
  41041. items[i] = {
  41042. offset,
  41043. size
  41044. };
  41045. offset += size;
  41046. }
  41047. listCache.lastVisitedIndex = index;
  41048. }
  41049. return items[index];
  41050. };
  41051. const findItem$1 = (props, listCache, offset) => {
  41052. const { items, lastVisitedIndex } = listCache;
  41053. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  41054. if (lastVisitedOffset >= offset) {
  41055. return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  41056. }
  41057. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  41058. };
  41059. const bs$1 = (props, listCache, low, high, offset) => {
  41060. while (low <= high) {
  41061. const mid = low + Math.floor((high - low) / 2);
  41062. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  41063. if (currentOffset === offset) {
  41064. return mid;
  41065. } else if (currentOffset < offset) {
  41066. low = mid + 1;
  41067. } else if (currentOffset > offset) {
  41068. high = mid - 1;
  41069. }
  41070. }
  41071. return Math.max(0, low - 1);
  41072. };
  41073. const es$1 = (props, listCache, index, offset) => {
  41074. const { total } = props;
  41075. let exponent = 1;
  41076. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  41077. index += exponent;
  41078. exponent *= 2;
  41079. }
  41080. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  41081. };
  41082. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  41083. let totalSizeOfMeasuredItems = 0;
  41084. if (lastVisitedIndex >= total) {
  41085. lastVisitedIndex = total - 1;
  41086. }
  41087. if (lastVisitedIndex >= 0) {
  41088. const item = items[lastVisitedIndex];
  41089. totalSizeOfMeasuredItems = item.offset + item.size;
  41090. }
  41091. const numUnmeasuredItems = total - lastVisitedIndex - 1;
  41092. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  41093. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  41094. };
  41095. const DynamicSizeList = createList$1({
  41096. name: "ElDynamicSizeList",
  41097. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  41098. getItemSize: (_, index, { items }) => items[index].size,
  41099. getEstimatedTotalSize,
  41100. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  41101. const { height, layout, width } = props;
  41102. const size = isHorizontal(layout) ? width : height;
  41103. const item = getItemFromCache$1(props, index, listCache);
  41104. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  41105. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  41106. const minOffset = Math.max(0, item.offset - size + item.size);
  41107. if (alignment === SMART_ALIGNMENT) {
  41108. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  41109. alignment = AUTO_ALIGNMENT;
  41110. } else {
  41111. alignment = CENTERED_ALIGNMENT;
  41112. }
  41113. }
  41114. switch (alignment) {
  41115. case START_ALIGNMENT: {
  41116. return maxOffset;
  41117. }
  41118. case END_ALIGNMENT: {
  41119. return minOffset;
  41120. }
  41121. case CENTERED_ALIGNMENT: {
  41122. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  41123. }
  41124. case AUTO_ALIGNMENT:
  41125. default: {
  41126. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  41127. return scrollOffset;
  41128. } else if (scrollOffset < minOffset) {
  41129. return minOffset;
  41130. } else {
  41131. return maxOffset;
  41132. }
  41133. }
  41134. }
  41135. },
  41136. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  41137. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  41138. const { height, total, layout, width } = props;
  41139. const size = isHorizontal(layout) ? width : height;
  41140. const item = getItemFromCache$1(props, startIndex, listCache);
  41141. const maxOffset = scrollOffset + size;
  41142. let offset = item.offset + item.size;
  41143. let stopIndex = startIndex;
  41144. while (stopIndex < total - 1 && offset < maxOffset) {
  41145. stopIndex++;
  41146. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  41147. }
  41148. return stopIndex;
  41149. },
  41150. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  41151. const cache = {
  41152. items: {},
  41153. estimatedItemSize,
  41154. lastVisitedIndex: -1
  41155. };
  41156. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  41157. var _a, _b;
  41158. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  41159. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1);
  41160. if (forceUpdate) {
  41161. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  41162. }
  41163. };
  41164. return cache;
  41165. },
  41166. clearCache: false,
  41167. validateProps: ({ itemSize }) => {
  41168. }
  41169. });
  41170. var DynamicSizeList$1 = DynamicSizeList;
  41171. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  41172. let frameHandle = null;
  41173. let xOffset = 0;
  41174. let yOffset = 0;
  41175. const hasReachedEdge = (x, y) => {
  41176. const xEdgeReached = x <= 0 && atXStartEdge.value || x >= 0 && atXEndEdge.value;
  41177. const yEdgeReached = y <= 0 && atYStartEdge.value || y >= 0 && atYEndEdge.value;
  41178. return xEdgeReached && yEdgeReached;
  41179. };
  41180. const onWheel = (e) => {
  41181. cAF(frameHandle);
  41182. let x = e.deltaX;
  41183. let y = e.deltaY;
  41184. if (Math.abs(x) > Math.abs(y)) {
  41185. y = 0;
  41186. } else {
  41187. x = 0;
  41188. }
  41189. if (e.shiftKey && y !== 0) {
  41190. x = y;
  41191. y = 0;
  41192. }
  41193. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y))
  41194. return;
  41195. xOffset += x;
  41196. yOffset += y;
  41197. e.preventDefault();
  41198. frameHandle = rAF(() => {
  41199. onWheelDelta(xOffset, yOffset);
  41200. xOffset = 0;
  41201. yOffset = 0;
  41202. });
  41203. };
  41204. return {
  41205. hasReachedEdge,
  41206. onWheel
  41207. };
  41208. };
  41209. const createGrid = ({
  41210. name,
  41211. clearCache,
  41212. getColumnPosition,
  41213. getColumnStartIndexForOffset,
  41214. getColumnStopIndexForStartIndex,
  41215. getEstimatedTotalHeight,
  41216. getEstimatedTotalWidth,
  41217. getColumnOffset,
  41218. getRowOffset,
  41219. getRowPosition,
  41220. getRowStartIndexForOffset,
  41221. getRowStopIndexForStartIndex,
  41222. initCache,
  41223. injectToInstance,
  41224. validateProps
  41225. }) => {
  41226. return defineComponent({
  41227. name: name != null ? name : "ElVirtualList",
  41228. props: virtualizedGridProps,
  41229. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  41230. setup(props, { emit, expose, slots }) {
  41231. const ns = useNamespace("vl");
  41232. validateProps(props);
  41233. const instance = getCurrentInstance();
  41234. const cache = ref(initCache(props, instance));
  41235. injectToInstance == null ? void 0 : injectToInstance(instance, cache);
  41236. const windowRef = ref();
  41237. const hScrollbar = ref();
  41238. const vScrollbar = ref();
  41239. const innerRef = ref(null);
  41240. const states = ref({
  41241. isScrolling: false,
  41242. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  41243. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  41244. updateRequested: false,
  41245. xAxisScrollDir: FORWARD,
  41246. yAxisScrollDir: FORWARD
  41247. });
  41248. const getItemStyleCache = useCache();
  41249. const parsedHeight = computed(() => Number.parseInt(`${props.height}`, 10));
  41250. const parsedWidth = computed(() => Number.parseInt(`${props.width}`, 10));
  41251. const columnsToRender = computed(() => {
  41252. const { totalColumn, totalRow, columnCache } = props;
  41253. const { isScrolling, xAxisScrollDir, scrollLeft } = unref(states);
  41254. if (totalColumn === 0 || totalRow === 0) {
  41255. return [0, 0, 0, 0];
  41256. }
  41257. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, unref(cache));
  41258. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, unref(cache));
  41259. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  41260. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  41261. return [
  41262. Math.max(0, startIndex - cacheBackward),
  41263. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  41264. startIndex,
  41265. stopIndex
  41266. ];
  41267. });
  41268. const rowsToRender = computed(() => {
  41269. const { totalColumn, totalRow, rowCache } = props;
  41270. const { isScrolling, yAxisScrollDir, scrollTop } = unref(states);
  41271. if (totalColumn === 0 || totalRow === 0) {
  41272. return [0, 0, 0, 0];
  41273. }
  41274. const startIndex = getRowStartIndexForOffset(props, scrollTop, unref(cache));
  41275. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, unref(cache));
  41276. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  41277. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  41278. return [
  41279. Math.max(0, startIndex - cacheBackward),
  41280. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  41281. startIndex,
  41282. stopIndex
  41283. ];
  41284. });
  41285. const estimatedTotalHeight = computed(() => getEstimatedTotalHeight(props, unref(cache)));
  41286. const estimatedTotalWidth = computed(() => getEstimatedTotalWidth(props, unref(cache)));
  41287. const windowStyle = computed(() => {
  41288. var _a;
  41289. return [
  41290. {
  41291. position: "relative",
  41292. overflow: "hidden",
  41293. WebkitOverflowScrolling: "touch",
  41294. willChange: "transform"
  41295. },
  41296. {
  41297. direction: props.direction,
  41298. height: isNumber(props.height) ? `${props.height}px` : props.height,
  41299. width: isNumber(props.width) ? `${props.width}px` : props.width
  41300. },
  41301. (_a = props.style) != null ? _a : {}
  41302. ];
  41303. });
  41304. const innerStyle = computed(() => {
  41305. const width = `${unref(estimatedTotalWidth)}px`;
  41306. const height = `${unref(estimatedTotalHeight)}px`;
  41307. return {
  41308. height,
  41309. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  41310. width
  41311. };
  41312. });
  41313. const emitEvents = () => {
  41314. const { totalColumn, totalRow } = props;
  41315. if (totalColumn > 0 && totalRow > 0) {
  41316. const [
  41317. columnCacheStart,
  41318. columnCacheEnd,
  41319. columnVisibleStart,
  41320. columnVisibleEnd
  41321. ] = unref(columnsToRender);
  41322. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = unref(rowsToRender);
  41323. emit(ITEM_RENDER_EVT, {
  41324. columnCacheStart,
  41325. columnCacheEnd,
  41326. rowCacheStart,
  41327. rowCacheEnd,
  41328. columnVisibleStart,
  41329. columnVisibleEnd,
  41330. rowVisibleStart,
  41331. rowVisibleEnd
  41332. });
  41333. }
  41334. const {
  41335. scrollLeft,
  41336. scrollTop,
  41337. updateRequested,
  41338. xAxisScrollDir,
  41339. yAxisScrollDir
  41340. } = unref(states);
  41341. emit(SCROLL_EVT, {
  41342. xAxisScrollDir,
  41343. scrollLeft,
  41344. yAxisScrollDir,
  41345. scrollTop,
  41346. updateRequested
  41347. });
  41348. };
  41349. const onScroll = (e) => {
  41350. const {
  41351. clientHeight,
  41352. clientWidth,
  41353. scrollHeight,
  41354. scrollLeft,
  41355. scrollTop,
  41356. scrollWidth
  41357. } = e.currentTarget;
  41358. const _states = unref(states);
  41359. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  41360. return;
  41361. }
  41362. let _scrollLeft = scrollLeft;
  41363. if (isRTL(props.direction)) {
  41364. switch (getRTLOffsetType()) {
  41365. case RTL_OFFSET_NAG:
  41366. _scrollLeft = -scrollLeft;
  41367. break;
  41368. case RTL_OFFSET_POS_DESC:
  41369. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  41370. break;
  41371. }
  41372. }
  41373. states.value = {
  41374. ..._states,
  41375. isScrolling: true,
  41376. scrollLeft: _scrollLeft,
  41377. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  41378. updateRequested: true,
  41379. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  41380. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  41381. };
  41382. nextTick(() => resetIsScrolling());
  41383. onUpdated();
  41384. emitEvents();
  41385. };
  41386. const onVerticalScroll = (distance, totalSteps) => {
  41387. const height = unref(parsedHeight);
  41388. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  41389. scrollTo({
  41390. scrollTop: Math.min(estimatedTotalHeight.value - height, offset)
  41391. });
  41392. };
  41393. const onHorizontalScroll = (distance, totalSteps) => {
  41394. const width = unref(parsedWidth);
  41395. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  41396. scrollTo({
  41397. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset)
  41398. });
  41399. };
  41400. const { onWheel } = useGridWheel({
  41401. atXStartEdge: computed(() => states.value.scrollLeft <= 0),
  41402. atXEndEdge: computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - unref(parsedWidth)),
  41403. atYStartEdge: computed(() => states.value.scrollTop <= 0),
  41404. atYEndEdge: computed(() => states.value.scrollTop >= estimatedTotalHeight.value - unref(parsedHeight))
  41405. }, (x, y) => {
  41406. var _a, _b, _c, _d;
  41407. (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a);
  41408. (_d = (_c = vScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  41409. const width = unref(parsedWidth);
  41410. const height = unref(parsedHeight);
  41411. scrollTo({
  41412. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  41413. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  41414. });
  41415. });
  41416. useEventListener(windowRef, "wheel", onWheel, {
  41417. passive: false
  41418. });
  41419. const scrollTo = ({
  41420. scrollLeft = states.value.scrollLeft,
  41421. scrollTop = states.value.scrollTop
  41422. }) => {
  41423. scrollLeft = Math.max(scrollLeft, 0);
  41424. scrollTop = Math.max(scrollTop, 0);
  41425. const _states = unref(states);
  41426. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  41427. return;
  41428. }
  41429. states.value = {
  41430. ..._states,
  41431. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  41432. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  41433. scrollLeft,
  41434. scrollTop,
  41435. updateRequested: true
  41436. };
  41437. nextTick(() => resetIsScrolling());
  41438. onUpdated();
  41439. emitEvents();
  41440. };
  41441. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  41442. const _states = unref(states);
  41443. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  41444. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  41445. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  41446. const _cache = unref(cache);
  41447. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  41448. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  41449. scrollTo({
  41450. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  41451. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  41452. });
  41453. };
  41454. const getItemStyle = (rowIndex, columnIndex) => {
  41455. const { columnWidth, direction, rowHeight } = props;
  41456. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  41457. const key = `${rowIndex},${columnIndex}`;
  41458. if (hasOwn(itemStyleCache, key)) {
  41459. return itemStyleCache[key];
  41460. } else {
  41461. const [, left] = getColumnPosition(props, columnIndex, unref(cache));
  41462. const _cache = unref(cache);
  41463. const rtl = isRTL(direction);
  41464. const [height, top] = getRowPosition(props, rowIndex, _cache);
  41465. const [width] = getColumnPosition(props, columnIndex, _cache);
  41466. itemStyleCache[key] = {
  41467. position: "absolute",
  41468. left: rtl ? void 0 : `${left}px`,
  41469. right: rtl ? `${left}px` : void 0,
  41470. top: `${top}px`,
  41471. height: `${height}px`,
  41472. width: `${width}px`
  41473. };
  41474. return itemStyleCache[key];
  41475. }
  41476. };
  41477. const resetIsScrolling = () => {
  41478. states.value.isScrolling = false;
  41479. nextTick(() => {
  41480. getItemStyleCache.value(-1, null, null);
  41481. });
  41482. };
  41483. onMounted(() => {
  41484. if (!isClient)
  41485. return;
  41486. const { initScrollLeft, initScrollTop } = props;
  41487. const windowElement = unref(windowRef);
  41488. if (windowElement) {
  41489. if (isNumber(initScrollLeft)) {
  41490. windowElement.scrollLeft = initScrollLeft;
  41491. }
  41492. if (isNumber(initScrollTop)) {
  41493. windowElement.scrollTop = initScrollTop;
  41494. }
  41495. }
  41496. emitEvents();
  41497. });
  41498. const onUpdated = () => {
  41499. const { direction } = props;
  41500. const { scrollLeft, scrollTop, updateRequested } = unref(states);
  41501. const windowElement = unref(windowRef);
  41502. if (updateRequested && windowElement) {
  41503. if (direction === RTL) {
  41504. switch (getRTLOffsetType()) {
  41505. case RTL_OFFSET_NAG: {
  41506. windowElement.scrollLeft = -scrollLeft;
  41507. break;
  41508. }
  41509. case RTL_OFFSET_POS_ASC: {
  41510. windowElement.scrollLeft = scrollLeft;
  41511. break;
  41512. }
  41513. default: {
  41514. const { clientWidth, scrollWidth } = windowElement;
  41515. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  41516. break;
  41517. }
  41518. }
  41519. } else {
  41520. windowElement.scrollLeft = Math.max(0, scrollLeft);
  41521. }
  41522. windowElement.scrollTop = Math.max(0, scrollTop);
  41523. }
  41524. };
  41525. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  41526. expose({
  41527. windowRef,
  41528. innerRef,
  41529. getItemStyleCache,
  41530. scrollTo,
  41531. scrollToItem,
  41532. states,
  41533. resetAfterColumnIndex,
  41534. resetAfterRowIndex,
  41535. resetAfter
  41536. });
  41537. const renderScrollbars = () => {
  41538. const {
  41539. scrollbarAlwaysOn,
  41540. scrollbarStartGap,
  41541. scrollbarEndGap,
  41542. totalColumn,
  41543. totalRow
  41544. } = props;
  41545. const width = unref(parsedWidth);
  41546. const height = unref(parsedHeight);
  41547. const estimatedWidth = unref(estimatedTotalWidth);
  41548. const estimatedHeight = unref(estimatedTotalHeight);
  41549. const { scrollLeft, scrollTop } = unref(states);
  41550. const horizontalScrollbar = h$1(Scrollbar, {
  41551. ref: hScrollbar,
  41552. alwaysOn: scrollbarAlwaysOn,
  41553. startGap: scrollbarStartGap,
  41554. endGap: scrollbarEndGap,
  41555. class: ns.e("horizontal"),
  41556. clientSize: width,
  41557. layout: "horizontal",
  41558. onScroll: onHorizontalScroll,
  41559. ratio: width * 100 / estimatedWidth,
  41560. scrollFrom: scrollLeft / (estimatedWidth - width),
  41561. total: totalRow,
  41562. visible: true
  41563. });
  41564. const verticalScrollbar = h$1(Scrollbar, {
  41565. ref: vScrollbar,
  41566. alwaysOn: scrollbarAlwaysOn,
  41567. startGap: scrollbarStartGap,
  41568. endGap: scrollbarEndGap,
  41569. class: ns.e("vertical"),
  41570. clientSize: height,
  41571. layout: "vertical",
  41572. onScroll: onVerticalScroll,
  41573. ratio: height * 100 / estimatedHeight,
  41574. scrollFrom: scrollTop / (estimatedHeight - height),
  41575. total: totalColumn,
  41576. visible: true
  41577. });
  41578. return {
  41579. horizontalScrollbar,
  41580. verticalScrollbar
  41581. };
  41582. };
  41583. const renderItems = () => {
  41584. var _a;
  41585. const [columnStart, columnEnd] = unref(columnsToRender);
  41586. const [rowStart, rowEnd] = unref(rowsToRender);
  41587. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  41588. const children = [];
  41589. if (totalRow > 0 && totalColumn > 0) {
  41590. for (let row = rowStart; row <= rowEnd; row++) {
  41591. for (let column = columnStart; column <= columnEnd; column++) {
  41592. const key = itemKey({ columnIndex: column, data, rowIndex: row });
  41593. children.push(h$1(Fragment, { key }, (_a = slots.default) == null ? void 0 : _a.call(slots, {
  41594. columnIndex: column,
  41595. data,
  41596. isScrolling: useIsScrolling ? unref(states).isScrolling : void 0,
  41597. style: getItemStyle(row, column),
  41598. rowIndex: row
  41599. })));
  41600. }
  41601. }
  41602. }
  41603. return children;
  41604. };
  41605. const renderInner = () => {
  41606. const Inner = resolveDynamicComponent(props.innerElement);
  41607. const children = renderItems();
  41608. return [
  41609. h$1(Inner, mergeProps(props.innerProps, {
  41610. style: unref(innerStyle),
  41611. ref: innerRef
  41612. }), !isString$1(Inner) ? {
  41613. default: () => children
  41614. } : children)
  41615. ];
  41616. };
  41617. const renderWindow = () => {
  41618. const Container = resolveDynamicComponent(props.containerElement);
  41619. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  41620. const Inner = renderInner();
  41621. return h$1("div", {
  41622. key: 0,
  41623. class: ns.e("wrapper"),
  41624. role: props.role
  41625. }, [
  41626. h$1(Container, {
  41627. class: props.className,
  41628. style: unref(windowStyle),
  41629. onScroll,
  41630. ref: windowRef
  41631. }, !isString$1(Container) ? { default: () => Inner } : Inner),
  41632. horizontalScrollbar,
  41633. verticalScrollbar
  41634. ]);
  41635. };
  41636. return renderWindow;
  41637. }
  41638. });
  41639. };
  41640. var createGrid$1 = createGrid;
  41641. const FixedSizeGrid = createGrid$1({
  41642. name: "ElFixedSizeGrid",
  41643. getColumnPosition: ({ columnWidth }, index) => [
  41644. columnWidth,
  41645. index * columnWidth
  41646. ],
  41647. getRowPosition: ({ rowHeight }, index) => [
  41648. rowHeight,
  41649. index * rowHeight
  41650. ],
  41651. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  41652. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  41653. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  41654. width = Number(width);
  41655. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  41656. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  41657. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  41658. if (alignment === "smart") {
  41659. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  41660. alignment = AUTO_ALIGNMENT;
  41661. } else {
  41662. alignment = CENTERED_ALIGNMENT;
  41663. }
  41664. }
  41665. switch (alignment) {
  41666. case START_ALIGNMENT:
  41667. return maxOffset;
  41668. case END_ALIGNMENT:
  41669. return minOffset;
  41670. case CENTERED_ALIGNMENT: {
  41671. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  41672. if (middleOffset < Math.ceil(width / 2)) {
  41673. return 0;
  41674. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  41675. return lastColumnOffset;
  41676. } else {
  41677. return middleOffset;
  41678. }
  41679. }
  41680. case AUTO_ALIGNMENT:
  41681. default:
  41682. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  41683. return scrollLeft;
  41684. } else if (minOffset > maxOffset) {
  41685. return minOffset;
  41686. } else if (scrollLeft < minOffset) {
  41687. return minOffset;
  41688. } else {
  41689. return maxOffset;
  41690. }
  41691. }
  41692. },
  41693. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  41694. height = Number(height);
  41695. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  41696. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  41697. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  41698. if (align === SMART_ALIGNMENT) {
  41699. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  41700. align = AUTO_ALIGNMENT;
  41701. } else {
  41702. align = CENTERED_ALIGNMENT;
  41703. }
  41704. }
  41705. switch (align) {
  41706. case START_ALIGNMENT:
  41707. return maxOffset;
  41708. case END_ALIGNMENT:
  41709. return minOffset;
  41710. case CENTERED_ALIGNMENT: {
  41711. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  41712. if (middleOffset < Math.ceil(height / 2)) {
  41713. return 0;
  41714. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  41715. return lastRowOffset;
  41716. } else {
  41717. return middleOffset;
  41718. }
  41719. }
  41720. case AUTO_ALIGNMENT:
  41721. default:
  41722. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  41723. return scrollTop;
  41724. } else if (minOffset > maxOffset) {
  41725. return minOffset;
  41726. } else if (scrollTop < minOffset) {
  41727. return minOffset;
  41728. } else {
  41729. return maxOffset;
  41730. }
  41731. }
  41732. },
  41733. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  41734. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  41735. const left = startIndex * columnWidth;
  41736. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  41737. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  41738. },
  41739. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  41740. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  41741. const top = startIndex * rowHeight;
  41742. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  41743. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  41744. },
  41745. initCache: () => void 0,
  41746. clearCache: true,
  41747. validateProps: ({ columnWidth, rowHeight }) => {
  41748. }
  41749. });
  41750. var FixedSizeGrid$1 = FixedSizeGrid;
  41751. const { max: max$2, min: min$2, floor } = Math;
  41752. const ACCESS_SIZER_KEY_MAP = {
  41753. column: "columnWidth",
  41754. row: "rowHeight"
  41755. };
  41756. const ACCESS_LAST_VISITED_KEY_MAP = {
  41757. column: "lastVisitedColumnIndex",
  41758. row: "lastVisitedRowIndex"
  41759. };
  41760. const getItemFromCache = (props, index, gridCache, type) => {
  41761. const [cachedItems, sizer, lastVisited] = [
  41762. gridCache[type],
  41763. props[ACCESS_SIZER_KEY_MAP[type]],
  41764. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  41765. ];
  41766. if (index > lastVisited) {
  41767. let offset = 0;
  41768. if (lastVisited >= 0) {
  41769. const item = cachedItems[lastVisited];
  41770. offset = item.offset + item.size;
  41771. }
  41772. for (let i = lastVisited + 1; i <= index; i++) {
  41773. const size = sizer(i);
  41774. cachedItems[i] = {
  41775. offset,
  41776. size
  41777. };
  41778. offset += size;
  41779. }
  41780. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  41781. }
  41782. return cachedItems[index];
  41783. };
  41784. const bs = (props, gridCache, low, high, offset, type) => {
  41785. while (low <= high) {
  41786. const mid = low + floor((high - low) / 2);
  41787. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  41788. if (currentOffset === offset) {
  41789. return mid;
  41790. } else if (currentOffset < offset) {
  41791. low = mid + 1;
  41792. } else {
  41793. high = mid - 1;
  41794. }
  41795. }
  41796. return max$2(0, low - 1);
  41797. };
  41798. const es = (props, gridCache, idx, offset, type) => {
  41799. const total = type === "column" ? props.totalColumn : props.totalRow;
  41800. let exponent = 1;
  41801. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  41802. idx += exponent;
  41803. exponent *= 2;
  41804. }
  41805. return bs(props, gridCache, floor(idx / 2), min$2(idx, total - 1), offset, type);
  41806. };
  41807. const findItem = (props, gridCache, offset, type) => {
  41808. const [cache, lastVisitedIndex] = [
  41809. gridCache[type],
  41810. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  41811. ];
  41812. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0;
  41813. if (lastVisitedItemOffset >= offset) {
  41814. return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  41815. }
  41816. return es(props, gridCache, max$2(0, lastVisitedIndex), offset, type);
  41817. };
  41818. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  41819. let sizeOfVisitedRows = 0;
  41820. if (lastVisitedRowIndex >= totalRow) {
  41821. lastVisitedRowIndex = totalRow - 1;
  41822. }
  41823. if (lastVisitedRowIndex >= 0) {
  41824. const item = row[lastVisitedRowIndex];
  41825. sizeOfVisitedRows = item.offset + item.size;
  41826. }
  41827. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  41828. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  41829. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  41830. };
  41831. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  41832. let sizeOfVisitedColumns = 0;
  41833. if (lastVisitedColumnIndex > totalColumn) {
  41834. lastVisitedColumnIndex = totalColumn - 1;
  41835. }
  41836. if (lastVisitedColumnIndex >= 0) {
  41837. const item = column[lastVisitedColumnIndex];
  41838. sizeOfVisitedColumns = item.offset + item.size;
  41839. }
  41840. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  41841. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  41842. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  41843. };
  41844. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  41845. column: getEstimatedTotalWidth,
  41846. row: getEstimatedTotalHeight
  41847. };
  41848. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  41849. const [size, estimatedSizeAssociates] = [
  41850. type === "row" ? props.height : props.width,
  41851. ACCESS_ESTIMATED_SIZE_KEY_MAP[type]
  41852. ];
  41853. const item = getItemFromCache(props, index, cache, type);
  41854. const estimatedSize = estimatedSizeAssociates(props, cache);
  41855. const maxOffset = max$2(0, min$2(estimatedSize - size, item.offset));
  41856. const minOffset = max$2(0, item.offset - size + scrollBarWidth + item.size);
  41857. if (alignment === SMART_ALIGNMENT) {
  41858. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  41859. alignment = AUTO_ALIGNMENT;
  41860. } else {
  41861. alignment = CENTERED_ALIGNMENT;
  41862. }
  41863. }
  41864. switch (alignment) {
  41865. case START_ALIGNMENT: {
  41866. return maxOffset;
  41867. }
  41868. case END_ALIGNMENT: {
  41869. return minOffset;
  41870. }
  41871. case CENTERED_ALIGNMENT: {
  41872. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  41873. }
  41874. case AUTO_ALIGNMENT:
  41875. default: {
  41876. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  41877. return scrollOffset;
  41878. } else if (minOffset > maxOffset) {
  41879. return minOffset;
  41880. } else if (scrollOffset < minOffset) {
  41881. return minOffset;
  41882. } else {
  41883. return maxOffset;
  41884. }
  41885. }
  41886. }
  41887. };
  41888. const DynamicSizeGrid = createGrid$1({
  41889. name: "ElDynamicSizeGrid",
  41890. getColumnPosition: (props, idx, cache) => {
  41891. const item = getItemFromCache(props, idx, cache, "column");
  41892. return [item.size, item.offset];
  41893. },
  41894. getRowPosition: (props, idx, cache) => {
  41895. const item = getItemFromCache(props, idx, cache, "row");
  41896. return [item.size, item.offset];
  41897. },
  41898. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  41899. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  41900. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  41901. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  41902. const item = getItemFromCache(props, startIndex, cache, "column");
  41903. const maxOffset = scrollLeft + props.width;
  41904. let offset = item.offset + item.size;
  41905. let stopIndex = startIndex;
  41906. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  41907. stopIndex++;
  41908. offset += getItemFromCache(props, startIndex, cache, "column").size;
  41909. }
  41910. return stopIndex;
  41911. },
  41912. getEstimatedTotalHeight,
  41913. getEstimatedTotalWidth,
  41914. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  41915. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  41916. const { totalRow, height } = props;
  41917. const item = getItemFromCache(props, startIndex, cache, "row");
  41918. const maxOffset = scrollTop + height;
  41919. let offset = item.size + item.offset;
  41920. let stopIndex = startIndex;
  41921. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  41922. stopIndex++;
  41923. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  41924. }
  41925. return stopIndex;
  41926. },
  41927. injectToInstance: (instance, cache) => {
  41928. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  41929. var _a, _b;
  41930. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  41931. if (isNumber(columnIndex)) {
  41932. cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  41933. }
  41934. if (isNumber(rowIndex)) {
  41935. cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  41936. }
  41937. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null);
  41938. if (forceUpdate)
  41939. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  41940. };
  41941. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  41942. resetAfter({
  41943. columnIndex
  41944. }, forceUpdate);
  41945. };
  41946. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  41947. resetAfter({
  41948. rowIndex
  41949. }, forceUpdate);
  41950. };
  41951. Object.assign(instance.proxy, {
  41952. resetAfterColumnIndex,
  41953. resetAfterRowIndex,
  41954. resetAfter
  41955. });
  41956. },
  41957. initCache: ({
  41958. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  41959. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  41960. }) => {
  41961. const cache = {
  41962. column: {},
  41963. estimatedColumnWidth,
  41964. estimatedRowHeight,
  41965. lastVisitedColumnIndex: -1,
  41966. lastVisitedRowIndex: -1,
  41967. row: {}
  41968. };
  41969. return cache;
  41970. },
  41971. clearCache: false,
  41972. validateProps: ({ columnWidth, rowHeight }) => {
  41973. }
  41974. });
  41975. var DynamicSizeGrid$1 = DynamicSizeGrid;
  41976. const _sfc_main$L = defineComponent({
  41977. props: {
  41978. item: {
  41979. type: Object,
  41980. required: true
  41981. },
  41982. style: {
  41983. type: Object
  41984. },
  41985. height: Number
  41986. },
  41987. setup() {
  41988. const ns = useNamespace("select");
  41989. return {
  41990. ns
  41991. };
  41992. }
  41993. });
  41994. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  41995. return openBlock(), createElementBlock("div", {
  41996. class: normalizeClass(_ctx.ns.be("group", "title")),
  41997. style: normalizeStyle({ ..._ctx.style, lineHeight: `${_ctx.height}px` })
  41998. }, toDisplayString(_ctx.item.label), 7);
  41999. }
  42000. var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$7], ["__file", "group-item.vue"]]);
  42001. function useOption(props, { emit }) {
  42002. return {
  42003. hoverItem: () => {
  42004. if (!props.disabled) {
  42005. emit("hover", props.index);
  42006. }
  42007. },
  42008. selectOptionClick: () => {
  42009. if (!props.disabled) {
  42010. emit("select", props.item, props.index);
  42011. }
  42012. }
  42013. };
  42014. }
  42015. const selectV2Props = buildProps({
  42016. allowCreate: Boolean,
  42017. autocomplete: {
  42018. type: definePropType(String),
  42019. default: "none"
  42020. },
  42021. automaticDropdown: Boolean,
  42022. clearable: Boolean,
  42023. clearIcon: {
  42024. type: iconPropType,
  42025. default: circle_close_default
  42026. },
  42027. effect: {
  42028. type: definePropType(String),
  42029. default: "light"
  42030. },
  42031. collapseTags: Boolean,
  42032. collapseTagsTooltip: Boolean,
  42033. maxCollapseTags: {
  42034. type: Number,
  42035. default: 1
  42036. },
  42037. defaultFirstOption: Boolean,
  42038. disabled: Boolean,
  42039. estimatedOptionHeight: {
  42040. type: Number,
  42041. default: void 0
  42042. },
  42043. filterable: Boolean,
  42044. filterMethod: {
  42045. type: definePropType(Function)
  42046. },
  42047. height: {
  42048. type: Number,
  42049. default: 274
  42050. },
  42051. itemHeight: {
  42052. type: Number,
  42053. default: 34
  42054. },
  42055. id: String,
  42056. loading: Boolean,
  42057. loadingText: String,
  42058. modelValue: {
  42059. type: definePropType([Array, String, Number, Boolean, Object]),
  42060. default: void 0
  42061. },
  42062. multiple: Boolean,
  42063. multipleLimit: {
  42064. type: Number,
  42065. default: 0
  42066. },
  42067. name: String,
  42068. noDataText: String,
  42069. noMatchText: String,
  42070. remoteMethod: {
  42071. type: definePropType(Function)
  42072. },
  42073. reserveKeyword: {
  42074. type: Boolean,
  42075. default: true
  42076. },
  42077. options: {
  42078. type: definePropType(Array),
  42079. required: true
  42080. },
  42081. placeholder: {
  42082. type: String
  42083. },
  42084. teleported: useTooltipContentProps.teleported,
  42085. persistent: {
  42086. type: Boolean,
  42087. default: true
  42088. },
  42089. popperClass: useTooltipContentProps.popperClass,
  42090. popperStyle: useTooltipContentProps.popperStyle,
  42091. popperOptions: {
  42092. type: definePropType(Object),
  42093. default: () => ({})
  42094. },
  42095. remote: Boolean,
  42096. debounce: {
  42097. type: Number,
  42098. default: 300
  42099. },
  42100. size: useSizeProp,
  42101. props: {
  42102. type: definePropType(Object),
  42103. default: () => defaultProps$5
  42104. },
  42105. valueKey: {
  42106. type: String,
  42107. default: "value"
  42108. },
  42109. scrollbarAlwaysOn: Boolean,
  42110. validateEvent: {
  42111. type: Boolean,
  42112. default: true
  42113. },
  42114. offset: {
  42115. type: Number,
  42116. default: 12
  42117. },
  42118. showArrow: {
  42119. type: Boolean,
  42120. default: true
  42121. },
  42122. placement: {
  42123. type: definePropType(String),
  42124. values: Ee,
  42125. default: "bottom-start"
  42126. },
  42127. fallbackPlacements: {
  42128. type: definePropType(Array),
  42129. default: ["bottom-start", "top-start", "right", "left"]
  42130. },
  42131. tagType: { ...tagProps.type, default: "info" },
  42132. tagEffect: { ...tagProps.effect, default: "light" },
  42133. tabindex: {
  42134. type: [String, Number],
  42135. default: 0
  42136. },
  42137. appendTo: useTooltipContentProps.appendTo,
  42138. fitInputWidth: {
  42139. type: [Boolean, Number],
  42140. default: true,
  42141. validator(val) {
  42142. return isBoolean(val) || isNumber(val);
  42143. }
  42144. },
  42145. suffixIcon: {
  42146. type: iconPropType,
  42147. default: arrow_down_default
  42148. },
  42149. ...useEmptyValuesProps,
  42150. ...useAriaProps(["ariaLabel"])
  42151. });
  42152. const optionV2Props = buildProps({
  42153. data: Array,
  42154. disabled: Boolean,
  42155. hovering: Boolean,
  42156. item: {
  42157. type: definePropType(Object),
  42158. required: true
  42159. },
  42160. index: Number,
  42161. style: Object,
  42162. selected: Boolean,
  42163. created: Boolean
  42164. });
  42165. const selectV2Emits = {
  42166. [UPDATE_MODEL_EVENT]: (val) => true,
  42167. [CHANGE_EVENT]: (val) => true,
  42168. "remove-tag": (val) => true,
  42169. "visible-change": (visible) => true,
  42170. focus: (evt) => evt instanceof FocusEvent,
  42171. blur: (evt) => evt instanceof FocusEvent,
  42172. clear: () => true
  42173. };
  42174. const optionV2Emits = {
  42175. hover: (index) => isNumber(index),
  42176. select: (val, index) => true
  42177. };
  42178. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  42179. const _sfc_main$K = defineComponent({
  42180. props: optionV2Props,
  42181. emits: optionV2Emits,
  42182. setup(props, { emit }) {
  42183. const select = inject(selectV2InjectionKey);
  42184. const ns = useNamespace("select");
  42185. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  42186. const { getLabel } = useProps(select.props);
  42187. const contentId = select.contentId;
  42188. return {
  42189. ns,
  42190. contentId,
  42191. hoverItem,
  42192. selectOptionClick,
  42193. getLabel
  42194. };
  42195. }
  42196. });
  42197. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  42198. return openBlock(), createElementBlock("li", {
  42199. id: `${_ctx.contentId}-${_ctx.index}`,
  42200. role: "option",
  42201. "aria-selected": _ctx.selected,
  42202. "aria-disabled": _ctx.disabled || void 0,
  42203. style: normalizeStyle(_ctx.style),
  42204. class: normalizeClass([
  42205. _ctx.ns.be("dropdown", "item"),
  42206. _ctx.ns.is("selected", _ctx.selected),
  42207. _ctx.ns.is("disabled", _ctx.disabled),
  42208. _ctx.ns.is("created", _ctx.created),
  42209. _ctx.ns.is("hovering", _ctx.hovering)
  42210. ]),
  42211. onMousemove: _ctx.hoverItem,
  42212. onClick: withModifiers(_ctx.selectOptionClick, ["stop"])
  42213. }, [
  42214. renderSlot(_ctx.$slots, "default", {
  42215. item: _ctx.item,
  42216. index: _ctx.index,
  42217. disabled: _ctx.disabled
  42218. }, () => [
  42219. createElementVNode("span", null, toDisplayString(_ctx.getLabel(_ctx.item)), 1)
  42220. ])
  42221. ], 46, ["id", "aria-selected", "aria-disabled", "onMousemove", "onClick"]);
  42222. }
  42223. var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["render", _sfc_render$6], ["__file", "option-item.vue"]]);
  42224. const props = {
  42225. loading: Boolean,
  42226. data: {
  42227. type: Array,
  42228. required: true
  42229. },
  42230. hoveringIndex: Number,
  42231. width: Number,
  42232. id: String,
  42233. ariaLabel: String
  42234. };
  42235. var ElSelectMenu = defineComponent({
  42236. name: "ElSelectDropdown",
  42237. props,
  42238. setup(props2, {
  42239. slots,
  42240. expose
  42241. }) {
  42242. const select = inject(selectV2InjectionKey);
  42243. const ns = useNamespace("select");
  42244. const {
  42245. getLabel,
  42246. getValue,
  42247. getDisabled
  42248. } = useProps(select.props);
  42249. const cachedHeights = ref([]);
  42250. const listRef = ref();
  42251. const size = computed(() => props2.data.length);
  42252. watch(() => size.value, () => {
  42253. var _a, _b;
  42254. (_b = (_a = select.tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  42255. });
  42256. const isSized = computed(() => isUndefined(select.props.estimatedOptionHeight));
  42257. const listProps = computed(() => {
  42258. if (isSized.value) {
  42259. return {
  42260. itemSize: select.props.itemHeight
  42261. };
  42262. }
  42263. return {
  42264. estimatedSize: select.props.estimatedOptionHeight,
  42265. itemSize: (idx) => cachedHeights.value[idx]
  42266. };
  42267. });
  42268. const contains = (arr = [], target) => {
  42269. const {
  42270. props: {
  42271. valueKey
  42272. }
  42273. } = select;
  42274. if (!isObject$1(target)) {
  42275. return arr.includes(target);
  42276. }
  42277. return arr && arr.some((item) => {
  42278. return toRaw(get(item, valueKey)) === get(target, valueKey);
  42279. });
  42280. };
  42281. const isEqual = (selected, target) => {
  42282. if (!isObject$1(target)) {
  42283. return selected === target;
  42284. } else {
  42285. const {
  42286. valueKey
  42287. } = select.props;
  42288. return get(selected, valueKey) === get(target, valueKey);
  42289. }
  42290. };
  42291. const isItemSelected = (modelValue, target) => {
  42292. if (select.props.multiple) {
  42293. return contains(modelValue, getValue(target));
  42294. }
  42295. return isEqual(modelValue, getValue(target));
  42296. };
  42297. const isItemDisabled = (modelValue, selected) => {
  42298. const {
  42299. disabled,
  42300. multiple,
  42301. multipleLimit
  42302. } = select.props;
  42303. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  42304. };
  42305. const isItemHovering = (target) => props2.hoveringIndex === target;
  42306. const scrollToItem = (index) => {
  42307. const list = listRef.value;
  42308. if (list) {
  42309. list.scrollToItem(index);
  42310. }
  42311. };
  42312. const resetScrollTop = () => {
  42313. const list = listRef.value;
  42314. if (list) {
  42315. list.resetScrollTop();
  42316. }
  42317. };
  42318. const exposed = {
  42319. listRef,
  42320. isSized,
  42321. isItemDisabled,
  42322. isItemHovering,
  42323. isItemSelected,
  42324. scrollToItem,
  42325. resetScrollTop
  42326. };
  42327. expose(exposed);
  42328. const Item = (itemProps) => {
  42329. const {
  42330. index,
  42331. data,
  42332. style
  42333. } = itemProps;
  42334. const sized = unref(isSized);
  42335. const {
  42336. itemSize,
  42337. estimatedSize
  42338. } = unref(listProps);
  42339. const {
  42340. modelValue
  42341. } = select.props;
  42342. const {
  42343. onSelect,
  42344. onHover
  42345. } = select;
  42346. const item = data[index];
  42347. if (item.type === "Group") {
  42348. return createVNode(GroupItem, {
  42349. "item": item,
  42350. "style": style,
  42351. "height": sized ? itemSize : estimatedSize
  42352. }, null);
  42353. }
  42354. const isSelected = isItemSelected(modelValue, item);
  42355. const isDisabled = isItemDisabled(modelValue, isSelected);
  42356. const isHovering = isItemHovering(index);
  42357. return createVNode(OptionItem, mergeProps(itemProps, {
  42358. "selected": isSelected,
  42359. "disabled": getDisabled(item) || isDisabled,
  42360. "created": !!item.created,
  42361. "hovering": isHovering,
  42362. "item": item,
  42363. "onSelect": onSelect,
  42364. "onHover": onHover
  42365. }), {
  42366. default: (props3) => {
  42367. var _a;
  42368. return ((_a = slots.default) == null ? void 0 : _a.call(slots, props3)) || createVNode("span", null, [getLabel(item)]);
  42369. }
  42370. });
  42371. };
  42372. const {
  42373. onKeyboardNavigate,
  42374. onKeyboardSelect
  42375. } = select;
  42376. const onForward = () => {
  42377. onKeyboardNavigate("forward");
  42378. };
  42379. const onBackward = () => {
  42380. onKeyboardNavigate("backward");
  42381. };
  42382. const onKeydown = (e) => {
  42383. const code = getEventCode(e);
  42384. const {
  42385. tab,
  42386. esc,
  42387. down,
  42388. up,
  42389. enter,
  42390. numpadEnter
  42391. } = EVENT_CODE;
  42392. if ([esc, down, up, enter, numpadEnter].includes(code)) {
  42393. e.preventDefault();
  42394. e.stopPropagation();
  42395. }
  42396. switch (code) {
  42397. case tab:
  42398. case esc:
  42399. break;
  42400. case down:
  42401. onForward();
  42402. break;
  42403. case up:
  42404. onBackward();
  42405. break;
  42406. case enter:
  42407. case numpadEnter:
  42408. onKeyboardSelect();
  42409. break;
  42410. }
  42411. };
  42412. return () => {
  42413. var _a, _b, _c, _d;
  42414. const {
  42415. data,
  42416. width
  42417. } = props2;
  42418. const {
  42419. height,
  42420. multiple,
  42421. scrollbarAlwaysOn
  42422. } = select.props;
  42423. const isScrollbarAlwaysOn = computed(() => {
  42424. return isIOS ? true : scrollbarAlwaysOn;
  42425. });
  42426. const List = unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1;
  42427. return createVNode("div", {
  42428. "class": [ns.b("dropdown"), ns.is("multiple", multiple)],
  42429. "style": {
  42430. width: `${width}px`
  42431. }
  42432. }, [(_a = slots.header) == null ? void 0 : _a.call(slots), ((_b = slots.loading) == null ? void 0 : _b.call(slots)) || ((_c = slots.empty) == null ? void 0 : _c.call(slots)) || createVNode(List, mergeProps({
  42433. "ref": listRef
  42434. }, unref(listProps), {
  42435. "className": ns.be("dropdown", "list"),
  42436. "scrollbarAlwaysOn": isScrollbarAlwaysOn.value,
  42437. "data": data,
  42438. "height": height,
  42439. "width": width,
  42440. "total": data.length,
  42441. "innerElement": "ul",
  42442. "innerProps": {
  42443. id: props2.id,
  42444. role: "listbox",
  42445. "aria-label": props2.ariaLabel,
  42446. "aria-orientation": "vertical"
  42447. },
  42448. "onKeydown": onKeydown
  42449. }), {
  42450. default: (props3) => createVNode(Item, props3, null)
  42451. }), (_d = slots.footer) == null ? void 0 : _d.call(slots)]);
  42452. };
  42453. }
  42454. });
  42455. function useAllowCreate(props, states) {
  42456. const { aliasProps, getLabel, getValue } = useProps(props);
  42457. const createOptionCount = ref(0);
  42458. const cachedSelectedOption = ref();
  42459. const enableAllowCreateMode = computed(() => {
  42460. return props.allowCreate && props.filterable;
  42461. });
  42462. watch(() => props.options, (options) => {
  42463. const optionLabelsSet = new Set(options.map((option) => getLabel(option)));
  42464. states.createdOptions = states.createdOptions.filter((createdOption) => !optionLabelsSet.has(getLabel(createdOption)));
  42465. });
  42466. function hasExistingOption(query) {
  42467. const hasOption = (option) => getLabel(option) === query;
  42468. return props.options && props.options.some(hasOption) || states.createdOptions.some(hasOption);
  42469. }
  42470. function selectNewOption(option) {
  42471. if (!enableAllowCreateMode.value) {
  42472. return;
  42473. }
  42474. if (props.multiple && option.created) {
  42475. createOptionCount.value++;
  42476. } else {
  42477. cachedSelectedOption.value = option;
  42478. }
  42479. }
  42480. function createNewOption(query) {
  42481. if (enableAllowCreateMode.value) {
  42482. if (query && query.length > 0) {
  42483. if (hasExistingOption(query)) {
  42484. states.createdOptions = states.createdOptions.filter((createdOption) => getLabel(createdOption) !== states.previousQuery);
  42485. return;
  42486. }
  42487. const newOption = {
  42488. [aliasProps.value.value]: query,
  42489. [aliasProps.value.label]: query,
  42490. created: true,
  42491. [aliasProps.value.disabled]: false
  42492. };
  42493. if (states.createdOptions.length >= createOptionCount.value) {
  42494. states.createdOptions[createOptionCount.value] = newOption;
  42495. } else {
  42496. states.createdOptions.push(newOption);
  42497. }
  42498. } else {
  42499. if (props.multiple) {
  42500. states.createdOptions.length = createOptionCount.value;
  42501. } else {
  42502. const selectedOption = cachedSelectedOption.value;
  42503. states.createdOptions.length = 0;
  42504. if (selectedOption && selectedOption.created) {
  42505. states.createdOptions.push(selectedOption);
  42506. }
  42507. }
  42508. }
  42509. }
  42510. }
  42511. function removeNewOption(option) {
  42512. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) {
  42513. return;
  42514. }
  42515. const idx = states.createdOptions.findIndex((it) => getValue(it) === getValue(option));
  42516. if (~idx) {
  42517. states.createdOptions.splice(idx, 1);
  42518. createOptionCount.value--;
  42519. }
  42520. }
  42521. function clearAllNewOption() {
  42522. if (enableAllowCreateMode.value) {
  42523. states.createdOptions.length = 0;
  42524. createOptionCount.value = 0;
  42525. }
  42526. }
  42527. return {
  42528. createNewOption,
  42529. removeNewOption,
  42530. selectNewOption,
  42531. clearAllNewOption
  42532. };
  42533. }
  42534. const useSelect$1 = (props, emit) => {
  42535. const { t } = useLocale();
  42536. const nsSelect = useNamespace("select");
  42537. const nsInput = useNamespace("input");
  42538. const { form: elForm, formItem: elFormItem } = useFormItem();
  42539. const { inputId } = useFormItemInputId(props, {
  42540. formItemContext: elFormItem
  42541. });
  42542. const { aliasProps, getLabel, getValue, getDisabled, getOptions } = useProps(props);
  42543. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  42544. const states = reactive({
  42545. inputValue: "",
  42546. cachedOptions: [],
  42547. createdOptions: [],
  42548. hoveringIndex: -1,
  42549. inputHovering: false,
  42550. selectionWidth: 0,
  42551. collapseItemWidth: 0,
  42552. previousQuery: null,
  42553. previousValue: void 0,
  42554. selectedLabel: "",
  42555. menuVisibleOnFocus: false,
  42556. isBeforeHide: false
  42557. });
  42558. const popperSize = ref(-1);
  42559. const debouncing = ref(false);
  42560. const selectRef = ref();
  42561. const selectionRef = ref();
  42562. const tooltipRef = ref();
  42563. const tagTooltipRef = ref();
  42564. const inputRef = ref();
  42565. const prefixRef = ref();
  42566. const suffixRef = ref();
  42567. const menuRef = ref();
  42568. const tagMenuRef = ref();
  42569. const collapseItemRef = ref();
  42570. const {
  42571. isComposing,
  42572. handleCompositionStart,
  42573. handleCompositionEnd,
  42574. handleCompositionUpdate
  42575. } = useComposition({
  42576. afterComposition: (e) => onInput(e)
  42577. });
  42578. const selectDisabled = computed(() => props.disabled || !!(elForm == null ? void 0 : elForm.disabled));
  42579. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  42580. disabled: selectDisabled,
  42581. afterFocus() {
  42582. if (props.automaticDropdown && !expanded.value) {
  42583. expanded.value = true;
  42584. states.menuVisibleOnFocus = true;
  42585. }
  42586. },
  42587. beforeBlur(event) {
  42588. var _a, _b;
  42589. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  42590. },
  42591. afterBlur() {
  42592. var _a;
  42593. expanded.value = false;
  42594. states.menuVisibleOnFocus = false;
  42595. if (props.validateEvent) {
  42596. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn(err));
  42597. }
  42598. }
  42599. });
  42600. const allOptions = computed(() => filterOptions(""));
  42601. const hasOptions = computed(() => {
  42602. if (props.loading)
  42603. return false;
  42604. return props.options.length > 0 || states.createdOptions.length > 0;
  42605. });
  42606. const filteredOptions = ref([]);
  42607. const expanded = ref(false);
  42608. const needStatusIcon = computed(() => {
  42609. var _a;
  42610. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  42611. });
  42612. const popupHeight = computed(() => {
  42613. const totalHeight = filteredOptions.value.length * props.itemHeight;
  42614. return totalHeight > props.height ? props.height : totalHeight;
  42615. });
  42616. const hasModelValue = computed(() => {
  42617. return props.multiple ? isArray$1(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  42618. });
  42619. const showClearBtn = computed(() => {
  42620. return props.clearable && !selectDisabled.value && hasModelValue.value && (isFocused.value || states.inputHovering);
  42621. });
  42622. const iconComponent = computed(() => props.remote && props.filterable ? "" : props.suffixIcon);
  42623. const iconReverse = computed(() => iconComponent.value && nsSelect.is("reverse", expanded.value));
  42624. const validateState = computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  42625. const validateIcon = computed(() => {
  42626. if (!validateState.value)
  42627. return;
  42628. return ValidateComponentsMap[validateState.value];
  42629. });
  42630. const debounce = computed(() => props.remote ? props.debounce : 0);
  42631. const isRemoteSearchEmpty = computed(() => props.remote && !states.inputValue && !hasOptions.value);
  42632. const emptyText = computed(() => {
  42633. if (props.loading) {
  42634. return props.loadingText || t("el.select.loading");
  42635. } else {
  42636. if (props.filterable && states.inputValue && hasOptions.value && filteredOptions.value.length === 0) {
  42637. return props.noMatchText || t("el.select.noMatch");
  42638. }
  42639. if (!hasOptions.value) {
  42640. return props.noDataText || t("el.select.noData");
  42641. }
  42642. }
  42643. return null;
  42644. });
  42645. const isFilterMethodValid = computed(() => props.filterable && isFunction$1(props.filterMethod));
  42646. const isRemoteMethodValid = computed(() => props.filterable && props.remote && isFunction$1(props.remoteMethod));
  42647. const filterOptions = (query) => {
  42648. const regexp = new RegExp(escapeStringRegexp(query), "i");
  42649. const isValidOption = (o) => {
  42650. if (isFilterMethodValid.value || isRemoteMethodValid.value)
  42651. return true;
  42652. return query ? regexp.test(getLabel(o) || "") : true;
  42653. };
  42654. if (props.loading) {
  42655. return [];
  42656. }
  42657. return [...states.createdOptions, ...props.options].reduce((all, item) => {
  42658. const options = getOptions(item);
  42659. if (isArray$1(options)) {
  42660. const filtered = options.filter(isValidOption);
  42661. if (filtered.length > 0) {
  42662. all.push({
  42663. label: getLabel(item),
  42664. type: "Group"
  42665. }, ...filtered);
  42666. }
  42667. } else if (props.remote || isValidOption(item)) {
  42668. all.push(item);
  42669. }
  42670. return all;
  42671. }, []);
  42672. };
  42673. const updateOptions = () => {
  42674. filteredOptions.value = filterOptions(states.inputValue);
  42675. };
  42676. const allOptionsValueMap = computed(() => {
  42677. const valueMap = /* @__PURE__ */ new Map();
  42678. allOptions.value.forEach((option, index) => {
  42679. valueMap.set(getValueKey(getValue(option)), { option, index });
  42680. });
  42681. return valueMap;
  42682. });
  42683. const filteredOptionsValueMap = computed(() => {
  42684. const valueMap = /* @__PURE__ */ new Map();
  42685. filteredOptions.value.forEach((option, index) => {
  42686. valueMap.set(getValueKey(getValue(option)), { option, index });
  42687. });
  42688. return valueMap;
  42689. });
  42690. const optionsAllDisabled = computed(() => filteredOptions.value.every((option) => getDisabled(option)));
  42691. const selectSize = useFormSize();
  42692. const collapseTagSize = computed(() => selectSize.value === "small" ? "small" : "default");
  42693. const calculatePopperSize = () => {
  42694. var _a;
  42695. if (isNumber(props.fitInputWidth)) {
  42696. popperSize.value = props.fitInputWidth;
  42697. return;
  42698. }
  42699. const width = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200;
  42700. if (!props.fitInputWidth && hasOptions.value) {
  42701. nextTick(() => {
  42702. popperSize.value = Math.max(width, calculateLabelMaxWidth());
  42703. });
  42704. } else {
  42705. popperSize.value = width;
  42706. }
  42707. };
  42708. const calculateLabelMaxWidth = () => {
  42709. var _a, _b;
  42710. const canvas = document.createElement("canvas");
  42711. const ctx = canvas.getContext("2d");
  42712. const selector = nsSelect.be("dropdown", "item");
  42713. const dom = ((_b = (_a = menuRef.value) == null ? void 0 : _a.listRef) == null ? void 0 : _b.innerRef) || document;
  42714. const dropdownItemEl = dom.querySelector(`.${selector}`);
  42715. if (dropdownItemEl === null || ctx === null)
  42716. return 0;
  42717. const style = getComputedStyle(dropdownItemEl);
  42718. const padding = Number.parseFloat(style.paddingLeft) + Number.parseFloat(style.paddingRight);
  42719. ctx.font = `bold ${style.font.replace(new RegExp(`\\b${style.fontWeight}\\b`), "")}`;
  42720. const maxWidth = filteredOptions.value.reduce((max, option) => {
  42721. const metrics = ctx.measureText(getLabel(option));
  42722. return Math.max(metrics.width, max);
  42723. }, 0);
  42724. return maxWidth + padding;
  42725. };
  42726. const getGapWidth = () => {
  42727. if (!selectionRef.value)
  42728. return 0;
  42729. const style = window.getComputedStyle(selectionRef.value);
  42730. return Number.parseFloat(style.gap || "6px");
  42731. };
  42732. const tagStyle = computed(() => {
  42733. const gapWidth = getGapWidth();
  42734. const inputSlotWidth = props.filterable ? gapWidth + MINIMUM_INPUT_WIDTH : 0;
  42735. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.selectionWidth - inputSlotWidth;
  42736. return { maxWidth: `${maxWidth}px` };
  42737. });
  42738. const collapseTagStyle = computed(() => {
  42739. return { maxWidth: `${states.selectionWidth}px` };
  42740. });
  42741. const shouldShowPlaceholder = computed(() => {
  42742. if (isArray$1(props.modelValue)) {
  42743. return props.modelValue.length === 0 && !states.inputValue;
  42744. }
  42745. return props.filterable ? !states.inputValue : true;
  42746. });
  42747. const currentPlaceholder = computed(() => {
  42748. var _a;
  42749. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  42750. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  42751. });
  42752. const popperRef = computed(() => {
  42753. var _a, _b;
  42754. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  42755. });
  42756. const indexRef = computed(() => {
  42757. if (props.multiple) {
  42758. const len = props.modelValue.length;
  42759. if (props.modelValue.length > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
  42760. const { index } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
  42761. return index;
  42762. }
  42763. } else {
  42764. if (!isEmptyValue(props.modelValue) && filteredOptionsValueMap.value.has(props.modelValue)) {
  42765. const { index } = filteredOptionsValueMap.value.get(props.modelValue);
  42766. return index;
  42767. }
  42768. }
  42769. return -1;
  42770. });
  42771. const dropdownMenuVisible = computed({
  42772. get() {
  42773. return expanded.value && (props.loading || !isRemoteSearchEmpty.value) && (!debouncing.value || !isEmpty(states.previousQuery));
  42774. },
  42775. set(val) {
  42776. expanded.value = val;
  42777. }
  42778. });
  42779. const showTagList = computed(() => {
  42780. if (!props.multiple) {
  42781. return [];
  42782. }
  42783. return props.collapseTags ? states.cachedOptions.slice(0, props.maxCollapseTags) : states.cachedOptions;
  42784. });
  42785. const collapseTagList = computed(() => {
  42786. if (!props.multiple) {
  42787. return [];
  42788. }
  42789. return props.collapseTags ? states.cachedOptions.slice(props.maxCollapseTags) : [];
  42790. });
  42791. const {
  42792. createNewOption,
  42793. removeNewOption,
  42794. selectNewOption,
  42795. clearAllNewOption
  42796. } = useAllowCreate(props, states);
  42797. const toggleMenu = () => {
  42798. if (selectDisabled.value)
  42799. return;
  42800. if (states.menuVisibleOnFocus) {
  42801. states.menuVisibleOnFocus = false;
  42802. } else {
  42803. expanded.value = !expanded.value;
  42804. }
  42805. };
  42806. const onInputChange = () => {
  42807. if (states.inputValue.length > 0 && !expanded.value) {
  42808. expanded.value = true;
  42809. }
  42810. createNewOption(states.inputValue);
  42811. nextTick(() => {
  42812. handleQueryChange(states.inputValue);
  42813. });
  42814. };
  42815. const debouncedOnInputChange = useDebounceFn(() => {
  42816. onInputChange();
  42817. debouncing.value = false;
  42818. }, debounce);
  42819. const handleQueryChange = (val) => {
  42820. if (states.previousQuery === val || isComposing.value) {
  42821. return;
  42822. }
  42823. states.previousQuery = val;
  42824. if (props.filterable && isFunction$1(props.filterMethod)) {
  42825. props.filterMethod(val);
  42826. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  42827. props.remoteMethod(val);
  42828. }
  42829. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptions.value.length) {
  42830. nextTick(checkDefaultFirstOption);
  42831. } else {
  42832. nextTick(updateHoveringIndex);
  42833. }
  42834. };
  42835. const checkDefaultFirstOption = () => {
  42836. const optionsInDropdown = filteredOptions.value.filter((n) => !n.disabled && n.type !== "Group");
  42837. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  42838. const firstOriginOption = optionsInDropdown[0];
  42839. states.hoveringIndex = getValueIndex(filteredOptions.value, userCreatedOption || firstOriginOption);
  42840. };
  42841. const emitChange = (val) => {
  42842. if (!isEqual$1(props.modelValue, val)) {
  42843. emit(CHANGE_EVENT, val);
  42844. }
  42845. };
  42846. const update = (val) => {
  42847. emit(UPDATE_MODEL_EVENT, val);
  42848. emitChange(val);
  42849. states.previousValue = props.multiple ? String(val) : val;
  42850. nextTick(() => {
  42851. if (props.multiple && isArray$1(props.modelValue)) {
  42852. const cachedOptions = states.cachedOptions.slice();
  42853. const selectedOptions = props.modelValue.map((value) => getOption(value, cachedOptions));
  42854. if (!isEqual$1(states.cachedOptions, selectedOptions)) {
  42855. states.cachedOptions = selectedOptions;
  42856. }
  42857. } else {
  42858. initStates(true);
  42859. }
  42860. });
  42861. };
  42862. const getValueIndex = (arr = [], value) => {
  42863. if (!isObject$1(value)) {
  42864. return arr.indexOf(value);
  42865. }
  42866. const valueKey = props.valueKey;
  42867. let index = -1;
  42868. arr.some((item, i) => {
  42869. if (get(item, valueKey) === get(value, valueKey)) {
  42870. index = i;
  42871. return true;
  42872. }
  42873. return false;
  42874. });
  42875. return index;
  42876. };
  42877. const getValueKey = (item) => {
  42878. return isObject$1(item) ? get(item, props.valueKey) : item;
  42879. };
  42880. const handleResize = () => {
  42881. calculatePopperSize();
  42882. };
  42883. const resetSelectionWidth = () => {
  42884. states.selectionWidth = Number.parseFloat(window.getComputedStyle(selectionRef.value).width);
  42885. };
  42886. const resetCollapseItemWidth = () => {
  42887. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  42888. };
  42889. const updateTooltip = () => {
  42890. var _a, _b;
  42891. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  42892. };
  42893. const updateTagTooltip = () => {
  42894. var _a, _b;
  42895. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  42896. };
  42897. const onSelect = (option) => {
  42898. const optionValue = getValue(option);
  42899. if (props.multiple) {
  42900. let selectedOptions = props.modelValue.slice();
  42901. const index = getValueIndex(selectedOptions, optionValue);
  42902. if (index > -1) {
  42903. selectedOptions = [
  42904. ...selectedOptions.slice(0, index),
  42905. ...selectedOptions.slice(index + 1)
  42906. ];
  42907. states.cachedOptions.splice(index, 1);
  42908. removeNewOption(option);
  42909. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  42910. selectedOptions = [...selectedOptions, optionValue];
  42911. states.cachedOptions.push(option);
  42912. selectNewOption(option);
  42913. }
  42914. update(selectedOptions);
  42915. if (option.created) {
  42916. handleQueryChange("");
  42917. }
  42918. if (props.filterable && !props.reserveKeyword) {
  42919. states.inputValue = "";
  42920. }
  42921. } else {
  42922. states.selectedLabel = getLabel(option);
  42923. !isEqual$1(props.modelValue, optionValue) && update(optionValue);
  42924. expanded.value = false;
  42925. selectNewOption(option);
  42926. if (!option.created) {
  42927. clearAllNewOption();
  42928. }
  42929. }
  42930. focus();
  42931. };
  42932. const deleteTag = (event, option) => {
  42933. let selectedOptions = props.modelValue.slice();
  42934. const index = getValueIndex(selectedOptions, getValue(option));
  42935. if (index > -1 && !selectDisabled.value) {
  42936. selectedOptions = [
  42937. ...props.modelValue.slice(0, index),
  42938. ...props.modelValue.slice(index + 1)
  42939. ];
  42940. states.cachedOptions.splice(index, 1);
  42941. update(selectedOptions);
  42942. emit("remove-tag", getValue(option));
  42943. removeNewOption(option);
  42944. }
  42945. event.stopPropagation();
  42946. focus();
  42947. };
  42948. const focus = () => {
  42949. var _a;
  42950. (_a = inputRef.value) == null ? void 0 : _a.focus();
  42951. };
  42952. const blur = () => {
  42953. var _a;
  42954. if (expanded.value) {
  42955. expanded.value = false;
  42956. nextTick(() => {
  42957. var _a2;
  42958. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  42959. });
  42960. return;
  42961. }
  42962. (_a = inputRef.value) == null ? void 0 : _a.blur();
  42963. };
  42964. const handleEsc = () => {
  42965. if (states.inputValue.length > 0) {
  42966. states.inputValue = "";
  42967. } else {
  42968. expanded.value = false;
  42969. }
  42970. };
  42971. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.cachedOptions.some((option) => getValue(option) === it && getDisabled(option)));
  42972. const handleDel = (e) => {
  42973. const code = getEventCode(e);
  42974. if (!props.multiple)
  42975. return;
  42976. if (code === EVENT_CODE.delete)
  42977. return;
  42978. if (states.inputValue.length === 0) {
  42979. e.preventDefault();
  42980. const selected = props.modelValue.slice();
  42981. const lastNotDisabledIndex = getLastNotDisabledIndex(selected);
  42982. if (lastNotDisabledIndex < 0)
  42983. return;
  42984. const removeTagValue = selected[lastNotDisabledIndex];
  42985. selected.splice(lastNotDisabledIndex, 1);
  42986. const option = states.cachedOptions[lastNotDisabledIndex];
  42987. states.cachedOptions.splice(lastNotDisabledIndex, 1);
  42988. removeNewOption(option);
  42989. update(selected);
  42990. emit("remove-tag", removeTagValue);
  42991. }
  42992. };
  42993. const handleClear = () => {
  42994. let emptyValue;
  42995. if (isArray$1(props.modelValue)) {
  42996. emptyValue = [];
  42997. } else {
  42998. emptyValue = valueOnClear.value;
  42999. }
  43000. states.selectedLabel = "";
  43001. expanded.value = false;
  43002. update(emptyValue);
  43003. emit("clear");
  43004. clearAllNewOption();
  43005. focus();
  43006. };
  43007. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  43008. const options = filteredOptions.value;
  43009. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value || isComposing.value) {
  43010. return;
  43011. }
  43012. if (!expanded.value) {
  43013. return toggleMenu();
  43014. }
  43015. if (isUndefined(hoveringIndex)) {
  43016. hoveringIndex = states.hoveringIndex;
  43017. }
  43018. let newIndex = -1;
  43019. if (direction === "forward") {
  43020. newIndex = hoveringIndex + 1;
  43021. if (newIndex >= options.length) {
  43022. newIndex = 0;
  43023. }
  43024. } else if (direction === "backward") {
  43025. newIndex = hoveringIndex - 1;
  43026. if (newIndex < 0 || newIndex >= options.length) {
  43027. newIndex = options.length - 1;
  43028. }
  43029. }
  43030. const option = options[newIndex];
  43031. if (getDisabled(option) || option.type === "Group") {
  43032. return onKeyboardNavigate(direction, newIndex);
  43033. } else {
  43034. states.hoveringIndex = newIndex;
  43035. scrollToItem(newIndex);
  43036. }
  43037. };
  43038. const onKeyboardSelect = () => {
  43039. if (!expanded.value) {
  43040. return toggleMenu();
  43041. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  43042. onSelect(filteredOptions.value[states.hoveringIndex]);
  43043. }
  43044. };
  43045. const onHoverOption = (idx) => {
  43046. states.hoveringIndex = idx != null ? idx : -1;
  43047. };
  43048. const updateHoveringIndex = () => {
  43049. if (!props.multiple) {
  43050. states.hoveringIndex = filteredOptions.value.findIndex((item) => {
  43051. return getValueKey(getValue(item)) === getValueKey(props.modelValue);
  43052. });
  43053. } else {
  43054. states.hoveringIndex = filteredOptions.value.findIndex((item) => props.modelValue.some((modelValue) => getValueKey(modelValue) === getValueKey(getValue(item))));
  43055. }
  43056. };
  43057. const onInput = (event) => {
  43058. states.inputValue = event.target.value;
  43059. if (props.remote) {
  43060. debouncing.value = true;
  43061. debouncedOnInputChange();
  43062. } else {
  43063. return onInputChange();
  43064. }
  43065. };
  43066. const handleClickOutside = (event) => {
  43067. expanded.value = false;
  43068. if (isFocused.value) {
  43069. const _event = new FocusEvent("blur", event);
  43070. handleBlur(_event);
  43071. }
  43072. };
  43073. const handleMenuEnter = () => {
  43074. states.isBeforeHide = false;
  43075. return nextTick(() => {
  43076. if (~indexRef.value) {
  43077. scrollToItem(states.hoveringIndex);
  43078. }
  43079. });
  43080. };
  43081. const scrollToItem = (index) => {
  43082. menuRef.value.scrollToItem(index);
  43083. };
  43084. const getOption = (value, cachedOptions) => {
  43085. const selectValue = getValueKey(value);
  43086. if (allOptionsValueMap.value.has(selectValue)) {
  43087. const { option } = allOptionsValueMap.value.get(selectValue);
  43088. return option;
  43089. }
  43090. if (cachedOptions && cachedOptions.length) {
  43091. const option = cachedOptions.find((option2) => getValueKey(getValue(option2)) === selectValue);
  43092. if (option) {
  43093. return option;
  43094. }
  43095. }
  43096. return {
  43097. [aliasProps.value.value]: value,
  43098. [aliasProps.value.label]: value
  43099. };
  43100. };
  43101. const getIndex = (option) => {
  43102. var _a, _b;
  43103. return (_b = (_a = allOptionsValueMap.value.get(getValue(option))) == null ? void 0 : _a.index) != null ? _b : -1;
  43104. };
  43105. const initStates = (needUpdateSelectedLabel = false) => {
  43106. if (props.multiple) {
  43107. if (props.modelValue.length > 0) {
  43108. const cachedOptions = states.cachedOptions.slice();
  43109. states.cachedOptions.length = 0;
  43110. states.previousValue = props.modelValue.toString();
  43111. for (const value of props.modelValue) {
  43112. const option = getOption(value, cachedOptions);
  43113. states.cachedOptions.push(option);
  43114. }
  43115. } else {
  43116. states.cachedOptions = [];
  43117. states.previousValue = void 0;
  43118. }
  43119. } else {
  43120. if (hasModelValue.value) {
  43121. states.previousValue = props.modelValue;
  43122. const options = filteredOptions.value;
  43123. const selectedItemIndex = options.findIndex((option) => getValueKey(getValue(option)) === getValueKey(props.modelValue));
  43124. if (~selectedItemIndex) {
  43125. states.selectedLabel = getLabel(options[selectedItemIndex]);
  43126. } else {
  43127. if (!states.selectedLabel || needUpdateSelectedLabel) {
  43128. states.selectedLabel = getValueKey(props.modelValue);
  43129. }
  43130. }
  43131. } else {
  43132. states.selectedLabel = "";
  43133. states.previousValue = void 0;
  43134. }
  43135. }
  43136. clearAllNewOption();
  43137. calculatePopperSize();
  43138. };
  43139. watch(() => props.fitInputWidth, () => {
  43140. calculatePopperSize();
  43141. });
  43142. watch(expanded, (val) => {
  43143. if (val) {
  43144. if (!props.persistent) {
  43145. calculatePopperSize();
  43146. }
  43147. handleQueryChange("");
  43148. } else {
  43149. states.inputValue = "";
  43150. states.previousQuery = null;
  43151. states.isBeforeHide = true;
  43152. createNewOption("");
  43153. }
  43154. emit("visible-change", val);
  43155. });
  43156. watch(() => props.modelValue, (val, oldVal) => {
  43157. var _a;
  43158. const isValEmpty = !val || isArray$1(val) && val.length === 0;
  43159. if (isValEmpty || props.multiple && !isEqual$1(val.toString(), states.previousValue) || !props.multiple && getValueKey(val) !== getValueKey(states.previousValue)) {
  43160. initStates(true);
  43161. }
  43162. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  43163. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn(err));
  43164. }
  43165. }, {
  43166. deep: true
  43167. });
  43168. watch(() => props.options, () => {
  43169. const input = inputRef.value;
  43170. if (!input || input && document.activeElement !== input) {
  43171. initStates();
  43172. }
  43173. }, {
  43174. deep: true,
  43175. flush: "post"
  43176. });
  43177. watch(() => filteredOptions.value, () => {
  43178. calculatePopperSize();
  43179. return menuRef.value && nextTick(menuRef.value.resetScrollTop);
  43180. });
  43181. watchEffect(() => {
  43182. if (states.isBeforeHide)
  43183. return;
  43184. updateOptions();
  43185. });
  43186. watchEffect(() => {
  43187. const { valueKey, options } = props;
  43188. const duplicateValue = /* @__PURE__ */ new Map();
  43189. for (const item of options) {
  43190. const optionValue = getValue(item);
  43191. let v = optionValue;
  43192. if (isObject$1(v)) {
  43193. v = get(optionValue, valueKey);
  43194. }
  43195. if (duplicateValue.get(v)) {
  43196. debugWarn("ElSelectV2", `The option values you provided seem to be duplicated, which may cause some problems, please check.`);
  43197. break;
  43198. } else {
  43199. duplicateValue.set(v, true);
  43200. }
  43201. }
  43202. });
  43203. onMounted(() => {
  43204. initStates();
  43205. });
  43206. useResizeObserver(selectRef, handleResize);
  43207. useResizeObserver(selectionRef, resetSelectionWidth);
  43208. useResizeObserver(menuRef, updateTooltip);
  43209. useResizeObserver(wrapperRef, updateTooltip);
  43210. useResizeObserver(tagMenuRef, updateTagTooltip);
  43211. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  43212. return {
  43213. inputId,
  43214. collapseTagSize,
  43215. currentPlaceholder,
  43216. expanded,
  43217. emptyText,
  43218. popupHeight,
  43219. debounce,
  43220. allOptions,
  43221. allOptionsValueMap,
  43222. filteredOptions,
  43223. iconComponent,
  43224. iconReverse,
  43225. tagStyle,
  43226. collapseTagStyle,
  43227. popperSize,
  43228. dropdownMenuVisible,
  43229. hasModelValue,
  43230. shouldShowPlaceholder,
  43231. selectDisabled,
  43232. selectSize,
  43233. needStatusIcon,
  43234. showClearBtn,
  43235. states,
  43236. isFocused,
  43237. nsSelect,
  43238. nsInput,
  43239. inputRef,
  43240. menuRef,
  43241. tagMenuRef,
  43242. tooltipRef,
  43243. tagTooltipRef,
  43244. selectRef,
  43245. wrapperRef,
  43246. selectionRef,
  43247. prefixRef,
  43248. suffixRef,
  43249. collapseItemRef,
  43250. popperRef,
  43251. validateState,
  43252. validateIcon,
  43253. showTagList,
  43254. collapseTagList,
  43255. debouncedOnInputChange,
  43256. deleteTag,
  43257. getLabel,
  43258. getValue,
  43259. getDisabled,
  43260. getValueKey,
  43261. getIndex,
  43262. handleClear,
  43263. handleClickOutside,
  43264. handleDel,
  43265. handleEsc,
  43266. focus,
  43267. blur,
  43268. handleMenuEnter,
  43269. handleResize,
  43270. resetSelectionWidth,
  43271. updateTooltip,
  43272. updateTagTooltip,
  43273. updateOptions,
  43274. toggleMenu,
  43275. scrollTo: scrollToItem,
  43276. onInput,
  43277. onKeyboardNavigate,
  43278. onKeyboardSelect,
  43279. onSelect,
  43280. onHover: onHoverOption,
  43281. handleCompositionStart,
  43282. handleCompositionEnd,
  43283. handleCompositionUpdate
  43284. };
  43285. };
  43286. var useSelect$2 = useSelect$1;
  43287. const _sfc_main$J = defineComponent({
  43288. name: "ElSelectV2",
  43289. components: {
  43290. ElSelectMenu,
  43291. ElTag,
  43292. ElTooltip,
  43293. ElIcon
  43294. },
  43295. directives: { ClickOutside },
  43296. props: selectV2Props,
  43297. emits: selectV2Emits,
  43298. setup(props, { emit }) {
  43299. const modelValue = computed(() => {
  43300. const { modelValue: rawModelValue, multiple } = props;
  43301. const fallback = multiple ? [] : void 0;
  43302. if (isArray$1(rawModelValue)) {
  43303. return multiple ? rawModelValue : fallback;
  43304. }
  43305. return multiple ? fallback : rawModelValue;
  43306. });
  43307. const API = useSelect$2(reactive({
  43308. ...toRefs(props),
  43309. modelValue
  43310. }), emit);
  43311. const { calculatorRef, inputStyle } = useCalcInputWidth();
  43312. const contentId = useId();
  43313. provide(selectV2InjectionKey, {
  43314. props: reactive({
  43315. ...toRefs(props),
  43316. height: API.popupHeight,
  43317. modelValue
  43318. }),
  43319. expanded: API.expanded,
  43320. tooltipRef: API.tooltipRef,
  43321. contentId,
  43322. onSelect: API.onSelect,
  43323. onHover: API.onHover,
  43324. onKeyboardNavigate: API.onKeyboardNavigate,
  43325. onKeyboardSelect: API.onKeyboardSelect
  43326. });
  43327. const selectedLabel = computed(() => {
  43328. if (!props.multiple) {
  43329. return API.states.selectedLabel;
  43330. }
  43331. return API.states.cachedOptions.map((i) => API.getLabel(i));
  43332. });
  43333. return {
  43334. ...API,
  43335. modelValue,
  43336. selectedLabel,
  43337. calculatorRef,
  43338. inputStyle,
  43339. contentId,
  43340. BORDER_HORIZONTAL_WIDTH
  43341. };
  43342. }
  43343. });
  43344. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  43345. const _component_el_tag = resolveComponent("el-tag");
  43346. const _component_el_tooltip = resolveComponent("el-tooltip");
  43347. const _component_el_icon = resolveComponent("el-icon");
  43348. const _component_el_select_menu = resolveComponent("el-select-menu");
  43349. const _directive_click_outside = resolveDirective("click-outside");
  43350. return withDirectives((openBlock(), createElementBlock("div", {
  43351. ref: "selectRef",
  43352. class: normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  43353. onMouseenter: ($event) => _ctx.states.inputHovering = true,
  43354. onMouseleave: ($event) => _ctx.states.inputHovering = false
  43355. }, [
  43356. createVNode(_component_el_tooltip, {
  43357. ref: "tooltipRef",
  43358. visible: _ctx.dropdownMenuVisible,
  43359. teleported: _ctx.teleported,
  43360. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  43361. "popper-style": _ctx.popperStyle,
  43362. "gpu-acceleration": false,
  43363. "stop-popper-mouse-event": false,
  43364. "popper-options": _ctx.popperOptions,
  43365. "fallback-placements": _ctx.fallbackPlacements,
  43366. effect: _ctx.effect,
  43367. placement: _ctx.placement,
  43368. pure: "",
  43369. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  43370. trigger: "click",
  43371. persistent: _ctx.persistent,
  43372. "append-to": _ctx.appendTo,
  43373. "show-arrow": _ctx.showArrow,
  43374. offset: _ctx.offset,
  43375. onBeforeShow: _ctx.handleMenuEnter,
  43376. onHide: ($event) => _ctx.states.isBeforeHide = false
  43377. }, {
  43378. default: withCtx(() => {
  43379. var _a, _b;
  43380. return [
  43381. createElementVNode("div", {
  43382. ref: "wrapperRef",
  43383. class: normalizeClass([
  43384. _ctx.nsSelect.e("wrapper"),
  43385. _ctx.nsSelect.is("focused", _ctx.isFocused),
  43386. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  43387. _ctx.nsSelect.is("filterable", _ctx.filterable),
  43388. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  43389. ]),
  43390. onClick: withModifiers(_ctx.toggleMenu, ["prevent"])
  43391. }, [
  43392. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
  43393. key: 0,
  43394. ref: "prefixRef",
  43395. class: normalizeClass(_ctx.nsSelect.e("prefix"))
  43396. }, [
  43397. renderSlot(_ctx.$slots, "prefix")
  43398. ], 2)) : createCommentVNode("v-if", true),
  43399. createElementVNode("div", {
  43400. ref: "selectionRef",
  43401. class: normalizeClass([
  43402. _ctx.nsSelect.e("selection"),
  43403. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.modelValue.length)
  43404. ])
  43405. }, [
  43406. _ctx.multiple ? renderSlot(_ctx.$slots, "tag", {
  43407. key: 0,
  43408. data: _ctx.states.cachedOptions,
  43409. deleteTag: _ctx.deleteTag,
  43410. selectDisabled: _ctx.selectDisabled
  43411. }, () => [
  43412. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  43413. return openBlock(), createElementBlock("div", {
  43414. key: _ctx.getValueKey(_ctx.getValue(item)),
  43415. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  43416. }, [
  43417. createVNode(_component_el_tag, {
  43418. closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
  43419. size: _ctx.collapseTagSize,
  43420. type: _ctx.tagType,
  43421. effect: _ctx.tagEffect,
  43422. "disable-transitions": "",
  43423. style: normalizeStyle(_ctx.tagStyle),
  43424. onClose: ($event) => _ctx.deleteTag($event, item)
  43425. }, {
  43426. default: withCtx(() => [
  43427. createElementVNode("span", {
  43428. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  43429. }, [
  43430. renderSlot(_ctx.$slots, "label", {
  43431. index: _ctx.getIndex(item),
  43432. label: _ctx.getLabel(item),
  43433. value: _ctx.getValue(item)
  43434. }, () => [
  43435. createTextVNode(toDisplayString(_ctx.getLabel(item)), 1)
  43436. ])
  43437. ], 2)
  43438. ]),
  43439. _: 2
  43440. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  43441. ], 2);
  43442. }), 128)),
  43443. _ctx.collapseTags && _ctx.modelValue.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
  43444. key: 0,
  43445. ref: "tagTooltipRef",
  43446. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  43447. "fallback-placements": ["bottom", "top", "right", "left"],
  43448. effect: _ctx.effect,
  43449. placement: "bottom",
  43450. "popper-class": _ctx.popperClass,
  43451. "popper-style": _ctx.popperStyle,
  43452. teleported: _ctx.teleported
  43453. }, {
  43454. default: withCtx(() => [
  43455. createElementVNode("div", {
  43456. ref: "collapseItemRef",
  43457. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  43458. }, [
  43459. createVNode(_component_el_tag, {
  43460. closable: false,
  43461. size: _ctx.collapseTagSize,
  43462. type: _ctx.tagType,
  43463. effect: _ctx.tagEffect,
  43464. style: normalizeStyle(_ctx.collapseTagStyle),
  43465. "disable-transitions": ""
  43466. }, {
  43467. default: withCtx(() => [
  43468. createElementVNode("span", {
  43469. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  43470. }, " + " + toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 3)
  43471. ]),
  43472. _: 1
  43473. }, 8, ["size", "type", "effect", "style"])
  43474. ], 2)
  43475. ]),
  43476. content: withCtx(() => [
  43477. createElementVNode("div", {
  43478. ref: "tagMenuRef",
  43479. class: normalizeClass(_ctx.nsSelect.e("selection"))
  43480. }, [
  43481. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (selected) => {
  43482. return openBlock(), createElementBlock("div", {
  43483. key: _ctx.getValueKey(_ctx.getValue(selected)),
  43484. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  43485. }, [
  43486. createVNode(_component_el_tag, {
  43487. class: "in-tooltip",
  43488. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  43489. size: _ctx.collapseTagSize,
  43490. type: _ctx.tagType,
  43491. effect: _ctx.tagEffect,
  43492. "disable-transitions": "",
  43493. onClose: ($event) => _ctx.deleteTag($event, selected)
  43494. }, {
  43495. default: withCtx(() => [
  43496. createElementVNode("span", {
  43497. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  43498. }, [
  43499. renderSlot(_ctx.$slots, "label", {
  43500. index: _ctx.getIndex(selected),
  43501. label: _ctx.getLabel(selected),
  43502. value: _ctx.getValue(selected)
  43503. }, () => [
  43504. createTextVNode(toDisplayString(_ctx.getLabel(selected)), 1)
  43505. ])
  43506. ], 2)
  43507. ]),
  43508. _: 2
  43509. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  43510. ], 2);
  43511. }), 128))
  43512. ], 2)
  43513. ]),
  43514. _: 3
  43515. }, 8, ["disabled", "effect", "popper-class", "popper-style", "teleported"])) : createCommentVNode("v-if", true)
  43516. ]) : createCommentVNode("v-if", true),
  43517. createElementVNode("div", {
  43518. class: normalizeClass([
  43519. _ctx.nsSelect.e("selected-item"),
  43520. _ctx.nsSelect.e("input-wrapper"),
  43521. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  43522. ])
  43523. }, [
  43524. withDirectives(createElementVNode("input", {
  43525. id: _ctx.inputId,
  43526. ref: "inputRef",
  43527. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  43528. style: normalizeStyle(_ctx.inputStyle),
  43529. autocomplete: _ctx.autocomplete,
  43530. tabindex: _ctx.tabindex,
  43531. "aria-autocomplete": "none",
  43532. "aria-haspopup": "listbox",
  43533. autocapitalize: "off",
  43534. "aria-expanded": _ctx.expanded,
  43535. "aria-label": _ctx.ariaLabel,
  43536. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  43537. disabled: _ctx.selectDisabled,
  43538. role: "combobox",
  43539. "aria-controls": _ctx.contentId,
  43540. "aria-activedescendant": _ctx.states.hoveringIndex >= 0 ? `${_ctx.contentId}-${_ctx.states.hoveringIndex}` : "",
  43541. readonly: !_ctx.filterable,
  43542. spellcheck: "false",
  43543. type: "text",
  43544. name: _ctx.name,
  43545. onInput: _ctx.onInput,
  43546. onCompositionstart: _ctx.handleCompositionStart,
  43547. onCompositionupdate: _ctx.handleCompositionUpdate,
  43548. onCompositionend: _ctx.handleCompositionEnd,
  43549. onKeydown: [
  43550. withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"]),
  43551. withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"]),
  43552. withKeys(withModifiers(_ctx.onKeyboardSelect, ["stop", "prevent"]), ["enter"]),
  43553. withKeys(withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  43554. withKeys(withModifiers(_ctx.handleDel, ["stop"]), ["delete"])
  43555. ],
  43556. onClick: withModifiers(_ctx.toggleMenu, ["stop"])
  43557. }, null, 46, ["id", "onUpdate:modelValue", "autocomplete", "tabindex", "aria-expanded", "aria-label", "disabled", "aria-controls", "aria-activedescendant", "readonly", "name", "onInput", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown", "onClick"]), [
  43558. [vModelText, _ctx.states.inputValue]
  43559. ]),
  43560. _ctx.filterable ? (openBlock(), createElementBlock("span", {
  43561. key: 0,
  43562. ref: "calculatorRef",
  43563. "aria-hidden": "true",
  43564. class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
  43565. textContent: toDisplayString(_ctx.states.inputValue)
  43566. }, null, 10, ["textContent"])) : createCommentVNode("v-if", true)
  43567. ], 2),
  43568. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
  43569. key: 1,
  43570. class: normalizeClass([
  43571. _ctx.nsSelect.e("selected-item"),
  43572. _ctx.nsSelect.e("placeholder"),
  43573. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  43574. ])
  43575. }, [
  43576. _ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
  43577. key: 0,
  43578. index: (_b = (_a = _ctx.allOptionsValueMap.get(_ctx.modelValue)) == null ? void 0 : _a.index) != null ? _b : -1,
  43579. label: _ctx.currentPlaceholder,
  43580. value: _ctx.modelValue
  43581. }, () => [
  43582. createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)
  43583. ]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.currentPlaceholder), 1))
  43584. ], 2)) : createCommentVNode("v-if", true)
  43585. ], 2),
  43586. createElementVNode("div", {
  43587. ref: "suffixRef",
  43588. class: normalizeClass(_ctx.nsSelect.e("suffix"))
  43589. }, [
  43590. _ctx.iconComponent ? withDirectives((openBlock(), createBlock(_component_el_icon, {
  43591. key: 0,
  43592. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  43593. }, {
  43594. default: withCtx(() => [
  43595. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  43596. ]),
  43597. _: 1
  43598. }, 8, ["class"])), [
  43599. [vShow, !_ctx.showClearBtn]
  43600. ]) : createCommentVNode("v-if", true),
  43601. _ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  43602. key: 1,
  43603. class: normalizeClass([
  43604. _ctx.nsSelect.e("caret"),
  43605. _ctx.nsInput.e("icon"),
  43606. _ctx.nsSelect.e("clear")
  43607. ]),
  43608. onClick: withModifiers(_ctx.handleClear, ["prevent", "stop"])
  43609. }, {
  43610. default: withCtx(() => [
  43611. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  43612. ]),
  43613. _: 1
  43614. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  43615. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
  43616. key: 2,
  43617. class: normalizeClass([
  43618. _ctx.nsInput.e("icon"),
  43619. _ctx.nsInput.e("validateIcon"),
  43620. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  43621. ])
  43622. }, {
  43623. default: withCtx(() => [
  43624. (openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))
  43625. ]),
  43626. _: 1
  43627. }, 8, ["class"])) : createCommentVNode("v-if", true)
  43628. ], 2)
  43629. ], 10, ["onClick"])
  43630. ];
  43631. }),
  43632. content: withCtx(() => [
  43633. createVNode(_component_el_select_menu, {
  43634. id: _ctx.contentId,
  43635. ref: "menuRef",
  43636. data: _ctx.filteredOptions,
  43637. width: _ctx.popperSize - _ctx.BORDER_HORIZONTAL_WIDTH,
  43638. "hovering-index": _ctx.states.hoveringIndex,
  43639. "scrollbar-always-on": _ctx.scrollbarAlwaysOn,
  43640. "aria-label": _ctx.ariaLabel
  43641. }, createSlots({
  43642. default: withCtx((scope) => [
  43643. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(scope)))
  43644. ]),
  43645. _: 2
  43646. }, [
  43647. _ctx.$slots.header ? {
  43648. name: "header",
  43649. fn: withCtx(() => [
  43650. createElementVNode("div", {
  43651. class: normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  43652. onClick: withModifiers(() => {
  43653. }, ["stop"])
  43654. }, [
  43655. renderSlot(_ctx.$slots, "header")
  43656. ], 10, ["onClick"])
  43657. ])
  43658. } : void 0,
  43659. _ctx.$slots.loading && _ctx.loading ? {
  43660. name: "loading",
  43661. fn: withCtx(() => [
  43662. createElementVNode("div", {
  43663. class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  43664. }, [
  43665. renderSlot(_ctx.$slots, "loading")
  43666. ], 2)
  43667. ])
  43668. } : _ctx.loading || _ctx.filteredOptions.length === 0 ? {
  43669. name: "empty",
  43670. fn: withCtx(() => [
  43671. createElementVNode("div", {
  43672. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  43673. }, [
  43674. renderSlot(_ctx.$slots, "empty", {}, () => [
  43675. createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)
  43676. ])
  43677. ], 2)
  43678. ])
  43679. } : void 0,
  43680. _ctx.$slots.footer ? {
  43681. name: "footer",
  43682. fn: withCtx(() => [
  43683. createElementVNode("div", {
  43684. class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  43685. onClick: withModifiers(() => {
  43686. }, ["stop"])
  43687. }, [
  43688. renderSlot(_ctx.$slots, "footer")
  43689. ], 10, ["onClick"])
  43690. ])
  43691. } : void 0
  43692. ]), 1032, ["id", "data", "width", "hovering-index", "scrollbar-always-on", "aria-label"])
  43693. ]),
  43694. _: 3
  43695. }, 8, ["visible", "teleported", "popper-class", "popper-style", "popper-options", "fallback-placements", "effect", "placement", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  43696. ], 42, ["onMouseenter", "onMouseleave"])), [
  43697. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  43698. ]);
  43699. }
  43700. var Select = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", _sfc_render$5], ["__file", "select.vue"]]);
  43701. const ElSelectV2 = withInstall(Select);
  43702. const skeletonProps = buildProps({
  43703. animated: Boolean,
  43704. count: {
  43705. type: Number,
  43706. default: 1
  43707. },
  43708. rows: {
  43709. type: Number,
  43710. default: 3
  43711. },
  43712. loading: {
  43713. type: Boolean,
  43714. default: true
  43715. },
  43716. throttle: {
  43717. type: definePropType([Number, Object])
  43718. }
  43719. });
  43720. const skeletonItemProps = buildProps({
  43721. variant: {
  43722. type: String,
  43723. values: [
  43724. "circle",
  43725. "rect",
  43726. "h1",
  43727. "h3",
  43728. "text",
  43729. "caption",
  43730. "p",
  43731. "image",
  43732. "button"
  43733. ],
  43734. default: "text"
  43735. }
  43736. });
  43737. const __default__$B = defineComponent({
  43738. name: "ElSkeletonItem"
  43739. });
  43740. const _sfc_main$I = /* @__PURE__ */ defineComponent({
  43741. ...__default__$B,
  43742. props: skeletonItemProps,
  43743. setup(__props) {
  43744. const ns = useNamespace("skeleton");
  43745. return (_ctx, _cache) => {
  43746. return openBlock(), createElementBlock("div", {
  43747. class: normalizeClass([unref(ns).e("item"), unref(ns).e(_ctx.variant)])
  43748. }, [
  43749. _ctx.variant === "image" ? (openBlock(), createBlock(unref(picture_filled_default), { key: 0 })) : createCommentVNode("v-if", true)
  43750. ], 2);
  43751. };
  43752. }
  43753. });
  43754. var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "skeleton-item.vue"]]);
  43755. const __default__$A = defineComponent({
  43756. name: "ElSkeleton"
  43757. });
  43758. const _sfc_main$H = /* @__PURE__ */ defineComponent({
  43759. ...__default__$A,
  43760. props: skeletonProps,
  43761. setup(__props, { expose }) {
  43762. const props = __props;
  43763. const ns = useNamespace("skeleton");
  43764. const uiLoading = useThrottleRender(toRef(props, "loading"), props.throttle);
  43765. expose({
  43766. uiLoading
  43767. });
  43768. return (_ctx, _cache) => {
  43769. return unref(uiLoading) ? (openBlock(), createElementBlock("div", mergeProps({
  43770. key: 0,
  43771. class: [unref(ns).b(), unref(ns).is("animated", _ctx.animated)]
  43772. }, _ctx.$attrs), [
  43773. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.count, (i) => {
  43774. return openBlock(), createElementBlock(Fragment, { key: i }, [
  43775. unref(uiLoading) ? renderSlot(_ctx.$slots, "template", { key: i }, () => [
  43776. createVNode(SkeletonItem, {
  43777. class: normalizeClass(unref(ns).is("first")),
  43778. variant: "p"
  43779. }, null, 8, ["class"]),
  43780. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (item) => {
  43781. return openBlock(), createBlock(SkeletonItem, {
  43782. key: item,
  43783. class: normalizeClass([
  43784. unref(ns).e("paragraph"),
  43785. unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  43786. ]),
  43787. variant: "p"
  43788. }, null, 8, ["class"]);
  43789. }), 128))
  43790. ]) : createCommentVNode("v-if", true)
  43791. ], 64);
  43792. }), 128))
  43793. ], 16)) : renderSlot(_ctx.$slots, "default", normalizeProps(mergeProps({ key: 1 }, _ctx.$attrs)));
  43794. };
  43795. }
  43796. });
  43797. var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "skeleton.vue"]]);
  43798. const ElSkeleton = withInstall(Skeleton, {
  43799. SkeletonItem
  43800. });
  43801. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  43802. const sliderContextKey = Symbol("sliderContextKey");
  43803. const sliderProps = buildProps({
  43804. modelValue: {
  43805. type: definePropType([Number, Array]),
  43806. default: 0
  43807. },
  43808. id: {
  43809. type: String,
  43810. default: void 0
  43811. },
  43812. min: {
  43813. type: Number,
  43814. default: 0
  43815. },
  43816. max: {
  43817. type: Number,
  43818. default: 100
  43819. },
  43820. step: {
  43821. type: Number,
  43822. default: 1
  43823. },
  43824. showInput: Boolean,
  43825. showInputControls: {
  43826. type: Boolean,
  43827. default: true
  43828. },
  43829. size: useSizeProp,
  43830. inputSize: useSizeProp,
  43831. showStops: Boolean,
  43832. showTooltip: {
  43833. type: Boolean,
  43834. default: true
  43835. },
  43836. formatTooltip: {
  43837. type: definePropType(Function),
  43838. default: void 0
  43839. },
  43840. disabled: Boolean,
  43841. range: Boolean,
  43842. vertical: Boolean,
  43843. height: String,
  43844. rangeStartLabel: {
  43845. type: String,
  43846. default: void 0
  43847. },
  43848. rangeEndLabel: {
  43849. type: String,
  43850. default: void 0
  43851. },
  43852. formatValueText: {
  43853. type: definePropType(Function),
  43854. default: void 0
  43855. },
  43856. tooltipClass: {
  43857. type: String,
  43858. default: void 0
  43859. },
  43860. placement: {
  43861. type: String,
  43862. values: Ee,
  43863. default: "top"
  43864. },
  43865. marks: {
  43866. type: definePropType(Object)
  43867. },
  43868. validateEvent: {
  43869. type: Boolean,
  43870. default: true
  43871. },
  43872. persistent: {
  43873. type: Boolean,
  43874. default: true
  43875. },
  43876. ...useAriaProps(["ariaLabel"])
  43877. });
  43878. const isValidValue$1 = (value) => isNumber(value) || isArray$1(value) && value.every(isNumber);
  43879. const sliderEmits = {
  43880. [UPDATE_MODEL_EVENT]: isValidValue$1,
  43881. [INPUT_EVENT]: isValidValue$1,
  43882. [CHANGE_EVENT]: isValidValue$1
  43883. };
  43884. const useLifecycle = (props, initData, resetSize) => {
  43885. const sliderWrapper = ref();
  43886. onMounted(async () => {
  43887. if (props.range) {
  43888. if (isArray$1(props.modelValue)) {
  43889. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  43890. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  43891. } else {
  43892. initData.firstValue = props.min;
  43893. initData.secondValue = props.max;
  43894. }
  43895. initData.oldValue = [initData.firstValue, initData.secondValue];
  43896. } else {
  43897. if (!isNumber(props.modelValue) || Number.isNaN(props.modelValue)) {
  43898. initData.firstValue = props.min;
  43899. } else {
  43900. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  43901. }
  43902. initData.oldValue = initData.firstValue;
  43903. }
  43904. useEventListener(window, "resize", resetSize);
  43905. await nextTick();
  43906. resetSize();
  43907. });
  43908. return {
  43909. sliderWrapper
  43910. };
  43911. };
  43912. const useMarks = (props) => {
  43913. return computed(() => {
  43914. if (!props.marks) {
  43915. return [];
  43916. }
  43917. const marksKeys = Object.keys(props.marks);
  43918. return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  43919. point,
  43920. position: (point - props.min) * 100 / (props.max - props.min),
  43921. mark: props.marks[point]
  43922. }));
  43923. });
  43924. };
  43925. const useSlide = (props, initData, emit) => {
  43926. const { form: elForm, formItem: elFormItem } = useFormItem();
  43927. const slider = shallowRef();
  43928. const firstButton = ref();
  43929. const secondButton = ref();
  43930. const buttonRefs = {
  43931. firstButton,
  43932. secondButton
  43933. };
  43934. const sliderDisabled = computed(() => {
  43935. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  43936. });
  43937. const minValue = computed(() => {
  43938. return Math.min(initData.firstValue, initData.secondValue);
  43939. });
  43940. const maxValue = computed(() => {
  43941. return Math.max(initData.firstValue, initData.secondValue);
  43942. });
  43943. const barSize = computed(() => {
  43944. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  43945. });
  43946. const barStart = computed(() => {
  43947. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  43948. });
  43949. const runwayStyle = computed(() => {
  43950. return props.vertical ? { height: props.height } : {};
  43951. });
  43952. const barStyle = computed(() => {
  43953. return props.vertical ? {
  43954. height: barSize.value,
  43955. bottom: barStart.value
  43956. } : {
  43957. width: barSize.value,
  43958. left: barStart.value
  43959. };
  43960. });
  43961. const resetSize = () => {
  43962. if (slider.value) {
  43963. const rect = slider.value.getBoundingClientRect();
  43964. initData.sliderSize = rect[props.vertical ? "height" : "width"];
  43965. }
  43966. };
  43967. const getButtonRefByPercent = (percent) => {
  43968. const targetValue = props.min + percent * (props.max - props.min) / 100;
  43969. if (!props.range) {
  43970. return firstButton;
  43971. }
  43972. let buttonRefName;
  43973. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  43974. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  43975. } else {
  43976. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  43977. }
  43978. return buttonRefs[buttonRefName];
  43979. };
  43980. const setPosition = (percent) => {
  43981. const buttonRef = getButtonRefByPercent(percent);
  43982. buttonRef.value.setPosition(percent);
  43983. return buttonRef;
  43984. };
  43985. const setFirstValue = (firstValue) => {
  43986. initData.firstValue = firstValue != null ? firstValue : props.min;
  43987. _emit(props.range ? [minValue.value, maxValue.value] : firstValue != null ? firstValue : props.min);
  43988. };
  43989. const setSecondValue = (secondValue) => {
  43990. initData.secondValue = secondValue;
  43991. if (props.range) {
  43992. _emit([minValue.value, maxValue.value]);
  43993. }
  43994. };
  43995. const _emit = (val) => {
  43996. emit(UPDATE_MODEL_EVENT, val);
  43997. emit(INPUT_EVENT, val);
  43998. };
  43999. const emitChange = async () => {
  44000. await nextTick();
  44001. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  44002. };
  44003. const handleSliderPointerEvent = (event) => {
  44004. var _a, _b, _c, _d, _e, _f;
  44005. if (sliderDisabled.value || initData.dragging)
  44006. return;
  44007. resetSize();
  44008. let newPercent = 0;
  44009. if (props.vertical) {
  44010. const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  44011. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  44012. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  44013. } else {
  44014. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  44015. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  44016. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  44017. }
  44018. if (newPercent < 0 || newPercent > 100)
  44019. return;
  44020. return setPosition(newPercent);
  44021. };
  44022. const onSliderWrapperPrevent = (event) => {
  44023. var _a, _b;
  44024. if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  44025. event.preventDefault();
  44026. }
  44027. };
  44028. const onSliderDown = async (event) => {
  44029. const buttonRef = handleSliderPointerEvent(event);
  44030. if (buttonRef) {
  44031. await nextTick();
  44032. buttonRef.value.onButtonDown(event);
  44033. }
  44034. };
  44035. const onSliderClick = (event) => {
  44036. const buttonRef = handleSliderPointerEvent(event);
  44037. if (buttonRef) {
  44038. emitChange();
  44039. }
  44040. };
  44041. const onSliderMarkerDown = (position) => {
  44042. if (sliderDisabled.value || initData.dragging)
  44043. return;
  44044. const buttonRef = setPosition(position);
  44045. if (buttonRef) {
  44046. emitChange();
  44047. }
  44048. };
  44049. return {
  44050. elFormItem,
  44051. slider,
  44052. firstButton,
  44053. secondButton,
  44054. sliderDisabled,
  44055. minValue,
  44056. maxValue,
  44057. runwayStyle,
  44058. barStyle,
  44059. resetSize,
  44060. setPosition,
  44061. emitChange,
  44062. onSliderWrapperPrevent,
  44063. onSliderClick,
  44064. onSliderDown,
  44065. onSliderMarkerDown,
  44066. setFirstValue,
  44067. setSecondValue
  44068. };
  44069. };
  44070. const useTooltip = (props, formatTooltip, showTooltip) => {
  44071. const tooltip = ref();
  44072. const tooltipVisible = ref(false);
  44073. const enableFormat = computed(() => {
  44074. return formatTooltip.value instanceof Function;
  44075. });
  44076. const formatValue = computed(() => {
  44077. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  44078. });
  44079. const displayTooltip = debounce(() => {
  44080. showTooltip.value && (tooltipVisible.value = true);
  44081. }, 50);
  44082. const hideTooltip = debounce(() => {
  44083. showTooltip.value && (tooltipVisible.value = false);
  44084. }, 50);
  44085. return {
  44086. tooltip,
  44087. tooltipVisible,
  44088. formatValue,
  44089. displayTooltip,
  44090. hideTooltip
  44091. };
  44092. };
  44093. const useSliderButton = (props, initData, emit) => {
  44094. const {
  44095. disabled,
  44096. min,
  44097. max,
  44098. step,
  44099. showTooltip,
  44100. persistent,
  44101. precision,
  44102. sliderSize,
  44103. formatTooltip,
  44104. emitChange,
  44105. resetSize,
  44106. updateDragging
  44107. } = inject(sliderContextKey);
  44108. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  44109. const button = ref();
  44110. const currentPosition = computed(() => {
  44111. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  44112. });
  44113. const wrapperStyle = computed(() => {
  44114. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  44115. });
  44116. const handleMouseEnter = () => {
  44117. initData.hovering = true;
  44118. displayTooltip();
  44119. };
  44120. const handleMouseLeave = () => {
  44121. initData.hovering = false;
  44122. if (!initData.dragging) {
  44123. hideTooltip();
  44124. }
  44125. };
  44126. const onButtonDown = (event) => {
  44127. if (disabled.value)
  44128. return;
  44129. event.preventDefault();
  44130. onDragStart(event);
  44131. window.addEventListener("mousemove", onDragging);
  44132. window.addEventListener("touchmove", onDragging);
  44133. window.addEventListener("mouseup", onDragEnd);
  44134. window.addEventListener("touchend", onDragEnd);
  44135. window.addEventListener("contextmenu", onDragEnd);
  44136. button.value.focus();
  44137. };
  44138. const incrementPosition = (amount) => {
  44139. if (disabled.value)
  44140. return;
  44141. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  44142. setPosition(initData.newPosition);
  44143. emitChange();
  44144. };
  44145. const onLeftKeyDown = () => {
  44146. incrementPosition(-step.value);
  44147. };
  44148. const onRightKeyDown = () => {
  44149. incrementPosition(step.value);
  44150. };
  44151. const onPageDownKeyDown = () => {
  44152. incrementPosition(-step.value * 4);
  44153. };
  44154. const onPageUpKeyDown = () => {
  44155. incrementPosition(step.value * 4);
  44156. };
  44157. const onHomeKeyDown = () => {
  44158. if (disabled.value)
  44159. return;
  44160. setPosition(0);
  44161. emitChange();
  44162. };
  44163. const onEndKeyDown = () => {
  44164. if (disabled.value)
  44165. return;
  44166. setPosition(100);
  44167. emitChange();
  44168. };
  44169. const onKeyDown = (event) => {
  44170. const code = getEventCode(event);
  44171. let isPreventDefault = true;
  44172. switch (code) {
  44173. case EVENT_CODE.left:
  44174. case EVENT_CODE.down:
  44175. onLeftKeyDown();
  44176. break;
  44177. case EVENT_CODE.right:
  44178. case EVENT_CODE.up:
  44179. onRightKeyDown();
  44180. break;
  44181. case EVENT_CODE.home:
  44182. onHomeKeyDown();
  44183. break;
  44184. case EVENT_CODE.end:
  44185. onEndKeyDown();
  44186. break;
  44187. case EVENT_CODE.pageDown:
  44188. onPageDownKeyDown();
  44189. break;
  44190. case EVENT_CODE.pageUp:
  44191. onPageUpKeyDown();
  44192. break;
  44193. default:
  44194. isPreventDefault = false;
  44195. break;
  44196. }
  44197. isPreventDefault && event.preventDefault();
  44198. };
  44199. const getClientXY = (event) => {
  44200. let clientX;
  44201. let clientY;
  44202. if (event.type.startsWith("touch")) {
  44203. clientY = event.touches[0].clientY;
  44204. clientX = event.touches[0].clientX;
  44205. } else {
  44206. clientY = event.clientY;
  44207. clientX = event.clientX;
  44208. }
  44209. return {
  44210. clientX,
  44211. clientY
  44212. };
  44213. };
  44214. const onDragStart = (event) => {
  44215. initData.dragging = true;
  44216. initData.isClick = true;
  44217. const { clientX, clientY } = getClientXY(event);
  44218. if (props.vertical) {
  44219. initData.startY = clientY;
  44220. } else {
  44221. initData.startX = clientX;
  44222. }
  44223. initData.startPosition = Number.parseFloat(currentPosition.value);
  44224. initData.newPosition = initData.startPosition;
  44225. };
  44226. const onDragging = (event) => {
  44227. if (initData.dragging) {
  44228. initData.isClick = false;
  44229. displayTooltip();
  44230. resetSize();
  44231. let diff;
  44232. const { clientX, clientY } = getClientXY(event);
  44233. if (props.vertical) {
  44234. initData.currentY = clientY;
  44235. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  44236. } else {
  44237. initData.currentX = clientX;
  44238. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  44239. }
  44240. initData.newPosition = initData.startPosition + diff;
  44241. setPosition(initData.newPosition);
  44242. }
  44243. };
  44244. const onDragEnd = () => {
  44245. if (initData.dragging) {
  44246. setTimeout(() => {
  44247. initData.dragging = false;
  44248. if (!initData.hovering) {
  44249. hideTooltip();
  44250. }
  44251. if (!initData.isClick) {
  44252. setPosition(initData.newPosition);
  44253. }
  44254. emitChange();
  44255. }, 0);
  44256. window.removeEventListener("mousemove", onDragging);
  44257. window.removeEventListener("touchmove", onDragging);
  44258. window.removeEventListener("mouseup", onDragEnd);
  44259. window.removeEventListener("touchend", onDragEnd);
  44260. window.removeEventListener("contextmenu", onDragEnd);
  44261. }
  44262. };
  44263. const setPosition = async (newPosition) => {
  44264. if (newPosition === null || Number.isNaN(+newPosition))
  44265. return;
  44266. newPosition = clamp$1(newPosition, 0, 100);
  44267. const fullSteps = Math.floor((max.value - min.value) / step.value);
  44268. const fullRangePercentage = fullSteps * step.value / (max.value - min.value) * 100;
  44269. const threshold = fullRangePercentage + (100 - fullRangePercentage) / 2;
  44270. let value;
  44271. if (newPosition < fullRangePercentage) {
  44272. const valueBetween = fullRangePercentage / fullSteps;
  44273. const steps = Math.round(newPosition / valueBetween);
  44274. value = min.value + steps * step.value;
  44275. } else if (newPosition < threshold) {
  44276. value = min.value + fullSteps * step.value;
  44277. } else {
  44278. value = max.value;
  44279. }
  44280. value = Number.parseFloat(value.toFixed(precision.value));
  44281. if (value !== props.modelValue) {
  44282. emit(UPDATE_MODEL_EVENT, value);
  44283. }
  44284. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  44285. initData.oldValue = props.modelValue;
  44286. }
  44287. await nextTick();
  44288. initData.dragging && displayTooltip();
  44289. tooltip.value.updatePopper();
  44290. };
  44291. watch(() => initData.dragging, (val) => {
  44292. updateDragging(val);
  44293. });
  44294. useEventListener(button, "touchstart", onButtonDown, { passive: false });
  44295. return {
  44296. disabled,
  44297. button,
  44298. tooltip,
  44299. tooltipVisible,
  44300. showTooltip,
  44301. persistent,
  44302. wrapperStyle,
  44303. formatValue,
  44304. handleMouseEnter,
  44305. handleMouseLeave,
  44306. onButtonDown,
  44307. onKeyDown,
  44308. setPosition
  44309. };
  44310. };
  44311. const useStops = (props, initData, minValue, maxValue) => {
  44312. const stops = computed(() => {
  44313. if (!props.showStops || props.min > props.max)
  44314. return [];
  44315. if (props.step === 0) {
  44316. debugWarn("ElSlider", "step should not be 0.");
  44317. return [];
  44318. }
  44319. const stopCount = Math.ceil((props.max - props.min) / props.step);
  44320. const stepWidth = 100 * props.step / (props.max - props.min);
  44321. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  44322. if (props.range) {
  44323. return result.filter((step) => {
  44324. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  44325. });
  44326. } else {
  44327. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  44328. }
  44329. });
  44330. const getStopStyle = (position) => {
  44331. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  44332. };
  44333. return {
  44334. stops,
  44335. getStopStyle
  44336. };
  44337. };
  44338. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  44339. const _emit = (val) => {
  44340. emit(UPDATE_MODEL_EVENT, val);
  44341. emit(INPUT_EVENT, val);
  44342. };
  44343. const valueChanged = () => {
  44344. if (props.range) {
  44345. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  44346. } else {
  44347. return props.modelValue !== initData.oldValue;
  44348. }
  44349. };
  44350. const setValues = () => {
  44351. var _a, _b;
  44352. if (props.min > props.max) {
  44353. throwError("Slider", "min should not be greater than max.");
  44354. }
  44355. const val = props.modelValue;
  44356. if (props.range && isArray$1(val)) {
  44357. if (val[1] < props.min) {
  44358. _emit([props.min, props.min]);
  44359. } else if (val[0] > props.max) {
  44360. _emit([props.max, props.max]);
  44361. } else if (val[0] < props.min) {
  44362. _emit([props.min, val[1]]);
  44363. } else if (val[1] > props.max) {
  44364. _emit([val[0], props.max]);
  44365. } else {
  44366. initData.firstValue = val[0];
  44367. initData.secondValue = val[1];
  44368. if (valueChanged()) {
  44369. if (props.validateEvent) {
  44370. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn(err));
  44371. }
  44372. initData.oldValue = val.slice();
  44373. }
  44374. }
  44375. } else if (!props.range && isNumber(val) && !Number.isNaN(val)) {
  44376. if (val < props.min) {
  44377. _emit(props.min);
  44378. } else if (val > props.max) {
  44379. _emit(props.max);
  44380. } else {
  44381. initData.firstValue = val;
  44382. if (valueChanged()) {
  44383. if (props.validateEvent) {
  44384. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn(err));
  44385. }
  44386. initData.oldValue = val;
  44387. }
  44388. }
  44389. }
  44390. };
  44391. setValues();
  44392. watch(() => initData.dragging, (val) => {
  44393. if (!val) {
  44394. setValues();
  44395. }
  44396. });
  44397. watch(() => props.modelValue, (val, oldVal) => {
  44398. if (initData.dragging || isArray$1(val) && isArray$1(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  44399. return;
  44400. }
  44401. setValues();
  44402. }, {
  44403. deep: true
  44404. });
  44405. watch(() => [props.min, props.max], () => {
  44406. setValues();
  44407. });
  44408. };
  44409. const sliderButtonProps = buildProps({
  44410. modelValue: {
  44411. type: Number,
  44412. default: 0
  44413. },
  44414. vertical: Boolean,
  44415. tooltipClass: String,
  44416. placement: {
  44417. type: String,
  44418. values: Ee,
  44419. default: "top"
  44420. }
  44421. });
  44422. const sliderButtonEmits = {
  44423. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  44424. };
  44425. const __default__$z = defineComponent({
  44426. name: "ElSliderButton"
  44427. });
  44428. const _sfc_main$G = /* @__PURE__ */ defineComponent({
  44429. ...__default__$z,
  44430. props: sliderButtonProps,
  44431. emits: sliderButtonEmits,
  44432. setup(__props, { expose, emit }) {
  44433. const props = __props;
  44434. const ns = useNamespace("slider");
  44435. const initData = reactive({
  44436. hovering: false,
  44437. dragging: false,
  44438. isClick: false,
  44439. startX: 0,
  44440. currentX: 0,
  44441. startY: 0,
  44442. currentY: 0,
  44443. startPosition: 0,
  44444. newPosition: 0,
  44445. oldValue: props.modelValue
  44446. });
  44447. const tooltipPersistent = computed(() => !showTooltip.value ? false : persistent.value);
  44448. const {
  44449. disabled,
  44450. button,
  44451. tooltip,
  44452. showTooltip,
  44453. persistent,
  44454. tooltipVisible,
  44455. wrapperStyle,
  44456. formatValue,
  44457. handleMouseEnter,
  44458. handleMouseLeave,
  44459. onButtonDown,
  44460. onKeyDown,
  44461. setPosition
  44462. } = useSliderButton(props, initData, emit);
  44463. const { hovering, dragging } = toRefs(initData);
  44464. expose({
  44465. onButtonDown,
  44466. onKeyDown,
  44467. setPosition,
  44468. hovering,
  44469. dragging
  44470. });
  44471. return (_ctx, _cache) => {
  44472. return openBlock(), createElementBlock("div", {
  44473. ref_key: "button",
  44474. ref: button,
  44475. class: normalizeClass([unref(ns).e("button-wrapper"), { hover: unref(hovering), dragging: unref(dragging) }]),
  44476. style: normalizeStyle(unref(wrapperStyle)),
  44477. tabindex: unref(disabled) ? void 0 : 0,
  44478. onMouseenter: unref(handleMouseEnter),
  44479. onMouseleave: unref(handleMouseLeave),
  44480. onMousedown: unref(onButtonDown),
  44481. onFocus: unref(handleMouseEnter),
  44482. onBlur: unref(handleMouseLeave),
  44483. onKeydown: unref(onKeyDown)
  44484. }, [
  44485. createVNode(unref(ElTooltip), {
  44486. ref_key: "tooltip",
  44487. ref: tooltip,
  44488. visible: unref(tooltipVisible),
  44489. placement: _ctx.placement,
  44490. "fallback-placements": ["top", "bottom", "right", "left"],
  44491. "stop-popper-mouse-event": false,
  44492. "popper-class": _ctx.tooltipClass,
  44493. disabled: !unref(showTooltip),
  44494. persistent: unref(tooltipPersistent)
  44495. }, {
  44496. content: withCtx(() => [
  44497. createElementVNode("span", null, toDisplayString(unref(formatValue)), 1)
  44498. ]),
  44499. default: withCtx(() => [
  44500. createElementVNode("div", {
  44501. class: normalizeClass([unref(ns).e("button"), { hover: unref(hovering), dragging: unref(dragging) }])
  44502. }, null, 2)
  44503. ]),
  44504. _: 1
  44505. }, 8, ["visible", "placement", "popper-class", "disabled", "persistent"])
  44506. ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"]);
  44507. };
  44508. }
  44509. });
  44510. var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "button.vue"]]);
  44511. const sliderMarkerProps = buildProps({
  44512. mark: {
  44513. type: definePropType([String, Object]),
  44514. default: void 0
  44515. }
  44516. });
  44517. var SliderMarker = defineComponent({
  44518. name: "ElSliderMarker",
  44519. props: sliderMarkerProps,
  44520. setup(props) {
  44521. const ns = useNamespace("slider");
  44522. const label = computed(() => {
  44523. return isString$1(props.mark) ? props.mark : props.mark.label;
  44524. });
  44525. const style = computed(() => isString$1(props.mark) ? void 0 : props.mark.style);
  44526. return () => h$1("div", {
  44527. class: ns.e("marks-text"),
  44528. style: style.value
  44529. }, label.value);
  44530. }
  44531. });
  44532. const __default__$y = defineComponent({
  44533. name: "ElSlider"
  44534. });
  44535. const _sfc_main$F = /* @__PURE__ */ defineComponent({
  44536. ...__default__$y,
  44537. props: sliderProps,
  44538. emits: sliderEmits,
  44539. setup(__props, { expose, emit }) {
  44540. const props = __props;
  44541. const ns = useNamespace("slider");
  44542. const { t } = useLocale();
  44543. const initData = reactive({
  44544. firstValue: 0,
  44545. secondValue: 0,
  44546. oldValue: 0,
  44547. dragging: false,
  44548. sliderSize: 1
  44549. });
  44550. const {
  44551. elFormItem,
  44552. slider,
  44553. firstButton,
  44554. secondButton,
  44555. sliderDisabled,
  44556. minValue,
  44557. maxValue,
  44558. runwayStyle,
  44559. barStyle,
  44560. resetSize,
  44561. emitChange,
  44562. onSliderWrapperPrevent,
  44563. onSliderClick,
  44564. onSliderDown,
  44565. onSliderMarkerDown,
  44566. setFirstValue,
  44567. setSecondValue
  44568. } = useSlide(props, initData, emit);
  44569. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  44570. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  44571. formItemContext: elFormItem
  44572. });
  44573. const sliderWrapperSize = useFormSize();
  44574. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  44575. const groupLabel = computed(() => {
  44576. return props.ariaLabel || t("el.slider.defaultLabel", {
  44577. min: props.min,
  44578. max: props.max
  44579. });
  44580. });
  44581. const firstButtonLabel = computed(() => {
  44582. if (props.range) {
  44583. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  44584. } else {
  44585. return groupLabel.value;
  44586. }
  44587. });
  44588. const firstValueText = computed(() => {
  44589. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  44590. });
  44591. const secondButtonLabel = computed(() => {
  44592. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  44593. });
  44594. const secondValueText = computed(() => {
  44595. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  44596. });
  44597. const sliderKls = computed(() => [
  44598. ns.b(),
  44599. ns.m(sliderWrapperSize.value),
  44600. ns.is("vertical", props.vertical),
  44601. { [ns.m("with-input")]: props.showInput }
  44602. ]);
  44603. const markList = useMarks(props);
  44604. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  44605. const precision = computed(() => {
  44606. const precisions = [props.min, props.max, props.step].map((item) => {
  44607. const decimal = `${item}`.split(".")[1];
  44608. return decimal ? decimal.length : 0;
  44609. });
  44610. return Math.max.apply(null, precisions);
  44611. });
  44612. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  44613. const { firstValue, secondValue, sliderSize } = toRefs(initData);
  44614. const updateDragging = (val) => {
  44615. initData.dragging = val;
  44616. };
  44617. useEventListener(sliderWrapper, "touchstart", onSliderWrapperPrevent, {
  44618. passive: false
  44619. });
  44620. useEventListener(sliderWrapper, "touchmove", onSliderWrapperPrevent, {
  44621. passive: false
  44622. });
  44623. provide(sliderContextKey, {
  44624. ...toRefs(props),
  44625. sliderSize,
  44626. disabled: sliderDisabled,
  44627. precision,
  44628. emitChange,
  44629. resetSize,
  44630. updateDragging
  44631. });
  44632. expose({
  44633. onSliderClick
  44634. });
  44635. return (_ctx, _cache) => {
  44636. var _a, _b;
  44637. return openBlock(), createElementBlock("div", {
  44638. id: _ctx.range ? unref(inputId) : void 0,
  44639. ref_key: "sliderWrapper",
  44640. ref: sliderWrapper,
  44641. class: normalizeClass(unref(sliderKls)),
  44642. role: _ctx.range ? "group" : void 0,
  44643. "aria-label": _ctx.range && !unref(isLabeledByFormItem) ? unref(groupLabel) : void 0,
  44644. "aria-labelledby": _ctx.range && unref(isLabeledByFormItem) ? (_a = unref(elFormItem)) == null ? void 0 : _a.labelId : void 0
  44645. }, [
  44646. createElementVNode("div", {
  44647. ref_key: "slider",
  44648. ref: slider,
  44649. class: normalizeClass([
  44650. unref(ns).e("runway"),
  44651. { "show-input": _ctx.showInput && !_ctx.range },
  44652. unref(ns).is("disabled", unref(sliderDisabled))
  44653. ]),
  44654. style: normalizeStyle(unref(runwayStyle)),
  44655. onMousedown: unref(onSliderDown),
  44656. onTouchstartPassive: unref(onSliderDown)
  44657. }, [
  44658. createElementVNode("div", {
  44659. class: normalizeClass(unref(ns).e("bar")),
  44660. style: normalizeStyle(unref(barStyle))
  44661. }, null, 6),
  44662. createVNode(SliderButton, {
  44663. id: !_ctx.range ? unref(inputId) : void 0,
  44664. ref_key: "firstButton",
  44665. ref: firstButton,
  44666. "model-value": unref(firstValue),
  44667. vertical: _ctx.vertical,
  44668. "tooltip-class": _ctx.tooltipClass,
  44669. placement: _ctx.placement,
  44670. role: "slider",
  44671. "aria-label": _ctx.range || !unref(isLabeledByFormItem) ? unref(firstButtonLabel) : void 0,
  44672. "aria-labelledby": !_ctx.range && unref(isLabeledByFormItem) ? (_b = unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  44673. "aria-valuemin": _ctx.min,
  44674. "aria-valuemax": _ctx.range ? unref(secondValue) : _ctx.max,
  44675. "aria-valuenow": unref(firstValue),
  44676. "aria-valuetext": unref(firstValueText),
  44677. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  44678. "aria-disabled": unref(sliderDisabled),
  44679. "onUpdate:modelValue": unref(setFirstValue)
  44680. }, null, 8, ["id", "model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-labelledby", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"]),
  44681. _ctx.range ? (openBlock(), createBlock(SliderButton, {
  44682. key: 0,
  44683. ref_key: "secondButton",
  44684. ref: secondButton,
  44685. "model-value": unref(secondValue),
  44686. vertical: _ctx.vertical,
  44687. "tooltip-class": _ctx.tooltipClass,
  44688. placement: _ctx.placement,
  44689. role: "slider",
  44690. "aria-label": unref(secondButtonLabel),
  44691. "aria-valuemin": unref(firstValue),
  44692. "aria-valuemax": _ctx.max,
  44693. "aria-valuenow": unref(secondValue),
  44694. "aria-valuetext": unref(secondValueText),
  44695. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  44696. "aria-disabled": unref(sliderDisabled),
  44697. "onUpdate:modelValue": unref(setSecondValue)
  44698. }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
  44699. _ctx.showStops ? (openBlock(), createElementBlock("div", { key: 1 }, [
  44700. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(stops), (item, key) => {
  44701. return openBlock(), createElementBlock("div", {
  44702. key,
  44703. class: normalizeClass(unref(ns).e("stop")),
  44704. style: normalizeStyle(unref(getStopStyle)(item))
  44705. }, null, 6);
  44706. }), 128))
  44707. ])) : createCommentVNode("v-if", true),
  44708. unref(markList).length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  44709. createElementVNode("div", null, [
  44710. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  44711. return openBlock(), createElementBlock("div", {
  44712. key,
  44713. style: normalizeStyle(unref(getStopStyle)(item.position)),
  44714. class: normalizeClass([unref(ns).e("stop"), unref(ns).e("marks-stop")])
  44715. }, null, 6);
  44716. }), 128))
  44717. ]),
  44718. createElementVNode("div", {
  44719. class: normalizeClass(unref(ns).e("marks"))
  44720. }, [
  44721. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  44722. return openBlock(), createBlock(unref(SliderMarker), {
  44723. key,
  44724. mark: item.mark,
  44725. style: normalizeStyle(unref(getStopStyle)(item.position)),
  44726. onMousedown: withModifiers(($event) => unref(onSliderMarkerDown)(item.position), ["stop"])
  44727. }, null, 8, ["mark", "style", "onMousedown"]);
  44728. }), 128))
  44729. ], 2)
  44730. ], 64)) : createCommentVNode("v-if", true)
  44731. ], 46, ["onMousedown", "onTouchstartPassive"]),
  44732. _ctx.showInput && !_ctx.range ? (openBlock(), createBlock(unref(ElInputNumber), {
  44733. key: 0,
  44734. ref: "input",
  44735. "model-value": unref(firstValue),
  44736. class: normalizeClass(unref(ns).e("input")),
  44737. step: _ctx.step,
  44738. disabled: unref(sliderDisabled),
  44739. controls: _ctx.showInputControls,
  44740. min: _ctx.min,
  44741. max: _ctx.max,
  44742. precision: unref(precision),
  44743. size: unref(sliderInputSize),
  44744. "onUpdate:modelValue": unref(setFirstValue),
  44745. onChange: unref(emitChange)
  44746. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
  44747. ], 10, ["id", "role", "aria-label", "aria-labelledby"]);
  44748. };
  44749. }
  44750. });
  44751. var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "slider.vue"]]);
  44752. const ElSlider = withInstall(Slider);
  44753. const spaceItemProps = buildProps({
  44754. prefixCls: {
  44755. type: String
  44756. }
  44757. });
  44758. const SpaceItem = defineComponent({
  44759. name: "ElSpaceItem",
  44760. props: spaceItemProps,
  44761. setup(props, { slots }) {
  44762. const ns = useNamespace("space");
  44763. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  44764. return () => h$1("div", { class: classes.value }, renderSlot(slots, "default"));
  44765. }
  44766. });
  44767. const SIZE_MAP = {
  44768. small: 8,
  44769. default: 12,
  44770. large: 16
  44771. };
  44772. function useSpace(props) {
  44773. const ns = useNamespace("space");
  44774. const classes = computed(() => [ns.b(), ns.m(props.direction), props.class]);
  44775. const horizontalSize = ref(0);
  44776. const verticalSize = ref(0);
  44777. const containerStyle = computed(() => {
  44778. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap" } : {};
  44779. const alignment = {
  44780. alignItems: props.alignment
  44781. };
  44782. const gap = {
  44783. rowGap: `${verticalSize.value}px`,
  44784. columnGap: `${horizontalSize.value}px`
  44785. };
  44786. return [wrapKls, alignment, gap, props.style];
  44787. });
  44788. const itemStyle = computed(() => {
  44789. return props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  44790. });
  44791. watchEffect(() => {
  44792. const { size = "small", wrap, direction: dir, fill } = props;
  44793. if (isArray$1(size)) {
  44794. const [h = 0, v = 0] = size;
  44795. horizontalSize.value = h;
  44796. verticalSize.value = v;
  44797. } else {
  44798. let val;
  44799. if (isNumber(size)) {
  44800. val = size;
  44801. } else {
  44802. val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  44803. }
  44804. if ((wrap || fill) && dir === "horizontal") {
  44805. horizontalSize.value = verticalSize.value = val;
  44806. } else {
  44807. if (dir === "horizontal") {
  44808. horizontalSize.value = val;
  44809. verticalSize.value = 0;
  44810. } else {
  44811. verticalSize.value = val;
  44812. horizontalSize.value = 0;
  44813. }
  44814. }
  44815. }
  44816. });
  44817. return {
  44818. classes,
  44819. containerStyle,
  44820. itemStyle
  44821. };
  44822. }
  44823. const spaceProps = buildProps({
  44824. direction: {
  44825. type: String,
  44826. values: ["horizontal", "vertical"],
  44827. default: "horizontal"
  44828. },
  44829. class: {
  44830. type: definePropType([
  44831. String,
  44832. Object,
  44833. Array
  44834. ]),
  44835. default: ""
  44836. },
  44837. style: {
  44838. type: definePropType([String, Array, Object]),
  44839. default: ""
  44840. },
  44841. alignment: {
  44842. type: definePropType(String),
  44843. default: "center"
  44844. },
  44845. prefixCls: {
  44846. type: String
  44847. },
  44848. spacer: {
  44849. type: definePropType([Object, String, Number, Array]),
  44850. default: null,
  44851. validator: (val) => isVNode(val) || isNumber(val) || isString$1(val)
  44852. },
  44853. wrap: Boolean,
  44854. fill: Boolean,
  44855. fillRatio: {
  44856. type: Number,
  44857. default: 100
  44858. },
  44859. size: {
  44860. type: [String, Array, Number],
  44861. values: componentSizes,
  44862. validator: (val) => {
  44863. return isNumber(val) || isArray$1(val) && val.length === 2 && val.every(isNumber);
  44864. }
  44865. }
  44866. });
  44867. const Space = defineComponent({
  44868. name: "ElSpace",
  44869. props: spaceProps,
  44870. setup(props, { slots }) {
  44871. const { classes, containerStyle, itemStyle } = useSpace(props);
  44872. function extractChildren(children, parentKey = "", extractedChildren = []) {
  44873. const { prefixCls } = props;
  44874. children.forEach((child, loopKey) => {
  44875. if (isFragment(child)) {
  44876. if (isArray$1(child.children)) {
  44877. child.children.forEach((nested, key) => {
  44878. if (isFragment(nested) && isArray$1(nested.children)) {
  44879. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  44880. } else {
  44881. if (isVNode(nested) && (nested == null ? void 0 : nested.type) === Comment) {
  44882. extractedChildren.push(nested);
  44883. } else {
  44884. extractedChildren.push(createVNode(SpaceItem, {
  44885. style: itemStyle.value,
  44886. prefixCls,
  44887. key: `nested-${parentKey + key}`
  44888. }, {
  44889. default: () => [nested]
  44890. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  44891. }
  44892. }
  44893. });
  44894. }
  44895. } else if (isValidElementNode(child)) {
  44896. extractedChildren.push(createVNode(SpaceItem, {
  44897. style: itemStyle.value,
  44898. prefixCls,
  44899. key: `LoopKey${parentKey + loopKey}`
  44900. }, {
  44901. default: () => [child]
  44902. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  44903. }
  44904. });
  44905. return extractedChildren;
  44906. }
  44907. return () => {
  44908. var _a;
  44909. const { spacer, direction } = props;
  44910. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  44911. if (((_a = children.children) != null ? _a : []).length === 0)
  44912. return null;
  44913. if (isArray$1(children.children)) {
  44914. let extractedChildren = extractChildren(children.children);
  44915. if (spacer) {
  44916. const len = extractedChildren.length - 1;
  44917. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  44918. const children2 = [...acc, child];
  44919. if (idx !== len) {
  44920. children2.push(createVNode("span", {
  44921. style: [
  44922. itemStyle.value,
  44923. direction === "vertical" ? "width: 100%" : null
  44924. ],
  44925. key: idx
  44926. }, [
  44927. isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)
  44928. ], PatchFlags.STYLE));
  44929. }
  44930. return children2;
  44931. }, []);
  44932. }
  44933. return createVNode("div", {
  44934. class: classes.value,
  44935. style: containerStyle.value
  44936. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  44937. }
  44938. return children.children;
  44939. };
  44940. }
  44941. });
  44942. const ElSpace = withInstall(Space);
  44943. const statisticProps = buildProps({
  44944. decimalSeparator: {
  44945. type: String,
  44946. default: "."
  44947. },
  44948. groupSeparator: {
  44949. type: String,
  44950. default: ","
  44951. },
  44952. precision: {
  44953. type: Number,
  44954. default: 0
  44955. },
  44956. formatter: Function,
  44957. value: {
  44958. type: definePropType([Number, Object]),
  44959. default: 0
  44960. },
  44961. prefix: String,
  44962. suffix: String,
  44963. title: String,
  44964. valueStyle: {
  44965. type: definePropType([String, Object, Array])
  44966. }
  44967. });
  44968. const __default__$x = defineComponent({
  44969. name: "ElStatistic"
  44970. });
  44971. const _sfc_main$E = /* @__PURE__ */ defineComponent({
  44972. ...__default__$x,
  44973. props: statisticProps,
  44974. setup(__props, { expose }) {
  44975. const props = __props;
  44976. const ns = useNamespace("statistic");
  44977. const displayValue = computed(() => {
  44978. const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
  44979. if (isFunction$1(formatter))
  44980. return formatter(value);
  44981. if (!isNumber(value) || Number.isNaN(value))
  44982. return value;
  44983. let [integer, decimal = ""] = String(value).split(".");
  44984. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  44985. integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  44986. return [integer, decimal].join(decimal ? decimalSeparator : "");
  44987. });
  44988. expose({
  44989. displayValue
  44990. });
  44991. return (_ctx, _cache) => {
  44992. return openBlock(), createElementBlock("div", {
  44993. class: normalizeClass(unref(ns).b())
  44994. }, [
  44995. _ctx.$slots.title || _ctx.title ? (openBlock(), createElementBlock("div", {
  44996. key: 0,
  44997. class: normalizeClass(unref(ns).e("head"))
  44998. }, [
  44999. renderSlot(_ctx.$slots, "title", {}, () => [
  45000. createTextVNode(toDisplayString(_ctx.title), 1)
  45001. ])
  45002. ], 2)) : createCommentVNode("v-if", true),
  45003. createElementVNode("div", {
  45004. class: normalizeClass(unref(ns).e("content"))
  45005. }, [
  45006. _ctx.$slots.prefix || _ctx.prefix ? (openBlock(), createElementBlock("div", {
  45007. key: 0,
  45008. class: normalizeClass(unref(ns).e("prefix"))
  45009. }, [
  45010. renderSlot(_ctx.$slots, "prefix", {}, () => [
  45011. createElementVNode("span", null, toDisplayString(_ctx.prefix), 1)
  45012. ])
  45013. ], 2)) : createCommentVNode("v-if", true),
  45014. createElementVNode("span", {
  45015. class: normalizeClass(unref(ns).e("number")),
  45016. style: normalizeStyle(_ctx.valueStyle)
  45017. }, toDisplayString(unref(displayValue)), 7),
  45018. _ctx.$slots.suffix || _ctx.suffix ? (openBlock(), createElementBlock("div", {
  45019. key: 1,
  45020. class: normalizeClass(unref(ns).e("suffix"))
  45021. }, [
  45022. renderSlot(_ctx.$slots, "suffix", {}, () => [
  45023. createElementVNode("span", null, toDisplayString(_ctx.suffix), 1)
  45024. ])
  45025. ], 2)) : createCommentVNode("v-if", true)
  45026. ], 2)
  45027. ], 2);
  45028. };
  45029. }
  45030. });
  45031. var Statistic = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "statistic.vue"]]);
  45032. const ElStatistic = withInstall(Statistic);
  45033. const countdownProps = buildProps({
  45034. format: {
  45035. type: String,
  45036. default: "HH:mm:ss"
  45037. },
  45038. prefix: String,
  45039. suffix: String,
  45040. title: String,
  45041. value: {
  45042. type: definePropType([Number, Object]),
  45043. default: 0
  45044. },
  45045. valueStyle: {
  45046. type: definePropType([String, Object, Array])
  45047. }
  45048. });
  45049. const countdownEmits = {
  45050. finish: () => true,
  45051. [CHANGE_EVENT]: (value) => isNumber(value)
  45052. };
  45053. const timeUnits = [
  45054. ["Y", 1e3 * 60 * 60 * 24 * 365],
  45055. ["M", 1e3 * 60 * 60 * 24 * 30],
  45056. ["D", 1e3 * 60 * 60 * 24],
  45057. ["H", 1e3 * 60 * 60],
  45058. ["m", 1e3 * 60],
  45059. ["s", 1e3],
  45060. ["S", 1]
  45061. ];
  45062. const getTime = (value) => {
  45063. return isNumber(value) ? new Date(value).getTime() : value.valueOf();
  45064. };
  45065. const formatTime$1 = (timestamp, format) => {
  45066. let timeLeft = timestamp;
  45067. const escapeRegex = /\[([^\]]*)]/g;
  45068. const replacedText = timeUnits.reduce((current, [name, unit]) => {
  45069. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  45070. if (replaceRegex.test(current)) {
  45071. const value = Math.floor(timeLeft / unit);
  45072. timeLeft -= value * unit;
  45073. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  45074. }
  45075. return current;
  45076. }, format);
  45077. return replacedText.replace(escapeRegex, "$1");
  45078. };
  45079. const __default__$w = defineComponent({
  45080. name: "ElCountdown"
  45081. });
  45082. const _sfc_main$D = /* @__PURE__ */ defineComponent({
  45083. ...__default__$w,
  45084. props: countdownProps,
  45085. emits: countdownEmits,
  45086. setup(__props, { expose, emit }) {
  45087. const props = __props;
  45088. let timer;
  45089. const rawValue = ref(0);
  45090. const displayValue = computed(() => formatTime$1(rawValue.value, props.format));
  45091. const formatter = (val) => formatTime$1(val, props.format);
  45092. const stopTimer = () => {
  45093. if (timer) {
  45094. cAF(timer);
  45095. timer = void 0;
  45096. }
  45097. };
  45098. const startTimer = () => {
  45099. const timestamp = getTime(props.value);
  45100. const frameFunc = () => {
  45101. let diff = timestamp - Date.now();
  45102. emit(CHANGE_EVENT, diff);
  45103. if (diff <= 0) {
  45104. diff = 0;
  45105. stopTimer();
  45106. emit("finish");
  45107. } else {
  45108. timer = rAF(frameFunc);
  45109. }
  45110. rawValue.value = diff;
  45111. };
  45112. timer = rAF(frameFunc);
  45113. };
  45114. onMounted(() => {
  45115. rawValue.value = getTime(props.value) - Date.now();
  45116. watch(() => [props.value, props.format], () => {
  45117. stopTimer();
  45118. startTimer();
  45119. }, {
  45120. immediate: true
  45121. });
  45122. });
  45123. onBeforeUnmount(() => {
  45124. stopTimer();
  45125. });
  45126. expose({
  45127. displayValue
  45128. });
  45129. return (_ctx, _cache) => {
  45130. return openBlock(), createBlock(unref(ElStatistic), {
  45131. value: rawValue.value,
  45132. title: _ctx.title,
  45133. prefix: _ctx.prefix,
  45134. suffix: _ctx.suffix,
  45135. "value-style": _ctx.valueStyle,
  45136. formatter
  45137. }, createSlots({
  45138. _: 2
  45139. }, [
  45140. renderList(_ctx.$slots, (_, name) => {
  45141. return {
  45142. name,
  45143. fn: withCtx(() => [
  45144. renderSlot(_ctx.$slots, name)
  45145. ])
  45146. };
  45147. })
  45148. ]), 1032, ["value", "title", "prefix", "suffix", "value-style"]);
  45149. };
  45150. }
  45151. });
  45152. var Countdown = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__file", "countdown.vue"]]);
  45153. const ElCountdown = withInstall(Countdown);
  45154. const stepsProps = buildProps({
  45155. space: {
  45156. type: [Number, String],
  45157. default: ""
  45158. },
  45159. active: {
  45160. type: Number,
  45161. default: 0
  45162. },
  45163. direction: {
  45164. type: String,
  45165. default: "horizontal",
  45166. values: ["horizontal", "vertical"]
  45167. },
  45168. alignCenter: {
  45169. type: Boolean
  45170. },
  45171. simple: {
  45172. type: Boolean
  45173. },
  45174. finishStatus: {
  45175. type: String,
  45176. values: ["wait", "process", "finish", "error", "success"],
  45177. default: "finish"
  45178. },
  45179. processStatus: {
  45180. type: String,
  45181. values: ["wait", "process", "finish", "error", "success"],
  45182. default: "process"
  45183. }
  45184. });
  45185. const stepsEmits = {
  45186. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber)
  45187. };
  45188. const STEPS_INJECTION_KEY = "ElSteps";
  45189. const __default__$v = defineComponent({
  45190. name: "ElSteps"
  45191. });
  45192. const _sfc_main$C = /* @__PURE__ */ defineComponent({
  45193. ...__default__$v,
  45194. props: stepsProps,
  45195. emits: stepsEmits,
  45196. setup(__props, { emit }) {
  45197. const props = __props;
  45198. const ns = useNamespace("steps");
  45199. const {
  45200. children: steps,
  45201. addChild: addStep,
  45202. removeChild: removeStep,
  45203. ChildrenSorter: StepsSorter
  45204. } = useOrderedChildren(getCurrentInstance(), "ElStep");
  45205. watch(steps, () => {
  45206. steps.value.forEach((instance, index) => {
  45207. instance.setIndex(index);
  45208. });
  45209. });
  45210. provide(STEPS_INJECTION_KEY, { props, steps, addStep, removeStep });
  45211. watch(() => props.active, (newVal, oldVal) => {
  45212. emit(CHANGE_EVENT, newVal, oldVal);
  45213. });
  45214. return (_ctx, _cache) => {
  45215. return openBlock(), createElementBlock("div", {
  45216. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  45217. }, [
  45218. renderSlot(_ctx.$slots, "default"),
  45219. createVNode(unref(StepsSorter))
  45220. ], 2);
  45221. };
  45222. }
  45223. });
  45224. var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__file", "steps.vue"]]);
  45225. const stepProps = buildProps({
  45226. title: {
  45227. type: String,
  45228. default: ""
  45229. },
  45230. icon: {
  45231. type: iconPropType
  45232. },
  45233. description: {
  45234. type: String,
  45235. default: ""
  45236. },
  45237. status: {
  45238. type: String,
  45239. values: ["", "wait", "process", "finish", "error", "success"],
  45240. default: ""
  45241. }
  45242. });
  45243. const __default__$u = defineComponent({
  45244. name: "ElStep"
  45245. });
  45246. const _sfc_main$B = defineComponent({
  45247. ...__default__$u,
  45248. props: stepProps,
  45249. setup(__props) {
  45250. const props = __props;
  45251. const ns = useNamespace("step");
  45252. const index = ref(-1);
  45253. const lineStyle = ref({});
  45254. const internalStatus = ref("");
  45255. const parent = inject(STEPS_INJECTION_KEY);
  45256. const currentInstance = getCurrentInstance();
  45257. let stepDiff = 0;
  45258. let beforeActive = 0;
  45259. onMounted(() => {
  45260. watch([
  45261. () => parent.props.active,
  45262. () => parent.props.processStatus,
  45263. () => parent.props.finishStatus
  45264. ], ([active], [oldActive]) => {
  45265. beforeActive = oldActive || 0;
  45266. stepDiff = active - beforeActive;
  45267. updateStatus(active);
  45268. }, { immediate: true });
  45269. });
  45270. const currentStatus = computed(() => {
  45271. return props.status || internalStatus.value;
  45272. });
  45273. const prevInternalStatus = computed(() => {
  45274. const prevStep = parent.steps.value[index.value - 1];
  45275. return prevStep ? prevStep.internalStatus.value : "wait";
  45276. });
  45277. const isCenter = computed(() => {
  45278. return parent.props.alignCenter;
  45279. });
  45280. const isVertical = computed(() => {
  45281. return parent.props.direction === "vertical";
  45282. });
  45283. const isSimple = computed(() => {
  45284. return parent.props.simple;
  45285. });
  45286. const stepsCount = computed(() => {
  45287. return parent.steps.value.length;
  45288. });
  45289. const isLast = computed(() => {
  45290. var _a;
  45291. return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === currentInstance.uid;
  45292. });
  45293. const space = computed(() => {
  45294. return isSimple.value ? "" : parent.props.space;
  45295. });
  45296. const containerKls = computed(() => {
  45297. return [
  45298. ns.b(),
  45299. ns.is(isSimple.value ? "simple" : parent.props.direction),
  45300. ns.is("flex", isLast.value && !space.value && !isCenter.value),
  45301. ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
  45302. ];
  45303. });
  45304. const style = computed(() => {
  45305. const style2 = {
  45306. flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  45307. };
  45308. if (isVertical.value)
  45309. return style2;
  45310. if (isLast.value) {
  45311. style2.maxWidth = `${100 / stepsCount.value}%`;
  45312. }
  45313. return style2;
  45314. });
  45315. const setIndex = (val) => {
  45316. index.value = val;
  45317. };
  45318. const calcProgress = (status) => {
  45319. const isWait = status === "wait";
  45320. const delayTimer = Math.abs(stepDiff) === 1 ? 0 : stepDiff > 0 ? (index.value + 1 - beforeActive) * 150 : -(index.value + 1 - parent.props.active) * 150;
  45321. const style2 = {
  45322. transitionDelay: `${delayTimer}ms`
  45323. };
  45324. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  45325. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  45326. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  45327. lineStyle.value = style2;
  45328. };
  45329. const updateStatus = (activeIndex) => {
  45330. if (activeIndex > index.value) {
  45331. internalStatus.value = parent.props.finishStatus;
  45332. } else if (activeIndex === index.value && prevInternalStatus.value !== "error") {
  45333. internalStatus.value = parent.props.processStatus;
  45334. } else {
  45335. internalStatus.value = "wait";
  45336. }
  45337. const prevChild = parent.steps.value[index.value - 1];
  45338. if (prevChild)
  45339. prevChild.calcProgress(internalStatus.value);
  45340. };
  45341. const stepItemState = {
  45342. uid: currentInstance.uid,
  45343. getVnode: () => currentInstance.vnode,
  45344. currentStatus,
  45345. internalStatus,
  45346. setIndex,
  45347. calcProgress
  45348. };
  45349. parent.addStep(stepItemState);
  45350. onBeforeUnmount(() => {
  45351. parent.removeStep(stepItemState);
  45352. });
  45353. return (_ctx, _cache) => {
  45354. return openBlock(), createElementBlock("div", {
  45355. style: normalizeStyle(unref(style)),
  45356. class: normalizeClass(unref(containerKls))
  45357. }, [
  45358. createCommentVNode(" icon & line "),
  45359. createElementVNode("div", {
  45360. class: normalizeClass([unref(ns).e("head"), unref(ns).is(unref(currentStatus))])
  45361. }, [
  45362. !unref(isSimple) ? (openBlock(), createElementBlock("div", {
  45363. key: 0,
  45364. class: normalizeClass(unref(ns).e("line"))
  45365. }, [
  45366. createElementVNode("i", {
  45367. class: normalizeClass(unref(ns).e("line-inner")),
  45368. style: normalizeStyle(lineStyle.value)
  45369. }, null, 6)
  45370. ], 2)) : createCommentVNode("v-if", true),
  45371. createElementVNode("div", {
  45372. class: normalizeClass([unref(ns).e("icon"), unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  45373. }, [
  45374. renderSlot(_ctx.$slots, "icon", {}, () => [
  45375. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  45376. key: 0,
  45377. class: normalizeClass(unref(ns).e("icon-inner"))
  45378. }, {
  45379. default: withCtx(() => [
  45380. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  45381. ]),
  45382. _: 1
  45383. }, 8, ["class"])) : unref(currentStatus) === "success" ? (openBlock(), createBlock(unref(ElIcon), {
  45384. key: 1,
  45385. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  45386. }, {
  45387. default: withCtx(() => [
  45388. createVNode(unref(check_default))
  45389. ]),
  45390. _: 1
  45391. }, 8, ["class"])) : unref(currentStatus) === "error" ? (openBlock(), createBlock(unref(ElIcon), {
  45392. key: 2,
  45393. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  45394. }, {
  45395. default: withCtx(() => [
  45396. createVNode(unref(close_default))
  45397. ]),
  45398. _: 1
  45399. }, 8, ["class"])) : !unref(isSimple) ? (openBlock(), createElementBlock("div", {
  45400. key: 3,
  45401. class: normalizeClass(unref(ns).e("icon-inner"))
  45402. }, toDisplayString(index.value + 1), 3)) : createCommentVNode("v-if", true)
  45403. ])
  45404. ], 2)
  45405. ], 2),
  45406. createCommentVNode(" title & description "),
  45407. createElementVNode("div", {
  45408. class: normalizeClass(unref(ns).e("main"))
  45409. }, [
  45410. createElementVNode("div", {
  45411. class: normalizeClass([unref(ns).e("title"), unref(ns).is(unref(currentStatus))])
  45412. }, [
  45413. renderSlot(_ctx.$slots, "title", {}, () => [
  45414. createTextVNode(toDisplayString(_ctx.title), 1)
  45415. ])
  45416. ], 2),
  45417. unref(isSimple) ? (openBlock(), createElementBlock("div", {
  45418. key: 0,
  45419. class: normalizeClass(unref(ns).e("arrow"))
  45420. }, null, 2)) : (openBlock(), createElementBlock("div", {
  45421. key: 1,
  45422. class: normalizeClass([unref(ns).e("description"), unref(ns).is(unref(currentStatus))])
  45423. }, [
  45424. renderSlot(_ctx.$slots, "description", {}, () => [
  45425. createTextVNode(toDisplayString(_ctx.description), 1)
  45426. ])
  45427. ], 2))
  45428. ], 2)
  45429. ], 6);
  45430. };
  45431. }
  45432. });
  45433. var Step = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__file", "item.vue"]]);
  45434. const ElSteps = withInstall(Steps, {
  45435. Step
  45436. });
  45437. const ElStep = withNoopInstall(Step);
  45438. const switchProps = buildProps({
  45439. modelValue: {
  45440. type: [Boolean, String, Number],
  45441. default: false
  45442. },
  45443. disabled: Boolean,
  45444. loading: Boolean,
  45445. size: {
  45446. type: String,
  45447. validator: isValidComponentSize
  45448. },
  45449. width: {
  45450. type: [String, Number],
  45451. default: ""
  45452. },
  45453. inlinePrompt: Boolean,
  45454. inactiveActionIcon: {
  45455. type: iconPropType
  45456. },
  45457. activeActionIcon: {
  45458. type: iconPropType
  45459. },
  45460. activeIcon: {
  45461. type: iconPropType
  45462. },
  45463. inactiveIcon: {
  45464. type: iconPropType
  45465. },
  45466. activeText: {
  45467. type: String,
  45468. default: ""
  45469. },
  45470. inactiveText: {
  45471. type: String,
  45472. default: ""
  45473. },
  45474. activeValue: {
  45475. type: [Boolean, String, Number],
  45476. default: true
  45477. },
  45478. inactiveValue: {
  45479. type: [Boolean, String, Number],
  45480. default: false
  45481. },
  45482. name: {
  45483. type: String,
  45484. default: ""
  45485. },
  45486. validateEvent: {
  45487. type: Boolean,
  45488. default: true
  45489. },
  45490. beforeChange: {
  45491. type: definePropType(Function)
  45492. },
  45493. id: String,
  45494. tabindex: {
  45495. type: [String, Number]
  45496. },
  45497. ...useAriaProps(["ariaLabel"])
  45498. });
  45499. const switchEmits = {
  45500. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  45501. [CHANGE_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  45502. [INPUT_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val)
  45503. };
  45504. const COMPONENT_NAME$9 = "ElSwitch";
  45505. const __default__$t = defineComponent({
  45506. name: COMPONENT_NAME$9
  45507. });
  45508. const _sfc_main$A = /* @__PURE__ */ defineComponent({
  45509. ...__default__$t,
  45510. props: switchProps,
  45511. emits: switchEmits,
  45512. setup(__props, { expose, emit }) {
  45513. const props = __props;
  45514. const { formItem } = useFormItem();
  45515. const switchSize = useFormSize();
  45516. const ns = useNamespace("switch");
  45517. const { inputId } = useFormItemInputId(props, {
  45518. formItemContext: formItem
  45519. });
  45520. const switchDisabled = useFormDisabled(computed(() => props.loading));
  45521. const isControlled = ref(props.modelValue !== false);
  45522. const input = shallowRef();
  45523. const switchKls = computed(() => [
  45524. ns.b(),
  45525. ns.m(switchSize.value),
  45526. ns.is("disabled", switchDisabled.value),
  45527. ns.is("checked", checked.value)
  45528. ]);
  45529. const labelLeftKls = computed(() => [
  45530. ns.e("label"),
  45531. ns.em("label", "left"),
  45532. ns.is("active", !checked.value)
  45533. ]);
  45534. const labelRightKls = computed(() => [
  45535. ns.e("label"),
  45536. ns.em("label", "right"),
  45537. ns.is("active", checked.value)
  45538. ]);
  45539. const coreStyle = computed(() => ({
  45540. width: addUnit(props.width)
  45541. }));
  45542. watch(() => props.modelValue, () => {
  45543. isControlled.value = true;
  45544. });
  45545. const actualValue = computed(() => {
  45546. return isControlled.value ? props.modelValue : false;
  45547. });
  45548. const checked = computed(() => actualValue.value === props.activeValue);
  45549. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  45550. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  45551. emit(CHANGE_EVENT, props.inactiveValue);
  45552. emit(INPUT_EVENT, props.inactiveValue);
  45553. }
  45554. watch(checked, (val) => {
  45555. var _a;
  45556. input.value.checked = val;
  45557. if (props.validateEvent) {
  45558. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn(err));
  45559. }
  45560. });
  45561. const handleChange = () => {
  45562. const val = checked.value ? props.inactiveValue : props.activeValue;
  45563. emit(UPDATE_MODEL_EVENT, val);
  45564. emit(CHANGE_EVENT, val);
  45565. emit(INPUT_EVENT, val);
  45566. nextTick(() => {
  45567. input.value.checked = checked.value;
  45568. });
  45569. };
  45570. const switchValue = () => {
  45571. if (switchDisabled.value)
  45572. return;
  45573. const { beforeChange } = props;
  45574. if (!beforeChange) {
  45575. handleChange();
  45576. return;
  45577. }
  45578. const shouldChange = beforeChange();
  45579. const isPromiseOrBool = [
  45580. isPromise(shouldChange),
  45581. isBoolean(shouldChange)
  45582. ].includes(true);
  45583. if (!isPromiseOrBool) {
  45584. throwError(COMPONENT_NAME$9, "beforeChange must return type `Promise<boolean>` or `boolean`");
  45585. }
  45586. if (isPromise(shouldChange)) {
  45587. shouldChange.then((result) => {
  45588. if (result) {
  45589. handleChange();
  45590. }
  45591. }).catch((e) => {
  45592. debugWarn(COMPONENT_NAME$9, `some error occurred: ${e}`);
  45593. });
  45594. } else if (shouldChange) {
  45595. handleChange();
  45596. }
  45597. };
  45598. const focus = () => {
  45599. var _a, _b;
  45600. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  45601. };
  45602. onMounted(() => {
  45603. input.value.checked = checked.value;
  45604. });
  45605. expose({
  45606. focus,
  45607. checked
  45608. });
  45609. return (_ctx, _cache) => {
  45610. return openBlock(), createElementBlock("div", {
  45611. class: normalizeClass(unref(switchKls)),
  45612. onClick: withModifiers(switchValue, ["prevent"])
  45613. }, [
  45614. createElementVNode("input", {
  45615. id: unref(inputId),
  45616. ref_key: "input",
  45617. ref: input,
  45618. class: normalizeClass(unref(ns).e("input")),
  45619. type: "checkbox",
  45620. role: "switch",
  45621. "aria-checked": unref(checked),
  45622. "aria-disabled": unref(switchDisabled),
  45623. "aria-label": _ctx.ariaLabel,
  45624. name: _ctx.name,
  45625. "true-value": _ctx.activeValue,
  45626. "false-value": _ctx.inactiveValue,
  45627. disabled: unref(switchDisabled),
  45628. tabindex: _ctx.tabindex,
  45629. onChange: handleChange,
  45630. onKeydown: withKeys(switchValue, ["enter"])
  45631. }, null, 42, ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"]),
  45632. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  45633. key: 0,
  45634. class: normalizeClass(unref(labelLeftKls))
  45635. }, [
  45636. _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  45637. default: withCtx(() => [
  45638. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  45639. ]),
  45640. _: 1
  45641. })) : createCommentVNode("v-if", true),
  45642. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  45643. key: 1,
  45644. "aria-hidden": unref(checked)
  45645. }, toDisplayString(_ctx.inactiveText), 9, ["aria-hidden"])) : createCommentVNode("v-if", true)
  45646. ], 2)) : createCommentVNode("v-if", true),
  45647. createElementVNode("span", {
  45648. class: normalizeClass(unref(ns).e("core")),
  45649. style: normalizeStyle(unref(coreStyle))
  45650. }, [
  45651. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  45652. key: 0,
  45653. class: normalizeClass(unref(ns).e("inner"))
  45654. }, [
  45655. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), {
  45656. key: 0,
  45657. class: normalizeClass(unref(ns).is("icon"))
  45658. }, {
  45659. default: withCtx(() => [
  45660. (openBlock(), createBlock(resolveDynamicComponent(unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  45661. ]),
  45662. _: 1
  45663. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  45664. key: 1,
  45665. class: normalizeClass(unref(ns).is("text")),
  45666. "aria-hidden": !unref(checked)
  45667. }, toDisplayString(unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, ["aria-hidden"])) : createCommentVNode("v-if", true)
  45668. ], 2)) : createCommentVNode("v-if", true),
  45669. createElementVNode("div", {
  45670. class: normalizeClass(unref(ns).e("action"))
  45671. }, [
  45672. _ctx.loading ? (openBlock(), createBlock(unref(ElIcon), {
  45673. key: 0,
  45674. class: normalizeClass(unref(ns).is("loading"))
  45675. }, {
  45676. default: withCtx(() => [
  45677. createVNode(unref(loading_default))
  45678. ]),
  45679. _: 1
  45680. }, 8, ["class"])) : unref(checked) ? renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [
  45681. _ctx.activeActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  45682. default: withCtx(() => [
  45683. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeActionIcon)))
  45684. ]),
  45685. _: 1
  45686. })) : createCommentVNode("v-if", true)
  45687. ]) : !unref(checked) ? renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [
  45688. _ctx.inactiveActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  45689. default: withCtx(() => [
  45690. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveActionIcon)))
  45691. ]),
  45692. _: 1
  45693. })) : createCommentVNode("v-if", true)
  45694. ]) : createCommentVNode("v-if", true)
  45695. ], 2)
  45696. ], 6),
  45697. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  45698. key: 1,
  45699. class: normalizeClass(unref(labelRightKls))
  45700. }, [
  45701. _ctx.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  45702. default: withCtx(() => [
  45703. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  45704. ]),
  45705. _: 1
  45706. })) : createCommentVNode("v-if", true),
  45707. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  45708. key: 1,
  45709. "aria-hidden": !unref(checked)
  45710. }, toDisplayString(_ctx.activeText), 9, ["aria-hidden"])) : createCommentVNode("v-if", true)
  45711. ], 2)) : createCommentVNode("v-if", true)
  45712. ], 10, ["onClick"]);
  45713. };
  45714. }
  45715. });
  45716. var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__file", "switch.vue"]]);
  45717. const ElSwitch = withInstall(Switch);
  45718. const getCell = function(event) {
  45719. var _a;
  45720. return (_a = event.target) == null ? void 0 : _a.closest("td");
  45721. };
  45722. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  45723. if (!sortKey && !sortMethod && (!sortBy || isArray$1(sortBy) && !sortBy.length)) {
  45724. return array;
  45725. }
  45726. if (isString$1(reverse)) {
  45727. reverse = reverse === "descending" ? -1 : 1;
  45728. } else {
  45729. reverse = reverse && reverse < 0 ? -1 : 1;
  45730. }
  45731. const getKey = sortMethod ? null : function(value, index) {
  45732. if (sortBy) {
  45733. return flatMap(castArray$1(sortBy), (by) => {
  45734. if (isString$1(by)) {
  45735. return get(value, by);
  45736. } else {
  45737. return by(value, index, array);
  45738. }
  45739. });
  45740. }
  45741. if (sortKey !== "$key") {
  45742. if (isObject$1(value) && "$value" in value)
  45743. value = value.$value;
  45744. }
  45745. return [
  45746. isObject$1(value) ? sortKey ? get(value, sortKey) : null : value
  45747. ];
  45748. };
  45749. const compare = function(a, b) {
  45750. var _a, _b, _c, _d, _e, _f;
  45751. if (sortMethod) {
  45752. return sortMethod(a.value, b.value);
  45753. }
  45754. for (let i = 0, len = (_b = (_a = a.key) == null ? void 0 : _a.length) != null ? _b : 0; i < len; i++) {
  45755. if (((_c = a.key) == null ? void 0 : _c[i]) < ((_d = b.key) == null ? void 0 : _d[i])) {
  45756. return -1;
  45757. }
  45758. if (((_e = a.key) == null ? void 0 : _e[i]) > ((_f = b.key) == null ? void 0 : _f[i])) {
  45759. return 1;
  45760. }
  45761. }
  45762. return 0;
  45763. };
  45764. return array.map((value, index) => {
  45765. return {
  45766. value,
  45767. index,
  45768. key: getKey ? getKey(value, index) : null
  45769. };
  45770. }).sort((a, b) => {
  45771. let order = compare(a, b);
  45772. if (!order) {
  45773. order = a.index - b.index;
  45774. }
  45775. return order * +reverse;
  45776. }).map((item) => item.value);
  45777. };
  45778. const getColumnById = function(table, columnId) {
  45779. let column = null;
  45780. table.columns.forEach((item) => {
  45781. if (item.id === columnId) {
  45782. column = item;
  45783. }
  45784. });
  45785. return column;
  45786. };
  45787. const getColumnByKey = function(table, columnKey) {
  45788. let column = null;
  45789. for (let i = 0; i < table.columns.length; i++) {
  45790. const item = table.columns[i];
  45791. if (item.columnKey === columnKey) {
  45792. column = item;
  45793. break;
  45794. }
  45795. }
  45796. if (!column)
  45797. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  45798. return column;
  45799. };
  45800. const getColumnByCell = function(table, cell, namespace) {
  45801. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  45802. if (matches) {
  45803. return getColumnById(table, matches[0]);
  45804. }
  45805. return null;
  45806. };
  45807. const getRowIdentity = (row, rowKey) => {
  45808. if (!row)
  45809. throw new Error("Row is required when get row identity");
  45810. if (isString$1(rowKey)) {
  45811. if (!rowKey.includes(".")) {
  45812. return `${row[rowKey]}`;
  45813. }
  45814. const key = rowKey.split(".");
  45815. let current = row;
  45816. for (const element of key) {
  45817. current = current[element];
  45818. }
  45819. return `${current}`;
  45820. } else if (isFunction$1(rowKey)) {
  45821. return rowKey.call(null, row);
  45822. }
  45823. return "";
  45824. };
  45825. const getKeysMap = function(array, rowKey, flatten = false, childrenKey = "children") {
  45826. const data = array || [];
  45827. const arrayMap = {};
  45828. data.forEach((row, index) => {
  45829. arrayMap[getRowIdentity(row, rowKey)] = { row, index };
  45830. if (flatten) {
  45831. const children = row[childrenKey];
  45832. if (isArray$1(children)) {
  45833. Object.assign(arrayMap, getKeysMap(children, rowKey, true, childrenKey));
  45834. }
  45835. }
  45836. });
  45837. return arrayMap;
  45838. };
  45839. function mergeOptions(defaults, config) {
  45840. const options = {};
  45841. let key;
  45842. for (key in defaults) {
  45843. options[key] = defaults[key];
  45844. }
  45845. for (key in config) {
  45846. if (hasOwn(config, key)) {
  45847. const value = config[key];
  45848. if (!isUndefined(value)) {
  45849. options[key] = value;
  45850. }
  45851. }
  45852. }
  45853. return options;
  45854. }
  45855. function parseWidth(width) {
  45856. if (width === "")
  45857. return width;
  45858. if (!isUndefined(width)) {
  45859. width = Number.parseInt(width, 10);
  45860. if (Number.isNaN(width)) {
  45861. width = "";
  45862. }
  45863. }
  45864. return width;
  45865. }
  45866. function parseMinWidth(minWidth) {
  45867. if (minWidth === "")
  45868. return minWidth;
  45869. if (!isUndefined(minWidth)) {
  45870. minWidth = parseWidth(minWidth);
  45871. if (Number.isNaN(minWidth)) {
  45872. minWidth = 80;
  45873. }
  45874. }
  45875. return minWidth;
  45876. }
  45877. function parseHeight(height) {
  45878. if (isNumber(height)) {
  45879. return height;
  45880. }
  45881. if (isString$1(height)) {
  45882. if (/^\d+(?:px)?$/.test(height)) {
  45883. return Number.parseInt(height, 10);
  45884. } else {
  45885. return height;
  45886. }
  45887. }
  45888. return null;
  45889. }
  45890. function compose(...funcs) {
  45891. if (funcs.length === 0) {
  45892. return (arg) => arg;
  45893. }
  45894. if (funcs.length === 1) {
  45895. return funcs[0];
  45896. }
  45897. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  45898. }
  45899. function toggleRowStatus(statusArr, row, newVal, tableTreeProps, selectable, rowIndex, rowKey) {
  45900. let _rowIndex = rowIndex != null ? rowIndex : 0;
  45901. let changed = false;
  45902. const getIndex = () => {
  45903. if (!rowKey) {
  45904. return statusArr.indexOf(row);
  45905. }
  45906. const id = getRowIdentity(row, rowKey);
  45907. return statusArr.findIndex((item) => getRowIdentity(item, rowKey) === id);
  45908. };
  45909. const index = getIndex();
  45910. const included = index !== -1;
  45911. const isRowSelectable = selectable == null ? void 0 : selectable.call(null, row, _rowIndex);
  45912. const toggleStatus = (type) => {
  45913. if (type === "add") {
  45914. statusArr.push(row);
  45915. } else {
  45916. statusArr.splice(index, 1);
  45917. }
  45918. changed = true;
  45919. };
  45920. const getChildrenCount = (row2) => {
  45921. let count = 0;
  45922. const children = (tableTreeProps == null ? void 0 : tableTreeProps.children) && row2[tableTreeProps.children];
  45923. if (children && isArray$1(children)) {
  45924. count += children.length;
  45925. children.forEach((item) => {
  45926. count += getChildrenCount(item);
  45927. });
  45928. }
  45929. return count;
  45930. };
  45931. if (!selectable || isRowSelectable) {
  45932. if (isBoolean(newVal)) {
  45933. if (newVal && !included) {
  45934. toggleStatus("add");
  45935. } else if (!newVal && included) {
  45936. toggleStatus("remove");
  45937. }
  45938. } else {
  45939. included ? toggleStatus("remove") : toggleStatus("add");
  45940. }
  45941. }
  45942. if (!(tableTreeProps == null ? void 0 : tableTreeProps.checkStrictly) && (tableTreeProps == null ? void 0 : tableTreeProps.children) && isArray$1(row[tableTreeProps.children])) {
  45943. row[tableTreeProps.children].forEach((item) => {
  45944. const childChanged = toggleRowStatus(statusArr, item, newVal != null ? newVal : !included, tableTreeProps, selectable, _rowIndex + 1, rowKey);
  45945. _rowIndex += getChildrenCount(item) + 1;
  45946. if (childChanged) {
  45947. changed = childChanged;
  45948. }
  45949. });
  45950. }
  45951. return changed;
  45952. }
  45953. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren", lazy = false) {
  45954. const isNil = (array) => !(isArray$1(array) && array.length);
  45955. function _walker(parent, children, level) {
  45956. cb(parent, children, level);
  45957. children.forEach((item) => {
  45958. if (item[lazyKey] && lazy) {
  45959. cb(item, null, level + 1);
  45960. return;
  45961. }
  45962. const children2 = item[childrenKey];
  45963. if (!isNil(children2)) {
  45964. _walker(item, children2, level + 1);
  45965. }
  45966. });
  45967. }
  45968. root.forEach((item) => {
  45969. if (item[lazyKey] && lazy) {
  45970. cb(item, null, 0);
  45971. return;
  45972. }
  45973. const children = item[childrenKey];
  45974. if (!isNil(children)) {
  45975. _walker(item, children, 0);
  45976. }
  45977. });
  45978. }
  45979. const getTableOverflowTooltipProps = (props, innerText, row, column) => {
  45980. const popperOptions = {
  45981. strategy: "fixed",
  45982. ...props.popperOptions
  45983. };
  45984. const tooltipFormatterContent = isFunction$1(column == null ? void 0 : column.tooltipFormatter) ? column.tooltipFormatter({
  45985. row,
  45986. column,
  45987. cellValue: getProp(row, column.property).value
  45988. }) : void 0;
  45989. if (isVNode(tooltipFormatterContent)) {
  45990. return {
  45991. slotContent: tooltipFormatterContent,
  45992. content: null,
  45993. ...props,
  45994. popperOptions
  45995. };
  45996. }
  45997. return {
  45998. slotContent: null,
  45999. content: tooltipFormatterContent != null ? tooltipFormatterContent : innerText,
  46000. ...props,
  46001. popperOptions
  46002. };
  46003. };
  46004. let removePopper = null;
  46005. function createTablePopper(props, popperContent, row, column, trigger, table) {
  46006. var _a;
  46007. const tableOverflowTooltipProps = getTableOverflowTooltipProps(props, popperContent, row, column);
  46008. const mergedProps = {
  46009. ...tableOverflowTooltipProps,
  46010. slotContent: void 0
  46011. };
  46012. if ((removePopper == null ? void 0 : removePopper.trigger) === trigger) {
  46013. const comp = (_a = removePopper.vm) == null ? void 0 : _a.component;
  46014. merge(comp == null ? void 0 : comp.props, mergedProps);
  46015. if (comp && tableOverflowTooltipProps.slotContent) {
  46016. comp.slots.content = () => [tableOverflowTooltipProps.slotContent];
  46017. }
  46018. return;
  46019. }
  46020. removePopper == null ? void 0 : removePopper();
  46021. const parentNode = table == null ? void 0 : table.refs.tableWrapper;
  46022. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  46023. const vm = createVNode(ElTooltip, {
  46024. virtualTriggering: true,
  46025. virtualRef: trigger,
  46026. appendTo: parentNode,
  46027. placement: "top",
  46028. transition: "none",
  46029. offset: 0,
  46030. hideAfter: 0,
  46031. ...mergedProps
  46032. }, tableOverflowTooltipProps.slotContent ? {
  46033. content: () => tableOverflowTooltipProps.slotContent
  46034. } : void 0);
  46035. vm.appContext = { ...table.appContext, ...table };
  46036. const container = document.createElement("div");
  46037. render(vm, container);
  46038. vm.component.exposed.onOpen();
  46039. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  46040. removePopper = () => {
  46041. var _a2, _b;
  46042. if ((_b = (_a2 = vm.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.onClose) {
  46043. vm.component.exposed.onClose();
  46044. }
  46045. render(null, container);
  46046. const currentRemovePopper = removePopper;
  46047. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", currentRemovePopper);
  46048. currentRemovePopper.trigger = void 0;
  46049. currentRemovePopper.vm = void 0;
  46050. removePopper = null;
  46051. };
  46052. removePopper.trigger = trigger != null ? trigger : void 0;
  46053. removePopper.vm = vm;
  46054. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  46055. }
  46056. function getCurrentColumns(column) {
  46057. if (column.children) {
  46058. return flatMap(column.children, getCurrentColumns);
  46059. } else {
  46060. return [column];
  46061. }
  46062. }
  46063. function getColSpan(colSpan, column) {
  46064. return colSpan + column.colSpan;
  46065. }
  46066. const isFixedColumn = (index, fixed, store, realColumns) => {
  46067. let start = 0;
  46068. let after = index;
  46069. const columns = store.states.columns.value;
  46070. if (realColumns) {
  46071. const curColumns = getCurrentColumns(realColumns[index]);
  46072. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  46073. start = preColumns.reduce(getColSpan, 0);
  46074. after = start + curColumns.reduce(getColSpan, 0) - 1;
  46075. } else {
  46076. start = index;
  46077. }
  46078. let fixedLayout;
  46079. switch (fixed) {
  46080. case "left":
  46081. if (after < store.states.fixedLeafColumnsLength.value) {
  46082. fixedLayout = "left";
  46083. }
  46084. break;
  46085. case "right":
  46086. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  46087. fixedLayout = "right";
  46088. }
  46089. break;
  46090. default:
  46091. if (after < store.states.fixedLeafColumnsLength.value) {
  46092. fixedLayout = "left";
  46093. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  46094. fixedLayout = "right";
  46095. }
  46096. }
  46097. return fixedLayout ? {
  46098. direction: fixedLayout,
  46099. start,
  46100. after
  46101. } : {};
  46102. };
  46103. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  46104. const classes = [];
  46105. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  46106. if (direction) {
  46107. const isLeft = direction === "left";
  46108. classes.push(`${namespace}-fixed-column--${direction}`);
  46109. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  46110. classes.push("is-last-column");
  46111. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  46112. classes.push("is-first-column");
  46113. }
  46114. }
  46115. return classes;
  46116. };
  46117. function getOffset(offset, column) {
  46118. return offset + (isNull(column.realWidth) || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  46119. }
  46120. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  46121. const {
  46122. direction,
  46123. start = 0,
  46124. after = 0
  46125. } = isFixedColumn(index, fixed, store, realColumns);
  46126. if (!direction) {
  46127. return;
  46128. }
  46129. const styles = {};
  46130. const isLeft = direction === "left";
  46131. const columns = store.states.columns.value;
  46132. if (isLeft) {
  46133. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  46134. } else {
  46135. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  46136. }
  46137. return styles;
  46138. };
  46139. const ensurePosition = (style, key) => {
  46140. if (!style)
  46141. return;
  46142. if (!Number.isNaN(style[key])) {
  46143. style[key] = `${style[key]}px`;
  46144. }
  46145. };
  46146. function useExpand(watcherData) {
  46147. const instance = getCurrentInstance();
  46148. const defaultExpandAll = ref(false);
  46149. const expandRows = ref([]);
  46150. const updateExpandRows = () => {
  46151. const data = watcherData.data.value || [];
  46152. const rowKey = watcherData.rowKey.value;
  46153. if (defaultExpandAll.value) {
  46154. expandRows.value = data.slice();
  46155. } else if (rowKey) {
  46156. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  46157. expandRows.value = data.reduce((prev, row) => {
  46158. const rowId = getRowIdentity(row, rowKey);
  46159. const rowInfo = expandRowsMap[rowId];
  46160. if (rowInfo) {
  46161. prev.push(row);
  46162. }
  46163. return prev;
  46164. }, []);
  46165. } else {
  46166. expandRows.value = [];
  46167. }
  46168. };
  46169. const toggleRowExpansion = (row, expanded) => {
  46170. const changed = toggleRowStatus(expandRows.value, row, expanded, void 0, void 0, void 0, watcherData.rowKey.value);
  46171. if (changed) {
  46172. instance.emit("expand-change", row, expandRows.value.slice());
  46173. }
  46174. };
  46175. const setExpandRowKeys = (rowKeys) => {
  46176. instance.store.assertRowKey();
  46177. const data = watcherData.data.value || [];
  46178. const rowKey = watcherData.rowKey.value;
  46179. const keysMap = getKeysMap(data, rowKey);
  46180. expandRows.value = rowKeys.reduce((prev, cur) => {
  46181. const info = keysMap[cur];
  46182. if (info) {
  46183. prev.push(info.row);
  46184. }
  46185. return prev;
  46186. }, []);
  46187. };
  46188. const isRowExpanded = (row) => {
  46189. const rowKey = watcherData.rowKey.value;
  46190. if (rowKey) {
  46191. const expandMap = getKeysMap(expandRows.value, rowKey);
  46192. return !!expandMap[getRowIdentity(row, rowKey)];
  46193. }
  46194. return expandRows.value.includes(row);
  46195. };
  46196. return {
  46197. updateExpandRows,
  46198. toggleRowExpansion,
  46199. setExpandRowKeys,
  46200. isRowExpanded,
  46201. states: {
  46202. expandRows,
  46203. defaultExpandAll
  46204. }
  46205. };
  46206. }
  46207. function useCurrent(watcherData) {
  46208. const instance = getCurrentInstance();
  46209. const _currentRowKey = ref(null);
  46210. const currentRow = ref(null);
  46211. const setCurrentRowKey = (key) => {
  46212. instance.store.assertRowKey();
  46213. _currentRowKey.value = key;
  46214. setCurrentRowByKey(key);
  46215. };
  46216. const restoreCurrentRowKey = () => {
  46217. _currentRowKey.value = null;
  46218. };
  46219. const setCurrentRowByKey = (key) => {
  46220. var _a;
  46221. const { data, rowKey } = watcherData;
  46222. let _currentRow = null;
  46223. if (rowKey.value) {
  46224. _currentRow = (_a = (unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key)) != null ? _a : null;
  46225. }
  46226. currentRow.value = _currentRow != null ? _currentRow : null;
  46227. instance.emit("current-change", currentRow.value, null);
  46228. };
  46229. const updateCurrentRow = (_currentRow) => {
  46230. const oldCurrentRow = currentRow.value;
  46231. if (_currentRow && _currentRow !== oldCurrentRow) {
  46232. currentRow.value = _currentRow;
  46233. instance.emit("current-change", currentRow.value, oldCurrentRow);
  46234. return;
  46235. }
  46236. if (!_currentRow && oldCurrentRow) {
  46237. currentRow.value = null;
  46238. instance.emit("current-change", null, oldCurrentRow);
  46239. }
  46240. };
  46241. const updateCurrentRowData = () => {
  46242. const rowKey = watcherData.rowKey.value;
  46243. const data = watcherData.data.value || [];
  46244. const oldCurrentRow = currentRow.value;
  46245. if (oldCurrentRow && !data.includes(oldCurrentRow)) {
  46246. if (rowKey) {
  46247. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  46248. setCurrentRowByKey(currentRowKey);
  46249. } else {
  46250. currentRow.value = null;
  46251. }
  46252. if (isNull(currentRow.value)) {
  46253. instance.emit("current-change", null, oldCurrentRow);
  46254. }
  46255. } else if (_currentRowKey.value) {
  46256. setCurrentRowByKey(_currentRowKey.value);
  46257. restoreCurrentRowKey();
  46258. }
  46259. };
  46260. return {
  46261. setCurrentRowKey,
  46262. restoreCurrentRowKey,
  46263. setCurrentRowByKey,
  46264. updateCurrentRow,
  46265. updateCurrentRowData,
  46266. states: {
  46267. _currentRowKey,
  46268. currentRow
  46269. }
  46270. };
  46271. }
  46272. function useTree$2(watcherData) {
  46273. const expandRowKeys = ref([]);
  46274. const treeData = ref({});
  46275. const indent = ref(16);
  46276. const lazy = ref(false);
  46277. const lazyTreeNodeMap = ref({});
  46278. const lazyColumnIdentifier = ref("hasChildren");
  46279. const childrenColumnName = ref("children");
  46280. const checkStrictly = ref(false);
  46281. const instance = getCurrentInstance();
  46282. const normalizedData = computed(() => {
  46283. if (!watcherData.rowKey.value)
  46284. return {};
  46285. const data = watcherData.data.value || [];
  46286. return normalize(data);
  46287. });
  46288. const normalizedLazyNode = computed(() => {
  46289. const rowKey = watcherData.rowKey.value;
  46290. const keys = Object.keys(lazyTreeNodeMap.value);
  46291. const res = {};
  46292. if (!keys.length)
  46293. return res;
  46294. keys.forEach((key) => {
  46295. if (lazyTreeNodeMap.value[key].length) {
  46296. const item = { children: [] };
  46297. lazyTreeNodeMap.value[key].forEach((row) => {
  46298. const currentRowKey = getRowIdentity(row, rowKey);
  46299. item.children.push(currentRowKey);
  46300. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  46301. res[currentRowKey] = { children: [] };
  46302. }
  46303. });
  46304. res[key] = item;
  46305. }
  46306. });
  46307. return res;
  46308. });
  46309. const normalize = (data) => {
  46310. const rowKey = watcherData.rowKey.value;
  46311. const res = {};
  46312. walkTreeNode(data, (parent, children, level) => {
  46313. const parentId = getRowIdentity(parent, rowKey);
  46314. if (isArray$1(children)) {
  46315. res[parentId] = {
  46316. children: children.map((row) => getRowIdentity(row, rowKey)),
  46317. level
  46318. };
  46319. } else if (lazy.value) {
  46320. res[parentId] = {
  46321. children: [],
  46322. lazy: true,
  46323. level
  46324. };
  46325. }
  46326. }, childrenColumnName.value, lazyColumnIdentifier.value, lazy.value);
  46327. return res;
  46328. };
  46329. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll) => {
  46330. var _a, _b;
  46331. ifExpandAll || (ifExpandAll = (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value);
  46332. const nested = normalizedData.value;
  46333. const normalizedLazyNode_ = normalizedLazyNode.value;
  46334. const keys = Object.keys(nested);
  46335. const newTreeData = {};
  46336. if (keys.length) {
  46337. const oldTreeData = unref(treeData);
  46338. const rootLazyRowKeys = [];
  46339. const getExpanded = (oldValue, key) => {
  46340. if (ifChangeExpandRowKeys) {
  46341. if (expandRowKeys.value) {
  46342. return ifExpandAll || expandRowKeys.value.includes(key);
  46343. } else {
  46344. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  46345. }
  46346. } else {
  46347. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  46348. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  46349. }
  46350. };
  46351. keys.forEach((key) => {
  46352. const oldValue = oldTreeData[key];
  46353. const newValue = { ...nested[key] };
  46354. newValue.expanded = getExpanded(oldValue, key);
  46355. if (newValue.lazy) {
  46356. const { loaded = false, loading = false } = oldValue || {};
  46357. newValue.loaded = !!loaded;
  46358. newValue.loading = !!loading;
  46359. rootLazyRowKeys.push(key);
  46360. }
  46361. newTreeData[key] = newValue;
  46362. });
  46363. const lazyKeys = Object.keys(normalizedLazyNode_);
  46364. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  46365. lazyKeys.forEach((key) => {
  46366. var _a2;
  46367. const oldValue = oldTreeData[key];
  46368. const lazyNodeChildren = normalizedLazyNode_[key].children;
  46369. if (rootLazyRowKeys.includes(key)) {
  46370. if (((_a2 = newTreeData[key].children) == null ? void 0 : _a2.length) !== 0) {
  46371. throw new Error("[ElTable]children must be an empty array.");
  46372. }
  46373. newTreeData[key].children = lazyNodeChildren;
  46374. } else {
  46375. const { loaded = false, loading = false } = oldValue || {};
  46376. newTreeData[key] = {
  46377. lazy: true,
  46378. loaded: !!loaded,
  46379. loading: !!loading,
  46380. expanded: getExpanded(oldValue, key),
  46381. children: lazyNodeChildren,
  46382. level: void 0
  46383. };
  46384. }
  46385. });
  46386. }
  46387. }
  46388. treeData.value = newTreeData;
  46389. (_b = instance.store) == null ? void 0 : _b.updateTableScrollY();
  46390. };
  46391. watch(() => expandRowKeys.value, () => {
  46392. updateTreeData(true);
  46393. });
  46394. watch(() => normalizedData.value, () => {
  46395. updateTreeData();
  46396. });
  46397. watch(() => normalizedLazyNode.value, () => {
  46398. updateTreeData();
  46399. });
  46400. const updateTreeExpandKeys = (value) => {
  46401. expandRowKeys.value = value;
  46402. updateTreeData();
  46403. };
  46404. const isUseLazy = (data) => {
  46405. return lazy.value && data && "loaded" in data && !data.loaded;
  46406. };
  46407. const toggleTreeExpansion = (row, expanded) => {
  46408. instance.store.assertRowKey();
  46409. const rowKey = watcherData.rowKey.value;
  46410. const id = getRowIdentity(row, rowKey);
  46411. const data = id && treeData.value[id];
  46412. if (id && data && "expanded" in data) {
  46413. const oldExpanded = data.expanded;
  46414. expanded = isUndefined(expanded) ? !data.expanded : expanded;
  46415. treeData.value[id].expanded = expanded;
  46416. if (oldExpanded !== expanded) {
  46417. instance.emit("expand-change", row, expanded);
  46418. }
  46419. isUseLazy(data) && loadData(row, id, data);
  46420. instance.store.updateTableScrollY();
  46421. }
  46422. };
  46423. const loadOrToggle = (row) => {
  46424. instance.store.assertRowKey();
  46425. const rowKey = watcherData.rowKey.value;
  46426. const id = getRowIdentity(row, rowKey);
  46427. const data = treeData.value[id];
  46428. if (isUseLazy(data)) {
  46429. loadData(row, id, data);
  46430. } else {
  46431. toggleTreeExpansion(row, void 0);
  46432. }
  46433. };
  46434. const loadData = (row, key, treeNode) => {
  46435. const { load } = instance.props;
  46436. if (load && !treeData.value[key].loaded) {
  46437. treeData.value[key].loading = true;
  46438. load(row, treeNode, (data) => {
  46439. if (!isArray$1(data)) {
  46440. throw new TypeError("[ElTable] data must be an array");
  46441. }
  46442. treeData.value[key].loading = false;
  46443. treeData.value[key].loaded = true;
  46444. treeData.value[key].expanded = true;
  46445. if (data.length) {
  46446. lazyTreeNodeMap.value[key] = data;
  46447. }
  46448. instance.emit("expand-change", row, true);
  46449. });
  46450. }
  46451. };
  46452. const updateKeyChildren = (key, data) => {
  46453. const { lazy: lazy2, rowKey } = instance.props;
  46454. if (!lazy2)
  46455. return;
  46456. if (!rowKey)
  46457. throw new Error("[Table] rowKey is required in updateKeyChild");
  46458. if (lazyTreeNodeMap.value[key]) {
  46459. lazyTreeNodeMap.value[key] = data;
  46460. }
  46461. };
  46462. return {
  46463. loadData,
  46464. loadOrToggle,
  46465. toggleTreeExpansion,
  46466. updateTreeExpandKeys,
  46467. updateTreeData,
  46468. updateKeyChildren,
  46469. normalize,
  46470. states: {
  46471. expandRowKeys,
  46472. treeData,
  46473. indent,
  46474. lazy,
  46475. lazyTreeNodeMap,
  46476. lazyColumnIdentifier,
  46477. childrenColumnName,
  46478. checkStrictly
  46479. }
  46480. };
  46481. }
  46482. const sortData = (data, states) => {
  46483. const sortingColumn = states.sortingColumn;
  46484. if (!sortingColumn || isString$1(sortingColumn.sortable)) {
  46485. return data;
  46486. }
  46487. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  46488. };
  46489. const doFlattenColumns = (columns) => {
  46490. const result = [];
  46491. columns.forEach((column) => {
  46492. if (column.children && column.children.length > 0) {
  46493. result.push.apply(result, doFlattenColumns(column.children));
  46494. } else {
  46495. result.push(column);
  46496. }
  46497. });
  46498. return result;
  46499. };
  46500. function useWatcher$1() {
  46501. var _a;
  46502. const instance = getCurrentInstance();
  46503. const { size: tableSize } = toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
  46504. const rowKey = ref(null);
  46505. const data = ref([]);
  46506. const _data = ref([]);
  46507. const isComplex = ref(false);
  46508. const _columns = ref([]);
  46509. const originColumns = ref([]);
  46510. const columns = ref([]);
  46511. const fixedColumns = ref([]);
  46512. const rightFixedColumns = ref([]);
  46513. const leafColumns = ref([]);
  46514. const fixedLeafColumns = ref([]);
  46515. const rightFixedLeafColumns = ref([]);
  46516. const updateOrderFns = [];
  46517. const leafColumnsLength = ref(0);
  46518. const fixedLeafColumnsLength = ref(0);
  46519. const rightFixedLeafColumnsLength = ref(0);
  46520. const isAllSelected = ref(false);
  46521. const selection = ref([]);
  46522. const reserveSelection = ref(false);
  46523. const selectOnIndeterminate = ref(false);
  46524. const selectable = ref(null);
  46525. const filters = ref({});
  46526. const filteredData = ref(null);
  46527. const sortingColumn = ref(null);
  46528. const sortProp = ref(null);
  46529. const sortOrder = ref(null);
  46530. const hoverRow = ref(null);
  46531. const selectedMap = computed(() => {
  46532. return rowKey.value ? getKeysMap(selection.value, rowKey.value) : void 0;
  46533. });
  46534. watch(data, () => {
  46535. var _a2;
  46536. if (instance.state) {
  46537. scheduleLayout(false);
  46538. const needUpdateFixed = instance.props.tableLayout === "auto";
  46539. if (needUpdateFixed) {
  46540. (_a2 = instance.refs.tableHeaderRef) == null ? void 0 : _a2.updateFixedColumnStyle();
  46541. }
  46542. }
  46543. }, {
  46544. deep: true
  46545. });
  46546. const assertRowKey = () => {
  46547. if (!rowKey.value)
  46548. throw new Error("[ElTable] prop row-key is required");
  46549. };
  46550. const updateChildFixed = (column) => {
  46551. var _a2;
  46552. (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => {
  46553. childColumn.fixed = column.fixed;
  46554. updateChildFixed(childColumn);
  46555. });
  46556. };
  46557. const updateColumns = () => {
  46558. _columns.value.forEach((column) => {
  46559. updateChildFixed(column);
  46560. });
  46561. fixedColumns.value = _columns.value.filter((column) => [true, "left"].includes(column.fixed));
  46562. const selectColumn = _columns.value.find((column) => column.type === "selection");
  46563. let selectColFixLeft;
  46564. if (selectColumn && selectColumn.fixed !== "right" && !fixedColumns.value.includes(selectColumn)) {
  46565. const selectColumnIndex = _columns.value.indexOf(selectColumn);
  46566. if (selectColumnIndex === 0 && fixedColumns.value.length) {
  46567. fixedColumns.value.unshift(selectColumn);
  46568. selectColFixLeft = true;
  46569. }
  46570. }
  46571. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  46572. const notFixedColumns = _columns.value.filter((column) => (selectColFixLeft ? column.type !== "selection" : true) && !column.fixed);
  46573. originColumns.value = Array.from(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  46574. const leafColumns2 = doFlattenColumns(notFixedColumns);
  46575. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  46576. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  46577. leafColumnsLength.value = leafColumns2.length;
  46578. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  46579. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  46580. columns.value = Array.from(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  46581. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  46582. };
  46583. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  46584. if (needUpdateColumns) {
  46585. updateColumns();
  46586. }
  46587. if (immediate) {
  46588. instance.state.doLayout();
  46589. } else {
  46590. instance.state.debouncedUpdateLayout();
  46591. }
  46592. };
  46593. const isSelected = (row) => {
  46594. if (selectedMap.value) {
  46595. return !!selectedMap.value[getRowIdentity(row, rowKey.value)];
  46596. } else {
  46597. return selection.value.includes(row);
  46598. }
  46599. };
  46600. const clearSelection = () => {
  46601. isAllSelected.value = false;
  46602. const oldSelection = selection.value;
  46603. selection.value = [];
  46604. if (oldSelection.length) {
  46605. instance.emit("selection-change", []);
  46606. }
  46607. };
  46608. const cleanSelection = () => {
  46609. var _a2, _b;
  46610. let deleted;
  46611. if (rowKey.value) {
  46612. deleted = [];
  46613. const childrenKey = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.childrenColumnName.value;
  46614. const dataMap = getKeysMap(data.value, rowKey.value, true, childrenKey);
  46615. for (const key in selectedMap.value) {
  46616. if (hasOwn(selectedMap.value, key) && !dataMap[key]) {
  46617. deleted.push(selectedMap.value[key].row);
  46618. }
  46619. }
  46620. } else {
  46621. deleted = selection.value.filter((item) => !data.value.includes(item));
  46622. }
  46623. if (deleted.length) {
  46624. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  46625. selection.value = newSelection;
  46626. instance.emit("selection-change", newSelection.slice());
  46627. }
  46628. };
  46629. const getSelectionRows = () => {
  46630. return (selection.value || []).slice();
  46631. };
  46632. const toggleRowSelection = (row, selected, emitChange = true, ignoreSelectable = false) => {
  46633. var _a2, _b, _c, _d;
  46634. const treeProps = {
  46635. children: (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.childrenColumnName.value,
  46636. checkStrictly: (_d = (_c = instance == null ? void 0 : instance.store) == null ? void 0 : _c.states) == null ? void 0 : _d.checkStrictly.value
  46637. };
  46638. const changed = toggleRowStatus(selection.value, row, selected, treeProps, ignoreSelectable ? void 0 : selectable.value, data.value.indexOf(row), rowKey.value);
  46639. if (changed) {
  46640. const newSelection = (selection.value || []).slice();
  46641. if (emitChange) {
  46642. instance.emit("select", newSelection, row);
  46643. }
  46644. instance.emit("selection-change", newSelection);
  46645. }
  46646. };
  46647. const _toggleAllSelection = () => {
  46648. var _a2, _b;
  46649. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  46650. isAllSelected.value = value;
  46651. let selectionChanged = false;
  46652. let childrenCount = 0;
  46653. const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
  46654. const { childrenColumnName } = instance.store.states;
  46655. const treeProps = {
  46656. children: childrenColumnName.value,
  46657. checkStrictly: false
  46658. };
  46659. data.value.forEach((row, index) => {
  46660. const rowIndex = index + childrenCount;
  46661. if (toggleRowStatus(selection.value, row, value, treeProps, selectable.value, rowIndex, rowKey2)) {
  46662. selectionChanged = true;
  46663. }
  46664. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  46665. });
  46666. if (selectionChanged) {
  46667. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  46668. }
  46669. instance.emit("select-all", (selection.value || []).slice());
  46670. };
  46671. const updateAllSelected = () => {
  46672. var _a2;
  46673. if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
  46674. isAllSelected.value = false;
  46675. return;
  46676. }
  46677. const { childrenColumnName } = instance.store.states;
  46678. let rowIndex = 0;
  46679. let selectedCount = 0;
  46680. const checkSelectedStatus = (data2) => {
  46681. var _a3;
  46682. for (const row of data2) {
  46683. const isRowSelectable = selectable.value && selectable.value.call(null, row, rowIndex);
  46684. if (!isSelected(row)) {
  46685. if (!selectable.value || isRowSelectable) {
  46686. return false;
  46687. }
  46688. } else {
  46689. selectedCount++;
  46690. }
  46691. rowIndex++;
  46692. if (((_a3 = row[childrenColumnName.value]) == null ? void 0 : _a3.length) && !checkSelectedStatus(row[childrenColumnName.value])) {
  46693. return false;
  46694. }
  46695. }
  46696. return true;
  46697. };
  46698. const isAllSelected_ = checkSelectedStatus(data.value || []);
  46699. isAllSelected.value = selectedCount === 0 ? false : isAllSelected_;
  46700. };
  46701. const getChildrenCount = (rowKey2) => {
  46702. var _a2;
  46703. if (!instance || !instance.store)
  46704. return 0;
  46705. const { treeData } = instance.store.states;
  46706. let count = 0;
  46707. const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
  46708. if (children) {
  46709. count += children.length;
  46710. children.forEach((childKey) => {
  46711. count += getChildrenCount(childKey);
  46712. });
  46713. }
  46714. return count;
  46715. };
  46716. const updateFilters = (column, values) => {
  46717. const filters_ = {};
  46718. castArray$1(column).forEach((col) => {
  46719. filters.value[col.id] = values;
  46720. filters_[col.columnKey || col.id] = values;
  46721. });
  46722. return filters_;
  46723. };
  46724. const updateSort = (column, prop, order) => {
  46725. if (sortingColumn.value && sortingColumn.value !== column) {
  46726. sortingColumn.value.order = null;
  46727. }
  46728. sortingColumn.value = column;
  46729. sortProp.value = prop;
  46730. sortOrder.value = order;
  46731. };
  46732. const execFilter = () => {
  46733. let sourceData = unref(_data);
  46734. Object.keys(filters.value).forEach((columnId) => {
  46735. const values = filters.value[columnId];
  46736. if (!values || values.length === 0)
  46737. return;
  46738. const column = getColumnById({
  46739. columns: columns.value
  46740. }, columnId);
  46741. if (column && column.filterMethod) {
  46742. sourceData = sourceData.filter((row) => {
  46743. return values.some((value) => column.filterMethod.call(null, value, row, column));
  46744. });
  46745. }
  46746. });
  46747. filteredData.value = sourceData;
  46748. };
  46749. const execSort = () => {
  46750. var _a2;
  46751. data.value = sortData((_a2 = filteredData.value) != null ? _a2 : [], {
  46752. sortingColumn: sortingColumn.value,
  46753. sortProp: sortProp.value,
  46754. sortOrder: sortOrder.value
  46755. });
  46756. };
  46757. const execQuery = (ignore = void 0) => {
  46758. if (!(ignore == null ? void 0 : ignore.filter)) {
  46759. execFilter();
  46760. }
  46761. execSort();
  46762. };
  46763. const clearFilter = (columnKeys) => {
  46764. const { tableHeaderRef } = instance.refs;
  46765. if (!tableHeaderRef)
  46766. return;
  46767. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  46768. const keys = Object.keys(panels);
  46769. if (!keys.length)
  46770. return;
  46771. if (isString$1(columnKeys)) {
  46772. columnKeys = [columnKeys];
  46773. }
  46774. if (isArray$1(columnKeys)) {
  46775. const columns_ = columnKeys.map((key) => getColumnByKey({
  46776. columns: columns.value
  46777. }, key));
  46778. keys.forEach((key) => {
  46779. const column = columns_.find((col) => col.id === key);
  46780. if (column) {
  46781. column.filteredValue = [];
  46782. }
  46783. });
  46784. instance.store.commit("filterChange", {
  46785. column: columns_,
  46786. values: [],
  46787. silent: true,
  46788. multi: true
  46789. });
  46790. } else {
  46791. keys.forEach((key) => {
  46792. const column = columns.value.find((col) => col.id === key);
  46793. if (column) {
  46794. column.filteredValue = [];
  46795. }
  46796. });
  46797. filters.value = {};
  46798. instance.store.commit("filterChange", {
  46799. column: {},
  46800. values: [],
  46801. silent: true
  46802. });
  46803. }
  46804. };
  46805. const clearSort = () => {
  46806. if (!sortingColumn.value)
  46807. return;
  46808. updateSort(null, null, null);
  46809. instance.store.commit("changeSortCondition", {
  46810. silent: true
  46811. });
  46812. };
  46813. const {
  46814. setExpandRowKeys,
  46815. toggleRowExpansion,
  46816. updateExpandRows,
  46817. states: expandStates,
  46818. isRowExpanded
  46819. } = useExpand({
  46820. data,
  46821. rowKey
  46822. });
  46823. const {
  46824. updateTreeExpandKeys,
  46825. toggleTreeExpansion,
  46826. updateTreeData,
  46827. updateKeyChildren,
  46828. loadOrToggle,
  46829. states: treeStates
  46830. } = useTree$2({
  46831. data,
  46832. rowKey
  46833. });
  46834. const {
  46835. updateCurrentRowData,
  46836. updateCurrentRow,
  46837. setCurrentRowKey,
  46838. states: currentData
  46839. } = useCurrent({
  46840. data,
  46841. rowKey
  46842. });
  46843. const setExpandRowKeysAdapter = (val) => {
  46844. setExpandRowKeys(val);
  46845. updateTreeExpandKeys(val);
  46846. };
  46847. const toggleRowExpansionAdapter = (row, expanded) => {
  46848. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  46849. if (hasExpandColumn) {
  46850. toggleRowExpansion(row, expanded);
  46851. } else {
  46852. toggleTreeExpansion(row, expanded);
  46853. }
  46854. };
  46855. return {
  46856. assertRowKey,
  46857. updateColumns,
  46858. scheduleLayout,
  46859. isSelected,
  46860. clearSelection,
  46861. cleanSelection,
  46862. getSelectionRows,
  46863. toggleRowSelection,
  46864. _toggleAllSelection,
  46865. toggleAllSelection: null,
  46866. updateAllSelected,
  46867. updateFilters,
  46868. updateCurrentRow,
  46869. updateSort,
  46870. execFilter,
  46871. execSort,
  46872. execQuery,
  46873. clearFilter,
  46874. clearSort,
  46875. toggleRowExpansion,
  46876. setExpandRowKeysAdapter,
  46877. setCurrentRowKey,
  46878. toggleRowExpansionAdapter,
  46879. isRowExpanded,
  46880. updateExpandRows,
  46881. updateCurrentRowData,
  46882. loadOrToggle,
  46883. updateTreeData,
  46884. updateKeyChildren,
  46885. states: {
  46886. tableSize,
  46887. rowKey,
  46888. data,
  46889. _data,
  46890. isComplex,
  46891. _columns,
  46892. originColumns,
  46893. columns,
  46894. fixedColumns,
  46895. rightFixedColumns,
  46896. leafColumns,
  46897. fixedLeafColumns,
  46898. rightFixedLeafColumns,
  46899. updateOrderFns,
  46900. leafColumnsLength,
  46901. fixedLeafColumnsLength,
  46902. rightFixedLeafColumnsLength,
  46903. isAllSelected,
  46904. selection,
  46905. reserveSelection,
  46906. selectOnIndeterminate,
  46907. selectable,
  46908. filters,
  46909. filteredData,
  46910. sortingColumn,
  46911. sortProp,
  46912. sortOrder,
  46913. hoverRow,
  46914. ...expandStates,
  46915. ...treeStates,
  46916. ...currentData
  46917. }
  46918. };
  46919. }
  46920. function replaceColumn(array, column) {
  46921. return array.map((item) => {
  46922. var _a;
  46923. if (item.id === column.id) {
  46924. return column;
  46925. } else if ((_a = item.children) == null ? void 0 : _a.length) {
  46926. item.children = replaceColumn(item.children, column);
  46927. }
  46928. return item;
  46929. });
  46930. }
  46931. function sortColumn(array) {
  46932. array.forEach((item) => {
  46933. var _a, _b;
  46934. item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
  46935. if ((_b = item.children) == null ? void 0 : _b.length) {
  46936. sortColumn(item.children);
  46937. }
  46938. });
  46939. array.sort((cur, pre) => cur.no - pre.no);
  46940. }
  46941. function useStore() {
  46942. const instance = getCurrentInstance();
  46943. const watcher = useWatcher$1();
  46944. const ns = useNamespace("table");
  46945. const mutations = {
  46946. setData(states, data) {
  46947. const dataInstanceChanged = unref(states._data) !== data;
  46948. states.data.value = data;
  46949. states._data.value = data;
  46950. instance.store.execQuery();
  46951. instance.store.updateCurrentRowData();
  46952. instance.store.updateExpandRows();
  46953. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  46954. if (unref(states.reserveSelection)) {
  46955. instance.store.assertRowKey();
  46956. } else {
  46957. if (dataInstanceChanged) {
  46958. instance.store.clearSelection();
  46959. } else {
  46960. instance.store.cleanSelection();
  46961. }
  46962. }
  46963. instance.store.updateAllSelected();
  46964. if (instance.$ready) {
  46965. instance.store.scheduleLayout();
  46966. }
  46967. },
  46968. insertColumn(states, column, parent, updateColumnOrder) {
  46969. var _a;
  46970. const array = unref(states._columns);
  46971. let newColumns = [];
  46972. if (!parent) {
  46973. array.push(column);
  46974. newColumns = array;
  46975. } else {
  46976. if (parent && !parent.children) {
  46977. parent.children = [];
  46978. }
  46979. (_a = parent.children) == null ? void 0 : _a.push(column);
  46980. newColumns = replaceColumn(array, parent);
  46981. }
  46982. sortColumn(newColumns);
  46983. states._columns.value = newColumns;
  46984. states.updateOrderFns.push(updateColumnOrder);
  46985. if (column.type === "selection") {
  46986. states.selectable.value = column.selectable;
  46987. states.reserveSelection.value = column.reserveSelection;
  46988. }
  46989. if (instance.$ready) {
  46990. instance.store.updateColumns();
  46991. instance.store.scheduleLayout();
  46992. }
  46993. },
  46994. updateColumnOrder(states, column) {
  46995. var _a;
  46996. const newColumnIndex = (_a = column.getColumnIndex) == null ? void 0 : _a.call(column);
  46997. if (newColumnIndex === column.no)
  46998. return;
  46999. sortColumn(states._columns.value);
  47000. if (instance.$ready) {
  47001. instance.store.updateColumns();
  47002. }
  47003. },
  47004. removeColumn(states, column, parent, updateColumnOrder) {
  47005. var _a;
  47006. const array = unref(states._columns) || [];
  47007. if (parent) {
  47008. (_a = parent.children) == null ? void 0 : _a.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  47009. nextTick(() => {
  47010. var _a2;
  47011. if (((_a2 = parent.children) == null ? void 0 : _a2.length) === 0) {
  47012. delete parent.children;
  47013. }
  47014. });
  47015. states._columns.value = replaceColumn(array, parent);
  47016. } else {
  47017. const index = array.indexOf(column);
  47018. if (index > -1) {
  47019. array.splice(index, 1);
  47020. states._columns.value = array;
  47021. }
  47022. }
  47023. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  47024. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  47025. if (instance.$ready) {
  47026. instance.store.updateColumns();
  47027. instance.store.scheduleLayout();
  47028. }
  47029. },
  47030. sort(states, options) {
  47031. const { prop, order, init } = options;
  47032. if (prop) {
  47033. const column = unref(states.columns).find((column2) => column2.property === prop);
  47034. if (column) {
  47035. column.order = order;
  47036. instance.store.updateSort(column, prop, order);
  47037. instance.store.commit("changeSortCondition", { init });
  47038. }
  47039. }
  47040. },
  47041. changeSortCondition(states, options) {
  47042. const { sortingColumn, sortProp, sortOrder } = states;
  47043. const columnValue = unref(sortingColumn), propValue = unref(sortProp), orderValue = unref(sortOrder);
  47044. if (isNull(orderValue)) {
  47045. states.sortingColumn.value = null;
  47046. states.sortProp.value = null;
  47047. }
  47048. const ignore = { filter: true };
  47049. instance.store.execQuery(ignore);
  47050. if (!options || !(options.silent || options.init)) {
  47051. instance.emit("sort-change", {
  47052. column: columnValue,
  47053. prop: propValue,
  47054. order: orderValue
  47055. });
  47056. }
  47057. instance.store.updateTableScrollY();
  47058. },
  47059. filterChange(_states, options) {
  47060. const { column, values, silent } = options;
  47061. const newFilters = instance.store.updateFilters(column, values);
  47062. instance.store.execQuery();
  47063. if (!silent) {
  47064. instance.emit("filter-change", newFilters);
  47065. }
  47066. instance.store.updateTableScrollY();
  47067. },
  47068. toggleAllSelection() {
  47069. var _a, _b;
  47070. (_b = (_a = instance.store).toggleAllSelection) == null ? void 0 : _b.call(_a);
  47071. },
  47072. rowSelectedChanged(_states, row) {
  47073. instance.store.toggleRowSelection(row);
  47074. instance.store.updateAllSelected();
  47075. },
  47076. setHoverRow(states, row) {
  47077. states.hoverRow.value = row;
  47078. },
  47079. setCurrentRow(_states, row) {
  47080. instance.store.updateCurrentRow(row);
  47081. }
  47082. };
  47083. const commit = function(name, ...args) {
  47084. const mutations2 = instance.store.mutations;
  47085. if (mutations2[name]) {
  47086. mutations2[name].apply(instance, [
  47087. instance.store.states,
  47088. ...args
  47089. ]);
  47090. } else {
  47091. throw new Error(`Action not found: ${name}`);
  47092. }
  47093. };
  47094. const updateTableScrollY = function() {
  47095. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  47096. };
  47097. return {
  47098. ns,
  47099. ...watcher,
  47100. mutations,
  47101. commit,
  47102. updateTableScrollY
  47103. };
  47104. }
  47105. const InitialStateMap = {
  47106. rowKey: "rowKey",
  47107. defaultExpandAll: "defaultExpandAll",
  47108. selectOnIndeterminate: "selectOnIndeterminate",
  47109. indent: "indent",
  47110. lazy: "lazy",
  47111. data: "data",
  47112. ["treeProps.hasChildren"]: {
  47113. key: "lazyColumnIdentifier",
  47114. default: "hasChildren"
  47115. },
  47116. ["treeProps.children"]: {
  47117. key: "childrenColumnName",
  47118. default: "children"
  47119. },
  47120. ["treeProps.checkStrictly"]: {
  47121. key: "checkStrictly",
  47122. default: false
  47123. }
  47124. };
  47125. function createStore(table, props) {
  47126. if (!table) {
  47127. throw new Error("Table is required.");
  47128. }
  47129. const store = useStore();
  47130. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  47131. Object.keys(InitialStateMap).forEach((key) => {
  47132. handleValue(getArrKeysValue(props, key), key, store);
  47133. });
  47134. proxyTableProps(store, props);
  47135. return store;
  47136. }
  47137. function proxyTableProps(store, props) {
  47138. Object.keys(InitialStateMap).forEach((key) => {
  47139. watch(() => getArrKeysValue(props, key), (value) => {
  47140. handleValue(value, key, store);
  47141. });
  47142. });
  47143. }
  47144. function handleValue(value, propsKey, store) {
  47145. let newVal = value;
  47146. let storeKey = InitialStateMap[propsKey];
  47147. if (isObject$1(storeKey)) {
  47148. newVal = newVal || storeKey.default;
  47149. storeKey = storeKey.key;
  47150. }
  47151. store.states[storeKey].value = newVal;
  47152. }
  47153. function getArrKeysValue(props, key) {
  47154. if (key.includes(".")) {
  47155. const keyList = key.split(".");
  47156. let value = props;
  47157. keyList.forEach((k) => {
  47158. value = value[k];
  47159. });
  47160. return value;
  47161. } else {
  47162. return props[key];
  47163. }
  47164. }
  47165. class TableLayout {
  47166. constructor(options) {
  47167. this.observers = [];
  47168. this.table = null;
  47169. this.store = null;
  47170. this.columns = [];
  47171. this.fit = true;
  47172. this.showHeader = true;
  47173. this.height = ref(null);
  47174. this.scrollX = ref(false);
  47175. this.scrollY = ref(false);
  47176. this.bodyWidth = ref(null);
  47177. this.fixedWidth = ref(null);
  47178. this.rightFixedWidth = ref(null);
  47179. this.gutterWidth = 0;
  47180. for (const name in options) {
  47181. if (hasOwn(options, name)) {
  47182. if (isRef(this[name])) {
  47183. this[name].value = options[name];
  47184. } else {
  47185. this[name] = options[name];
  47186. }
  47187. }
  47188. }
  47189. if (!this.table) {
  47190. throw new Error("Table is required for Table Layout");
  47191. }
  47192. if (!this.store) {
  47193. throw new Error("Store is required for Table Layout");
  47194. }
  47195. }
  47196. updateScrollY() {
  47197. const height = this.height.value;
  47198. if (isNull(height))
  47199. return false;
  47200. const scrollBarRef = this.table.refs.scrollBarRef;
  47201. if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
  47202. let scrollY = true;
  47203. const prevScrollY = this.scrollY.value;
  47204. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  47205. this.scrollY.value = scrollY;
  47206. return prevScrollY !== scrollY;
  47207. }
  47208. return false;
  47209. }
  47210. setHeight(value, prop = "height") {
  47211. if (!isClient)
  47212. return;
  47213. const el = this.table.vnode.el;
  47214. value = parseHeight(value);
  47215. this.height.value = Number(value);
  47216. if (!el && (value || value === 0)) {
  47217. nextTick(() => this.setHeight(value, prop));
  47218. return;
  47219. }
  47220. if (el && isNumber(value)) {
  47221. el.style[prop] = `${value}px`;
  47222. this.updateElsHeight();
  47223. } else if (el && isString$1(value)) {
  47224. el.style[prop] = value;
  47225. this.updateElsHeight();
  47226. }
  47227. }
  47228. setMaxHeight(value) {
  47229. this.setHeight(value, "max-height");
  47230. }
  47231. getFlattenColumns() {
  47232. const flattenColumns = [];
  47233. const columns = this.table.store.states.columns.value;
  47234. columns.forEach((column) => {
  47235. if (column.isColumnGroup) {
  47236. flattenColumns.push.apply(flattenColumns, column.columns);
  47237. } else {
  47238. flattenColumns.push(column);
  47239. }
  47240. });
  47241. return flattenColumns;
  47242. }
  47243. updateElsHeight() {
  47244. this.updateScrollY();
  47245. this.notifyObservers("scrollable");
  47246. }
  47247. headerDisplayNone(elm) {
  47248. if (!elm)
  47249. return true;
  47250. let headerChild = elm;
  47251. while (headerChild.tagName !== "DIV") {
  47252. if (getComputedStyle(headerChild).display === "none") {
  47253. return true;
  47254. }
  47255. headerChild = headerChild.parentElement;
  47256. }
  47257. return false;
  47258. }
  47259. updateColumnsWidth() {
  47260. var _a;
  47261. if (!isClient)
  47262. return;
  47263. const fit = this.fit;
  47264. const bodyWidth = (_a = this.table.vnode.el) == null ? void 0 : _a.clientWidth;
  47265. let bodyMinWidth = 0;
  47266. const flattenColumns = this.getFlattenColumns();
  47267. const flexColumns = flattenColumns.filter((column) => !isNumber(column.width));
  47268. flattenColumns.forEach((column) => {
  47269. if (isNumber(column.width) && column.realWidth)
  47270. column.realWidth = null;
  47271. });
  47272. if (flexColumns.length > 0 && fit) {
  47273. flattenColumns.forEach((column) => {
  47274. bodyMinWidth += Number(column.width || column.minWidth || 80);
  47275. });
  47276. if (bodyMinWidth <= bodyWidth) {
  47277. this.scrollX.value = false;
  47278. const totalFlexWidth = bodyWidth - bodyMinWidth;
  47279. if (flexColumns.length === 1) {
  47280. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  47281. } else {
  47282. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  47283. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  47284. let noneFirstWidth = 0;
  47285. flexColumns.forEach((column, index) => {
  47286. if (index === 0)
  47287. return;
  47288. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  47289. noneFirstWidth += flexWidth;
  47290. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  47291. });
  47292. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  47293. }
  47294. } else {
  47295. this.scrollX.value = true;
  47296. flexColumns.forEach((column) => {
  47297. column.realWidth = Number(column.minWidth);
  47298. });
  47299. }
  47300. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  47301. this.table.state.resizeState.value.width = this.bodyWidth.value;
  47302. } else {
  47303. flattenColumns.forEach((column) => {
  47304. if (!column.width && !column.minWidth) {
  47305. column.realWidth = 80;
  47306. } else {
  47307. column.realWidth = Number(column.width || column.minWidth);
  47308. }
  47309. bodyMinWidth += column.realWidth;
  47310. });
  47311. this.scrollX.value = bodyMinWidth > bodyWidth;
  47312. this.bodyWidth.value = bodyMinWidth;
  47313. }
  47314. const fixedColumns = this.store.states.fixedColumns.value;
  47315. if (fixedColumns.length > 0) {
  47316. let fixedWidth = 0;
  47317. fixedColumns.forEach((column) => {
  47318. fixedWidth += Number(column.realWidth || column.width);
  47319. });
  47320. this.fixedWidth.value = fixedWidth;
  47321. }
  47322. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  47323. if (rightFixedColumns.length > 0) {
  47324. let rightFixedWidth = 0;
  47325. rightFixedColumns.forEach((column) => {
  47326. rightFixedWidth += Number(column.realWidth || column.width);
  47327. });
  47328. this.rightFixedWidth.value = rightFixedWidth;
  47329. }
  47330. this.notifyObservers("columns");
  47331. }
  47332. addObserver(observer) {
  47333. this.observers.push(observer);
  47334. }
  47335. removeObserver(observer) {
  47336. const index = this.observers.indexOf(observer);
  47337. if (index !== -1) {
  47338. this.observers.splice(index, 1);
  47339. }
  47340. }
  47341. notifyObservers(event) {
  47342. const observers = this.observers;
  47343. observers.forEach((observer) => {
  47344. var _a, _b;
  47345. switch (event) {
  47346. case "columns":
  47347. (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this);
  47348. break;
  47349. case "scrollable":
  47350. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  47351. break;
  47352. default:
  47353. throw new Error(`Table Layout don't have event ${event}.`);
  47354. }
  47355. });
  47356. }
  47357. }
  47358. var TableLayout$1 = TableLayout;
  47359. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  47360. const _sfc_main$z = defineComponent({
  47361. name: "ElTableFilterPanel",
  47362. components: {
  47363. ElCheckbox,
  47364. ElCheckboxGroup,
  47365. ElScrollbar,
  47366. ElTooltip,
  47367. ElIcon,
  47368. ArrowDown: arrow_down_default,
  47369. ArrowUp: arrow_up_default
  47370. },
  47371. directives: { ClickOutside },
  47372. props: {
  47373. placement: {
  47374. type: String,
  47375. default: "bottom-start"
  47376. },
  47377. store: {
  47378. type: Object
  47379. },
  47380. column: {
  47381. type: Object
  47382. },
  47383. upDataColumn: {
  47384. type: Function
  47385. },
  47386. appendTo: useTooltipContentProps.appendTo
  47387. },
  47388. setup(props) {
  47389. const instance = getCurrentInstance();
  47390. const { t } = useLocale();
  47391. const ns = useNamespace("table-filter");
  47392. const parent = instance == null ? void 0 : instance.parent;
  47393. if (props.column && !parent.filterPanels.value[props.column.id]) {
  47394. parent.filterPanels.value[props.column.id] = instance;
  47395. }
  47396. const tooltipVisible = ref(false);
  47397. const tooltip = ref(null);
  47398. const filters = computed(() => {
  47399. return props.column && props.column.filters;
  47400. });
  47401. const filterClassName = computed(() => {
  47402. if (props.column && props.column.filterClassName) {
  47403. return `${ns.b()} ${props.column.filterClassName}`;
  47404. }
  47405. return ns.b();
  47406. });
  47407. const filterValue = computed({
  47408. get: () => {
  47409. var _a;
  47410. return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
  47411. },
  47412. set: (value) => {
  47413. if (filteredValue.value) {
  47414. if (!isPropAbsent(value)) {
  47415. filteredValue.value.splice(0, 1, value);
  47416. } else {
  47417. filteredValue.value.splice(0, 1);
  47418. }
  47419. }
  47420. }
  47421. });
  47422. const filteredValue = computed({
  47423. get() {
  47424. if (props.column) {
  47425. return props.column.filteredValue || [];
  47426. }
  47427. return [];
  47428. },
  47429. set(value) {
  47430. var _a;
  47431. if (props.column) {
  47432. (_a = props.upDataColumn) == null ? void 0 : _a.call(props, "filteredValue", value);
  47433. }
  47434. }
  47435. });
  47436. const multiple = computed(() => {
  47437. if (props.column) {
  47438. return props.column.filterMultiple;
  47439. }
  47440. return true;
  47441. });
  47442. const isActive = (filter) => {
  47443. return filter.value === filterValue.value;
  47444. };
  47445. const hidden = () => {
  47446. tooltipVisible.value = false;
  47447. };
  47448. const showFilterPanel = (e) => {
  47449. e.stopPropagation();
  47450. tooltipVisible.value = !tooltipVisible.value;
  47451. };
  47452. const hideFilterPanel = () => {
  47453. tooltipVisible.value = false;
  47454. };
  47455. const handleConfirm = () => {
  47456. confirmFilter(filteredValue.value);
  47457. hidden();
  47458. };
  47459. const handleReset = () => {
  47460. filteredValue.value = [];
  47461. confirmFilter(filteredValue.value);
  47462. hidden();
  47463. };
  47464. const handleSelect = (_filterValue) => {
  47465. filterValue.value = _filterValue;
  47466. if (!isPropAbsent(_filterValue)) {
  47467. confirmFilter(filteredValue.value);
  47468. } else {
  47469. confirmFilter([]);
  47470. }
  47471. hidden();
  47472. };
  47473. const confirmFilter = (filteredValue2) => {
  47474. var _a, _b;
  47475. (_a = props.store) == null ? void 0 : _a.commit("filterChange", {
  47476. column: props.column,
  47477. values: filteredValue2
  47478. });
  47479. (_b = props.store) == null ? void 0 : _b.updateAllSelected();
  47480. };
  47481. watch(tooltipVisible, (value) => {
  47482. var _a;
  47483. if (props.column) {
  47484. (_a = props.upDataColumn) == null ? void 0 : _a.call(props, "filterOpened", value);
  47485. }
  47486. }, {
  47487. immediate: true
  47488. });
  47489. const popperPaneRef = computed(() => {
  47490. var _a, _b;
  47491. return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  47492. });
  47493. return {
  47494. tooltipVisible,
  47495. multiple,
  47496. filterClassName,
  47497. filteredValue,
  47498. filterValue,
  47499. filters,
  47500. handleConfirm,
  47501. handleReset,
  47502. handleSelect,
  47503. isPropAbsent,
  47504. isActive,
  47505. t,
  47506. ns,
  47507. showFilterPanel,
  47508. hideFilterPanel,
  47509. popperPaneRef,
  47510. tooltip
  47511. };
  47512. }
  47513. });
  47514. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  47515. const _component_el_checkbox = resolveComponent("el-checkbox");
  47516. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  47517. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  47518. const _component_arrow_up = resolveComponent("arrow-up");
  47519. const _component_arrow_down = resolveComponent("arrow-down");
  47520. const _component_el_icon = resolveComponent("el-icon");
  47521. const _component_el_tooltip = resolveComponent("el-tooltip");
  47522. const _directive_click_outside = resolveDirective("click-outside");
  47523. return openBlock(), createBlock(_component_el_tooltip, {
  47524. ref: "tooltip",
  47525. visible: _ctx.tooltipVisible,
  47526. offset: 0,
  47527. placement: _ctx.placement,
  47528. "show-arrow": false,
  47529. "stop-popper-mouse-event": false,
  47530. teleported: "",
  47531. effect: "light",
  47532. pure: "",
  47533. "popper-class": _ctx.filterClassName,
  47534. persistent: "",
  47535. "append-to": _ctx.appendTo
  47536. }, {
  47537. content: withCtx(() => [
  47538. _ctx.multiple ? (openBlock(), createElementBlock("div", { key: 0 }, [
  47539. createElementVNode("div", {
  47540. class: normalizeClass(_ctx.ns.e("content"))
  47541. }, [
  47542. createVNode(_component_el_scrollbar, {
  47543. "wrap-class": _ctx.ns.e("wrap")
  47544. }, {
  47545. default: withCtx(() => [
  47546. createVNode(_component_el_checkbox_group, {
  47547. modelValue: _ctx.filteredValue,
  47548. "onUpdate:modelValue": ($event) => _ctx.filteredValue = $event,
  47549. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  47550. }, {
  47551. default: withCtx(() => [
  47552. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  47553. return openBlock(), createBlock(_component_el_checkbox, {
  47554. key: filter.value,
  47555. value: filter.value
  47556. }, {
  47557. default: withCtx(() => [
  47558. createTextVNode(toDisplayString(filter.text), 1)
  47559. ]),
  47560. _: 2
  47561. }, 1032, ["value"]);
  47562. }), 128))
  47563. ]),
  47564. _: 1
  47565. }, 8, ["modelValue", "onUpdate:modelValue", "class"])
  47566. ]),
  47567. _: 1
  47568. }, 8, ["wrap-class"])
  47569. ], 2),
  47570. createElementVNode("div", {
  47571. class: normalizeClass(_ctx.ns.e("bottom"))
  47572. }, [
  47573. createElementVNode("button", {
  47574. class: normalizeClass(_ctx.ns.is("disabled", _ctx.filteredValue.length === 0)),
  47575. disabled: _ctx.filteredValue.length === 0,
  47576. type: "button",
  47577. onClick: _ctx.handleConfirm
  47578. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, ["disabled", "onClick"]),
  47579. createElementVNode("button", {
  47580. type: "button",
  47581. onClick: _ctx.handleReset
  47582. }, toDisplayString(_ctx.t("el.table.resetFilter")), 9, ["onClick"])
  47583. ], 2)
  47584. ])) : (openBlock(), createElementBlock("ul", {
  47585. key: 1,
  47586. class: normalizeClass(_ctx.ns.e("list"))
  47587. }, [
  47588. createElementVNode("li", {
  47589. class: normalizeClass([
  47590. _ctx.ns.e("list-item"),
  47591. _ctx.ns.is("active", _ctx.isPropAbsent(_ctx.filterValue))
  47592. ]),
  47593. onClick: ($event) => _ctx.handleSelect(null)
  47594. }, toDisplayString(_ctx.t("el.table.clearFilter")), 11, ["onClick"]),
  47595. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  47596. return openBlock(), createElementBlock("li", {
  47597. key: filter.value,
  47598. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  47599. label: filter.value,
  47600. onClick: ($event) => _ctx.handleSelect(filter.value)
  47601. }, toDisplayString(filter.text), 11, ["label", "onClick"]);
  47602. }), 128))
  47603. ], 2))
  47604. ]),
  47605. default: withCtx(() => [
  47606. withDirectives((openBlock(), createElementBlock("span", {
  47607. class: normalizeClass([
  47608. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  47609. `${_ctx.ns.namespace.value}-none-outline`
  47610. ]),
  47611. onClick: _ctx.showFilterPanel
  47612. }, [
  47613. createVNode(_component_el_icon, null, {
  47614. default: withCtx(() => [
  47615. renderSlot(_ctx.$slots, "filter-icon", {}, () => {
  47616. var _a;
  47617. return [
  47618. ((_a = _ctx.column) == null ? void 0 : _a.filterOpened) ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))
  47619. ];
  47620. })
  47621. ]),
  47622. _: 3
  47623. })
  47624. ], 10, ["onClick"])), [
  47625. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  47626. ])
  47627. ]),
  47628. _: 3
  47629. }, 8, ["visible", "placement", "popper-class", "append-to"]);
  47630. }
  47631. var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]);
  47632. function useLayoutObserver(root) {
  47633. const instance = getCurrentInstance();
  47634. onBeforeMount(() => {
  47635. tableLayout.value.addObserver(instance);
  47636. });
  47637. onMounted(() => {
  47638. onColumnsChange(tableLayout.value);
  47639. onScrollableChange(tableLayout.value);
  47640. });
  47641. onUpdated(() => {
  47642. onColumnsChange(tableLayout.value);
  47643. onScrollableChange(tableLayout.value);
  47644. });
  47645. onUnmounted(() => {
  47646. tableLayout.value.removeObserver(instance);
  47647. });
  47648. const tableLayout = computed(() => {
  47649. const layout = root.layout;
  47650. if (!layout) {
  47651. throw new Error("Can not find table layout.");
  47652. }
  47653. return layout;
  47654. });
  47655. const onColumnsChange = (layout) => {
  47656. var _a;
  47657. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
  47658. if (!cols.length)
  47659. return;
  47660. const flattenColumns = layout.getFlattenColumns();
  47661. const columnsMap = {};
  47662. flattenColumns.forEach((column) => {
  47663. columnsMap[column.id] = column;
  47664. });
  47665. for (let i = 0, j = cols.length; i < j; i++) {
  47666. const col = cols[i];
  47667. const name = col.getAttribute("name");
  47668. const column = columnsMap[name];
  47669. if (column) {
  47670. col.setAttribute("width", column.realWidth || column.width);
  47671. }
  47672. }
  47673. };
  47674. const onScrollableChange = (layout) => {
  47675. var _a, _b;
  47676. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
  47677. for (let i = 0, j = cols.length; i < j; i++) {
  47678. const col = cols[i];
  47679. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  47680. }
  47681. const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  47682. for (let i = 0, j = ths.length; i < j; i++) {
  47683. const th = ths[i];
  47684. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  47685. th.style.display = layout.scrollY.value ? "" : "none";
  47686. }
  47687. };
  47688. return {
  47689. tableLayout: tableLayout.value,
  47690. onColumnsChange,
  47691. onScrollableChange
  47692. };
  47693. }
  47694. const TABLE_INJECTION_KEY = Symbol("ElTable");
  47695. function useEvent(props, emit) {
  47696. const instance = getCurrentInstance();
  47697. const parent = inject(TABLE_INJECTION_KEY);
  47698. const handleFilterClick = (event) => {
  47699. event.stopPropagation();
  47700. return;
  47701. };
  47702. const handleHeaderClick = (event, column) => {
  47703. if (!column.filters && column.sortable) {
  47704. handleSortClick(event, column, false);
  47705. } else if (column.filterable && !column.sortable) {
  47706. handleFilterClick(event);
  47707. }
  47708. parent == null ? void 0 : parent.emit("header-click", column, event);
  47709. };
  47710. const handleHeaderContextMenu = (event, column) => {
  47711. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  47712. };
  47713. const draggingColumn = ref(null);
  47714. const dragging = ref(false);
  47715. const dragState = ref();
  47716. const handleMouseDown = (event, column) => {
  47717. var _a, _b;
  47718. if (!isClient)
  47719. return;
  47720. if (column.children && column.children.length > 0)
  47721. return;
  47722. if (draggingColumn.value && props.border) {
  47723. dragging.value = true;
  47724. const table = parent;
  47725. emit("set-drag-visible", true);
  47726. const tableEl = table == null ? void 0 : table.vnode.el;
  47727. const tableLeft = tableEl == null ? void 0 : tableEl.getBoundingClientRect().left;
  47728. const columnEl = (_b = (_a = instance == null ? void 0 : instance.vnode) == null ? void 0 : _a.el) == null ? void 0 : _b.querySelector(`th.${column.id}`);
  47729. const columnRect = columnEl.getBoundingClientRect();
  47730. const minLeft = columnRect.left - tableLeft + 30;
  47731. addClass(columnEl, "noclick");
  47732. dragState.value = {
  47733. startMouseLeft: event.clientX,
  47734. startLeft: columnRect.right - tableLeft,
  47735. startColumnLeft: columnRect.left - tableLeft,
  47736. tableLeft
  47737. };
  47738. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  47739. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  47740. document.onselectstart = function() {
  47741. return false;
  47742. };
  47743. document.ondragstart = function() {
  47744. return false;
  47745. };
  47746. const handleMouseMove2 = (event2) => {
  47747. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  47748. const proxyLeft = dragState.value.startLeft + deltaLeft;
  47749. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  47750. };
  47751. const handleMouseUp = () => {
  47752. if (dragging.value) {
  47753. const { startColumnLeft, startLeft } = dragState.value;
  47754. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  47755. const columnWidth = finalLeft - startColumnLeft;
  47756. column.width = column.realWidth = columnWidth;
  47757. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  47758. requestAnimationFrame(() => {
  47759. props.store.scheduleLayout(false, true);
  47760. });
  47761. document.body.style.cursor = "";
  47762. dragging.value = false;
  47763. draggingColumn.value = null;
  47764. dragState.value = void 0;
  47765. emit("set-drag-visible", false);
  47766. }
  47767. document.removeEventListener("mousemove", handleMouseMove2);
  47768. document.removeEventListener("mouseup", handleMouseUp);
  47769. document.onselectstart = null;
  47770. document.ondragstart = null;
  47771. setTimeout(() => {
  47772. removeClass(columnEl, "noclick");
  47773. }, 0);
  47774. };
  47775. document.addEventListener("mousemove", handleMouseMove2);
  47776. document.addEventListener("mouseup", handleMouseUp);
  47777. }
  47778. };
  47779. const handleMouseMove = (event, column) => {
  47780. var _a;
  47781. if (column.children && column.children.length > 0)
  47782. return;
  47783. const el = event.target;
  47784. if (!isElement$2(el)) {
  47785. return;
  47786. }
  47787. const target = el == null ? void 0 : el.closest("th");
  47788. if (!column || !column.resizable || !target)
  47789. return;
  47790. if (!dragging.value && props.border) {
  47791. const rect = target.getBoundingClientRect();
  47792. const bodyStyle = document.body.style;
  47793. const isLastTh = ((_a = target.parentNode) == null ? void 0 : _a.lastElementChild) === target;
  47794. const allowDarg = props.allowDragLastColumn || !isLastTh;
  47795. if (rect.width > 12 && rect.right - event.clientX < 8 && allowDarg) {
  47796. bodyStyle.cursor = "col-resize";
  47797. if (hasClass(target, "is-sortable")) {
  47798. target.style.cursor = "col-resize";
  47799. }
  47800. draggingColumn.value = column;
  47801. } else if (!dragging.value) {
  47802. bodyStyle.cursor = "";
  47803. if (hasClass(target, "is-sortable")) {
  47804. target.style.cursor = "pointer";
  47805. }
  47806. draggingColumn.value = null;
  47807. }
  47808. }
  47809. };
  47810. const handleMouseOut = () => {
  47811. if (!isClient)
  47812. return;
  47813. document.body.style.cursor = "";
  47814. };
  47815. const toggleOrder = ({ order, sortOrders }) => {
  47816. if (order === "")
  47817. return sortOrders[0];
  47818. const index = sortOrders.indexOf(order || null);
  47819. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  47820. };
  47821. const handleSortClick = (event, column, givenOrder) => {
  47822. var _a;
  47823. event.stopPropagation();
  47824. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  47825. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  47826. if (target) {
  47827. if (hasClass(target, "noclick")) {
  47828. removeClass(target, "noclick");
  47829. return;
  47830. }
  47831. }
  47832. if (!column.sortable)
  47833. return;
  47834. const clickTarget = event.currentTarget;
  47835. if (["ascending", "descending"].some((str) => hasClass(clickTarget, str) && !column.sortOrders.includes(str))) {
  47836. return;
  47837. }
  47838. const states = props.store.states;
  47839. let sortProp = states.sortProp.value;
  47840. let sortOrder;
  47841. const sortingColumn = states.sortingColumn.value;
  47842. if (sortingColumn !== column || sortingColumn === column && isNull(sortingColumn.order)) {
  47843. if (sortingColumn) {
  47844. sortingColumn.order = null;
  47845. }
  47846. states.sortingColumn.value = column;
  47847. sortProp = column.property;
  47848. }
  47849. if (!order) {
  47850. sortOrder = column.order = null;
  47851. } else {
  47852. sortOrder = column.order = order;
  47853. }
  47854. states.sortProp.value = sortProp;
  47855. states.sortOrder.value = sortOrder;
  47856. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  47857. };
  47858. return {
  47859. handleHeaderClick,
  47860. handleHeaderContextMenu,
  47861. handleMouseDown,
  47862. handleMouseMove,
  47863. handleMouseOut,
  47864. handleSortClick,
  47865. handleFilterClick
  47866. };
  47867. }
  47868. function useStyle$2(props) {
  47869. const parent = inject(TABLE_INJECTION_KEY);
  47870. const ns = useNamespace("table");
  47871. const getHeaderRowStyle = (rowIndex) => {
  47872. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  47873. if (isFunction$1(headerRowStyle)) {
  47874. return headerRowStyle.call(null, { rowIndex });
  47875. }
  47876. return headerRowStyle;
  47877. };
  47878. const getHeaderRowClass = (rowIndex) => {
  47879. const classes = [];
  47880. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  47881. if (isString$1(headerRowClassName)) {
  47882. classes.push(headerRowClassName);
  47883. } else if (isFunction$1(headerRowClassName)) {
  47884. classes.push(headerRowClassName.call(null, { rowIndex }));
  47885. }
  47886. return classes.join(" ");
  47887. };
  47888. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  47889. var _a;
  47890. let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
  47891. if (isFunction$1(headerCellStyles)) {
  47892. headerCellStyles = headerCellStyles.call(null, {
  47893. rowIndex,
  47894. columnIndex,
  47895. row,
  47896. column
  47897. });
  47898. }
  47899. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  47900. ensurePosition(fixedStyle, "left");
  47901. ensurePosition(fixedStyle, "right");
  47902. return Object.assign({}, headerCellStyles, fixedStyle);
  47903. };
  47904. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  47905. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  47906. const classes = [
  47907. column.id,
  47908. column.order,
  47909. column.headerAlign,
  47910. column.className,
  47911. column.labelClassName,
  47912. ...fixedClasses
  47913. ];
  47914. if (!column.children) {
  47915. classes.push("is-leaf");
  47916. }
  47917. if (column.sortable) {
  47918. classes.push("is-sortable");
  47919. }
  47920. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  47921. if (isString$1(headerCellClassName)) {
  47922. classes.push(headerCellClassName);
  47923. } else if (isFunction$1(headerCellClassName)) {
  47924. classes.push(headerCellClassName.call(null, {
  47925. rowIndex,
  47926. columnIndex,
  47927. row,
  47928. column
  47929. }));
  47930. }
  47931. classes.push(ns.e("cell"));
  47932. return classes.filter((className) => Boolean(className)).join(" ");
  47933. };
  47934. return {
  47935. getHeaderRowStyle,
  47936. getHeaderRowClass,
  47937. getHeaderCellStyle,
  47938. getHeaderCellClass
  47939. };
  47940. }
  47941. const getAllColumns = (columns) => {
  47942. const result = [];
  47943. columns.forEach((column) => {
  47944. if (column.children) {
  47945. result.push(column);
  47946. result.push.apply(result, getAllColumns(column.children));
  47947. } else {
  47948. result.push(column);
  47949. }
  47950. });
  47951. return result;
  47952. };
  47953. const convertToRows = (originColumns) => {
  47954. let maxLevel = 1;
  47955. const traverse = (column, parent) => {
  47956. if (parent) {
  47957. column.level = parent.level + 1;
  47958. if (maxLevel < column.level) {
  47959. maxLevel = column.level;
  47960. }
  47961. }
  47962. if (column.children) {
  47963. let colSpan = 0;
  47964. column.children.forEach((subColumn) => {
  47965. traverse(subColumn, column);
  47966. colSpan += subColumn.colSpan;
  47967. });
  47968. column.colSpan = colSpan;
  47969. } else {
  47970. column.colSpan = 1;
  47971. }
  47972. };
  47973. originColumns.forEach((column) => {
  47974. column.level = 1;
  47975. traverse(column, void 0);
  47976. });
  47977. const rows = [];
  47978. for (let i = 0; i < maxLevel; i++) {
  47979. rows.push([]);
  47980. }
  47981. const allColumns = getAllColumns(originColumns);
  47982. allColumns.forEach((column) => {
  47983. if (!column.children) {
  47984. column.rowSpan = maxLevel - column.level + 1;
  47985. } else {
  47986. column.rowSpan = 1;
  47987. column.children.forEach((col) => col.isSubColumn = true);
  47988. }
  47989. rows[column.level - 1].push(column);
  47990. });
  47991. return rows;
  47992. };
  47993. function useUtils$1(props) {
  47994. const parent = inject(TABLE_INJECTION_KEY);
  47995. const columnRows = computed(() => {
  47996. return convertToRows(props.store.states.originColumns.value);
  47997. });
  47998. const isGroup = computed(() => {
  47999. const result = columnRows.value.length > 1;
  48000. if (result && parent) {
  48001. parent.state.isGroup.value = true;
  48002. }
  48003. return result;
  48004. });
  48005. const toggleAllSelection = (event) => {
  48006. event.stopPropagation();
  48007. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  48008. };
  48009. return {
  48010. isGroup,
  48011. toggleAllSelection,
  48012. columnRows
  48013. };
  48014. }
  48015. var TableHeader = defineComponent({
  48016. name: "ElTableHeader",
  48017. components: {
  48018. ElCheckbox
  48019. },
  48020. props: {
  48021. fixed: {
  48022. type: String,
  48023. default: ""
  48024. },
  48025. store: {
  48026. required: true,
  48027. type: Object
  48028. },
  48029. border: Boolean,
  48030. defaultSort: {
  48031. type: Object,
  48032. default: () => {
  48033. return {
  48034. prop: "",
  48035. order: ""
  48036. };
  48037. }
  48038. },
  48039. appendFilterPanelTo: {
  48040. type: String
  48041. },
  48042. allowDragLastColumn: {
  48043. type: Boolean
  48044. }
  48045. },
  48046. setup(props, { emit }) {
  48047. const instance = getCurrentInstance();
  48048. const parent = inject(TABLE_INJECTION_KEY);
  48049. const ns = useNamespace("table");
  48050. const filterPanels = ref({});
  48051. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  48052. const isTableLayoutAuto = (parent == null ? void 0 : parent.props.tableLayout) === "auto";
  48053. const saveIndexSelection = reactive(/* @__PURE__ */ new Map());
  48054. const theadRef = ref();
  48055. let delayId;
  48056. const updateFixedColumnStyle = () => {
  48057. delayId = setTimeout(() => {
  48058. if (saveIndexSelection.size > 0) {
  48059. saveIndexSelection.forEach((column, key) => {
  48060. const el = theadRef.value.querySelector(`.${key.replace(/\s/g, ".")}`);
  48061. if (el) {
  48062. const width = el.getBoundingClientRect().width;
  48063. column.width = width || column.width;
  48064. }
  48065. });
  48066. saveIndexSelection.clear();
  48067. }
  48068. });
  48069. };
  48070. watch(saveIndexSelection, updateFixedColumnStyle);
  48071. onBeforeUnmount(() => {
  48072. if (delayId) {
  48073. clearTimeout(delayId);
  48074. delayId = void 0;
  48075. }
  48076. });
  48077. onMounted(async () => {
  48078. await nextTick();
  48079. await nextTick();
  48080. const { prop, order } = props.defaultSort;
  48081. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  48082. updateFixedColumnStyle();
  48083. });
  48084. const {
  48085. handleHeaderClick,
  48086. handleHeaderContextMenu,
  48087. handleMouseDown,
  48088. handleMouseMove,
  48089. handleMouseOut,
  48090. handleSortClick,
  48091. handleFilterClick
  48092. } = useEvent(props, emit);
  48093. const {
  48094. getHeaderRowStyle,
  48095. getHeaderRowClass,
  48096. getHeaderCellStyle,
  48097. getHeaderCellClass
  48098. } = useStyle$2(props);
  48099. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  48100. instance.state = {
  48101. onColumnsChange,
  48102. onScrollableChange
  48103. };
  48104. instance.filterPanels = filterPanels;
  48105. return {
  48106. ns,
  48107. filterPanels,
  48108. onColumnsChange,
  48109. onScrollableChange,
  48110. columnRows,
  48111. getHeaderRowClass,
  48112. getHeaderRowStyle,
  48113. getHeaderCellClass,
  48114. getHeaderCellStyle,
  48115. handleHeaderClick,
  48116. handleHeaderContextMenu,
  48117. handleMouseDown,
  48118. handleMouseMove,
  48119. handleMouseOut,
  48120. handleSortClick,
  48121. handleFilterClick,
  48122. isGroup,
  48123. toggleAllSelection,
  48124. saveIndexSelection,
  48125. isTableLayoutAuto,
  48126. theadRef,
  48127. updateFixedColumnStyle
  48128. };
  48129. },
  48130. render() {
  48131. const {
  48132. ns,
  48133. isGroup,
  48134. columnRows,
  48135. getHeaderCellStyle,
  48136. getHeaderCellClass,
  48137. getHeaderRowClass,
  48138. getHeaderRowStyle,
  48139. handleHeaderClick,
  48140. handleHeaderContextMenu,
  48141. handleMouseDown,
  48142. handleMouseMove,
  48143. handleSortClick,
  48144. handleMouseOut,
  48145. store,
  48146. $parent,
  48147. saveIndexSelection,
  48148. isTableLayoutAuto
  48149. } = this;
  48150. let rowSpan = 1;
  48151. return h$1("thead", {
  48152. ref: "theadRef",
  48153. class: ns.is("group", isGroup)
  48154. }, columnRows.map((subColumns, rowIndex) => h$1("tr", {
  48155. class: getHeaderRowClass(rowIndex),
  48156. key: rowIndex,
  48157. style: getHeaderRowStyle(rowIndex)
  48158. }, subColumns.map((column, cellIndex) => {
  48159. if (column.rowSpan > rowSpan) {
  48160. rowSpan = column.rowSpan;
  48161. }
  48162. const _class = getHeaderCellClass(rowIndex, cellIndex, subColumns, column);
  48163. if (isTableLayoutAuto && column.fixed) {
  48164. saveIndexSelection.set(_class, column);
  48165. }
  48166. return h$1("th", {
  48167. class: _class,
  48168. colspan: column.colSpan,
  48169. key: `${column.id}-thead`,
  48170. rowspan: column.rowSpan,
  48171. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  48172. onClick: ($event) => {
  48173. var _a;
  48174. if ((_a = $event.currentTarget) == null ? void 0 : _a.classList.contains("noclick")) {
  48175. return;
  48176. }
  48177. handleHeaderClick($event, column);
  48178. },
  48179. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  48180. onMousedown: ($event) => handleMouseDown($event, column),
  48181. onMousemove: ($event) => handleMouseMove($event, column),
  48182. onMouseout: handleMouseOut
  48183. }, [
  48184. h$1("div", {
  48185. class: [
  48186. "cell",
  48187. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  48188. ]
  48189. }, [
  48190. column.renderHeader ? column.renderHeader({
  48191. column,
  48192. $index: cellIndex,
  48193. store,
  48194. _self: $parent
  48195. }) : column.label,
  48196. column.sortable && h$1("span", {
  48197. onClick: ($event) => handleSortClick($event, column),
  48198. class: "caret-wrapper"
  48199. }, [
  48200. h$1("i", {
  48201. onClick: ($event) => handleSortClick($event, column, "ascending"),
  48202. class: "sort-caret ascending"
  48203. }),
  48204. h$1("i", {
  48205. onClick: ($event) => handleSortClick($event, column, "descending"),
  48206. class: "sort-caret descending"
  48207. })
  48208. ]),
  48209. column.filterable && h$1(FilterPanel, {
  48210. store,
  48211. placement: column.filterPlacement || "bottom-start",
  48212. appendTo: $parent == null ? void 0 : $parent.appendFilterPanelTo,
  48213. column,
  48214. upDataColumn: (key, value) => {
  48215. column[key] = value;
  48216. }
  48217. }, {
  48218. "filter-icon": () => column.renderFilterIcon ? column.renderFilterIcon({
  48219. filterOpened: column.filterOpened
  48220. }) : null
  48221. })
  48222. ])
  48223. ]);
  48224. }))));
  48225. }
  48226. });
  48227. function isGreaterThan(a, b, epsilon = 0.03) {
  48228. return a - b > epsilon;
  48229. }
  48230. function useEvents(props) {
  48231. const parent = inject(TABLE_INJECTION_KEY);
  48232. const tooltipContent = ref("");
  48233. const tooltipTrigger = ref(h$1("div"));
  48234. const handleEvent = (event, row, name) => {
  48235. var _a, _b, _c;
  48236. const table = parent;
  48237. const cell = getCell(event);
  48238. let column = null;
  48239. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  48240. if (cell) {
  48241. column = getColumnByCell({
  48242. columns: (_c = (_b = props.store) == null ? void 0 : _b.states.columns.value) != null ? _c : []
  48243. }, cell, namespace);
  48244. if (column) {
  48245. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  48246. }
  48247. }
  48248. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  48249. };
  48250. const handleDoubleClick = (event, row) => {
  48251. handleEvent(event, row, "dblclick");
  48252. };
  48253. const handleClick = (event, row) => {
  48254. var _a;
  48255. (_a = props.store) == null ? void 0 : _a.commit("setCurrentRow", row);
  48256. handleEvent(event, row, "click");
  48257. };
  48258. const handleContextMenu = (event, row) => {
  48259. handleEvent(event, row, "contextmenu");
  48260. };
  48261. const handleMouseEnter = debounce((index) => {
  48262. var _a;
  48263. (_a = props.store) == null ? void 0 : _a.commit("setHoverRow", index);
  48264. }, 30);
  48265. const handleMouseLeave = debounce(() => {
  48266. var _a;
  48267. (_a = props.store) == null ? void 0 : _a.commit("setHoverRow", null);
  48268. }, 30);
  48269. const getPadding = (el) => {
  48270. const style = window.getComputedStyle(el, null);
  48271. const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
  48272. const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
  48273. const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
  48274. const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
  48275. return {
  48276. left: paddingLeft,
  48277. right: paddingRight,
  48278. top: paddingTop,
  48279. bottom: paddingBottom
  48280. };
  48281. };
  48282. const toggleRowClassByCell = (rowSpan, event, toggle) => {
  48283. var _a;
  48284. let node = (_a = event == null ? void 0 : event.target) == null ? void 0 : _a.parentNode;
  48285. while (rowSpan > 1) {
  48286. node = node == null ? void 0 : node.nextSibling;
  48287. if (!node || node.nodeName !== "TR")
  48288. break;
  48289. toggle(node, "hover-row hover-fixed-row");
  48290. rowSpan--;
  48291. }
  48292. };
  48293. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  48294. var _a, _b, _c, _d, _e, _f, _g, _h;
  48295. if (!parent)
  48296. return;
  48297. const table = parent;
  48298. const cell = getCell(event);
  48299. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  48300. let column = null;
  48301. if (cell) {
  48302. column = getColumnByCell({
  48303. columns: (_c = (_b = props.store) == null ? void 0 : _b.states.columns.value) != null ? _c : []
  48304. }, cell, namespace);
  48305. if (!column) {
  48306. return;
  48307. }
  48308. if (cell.rowSpan > 1) {
  48309. toggleRowClassByCell(cell.rowSpan, event, addClass);
  48310. }
  48311. const hoverState = table.hoverState = {
  48312. cell,
  48313. column,
  48314. row
  48315. };
  48316. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  48317. }
  48318. if (!tooltipOptions) {
  48319. if (((_d = removePopper) == null ? void 0 : _d.trigger) === cell) {
  48320. (_e = removePopper) == null ? void 0 : _e();
  48321. }
  48322. return;
  48323. }
  48324. const cellChild = event.target.querySelector(".cell");
  48325. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  48326. return;
  48327. }
  48328. const range = document.createRange();
  48329. range.setStart(cellChild, 0);
  48330. range.setEnd(cellChild, cellChild.childNodes.length);
  48331. const { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
  48332. const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
  48333. const { top, left, right, bottom } = getPadding(cellChild);
  48334. const horizontalPadding = left + right;
  48335. const verticalPadding = top + bottom;
  48336. if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) {
  48337. createTablePopper(tooltipOptions, (_f = (cell == null ? void 0 : cell.innerText) || (cell == null ? void 0 : cell.textContent)) != null ? _f : "", row, column, cell, table);
  48338. } else if (((_g = removePopper) == null ? void 0 : _g.trigger) === cell) {
  48339. (_h = removePopper) == null ? void 0 : _h();
  48340. }
  48341. };
  48342. const handleCellMouseLeave = (event) => {
  48343. const cell = getCell(event);
  48344. if (!cell)
  48345. return;
  48346. if (cell.rowSpan > 1) {
  48347. toggleRowClassByCell(cell.rowSpan, event, removeClass);
  48348. }
  48349. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  48350. parent == null ? void 0 : parent.emit("cell-mouse-leave", oldHoverState == null ? void 0 : oldHoverState.row, oldHoverState == null ? void 0 : oldHoverState.column, oldHoverState == null ? void 0 : oldHoverState.cell, event);
  48351. };
  48352. return {
  48353. handleDoubleClick,
  48354. handleClick,
  48355. handleContextMenu,
  48356. handleMouseEnter,
  48357. handleMouseLeave,
  48358. handleCellMouseEnter,
  48359. handleCellMouseLeave,
  48360. tooltipContent,
  48361. tooltipTrigger
  48362. };
  48363. }
  48364. function useStyles$1(props) {
  48365. const parent = inject(TABLE_INJECTION_KEY);
  48366. const ns = useNamespace("table");
  48367. const getRowStyle = (row, rowIndex) => {
  48368. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  48369. if (isFunction$1(rowStyle)) {
  48370. return rowStyle.call(null, {
  48371. row,
  48372. rowIndex
  48373. });
  48374. }
  48375. return rowStyle || null;
  48376. };
  48377. const getRowClass = (row, rowIndex, displayIndex) => {
  48378. var _a;
  48379. const classes = [ns.e("row")];
  48380. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === ((_a = props.store) == null ? void 0 : _a.states.currentRow.value)) {
  48381. classes.push("current-row");
  48382. }
  48383. if (props.stripe && displayIndex % 2 === 1) {
  48384. classes.push(ns.em("row", "striped"));
  48385. }
  48386. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  48387. if (isString$1(rowClassName)) {
  48388. classes.push(rowClassName);
  48389. } else if (isFunction$1(rowClassName)) {
  48390. classes.push(rowClassName.call(null, {
  48391. row,
  48392. rowIndex
  48393. }));
  48394. }
  48395. return classes;
  48396. };
  48397. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  48398. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  48399. let cellStyles = cellStyle != null ? cellStyle : {};
  48400. if (isFunction$1(cellStyle)) {
  48401. cellStyles = cellStyle.call(null, {
  48402. rowIndex,
  48403. columnIndex,
  48404. row,
  48405. column
  48406. });
  48407. }
  48408. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  48409. ensurePosition(fixedStyle, "left");
  48410. ensurePosition(fixedStyle, "right");
  48411. return Object.assign({}, cellStyles, fixedStyle);
  48412. };
  48413. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  48414. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  48415. const classes = [column.id, column.align, column.className, ...fixedClasses];
  48416. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  48417. if (isString$1(cellClassName)) {
  48418. classes.push(cellClassName);
  48419. } else if (isFunction$1(cellClassName)) {
  48420. classes.push(cellClassName.call(null, {
  48421. rowIndex,
  48422. columnIndex,
  48423. row,
  48424. column
  48425. }));
  48426. }
  48427. classes.push(ns.e("cell"));
  48428. return classes.filter((className) => Boolean(className)).join(" ");
  48429. };
  48430. const getSpan = (row, column, rowIndex, columnIndex) => {
  48431. let rowspan = 1;
  48432. let colspan = 1;
  48433. const fn = parent == null ? void 0 : parent.props.spanMethod;
  48434. if (isFunction$1(fn)) {
  48435. const result = fn({
  48436. row,
  48437. column,
  48438. rowIndex,
  48439. columnIndex
  48440. });
  48441. if (isArray$1(result)) {
  48442. rowspan = result[0];
  48443. colspan = result[1];
  48444. } else if (isObject$1(result)) {
  48445. rowspan = result.rowspan;
  48446. colspan = result.colspan;
  48447. }
  48448. }
  48449. return { rowspan, colspan };
  48450. };
  48451. const getColspanRealWidth = (columns, colspan, index) => {
  48452. if (colspan < 1) {
  48453. return columns[index].realWidth;
  48454. }
  48455. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  48456. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  48457. };
  48458. return {
  48459. getRowStyle,
  48460. getRowClass,
  48461. getCellStyle,
  48462. getCellClass,
  48463. getSpan,
  48464. getColspanRealWidth
  48465. };
  48466. }
  48467. const __default__$s = defineComponent({
  48468. name: "TableTdWrapper"
  48469. });
  48470. const _sfc_main$y = /* @__PURE__ */ defineComponent({
  48471. ...__default__$s,
  48472. props: {
  48473. colspan: {
  48474. type: Number,
  48475. default: 1
  48476. },
  48477. rowspan: {
  48478. type: Number,
  48479. default: 1
  48480. }
  48481. },
  48482. setup(__props) {
  48483. return (_ctx, _cache) => {
  48484. return openBlock(), createElementBlock("td", {
  48485. colspan: __props.colspan,
  48486. rowspan: __props.rowspan
  48487. }, [
  48488. renderSlot(_ctx.$slots, "default")
  48489. ], 8, ["colspan", "rowspan"]);
  48490. };
  48491. }
  48492. });
  48493. var TdWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__file", "td-wrapper.vue"]]);
  48494. function useRender$1(props) {
  48495. const parent = inject(TABLE_INJECTION_KEY);
  48496. const ns = useNamespace("table");
  48497. const {
  48498. handleDoubleClick,
  48499. handleClick,
  48500. handleContextMenu,
  48501. handleMouseEnter,
  48502. handleMouseLeave,
  48503. handleCellMouseEnter,
  48504. handleCellMouseLeave,
  48505. tooltipContent,
  48506. tooltipTrigger
  48507. } = useEvents(props);
  48508. const {
  48509. getRowStyle,
  48510. getRowClass,
  48511. getCellStyle,
  48512. getCellClass,
  48513. getSpan,
  48514. getColspanRealWidth
  48515. } = useStyles$1(props);
  48516. let displayIndex = -1;
  48517. const firstDefaultColumnIndex = computed(() => {
  48518. var _a;
  48519. return (_a = props.store) == null ? void 0 : _a.states.columns.value.findIndex(({ type }) => type === "default");
  48520. });
  48521. const getKeyOfRow = (row, index) => {
  48522. var _a;
  48523. const rowKey = (_a = parent == null ? void 0 : parent.props) == null ? void 0 : _a.rowKey;
  48524. if (rowKey) {
  48525. return getRowIdentity(row, rowKey);
  48526. }
  48527. return index;
  48528. };
  48529. const rowRender = (row, $index, treeRowData, expanded = false) => {
  48530. const { tooltipEffect, tooltipOptions, store } = props;
  48531. const { indent, columns } = store.states;
  48532. const rowClasses = [];
  48533. let display = true;
  48534. if (treeRowData) {
  48535. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  48536. display = !!treeRowData.display;
  48537. }
  48538. if ($index === 0) {
  48539. displayIndex = -1;
  48540. }
  48541. if (props.stripe && display) {
  48542. displayIndex++;
  48543. }
  48544. rowClasses.push(...getRowClass(row, $index, displayIndex));
  48545. const displayStyle = display ? null : { display: "none" };
  48546. return h$1("tr", {
  48547. style: [displayStyle, getRowStyle(row, $index)],
  48548. class: rowClasses,
  48549. key: getKeyOfRow(row, $index),
  48550. onDblclick: ($event) => handleDoubleClick($event, row),
  48551. onClick: ($event) => handleClick($event, row),
  48552. onContextmenu: ($event) => handleContextMenu($event, row),
  48553. onMouseenter: () => handleMouseEnter($index),
  48554. onMouseleave: handleMouseLeave
  48555. }, columns.value.map((column, cellIndex) => {
  48556. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  48557. if (!rowspan || !colspan) {
  48558. return null;
  48559. }
  48560. const columnData = Object.assign({}, column);
  48561. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  48562. const data = {
  48563. store,
  48564. _self: props.context || parent,
  48565. column: columnData,
  48566. row,
  48567. $index,
  48568. cellIndex,
  48569. expanded
  48570. };
  48571. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  48572. data.treeNode = {
  48573. indent: treeRowData.level && treeRowData.level * indent.value,
  48574. level: treeRowData.level
  48575. };
  48576. if (isBoolean(treeRowData.expanded)) {
  48577. data.treeNode.expanded = treeRowData.expanded;
  48578. if ("loading" in treeRowData) {
  48579. data.treeNode.loading = treeRowData.loading;
  48580. }
  48581. if ("noLazyChildren" in treeRowData) {
  48582. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  48583. }
  48584. }
  48585. }
  48586. const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`;
  48587. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  48588. const mergedTooltipOptions = column.showOverflowTooltip && merge({
  48589. effect: tooltipEffect
  48590. }, tooltipOptions, column.showOverflowTooltip);
  48591. return h$1(TdWrapper, {
  48592. style: getCellStyle($index, cellIndex, row, column),
  48593. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  48594. key: `${patchKey}${baseKey}`,
  48595. rowspan,
  48596. colspan,
  48597. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  48598. onMouseleave: handleCellMouseLeave
  48599. }, {
  48600. default: () => cellChildren(cellIndex, column, data)
  48601. });
  48602. }));
  48603. };
  48604. const cellChildren = (_cellIndex, column, data) => {
  48605. return column.renderCell(data);
  48606. };
  48607. const wrappedRowRender = (row, $index) => {
  48608. const store = props.store;
  48609. const { isRowExpanded, assertRowKey } = store;
  48610. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  48611. const columns = store.states.columns.value;
  48612. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  48613. if (hasExpandColumn) {
  48614. const expanded = isRowExpanded(row);
  48615. const tr = rowRender(row, $index, void 0, expanded);
  48616. const renderExpanded = parent == null ? void 0 : parent.renderExpanded;
  48617. if (!renderExpanded) {
  48618. console.error("[Element Error]renderExpanded is required.");
  48619. return tr;
  48620. }
  48621. const rows = [[tr]];
  48622. if (parent.props.preserveExpandedContent || expanded) {
  48623. rows[0].push(h$1("tr", {
  48624. key: `expanded-row__${tr.key}`,
  48625. style: { display: expanded ? "" : "none" }
  48626. }, [
  48627. h$1("td", {
  48628. colspan: columns.length,
  48629. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  48630. }, [renderExpanded({ row, $index, store, expanded })])
  48631. ]));
  48632. }
  48633. return rows;
  48634. } else if (Object.keys(treeData.value).length) {
  48635. assertRowKey();
  48636. const key = getRowIdentity(row, rowKey.value);
  48637. let cur = treeData.value[key];
  48638. let treeRowData = null;
  48639. if (cur) {
  48640. treeRowData = {
  48641. expanded: cur.expanded,
  48642. level: cur.level,
  48643. display: true,
  48644. noLazyChildren: void 0,
  48645. loading: void 0
  48646. };
  48647. if (isBoolean(cur.lazy)) {
  48648. if (treeRowData && isBoolean(cur.loaded) && cur.loaded) {
  48649. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  48650. }
  48651. treeRowData.loading = cur.loading;
  48652. }
  48653. }
  48654. const tmp = [rowRender(row, $index, treeRowData != null ? treeRowData : void 0)];
  48655. if (cur) {
  48656. let i = 0;
  48657. const traverse = (children, parent2) => {
  48658. if (!(children && children.length && parent2))
  48659. return;
  48660. children.forEach((node) => {
  48661. const innerTreeRowData = {
  48662. display: parent2.display && parent2.expanded,
  48663. level: parent2.level + 1,
  48664. expanded: false,
  48665. noLazyChildren: false,
  48666. loading: false
  48667. };
  48668. const childKey = getRowIdentity(node, rowKey.value);
  48669. if (isPropAbsent(childKey)) {
  48670. throw new Error("For nested data item, row-key is required.");
  48671. }
  48672. cur = { ...treeData.value[childKey] };
  48673. if (cur) {
  48674. innerTreeRowData.expanded = cur.expanded;
  48675. cur.level = cur.level || innerTreeRowData.level;
  48676. cur.display = !!(cur.expanded && innerTreeRowData.display);
  48677. if (isBoolean(cur.lazy)) {
  48678. if (isBoolean(cur.loaded) && cur.loaded) {
  48679. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  48680. }
  48681. innerTreeRowData.loading = cur.loading;
  48682. }
  48683. }
  48684. i++;
  48685. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  48686. if (cur) {
  48687. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  48688. traverse(nodes2, cur);
  48689. }
  48690. });
  48691. };
  48692. cur.display = true;
  48693. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  48694. traverse(nodes, cur);
  48695. }
  48696. return tmp;
  48697. } else {
  48698. return rowRender(row, $index, void 0);
  48699. }
  48700. };
  48701. return {
  48702. wrappedRowRender,
  48703. tooltipContent,
  48704. tooltipTrigger
  48705. };
  48706. }
  48707. const defaultProps$3 = {
  48708. store: {
  48709. required: true,
  48710. type: Object
  48711. },
  48712. stripe: Boolean,
  48713. tooltipEffect: String,
  48714. tooltipOptions: {
  48715. type: Object
  48716. },
  48717. context: {
  48718. default: () => ({}),
  48719. type: Object
  48720. },
  48721. rowClassName: [String, Function],
  48722. rowStyle: [Object, Function],
  48723. fixed: {
  48724. type: String,
  48725. default: ""
  48726. },
  48727. highlight: Boolean
  48728. };
  48729. var defaultProps$4 = defaultProps$3;
  48730. var TableBody = defineComponent({
  48731. name: "ElTableBody",
  48732. props: defaultProps$4,
  48733. setup(props) {
  48734. var _a;
  48735. const instance = getCurrentInstance();
  48736. const parent = inject(TABLE_INJECTION_KEY);
  48737. const ns = useNamespace("table");
  48738. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  48739. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  48740. const hoveredCellList = [];
  48741. watch((_a = props.store) == null ? void 0 : _a.states.hoverRow, (newVal, oldVal) => {
  48742. var _a2, _b;
  48743. const el = instance == null ? void 0 : instance.vnode.el;
  48744. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  48745. let rowNum = newVal;
  48746. const childNodes = (_a2 = rows[rowNum]) == null ? void 0 : _a2.childNodes;
  48747. if (childNodes == null ? void 0 : childNodes.length) {
  48748. let control = 0;
  48749. const indexes = Array.from(childNodes).reduce((acc, item, index) => {
  48750. var _a3, _b2;
  48751. if (((_a3 = childNodes[index]) == null ? void 0 : _a3.colSpan) > 1) {
  48752. control = (_b2 = childNodes[index]) == null ? void 0 : _b2.colSpan;
  48753. }
  48754. if (item.nodeName !== "TD" && control === 0) {
  48755. acc.push(index);
  48756. }
  48757. control > 0 && control--;
  48758. return acc;
  48759. }, []);
  48760. indexes.forEach((rowIndex) => {
  48761. var _a3;
  48762. rowNum = newVal;
  48763. while (rowNum > 0) {
  48764. const preChildNodes = (_a3 = rows[rowNum - 1]) == null ? void 0 : _a3.childNodes;
  48765. if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
  48766. addClass(preChildNodes[rowIndex], "hover-cell");
  48767. hoveredCellList.push(preChildNodes[rowIndex]);
  48768. break;
  48769. }
  48770. rowNum--;
  48771. }
  48772. });
  48773. } else {
  48774. hoveredCellList.forEach((item) => removeClass(item, "hover-cell"));
  48775. hoveredCellList.length = 0;
  48776. }
  48777. if (!((_b = props.store) == null ? void 0 : _b.states.isComplex.value) || !isClient)
  48778. return;
  48779. rAF(() => {
  48780. const oldRow = rows[oldVal];
  48781. const newRow = rows[newVal];
  48782. if (oldRow && !oldRow.classList.contains("hover-fixed-row")) {
  48783. removeClass(oldRow, "hover-row");
  48784. }
  48785. if (newRow) {
  48786. addClass(newRow, "hover-row");
  48787. }
  48788. });
  48789. });
  48790. onUnmounted(() => {
  48791. var _a2;
  48792. (_a2 = removePopper) == null ? void 0 : _a2();
  48793. });
  48794. return {
  48795. ns,
  48796. onColumnsChange,
  48797. onScrollableChange,
  48798. wrappedRowRender,
  48799. tooltipContent,
  48800. tooltipTrigger
  48801. };
  48802. },
  48803. render() {
  48804. const { wrappedRowRender, store } = this;
  48805. const data = (store == null ? void 0 : store.states.data.value) || [];
  48806. return h$1("tbody", { tabIndex: -1 }, [
  48807. data.reduce((acc, row) => {
  48808. return acc.concat(wrappedRowRender(row, acc.length));
  48809. }, [])
  48810. ]);
  48811. }
  48812. });
  48813. function useMapState() {
  48814. const table = inject(TABLE_INJECTION_KEY);
  48815. const store = table == null ? void 0 : table.store;
  48816. const leftFixedLeafCount = computed(() => {
  48817. var _a;
  48818. return (_a = store == null ? void 0 : store.states.fixedLeafColumnsLength.value) != null ? _a : 0;
  48819. });
  48820. const rightFixedLeafCount = computed(() => {
  48821. var _a;
  48822. return (_a = store == null ? void 0 : store.states.rightFixedColumns.value.length) != null ? _a : 0;
  48823. });
  48824. const columnsCount = computed(() => {
  48825. var _a;
  48826. return (_a = store == null ? void 0 : store.states.columns.value.length) != null ? _a : 0;
  48827. });
  48828. const leftFixedCount = computed(() => {
  48829. var _a;
  48830. return (_a = store == null ? void 0 : store.states.fixedColumns.value.length) != null ? _a : 0;
  48831. });
  48832. const rightFixedCount = computed(() => {
  48833. var _a;
  48834. return (_a = store == null ? void 0 : store.states.rightFixedColumns.value.length) != null ? _a : 0;
  48835. });
  48836. return {
  48837. leftFixedLeafCount,
  48838. rightFixedLeafCount,
  48839. columnsCount,
  48840. leftFixedCount,
  48841. rightFixedCount,
  48842. columns: computed(() => {
  48843. var _a;
  48844. return (_a = store == null ? void 0 : store.states.columns.value) != null ? _a : [];
  48845. })
  48846. };
  48847. }
  48848. function useStyle$1(props) {
  48849. const { columns } = useMapState();
  48850. const ns = useNamespace("table");
  48851. const getCellClasses = (columns2, cellIndex) => {
  48852. const column = columns2[cellIndex];
  48853. const classes = [
  48854. ns.e("cell"),
  48855. column.id,
  48856. column.align,
  48857. column.labelClassName,
  48858. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  48859. ];
  48860. if (column.className) {
  48861. classes.push(column.className);
  48862. }
  48863. if (!column.children) {
  48864. classes.push(ns.is("leaf"));
  48865. }
  48866. return classes;
  48867. };
  48868. const getCellStyles = (column, cellIndex) => {
  48869. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  48870. ensurePosition(fixedStyle, "left");
  48871. ensurePosition(fixedStyle, "right");
  48872. return fixedStyle;
  48873. };
  48874. return {
  48875. getCellClasses,
  48876. getCellStyles,
  48877. columns
  48878. };
  48879. }
  48880. var TableFooter = defineComponent({
  48881. name: "ElTableFooter",
  48882. props: {
  48883. fixed: {
  48884. type: String,
  48885. default: ""
  48886. },
  48887. store: {
  48888. required: true,
  48889. type: Object
  48890. },
  48891. summaryMethod: Function,
  48892. sumText: String,
  48893. border: Boolean,
  48894. defaultSort: {
  48895. type: Object,
  48896. default: () => {
  48897. return {
  48898. prop: "",
  48899. order: ""
  48900. };
  48901. }
  48902. }
  48903. },
  48904. setup(props) {
  48905. const parent = inject(TABLE_INJECTION_KEY);
  48906. const ns = useNamespace("table");
  48907. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  48908. const { onScrollableChange, onColumnsChange } = useLayoutObserver(parent);
  48909. return {
  48910. ns,
  48911. onScrollableChange,
  48912. onColumnsChange,
  48913. getCellClasses,
  48914. getCellStyles,
  48915. columns
  48916. };
  48917. },
  48918. render() {
  48919. const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  48920. const data = this.store.states.data.value;
  48921. let sums = [];
  48922. if (summaryMethod) {
  48923. sums = summaryMethod({
  48924. columns,
  48925. data
  48926. });
  48927. } else {
  48928. columns.forEach((column, index) => {
  48929. if (index === 0) {
  48930. sums[index] = sumText;
  48931. return;
  48932. }
  48933. const values = data.map((item) => Number(item[column.property]));
  48934. const precisions = [];
  48935. let notNumber = true;
  48936. values.forEach((value) => {
  48937. if (!Number.isNaN(+value)) {
  48938. notNumber = false;
  48939. const decimal = `${value}`.split(".")[1];
  48940. precisions.push(decimal ? decimal.length : 0);
  48941. }
  48942. });
  48943. const precision = Math.max.apply(null, precisions);
  48944. if (!notNumber) {
  48945. sums[index] = values.reduce((prev, curr) => {
  48946. const value = Number(curr);
  48947. if (!Number.isNaN(+value)) {
  48948. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  48949. } else {
  48950. return prev;
  48951. }
  48952. }, 0);
  48953. } else {
  48954. sums[index] = "";
  48955. }
  48956. });
  48957. }
  48958. return h$1(h$1("tfoot", [
  48959. h$1("tr", {}, [
  48960. ...columns.map((column, cellIndex) => h$1("td", {
  48961. key: cellIndex,
  48962. colspan: column.colSpan,
  48963. rowspan: column.rowSpan,
  48964. class: getCellClasses(columns, cellIndex),
  48965. style: getCellStyles(column, cellIndex)
  48966. }, [
  48967. h$1("div", {
  48968. class: ["cell", column.labelClassName]
  48969. }, [sums[cellIndex]])
  48970. ]))
  48971. ])
  48972. ]));
  48973. }
  48974. });
  48975. function useUtils(store) {
  48976. const setCurrentRow = (row) => {
  48977. store.commit("setCurrentRow", row);
  48978. };
  48979. const getSelectionRows = () => {
  48980. return store.getSelectionRows();
  48981. };
  48982. const toggleRowSelection = (row, selected, ignoreSelectable = true) => {
  48983. store.toggleRowSelection(row, selected, false, ignoreSelectable);
  48984. store.updateAllSelected();
  48985. };
  48986. const clearSelection = () => {
  48987. store.clearSelection();
  48988. };
  48989. const clearFilter = (columnKeys) => {
  48990. store.clearFilter(columnKeys);
  48991. };
  48992. const toggleAllSelection = () => {
  48993. store.commit("toggleAllSelection");
  48994. };
  48995. const toggleRowExpansion = (row, expanded) => {
  48996. store.toggleRowExpansionAdapter(row, expanded);
  48997. };
  48998. const clearSort = () => {
  48999. store.clearSort();
  49000. };
  49001. const sort = (prop, order) => {
  49002. store.commit("sort", { prop, order });
  49003. };
  49004. const updateKeyChildren = (key, data) => {
  49005. store.updateKeyChildren(key, data);
  49006. };
  49007. return {
  49008. setCurrentRow,
  49009. getSelectionRows,
  49010. toggleRowSelection,
  49011. clearSelection,
  49012. clearFilter,
  49013. toggleAllSelection,
  49014. toggleRowExpansion,
  49015. clearSort,
  49016. sort,
  49017. updateKeyChildren
  49018. };
  49019. }
  49020. function useStyle(props, layout, store, table) {
  49021. const isHidden = ref(false);
  49022. const renderExpanded = ref(null);
  49023. const resizeProxyVisible = ref(false);
  49024. const setDragVisible = (visible) => {
  49025. resizeProxyVisible.value = visible;
  49026. };
  49027. const resizeState = ref({
  49028. width: null,
  49029. height: null,
  49030. headerHeight: null
  49031. });
  49032. const isGroup = ref(false);
  49033. const scrollbarViewStyle = {
  49034. display: "inline-block",
  49035. verticalAlign: "middle"
  49036. };
  49037. const tableWidth = ref();
  49038. const tableScrollHeight = ref(0);
  49039. const bodyScrollHeight = ref(0);
  49040. const headerScrollHeight = ref(0);
  49041. const footerScrollHeight = ref(0);
  49042. const appendScrollHeight = ref(0);
  49043. watchEffect(() => {
  49044. var _a;
  49045. layout.setHeight((_a = props.height) != null ? _a : null);
  49046. });
  49047. watchEffect(() => {
  49048. var _a;
  49049. layout.setMaxHeight((_a = props.maxHeight) != null ? _a : null);
  49050. });
  49051. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  49052. if (!unref(rowKey) || !unref(currentRowKey))
  49053. return;
  49054. store.setCurrentRowKey(`${currentRowKey}`);
  49055. }, {
  49056. immediate: true
  49057. });
  49058. watch(() => props.data, (data) => {
  49059. table.store.commit("setData", data);
  49060. }, {
  49061. immediate: true,
  49062. deep: true
  49063. });
  49064. watchEffect(() => {
  49065. if (props.expandRowKeys) {
  49066. store.setExpandRowKeysAdapter(props.expandRowKeys);
  49067. }
  49068. });
  49069. const handleMouseLeave = () => {
  49070. table.store.commit("setHoverRow", null);
  49071. if (table.hoverState)
  49072. table.hoverState = null;
  49073. };
  49074. const handleHeaderFooterMousewheel = (_event, data) => {
  49075. const { pixelX, pixelY } = data;
  49076. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  49077. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  49078. }
  49079. };
  49080. const shouldUpdateHeight = computed(() => {
  49081. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  49082. });
  49083. const tableBodyStyles = computed(() => {
  49084. return {
  49085. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  49086. };
  49087. });
  49088. const doLayout = () => {
  49089. if (shouldUpdateHeight.value) {
  49090. layout.updateElsHeight();
  49091. }
  49092. layout.updateColumnsWidth();
  49093. if (typeof window === "undefined")
  49094. return;
  49095. requestAnimationFrame(syncPosition);
  49096. };
  49097. onMounted(async () => {
  49098. await nextTick();
  49099. store.updateColumns();
  49100. bindEvents();
  49101. requestAnimationFrame(doLayout);
  49102. const el = table.vnode.el;
  49103. const tableHeader = table.refs.headerWrapper;
  49104. if (props.flexible && el && el.parentElement) {
  49105. el.parentElement.style.minWidth = "0";
  49106. }
  49107. resizeState.value = {
  49108. width: tableWidth.value = el.offsetWidth,
  49109. height: el.offsetHeight,
  49110. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  49111. };
  49112. store.states.columns.value.forEach((column) => {
  49113. if (column.filteredValue && column.filteredValue.length) {
  49114. table.store.commit("filterChange", {
  49115. column,
  49116. values: column.filteredValue,
  49117. silent: true
  49118. });
  49119. }
  49120. });
  49121. table.$ready = true;
  49122. });
  49123. const setScrollClassByEl = (el, className) => {
  49124. if (!el)
  49125. return;
  49126. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  49127. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  49128. el.className = classList.join(" ");
  49129. };
  49130. const setScrollClass = (className) => {
  49131. const { tableWrapper } = table.refs;
  49132. setScrollClassByEl(tableWrapper, className);
  49133. };
  49134. const hasScrollClass = (className) => {
  49135. const { tableWrapper } = table.refs;
  49136. return !!(tableWrapper && tableWrapper.classList.contains(className));
  49137. };
  49138. const syncPosition = function() {
  49139. if (!table.refs.scrollBarRef)
  49140. return;
  49141. if (!layout.scrollX.value) {
  49142. const scrollingNoneClass = "is-scrolling-none";
  49143. if (!hasScrollClass(scrollingNoneClass)) {
  49144. setScrollClass(scrollingNoneClass);
  49145. }
  49146. return;
  49147. }
  49148. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  49149. if (!scrollContainer)
  49150. return;
  49151. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  49152. const { headerWrapper, footerWrapper } = table.refs;
  49153. if (headerWrapper)
  49154. headerWrapper.scrollLeft = scrollLeft;
  49155. if (footerWrapper)
  49156. footerWrapper.scrollLeft = scrollLeft;
  49157. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  49158. if (scrollLeft >= maxScrollLeftPosition) {
  49159. setScrollClass("is-scrolling-right");
  49160. } else if (scrollLeft === 0) {
  49161. setScrollClass("is-scrolling-left");
  49162. } else {
  49163. setScrollClass("is-scrolling-middle");
  49164. }
  49165. };
  49166. const bindEvents = () => {
  49167. if (!table.refs.scrollBarRef)
  49168. return;
  49169. if (table.refs.scrollBarRef.wrapRef) {
  49170. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  49171. passive: true
  49172. });
  49173. }
  49174. if (props.fit) {
  49175. useResizeObserver(table.vnode.el, resizeListener);
  49176. } else {
  49177. useEventListener(window, "resize", resizeListener);
  49178. }
  49179. useResizeObserver(table.refs.bodyWrapper, () => {
  49180. var _a, _b;
  49181. resizeListener();
  49182. (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update();
  49183. });
  49184. };
  49185. const resizeListener = () => {
  49186. var _a, _b, _c, _d;
  49187. const el = table.vnode.el;
  49188. if (!table.$ready || !el)
  49189. return;
  49190. let shouldUpdateLayout = false;
  49191. const {
  49192. width: oldWidth,
  49193. height: oldHeight,
  49194. headerHeight: oldHeaderHeight
  49195. } = resizeState.value;
  49196. const width = tableWidth.value = el.offsetWidth;
  49197. if (oldWidth !== width) {
  49198. shouldUpdateLayout = true;
  49199. }
  49200. const height = el.offsetHeight;
  49201. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  49202. shouldUpdateLayout = true;
  49203. }
  49204. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
  49205. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  49206. shouldUpdateLayout = true;
  49207. }
  49208. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  49209. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  49210. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  49211. appendScrollHeight.value = ((_d = table.refs.appendWrapper) == null ? void 0 : _d.offsetHeight) || 0;
  49212. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  49213. if (shouldUpdateLayout) {
  49214. resizeState.value = {
  49215. width,
  49216. height,
  49217. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  49218. };
  49219. doLayout();
  49220. }
  49221. };
  49222. const tableSize = useFormSize();
  49223. const bodyWidth = computed(() => {
  49224. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  49225. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  49226. });
  49227. const tableLayout = computed(() => {
  49228. if (props.maxHeight)
  49229. return "fixed";
  49230. return props.tableLayout;
  49231. });
  49232. const emptyBlockStyle = computed(() => {
  49233. if (props.data && props.data.length)
  49234. return;
  49235. let height = "100%";
  49236. if (props.height && bodyScrollHeight.value) {
  49237. height = `${bodyScrollHeight.value}px`;
  49238. }
  49239. const width = tableWidth.value;
  49240. return {
  49241. width: width ? `${width}px` : "",
  49242. height
  49243. };
  49244. });
  49245. const scrollbarStyle = computed(() => {
  49246. if (props.height) {
  49247. return {
  49248. height: "100%"
  49249. };
  49250. }
  49251. if (props.maxHeight) {
  49252. if (!Number.isNaN(Number(props.maxHeight))) {
  49253. return {
  49254. maxHeight: `${+props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px`
  49255. };
  49256. } else {
  49257. return {
  49258. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  49259. };
  49260. }
  49261. }
  49262. return {};
  49263. });
  49264. return {
  49265. isHidden,
  49266. renderExpanded,
  49267. setDragVisible,
  49268. isGroup,
  49269. handleMouseLeave,
  49270. handleHeaderFooterMousewheel,
  49271. tableSize,
  49272. emptyBlockStyle,
  49273. resizeProxyVisible,
  49274. bodyWidth,
  49275. resizeState,
  49276. doLayout,
  49277. tableBodyStyles,
  49278. tableLayout,
  49279. scrollbarViewStyle,
  49280. scrollbarStyle
  49281. };
  49282. }
  49283. function useKeyRender(table) {
  49284. const observer = ref();
  49285. const initWatchDom = () => {
  49286. const el = table.vnode.el;
  49287. const columnsWrapper = el.querySelector(".hidden-columns");
  49288. const config = { childList: true, subtree: true };
  49289. const updateOrderFns = table.store.states.updateOrderFns;
  49290. observer.value = new MutationObserver(() => {
  49291. updateOrderFns.forEach((fn) => fn());
  49292. });
  49293. observer.value.observe(columnsWrapper, config);
  49294. };
  49295. onMounted(() => {
  49296. initWatchDom();
  49297. });
  49298. onUnmounted(() => {
  49299. var _a;
  49300. (_a = observer.value) == null ? void 0 : _a.disconnect();
  49301. });
  49302. }
  49303. var defaultProps$2 = {
  49304. data: {
  49305. type: Array,
  49306. default: () => []
  49307. },
  49308. size: useSizeProp,
  49309. width: [String, Number],
  49310. height: [String, Number],
  49311. maxHeight: [String, Number],
  49312. fit: {
  49313. type: Boolean,
  49314. default: true
  49315. },
  49316. stripe: Boolean,
  49317. border: Boolean,
  49318. rowKey: [String, Function],
  49319. showHeader: {
  49320. type: Boolean,
  49321. default: true
  49322. },
  49323. showSummary: Boolean,
  49324. sumText: String,
  49325. summaryMethod: Function,
  49326. rowClassName: [String, Function],
  49327. rowStyle: [Object, Function],
  49328. cellClassName: [String, Function],
  49329. cellStyle: [Object, Function],
  49330. headerRowClassName: [String, Function],
  49331. headerRowStyle: [Object, Function],
  49332. headerCellClassName: [String, Function],
  49333. headerCellStyle: [Object, Function],
  49334. highlightCurrentRow: Boolean,
  49335. currentRowKey: [String, Number],
  49336. emptyText: String,
  49337. expandRowKeys: Array,
  49338. defaultExpandAll: Boolean,
  49339. defaultSort: Object,
  49340. tooltipEffect: String,
  49341. tooltipOptions: Object,
  49342. spanMethod: Function,
  49343. selectOnIndeterminate: {
  49344. type: Boolean,
  49345. default: true
  49346. },
  49347. indent: {
  49348. type: Number,
  49349. default: 16
  49350. },
  49351. treeProps: {
  49352. type: Object,
  49353. default: () => {
  49354. return {
  49355. hasChildren: "hasChildren",
  49356. children: "children",
  49357. checkStrictly: false
  49358. };
  49359. }
  49360. },
  49361. lazy: Boolean,
  49362. load: Function,
  49363. style: {
  49364. type: Object,
  49365. default: () => ({})
  49366. },
  49367. className: {
  49368. type: String,
  49369. default: ""
  49370. },
  49371. tableLayout: {
  49372. type: String,
  49373. default: "fixed"
  49374. },
  49375. scrollbarAlwaysOn: Boolean,
  49376. flexible: Boolean,
  49377. showOverflowTooltip: [Boolean, Object],
  49378. tooltipFormatter: Function,
  49379. appendFilterPanelTo: String,
  49380. scrollbarTabindex: {
  49381. type: [Number, String],
  49382. default: void 0
  49383. },
  49384. allowDragLastColumn: {
  49385. type: Boolean,
  49386. default: true
  49387. },
  49388. preserveExpandedContent: Boolean,
  49389. nativeScrollbar: Boolean
  49390. };
  49391. function hColgroup(props) {
  49392. const isAuto = props.tableLayout === "auto";
  49393. let columns = props.columns || [];
  49394. if (isAuto) {
  49395. if (columns.every(({ width }) => isUndefined(width))) {
  49396. columns = [];
  49397. }
  49398. }
  49399. const getPropsData = (column) => {
  49400. const propsData = {
  49401. key: `${props.tableLayout}_${column.id}`,
  49402. style: {},
  49403. name: void 0
  49404. };
  49405. if (isAuto) {
  49406. propsData.style = {
  49407. width: `${column.width}px`
  49408. };
  49409. } else {
  49410. propsData.name = column.id;
  49411. }
  49412. return propsData;
  49413. };
  49414. return h$1("colgroup", {}, columns.map((column) => h$1("col", getPropsData(column))));
  49415. }
  49416. hColgroup.props = ["columns", "tableLayout"];
  49417. const useScrollbar$1 = () => {
  49418. const scrollBarRef = ref();
  49419. const scrollTo = (options, yCoord) => {
  49420. const scrollbar = scrollBarRef.value;
  49421. if (scrollbar) {
  49422. scrollbar.scrollTo(options, yCoord);
  49423. }
  49424. };
  49425. const setScrollPosition = (position, offset) => {
  49426. const scrollbar = scrollBarRef.value;
  49427. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) {
  49428. scrollbar[`setScroll${position}`](offset);
  49429. }
  49430. };
  49431. const setScrollTop = (top) => setScrollPosition("Top", top);
  49432. const setScrollLeft = (left) => setScrollPosition("Left", left);
  49433. return {
  49434. scrollBarRef,
  49435. scrollTo,
  49436. setScrollTop,
  49437. setScrollLeft
  49438. };
  49439. };
  49440. let tableIdSeed = 1;
  49441. const _sfc_main$x = defineComponent({
  49442. name: "ElTable",
  49443. directives: {
  49444. Mousewheel
  49445. },
  49446. components: {
  49447. TableHeader,
  49448. TableBody,
  49449. TableFooter,
  49450. ElScrollbar,
  49451. hColgroup
  49452. },
  49453. props: defaultProps$2,
  49454. emits: [
  49455. "select",
  49456. "select-all",
  49457. "selection-change",
  49458. "cell-mouse-enter",
  49459. "cell-mouse-leave",
  49460. "cell-contextmenu",
  49461. "cell-click",
  49462. "cell-dblclick",
  49463. "row-click",
  49464. "row-contextmenu",
  49465. "row-dblclick",
  49466. "header-click",
  49467. "header-contextmenu",
  49468. "sort-change",
  49469. "filter-change",
  49470. "current-change",
  49471. "header-dragend",
  49472. "expand-change",
  49473. "scroll"
  49474. ],
  49475. setup(props) {
  49476. const { t } = useLocale();
  49477. const ns = useNamespace("table");
  49478. const table = getCurrentInstance();
  49479. provide(TABLE_INJECTION_KEY, table);
  49480. const store = createStore(table, props);
  49481. table.store = store;
  49482. const layout = new TableLayout$1({
  49483. store: table.store,
  49484. table,
  49485. fit: props.fit,
  49486. showHeader: props.showHeader
  49487. });
  49488. table.layout = layout;
  49489. const isEmpty = computed(() => (store.states.data.value || []).length === 0);
  49490. const {
  49491. setCurrentRow,
  49492. getSelectionRows,
  49493. toggleRowSelection,
  49494. clearSelection,
  49495. clearFilter,
  49496. toggleAllSelection,
  49497. toggleRowExpansion,
  49498. clearSort,
  49499. sort,
  49500. updateKeyChildren
  49501. } = useUtils(store);
  49502. const {
  49503. isHidden,
  49504. renderExpanded,
  49505. setDragVisible,
  49506. isGroup,
  49507. handleMouseLeave,
  49508. handleHeaderFooterMousewheel,
  49509. tableSize,
  49510. emptyBlockStyle,
  49511. resizeProxyVisible,
  49512. bodyWidth,
  49513. resizeState,
  49514. doLayout,
  49515. tableBodyStyles,
  49516. tableLayout,
  49517. scrollbarViewStyle,
  49518. scrollbarStyle
  49519. } = useStyle(props, layout, store, table);
  49520. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  49521. const debouncedUpdateLayout = debounce(doLayout, 50);
  49522. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  49523. table.tableId = tableId;
  49524. table.state = {
  49525. isGroup,
  49526. resizeState,
  49527. doLayout,
  49528. debouncedUpdateLayout
  49529. };
  49530. const computedSumText = computed(() => {
  49531. var _a;
  49532. return (_a = props.sumText) != null ? _a : t("el.table.sumText");
  49533. });
  49534. const computedEmptyText = computed(() => {
  49535. var _a;
  49536. return (_a = props.emptyText) != null ? _a : t("el.table.emptyText");
  49537. });
  49538. const columns = computed(() => {
  49539. return convertToRows(store.states.originColumns.value)[0];
  49540. });
  49541. useKeyRender(table);
  49542. onBeforeUnmount(() => {
  49543. debouncedUpdateLayout.cancel();
  49544. });
  49545. return {
  49546. ns,
  49547. layout,
  49548. store,
  49549. columns,
  49550. handleHeaderFooterMousewheel,
  49551. handleMouseLeave,
  49552. tableId,
  49553. tableSize,
  49554. isHidden,
  49555. isEmpty,
  49556. renderExpanded,
  49557. resizeProxyVisible,
  49558. resizeState,
  49559. isGroup,
  49560. bodyWidth,
  49561. tableBodyStyles,
  49562. emptyBlockStyle,
  49563. debouncedUpdateLayout,
  49564. setCurrentRow,
  49565. getSelectionRows,
  49566. toggleRowSelection,
  49567. clearSelection,
  49568. clearFilter,
  49569. toggleAllSelection,
  49570. toggleRowExpansion,
  49571. clearSort,
  49572. doLayout,
  49573. sort,
  49574. updateKeyChildren,
  49575. t,
  49576. setDragVisible,
  49577. context: table,
  49578. computedSumText,
  49579. computedEmptyText,
  49580. tableLayout,
  49581. scrollbarViewStyle,
  49582. scrollbarStyle,
  49583. scrollBarRef,
  49584. scrollTo,
  49585. setScrollLeft,
  49586. setScrollTop,
  49587. allowDragLastColumn: props.allowDragLastColumn
  49588. };
  49589. }
  49590. });
  49591. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  49592. const _component_hColgroup = resolveComponent("hColgroup");
  49593. const _component_table_header = resolveComponent("table-header");
  49594. const _component_table_body = resolveComponent("table-body");
  49595. const _component_table_footer = resolveComponent("table-footer");
  49596. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  49597. const _directive_mousewheel = resolveDirective("mousewheel");
  49598. return openBlock(), createElementBlock("div", {
  49599. ref: "tableWrapper",
  49600. class: normalizeClass([
  49601. {
  49602. [_ctx.ns.m("fit")]: _ctx.fit,
  49603. [_ctx.ns.m("striped")]: _ctx.stripe,
  49604. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  49605. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  49606. [_ctx.ns.m("group")]: _ctx.isGroup,
  49607. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  49608. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  49609. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  49610. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  49611. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  49612. "has-footer": _ctx.showSummary
  49613. },
  49614. _ctx.ns.m(_ctx.tableSize),
  49615. _ctx.className,
  49616. _ctx.ns.b(),
  49617. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  49618. ]),
  49619. style: normalizeStyle(_ctx.style),
  49620. "data-prefix": _ctx.ns.namespace.value,
  49621. onMouseleave: _ctx.handleMouseLeave
  49622. }, [
  49623. createElementVNode("div", {
  49624. class: normalizeClass(_ctx.ns.e("inner-wrapper"))
  49625. }, [
  49626. createElementVNode("div", {
  49627. ref: "hiddenColumns",
  49628. class: "hidden-columns"
  49629. }, [
  49630. renderSlot(_ctx.$slots, "default")
  49631. ], 512),
  49632. _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  49633. key: 0,
  49634. ref: "headerWrapper",
  49635. class: normalizeClass(_ctx.ns.e("header-wrapper"))
  49636. }, [
  49637. createElementVNode("table", {
  49638. ref: "tableHeader",
  49639. class: normalizeClass(_ctx.ns.e("header")),
  49640. style: normalizeStyle(_ctx.tableBodyStyles),
  49641. border: "0",
  49642. cellpadding: "0",
  49643. cellspacing: "0"
  49644. }, [
  49645. createVNode(_component_hColgroup, {
  49646. columns: _ctx.store.states.columns.value,
  49647. "table-layout": _ctx.tableLayout
  49648. }, null, 8, ["columns", "table-layout"]),
  49649. createVNode(_component_table_header, {
  49650. ref: "tableHeaderRef",
  49651. border: _ctx.border,
  49652. "default-sort": _ctx.defaultSort,
  49653. store: _ctx.store,
  49654. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  49655. "allow-drag-last-column": _ctx.allowDragLastColumn,
  49656. onSetDragVisible: _ctx.setDragVisible
  49657. }, null, 8, ["border", "default-sort", "store", "append-filter-panel-to", "allow-drag-last-column", "onSetDragVisible"])
  49658. ], 6)
  49659. ], 2)), [
  49660. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  49661. ]) : createCommentVNode("v-if", true),
  49662. createElementVNode("div", {
  49663. ref: "bodyWrapper",
  49664. class: normalizeClass(_ctx.ns.e("body-wrapper"))
  49665. }, [
  49666. createVNode(_component_el_scrollbar, {
  49667. ref: "scrollBarRef",
  49668. "view-style": _ctx.scrollbarViewStyle,
  49669. "wrap-style": _ctx.scrollbarStyle,
  49670. always: _ctx.scrollbarAlwaysOn,
  49671. tabindex: _ctx.scrollbarTabindex,
  49672. native: _ctx.nativeScrollbar,
  49673. onScroll: ($event) => _ctx.$emit("scroll", $event)
  49674. }, {
  49675. default: withCtx(() => [
  49676. createElementVNode("table", {
  49677. ref: "tableBody",
  49678. class: normalizeClass(_ctx.ns.e("body")),
  49679. cellspacing: "0",
  49680. cellpadding: "0",
  49681. border: "0",
  49682. style: normalizeStyle({
  49683. width: _ctx.bodyWidth,
  49684. tableLayout: _ctx.tableLayout
  49685. })
  49686. }, [
  49687. createVNode(_component_hColgroup, {
  49688. columns: _ctx.store.states.columns.value,
  49689. "table-layout": _ctx.tableLayout
  49690. }, null, 8, ["columns", "table-layout"]),
  49691. _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
  49692. key: 0,
  49693. ref: "tableHeaderRef",
  49694. class: normalizeClass(_ctx.ns.e("body-header")),
  49695. border: _ctx.border,
  49696. "default-sort": _ctx.defaultSort,
  49697. store: _ctx.store,
  49698. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  49699. onSetDragVisible: _ctx.setDragVisible
  49700. }, null, 8, ["class", "border", "default-sort", "store", "append-filter-panel-to", "onSetDragVisible"])) : createCommentVNode("v-if", true),
  49701. createVNode(_component_table_body, {
  49702. context: _ctx.context,
  49703. highlight: _ctx.highlightCurrentRow,
  49704. "row-class-name": _ctx.rowClassName,
  49705. "tooltip-effect": _ctx.tooltipEffect,
  49706. "tooltip-options": _ctx.tooltipOptions,
  49707. "row-style": _ctx.rowStyle,
  49708. store: _ctx.store,
  49709. stripe: _ctx.stripe
  49710. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"]),
  49711. _ctx.showSummary && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_footer, {
  49712. key: 1,
  49713. class: normalizeClass(_ctx.ns.e("body-footer")),
  49714. border: _ctx.border,
  49715. "default-sort": _ctx.defaultSort,
  49716. store: _ctx.store,
  49717. "sum-text": _ctx.computedSumText,
  49718. "summary-method": _ctx.summaryMethod
  49719. }, null, 8, ["class", "border", "default-sort", "store", "sum-text", "summary-method"])) : createCommentVNode("v-if", true)
  49720. ], 6),
  49721. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  49722. key: 0,
  49723. ref: "emptyBlock",
  49724. style: normalizeStyle(_ctx.emptyBlockStyle),
  49725. class: normalizeClass(_ctx.ns.e("empty-block"))
  49726. }, [
  49727. createElementVNode("span", {
  49728. class: normalizeClass(_ctx.ns.e("empty-text"))
  49729. }, [
  49730. renderSlot(_ctx.$slots, "empty", {}, () => [
  49731. createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)
  49732. ])
  49733. ], 2)
  49734. ], 6)) : createCommentVNode("v-if", true),
  49735. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  49736. key: 1,
  49737. ref: "appendWrapper",
  49738. class: normalizeClass(_ctx.ns.e("append-wrapper"))
  49739. }, [
  49740. renderSlot(_ctx.$slots, "append")
  49741. ], 2)) : createCommentVNode("v-if", true)
  49742. ]),
  49743. _: 3
  49744. }, 8, ["view-style", "wrap-style", "always", "tabindex", "native", "onScroll"])
  49745. ], 2),
  49746. _ctx.showSummary && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  49747. key: 1,
  49748. ref: "footerWrapper",
  49749. class: normalizeClass(_ctx.ns.e("footer-wrapper"))
  49750. }, [
  49751. createElementVNode("table", {
  49752. class: normalizeClass(_ctx.ns.e("footer")),
  49753. cellspacing: "0",
  49754. cellpadding: "0",
  49755. border: "0",
  49756. style: normalizeStyle(_ctx.tableBodyStyles)
  49757. }, [
  49758. createVNode(_component_hColgroup, {
  49759. columns: _ctx.store.states.columns.value,
  49760. "table-layout": _ctx.tableLayout
  49761. }, null, 8, ["columns", "table-layout"]),
  49762. createVNode(_component_table_footer, {
  49763. border: _ctx.border,
  49764. "default-sort": _ctx.defaultSort,
  49765. store: _ctx.store,
  49766. "sum-text": _ctx.computedSumText,
  49767. "summary-method": _ctx.summaryMethod
  49768. }, null, 8, ["border", "default-sort", "store", "sum-text", "summary-method"])
  49769. ], 6)
  49770. ], 2)), [
  49771. [vShow, !_ctx.isEmpty],
  49772. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  49773. ]) : createCommentVNode("v-if", true),
  49774. _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
  49775. key: 2,
  49776. class: normalizeClass(_ctx.ns.e("border-left-patch"))
  49777. }, null, 2)) : createCommentVNode("v-if", true)
  49778. ], 2),
  49779. withDirectives(createElementVNode("div", {
  49780. ref: "resizeProxy",
  49781. class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
  49782. }, null, 2), [
  49783. [vShow, _ctx.resizeProxyVisible]
  49784. ])
  49785. ], 46, ["data-prefix", "onMouseleave"]);
  49786. }
  49787. var Table = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render$3], ["__file", "table.vue"]]);
  49788. const defaultClassNames = {
  49789. selection: "table-column--selection",
  49790. expand: "table__expand-column"
  49791. };
  49792. const cellStarts = {
  49793. default: {
  49794. order: ""
  49795. },
  49796. selection: {
  49797. width: 48,
  49798. minWidth: 48,
  49799. realWidth: 48,
  49800. order: ""
  49801. },
  49802. expand: {
  49803. width: 48,
  49804. minWidth: 48,
  49805. realWidth: 48,
  49806. order: ""
  49807. },
  49808. index: {
  49809. width: 48,
  49810. minWidth: 48,
  49811. realWidth: 48,
  49812. order: ""
  49813. }
  49814. };
  49815. const getDefaultClassName = (type) => {
  49816. return defaultClassNames[type] || "";
  49817. };
  49818. const cellForced = {
  49819. selection: {
  49820. renderHeader({
  49821. store,
  49822. column
  49823. }) {
  49824. var _a;
  49825. function isDisabled() {
  49826. return store.states.data.value && store.states.data.value.length === 0;
  49827. }
  49828. return h$1(ElCheckbox, {
  49829. disabled: isDisabled(),
  49830. size: store.states.tableSize.value,
  49831. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  49832. "onUpdate:modelValue": (_a = store.toggleAllSelection) != null ? _a : void 0,
  49833. modelValue: store.states.isAllSelected.value,
  49834. ariaLabel: column.label
  49835. });
  49836. },
  49837. renderCell({
  49838. row,
  49839. column,
  49840. store,
  49841. $index
  49842. }) {
  49843. return h$1(ElCheckbox, {
  49844. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  49845. size: store.states.tableSize.value,
  49846. onChange: () => {
  49847. store.commit("rowSelectedChanged", row);
  49848. },
  49849. onClick: (event) => event.stopPropagation(),
  49850. modelValue: store.isSelected(row),
  49851. ariaLabel: column.label
  49852. });
  49853. },
  49854. sortable: false,
  49855. resizable: false
  49856. },
  49857. index: {
  49858. renderHeader({
  49859. column
  49860. }) {
  49861. return column.label || "#";
  49862. },
  49863. renderCell({
  49864. column,
  49865. $index
  49866. }) {
  49867. let i = $index + 1;
  49868. const index = column.index;
  49869. if (isNumber(index)) {
  49870. i = $index + index;
  49871. } else if (isFunction$1(index)) {
  49872. i = index($index);
  49873. }
  49874. return h$1("div", {}, [i]);
  49875. },
  49876. sortable: false
  49877. },
  49878. expand: {
  49879. renderHeader({
  49880. column
  49881. }) {
  49882. return column.label || "";
  49883. },
  49884. renderCell({
  49885. column,
  49886. row,
  49887. store,
  49888. expanded
  49889. }) {
  49890. const { ns } = store;
  49891. const classes = [ns.e("expand-icon")];
  49892. if (!column.renderExpand && expanded) {
  49893. classes.push(ns.em("expand-icon", "expanded"));
  49894. }
  49895. const callback = function(e) {
  49896. e.stopPropagation();
  49897. store.toggleRowExpansion(row);
  49898. };
  49899. return h$1("div", {
  49900. class: classes,
  49901. onClick: callback
  49902. }, {
  49903. default: () => {
  49904. if (column.renderExpand) {
  49905. return [
  49906. column.renderExpand({
  49907. expanded
  49908. })
  49909. ];
  49910. }
  49911. return [
  49912. h$1(ElIcon, null, {
  49913. default: () => {
  49914. return [h$1(arrow_right_default)];
  49915. }
  49916. })
  49917. ];
  49918. }
  49919. });
  49920. },
  49921. sortable: false,
  49922. resizable: false
  49923. }
  49924. };
  49925. function defaultRenderCell({
  49926. row,
  49927. column,
  49928. $index
  49929. }) {
  49930. var _a;
  49931. const property = column.property;
  49932. const value = property && getProp(row, property).value;
  49933. if (column && column.formatter) {
  49934. return column.formatter(row, column, value, $index);
  49935. }
  49936. return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
  49937. }
  49938. function treeCellPrefix({
  49939. row,
  49940. treeNode,
  49941. store
  49942. }, createPlaceholder = false) {
  49943. const { ns } = store;
  49944. if (!treeNode) {
  49945. if (createPlaceholder) {
  49946. return [
  49947. h$1("span", {
  49948. class: ns.e("placeholder")
  49949. })
  49950. ];
  49951. }
  49952. return null;
  49953. }
  49954. const ele = [];
  49955. const callback = function(e) {
  49956. e.stopPropagation();
  49957. if (treeNode.loading) {
  49958. return;
  49959. }
  49960. store.loadOrToggle(row);
  49961. };
  49962. if (treeNode.indent) {
  49963. ele.push(h$1("span", {
  49964. class: ns.e("indent"),
  49965. style: { "padding-left": `${treeNode.indent}px` }
  49966. }));
  49967. }
  49968. if (isBoolean(treeNode.expanded) && !treeNode.noLazyChildren) {
  49969. const expandClasses = [
  49970. ns.e("expand-icon"),
  49971. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  49972. ];
  49973. let icon = arrow_right_default;
  49974. if (treeNode.loading) {
  49975. icon = loading_default;
  49976. }
  49977. ele.push(h$1("div", {
  49978. class: expandClasses,
  49979. onClick: callback
  49980. }, {
  49981. default: () => {
  49982. return [
  49983. h$1(ElIcon, { class: ns.is("loading", treeNode.loading) }, {
  49984. default: () => [h$1(icon)]
  49985. })
  49986. ];
  49987. }
  49988. }));
  49989. } else {
  49990. ele.push(h$1("span", {
  49991. class: ns.e("placeholder")
  49992. }));
  49993. }
  49994. return ele;
  49995. }
  49996. function getAllAliases(props, aliases) {
  49997. return props.reduce((prev, cur) => {
  49998. prev[cur] = cur;
  49999. return prev;
  50000. }, aliases);
  50001. }
  50002. function useWatcher(owner, props_) {
  50003. const instance = getCurrentInstance();
  50004. const registerComplexWatchers = () => {
  50005. const props = ["fixed"];
  50006. const aliases = {
  50007. realWidth: "width",
  50008. realMinWidth: "minWidth"
  50009. };
  50010. const allAliases = getAllAliases(props, aliases);
  50011. Object.keys(allAliases).forEach((key) => {
  50012. const columnKey = aliases[key];
  50013. if (hasOwn(props_, columnKey)) {
  50014. watch(() => props_[columnKey], (newVal) => {
  50015. let value = newVal;
  50016. if (columnKey === "width" && key === "realWidth") {
  50017. value = parseWidth(newVal);
  50018. }
  50019. if (columnKey === "minWidth" && key === "realMinWidth") {
  50020. value = parseMinWidth(newVal);
  50021. }
  50022. instance.columnConfig.value[columnKey] = value;
  50023. instance.columnConfig.value[key] = value;
  50024. const updateColumns = columnKey === "fixed";
  50025. owner.value.store.scheduleLayout(updateColumns);
  50026. });
  50027. }
  50028. });
  50029. };
  50030. const registerNormalWatchers = () => {
  50031. const props = [
  50032. "label",
  50033. "filters",
  50034. "filterMultiple",
  50035. "filteredValue",
  50036. "sortable",
  50037. "index",
  50038. "formatter",
  50039. "className",
  50040. "labelClassName",
  50041. "filterClassName",
  50042. "showOverflowTooltip",
  50043. "tooltipFormatter",
  50044. "resizable"
  50045. ];
  50046. const parentProps = ["showOverflowTooltip"];
  50047. const aliases = {
  50048. property: "prop",
  50049. align: "realAlign",
  50050. headerAlign: "realHeaderAlign"
  50051. };
  50052. const allAliases = getAllAliases(props, aliases);
  50053. Object.keys(allAliases).forEach((key) => {
  50054. const columnKey = aliases[key];
  50055. if (hasOwn(props_, columnKey)) {
  50056. watch(() => props_[columnKey], (newVal) => {
  50057. instance.columnConfig.value[key] = newVal;
  50058. });
  50059. }
  50060. });
  50061. parentProps.forEach((key) => {
  50062. if (hasOwn(owner.value.props, key)) {
  50063. watch(() => owner.value.props[key], (newVal) => {
  50064. instance.columnConfig.value[key] = newVal;
  50065. });
  50066. }
  50067. });
  50068. };
  50069. return {
  50070. registerComplexWatchers,
  50071. registerNormalWatchers
  50072. };
  50073. }
  50074. function useRender(props, slots, owner) {
  50075. const instance = getCurrentInstance();
  50076. const columnId = ref("");
  50077. const isSubColumn = ref(false);
  50078. const realAlign = ref();
  50079. const realHeaderAlign = ref();
  50080. const ns = useNamespace("table");
  50081. watchEffect(() => {
  50082. realAlign.value = props.align ? `is-${props.align}` : null;
  50083. realAlign.value;
  50084. });
  50085. watchEffect(() => {
  50086. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  50087. realHeaderAlign.value;
  50088. });
  50089. const columnOrTableParent = computed(() => {
  50090. let parent = instance.vnode.vParent || instance.parent;
  50091. while (parent && !parent.tableId && !parent.columnId) {
  50092. parent = parent.vnode.vParent || parent.parent;
  50093. }
  50094. return parent;
  50095. });
  50096. const hasTreeColumn = computed(() => {
  50097. const { store } = instance.parent;
  50098. if (!store)
  50099. return false;
  50100. const { treeData } = store.states;
  50101. const treeDataValue = treeData.value;
  50102. return treeDataValue && Object.keys(treeDataValue).length > 0;
  50103. });
  50104. const realWidth = ref(parseWidth(props.width));
  50105. const realMinWidth = ref(parseMinWidth(props.minWidth));
  50106. const setColumnWidth = (column) => {
  50107. if (realWidth.value)
  50108. column.width = realWidth.value;
  50109. if (realMinWidth.value) {
  50110. column.minWidth = realMinWidth.value;
  50111. }
  50112. if (!realWidth.value && realMinWidth.value) {
  50113. column.width = void 0;
  50114. }
  50115. if (!column.minWidth) {
  50116. column.minWidth = 80;
  50117. }
  50118. column.realWidth = Number(isUndefined(column.width) ? column.minWidth : column.width);
  50119. return column;
  50120. };
  50121. const setColumnForcedProps = (column) => {
  50122. const type = column.type;
  50123. const source = cellForced[type] || {};
  50124. Object.keys(source).forEach((prop) => {
  50125. const value = source[prop];
  50126. if (prop !== "className" && !isUndefined(value)) {
  50127. column[prop] = value;
  50128. }
  50129. });
  50130. const className = getDefaultClassName(type);
  50131. if (className) {
  50132. const forceClass = `${unref(ns.namespace)}-${className}`;
  50133. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  50134. }
  50135. return column;
  50136. };
  50137. const checkSubColumn = (children) => {
  50138. if (isArray$1(children)) {
  50139. children.forEach((child) => check(child));
  50140. } else {
  50141. check(children);
  50142. }
  50143. function check(item) {
  50144. var _a;
  50145. if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") {
  50146. item.vParent = instance;
  50147. }
  50148. }
  50149. };
  50150. const setColumnRenders = (column) => {
  50151. if (props.renderHeader) {
  50152. debugWarn("TableColumn", "Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header.");
  50153. } else if (column.type !== "selection") {
  50154. column.renderHeader = (scope) => {
  50155. instance.columnConfig.value["label"];
  50156. return renderSlot(slots, "header", scope, () => [column.label]);
  50157. };
  50158. }
  50159. if (slots["filter-icon"]) {
  50160. column.renderFilterIcon = (scope) => {
  50161. return renderSlot(slots, "filter-icon", scope);
  50162. };
  50163. }
  50164. if (slots.expand) {
  50165. column.renderExpand = (scope) => {
  50166. return renderSlot(slots, "expand", scope);
  50167. };
  50168. }
  50169. let originRenderCell = column.renderCell;
  50170. if (column.type === "expand") {
  50171. column.renderCell = (data) => h$1("div", {
  50172. class: "cell"
  50173. }, [originRenderCell(data)]);
  50174. owner.value.renderExpanded = (row) => {
  50175. return slots.default ? slots.default(row) : slots.default;
  50176. };
  50177. } else {
  50178. originRenderCell = originRenderCell || defaultRenderCell;
  50179. column.renderCell = (data) => {
  50180. let children = null;
  50181. if (slots.default) {
  50182. const vnodes = slots.default(data);
  50183. children = vnodes.some((v) => v.type !== Comment) ? vnodes : originRenderCell(data);
  50184. } else {
  50185. children = originRenderCell(data);
  50186. }
  50187. const { columns } = owner.value.store.states;
  50188. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  50189. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex;
  50190. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  50191. const props2 = {
  50192. class: "cell",
  50193. style: {}
  50194. };
  50195. if (column.showOverflowTooltip) {
  50196. props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
  50197. props2.style = {
  50198. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  50199. };
  50200. }
  50201. checkSubColumn(children);
  50202. return h$1("div", props2, [prefix, children]);
  50203. };
  50204. }
  50205. return column;
  50206. };
  50207. const getPropsData = (...propsKey) => {
  50208. return propsKey.reduce((prev, cur) => {
  50209. if (isArray$1(cur)) {
  50210. cur.forEach((key) => {
  50211. prev[key] = props[key];
  50212. });
  50213. }
  50214. return prev;
  50215. }, {});
  50216. };
  50217. const getColumnElIndex = (children, child) => {
  50218. return Array.prototype.indexOf.call(children, child);
  50219. };
  50220. const updateColumnOrder = () => {
  50221. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  50222. };
  50223. return {
  50224. columnId,
  50225. realAlign,
  50226. isSubColumn,
  50227. realHeaderAlign,
  50228. columnOrTableParent,
  50229. setColumnWidth,
  50230. setColumnForcedProps,
  50231. setColumnRenders,
  50232. getPropsData,
  50233. getColumnElIndex,
  50234. updateColumnOrder
  50235. };
  50236. }
  50237. var defaultProps$1 = {
  50238. type: {
  50239. type: String,
  50240. default: "default"
  50241. },
  50242. label: String,
  50243. className: String,
  50244. labelClassName: String,
  50245. property: String,
  50246. prop: String,
  50247. width: {
  50248. type: [String, Number],
  50249. default: ""
  50250. },
  50251. minWidth: {
  50252. type: [String, Number],
  50253. default: ""
  50254. },
  50255. renderHeader: Function,
  50256. sortable: {
  50257. type: [Boolean, String],
  50258. default: false
  50259. },
  50260. sortMethod: Function,
  50261. sortBy: [String, Function, Array],
  50262. resizable: {
  50263. type: Boolean,
  50264. default: true
  50265. },
  50266. columnKey: String,
  50267. align: String,
  50268. headerAlign: String,
  50269. showOverflowTooltip: {
  50270. type: [Boolean, Object],
  50271. default: void 0
  50272. },
  50273. tooltipFormatter: Function,
  50274. fixed: [Boolean, String],
  50275. formatter: Function,
  50276. selectable: Function,
  50277. reserveSelection: Boolean,
  50278. filterMethod: Function,
  50279. filteredValue: Array,
  50280. filters: Array,
  50281. filterPlacement: String,
  50282. filterMultiple: {
  50283. type: Boolean,
  50284. default: true
  50285. },
  50286. filterClassName: String,
  50287. index: [Number, Function],
  50288. sortOrders: {
  50289. type: Array,
  50290. default: () => {
  50291. return ["ascending", "descending", null];
  50292. },
  50293. validator: (val) => {
  50294. return val.every((order) => ["ascending", "descending", null].includes(order));
  50295. }
  50296. }
  50297. };
  50298. let columnIdSeed = 1;
  50299. var ElTableColumn$1 = defineComponent({
  50300. name: "ElTableColumn",
  50301. components: {
  50302. ElCheckbox
  50303. },
  50304. props: defaultProps$1,
  50305. setup(props, { slots }) {
  50306. const instance = getCurrentInstance();
  50307. const columnConfig = ref({});
  50308. const owner = computed(() => {
  50309. let parent2 = instance.parent;
  50310. while (parent2 && !parent2.tableId) {
  50311. parent2 = parent2.parent;
  50312. }
  50313. return parent2;
  50314. });
  50315. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  50316. const {
  50317. columnId,
  50318. isSubColumn,
  50319. realHeaderAlign,
  50320. columnOrTableParent,
  50321. setColumnWidth,
  50322. setColumnForcedProps,
  50323. setColumnRenders,
  50324. getPropsData,
  50325. getColumnElIndex,
  50326. realAlign,
  50327. updateColumnOrder
  50328. } = useRender(props, slots, owner);
  50329. const parent = columnOrTableParent.value;
  50330. columnId.value = `${"tableId" in parent && parent.tableId || "columnId" in parent && parent.columnId}_column_${columnIdSeed++}`;
  50331. onBeforeMount(() => {
  50332. isSubColumn.value = owner.value !== parent;
  50333. const type = props.type || "default";
  50334. const sortable = props.sortable === "" ? true : props.sortable;
  50335. const showOverflowTooltip = type === "selection" ? false : isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip : props.showOverflowTooltip;
  50336. const tooltipFormatter = isUndefined(props.tooltipFormatter) ? parent.props.tooltipFormatter : props.tooltipFormatter;
  50337. const defaults = {
  50338. ...cellStarts[type],
  50339. id: columnId.value,
  50340. type,
  50341. property: props.prop || props.property,
  50342. align: realAlign,
  50343. headerAlign: realHeaderAlign,
  50344. showOverflowTooltip,
  50345. tooltipFormatter,
  50346. filterable: props.filters || props.filterMethod,
  50347. filteredValue: [],
  50348. filterPlacement: "",
  50349. filterClassName: "",
  50350. isColumnGroup: false,
  50351. isSubColumn: false,
  50352. filterOpened: false,
  50353. sortable,
  50354. index: props.index,
  50355. rawColumnKey: instance.vnode.key
  50356. };
  50357. const basicProps = [
  50358. "columnKey",
  50359. "label",
  50360. "className",
  50361. "labelClassName",
  50362. "type",
  50363. "renderHeader",
  50364. "formatter",
  50365. "fixed",
  50366. "resizable"
  50367. ];
  50368. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  50369. const selectProps = ["selectable", "reserveSelection"];
  50370. const filterProps = [
  50371. "filterMethod",
  50372. "filters",
  50373. "filterMultiple",
  50374. "filterOpened",
  50375. "filteredValue",
  50376. "filterPlacement",
  50377. "filterClassName"
  50378. ];
  50379. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  50380. column = mergeOptions(defaults, column);
  50381. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  50382. column = chains(column);
  50383. columnConfig.value = column;
  50384. registerNormalWatchers();
  50385. registerComplexWatchers();
  50386. });
  50387. onMounted(() => {
  50388. var _a, _b;
  50389. const parent2 = columnOrTableParent.value;
  50390. const children = isSubColumn.value ? (_a = parent2.vnode.el) == null ? void 0 : _a.children : (_b = parent2.refs.hiddenColumns) == null ? void 0 : _b.children;
  50391. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  50392. columnConfig.value.getColumnIndex = getColumnIndex;
  50393. const columnIndex = getColumnIndex();
  50394. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? "columnConfig" in parent2 && parent2.columnConfig.value : null, updateColumnOrder);
  50395. });
  50396. onBeforeUnmount(() => {
  50397. const getColumnIndex = columnConfig.value.getColumnIndex;
  50398. const columnIndex = getColumnIndex ? getColumnIndex() : -1;
  50399. columnIndex > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? "columnConfig" in parent && parent.columnConfig.value : null, updateColumnOrder);
  50400. });
  50401. instance.columnId = columnId.value;
  50402. instance.columnConfig = columnConfig;
  50403. return;
  50404. },
  50405. render() {
  50406. var _a, _b, _c;
  50407. try {
  50408. const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
  50409. row: {},
  50410. column: {},
  50411. $index: -1
  50412. });
  50413. const children = [];
  50414. if (isArray$1(renderDefault)) {
  50415. for (const childNode of renderDefault) {
  50416. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  50417. children.push(childNode);
  50418. } else if (childNode.type === Fragment && isArray$1(childNode.children)) {
  50419. childNode.children.forEach((vnode2) => {
  50420. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString$1(vnode2 == null ? void 0 : vnode2.children)) {
  50421. children.push(vnode2);
  50422. }
  50423. });
  50424. }
  50425. }
  50426. }
  50427. const vnode = h$1("div", children);
  50428. return vnode;
  50429. } catch (e) {
  50430. return h$1("div", []);
  50431. }
  50432. }
  50433. });
  50434. const ElTable = withInstall(Table, {
  50435. TableColumn: ElTableColumn$1
  50436. });
  50437. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  50438. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  50439. SortOrder2["ASC"] = "asc";
  50440. SortOrder2["DESC"] = "desc";
  50441. return SortOrder2;
  50442. })(SortOrder || {});
  50443. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  50444. Alignment2["LEFT"] = "left";
  50445. Alignment2["CENTER"] = "center";
  50446. Alignment2["RIGHT"] = "right";
  50447. return Alignment2;
  50448. })(Alignment || {});
  50449. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  50450. FixedDir2["LEFT"] = "left";
  50451. FixedDir2["RIGHT"] = "right";
  50452. return FixedDir2;
  50453. })(FixedDir || {});
  50454. const oppositeOrderMap = {
  50455. ["asc" /* ASC */]: "desc" /* DESC */,
  50456. ["desc" /* DESC */]: "asc" /* ASC */
  50457. };
  50458. const placeholderSign = Symbol("placeholder");
  50459. const calcColumnStyle = (column, fixedColumn, fixed) => {
  50460. var _a;
  50461. const flex = {
  50462. flexGrow: 0,
  50463. flexShrink: 0,
  50464. ...fixed ? {} : {
  50465. flexGrow: column.flexGrow || 0,
  50466. flexShrink: column.flexShrink || 1
  50467. }
  50468. };
  50469. if (!fixed) {
  50470. flex.flexShrink = 1;
  50471. }
  50472. const style = {
  50473. ...(_a = column.style) != null ? _a : {},
  50474. ...flex,
  50475. flexBasis: "auto",
  50476. width: column.width
  50477. };
  50478. if (!fixedColumn) {
  50479. if (column.maxWidth)
  50480. style.maxWidth = column.maxWidth;
  50481. if (column.minWidth)
  50482. style.minWidth = column.minWidth;
  50483. }
  50484. return style;
  50485. };
  50486. function useColumns(props, columns, fixed) {
  50487. const _columns = computed(() => unref(columns).map((column, index) => {
  50488. var _a, _b;
  50489. return {
  50490. ...column,
  50491. key: (_b = (_a = column.key) != null ? _a : column.dataKey) != null ? _b : index
  50492. };
  50493. }));
  50494. const visibleColumns = computed(() => {
  50495. return unref(_columns).filter((column) => !column.hidden);
  50496. });
  50497. const fixedColumnsOnLeft = computed(() => unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  50498. const fixedColumnsOnRight = computed(() => unref(visibleColumns).filter((column) => column.fixed === "right"));
  50499. const normalColumns = computed(() => unref(visibleColumns).filter((column) => !column.fixed));
  50500. const mainColumns = computed(() => {
  50501. const ret = [];
  50502. unref(fixedColumnsOnLeft).forEach((column) => {
  50503. ret.push({
  50504. ...column,
  50505. placeholderSign
  50506. });
  50507. });
  50508. unref(normalColumns).forEach((column) => {
  50509. ret.push(column);
  50510. });
  50511. unref(fixedColumnsOnRight).forEach((column) => {
  50512. ret.push({
  50513. ...column,
  50514. placeholderSign
  50515. });
  50516. });
  50517. return ret;
  50518. });
  50519. const hasFixedColumns = computed(() => {
  50520. return unref(fixedColumnsOnLeft).length || unref(fixedColumnsOnRight).length;
  50521. });
  50522. const columnsStyles = computed(() => {
  50523. return unref(_columns).reduce((style, column) => {
  50524. style[column.key] = calcColumnStyle(column, unref(fixed), props.fixed);
  50525. return style;
  50526. }, {});
  50527. });
  50528. const columnsTotalWidth = computed(() => {
  50529. return unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  50530. });
  50531. const getColumn = (key) => {
  50532. return unref(_columns).find((column) => column.key === key);
  50533. };
  50534. const getColumnStyle = (key) => {
  50535. return unref(columnsStyles)[key];
  50536. };
  50537. const updateColumnWidth = (column, width) => {
  50538. column.width = width;
  50539. };
  50540. function onColumnSorted(e) {
  50541. var _a;
  50542. const { key } = e.currentTarget.dataset;
  50543. if (!key)
  50544. return;
  50545. const { sortState, sortBy } = props;
  50546. let order = SortOrder.ASC;
  50547. if (isObject$1(sortState)) {
  50548. order = oppositeOrderMap[sortState[key]];
  50549. } else {
  50550. order = oppositeOrderMap[sortBy.order];
  50551. }
  50552. (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order });
  50553. }
  50554. return {
  50555. columns: _columns,
  50556. columnsStyles,
  50557. columnsTotalWidth,
  50558. fixedColumnsOnLeft,
  50559. fixedColumnsOnRight,
  50560. hasFixedColumns,
  50561. mainColumns,
  50562. normalColumns,
  50563. visibleColumns,
  50564. getColumn,
  50565. getColumnStyle,
  50566. updateColumnWidth,
  50567. onColumnSorted
  50568. };
  50569. }
  50570. const useScrollbar = (props, {
  50571. mainTableRef,
  50572. leftTableRef,
  50573. rightTableRef,
  50574. onMaybeEndReached
  50575. }) => {
  50576. const scrollPos = ref({ scrollLeft: 0, scrollTop: 0 });
  50577. function doScroll(params) {
  50578. var _a, _b, _c;
  50579. const { scrollTop } = params;
  50580. (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(params);
  50581. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  50582. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  50583. }
  50584. function scrollTo(params) {
  50585. scrollPos.value = params;
  50586. doScroll(params);
  50587. }
  50588. function scrollToTop(scrollTop) {
  50589. scrollPos.value.scrollTop = scrollTop;
  50590. doScroll(unref(scrollPos));
  50591. }
  50592. function scrollToLeft(scrollLeft) {
  50593. var _a, _b;
  50594. scrollPos.value.scrollLeft = scrollLeft;
  50595. (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, unref(scrollPos));
  50596. }
  50597. function onScroll(params) {
  50598. var _a;
  50599. scrollTo(params);
  50600. (_a = props.onScroll) == null ? void 0 : _a.call(props, params);
  50601. }
  50602. function onVerticalScroll({ scrollTop }) {
  50603. const { scrollTop: currentScrollTop } = unref(scrollPos);
  50604. if (scrollTop !== currentScrollTop)
  50605. scrollToTop(scrollTop);
  50606. }
  50607. function scrollToRow(row, strategy = "auto") {
  50608. var _a;
  50609. (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy);
  50610. }
  50611. watch(() => unref(scrollPos).scrollTop, (cur, prev) => {
  50612. if (cur > prev)
  50613. onMaybeEndReached();
  50614. });
  50615. return {
  50616. scrollPos,
  50617. scrollTo,
  50618. scrollToLeft,
  50619. scrollToTop,
  50620. scrollToRow,
  50621. onScroll,
  50622. onVerticalScroll
  50623. };
  50624. };
  50625. const useRow = (props, {
  50626. mainTableRef,
  50627. leftTableRef,
  50628. rightTableRef,
  50629. tableInstance,
  50630. ns,
  50631. isScrolling
  50632. }) => {
  50633. const vm = getCurrentInstance();
  50634. const { emit } = vm;
  50635. const isResetting = shallowRef(false);
  50636. const expandedRowKeys = ref(props.defaultExpandedRowKeys || []);
  50637. const lastRenderedRowIndex = ref(-1);
  50638. const resetIndex = shallowRef(null);
  50639. const rowHeights = ref({});
  50640. const pendingRowHeights = ref({});
  50641. const leftTableHeights = shallowRef({});
  50642. const mainTableHeights = shallowRef({});
  50643. const rightTableHeights = shallowRef({});
  50644. const isDynamic = computed(() => isNumber(props.estimatedRowHeight));
  50645. function onRowsRendered(params) {
  50646. var _a;
  50647. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params);
  50648. if (params.rowCacheEnd > unref(lastRenderedRowIndex)) {
  50649. lastRenderedRowIndex.value = params.rowCacheEnd;
  50650. }
  50651. }
  50652. function onRowHovered({ hovered, rowKey }) {
  50653. if (isScrolling.value) {
  50654. return;
  50655. }
  50656. const tableRoot = tableInstance.vnode.el;
  50657. const rows = tableRoot.querySelectorAll(`[rowkey="${String(rowKey)}"]`);
  50658. rows.forEach((row) => {
  50659. if (hovered) {
  50660. row.classList.add(ns.is("hovered"));
  50661. } else {
  50662. row.classList.remove(ns.is("hovered"));
  50663. }
  50664. });
  50665. }
  50666. function onRowExpanded({
  50667. expanded,
  50668. rowData,
  50669. rowIndex,
  50670. rowKey
  50671. }) {
  50672. var _a, _b;
  50673. const _expandedRowKeys = [...unref(expandedRowKeys)];
  50674. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  50675. if (expanded) {
  50676. if (currentKeyIndex === -1)
  50677. _expandedRowKeys.push(rowKey);
  50678. } else {
  50679. if (currentKeyIndex > -1)
  50680. _expandedRowKeys.splice(currentKeyIndex, 1);
  50681. }
  50682. expandedRowKeys.value = _expandedRowKeys;
  50683. emit("update:expandedRowKeys", _expandedRowKeys);
  50684. (_a = props.onRowExpand) == null ? void 0 : _a.call(props, {
  50685. expanded,
  50686. rowData,
  50687. rowIndex,
  50688. rowKey
  50689. });
  50690. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  50691. const tableRoot = tableInstance.vnode.el;
  50692. const hoverRow = tableRoot.querySelector(`.${ns.is("hovered")}[rowkey="${String(rowKey)}"]`);
  50693. if (hoverRow) {
  50694. nextTick(() => onRowHovered({ hovered: true, rowKey }));
  50695. }
  50696. }
  50697. const flushingRowHeights = debounce(() => {
  50698. var _a, _b, _c, _d;
  50699. isResetting.value = true;
  50700. rowHeights.value = { ...unref(rowHeights), ...unref(pendingRowHeights) };
  50701. resetAfterIndex(unref(resetIndex), false);
  50702. pendingRowHeights.value = {};
  50703. resetIndex.value = null;
  50704. (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate();
  50705. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  50706. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  50707. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  50708. isResetting.value = false;
  50709. }, 0);
  50710. function resetAfterIndex(index, forceUpdate = false) {
  50711. if (!unref(isDynamic))
  50712. return;
  50713. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  50714. const table = unref(tableRef);
  50715. if (table)
  50716. table.resetAfterRowIndex(index, forceUpdate);
  50717. });
  50718. }
  50719. function resetHeights(rowKey, height, rowIdx) {
  50720. const resetIdx = unref(resetIndex);
  50721. if (resetIdx === null) {
  50722. resetIndex.value = rowIdx;
  50723. } else {
  50724. if (resetIdx > rowIdx) {
  50725. resetIndex.value = rowIdx;
  50726. }
  50727. }
  50728. pendingRowHeights.value[rowKey] = height;
  50729. }
  50730. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  50731. if (!fixedDir) {
  50732. mainTableHeights.value[rowKey] = height;
  50733. } else {
  50734. if (fixedDir === FixedDir.RIGHT) {
  50735. rightTableHeights.value[rowKey] = height;
  50736. } else {
  50737. leftTableHeights.value[rowKey] = height;
  50738. }
  50739. }
  50740. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0));
  50741. if (unref(rowHeights)[rowKey] !== maximumHeight) {
  50742. resetHeights(rowKey, maximumHeight, rowIndex);
  50743. flushingRowHeights();
  50744. }
  50745. }
  50746. return {
  50747. expandedRowKeys,
  50748. lastRenderedRowIndex,
  50749. isDynamic,
  50750. isResetting,
  50751. rowHeights,
  50752. resetAfterIndex,
  50753. onRowExpanded,
  50754. onRowHovered,
  50755. onRowsRendered,
  50756. onRowHeightChange
  50757. };
  50758. };
  50759. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  50760. const depthMap = ref({});
  50761. const flattenedData = computed(() => {
  50762. const depths = {};
  50763. const { data: data2, rowKey } = props;
  50764. const _expandedRowKeys = unref(expandedRowKeys);
  50765. if (!_expandedRowKeys || !_expandedRowKeys.length)
  50766. return data2;
  50767. const array = [];
  50768. const keysSet = /* @__PURE__ */ new Set();
  50769. _expandedRowKeys.forEach((x) => keysSet.add(x));
  50770. let copy = data2.slice();
  50771. copy.forEach((x) => depths[x[rowKey]] = 0);
  50772. while (copy.length > 0) {
  50773. const item = copy.shift();
  50774. array.push(item);
  50775. if (keysSet.has(item[rowKey]) && isArray$1(item.children) && item.children.length > 0) {
  50776. copy = [...item.children, ...copy];
  50777. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  50778. }
  50779. }
  50780. depthMap.value = depths;
  50781. return array;
  50782. });
  50783. const data = computed(() => {
  50784. const { data: data2, expandColumnKey } = props;
  50785. return expandColumnKey ? unref(flattenedData) : data2;
  50786. });
  50787. watch(data, (val, prev) => {
  50788. if (val !== prev) {
  50789. lastRenderedRowIndex.value = -1;
  50790. resetAfterIndex(0, true);
  50791. }
  50792. });
  50793. return {
  50794. data,
  50795. depthMap
  50796. };
  50797. };
  50798. const sumReducer = (sum2, num) => sum2 + num;
  50799. const sum = (listLike) => {
  50800. return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  50801. };
  50802. const tryCall = (fLike, params, defaultRet = {}) => {
  50803. return isFunction$1(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  50804. };
  50805. const enforceUnit = (style) => {
  50806. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  50807. style[key] = addUnit(style[key]);
  50808. });
  50809. return style;
  50810. };
  50811. const componentToSlot = (ComponentLike) => isVNode(ComponentLike) ? (props) => h$1(ComponentLike, props) : ComponentLike;
  50812. const useStyles = (props, {
  50813. columnsTotalWidth,
  50814. rowsHeight,
  50815. fixedColumnsOnLeft,
  50816. fixedColumnsOnRight
  50817. }) => {
  50818. const bodyWidth = computed(() => {
  50819. const { fixed, width, vScrollbarSize } = props;
  50820. const ret = width - vScrollbarSize;
  50821. return fixed ? Math.max(Math.round(unref(columnsTotalWidth)), ret) : ret;
  50822. });
  50823. const mainTableHeight = computed(() => {
  50824. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  50825. if (maxHeight > 0) {
  50826. const _fixedRowsHeight = unref(fixedRowsHeight);
  50827. const _rowsHeight = unref(rowsHeight);
  50828. const _headerHeight = unref(headerHeight);
  50829. const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  50830. return Math.min(total, maxHeight - footerHeight2);
  50831. }
  50832. return height - footerHeight2;
  50833. });
  50834. const fixedTableHeight = computed(() => {
  50835. const { maxHeight } = props;
  50836. const tableHeight = unref(mainTableHeight);
  50837. if (isNumber(maxHeight) && maxHeight > 0)
  50838. return tableHeight;
  50839. const totalHeight = unref(rowsHeight) + unref(headerHeight) + unref(fixedRowsHeight);
  50840. return Math.min(tableHeight, totalHeight);
  50841. });
  50842. const mapColumn = (column) => column.width;
  50843. const leftTableWidth = computed(() => sum(unref(fixedColumnsOnLeft).map(mapColumn)));
  50844. const rightTableWidth = computed(() => sum(unref(fixedColumnsOnRight).map(mapColumn)));
  50845. const headerHeight = computed(() => sum(props.headerHeight));
  50846. const fixedRowsHeight = computed(() => {
  50847. var _a;
  50848. return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight;
  50849. });
  50850. const windowHeight = computed(() => {
  50851. return unref(mainTableHeight) - unref(headerHeight) - unref(fixedRowsHeight);
  50852. });
  50853. const rootStyle = computed(() => {
  50854. const { style = {}, height, width } = props;
  50855. return enforceUnit({
  50856. ...style,
  50857. height,
  50858. width
  50859. });
  50860. });
  50861. const footerHeight = computed(() => enforceUnit({ height: props.footerHeight }));
  50862. const emptyStyle = computed(() => ({
  50863. top: addUnit(unref(headerHeight)),
  50864. bottom: addUnit(props.footerHeight),
  50865. width: addUnit(props.width)
  50866. }));
  50867. return {
  50868. bodyWidth,
  50869. fixedTableHeight,
  50870. mainTableHeight,
  50871. leftTableWidth,
  50872. rightTableWidth,
  50873. windowHeight,
  50874. footerHeight,
  50875. emptyStyle,
  50876. rootStyle,
  50877. headerHeight
  50878. };
  50879. };
  50880. const useAutoResize = (props) => {
  50881. const sizer = ref();
  50882. const width$ = ref(0);
  50883. const height$ = ref(0);
  50884. let resizerStopper;
  50885. onMounted(() => {
  50886. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  50887. const { width, height } = entry.contentRect;
  50888. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  50889. const left = Number.parseInt(paddingLeft) || 0;
  50890. const right = Number.parseInt(paddingRight) || 0;
  50891. const top = Number.parseInt(paddingTop) || 0;
  50892. const bottom = Number.parseInt(paddingBottom) || 0;
  50893. width$.value = width - left - right;
  50894. height$.value = height - top - bottom;
  50895. }).stop;
  50896. });
  50897. onBeforeUnmount(() => {
  50898. resizerStopper == null ? void 0 : resizerStopper();
  50899. });
  50900. watch([width$, height$], ([width, height]) => {
  50901. var _a;
  50902. (_a = props.onResize) == null ? void 0 : _a.call(props, {
  50903. width,
  50904. height
  50905. });
  50906. });
  50907. return {
  50908. sizer,
  50909. width: width$,
  50910. height: height$
  50911. };
  50912. };
  50913. function useTable(props) {
  50914. const mainTableRef = ref();
  50915. const leftTableRef = ref();
  50916. const rightTableRef = ref();
  50917. const {
  50918. columns,
  50919. columnsStyles,
  50920. columnsTotalWidth,
  50921. fixedColumnsOnLeft,
  50922. fixedColumnsOnRight,
  50923. hasFixedColumns,
  50924. mainColumns,
  50925. onColumnSorted
  50926. } = useColumns(props, toRef(props, "columns"), toRef(props, "fixed"));
  50927. const {
  50928. scrollTo,
  50929. scrollToLeft,
  50930. scrollToTop,
  50931. scrollToRow,
  50932. onScroll,
  50933. onVerticalScroll,
  50934. scrollPos
  50935. } = useScrollbar(props, {
  50936. mainTableRef,
  50937. leftTableRef,
  50938. rightTableRef,
  50939. onMaybeEndReached
  50940. });
  50941. const ns = useNamespace("table-v2");
  50942. const instance = getCurrentInstance();
  50943. const isScrolling = shallowRef(false);
  50944. const {
  50945. expandedRowKeys,
  50946. lastRenderedRowIndex,
  50947. isDynamic,
  50948. isResetting,
  50949. rowHeights,
  50950. resetAfterIndex,
  50951. onRowExpanded,
  50952. onRowHeightChange,
  50953. onRowHovered,
  50954. onRowsRendered
  50955. } = useRow(props, {
  50956. mainTableRef,
  50957. leftTableRef,
  50958. rightTableRef,
  50959. tableInstance: instance,
  50960. ns,
  50961. isScrolling
  50962. });
  50963. const { data, depthMap } = useData(props, {
  50964. expandedRowKeys,
  50965. lastRenderedRowIndex,
  50966. resetAfterIndex
  50967. });
  50968. const rowsHeight = computed(() => {
  50969. const { estimatedRowHeight, rowHeight } = props;
  50970. const _data = unref(data);
  50971. if (isNumber(estimatedRowHeight)) {
  50972. return Object.values(unref(rowHeights)).reduce((acc, curr) => acc + curr, 0);
  50973. }
  50974. return _data.length * rowHeight;
  50975. });
  50976. const {
  50977. bodyWidth,
  50978. fixedTableHeight,
  50979. mainTableHeight,
  50980. leftTableWidth,
  50981. rightTableWidth,
  50982. windowHeight,
  50983. footerHeight,
  50984. emptyStyle,
  50985. rootStyle,
  50986. headerHeight
  50987. } = useStyles(props, {
  50988. columnsTotalWidth,
  50989. fixedColumnsOnLeft,
  50990. fixedColumnsOnRight,
  50991. rowsHeight
  50992. });
  50993. const containerRef = ref();
  50994. const showEmpty = computed(() => {
  50995. const noData = unref(data).length === 0;
  50996. return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  50997. });
  50998. function getRowHeight(rowIndex) {
  50999. const { estimatedRowHeight, rowHeight, rowKey } = props;
  51000. if (!estimatedRowHeight)
  51001. return rowHeight;
  51002. return unref(rowHeights)[unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  51003. }
  51004. const isEndReached = ref(false);
  51005. function onMaybeEndReached() {
  51006. const { onEndReached } = props;
  51007. if (!onEndReached)
  51008. return;
  51009. const { scrollTop } = unref(scrollPos);
  51010. const _totalHeight = unref(rowsHeight);
  51011. const clientHeight = unref(windowHeight);
  51012. const remainDistance = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  51013. if (!isEndReached.value && unref(lastRenderedRowIndex) >= 0 && _totalHeight <= scrollTop + unref(mainTableHeight) - unref(headerHeight)) {
  51014. isEndReached.value = true;
  51015. onEndReached(remainDistance);
  51016. } else {
  51017. isEndReached.value = false;
  51018. }
  51019. }
  51020. watch(() => unref(rowsHeight), () => isEndReached.value = false);
  51021. watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  51022. deep: true
  51023. });
  51024. return {
  51025. columns,
  51026. containerRef,
  51027. mainTableRef,
  51028. leftTableRef,
  51029. rightTableRef,
  51030. isDynamic,
  51031. isResetting,
  51032. isScrolling,
  51033. hasFixedColumns,
  51034. columnsStyles,
  51035. columnsTotalWidth,
  51036. data,
  51037. expandedRowKeys,
  51038. depthMap,
  51039. fixedColumnsOnLeft,
  51040. fixedColumnsOnRight,
  51041. mainColumns,
  51042. bodyWidth,
  51043. emptyStyle,
  51044. rootStyle,
  51045. footerHeight,
  51046. mainTableHeight,
  51047. fixedTableHeight,
  51048. leftTableWidth,
  51049. rightTableWidth,
  51050. showEmpty,
  51051. getRowHeight,
  51052. onColumnSorted,
  51053. onRowHovered,
  51054. onRowExpanded,
  51055. onRowsRendered,
  51056. onRowHeightChange,
  51057. scrollTo,
  51058. scrollToLeft,
  51059. scrollToTop,
  51060. scrollToRow,
  51061. onScroll,
  51062. onVerticalScroll
  51063. };
  51064. }
  51065. const TableV2InjectionKey = Symbol("tableV2");
  51066. const TABLE_V2_GRID_INJECTION_KEY = "tableV2GridScrollLeft";
  51067. const classType = String;
  51068. const columns = {
  51069. type: definePropType(Array),
  51070. required: true
  51071. };
  51072. const fixedDataType = {
  51073. type: definePropType(Array)
  51074. };
  51075. const dataType = {
  51076. ...fixedDataType,
  51077. required: true
  51078. };
  51079. const expandColumnKey = String;
  51080. const expandKeys = {
  51081. type: definePropType(Array),
  51082. default: () => mutable([])
  51083. };
  51084. const requiredNumber = {
  51085. type: Number,
  51086. required: true
  51087. };
  51088. const rowKey = {
  51089. type: definePropType([String, Number, Symbol]),
  51090. default: "id"
  51091. };
  51092. const styleType = {
  51093. type: definePropType(Object)
  51094. };
  51095. const tableV2RowProps = buildProps({
  51096. class: String,
  51097. columns,
  51098. columnsStyles: {
  51099. type: definePropType(Object),
  51100. required: true
  51101. },
  51102. depth: Number,
  51103. expandColumnKey,
  51104. estimatedRowHeight: {
  51105. ...virtualizedGridProps.estimatedRowHeight,
  51106. default: void 0
  51107. },
  51108. isScrolling: Boolean,
  51109. onRowExpand: {
  51110. type: definePropType(Function)
  51111. },
  51112. onRowHover: {
  51113. type: definePropType(Function)
  51114. },
  51115. onRowHeightChange: {
  51116. type: definePropType(Function)
  51117. },
  51118. rowData: {
  51119. type: definePropType(Object),
  51120. required: true
  51121. },
  51122. rowEventHandlers: {
  51123. type: definePropType(Object)
  51124. },
  51125. rowIndex: {
  51126. type: Number,
  51127. required: true
  51128. },
  51129. rowKey,
  51130. style: {
  51131. type: definePropType(Object)
  51132. }
  51133. });
  51134. const requiredNumberType = {
  51135. type: Number,
  51136. required: true
  51137. };
  51138. const tableV2HeaderProps = buildProps({
  51139. class: String,
  51140. columns,
  51141. fixedHeaderData: {
  51142. type: definePropType(Array)
  51143. },
  51144. headerData: {
  51145. type: definePropType(Array),
  51146. required: true
  51147. },
  51148. headerHeight: {
  51149. type: definePropType([Number, Array]),
  51150. default: 50
  51151. },
  51152. rowWidth: requiredNumberType,
  51153. rowHeight: {
  51154. type: Number,
  51155. default: 50
  51156. },
  51157. height: requiredNumberType,
  51158. width: requiredNumberType
  51159. });
  51160. const tableV2GridProps = buildProps({
  51161. columns,
  51162. data: dataType,
  51163. fixedData: fixedDataType,
  51164. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  51165. width: requiredNumber,
  51166. height: requiredNumber,
  51167. headerWidth: requiredNumber,
  51168. headerHeight: tableV2HeaderProps.headerHeight,
  51169. bodyWidth: requiredNumber,
  51170. rowHeight: requiredNumber,
  51171. cache: virtualizedListProps.cache,
  51172. useIsScrolling: Boolean,
  51173. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  51174. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  51175. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  51176. class: classType,
  51177. style: styleType,
  51178. containerStyle: styleType,
  51179. getRowHeight: {
  51180. type: definePropType(Function),
  51181. required: true
  51182. },
  51183. rowKey: tableV2RowProps.rowKey,
  51184. onRowsRendered: {
  51185. type: definePropType(Function)
  51186. },
  51187. onScroll: {
  51188. type: definePropType(Function)
  51189. }
  51190. });
  51191. const tableV2Props = buildProps({
  51192. cache: tableV2GridProps.cache,
  51193. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  51194. rowKey,
  51195. headerClass: {
  51196. type: definePropType([
  51197. String,
  51198. Function
  51199. ])
  51200. },
  51201. headerProps: {
  51202. type: definePropType([
  51203. Object,
  51204. Function
  51205. ])
  51206. },
  51207. headerCellProps: {
  51208. type: definePropType([
  51209. Object,
  51210. Function
  51211. ])
  51212. },
  51213. headerHeight: tableV2HeaderProps.headerHeight,
  51214. footerHeight: {
  51215. type: Number,
  51216. default: 0
  51217. },
  51218. rowClass: {
  51219. type: definePropType([String, Function])
  51220. },
  51221. rowProps: {
  51222. type: definePropType([Object, Function])
  51223. },
  51224. rowHeight: {
  51225. type: Number,
  51226. default: 50
  51227. },
  51228. cellProps: {
  51229. type: definePropType([
  51230. Object,
  51231. Function
  51232. ])
  51233. },
  51234. columns,
  51235. data: dataType,
  51236. dataGetter: {
  51237. type: definePropType(Function)
  51238. },
  51239. fixedData: fixedDataType,
  51240. expandColumnKey: tableV2RowProps.expandColumnKey,
  51241. expandedRowKeys: expandKeys,
  51242. defaultExpandedRowKeys: expandKeys,
  51243. class: classType,
  51244. fixed: Boolean,
  51245. style: {
  51246. type: definePropType(Object)
  51247. },
  51248. width: requiredNumber,
  51249. height: requiredNumber,
  51250. maxHeight: Number,
  51251. useIsScrolling: Boolean,
  51252. indentSize: {
  51253. type: Number,
  51254. default: 12
  51255. },
  51256. iconSize: {
  51257. type: Number,
  51258. default: 12
  51259. },
  51260. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  51261. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  51262. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  51263. sortBy: {
  51264. type: definePropType(Object),
  51265. default: () => ({})
  51266. },
  51267. sortState: {
  51268. type: definePropType(Object),
  51269. default: void 0
  51270. },
  51271. onColumnSort: {
  51272. type: definePropType(Function)
  51273. },
  51274. onExpandedRowsChange: {
  51275. type: definePropType(Function)
  51276. },
  51277. onEndReached: {
  51278. type: definePropType(Function)
  51279. },
  51280. onRowExpand: tableV2RowProps.onRowExpand,
  51281. onScroll: tableV2GridProps.onScroll,
  51282. onRowsRendered: tableV2GridProps.onRowsRendered,
  51283. rowEventHandlers: tableV2RowProps.rowEventHandlers
  51284. });
  51285. const TableV2Cell = (props, {
  51286. slots
  51287. }) => {
  51288. var _a;
  51289. const {
  51290. cellData,
  51291. style
  51292. } = props;
  51293. const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || "";
  51294. const defaultSlot = renderSlot(slots, "default", props, () => [displayText]);
  51295. return createVNode("div", {
  51296. "class": props.class,
  51297. "title": displayText,
  51298. "style": style
  51299. }, [defaultSlot]);
  51300. };
  51301. TableV2Cell.displayName = "ElTableV2Cell";
  51302. TableV2Cell.inheritAttrs = false;
  51303. var TableCell = TableV2Cell;
  51304. const HeaderCell = (props, {
  51305. slots
  51306. }) => renderSlot(slots, "default", props, () => {
  51307. var _a, _b;
  51308. return [createVNode("div", {
  51309. "class": props.class,
  51310. "title": (_a = props.column) == null ? void 0 : _a.title
  51311. }, [(_b = props.column) == null ? void 0 : _b.title])];
  51312. });
  51313. HeaderCell.displayName = "ElTableV2HeaderCell";
  51314. HeaderCell.inheritAttrs = false;
  51315. var HeaderCell$1 = HeaderCell;
  51316. const tableV2HeaderRowProps = buildProps({
  51317. class: String,
  51318. columns,
  51319. columnsStyles: {
  51320. type: definePropType(Object),
  51321. required: true
  51322. },
  51323. headerIndex: Number,
  51324. style: { type: definePropType(Object) }
  51325. });
  51326. const TableV2HeaderRow = defineComponent({
  51327. name: "ElTableV2HeaderRow",
  51328. props: tableV2HeaderRowProps,
  51329. setup(props, {
  51330. slots
  51331. }) {
  51332. return () => {
  51333. const {
  51334. columns,
  51335. columnsStyles,
  51336. headerIndex,
  51337. style
  51338. } = props;
  51339. let Cells = columns.map((column, columnIndex) => {
  51340. return slots.cell({
  51341. columns,
  51342. column,
  51343. columnIndex,
  51344. headerIndex,
  51345. style: columnsStyles[column.key]
  51346. });
  51347. });
  51348. if (slots.header) {
  51349. Cells = slots.header({
  51350. cells: Cells.map((node) => {
  51351. if (isArray$1(node) && node.length === 1) {
  51352. return node[0];
  51353. }
  51354. return node;
  51355. }),
  51356. columns,
  51357. headerIndex
  51358. });
  51359. }
  51360. return createVNode("div", {
  51361. "class": props.class,
  51362. "style": style,
  51363. "role": "row"
  51364. }, [Cells]);
  51365. };
  51366. }
  51367. });
  51368. var HeaderRow = TableV2HeaderRow;
  51369. const COMPONENT_NAME$8 = "ElTableV2Header";
  51370. const TableV2Header = defineComponent({
  51371. name: COMPONENT_NAME$8,
  51372. props: tableV2HeaderProps,
  51373. setup(props, {
  51374. slots,
  51375. expose
  51376. }) {
  51377. const ns = useNamespace("table-v2");
  51378. const scrollLeftInfo = inject(TABLE_V2_GRID_INJECTION_KEY);
  51379. const headerRef = ref();
  51380. const headerStyle = computed(() => enforceUnit({
  51381. width: props.width,
  51382. height: props.height
  51383. }));
  51384. const rowStyle = computed(() => enforceUnit({
  51385. width: props.rowWidth,
  51386. height: props.height
  51387. }));
  51388. const headerHeights = computed(() => castArray$1(unref(props.headerHeight)));
  51389. const scrollToLeft = (left) => {
  51390. const headerEl = unref(headerRef);
  51391. nextTick(() => {
  51392. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  51393. left
  51394. });
  51395. });
  51396. };
  51397. const renderFixedRows = () => {
  51398. const fixedRowClassName = ns.e("fixed-header-row");
  51399. const {
  51400. columns,
  51401. fixedHeaderData,
  51402. rowHeight
  51403. } = props;
  51404. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  51405. var _a;
  51406. const style = enforceUnit({
  51407. height: rowHeight,
  51408. width: "100%"
  51409. });
  51410. return (_a = slots.fixed) == null ? void 0 : _a.call(slots, {
  51411. class: fixedRowClassName,
  51412. columns,
  51413. rowData: fixedRowData,
  51414. rowIndex: -(fixedRowIndex + 1),
  51415. style
  51416. });
  51417. });
  51418. };
  51419. const renderDynamicRows = () => {
  51420. const dynamicRowClassName = ns.e("dynamic-header-row");
  51421. const {
  51422. columns
  51423. } = props;
  51424. return unref(headerHeights).map((rowHeight, rowIndex) => {
  51425. var _a;
  51426. const style = enforceUnit({
  51427. width: "100%",
  51428. height: rowHeight
  51429. });
  51430. return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, {
  51431. class: dynamicRowClassName,
  51432. columns,
  51433. headerIndex: rowIndex,
  51434. style
  51435. });
  51436. });
  51437. };
  51438. onUpdated(() => {
  51439. if (scrollLeftInfo == null ? void 0 : scrollLeftInfo.value) {
  51440. scrollToLeft(scrollLeftInfo.value);
  51441. }
  51442. });
  51443. expose({
  51444. scrollToLeft
  51445. });
  51446. return () => {
  51447. if (props.height <= 0)
  51448. return;
  51449. return createVNode("div", {
  51450. "ref": headerRef,
  51451. "class": props.class,
  51452. "style": unref(headerStyle),
  51453. "role": "rowgroup"
  51454. }, [createVNode("div", {
  51455. "style": unref(rowStyle),
  51456. "class": ns.e("header")
  51457. }, [renderDynamicRows(), renderFixedRows()])]);
  51458. };
  51459. }
  51460. });
  51461. var Header = TableV2Header;
  51462. const useTableRow = (props) => {
  51463. const {
  51464. isScrolling
  51465. } = inject(TableV2InjectionKey);
  51466. const measured = ref(false);
  51467. const rowRef = ref();
  51468. const measurable = computed(() => {
  51469. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  51470. });
  51471. const doMeasure = (isInit = false) => {
  51472. const $rowRef = unref(rowRef);
  51473. if (!$rowRef)
  51474. return;
  51475. const {
  51476. columns,
  51477. onRowHeightChange,
  51478. rowKey,
  51479. rowIndex,
  51480. style
  51481. } = props;
  51482. const {
  51483. height
  51484. } = $rowRef.getBoundingClientRect();
  51485. measured.value = true;
  51486. nextTick(() => {
  51487. if (isInit || height !== Number.parseInt(style.height)) {
  51488. const firstColumn = columns[0];
  51489. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  51490. onRowHeightChange == null ? void 0 : onRowHeightChange({
  51491. rowKey,
  51492. height,
  51493. rowIndex
  51494. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  51495. }
  51496. });
  51497. };
  51498. const eventHandlers = computed(() => {
  51499. const {
  51500. rowData,
  51501. rowIndex,
  51502. rowKey,
  51503. onRowHover
  51504. } = props;
  51505. const handlers = props.rowEventHandlers || {};
  51506. const eventHandlers2 = {};
  51507. Object.entries(handlers).forEach(([eventName, handler]) => {
  51508. if (isFunction$1(handler)) {
  51509. eventHandlers2[eventName] = (event) => {
  51510. handler({
  51511. event,
  51512. rowData,
  51513. rowIndex,
  51514. rowKey
  51515. });
  51516. };
  51517. }
  51518. });
  51519. if (onRowHover) {
  51520. [{
  51521. name: "onMouseleave",
  51522. hovered: false
  51523. }, {
  51524. name: "onMouseenter",
  51525. hovered: true
  51526. }].forEach(({
  51527. name,
  51528. hovered
  51529. }) => {
  51530. const existedHandler = eventHandlers2[name];
  51531. eventHandlers2[name] = (event) => {
  51532. onRowHover({
  51533. event,
  51534. hovered,
  51535. rowData,
  51536. rowIndex,
  51537. rowKey
  51538. });
  51539. existedHandler == null ? void 0 : existedHandler(event);
  51540. };
  51541. });
  51542. }
  51543. return eventHandlers2;
  51544. });
  51545. const onExpand = (expanded) => {
  51546. const {
  51547. onRowExpand,
  51548. rowData,
  51549. rowIndex,
  51550. rowKey
  51551. } = props;
  51552. onRowExpand == null ? void 0 : onRowExpand({
  51553. expanded,
  51554. rowData,
  51555. rowIndex,
  51556. rowKey
  51557. });
  51558. };
  51559. onMounted(() => {
  51560. if (unref(measurable)) {
  51561. doMeasure(true);
  51562. }
  51563. });
  51564. return {
  51565. isScrolling,
  51566. measurable,
  51567. measured,
  51568. rowRef,
  51569. eventHandlers,
  51570. onExpand
  51571. };
  51572. };
  51573. const COMPONENT_NAME$7 = "ElTableV2TableRow";
  51574. const TableV2Row = defineComponent({
  51575. name: COMPONENT_NAME$7,
  51576. props: tableV2RowProps,
  51577. setup(props, {
  51578. expose,
  51579. slots,
  51580. attrs
  51581. }) {
  51582. const {
  51583. eventHandlers,
  51584. isScrolling,
  51585. measurable,
  51586. measured,
  51587. rowRef,
  51588. onExpand
  51589. } = useTableRow(props);
  51590. expose({
  51591. onExpand
  51592. });
  51593. return () => {
  51594. const {
  51595. columns,
  51596. columnsStyles,
  51597. expandColumnKey,
  51598. depth,
  51599. rowData,
  51600. rowIndex,
  51601. style
  51602. } = props;
  51603. let ColumnCells = columns.map((column, columnIndex) => {
  51604. const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  51605. return slots.cell({
  51606. column,
  51607. columns,
  51608. columnIndex,
  51609. depth,
  51610. style: columnsStyles[column.key],
  51611. rowData,
  51612. rowIndex,
  51613. isScrolling: unref(isScrolling),
  51614. expandIconProps: expandable ? {
  51615. rowData,
  51616. rowIndex,
  51617. onExpand
  51618. } : void 0
  51619. });
  51620. });
  51621. if (slots.row) {
  51622. ColumnCells = slots.row({
  51623. cells: ColumnCells.map((node) => {
  51624. if (isArray$1(node) && node.length === 1) {
  51625. return node[0];
  51626. }
  51627. return node;
  51628. }),
  51629. style,
  51630. columns,
  51631. depth,
  51632. rowData,
  51633. rowIndex,
  51634. isScrolling: unref(isScrolling)
  51635. });
  51636. }
  51637. if (unref(measurable)) {
  51638. const {
  51639. height,
  51640. ...exceptHeightStyle
  51641. } = style || {};
  51642. const _measured = unref(measured);
  51643. return createVNode("div", mergeProps({
  51644. "ref": rowRef,
  51645. "class": props.class,
  51646. "style": _measured ? style : exceptHeightStyle,
  51647. "role": "row"
  51648. }, attrs, unref(eventHandlers)), [ColumnCells]);
  51649. }
  51650. return createVNode("div", mergeProps(attrs, {
  51651. "ref": rowRef,
  51652. "class": props.class,
  51653. "style": style,
  51654. "role": "row"
  51655. }, unref(eventHandlers)), [ColumnCells]);
  51656. };
  51657. }
  51658. });
  51659. var Row = TableV2Row;
  51660. const SortIcon = (props) => {
  51661. const {
  51662. sortOrder
  51663. } = props;
  51664. return createVNode(ElIcon, {
  51665. "size": 14,
  51666. "class": props.class
  51667. }, {
  51668. default: () => [sortOrder === SortOrder.ASC ? createVNode(sort_up_default, null, null) : createVNode(sort_down_default, null, null)]
  51669. });
  51670. };
  51671. var SortIcon$1 = SortIcon;
  51672. const ExpandIcon = (props) => {
  51673. const {
  51674. expanded,
  51675. expandable,
  51676. onExpand,
  51677. style,
  51678. size
  51679. } = props;
  51680. const expandIconProps = {
  51681. onClick: expandable ? () => onExpand(!expanded) : void 0,
  51682. class: props.class
  51683. };
  51684. return createVNode(ElIcon, mergeProps(expandIconProps, {
  51685. "size": size,
  51686. "style": style
  51687. }), {
  51688. default: () => [createVNode(arrow_right_default, null, null)]
  51689. });
  51690. };
  51691. var ExpandIcon$1 = ExpandIcon;
  51692. const COMPONENT_NAME$6 = "ElTableV2Grid";
  51693. const useTableGrid = (props) => {
  51694. const headerRef = ref();
  51695. const bodyRef = ref();
  51696. const scrollLeft = ref(0);
  51697. const totalHeight = computed(() => {
  51698. const {
  51699. data,
  51700. rowHeight,
  51701. estimatedRowHeight
  51702. } = props;
  51703. if (estimatedRowHeight) {
  51704. return;
  51705. }
  51706. return data.length * rowHeight;
  51707. });
  51708. const fixedRowHeight = computed(() => {
  51709. const {
  51710. fixedData,
  51711. rowHeight
  51712. } = props;
  51713. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  51714. });
  51715. const headerHeight = computed(() => sum(props.headerHeight));
  51716. const gridHeight = computed(() => {
  51717. const {
  51718. height
  51719. } = props;
  51720. return Math.max(0, height - unref(headerHeight) - unref(fixedRowHeight));
  51721. });
  51722. const hasHeader = computed(() => {
  51723. return unref(headerHeight) + unref(fixedRowHeight) > 0;
  51724. });
  51725. const itemKey = ({
  51726. data,
  51727. rowIndex
  51728. }) => data[rowIndex][props.rowKey];
  51729. function onItemRendered({
  51730. rowCacheStart,
  51731. rowCacheEnd,
  51732. rowVisibleStart,
  51733. rowVisibleEnd
  51734. }) {
  51735. var _a;
  51736. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, {
  51737. rowCacheStart,
  51738. rowCacheEnd,
  51739. rowVisibleStart,
  51740. rowVisibleEnd
  51741. });
  51742. }
  51743. function resetAfterRowIndex(index, forceUpdate2) {
  51744. var _a;
  51745. (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2);
  51746. }
  51747. function scrollTo(leftOrOptions, top) {
  51748. const header$ = unref(headerRef);
  51749. const body$ = unref(bodyRef);
  51750. if (isObject$1(leftOrOptions)) {
  51751. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions.scrollLeft);
  51752. scrollLeft.value = leftOrOptions.scrollLeft;
  51753. body$ == null ? void 0 : body$.scrollTo(leftOrOptions);
  51754. } else {
  51755. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions);
  51756. scrollLeft.value = leftOrOptions;
  51757. body$ == null ? void 0 : body$.scrollTo({
  51758. scrollLeft: leftOrOptions,
  51759. scrollTop: top
  51760. });
  51761. }
  51762. }
  51763. function scrollToTop(scrollTop) {
  51764. var _a;
  51765. (_a = unref(bodyRef)) == null ? void 0 : _a.scrollTo({
  51766. scrollTop
  51767. });
  51768. }
  51769. function scrollToRow(row, strategy) {
  51770. var _a;
  51771. (_a = unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy);
  51772. }
  51773. function forceUpdate() {
  51774. var _a, _b;
  51775. (_a = unref(bodyRef)) == null ? void 0 : _a.$forceUpdate();
  51776. (_b = unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  51777. }
  51778. watch(() => props.bodyWidth, () => {
  51779. var _a;
  51780. if (isNumber(props.estimatedRowHeight))
  51781. (_a = bodyRef.value) == null ? void 0 : _a.resetAfter({
  51782. columnIndex: 0
  51783. }, false);
  51784. });
  51785. return {
  51786. bodyRef,
  51787. forceUpdate,
  51788. fixedRowHeight,
  51789. gridHeight,
  51790. hasHeader,
  51791. headerHeight,
  51792. headerRef,
  51793. totalHeight,
  51794. itemKey,
  51795. onItemRendered,
  51796. resetAfterRowIndex,
  51797. scrollTo,
  51798. scrollToTop,
  51799. scrollToRow,
  51800. scrollLeft
  51801. };
  51802. };
  51803. const TableGrid = defineComponent({
  51804. name: COMPONENT_NAME$6,
  51805. props: tableV2GridProps,
  51806. setup(props, {
  51807. slots,
  51808. expose
  51809. }) {
  51810. const {
  51811. ns
  51812. } = inject(TableV2InjectionKey);
  51813. const {
  51814. bodyRef,
  51815. fixedRowHeight,
  51816. gridHeight,
  51817. hasHeader,
  51818. headerRef,
  51819. headerHeight,
  51820. totalHeight,
  51821. forceUpdate,
  51822. itemKey,
  51823. onItemRendered,
  51824. resetAfterRowIndex,
  51825. scrollTo,
  51826. scrollToTop,
  51827. scrollToRow,
  51828. scrollLeft
  51829. } = useTableGrid(props);
  51830. provide(TABLE_V2_GRID_INJECTION_KEY, scrollLeft);
  51831. onActivated(async () => {
  51832. var _a;
  51833. await nextTick();
  51834. const scrollTop = (_a = bodyRef.value) == null ? void 0 : _a.states.scrollTop;
  51835. scrollTop && scrollToTop(Math.round(scrollTop) + 1);
  51836. });
  51837. expose({
  51838. forceUpdate,
  51839. totalHeight,
  51840. scrollTo,
  51841. scrollToTop,
  51842. scrollToRow,
  51843. resetAfterRowIndex
  51844. });
  51845. const getColumnWidth = () => props.bodyWidth;
  51846. return () => {
  51847. const {
  51848. cache,
  51849. columns,
  51850. data,
  51851. fixedData,
  51852. useIsScrolling,
  51853. scrollbarAlwaysOn,
  51854. scrollbarEndGap,
  51855. scrollbarStartGap,
  51856. style,
  51857. rowHeight,
  51858. bodyWidth,
  51859. estimatedRowHeight,
  51860. headerWidth,
  51861. height,
  51862. width,
  51863. getRowHeight,
  51864. onScroll
  51865. } = props;
  51866. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  51867. const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1;
  51868. const _headerHeight = unref(headerHeight);
  51869. return createVNode("div", {
  51870. "role": "table",
  51871. "class": [ns.e("table"), props.class],
  51872. "style": style
  51873. }, [createVNode(Grid, {
  51874. "ref": bodyRef,
  51875. "data": data,
  51876. "useIsScrolling": useIsScrolling,
  51877. "itemKey": itemKey,
  51878. "columnCache": 0,
  51879. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  51880. "totalColumn": 1,
  51881. "totalRow": data.length,
  51882. "rowCache": cache,
  51883. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  51884. "width": width,
  51885. "height": unref(gridHeight),
  51886. "class": ns.e("body"),
  51887. "role": "rowgroup",
  51888. "scrollbarStartGap": scrollbarStartGap,
  51889. "scrollbarEndGap": scrollbarEndGap,
  51890. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  51891. "onScroll": onScroll,
  51892. "onItemRendered": onItemRendered,
  51893. "perfMode": false
  51894. }, {
  51895. default: (params) => {
  51896. var _a;
  51897. const rowData = data[params.rowIndex];
  51898. return (_a = slots.row) == null ? void 0 : _a.call(slots, {
  51899. ...params,
  51900. columns,
  51901. rowData
  51902. });
  51903. }
  51904. }), unref(hasHeader) && createVNode(Header, {
  51905. "ref": headerRef,
  51906. "class": ns.e("header-wrapper"),
  51907. "columns": columns,
  51908. "headerData": data,
  51909. "headerHeight": props.headerHeight,
  51910. "fixedHeaderData": fixedData,
  51911. "rowWidth": headerWidth,
  51912. "rowHeight": rowHeight,
  51913. "width": width,
  51914. "height": Math.min(_headerHeight + unref(fixedRowHeight), height)
  51915. }, {
  51916. dynamic: slots.header,
  51917. fixed: slots.row
  51918. })]);
  51919. };
  51920. }
  51921. });
  51922. function _isSlot$5(s) {
  51923. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  51924. }
  51925. const MainTable = (props, {
  51926. slots
  51927. }) => {
  51928. const {
  51929. mainTableRef,
  51930. ...rest
  51931. } = props;
  51932. return createVNode(TableGrid, mergeProps({
  51933. "ref": mainTableRef
  51934. }, rest), _isSlot$5(slots) ? slots : {
  51935. default: () => [slots]
  51936. });
  51937. };
  51938. function _isSlot$4(s) {
  51939. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  51940. }
  51941. const LeftTable = (props, {
  51942. slots
  51943. }) => {
  51944. if (!props.columns.length)
  51945. return;
  51946. const {
  51947. leftTableRef,
  51948. ...rest
  51949. } = props;
  51950. return createVNode(TableGrid, mergeProps({
  51951. "ref": leftTableRef
  51952. }, rest), _isSlot$4(slots) ? slots : {
  51953. default: () => [slots]
  51954. });
  51955. };
  51956. function _isSlot$3(s) {
  51957. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  51958. }
  51959. const RightTable = (props, {
  51960. slots
  51961. }) => {
  51962. if (!props.columns.length)
  51963. return;
  51964. const {
  51965. rightTableRef,
  51966. ...rest
  51967. } = props;
  51968. return createVNode(TableGrid, mergeProps({
  51969. "ref": rightTableRef
  51970. }, rest), _isSlot$3(slots) ? slots : {
  51971. default: () => [slots]
  51972. });
  51973. };
  51974. function _isSlot$2(s) {
  51975. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  51976. }
  51977. const RowRenderer = (props, {
  51978. slots
  51979. }) => {
  51980. const {
  51981. columns,
  51982. columnsStyles,
  51983. depthMap,
  51984. expandColumnKey,
  51985. expandedRowKeys,
  51986. estimatedRowHeight,
  51987. hasFixedColumns,
  51988. rowData,
  51989. rowIndex,
  51990. style,
  51991. isScrolling,
  51992. rowProps,
  51993. rowClass,
  51994. rowKey,
  51995. rowEventHandlers,
  51996. ns,
  51997. onRowHovered,
  51998. onRowExpanded
  51999. } = props;
  52000. const rowKls = tryCall(rowClass, {
  52001. columns,
  52002. rowData,
  52003. rowIndex
  52004. }, "");
  52005. const additionalProps = tryCall(rowProps, {
  52006. columns,
  52007. rowData,
  52008. rowIndex
  52009. });
  52010. const _rowKey = rowData[rowKey];
  52011. const depth = depthMap[_rowKey] || 0;
  52012. const canExpand = Boolean(expandColumnKey);
  52013. const isFixedRow = rowIndex < 0;
  52014. const kls = [ns.e("row"), rowKls, ns.is("expanded", canExpand && expandedRowKeys.includes(_rowKey)), ns.is("fixed", !depth && isFixedRow), ns.is("customized", Boolean(slots.row)), {
  52015. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0
  52016. }];
  52017. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  52018. const _rowProps = {
  52019. ...additionalProps,
  52020. columns,
  52021. columnsStyles,
  52022. class: kls,
  52023. depth,
  52024. expandColumnKey,
  52025. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  52026. isScrolling,
  52027. rowIndex,
  52028. rowData,
  52029. rowKey: _rowKey,
  52030. rowEventHandlers,
  52031. style
  52032. };
  52033. const handlerMouseEnter = (e) => {
  52034. onRowHover == null ? void 0 : onRowHover({
  52035. hovered: true,
  52036. rowKey: _rowKey,
  52037. event: e,
  52038. rowData,
  52039. rowIndex
  52040. });
  52041. };
  52042. const handlerMouseLeave = (e) => {
  52043. onRowHover == null ? void 0 : onRowHover({
  52044. hovered: false,
  52045. rowKey: _rowKey,
  52046. event: e,
  52047. rowData,
  52048. rowIndex
  52049. });
  52050. };
  52051. return createVNode(Row, mergeProps(_rowProps, {
  52052. "onRowExpand": onRowExpanded,
  52053. "onMouseenter": handlerMouseEnter,
  52054. "onMouseleave": handlerMouseLeave,
  52055. "rowkey": _rowKey
  52056. }), _isSlot$2(slots) ? slots : {
  52057. default: () => [slots]
  52058. });
  52059. };
  52060. const CellRenderer = ({
  52061. columns,
  52062. column,
  52063. columnIndex,
  52064. depth,
  52065. expandIconProps,
  52066. isScrolling,
  52067. rowData,
  52068. rowIndex,
  52069. style,
  52070. expandedRowKeys,
  52071. ns,
  52072. cellProps: _cellProps,
  52073. expandColumnKey,
  52074. indentSize,
  52075. iconSize,
  52076. rowKey
  52077. }, {
  52078. slots
  52079. }) => {
  52080. const cellStyle = enforceUnit(style);
  52081. if (column.placeholderSign === placeholderSign) {
  52082. return createVNode("div", {
  52083. "class": ns.em("row-cell", "placeholder"),
  52084. "style": cellStyle
  52085. }, null);
  52086. }
  52087. const {
  52088. cellRenderer,
  52089. dataKey,
  52090. dataGetter
  52091. } = column;
  52092. const cellData = isFunction$1(dataGetter) ? dataGetter({
  52093. columns,
  52094. column,
  52095. columnIndex,
  52096. rowData,
  52097. rowIndex
  52098. }) : get(rowData, dataKey != null ? dataKey : "");
  52099. const extraCellProps = tryCall(_cellProps, {
  52100. cellData,
  52101. columns,
  52102. column,
  52103. columnIndex,
  52104. rowIndex,
  52105. rowData
  52106. });
  52107. const cellProps = {
  52108. class: ns.e("cell-text"),
  52109. columns,
  52110. column,
  52111. columnIndex,
  52112. cellData,
  52113. isScrolling,
  52114. rowData,
  52115. rowIndex
  52116. };
  52117. const columnCellRenderer = componentToSlot(cellRenderer);
  52118. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : renderSlot(slots, "default", cellProps, () => [createVNode(TableCell, cellProps, null)]);
  52119. const kls = [ns.e("row-cell"), column.class, column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  52120. const expandable = rowIndex >= 0 && expandColumnKey && column.key === expandColumnKey;
  52121. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  52122. let IconOrPlaceholder;
  52123. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  52124. if (expandable) {
  52125. if (isObject$1(expandIconProps)) {
  52126. IconOrPlaceholder = createVNode(ExpandIcon$1, mergeProps(expandIconProps, {
  52127. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  52128. "size": iconSize,
  52129. "expanded": expanded,
  52130. "style": iconStyle,
  52131. "expandable": true
  52132. }), null);
  52133. } else {
  52134. IconOrPlaceholder = createVNode("div", {
  52135. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  52136. }, null);
  52137. }
  52138. }
  52139. return createVNode("div", mergeProps({
  52140. "class": kls,
  52141. "style": cellStyle
  52142. }, extraCellProps, {
  52143. "role": "cell"
  52144. }), [IconOrPlaceholder, Cell]);
  52145. };
  52146. CellRenderer.inheritAttrs = false;
  52147. function _isSlot$1(s) {
  52148. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  52149. }
  52150. const HeaderRenderer = ({
  52151. columns,
  52152. columnsStyles,
  52153. headerIndex,
  52154. style,
  52155. headerClass,
  52156. headerProps,
  52157. ns
  52158. }, {
  52159. slots
  52160. }) => {
  52161. const param = {
  52162. columns,
  52163. headerIndex
  52164. };
  52165. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), ns.is("customized", Boolean(slots.header))];
  52166. const extraProps = {
  52167. ...tryCall(headerProps, param),
  52168. columnsStyles,
  52169. class: kls,
  52170. columns,
  52171. headerIndex,
  52172. style
  52173. };
  52174. return createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  52175. default: () => [slots]
  52176. });
  52177. };
  52178. const HeaderCellRenderer = (props, {
  52179. slots
  52180. }) => {
  52181. const {
  52182. column,
  52183. ns,
  52184. style,
  52185. onColumnSorted
  52186. } = props;
  52187. const cellStyle = enforceUnit(style);
  52188. if (column.placeholderSign === placeholderSign) {
  52189. return createVNode("div", {
  52190. "class": ns.em("header-row-cell", "placeholder"),
  52191. "style": cellStyle
  52192. }, null);
  52193. }
  52194. const {
  52195. headerCellRenderer,
  52196. headerClass,
  52197. sortable
  52198. } = column;
  52199. const cellProps = {
  52200. ...props,
  52201. class: ns.e("header-cell-text")
  52202. };
  52203. const columnCellRenderer = componentToSlot(headerCellRenderer);
  52204. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : renderSlot(slots, "default", cellProps, () => [createVNode(HeaderCell$1, cellProps, null)]);
  52205. const {
  52206. sortBy,
  52207. sortState,
  52208. headerCellProps
  52209. } = props;
  52210. let sorting, sortOrder;
  52211. if (sortState) {
  52212. const order = sortState[column.key];
  52213. sorting = Boolean(oppositeOrderMap[order]);
  52214. sortOrder = sorting ? order : SortOrder.ASC;
  52215. } else {
  52216. sorting = column.key === sortBy.key;
  52217. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  52218. }
  52219. const cellKls = [ns.e("header-cell"), tryCall(headerClass, props, ""), column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right"), sortable && ns.is("sortable")];
  52220. const cellWrapperProps = {
  52221. ...tryCall(headerCellProps, props),
  52222. onClick: column.sortable ? onColumnSorted : void 0,
  52223. class: cellKls,
  52224. style: cellStyle,
  52225. ["data-key"]: column.key
  52226. };
  52227. return createVNode("div", mergeProps(cellWrapperProps, {
  52228. "role": "columnheader"
  52229. }), [Cell, sortable && createVNode(SortIcon$1, {
  52230. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  52231. "sortOrder": sortOrder
  52232. }, null)]);
  52233. };
  52234. const Footer$1 = (props, {
  52235. slots
  52236. }) => {
  52237. var _a;
  52238. return createVNode("div", {
  52239. "class": props.class,
  52240. "style": props.style
  52241. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  52242. };
  52243. Footer$1.displayName = "ElTableV2Footer";
  52244. const Footer = (props, {
  52245. slots
  52246. }) => {
  52247. const defaultSlot = renderSlot(slots, "default", {}, () => [createVNode(ElEmpty, null, null)]);
  52248. return createVNode("div", {
  52249. "class": props.class,
  52250. "style": props.style
  52251. }, [defaultSlot]);
  52252. };
  52253. Footer.displayName = "ElTableV2Empty";
  52254. const Overlay = (props, {
  52255. slots
  52256. }) => {
  52257. var _a;
  52258. return createVNode("div", {
  52259. "class": props.class,
  52260. "style": props.style
  52261. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  52262. };
  52263. Overlay.displayName = "ElTableV2Overlay";
  52264. function _isSlot(s) {
  52265. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  52266. }
  52267. const COMPONENT_NAME$5 = "ElTableV2";
  52268. const TableV2 = defineComponent({
  52269. name: COMPONENT_NAME$5,
  52270. props: tableV2Props,
  52271. setup(props, {
  52272. slots,
  52273. expose
  52274. }) {
  52275. const ns = useNamespace("table-v2");
  52276. const {
  52277. columnsStyles,
  52278. fixedColumnsOnLeft,
  52279. fixedColumnsOnRight,
  52280. mainColumns,
  52281. mainTableHeight,
  52282. fixedTableHeight,
  52283. leftTableWidth,
  52284. rightTableWidth,
  52285. data,
  52286. depthMap,
  52287. expandedRowKeys,
  52288. hasFixedColumns,
  52289. mainTableRef,
  52290. leftTableRef,
  52291. rightTableRef,
  52292. isDynamic,
  52293. isResetting,
  52294. isScrolling,
  52295. bodyWidth,
  52296. emptyStyle,
  52297. rootStyle,
  52298. footerHeight,
  52299. showEmpty,
  52300. scrollTo,
  52301. scrollToLeft,
  52302. scrollToTop,
  52303. scrollToRow,
  52304. getRowHeight,
  52305. onColumnSorted,
  52306. onRowHeightChange,
  52307. onRowHovered,
  52308. onRowExpanded,
  52309. onRowsRendered,
  52310. onScroll,
  52311. onVerticalScroll
  52312. } = useTable(props);
  52313. expose({
  52314. scrollTo,
  52315. scrollToLeft,
  52316. scrollToTop,
  52317. scrollToRow
  52318. });
  52319. provide(TableV2InjectionKey, {
  52320. ns,
  52321. isResetting,
  52322. isScrolling
  52323. });
  52324. return () => {
  52325. const {
  52326. cache,
  52327. cellProps,
  52328. estimatedRowHeight,
  52329. expandColumnKey,
  52330. fixedData,
  52331. headerHeight,
  52332. headerClass,
  52333. headerProps,
  52334. headerCellProps,
  52335. sortBy,
  52336. sortState,
  52337. rowHeight,
  52338. rowClass,
  52339. rowEventHandlers,
  52340. rowKey,
  52341. rowProps,
  52342. scrollbarAlwaysOn,
  52343. indentSize,
  52344. iconSize,
  52345. useIsScrolling,
  52346. vScrollbarSize,
  52347. width
  52348. } = props;
  52349. const _data = unref(data);
  52350. const mainTableProps = {
  52351. cache,
  52352. class: ns.e("main"),
  52353. columns: unref(mainColumns),
  52354. data: _data,
  52355. fixedData,
  52356. estimatedRowHeight,
  52357. bodyWidth: unref(bodyWidth),
  52358. headerHeight,
  52359. headerWidth: unref(bodyWidth),
  52360. height: unref(mainTableHeight),
  52361. mainTableRef,
  52362. rowKey,
  52363. rowHeight,
  52364. scrollbarAlwaysOn,
  52365. scrollbarStartGap: 2,
  52366. scrollbarEndGap: vScrollbarSize,
  52367. useIsScrolling,
  52368. width,
  52369. getRowHeight,
  52370. onRowsRendered,
  52371. onScroll
  52372. };
  52373. const leftColumnsWidth = unref(leftTableWidth);
  52374. const _fixedTableHeight = unref(fixedTableHeight);
  52375. const leftTableProps = {
  52376. cache,
  52377. class: ns.e("left"),
  52378. columns: unref(fixedColumnsOnLeft),
  52379. data: _data,
  52380. fixedData,
  52381. estimatedRowHeight,
  52382. leftTableRef,
  52383. rowHeight,
  52384. bodyWidth: leftColumnsWidth,
  52385. headerWidth: leftColumnsWidth,
  52386. headerHeight,
  52387. height: _fixedTableHeight,
  52388. rowKey,
  52389. scrollbarAlwaysOn,
  52390. scrollbarStartGap: 2,
  52391. scrollbarEndGap: vScrollbarSize,
  52392. useIsScrolling,
  52393. width: leftColumnsWidth,
  52394. getRowHeight,
  52395. onScroll: onVerticalScroll
  52396. };
  52397. const rightColumnsWidth = unref(rightTableWidth);
  52398. const rightTableProps = {
  52399. cache,
  52400. class: ns.e("right"),
  52401. columns: unref(fixedColumnsOnRight),
  52402. data: _data,
  52403. fixedData,
  52404. estimatedRowHeight,
  52405. rightTableRef,
  52406. rowHeight,
  52407. bodyWidth: rightColumnsWidth,
  52408. headerWidth: rightColumnsWidth,
  52409. headerHeight,
  52410. height: _fixedTableHeight,
  52411. rowKey,
  52412. scrollbarAlwaysOn,
  52413. scrollbarStartGap: 2,
  52414. scrollbarEndGap: vScrollbarSize,
  52415. width: rightColumnsWidth,
  52416. style: `${ns.cssVarName("table-scrollbar-size")}: ${vScrollbarSize}px`,
  52417. useIsScrolling,
  52418. getRowHeight,
  52419. onScroll: onVerticalScroll
  52420. };
  52421. const _columnsStyles = unref(columnsStyles);
  52422. const tableRowProps = {
  52423. ns,
  52424. depthMap: unref(depthMap),
  52425. columnsStyles: _columnsStyles,
  52426. expandColumnKey,
  52427. expandedRowKeys: unref(expandedRowKeys),
  52428. estimatedRowHeight,
  52429. hasFixedColumns: unref(hasFixedColumns),
  52430. rowProps,
  52431. rowClass,
  52432. rowKey,
  52433. rowEventHandlers,
  52434. onRowHovered,
  52435. onRowExpanded,
  52436. onRowHeightChange
  52437. };
  52438. const tableCellProps = {
  52439. cellProps,
  52440. expandColumnKey,
  52441. indentSize,
  52442. iconSize,
  52443. rowKey,
  52444. expandedRowKeys: unref(expandedRowKeys),
  52445. ns
  52446. };
  52447. const tableHeaderProps = {
  52448. ns,
  52449. headerClass,
  52450. headerProps,
  52451. columnsStyles: _columnsStyles
  52452. };
  52453. const tableHeaderCellProps = {
  52454. ns,
  52455. sortBy,
  52456. sortState,
  52457. headerCellProps,
  52458. onColumnSorted
  52459. };
  52460. const tableSlots = {
  52461. row: (props2) => createVNode(RowRenderer, mergeProps(props2, tableRowProps), {
  52462. row: slots.row,
  52463. cell: (props3) => {
  52464. let _slot;
  52465. return slots.cell ? createVNode(CellRenderer, mergeProps(props3, tableCellProps, {
  52466. "style": _columnsStyles[props3.column.key]
  52467. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  52468. default: () => [_slot]
  52469. }) : createVNode(CellRenderer, mergeProps(props3, tableCellProps, {
  52470. "style": _columnsStyles[props3.column.key]
  52471. }), null);
  52472. }
  52473. }),
  52474. header: (props2) => createVNode(HeaderRenderer, mergeProps(props2, tableHeaderProps), {
  52475. header: slots.header,
  52476. cell: (props3) => {
  52477. let _slot2;
  52478. return slots["header-cell"] ? createVNode(HeaderCellRenderer, mergeProps(props3, tableHeaderCellProps, {
  52479. "style": _columnsStyles[props3.column.key]
  52480. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  52481. default: () => [_slot2]
  52482. }) : createVNode(HeaderCellRenderer, mergeProps(props3, tableHeaderCellProps, {
  52483. "style": _columnsStyles[props3.column.key]
  52484. }), null);
  52485. }
  52486. })
  52487. };
  52488. const rootKls = [props.class, ns.b(), ns.e("root"), ns.is("dynamic", unref(isDynamic))];
  52489. const footerProps = {
  52490. class: ns.e("footer"),
  52491. style: unref(footerHeight)
  52492. };
  52493. return createVNode("div", {
  52494. "class": rootKls,
  52495. "style": unref(rootStyle)
  52496. }, [createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  52497. default: () => [tableSlots]
  52498. }), createVNode(LeftTable, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  52499. default: () => [tableSlots]
  52500. }), createVNode(RightTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  52501. default: () => [tableSlots]
  52502. }), slots.footer && createVNode(Footer$1, footerProps, {
  52503. default: slots.footer
  52504. }), unref(showEmpty) && createVNode(Footer, {
  52505. "class": ns.e("empty"),
  52506. "style": unref(emptyStyle)
  52507. }, {
  52508. default: slots.empty
  52509. }), slots.overlay && createVNode(Overlay, {
  52510. "class": ns.e("overlay")
  52511. }, {
  52512. default: slots.overlay
  52513. })]);
  52514. };
  52515. }
  52516. });
  52517. var TableV2$1 = TableV2;
  52518. const autoResizerProps = buildProps({
  52519. disableWidth: Boolean,
  52520. disableHeight: Boolean,
  52521. onResize: {
  52522. type: definePropType(Function)
  52523. }
  52524. });
  52525. const AutoResizer = defineComponent({
  52526. name: "ElAutoResizer",
  52527. props: autoResizerProps,
  52528. setup(props, {
  52529. slots
  52530. }) {
  52531. const ns = useNamespace("auto-resizer");
  52532. const {
  52533. height,
  52534. width,
  52535. sizer
  52536. } = useAutoResize(props);
  52537. const style = {
  52538. width: "100%",
  52539. height: "100%"
  52540. };
  52541. return () => {
  52542. var _a;
  52543. return createVNode("div", {
  52544. "ref": sizer,
  52545. "class": ns.b(),
  52546. "style": style
  52547. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  52548. height: height.value,
  52549. width: width.value
  52550. })]);
  52551. };
  52552. }
  52553. });
  52554. const ElTableV2 = withInstall(TableV2$1);
  52555. const ElAutoResizer = withInstall(AutoResizer);
  52556. const tabsRootContextKey = Symbol("tabsRootContextKey");
  52557. const tabBarProps = buildProps({
  52558. tabs: {
  52559. type: definePropType(Array),
  52560. default: () => mutable([])
  52561. },
  52562. tabRefs: {
  52563. type: definePropType(Object),
  52564. default: () => mutable({})
  52565. }
  52566. });
  52567. const COMPONENT_NAME$4 = "ElTabBar";
  52568. const __default__$r = defineComponent({
  52569. name: COMPONENT_NAME$4
  52570. });
  52571. const _sfc_main$w = /* @__PURE__ */ defineComponent({
  52572. ...__default__$r,
  52573. props: tabBarProps,
  52574. setup(__props, { expose }) {
  52575. const props = __props;
  52576. const rootTabs = inject(tabsRootContextKey);
  52577. if (!rootTabs)
  52578. throwError(COMPONENT_NAME$4, "<el-tabs><el-tab-bar /></el-tabs>");
  52579. const ns = useNamespace("tabs");
  52580. const barRef = ref();
  52581. const barStyle = ref();
  52582. const getBarStyle = () => {
  52583. let offset = 0;
  52584. let tabSize = 0;
  52585. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  52586. const sizeDir = sizeName === "width" ? "x" : "y";
  52587. const position = sizeDir === "x" ? "left" : "top";
  52588. props.tabs.every((tab) => {
  52589. if (isUndefined(tab.paneName))
  52590. return false;
  52591. const $el = props.tabRefs[tab.paneName];
  52592. if (!$el)
  52593. return false;
  52594. if (!tab.active) {
  52595. return true;
  52596. }
  52597. offset = $el[`offset${capitalize(position)}`];
  52598. tabSize = $el[`client${capitalize(sizeName)}`];
  52599. const tabStyles = window.getComputedStyle($el);
  52600. if (sizeName === "width") {
  52601. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  52602. offset += Number.parseFloat(tabStyles.paddingLeft);
  52603. }
  52604. return false;
  52605. });
  52606. return {
  52607. [sizeName]: `${tabSize}px`,
  52608. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  52609. };
  52610. };
  52611. const update = () => barStyle.value = getBarStyle();
  52612. const tabObservers = [];
  52613. const observerTabs = () => {
  52614. tabObservers.forEach((observer) => observer.stop());
  52615. tabObservers.length = 0;
  52616. Object.values(props.tabRefs).forEach((tab) => {
  52617. tabObservers.push(useResizeObserver(tab, update));
  52618. });
  52619. };
  52620. watch(() => props.tabs, async () => {
  52621. await nextTick();
  52622. update();
  52623. observerTabs();
  52624. }, { immediate: true });
  52625. const barObserver = useResizeObserver(barRef, () => update());
  52626. onBeforeUnmount(() => {
  52627. tabObservers.forEach((observer) => observer.stop());
  52628. tabObservers.length = 0;
  52629. barObserver.stop();
  52630. });
  52631. expose({
  52632. ref: barRef,
  52633. update
  52634. });
  52635. return (_ctx, _cache) => {
  52636. return openBlock(), createElementBlock("div", {
  52637. ref_key: "barRef",
  52638. ref: barRef,
  52639. class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
  52640. style: normalizeStyle(barStyle.value)
  52641. }, null, 6);
  52642. };
  52643. }
  52644. });
  52645. var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "tab-bar.vue"]]);
  52646. const tabNavProps = buildProps({
  52647. panes: {
  52648. type: definePropType(Array),
  52649. default: () => mutable([])
  52650. },
  52651. currentName: {
  52652. type: [String, Number],
  52653. default: ""
  52654. },
  52655. editable: Boolean,
  52656. type: {
  52657. type: String,
  52658. values: ["card", "border-card", ""],
  52659. default: ""
  52660. },
  52661. stretch: Boolean,
  52662. tabindex: {
  52663. type: [String, Number],
  52664. default: void 0
  52665. }
  52666. });
  52667. const tabNavEmits = {
  52668. tabClick: (tab, tabName, ev) => ev instanceof Event,
  52669. tabRemove: (tab, ev) => ev instanceof Event
  52670. };
  52671. const COMPONENT_NAME$3 = "ElTabNav";
  52672. const TabNav = defineComponent({
  52673. name: COMPONENT_NAME$3,
  52674. props: tabNavProps,
  52675. emits: tabNavEmits,
  52676. setup(props, {
  52677. expose,
  52678. emit
  52679. }) {
  52680. const rootTabs = inject(tabsRootContextKey);
  52681. if (!rootTabs)
  52682. throwError(COMPONENT_NAME$3, `<el-tabs><tab-nav /></el-tabs>`);
  52683. const ns = useNamespace("tabs");
  52684. const visibility = useDocumentVisibility();
  52685. const focused = useWindowFocus();
  52686. const navScroll$ = ref();
  52687. const nav$ = ref();
  52688. const el$ = ref();
  52689. const tabRefsMap = ref({});
  52690. const tabBarRef = ref();
  52691. const scrollable = ref(false);
  52692. const navOffset = ref(0);
  52693. const isFocus = ref(false);
  52694. const focusable = ref(true);
  52695. const tracker = shallowRef();
  52696. const isHorizontal = computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition));
  52697. const sizeName = computed(() => isHorizontal.value ? "width" : "height");
  52698. const navStyle = computed(() => {
  52699. const dir = sizeName.value === "width" ? "X" : "Y";
  52700. return {
  52701. transform: `translate${dir}(-${navOffset.value}px)`
  52702. };
  52703. });
  52704. const {
  52705. width: navContainerWidth,
  52706. height: navContainerHeight
  52707. } = useElementSize(navScroll$);
  52708. const {
  52709. width: navWidth,
  52710. height: navHeight
  52711. } = useElementSize(nav$, {
  52712. width: 0,
  52713. height: 0
  52714. }, {
  52715. box: "border-box"
  52716. });
  52717. const navContainerSize = computed(() => isHorizontal.value ? navContainerWidth.value : navContainerHeight.value);
  52718. const navSize = computed(() => isHorizontal.value ? navWidth.value : navHeight.value);
  52719. const {
  52720. onWheel
  52721. } = useWheel$1({
  52722. atStartEdge: computed(() => navOffset.value <= 0),
  52723. atEndEdge: computed(() => navSize.value - navOffset.value <= navContainerSize.value),
  52724. layout: computed(() => isHorizontal.value ? "horizontal" : "vertical")
  52725. }, (offset) => {
  52726. navOffset.value = clamp$1(navOffset.value + offset, 0, navSize.value - navContainerSize.value);
  52727. });
  52728. const scrollPrev = () => {
  52729. if (!navScroll$.value)
  52730. return;
  52731. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  52732. const currentOffset = navOffset.value;
  52733. if (!currentOffset)
  52734. return;
  52735. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  52736. navOffset.value = newOffset;
  52737. };
  52738. const scrollNext = () => {
  52739. if (!navScroll$.value || !nav$.value)
  52740. return;
  52741. const navSize2 = nav$.value[`offset${capitalize(sizeName.value)}`];
  52742. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  52743. const currentOffset = navOffset.value;
  52744. if (navSize2 - currentOffset <= containerSize)
  52745. return;
  52746. const newOffset = navSize2 - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize2 - containerSize;
  52747. navOffset.value = newOffset;
  52748. };
  52749. const scrollToActiveTab = async () => {
  52750. const nav = nav$.value;
  52751. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  52752. return;
  52753. await nextTick();
  52754. const activeTab = tabRefsMap.value[props.currentName];
  52755. if (!activeTab)
  52756. return;
  52757. const navScroll = navScroll$.value;
  52758. const activeTabBounding = activeTab.getBoundingClientRect();
  52759. const navScrollBounding = navScroll.getBoundingClientRect();
  52760. const maxOffset = isHorizontal.value ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  52761. const currentOffset = navOffset.value;
  52762. let newOffset = currentOffset;
  52763. if (isHorizontal.value) {
  52764. if (activeTabBounding.left < navScrollBounding.left) {
  52765. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  52766. }
  52767. if (activeTabBounding.right > navScrollBounding.right) {
  52768. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  52769. }
  52770. } else {
  52771. if (activeTabBounding.top < navScrollBounding.top) {
  52772. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  52773. }
  52774. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  52775. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  52776. }
  52777. }
  52778. newOffset = Math.max(newOffset, 0);
  52779. navOffset.value = Math.min(newOffset, maxOffset);
  52780. };
  52781. const update = () => {
  52782. var _a;
  52783. if (!nav$.value || !navScroll$.value)
  52784. return;
  52785. props.stretch && ((_a = tabBarRef.value) == null ? void 0 : _a.update());
  52786. const navSize2 = nav$.value[`offset${capitalize(sizeName.value)}`];
  52787. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  52788. const currentOffset = navOffset.value;
  52789. if (containerSize < navSize2) {
  52790. scrollable.value = scrollable.value || {};
  52791. scrollable.value.prev = currentOffset;
  52792. scrollable.value.next = currentOffset + containerSize < navSize2;
  52793. if (navSize2 - currentOffset < containerSize) {
  52794. navOffset.value = navSize2 - containerSize;
  52795. }
  52796. } else {
  52797. scrollable.value = false;
  52798. if (currentOffset > 0) {
  52799. navOffset.value = 0;
  52800. }
  52801. }
  52802. };
  52803. const changeTab = (event) => {
  52804. const code = getEventCode(event);
  52805. let step = 0;
  52806. switch (code) {
  52807. case EVENT_CODE.left:
  52808. case EVENT_CODE.up:
  52809. step = -1;
  52810. break;
  52811. case EVENT_CODE.right:
  52812. case EVENT_CODE.down:
  52813. step = 1;
  52814. break;
  52815. default:
  52816. return;
  52817. }
  52818. const tabList = Array.from(event.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  52819. const currentIndex = tabList.indexOf(event.target);
  52820. let nextIndex = currentIndex + step;
  52821. if (nextIndex < 0) {
  52822. nextIndex = tabList.length - 1;
  52823. } else if (nextIndex >= tabList.length) {
  52824. nextIndex = 0;
  52825. }
  52826. tabList[nextIndex].focus({
  52827. preventScroll: true
  52828. });
  52829. tabList[nextIndex].click();
  52830. setFocus();
  52831. };
  52832. const setFocus = () => {
  52833. if (focusable.value)
  52834. isFocus.value = true;
  52835. };
  52836. const removeFocus = () => isFocus.value = false;
  52837. const setRefs = (el, key) => {
  52838. tabRefsMap.value[key] = el;
  52839. };
  52840. const focusActiveTab = async () => {
  52841. await nextTick();
  52842. const activeTab = tabRefsMap.value[props.currentName];
  52843. activeTab == null ? void 0 : activeTab.focus({
  52844. preventScroll: true
  52845. });
  52846. };
  52847. watch(visibility, (visibility2) => {
  52848. if (visibility2 === "hidden") {
  52849. focusable.value = false;
  52850. } else if (visibility2 === "visible") {
  52851. setTimeout(() => focusable.value = true, 50);
  52852. }
  52853. });
  52854. watch(focused, (focused2) => {
  52855. if (focused2) {
  52856. setTimeout(() => focusable.value = true, 50);
  52857. } else {
  52858. focusable.value = false;
  52859. }
  52860. });
  52861. useResizeObserver(el$, update);
  52862. onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  52863. onUpdated(() => update());
  52864. expose({
  52865. scrollToActiveTab,
  52866. removeFocus,
  52867. focusActiveTab,
  52868. tabListRef: nav$,
  52869. tabBarRef,
  52870. scheduleRender: () => triggerRef(tracker)
  52871. });
  52872. return () => {
  52873. const scrollBtn = scrollable.value ? [createVNode("span", {
  52874. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  52875. "onClick": scrollPrev
  52876. }, [createVNode(ElIcon, null, {
  52877. default: () => [createVNode(arrow_left_default, null, null)]
  52878. })]), createVNode("span", {
  52879. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  52880. "onClick": scrollNext
  52881. }, [createVNode(ElIcon, null, {
  52882. default: () => [createVNode(arrow_right_default, null, null)]
  52883. })])] : null;
  52884. const tabs = props.panes.map((pane, index) => {
  52885. var _a, _b, _c, _d, _e;
  52886. const uid = pane.uid;
  52887. const disabled = pane.props.disabled;
  52888. const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`;
  52889. const closable = !disabled && (pane.isClosable || pane.props.closable !== false && props.editable);
  52890. pane.index = `${index}`;
  52891. const btnClose = closable ? createVNode(ElIcon, {
  52892. "class": "is-icon-close",
  52893. "onClick": (ev) => emit("tabRemove", pane, ev)
  52894. }, {
  52895. default: () => [createVNode(close_default, null, null)]
  52896. }) : null;
  52897. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  52898. const tabindex = !disabled && pane.active ? (_e = props.tabindex) != null ? _e : rootTabs.props.tabindex : -1;
  52899. return createVNode("div", {
  52900. "ref": (el) => setRefs(el, tabName),
  52901. "class": [ns.e("item"), ns.is(rootTabs.props.tabPosition), ns.is("active", pane.active), ns.is("disabled", disabled), ns.is("closable", closable), ns.is("focus", isFocus.value)],
  52902. "id": `tab-${tabName}`,
  52903. "key": `tab-${uid}`,
  52904. "aria-controls": `pane-${tabName}`,
  52905. "role": "tab",
  52906. "aria-selected": pane.active,
  52907. "tabindex": tabindex,
  52908. "onFocus": () => setFocus(),
  52909. "onBlur": () => removeFocus(),
  52910. "onClick": (ev) => {
  52911. removeFocus();
  52912. emit("tabClick", pane, tabName, ev);
  52913. },
  52914. "onKeydown": (ev) => {
  52915. const code = getEventCode(ev);
  52916. if (closable && (code === EVENT_CODE.delete || code === EVENT_CODE.backspace)) {
  52917. emit("tabRemove", pane, ev);
  52918. }
  52919. }
  52920. }, [...[tabLabelContent, btnClose]]);
  52921. });
  52922. tracker.value;
  52923. return createVNode("div", {
  52924. "ref": el$,
  52925. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  52926. }, [scrollBtn, createVNode("div", {
  52927. "class": ns.e("nav-scroll"),
  52928. "ref": navScroll$
  52929. }, [props.panes.length > 0 ? createVNode("div", {
  52930. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  52931. "ref": nav$,
  52932. "style": navStyle.value,
  52933. "role": "tablist",
  52934. "onKeydown": changeTab,
  52935. "onWheel": onWheel
  52936. }, [...[!props.type ? createVNode(TabBar, {
  52937. "ref": tabBarRef,
  52938. "tabs": [...props.panes],
  52939. "tabRefs": tabRefsMap.value
  52940. }, null) : null, tabs]]) : null])]);
  52941. };
  52942. }
  52943. });
  52944. const tabsProps = buildProps({
  52945. type: {
  52946. type: String,
  52947. values: ["card", "border-card", ""],
  52948. default: ""
  52949. },
  52950. closable: Boolean,
  52951. addable: Boolean,
  52952. modelValue: {
  52953. type: [String, Number]
  52954. },
  52955. editable: Boolean,
  52956. tabPosition: {
  52957. type: String,
  52958. values: ["top", "right", "bottom", "left"],
  52959. default: "top"
  52960. },
  52961. beforeLeave: {
  52962. type: definePropType(Function),
  52963. default: () => true
  52964. },
  52965. stretch: Boolean,
  52966. tabindex: {
  52967. type: [String, Number],
  52968. default: 0
  52969. }
  52970. });
  52971. const isPaneName = (value) => isString$1(value) || isNumber(value);
  52972. const tabsEmits = {
  52973. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  52974. tabClick: (pane, ev) => ev instanceof Event,
  52975. tabChange: (name) => isPaneName(name),
  52976. edit: (paneName, action) => ["remove", "add"].includes(action),
  52977. tabRemove: (name) => isPaneName(name),
  52978. tabAdd: () => true
  52979. };
  52980. const Tabs = defineComponent({
  52981. name: "ElTabs",
  52982. props: tabsProps,
  52983. emits: tabsEmits,
  52984. setup(props, {
  52985. emit,
  52986. slots,
  52987. expose
  52988. }) {
  52989. var _a;
  52990. const ns = useNamespace("tabs");
  52991. const isVertical = computed(() => ["left", "right"].includes(props.tabPosition));
  52992. const {
  52993. children: panes,
  52994. addChild: registerPane,
  52995. removeChild: unregisterPane,
  52996. ChildrenSorter: PanesSorter
  52997. } = useOrderedChildren(getCurrentInstance(), "ElTabPane");
  52998. const nav$ = ref();
  52999. const currentName = ref((_a = props.modelValue) != null ? _a : "0");
  53000. const setCurrentName = async (value, trigger = false) => {
  53001. var _a2, _b, _c, _d;
  53002. if (currentName.value === value || isUndefined(value))
  53003. return;
  53004. try {
  53005. let canLeave;
  53006. if (props.beforeLeave) {
  53007. const result = props.beforeLeave(value, currentName.value);
  53008. canLeave = result instanceof Promise ? await result : result;
  53009. } else {
  53010. canLeave = true;
  53011. }
  53012. if (canLeave !== false) {
  53013. const isFocusInsidePane = (_a2 = panes.value.find((item) => item.paneName === currentName.value)) == null ? void 0 : _a2.isFocusInsidePane();
  53014. currentName.value = value;
  53015. if (trigger) {
  53016. emit(UPDATE_MODEL_EVENT, value);
  53017. emit("tabChange", value);
  53018. }
  53019. (_c = (_b = nav$.value) == null ? void 0 : _b.removeFocus) == null ? void 0 : _c.call(_b);
  53020. if (isFocusInsidePane) {
  53021. (_d = nav$.value) == null ? void 0 : _d.focusActiveTab();
  53022. }
  53023. }
  53024. } catch (e) {
  53025. }
  53026. };
  53027. const handleTabClick = (tab, tabName, event) => {
  53028. if (tab.props.disabled)
  53029. return;
  53030. emit("tabClick", tab, event);
  53031. setCurrentName(tabName, true);
  53032. };
  53033. const handleTabRemove = (pane, ev) => {
  53034. if (pane.props.disabled || isUndefined(pane.props.name))
  53035. return;
  53036. ev.stopPropagation();
  53037. emit("edit", pane.props.name, "remove");
  53038. emit("tabRemove", pane.props.name);
  53039. };
  53040. const handleTabAdd = () => {
  53041. emit("edit", void 0, "add");
  53042. emit("tabAdd");
  53043. };
  53044. const handleKeydown = (event) => {
  53045. const code = getEventCode(event);
  53046. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter].includes(code))
  53047. handleTabAdd();
  53048. };
  53049. const swapChildren = (vnode) => {
  53050. const actualFirstChild = vnode.el.firstChild;
  53051. const firstChild = ["bottom", "right"].includes(props.tabPosition) ? vnode.children[0].el : vnode.children[1].el;
  53052. if (actualFirstChild !== firstChild) {
  53053. actualFirstChild.before(firstChild);
  53054. }
  53055. };
  53056. watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  53057. watch(currentName, async () => {
  53058. var _a2;
  53059. await nextTick();
  53060. (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab();
  53061. });
  53062. provide(tabsRootContextKey, {
  53063. props,
  53064. currentName,
  53065. registerPane,
  53066. unregisterPane,
  53067. nav$
  53068. });
  53069. expose({
  53070. currentName,
  53071. get tabNavRef() {
  53072. return omit(nav$.value, ["scheduleRender"]);
  53073. }
  53074. });
  53075. return () => {
  53076. const addSlot = slots["add-icon"];
  53077. const newButton = props.editable || props.addable ? createVNode("div", {
  53078. "class": [ns.e("new-tab"), isVertical.value && ns.e("new-tab-vertical")],
  53079. "tabindex": props.tabindex,
  53080. "onClick": handleTabAdd,
  53081. "onKeydown": handleKeydown
  53082. }, [addSlot ? renderSlot(slots, "add-icon") : createVNode(ElIcon, {
  53083. "class": ns.is("icon-plus")
  53084. }, {
  53085. default: () => [createVNode(plus_default, null, null)]
  53086. })]) : null;
  53087. const tabNav = () => createVNode(TabNav, {
  53088. "ref": nav$,
  53089. "currentName": currentName.value,
  53090. "editable": props.editable,
  53091. "type": props.type,
  53092. "panes": panes.value,
  53093. "stretch": props.stretch,
  53094. "onTabClick": handleTabClick,
  53095. "onTabRemove": handleTabRemove
  53096. }, null);
  53097. const header = createVNode("div", {
  53098. "class": [ns.e("header"), isVertical.value && ns.e("header-vertical"), ns.is(props.tabPosition)]
  53099. }, [createVNode(PanesSorter, null, {
  53100. default: tabNav,
  53101. $stable: true
  53102. }), newButton]);
  53103. const panels = createVNode("div", {
  53104. "class": ns.e("content")
  53105. }, [renderSlot(slots, "default")]);
  53106. return createVNode("div", {
  53107. "class": [ns.b(), ns.m(props.tabPosition), {
  53108. [ns.m("card")]: props.type === "card",
  53109. [ns.m("border-card")]: props.type === "border-card"
  53110. }],
  53111. "onVnodeMounted": swapChildren,
  53112. "onVnodeUpdated": swapChildren
  53113. }, [panels, header]);
  53114. };
  53115. }
  53116. });
  53117. const tabPaneProps = buildProps({
  53118. label: {
  53119. type: String,
  53120. default: ""
  53121. },
  53122. name: {
  53123. type: [String, Number]
  53124. },
  53125. closable: {
  53126. type: Boolean,
  53127. default: void 0
  53128. },
  53129. disabled: Boolean,
  53130. lazy: Boolean
  53131. });
  53132. const COMPONENT_NAME$2 = "ElTabPane";
  53133. const __default__$q = defineComponent({
  53134. name: COMPONENT_NAME$2
  53135. });
  53136. const _sfc_main$v = /* @__PURE__ */ defineComponent({
  53137. ...__default__$q,
  53138. props: tabPaneProps,
  53139. setup(__props) {
  53140. const props = __props;
  53141. const instance = getCurrentInstance();
  53142. const slots = useSlots();
  53143. const tabsRoot = inject(tabsRootContextKey);
  53144. if (!tabsRoot)
  53145. throwError(COMPONENT_NAME$2, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  53146. const ns = useNamespace("tab-pane");
  53147. const paneRef = ref();
  53148. const index = ref();
  53149. const isClosable = computed(() => {
  53150. var _a;
  53151. return (_a = props.closable) != null ? _a : tabsRoot.props.closable;
  53152. });
  53153. const active = computedEager(() => {
  53154. var _a;
  53155. return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
  53156. });
  53157. const loaded = ref(active.value);
  53158. const paneName = computed(() => {
  53159. var _a;
  53160. return (_a = props.name) != null ? _a : index.value;
  53161. });
  53162. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  53163. const isFocusInsidePane = () => {
  53164. var _a;
  53165. return (_a = paneRef.value) == null ? void 0 : _a.contains(document.activeElement);
  53166. };
  53167. watch(active, (val) => {
  53168. if (val)
  53169. loaded.value = true;
  53170. });
  53171. const pane = reactive({
  53172. uid: instance.uid,
  53173. getVnode: () => instance.vnode,
  53174. slots,
  53175. props,
  53176. paneName,
  53177. active,
  53178. index,
  53179. isClosable,
  53180. isFocusInsidePane
  53181. });
  53182. tabsRoot.registerPane(pane);
  53183. onBeforeUnmount(() => {
  53184. tabsRoot.unregisterPane(pane);
  53185. });
  53186. onBeforeUpdate(() => {
  53187. var _a;
  53188. if (slots.label)
  53189. (_a = tabsRoot.nav$.value) == null ? void 0 : _a.scheduleRender();
  53190. });
  53191. return (_ctx, _cache) => {
  53192. return unref(shouldBeRender) ? withDirectives((openBlock(), createElementBlock("div", {
  53193. key: 0,
  53194. id: `pane-${unref(paneName)}`,
  53195. ref_key: "paneRef",
  53196. ref: paneRef,
  53197. class: normalizeClass(unref(ns).b()),
  53198. role: "tabpanel",
  53199. "aria-hidden": !unref(active),
  53200. "aria-labelledby": `tab-${unref(paneName)}`
  53201. }, [
  53202. renderSlot(_ctx.$slots, "default")
  53203. ], 10, ["id", "aria-hidden", "aria-labelledby"])), [
  53204. [vShow, unref(active)]
  53205. ]) : createCommentVNode("v-if", true);
  53206. };
  53207. }
  53208. });
  53209. var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "tab-pane.vue"]]);
  53210. const ElTabs = withInstall(Tabs, {
  53211. TabPane
  53212. });
  53213. const ElTabPane = withNoopInstall(TabPane);
  53214. const textProps = buildProps({
  53215. type: {
  53216. type: String,
  53217. values: ["primary", "success", "info", "warning", "danger", ""],
  53218. default: ""
  53219. },
  53220. size: {
  53221. type: String,
  53222. values: componentSizes,
  53223. default: ""
  53224. },
  53225. truncated: Boolean,
  53226. lineClamp: {
  53227. type: [String, Number]
  53228. },
  53229. tag: {
  53230. type: String,
  53231. default: "span"
  53232. }
  53233. });
  53234. const __default__$p = defineComponent({
  53235. name: "ElText"
  53236. });
  53237. const _sfc_main$u = /* @__PURE__ */ defineComponent({
  53238. ...__default__$p,
  53239. props: textProps,
  53240. setup(__props) {
  53241. const props = __props;
  53242. const textRef = ref();
  53243. const textSize = useFormSize();
  53244. const ns = useNamespace("text");
  53245. const textKls = computed(() => [
  53246. ns.b(),
  53247. ns.m(props.type),
  53248. ns.m(textSize.value),
  53249. ns.is("truncated", props.truncated),
  53250. ns.is("line-clamp", !isUndefined(props.lineClamp))
  53251. ]);
  53252. const bindTitle = () => {
  53253. var _a, _b, _c, _d, _e, _f, _g;
  53254. const inheritTitle = useAttrs$1().title;
  53255. if (inheritTitle)
  53256. return;
  53257. let shouldAddTitle = false;
  53258. const text = ((_a = textRef.value) == null ? void 0 : _a.textContent) || "";
  53259. if (props.truncated) {
  53260. const width = (_b = textRef.value) == null ? void 0 : _b.offsetWidth;
  53261. const scrollWidth = (_c = textRef.value) == null ? void 0 : _c.scrollWidth;
  53262. if (width && scrollWidth && scrollWidth > width) {
  53263. shouldAddTitle = true;
  53264. }
  53265. } else if (!isUndefined(props.lineClamp)) {
  53266. const height = (_d = textRef.value) == null ? void 0 : _d.offsetHeight;
  53267. const scrollHeight = (_e = textRef.value) == null ? void 0 : _e.scrollHeight;
  53268. if (height && scrollHeight && scrollHeight > height) {
  53269. shouldAddTitle = true;
  53270. }
  53271. }
  53272. if (shouldAddTitle) {
  53273. (_f = textRef.value) == null ? void 0 : _f.setAttribute("title", text);
  53274. } else {
  53275. (_g = textRef.value) == null ? void 0 : _g.removeAttribute("title");
  53276. }
  53277. };
  53278. onMounted(bindTitle);
  53279. onUpdated(bindTitle);
  53280. return (_ctx, _cache) => {
  53281. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  53282. ref_key: "textRef",
  53283. ref: textRef,
  53284. class: normalizeClass(unref(textKls)),
  53285. style: normalizeStyle({ "-webkit-line-clamp": _ctx.lineClamp })
  53286. }, {
  53287. default: withCtx(() => [
  53288. renderSlot(_ctx.$slots, "default")
  53289. ]),
  53290. _: 3
  53291. }, 8, ["class", "style"]);
  53292. };
  53293. }
  53294. });
  53295. var Text = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "text.vue"]]);
  53296. const ElText = withInstall(Text);
  53297. const timeSelectProps = buildProps({
  53298. format: {
  53299. type: String,
  53300. default: "HH:mm"
  53301. },
  53302. modelValue: {
  53303. type: definePropType(String)
  53304. },
  53305. disabled: Boolean,
  53306. editable: {
  53307. type: Boolean,
  53308. default: true
  53309. },
  53310. effect: {
  53311. type: definePropType(String),
  53312. default: "light"
  53313. },
  53314. clearable: {
  53315. type: Boolean,
  53316. default: true
  53317. },
  53318. size: useSizeProp,
  53319. placeholder: String,
  53320. start: {
  53321. type: String,
  53322. default: "09:00"
  53323. },
  53324. end: {
  53325. type: String,
  53326. default: "18:00"
  53327. },
  53328. step: {
  53329. type: String,
  53330. default: "00:30"
  53331. },
  53332. minTime: {
  53333. type: definePropType(String)
  53334. },
  53335. maxTime: {
  53336. type: definePropType(String)
  53337. },
  53338. includeEndTime: Boolean,
  53339. name: String,
  53340. prefixIcon: {
  53341. type: definePropType([String, Object]),
  53342. default: () => clock_default
  53343. },
  53344. clearIcon: {
  53345. type: definePropType([String, Object]),
  53346. default: () => circle_close_default
  53347. },
  53348. popperClass: {
  53349. type: String,
  53350. default: ""
  53351. },
  53352. popperStyle: {
  53353. type: definePropType([String, Object])
  53354. },
  53355. ...useEmptyValuesProps
  53356. });
  53357. const parseTime = (time) => {
  53358. const values = (time || "").split(":");
  53359. if (values.length >= 2) {
  53360. let hours = Number.parseInt(values[0], 10);
  53361. const minutes = Number.parseInt(values[1], 10);
  53362. const timeUpper = time.toUpperCase();
  53363. if (timeUpper.includes("AM") && hours === 12) {
  53364. hours = 0;
  53365. } else if (timeUpper.includes("PM") && hours !== 12) {
  53366. hours += 12;
  53367. }
  53368. return {
  53369. hours,
  53370. minutes
  53371. };
  53372. }
  53373. return null;
  53374. };
  53375. const compareTime = (time1, time2) => {
  53376. const value1 = parseTime(time1);
  53377. if (!value1)
  53378. return -1;
  53379. const value2 = parseTime(time2);
  53380. if (!value2)
  53381. return -1;
  53382. const minutes1 = value1.minutes + value1.hours * 60;
  53383. const minutes2 = value2.minutes + value2.hours * 60;
  53384. if (minutes1 === minutes2) {
  53385. return 0;
  53386. }
  53387. return minutes1 > minutes2 ? 1 : -1;
  53388. };
  53389. const padTime = (time) => {
  53390. return `${time}`.padStart(2, "0");
  53391. };
  53392. const formatTime = (time) => {
  53393. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  53394. };
  53395. const nextTime = (time, step) => {
  53396. const timeValue = parseTime(time);
  53397. if (!timeValue)
  53398. return "";
  53399. const stepValue = parseTime(step);
  53400. if (!stepValue)
  53401. return "";
  53402. const next = {
  53403. hours: timeValue.hours,
  53404. minutes: timeValue.minutes
  53405. };
  53406. next.minutes += stepValue.minutes;
  53407. next.hours += stepValue.hours;
  53408. next.hours += Math.floor(next.minutes / 60);
  53409. next.minutes = next.minutes % 60;
  53410. return formatTime(next);
  53411. };
  53412. const __default__$o = defineComponent({
  53413. name: "ElTimeSelect"
  53414. });
  53415. const _sfc_main$t = /* @__PURE__ */ defineComponent({
  53416. ...__default__$o,
  53417. props: timeSelectProps,
  53418. emits: [CHANGE_EVENT, "blur", "focus", "clear", UPDATE_MODEL_EVENT],
  53419. setup(__props, { expose }) {
  53420. const props = __props;
  53421. dayjs.extend(customParseFormat);
  53422. const { Option: ElOption } = ElSelect;
  53423. const nsInput = useNamespace("input");
  53424. const select = ref();
  53425. const _disabled = useFormDisabled();
  53426. const { lang } = useLocale();
  53427. const value = computed(() => props.modelValue);
  53428. const start = computed(() => {
  53429. const time = parseTime(props.start);
  53430. return time ? formatTime(time) : null;
  53431. });
  53432. const end = computed(() => {
  53433. const time = parseTime(props.end);
  53434. return time ? formatTime(time) : null;
  53435. });
  53436. const step = computed(() => {
  53437. const time = parseTime(props.step);
  53438. return time ? formatTime(time) : null;
  53439. });
  53440. const minTime = computed(() => {
  53441. const time = parseTime(props.minTime || "");
  53442. return time ? formatTime(time) : null;
  53443. });
  53444. const maxTime = computed(() => {
  53445. const time = parseTime(props.maxTime || "");
  53446. return time ? formatTime(time) : null;
  53447. });
  53448. const items = computed(() => {
  53449. var _a;
  53450. const result = [];
  53451. const push = (formattedValue, rawValue) => {
  53452. result.push({
  53453. value: formattedValue,
  53454. disabled: compareTime(rawValue, minTime.value || "-1:-1") <= 0 || compareTime(rawValue, maxTime.value || "100:100") >= 0
  53455. });
  53456. };
  53457. if (props.start && props.end && props.step) {
  53458. let current = start.value;
  53459. let currentTime;
  53460. while (current && end.value && compareTime(current, end.value) <= 0) {
  53461. currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
  53462. push(currentTime, current);
  53463. current = nextTime(current, step.value);
  53464. }
  53465. if (props.includeEndTime && end.value && ((_a = result[result.length - 1]) == null ? void 0 : _a.value) !== end.value) {
  53466. const formattedValue = dayjs(end.value, "HH:mm").locale(lang.value).format(props.format);
  53467. push(formattedValue, end.value);
  53468. }
  53469. }
  53470. return result;
  53471. });
  53472. const blur = () => {
  53473. var _a, _b;
  53474. (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  53475. };
  53476. const focus = () => {
  53477. var _a, _b;
  53478. (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  53479. };
  53480. expose({
  53481. blur,
  53482. focus
  53483. });
  53484. return (_ctx, _cache) => {
  53485. return openBlock(), createBlock(unref(ElSelect), {
  53486. ref_key: "select",
  53487. ref: select,
  53488. "model-value": unref(value),
  53489. disabled: unref(_disabled),
  53490. clearable: _ctx.clearable,
  53491. "clear-icon": _ctx.clearIcon,
  53492. size: _ctx.size,
  53493. effect: _ctx.effect,
  53494. placeholder: _ctx.placeholder,
  53495. "default-first-option": "",
  53496. filterable: _ctx.editable,
  53497. "empty-values": _ctx.emptyValues,
  53498. "value-on-clear": _ctx.valueOnClear,
  53499. "popper-class": _ctx.popperClass,
  53500. "popper-style": _ctx.popperStyle,
  53501. "onUpdate:modelValue": (event) => _ctx.$emit(unref(UPDATE_MODEL_EVENT), event),
  53502. onChange: (event) => _ctx.$emit(unref(CHANGE_EVENT), event),
  53503. onBlur: (event) => _ctx.$emit("blur", event),
  53504. onFocus: (event) => _ctx.$emit("focus", event),
  53505. onClear: () => _ctx.$emit("clear")
  53506. }, {
  53507. prefix: withCtx(() => [
  53508. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  53509. key: 0,
  53510. class: normalizeClass(unref(nsInput).e("prefix-icon"))
  53511. }, {
  53512. default: withCtx(() => [
  53513. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  53514. ]),
  53515. _: 1
  53516. }, 8, ["class"])) : createCommentVNode("v-if", true)
  53517. ]),
  53518. default: withCtx(() => [
  53519. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item) => {
  53520. return openBlock(), createBlock(unref(ElOption), {
  53521. key: item.value,
  53522. label: item.value,
  53523. value: item.value,
  53524. disabled: item.disabled
  53525. }, null, 8, ["label", "value", "disabled"]);
  53526. }), 128))
  53527. ]),
  53528. _: 1
  53529. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable", "empty-values", "value-on-clear", "popper-class", "popper-style", "onUpdate:modelValue", "onChange", "onBlur", "onFocus", "onClear"]);
  53530. };
  53531. }
  53532. });
  53533. var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "time-select.vue"]]);
  53534. const ElTimeSelect = withInstall(TimeSelect);
  53535. const TIMELINE_INJECTION_KEY = "timeline";
  53536. const Timeline = defineComponent({
  53537. name: "ElTimeline",
  53538. setup(_, { slots }) {
  53539. const ns = useNamespace("timeline");
  53540. provide(TIMELINE_INJECTION_KEY, slots);
  53541. return () => {
  53542. return h$1("ul", { class: [ns.b()] }, [renderSlot(slots, "default")]);
  53543. };
  53544. }
  53545. });
  53546. var Timeline$1 = Timeline;
  53547. const timelineItemProps = buildProps({
  53548. timestamp: {
  53549. type: String,
  53550. default: ""
  53551. },
  53552. hideTimestamp: Boolean,
  53553. center: Boolean,
  53554. placement: {
  53555. type: String,
  53556. values: ["top", "bottom"],
  53557. default: "bottom"
  53558. },
  53559. type: {
  53560. type: String,
  53561. values: ["primary", "success", "warning", "danger", "info"],
  53562. default: ""
  53563. },
  53564. color: {
  53565. type: String,
  53566. default: ""
  53567. },
  53568. size: {
  53569. type: String,
  53570. values: ["normal", "large"],
  53571. default: "normal"
  53572. },
  53573. icon: {
  53574. type: iconPropType
  53575. },
  53576. hollow: Boolean
  53577. });
  53578. const __default__$n = defineComponent({
  53579. name: "ElTimelineItem"
  53580. });
  53581. const _sfc_main$s = /* @__PURE__ */ defineComponent({
  53582. ...__default__$n,
  53583. props: timelineItemProps,
  53584. setup(__props) {
  53585. const props = __props;
  53586. const ns = useNamespace("timeline-item");
  53587. const defaultNodeKls = computed(() => [
  53588. ns.e("node"),
  53589. ns.em("node", props.size || ""),
  53590. ns.em("node", props.type || ""),
  53591. ns.is("hollow", props.hollow)
  53592. ]);
  53593. return (_ctx, _cache) => {
  53594. return openBlock(), createElementBlock("li", {
  53595. class: normalizeClass([unref(ns).b(), { [unref(ns).e("center")]: _ctx.center }])
  53596. }, [
  53597. createElementVNode("div", {
  53598. class: normalizeClass(unref(ns).e("tail"))
  53599. }, null, 2),
  53600. !_ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  53601. key: 0,
  53602. class: normalizeClass(unref(defaultNodeKls)),
  53603. style: normalizeStyle({
  53604. backgroundColor: _ctx.color
  53605. })
  53606. }, [
  53607. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  53608. key: 0,
  53609. class: normalizeClass(unref(ns).e("icon"))
  53610. }, {
  53611. default: withCtx(() => [
  53612. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  53613. ]),
  53614. _: 1
  53615. }, 8, ["class"])) : createCommentVNode("v-if", true)
  53616. ], 6)) : createCommentVNode("v-if", true),
  53617. _ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  53618. key: 1,
  53619. class: normalizeClass(unref(ns).e("dot"))
  53620. }, [
  53621. renderSlot(_ctx.$slots, "dot")
  53622. ], 2)) : createCommentVNode("v-if", true),
  53623. createElementVNode("div", {
  53624. class: normalizeClass(unref(ns).e("wrapper"))
  53625. }, [
  53626. !_ctx.hideTimestamp && _ctx.placement === "top" ? (openBlock(), createElementBlock("div", {
  53627. key: 0,
  53628. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("top")])
  53629. }, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true),
  53630. createElementVNode("div", {
  53631. class: normalizeClass(unref(ns).e("content"))
  53632. }, [
  53633. renderSlot(_ctx.$slots, "default")
  53634. ], 2),
  53635. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (openBlock(), createElementBlock("div", {
  53636. key: 1,
  53637. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("bottom")])
  53638. }, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true)
  53639. ], 2)
  53640. ], 2);
  53641. };
  53642. }
  53643. });
  53644. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "timeline-item.vue"]]);
  53645. const ElTimeline = withInstall(Timeline$1, {
  53646. TimelineItem
  53647. });
  53648. const ElTimelineItem = withNoopInstall(TimelineItem);
  53649. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  53650. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  53651. const transferProps = buildProps({
  53652. data: {
  53653. type: definePropType(Array),
  53654. default: () => []
  53655. },
  53656. titles: {
  53657. type: definePropType(Array),
  53658. default: () => []
  53659. },
  53660. buttonTexts: {
  53661. type: definePropType(Array),
  53662. default: () => []
  53663. },
  53664. filterPlaceholder: String,
  53665. filterMethod: {
  53666. type: definePropType(Function)
  53667. },
  53668. leftDefaultChecked: {
  53669. type: definePropType(Array),
  53670. default: () => []
  53671. },
  53672. rightDefaultChecked: {
  53673. type: definePropType(Array),
  53674. default: () => []
  53675. },
  53676. renderContent: {
  53677. type: definePropType(Function)
  53678. },
  53679. modelValue: {
  53680. type: definePropType(Array),
  53681. default: () => []
  53682. },
  53683. format: {
  53684. type: definePropType(Object),
  53685. default: () => ({})
  53686. },
  53687. filterable: Boolean,
  53688. props: {
  53689. type: definePropType(Object),
  53690. default: () => mutable({
  53691. label: "label",
  53692. key: "key",
  53693. disabled: "disabled"
  53694. })
  53695. },
  53696. targetOrder: {
  53697. type: String,
  53698. values: ["original", "push", "unshift"],
  53699. default: "original"
  53700. },
  53701. validateEvent: {
  53702. type: Boolean,
  53703. default: true
  53704. }
  53705. });
  53706. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys);
  53707. const transferEmits = {
  53708. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction),
  53709. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value),
  53710. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  53711. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  53712. };
  53713. const CHECKED_CHANGE_EVENT = "checked-change";
  53714. const transferPanelProps = buildProps({
  53715. data: transferProps.data,
  53716. optionRender: {
  53717. type: definePropType(Function)
  53718. },
  53719. placeholder: String,
  53720. title: String,
  53721. filterable: Boolean,
  53722. format: transferProps.format,
  53723. filterMethod: transferProps.filterMethod,
  53724. defaultChecked: transferProps.leftDefaultChecked,
  53725. props: transferProps.props
  53726. });
  53727. const transferPanelEmits = {
  53728. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  53729. };
  53730. const usePropsAlias = (props) => {
  53731. const initProps = {
  53732. label: "label",
  53733. key: "key",
  53734. disabled: "disabled"
  53735. };
  53736. return computed(() => ({
  53737. ...initProps,
  53738. ...props.props
  53739. }));
  53740. };
  53741. const useCheck$1 = (props, panelState, emit) => {
  53742. const propsAlias = usePropsAlias(props);
  53743. const filteredData = computed(() => {
  53744. return props.data.filter((item) => {
  53745. if (isFunction$1(props.filterMethod)) {
  53746. return props.filterMethod(panelState.query, item);
  53747. } else {
  53748. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  53749. return label.toLowerCase().includes(panelState.query.toLowerCase());
  53750. }
  53751. });
  53752. });
  53753. const checkableData = computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  53754. const checkedSummary = computed(() => {
  53755. const checkedLength = panelState.checked.length;
  53756. const dataLength = props.data.length;
  53757. const { noChecked, hasChecked } = props.format;
  53758. if (noChecked && hasChecked) {
  53759. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  53760. } else {
  53761. return `${checkedLength}/${dataLength}`;
  53762. }
  53763. });
  53764. const isIndeterminate = computed(() => {
  53765. const checkedLength = panelState.checked.length;
  53766. return checkedLength > 0 && checkedLength < checkableData.value.length;
  53767. });
  53768. const updateAllChecked = () => {
  53769. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  53770. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  53771. };
  53772. const handleAllCheckedChange = (value) => {
  53773. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  53774. };
  53775. watch(() => panelState.checked, (val, oldVal) => {
  53776. updateAllChecked();
  53777. if (panelState.checkChangeByUser) {
  53778. const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v));
  53779. emit(CHECKED_CHANGE_EVENT, val, movedKeys);
  53780. } else {
  53781. emit(CHECKED_CHANGE_EVENT, val);
  53782. panelState.checkChangeByUser = true;
  53783. }
  53784. });
  53785. watch(checkableData, () => {
  53786. updateAllChecked();
  53787. });
  53788. watch(() => props.data, () => {
  53789. const checked = [];
  53790. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  53791. panelState.checked.forEach((item) => {
  53792. if (filteredDataKeys.includes(item)) {
  53793. checked.push(item);
  53794. }
  53795. });
  53796. panelState.checkChangeByUser = false;
  53797. panelState.checked = checked;
  53798. });
  53799. watch(() => props.defaultChecked, (val, oldVal) => {
  53800. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  53801. return;
  53802. const checked = [];
  53803. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  53804. val.forEach((item) => {
  53805. if (checkableDataKeys.includes(item)) {
  53806. checked.push(item);
  53807. }
  53808. });
  53809. panelState.checkChangeByUser = false;
  53810. panelState.checked = checked;
  53811. }, {
  53812. immediate: true
  53813. });
  53814. return {
  53815. filteredData,
  53816. checkableData,
  53817. checkedSummary,
  53818. isIndeterminate,
  53819. updateAllChecked,
  53820. handleAllCheckedChange
  53821. };
  53822. };
  53823. const useCheckedChange = (checkedState, emit) => {
  53824. const onSourceCheckedChange = (val, movedKeys) => {
  53825. checkedState.leftChecked = val;
  53826. if (!movedKeys)
  53827. return;
  53828. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  53829. };
  53830. const onTargetCheckedChange = (val, movedKeys) => {
  53831. checkedState.rightChecked = val;
  53832. if (!movedKeys)
  53833. return;
  53834. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  53835. };
  53836. return {
  53837. onSourceCheckedChange,
  53838. onTargetCheckedChange
  53839. };
  53840. };
  53841. const useComputedData = (props) => {
  53842. const propsAlias = usePropsAlias(props);
  53843. const dataObj = computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  53844. const sourceData = computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  53845. const targetData = computed(() => {
  53846. if (props.targetOrder === "original") {
  53847. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  53848. } else {
  53849. return props.modelValue.reduce((arr, cur) => {
  53850. const val = dataObj.value[cur];
  53851. if (val) {
  53852. arr.push(val);
  53853. }
  53854. return arr;
  53855. }, []);
  53856. }
  53857. });
  53858. return {
  53859. sourceData,
  53860. targetData
  53861. };
  53862. };
  53863. const useMove = (props, checkedState, emit) => {
  53864. const propsAlias = usePropsAlias(props);
  53865. const _emit = (value, direction, movedKeys) => {
  53866. emit(UPDATE_MODEL_EVENT, value);
  53867. emit(CHANGE_EVENT, value, direction, movedKeys);
  53868. };
  53869. const addToLeft = () => {
  53870. const currentValue = props.modelValue.slice();
  53871. checkedState.rightChecked.forEach((item) => {
  53872. const index = currentValue.indexOf(item);
  53873. if (index > -1) {
  53874. currentValue.splice(index, 1);
  53875. }
  53876. });
  53877. _emit(currentValue, "left", checkedState.rightChecked);
  53878. };
  53879. const addToRight = () => {
  53880. let currentValue = props.modelValue.slice();
  53881. const itemsToBeMoved = props.data.filter((item) => {
  53882. const itemKey = item[propsAlias.value.key];
  53883. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  53884. }).map((item) => item[propsAlias.value.key]);
  53885. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  53886. if (props.targetOrder === "original") {
  53887. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  53888. }
  53889. _emit(currentValue, "right", checkedState.leftChecked);
  53890. };
  53891. return {
  53892. addToLeft,
  53893. addToRight
  53894. };
  53895. };
  53896. const __default__$m = defineComponent({
  53897. name: "ElTransferPanel"
  53898. });
  53899. const _sfc_main$r = /* @__PURE__ */ defineComponent({
  53900. ...__default__$m,
  53901. props: transferPanelProps,
  53902. emits: transferPanelEmits,
  53903. setup(__props, { expose, emit }) {
  53904. const props = __props;
  53905. const slots = useSlots();
  53906. const OptionContent = ({ option }) => option;
  53907. const { t } = useLocale();
  53908. const ns = useNamespace("transfer");
  53909. const panelState = reactive({
  53910. checked: [],
  53911. allChecked: false,
  53912. query: "",
  53913. checkChangeByUser: true
  53914. });
  53915. const propsAlias = usePropsAlias(props);
  53916. const {
  53917. filteredData,
  53918. checkedSummary,
  53919. isIndeterminate,
  53920. handleAllCheckedChange
  53921. } = useCheck$1(props, panelState, emit);
  53922. const hasNoMatch = computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  53923. const hasFooter = computed(() => !isEmpty(slots.default()[0].children));
  53924. const { checked, allChecked, query } = toRefs(panelState);
  53925. expose({
  53926. query
  53927. });
  53928. return (_ctx, _cache) => {
  53929. return openBlock(), createElementBlock("div", {
  53930. class: normalizeClass(unref(ns).b("panel"))
  53931. }, [
  53932. createElementVNode("p", {
  53933. class: normalizeClass(unref(ns).be("panel", "header"))
  53934. }, [
  53935. createVNode(unref(ElCheckbox), {
  53936. modelValue: unref(allChecked),
  53937. "onUpdate:modelValue": ($event) => isRef(allChecked) ? allChecked.value = $event : null,
  53938. indeterminate: unref(isIndeterminate),
  53939. "validate-event": false,
  53940. onChange: unref(handleAllCheckedChange)
  53941. }, {
  53942. default: withCtx(() => [
  53943. createTextVNode(toDisplayString(_ctx.title) + " ", 1),
  53944. createElementVNode("span", null, toDisplayString(unref(checkedSummary)), 1)
  53945. ]),
  53946. _: 1
  53947. }, 8, ["modelValue", "onUpdate:modelValue", "indeterminate", "onChange"])
  53948. ], 2),
  53949. createElementVNode("div", {
  53950. class: normalizeClass([unref(ns).be("panel", "body"), unref(ns).is("with-footer", unref(hasFooter))])
  53951. }, [
  53952. _ctx.filterable ? (openBlock(), createBlock(unref(ElInput), {
  53953. key: 0,
  53954. modelValue: unref(query),
  53955. "onUpdate:modelValue": ($event) => isRef(query) ? query.value = $event : null,
  53956. class: normalizeClass(unref(ns).be("panel", "filter")),
  53957. size: "default",
  53958. placeholder: _ctx.placeholder,
  53959. "prefix-icon": unref(search_default),
  53960. clearable: "",
  53961. "validate-event": false
  53962. }, null, 8, ["modelValue", "onUpdate:modelValue", "class", "placeholder", "prefix-icon"])) : createCommentVNode("v-if", true),
  53963. withDirectives(createVNode(unref(ElCheckboxGroup$1), {
  53964. modelValue: unref(checked),
  53965. "onUpdate:modelValue": ($event) => isRef(checked) ? checked.value = $event : null,
  53966. "validate-event": false,
  53967. class: normalizeClass([unref(ns).is("filterable", _ctx.filterable), unref(ns).be("panel", "list")])
  53968. }, {
  53969. default: withCtx(() => [
  53970. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(filteredData), (item) => {
  53971. return openBlock(), createBlock(unref(ElCheckbox), {
  53972. key: item[unref(propsAlias).key],
  53973. class: normalizeClass(unref(ns).be("panel", "item")),
  53974. value: item[unref(propsAlias).key],
  53975. disabled: item[unref(propsAlias).disabled],
  53976. "validate-event": false
  53977. }, {
  53978. default: withCtx(() => {
  53979. var _a;
  53980. return [
  53981. createVNode(OptionContent, {
  53982. option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item)
  53983. }, null, 8, ["option"])
  53984. ];
  53985. }),
  53986. _: 2
  53987. }, 1032, ["class", "value", "disabled"]);
  53988. }), 128))
  53989. ]),
  53990. _: 1
  53991. }, 8, ["modelValue", "onUpdate:modelValue", "class"]), [
  53992. [vShow, !unref(hasNoMatch) && !unref(isEmpty)(_ctx.data)]
  53993. ]),
  53994. withDirectives(createElementVNode("div", {
  53995. class: normalizeClass(unref(ns).be("panel", "empty"))
  53996. }, [
  53997. renderSlot(_ctx.$slots, "empty", {}, () => [
  53998. createTextVNode(toDisplayString(unref(hasNoMatch) ? unref(t)("el.transfer.noMatch") : unref(t)("el.transfer.noData")), 1)
  53999. ])
  54000. ], 2), [
  54001. [vShow, unref(hasNoMatch) || unref(isEmpty)(_ctx.data)]
  54002. ])
  54003. ], 2),
  54004. unref(hasFooter) ? (openBlock(), createElementBlock("p", {
  54005. key: 0,
  54006. class: normalizeClass(unref(ns).be("panel", "footer"))
  54007. }, [
  54008. renderSlot(_ctx.$slots, "default")
  54009. ], 2)) : createCommentVNode("v-if", true)
  54010. ], 2);
  54011. };
  54012. }
  54013. });
  54014. var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__file", "transfer-panel.vue"]]);
  54015. const __default__$l = defineComponent({
  54016. name: "ElTransfer"
  54017. });
  54018. const _sfc_main$q = /* @__PURE__ */ defineComponent({
  54019. ...__default__$l,
  54020. props: transferProps,
  54021. emits: transferEmits,
  54022. setup(__props, { expose, emit }) {
  54023. const props = __props;
  54024. const slots = useSlots();
  54025. const { t } = useLocale();
  54026. const ns = useNamespace("transfer");
  54027. const { formItem } = useFormItem();
  54028. const checkedState = reactive({
  54029. leftChecked: [],
  54030. rightChecked: []
  54031. });
  54032. const propsAlias = usePropsAlias(props);
  54033. const { sourceData, targetData } = useComputedData(props);
  54034. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  54035. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  54036. const leftPanel = ref();
  54037. const rightPanel = ref();
  54038. const clearQuery = (which) => {
  54039. switch (which) {
  54040. case "left":
  54041. leftPanel.value.query = "";
  54042. break;
  54043. case "right":
  54044. rightPanel.value.query = "";
  54045. break;
  54046. }
  54047. };
  54048. const hasButtonTexts = computed(() => props.buttonTexts.length === 2);
  54049. const leftPanelTitle = computed(() => props.titles[0] || t("el.transfer.titles.0"));
  54050. const rightPanelTitle = computed(() => props.titles[1] || t("el.transfer.titles.1"));
  54051. const panelFilterPlaceholder = computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  54052. watch(() => props.modelValue, () => {
  54053. var _a;
  54054. if (props.validateEvent) {
  54055. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn(err));
  54056. }
  54057. });
  54058. const optionRender = computed(() => (option) => {
  54059. var _a;
  54060. if (props.renderContent)
  54061. return props.renderContent(h$1, option);
  54062. const defaultSlotVNodes = (((_a = slots.default) == null ? void 0 : _a.call(slots, { option })) || []).filter((node) => node.type !== Comment);
  54063. if (defaultSlotVNodes.length) {
  54064. return defaultSlotVNodes;
  54065. }
  54066. return h$1("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  54067. });
  54068. expose({
  54069. clearQuery,
  54070. leftPanel,
  54071. rightPanel
  54072. });
  54073. return (_ctx, _cache) => {
  54074. return openBlock(), createElementBlock("div", {
  54075. class: normalizeClass(unref(ns).b())
  54076. }, [
  54077. createVNode(TransferPanel, {
  54078. ref_key: "leftPanel",
  54079. ref: leftPanel,
  54080. data: unref(sourceData),
  54081. "option-render": unref(optionRender),
  54082. placeholder: unref(panelFilterPlaceholder),
  54083. title: unref(leftPanelTitle),
  54084. filterable: _ctx.filterable,
  54085. format: _ctx.format,
  54086. "filter-method": _ctx.filterMethod,
  54087. "default-checked": _ctx.leftDefaultChecked,
  54088. props: props.props,
  54089. onCheckedChange: unref(onSourceCheckedChange)
  54090. }, {
  54091. empty: withCtx(() => [
  54092. renderSlot(_ctx.$slots, "left-empty")
  54093. ]),
  54094. default: withCtx(() => [
  54095. renderSlot(_ctx.$slots, "left-footer")
  54096. ]),
  54097. _: 3
  54098. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  54099. createElementVNode("div", {
  54100. class: normalizeClass(unref(ns).e("buttons"))
  54101. }, [
  54102. createVNode(unref(ElButton), {
  54103. type: "primary",
  54104. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", unref(hasButtonTexts))]),
  54105. disabled: unref(isEmpty)(checkedState.rightChecked),
  54106. onClick: unref(addToLeft)
  54107. }, {
  54108. default: withCtx(() => [
  54109. createVNode(unref(ElIcon), null, {
  54110. default: withCtx(() => [
  54111. createVNode(unref(arrow_left_default))
  54112. ]),
  54113. _: 1
  54114. }),
  54115. !unref(isUndefined)(_ctx.buttonTexts[0]) ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.buttonTexts[0]), 1)) : createCommentVNode("v-if", true)
  54116. ]),
  54117. _: 1
  54118. }, 8, ["class", "disabled", "onClick"]),
  54119. createVNode(unref(ElButton), {
  54120. type: "primary",
  54121. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", unref(hasButtonTexts))]),
  54122. disabled: unref(isEmpty)(checkedState.leftChecked),
  54123. onClick: unref(addToRight)
  54124. }, {
  54125. default: withCtx(() => [
  54126. !unref(isUndefined)(_ctx.buttonTexts[1]) ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.buttonTexts[1]), 1)) : createCommentVNode("v-if", true),
  54127. createVNode(unref(ElIcon), null, {
  54128. default: withCtx(() => [
  54129. createVNode(unref(arrow_right_default))
  54130. ]),
  54131. _: 1
  54132. })
  54133. ]),
  54134. _: 1
  54135. }, 8, ["class", "disabled", "onClick"])
  54136. ], 2),
  54137. createVNode(TransferPanel, {
  54138. ref_key: "rightPanel",
  54139. ref: rightPanel,
  54140. data: unref(targetData),
  54141. "option-render": unref(optionRender),
  54142. placeholder: unref(panelFilterPlaceholder),
  54143. filterable: _ctx.filterable,
  54144. format: _ctx.format,
  54145. "filter-method": _ctx.filterMethod,
  54146. title: unref(rightPanelTitle),
  54147. "default-checked": _ctx.rightDefaultChecked,
  54148. props: props.props,
  54149. onCheckedChange: unref(onTargetCheckedChange)
  54150. }, {
  54151. empty: withCtx(() => [
  54152. renderSlot(_ctx.$slots, "right-empty")
  54153. ]),
  54154. default: withCtx(() => [
  54155. renderSlot(_ctx.$slots, "right-footer")
  54156. ]),
  54157. _: 3
  54158. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  54159. ], 2);
  54160. };
  54161. }
  54162. });
  54163. var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__file", "transfer.vue"]]);
  54164. const ElTransfer = withInstall(Transfer);
  54165. const NODE_KEY = "$treeNodeId";
  54166. const markNodeData = function(node, data) {
  54167. if (!data || data[NODE_KEY])
  54168. return;
  54169. Object.defineProperty(data, NODE_KEY, {
  54170. value: node.id,
  54171. enumerable: false,
  54172. configurable: false,
  54173. writable: false
  54174. });
  54175. };
  54176. const getNodeKey = (key, data) => data == null ? void 0 : data[key || NODE_KEY];
  54177. const handleCurrentChange = (store, emit, setCurrent) => {
  54178. const preCurrentNode = store.value.currentNode;
  54179. setCurrent();
  54180. const currentNode = store.value.currentNode;
  54181. if (preCurrentNode === currentNode)
  54182. return;
  54183. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  54184. };
  54185. const getChildState = (node) => {
  54186. let all = true;
  54187. let none = true;
  54188. let allWithoutDisable = true;
  54189. for (let i = 0, j = node.length; i < j; i++) {
  54190. const n = node[i];
  54191. if (n.checked !== true || n.indeterminate) {
  54192. all = false;
  54193. if (!n.disabled) {
  54194. allWithoutDisable = false;
  54195. }
  54196. }
  54197. if (n.checked !== false || n.indeterminate) {
  54198. none = false;
  54199. }
  54200. }
  54201. return { all, none, allWithoutDisable, half: !all && !none };
  54202. };
  54203. const reInitChecked = function(node) {
  54204. if (node.childNodes.length === 0 || node.loading)
  54205. return;
  54206. const { all, none, half } = getChildState(node.childNodes);
  54207. if (all) {
  54208. node.checked = true;
  54209. node.indeterminate = false;
  54210. } else if (half) {
  54211. node.checked = false;
  54212. node.indeterminate = true;
  54213. } else if (none) {
  54214. node.checked = false;
  54215. node.indeterminate = false;
  54216. }
  54217. const parent = node.parent;
  54218. if (!parent || parent.level === 0)
  54219. return;
  54220. if (!node.store.checkStrictly) {
  54221. reInitChecked(parent);
  54222. }
  54223. };
  54224. const getPropertyFromData = function(node, prop) {
  54225. const props = node.store.props;
  54226. const data = node.data || {};
  54227. const config = props[prop];
  54228. if (isFunction$1(config)) {
  54229. return config(data, node);
  54230. } else if (isString$1(config)) {
  54231. return data[config];
  54232. } else if (isUndefined(config)) {
  54233. const dataProp = data[prop];
  54234. return isUndefined(dataProp) ? "" : dataProp;
  54235. }
  54236. };
  54237. const setCanFocus = function(childNodes, focus) {
  54238. childNodes.forEach((item) => {
  54239. item.canFocus = focus;
  54240. setCanFocus(item.childNodes, focus);
  54241. });
  54242. };
  54243. let nodeIdSeed = 0;
  54244. class Node$1 {
  54245. constructor(options) {
  54246. this.isLeafByUser = void 0;
  54247. this.isLeaf = void 0;
  54248. this.id = nodeIdSeed++;
  54249. this.text = null;
  54250. this.checked = false;
  54251. this.indeterminate = false;
  54252. this.data = null;
  54253. this.expanded = false;
  54254. this.parent = null;
  54255. this.visible = true;
  54256. this.isCurrent = false;
  54257. this.canFocus = false;
  54258. for (const name in options) {
  54259. if (hasOwn(options, name)) {
  54260. this[name] = options[name];
  54261. }
  54262. }
  54263. this.level = 0;
  54264. this.loaded = false;
  54265. this.childNodes = [];
  54266. this.loading = false;
  54267. if (this.parent) {
  54268. this.level = this.parent.level + 1;
  54269. }
  54270. }
  54271. initialize() {
  54272. var _a;
  54273. const store = this.store;
  54274. if (!store) {
  54275. throw new Error("[Node]store is required!");
  54276. }
  54277. store.registerNode(this);
  54278. const props = store.props;
  54279. if (props && typeof props.isLeaf !== "undefined") {
  54280. const isLeaf = getPropertyFromData(this, "isLeaf");
  54281. if (isBoolean(isLeaf)) {
  54282. this.isLeafByUser = isLeaf;
  54283. }
  54284. }
  54285. if (store.lazy !== true && this.data) {
  54286. this.setData(this.data);
  54287. if (store.defaultExpandAll) {
  54288. this.expanded = true;
  54289. this.canFocus = true;
  54290. }
  54291. } else if (this.level > 0 && store.lazy && store.defaultExpandAll && !this.isLeafByUser) {
  54292. this.expand();
  54293. }
  54294. if (!isArray$1(this.data)) {
  54295. markNodeData(this, this.data);
  54296. }
  54297. if (!this.data)
  54298. return;
  54299. const defaultExpandedKeys = store.defaultExpandedKeys;
  54300. const key = store.key;
  54301. if (key && !isNil(this.key) && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  54302. this.expand(null, store.autoExpandParent);
  54303. }
  54304. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  54305. store.currentNode = this;
  54306. store.currentNode.isCurrent = true;
  54307. }
  54308. if (store.lazy) {
  54309. store._initDefaultCheckedNode(this);
  54310. }
  54311. this.updateLeafState();
  54312. if (this.level === 1 || ((_a = this.parent) == null ? void 0 : _a.expanded) === true)
  54313. this.canFocus = true;
  54314. }
  54315. setData(data) {
  54316. if (!isArray$1(data)) {
  54317. markNodeData(this, data);
  54318. }
  54319. this.data = data;
  54320. this.childNodes = [];
  54321. let children;
  54322. if (this.level === 0 && isArray$1(this.data)) {
  54323. children = this.data;
  54324. } else {
  54325. children = getPropertyFromData(this, "children") || [];
  54326. }
  54327. for (let i = 0, j = children.length; i < j; i++) {
  54328. this.insertChild({ data: children[i] });
  54329. }
  54330. }
  54331. get label() {
  54332. return getPropertyFromData(this, "label");
  54333. }
  54334. get key() {
  54335. const nodeKey = this.store.key;
  54336. if (this.data)
  54337. return this.data[nodeKey];
  54338. return null;
  54339. }
  54340. get disabled() {
  54341. return getPropertyFromData(this, "disabled");
  54342. }
  54343. get nextSibling() {
  54344. const parent = this.parent;
  54345. if (parent) {
  54346. const index = parent.childNodes.indexOf(this);
  54347. if (index > -1) {
  54348. return parent.childNodes[index + 1];
  54349. }
  54350. }
  54351. return null;
  54352. }
  54353. get previousSibling() {
  54354. const parent = this.parent;
  54355. if (parent) {
  54356. const index = parent.childNodes.indexOf(this);
  54357. if (index > -1) {
  54358. return index > 0 ? parent.childNodes[index - 1] : null;
  54359. }
  54360. }
  54361. return null;
  54362. }
  54363. contains(target, deep = true) {
  54364. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  54365. }
  54366. remove() {
  54367. const parent = this.parent;
  54368. if (parent) {
  54369. parent.removeChild(this);
  54370. }
  54371. }
  54372. insertChild(child, index, batch) {
  54373. if (!child)
  54374. throw new Error("InsertChild error: child is required.");
  54375. if (!(child instanceof Node$1)) {
  54376. if (!batch) {
  54377. const children = this.getChildren(true);
  54378. if (!(children == null ? void 0 : children.includes(child.data))) {
  54379. if (isUndefined(index) || index < 0) {
  54380. children == null ? void 0 : children.push(child.data);
  54381. } else {
  54382. children == null ? void 0 : children.splice(index, 0, child.data);
  54383. }
  54384. }
  54385. }
  54386. Object.assign(child, {
  54387. parent: this,
  54388. store: this.store
  54389. });
  54390. child = reactive(new Node$1(child));
  54391. if (child instanceof Node$1) {
  54392. child.initialize();
  54393. }
  54394. }
  54395. child.level = this.level + 1;
  54396. if (isUndefined(index) || index < 0) {
  54397. this.childNodes.push(child);
  54398. } else {
  54399. this.childNodes.splice(index, 0, child);
  54400. }
  54401. this.updateLeafState();
  54402. }
  54403. insertBefore(child, ref) {
  54404. let index;
  54405. if (ref) {
  54406. index = this.childNodes.indexOf(ref);
  54407. }
  54408. this.insertChild(child, index);
  54409. }
  54410. insertAfter(child, ref) {
  54411. let index;
  54412. if (ref) {
  54413. index = this.childNodes.indexOf(ref);
  54414. if (index !== -1)
  54415. index += 1;
  54416. }
  54417. this.insertChild(child, index);
  54418. }
  54419. removeChild(child) {
  54420. const children = this.getChildren() || [];
  54421. const dataIndex = children.indexOf(child.data);
  54422. if (dataIndex > -1) {
  54423. children.splice(dataIndex, 1);
  54424. }
  54425. const index = this.childNodes.indexOf(child);
  54426. if (index > -1) {
  54427. this.store && this.store.deregisterNode(child);
  54428. child.parent = null;
  54429. this.childNodes.splice(index, 1);
  54430. }
  54431. this.updateLeafState();
  54432. }
  54433. removeChildByData(data) {
  54434. let targetNode = null;
  54435. for (let i = 0; i < this.childNodes.length; i++) {
  54436. if (this.childNodes[i].data === data) {
  54437. targetNode = this.childNodes[i];
  54438. break;
  54439. }
  54440. }
  54441. if (targetNode) {
  54442. this.removeChild(targetNode);
  54443. }
  54444. }
  54445. expand(callback, expandParent) {
  54446. const done = () => {
  54447. if (expandParent) {
  54448. let parent = this.parent;
  54449. while (parent && parent.level > 0) {
  54450. parent.expanded = true;
  54451. parent = parent.parent;
  54452. }
  54453. }
  54454. this.expanded = true;
  54455. if (callback)
  54456. callback();
  54457. setCanFocus(this.childNodes, true);
  54458. };
  54459. if (this.shouldLoadData()) {
  54460. this.loadData((data) => {
  54461. if (isArray$1(data)) {
  54462. if (this.checked) {
  54463. this.setChecked(true, true);
  54464. } else if (!this.store.checkStrictly) {
  54465. reInitChecked(this);
  54466. }
  54467. done();
  54468. }
  54469. });
  54470. } else {
  54471. done();
  54472. }
  54473. }
  54474. doCreateChildren(array, defaultProps = {}) {
  54475. array.forEach((item) => {
  54476. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  54477. });
  54478. }
  54479. collapse() {
  54480. this.expanded = false;
  54481. setCanFocus(this.childNodes, false);
  54482. }
  54483. shouldLoadData() {
  54484. return Boolean(this.store.lazy === true && this.store.load && !this.loaded);
  54485. }
  54486. updateLeafState() {
  54487. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  54488. this.isLeaf = this.isLeafByUser;
  54489. return;
  54490. }
  54491. const childNodes = this.childNodes;
  54492. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  54493. this.isLeaf = !childNodes || childNodes.length === 0;
  54494. return;
  54495. }
  54496. this.isLeaf = false;
  54497. }
  54498. setChecked(value, deep, recursion, passValue) {
  54499. this.indeterminate = value === "half";
  54500. this.checked = value === true;
  54501. if (this.store.checkStrictly)
  54502. return;
  54503. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  54504. const { all, allWithoutDisable } = getChildState(this.childNodes);
  54505. if (!this.isLeaf && !all && allWithoutDisable) {
  54506. this.checked = false;
  54507. value = false;
  54508. }
  54509. const handleDescendants = () => {
  54510. if (deep) {
  54511. const childNodes = this.childNodes;
  54512. for (let i = 0, j = childNodes.length; i < j; i++) {
  54513. const child = childNodes[i];
  54514. passValue = passValue || value !== false;
  54515. const isCheck = child.disabled ? child.checked : passValue;
  54516. child.setChecked(isCheck, deep, true, passValue);
  54517. }
  54518. const { half, all: all2 } = getChildState(childNodes);
  54519. if (!all2) {
  54520. this.checked = all2;
  54521. this.indeterminate = half;
  54522. }
  54523. }
  54524. };
  54525. if (this.shouldLoadData()) {
  54526. this.loadData(() => {
  54527. handleDescendants();
  54528. reInitChecked(this);
  54529. }, {
  54530. checked: value !== false
  54531. });
  54532. return;
  54533. } else {
  54534. handleDescendants();
  54535. }
  54536. }
  54537. const parent = this.parent;
  54538. if (!parent || parent.level === 0)
  54539. return;
  54540. if (!recursion) {
  54541. reInitChecked(parent);
  54542. }
  54543. }
  54544. getChildren(forceInit = false) {
  54545. if (this.level === 0)
  54546. return this.data;
  54547. const data = this.data;
  54548. if (!data)
  54549. return null;
  54550. const props = this.store.props;
  54551. let children = "children";
  54552. if (props) {
  54553. children = props.children || "children";
  54554. }
  54555. if (isUndefined(data[children])) {
  54556. data[children] = null;
  54557. }
  54558. if (forceInit && !data[children]) {
  54559. data[children] = [];
  54560. }
  54561. return data[children];
  54562. }
  54563. updateChildren() {
  54564. const newData = this.getChildren() || [];
  54565. const oldData = this.childNodes.map((node) => node.data);
  54566. const newDataMap = {};
  54567. const newNodes = [];
  54568. newData.forEach((item, index) => {
  54569. const key = item[NODE_KEY];
  54570. const isNodeExists = !!key && oldData.some((data) => (data == null ? void 0 : data[NODE_KEY]) === key);
  54571. if (isNodeExists) {
  54572. newDataMap[key] = { index, data: item };
  54573. } else {
  54574. newNodes.push({ index, data: item });
  54575. }
  54576. });
  54577. if (!this.store.lazy) {
  54578. oldData.forEach((item) => {
  54579. if (!newDataMap[item == null ? void 0 : item[NODE_KEY]])
  54580. this.removeChildByData(item);
  54581. });
  54582. }
  54583. newNodes.forEach(({ index, data }) => {
  54584. this.insertChild({ data }, index);
  54585. });
  54586. this.updateLeafState();
  54587. }
  54588. loadData(callback, defaultProps = {}) {
  54589. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  54590. this.loading = true;
  54591. const resolve = (children) => {
  54592. this.childNodes = [];
  54593. this.doCreateChildren(children, defaultProps);
  54594. this.loaded = true;
  54595. this.loading = false;
  54596. this.updateLeafState();
  54597. if (callback) {
  54598. callback.call(this, children);
  54599. }
  54600. };
  54601. const reject = () => {
  54602. this.loading = false;
  54603. };
  54604. this.store.load(this, resolve, reject);
  54605. } else {
  54606. if (callback) {
  54607. callback.call(this);
  54608. }
  54609. }
  54610. }
  54611. eachNode(callback) {
  54612. const arr = [this];
  54613. while (arr.length) {
  54614. const node = arr.shift();
  54615. arr.unshift(...node.childNodes);
  54616. callback(node);
  54617. }
  54618. }
  54619. reInitChecked() {
  54620. if (this.store.checkStrictly)
  54621. return;
  54622. reInitChecked(this);
  54623. }
  54624. }
  54625. var Node$2 = Node$1;
  54626. class TreeStore {
  54627. constructor(options) {
  54628. this.lazy = false;
  54629. this.checkStrictly = false;
  54630. this.autoExpandParent = false;
  54631. this.defaultExpandAll = false;
  54632. this.checkDescendants = false;
  54633. this.currentNode = null;
  54634. this.currentNodeKey = null;
  54635. for (const option in options) {
  54636. if (hasOwn(options, option)) {
  54637. this[option] = options[option];
  54638. }
  54639. }
  54640. this.nodesMap = {};
  54641. }
  54642. initialize() {
  54643. this.root = new Node$2({
  54644. data: this.data,
  54645. store: this
  54646. });
  54647. this.root.initialize();
  54648. if (this.lazy && this.load) {
  54649. const loadFn = this.load;
  54650. loadFn(this.root, (data) => {
  54651. this.root.doCreateChildren(data);
  54652. this._initDefaultCheckedNodes();
  54653. }, NOOP);
  54654. } else {
  54655. this._initDefaultCheckedNodes();
  54656. }
  54657. }
  54658. filter(value) {
  54659. const filterNodeMethod = this.filterNodeMethod;
  54660. const lazy = this.lazy;
  54661. const traverse = async function(node) {
  54662. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  54663. for (const [index, child] of childNodes.entries()) {
  54664. child.visible = !!(filterNodeMethod == null ? void 0 : filterNodeMethod.call(child, value, child.data, child));
  54665. if (index % 80 === 0 && index > 0) {
  54666. await nextTick();
  54667. }
  54668. await traverse(child);
  54669. }
  54670. if (!node.visible && childNodes.length) {
  54671. let allHidden = true;
  54672. allHidden = !childNodes.some((child) => child.visible);
  54673. if (node.root) {
  54674. node.root.visible = allHidden === false;
  54675. } else {
  54676. node.visible = allHidden === false;
  54677. }
  54678. }
  54679. if (!value)
  54680. return;
  54681. if (node.visible && !node.isLeaf) {
  54682. if (!lazy || node.loaded) {
  54683. node.expand();
  54684. }
  54685. }
  54686. };
  54687. traverse(this);
  54688. }
  54689. setData(newVal) {
  54690. const instanceChanged = newVal !== this.root.data;
  54691. if (instanceChanged) {
  54692. this.nodesMap = {};
  54693. this.root.setData(newVal);
  54694. this._initDefaultCheckedNodes();
  54695. this.setCurrentNodeKey(this.currentNodeKey);
  54696. } else {
  54697. this.root.updateChildren();
  54698. }
  54699. }
  54700. getNode(data) {
  54701. if (data instanceof Node$2)
  54702. return data;
  54703. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  54704. return this.nodesMap[key] || null;
  54705. }
  54706. insertBefore(data, refData) {
  54707. var _a;
  54708. const refNode = this.getNode(refData);
  54709. (_a = refNode.parent) == null ? void 0 : _a.insertBefore({ data }, refNode);
  54710. }
  54711. insertAfter(data, refData) {
  54712. var _a;
  54713. const refNode = this.getNode(refData);
  54714. (_a = refNode.parent) == null ? void 0 : _a.insertAfter({ data }, refNode);
  54715. }
  54716. remove(data) {
  54717. const node = this.getNode(data);
  54718. if (node && node.parent) {
  54719. if (node === this.currentNode) {
  54720. this.currentNode = null;
  54721. }
  54722. node.parent.removeChild(node);
  54723. }
  54724. }
  54725. append(data, parentData) {
  54726. const parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
  54727. if (parentNode) {
  54728. parentNode.insertChild({ data });
  54729. }
  54730. }
  54731. _initDefaultCheckedNodes() {
  54732. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  54733. const nodesMap = this.nodesMap;
  54734. defaultCheckedKeys.forEach((checkedKey) => {
  54735. const node = nodesMap[checkedKey];
  54736. if (node) {
  54737. node.setChecked(true, !this.checkStrictly);
  54738. }
  54739. });
  54740. }
  54741. _initDefaultCheckedNode(node) {
  54742. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  54743. if (!isNil(node.key) && defaultCheckedKeys.includes(node.key)) {
  54744. node.setChecked(true, !this.checkStrictly);
  54745. }
  54746. }
  54747. setDefaultCheckedKey(newVal) {
  54748. if (newVal !== this.defaultCheckedKeys) {
  54749. this.defaultCheckedKeys = newVal;
  54750. this._initDefaultCheckedNodes();
  54751. }
  54752. }
  54753. registerNode(node) {
  54754. const key = this.key;
  54755. if (!node || !node.data)
  54756. return;
  54757. if (!key) {
  54758. this.nodesMap[node.id] = node;
  54759. } else {
  54760. const nodeKey = node.key;
  54761. if (!isNil(nodeKey))
  54762. this.nodesMap[nodeKey] = node;
  54763. }
  54764. }
  54765. deregisterNode(node) {
  54766. const key = this.key;
  54767. if (!key || !node || !node.data)
  54768. return;
  54769. node.childNodes.forEach((child) => {
  54770. this.deregisterNode(child);
  54771. });
  54772. delete this.nodesMap[node.key];
  54773. }
  54774. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  54775. const checkedNodes = [];
  54776. const traverse = function(node) {
  54777. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  54778. childNodes.forEach((child) => {
  54779. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  54780. checkedNodes.push(child.data);
  54781. }
  54782. traverse(child);
  54783. });
  54784. };
  54785. traverse(this);
  54786. return checkedNodes;
  54787. }
  54788. getCheckedKeys(leafOnly = false) {
  54789. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  54790. }
  54791. getHalfCheckedNodes() {
  54792. const nodes = [];
  54793. const traverse = function(node) {
  54794. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  54795. childNodes.forEach((child) => {
  54796. if (child.indeterminate) {
  54797. nodes.push(child.data);
  54798. }
  54799. traverse(child);
  54800. });
  54801. };
  54802. traverse(this);
  54803. return nodes;
  54804. }
  54805. getHalfCheckedKeys() {
  54806. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  54807. }
  54808. _getAllNodes() {
  54809. const allNodes = [];
  54810. const nodesMap = this.nodesMap;
  54811. for (const nodeKey in nodesMap) {
  54812. if (hasOwn(nodesMap, nodeKey)) {
  54813. allNodes.push(nodesMap[nodeKey]);
  54814. }
  54815. }
  54816. return allNodes;
  54817. }
  54818. updateChildren(key, data) {
  54819. const node = this.nodesMap[key];
  54820. if (!node)
  54821. return;
  54822. const childNodes = node.childNodes;
  54823. for (let i = childNodes.length - 1; i >= 0; i--) {
  54824. const child = childNodes[i];
  54825. this.remove(child.data);
  54826. }
  54827. for (let i = 0, j = data.length; i < j; i++) {
  54828. const child = data[i];
  54829. this.append(child, node.data);
  54830. }
  54831. }
  54832. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  54833. const allNodes = this._getAllNodes().sort((a, b) => a.level - b.level);
  54834. const cache = /* @__PURE__ */ Object.create(null);
  54835. const keys = Object.keys(checkedKeys);
  54836. allNodes.forEach((node) => node.setChecked(false, false));
  54837. const cacheCheckedChild = (node) => {
  54838. node.childNodes.forEach((child) => {
  54839. var _a;
  54840. cache[child.data[key]] = true;
  54841. if ((_a = child.childNodes) == null ? void 0 : _a.length) {
  54842. cacheCheckedChild(child);
  54843. }
  54844. });
  54845. };
  54846. for (let i = 0, j = allNodes.length; i < j; i++) {
  54847. const node = allNodes[i];
  54848. const nodeKey = node.data[key].toString();
  54849. const checked = keys.includes(nodeKey);
  54850. if (!checked) {
  54851. if (node.checked && !cache[nodeKey]) {
  54852. node.setChecked(false, false);
  54853. }
  54854. continue;
  54855. }
  54856. if (node.childNodes.length) {
  54857. cacheCheckedChild(node);
  54858. }
  54859. if (node.isLeaf || this.checkStrictly) {
  54860. node.setChecked(true, false);
  54861. continue;
  54862. }
  54863. node.setChecked(true, true);
  54864. if (leafOnly) {
  54865. node.setChecked(false, false);
  54866. const traverse = function(node2) {
  54867. const childNodes = node2.childNodes;
  54868. childNodes.forEach((child) => {
  54869. if (!child.isLeaf) {
  54870. child.setChecked(false, false);
  54871. }
  54872. traverse(child);
  54873. });
  54874. };
  54875. traverse(node);
  54876. }
  54877. }
  54878. }
  54879. setCheckedNodes(array, leafOnly = false) {
  54880. const key = this.key;
  54881. const checkedKeys = {};
  54882. array.forEach((item) => {
  54883. checkedKeys[(item || {})[key]] = true;
  54884. });
  54885. this._setCheckedKeys(key, leafOnly, checkedKeys);
  54886. }
  54887. setCheckedKeys(keys, leafOnly = false) {
  54888. this.defaultCheckedKeys = keys;
  54889. const key = this.key;
  54890. const checkedKeys = {};
  54891. keys.forEach((key2) => {
  54892. checkedKeys[key2] = true;
  54893. });
  54894. this._setCheckedKeys(key, leafOnly, checkedKeys);
  54895. }
  54896. setDefaultExpandedKeys(keys) {
  54897. keys = keys || [];
  54898. this.defaultExpandedKeys = keys;
  54899. keys.forEach((key) => {
  54900. const node = this.getNode(key);
  54901. if (node)
  54902. node.expand(null, this.autoExpandParent);
  54903. });
  54904. }
  54905. setChecked(data, checked, deep) {
  54906. const node = this.getNode(data);
  54907. if (node) {
  54908. node.setChecked(!!checked, deep);
  54909. }
  54910. }
  54911. getCurrentNode() {
  54912. return this.currentNode;
  54913. }
  54914. setCurrentNode(currentNode) {
  54915. const prevCurrentNode = this.currentNode;
  54916. if (prevCurrentNode) {
  54917. prevCurrentNode.isCurrent = false;
  54918. }
  54919. this.currentNode = currentNode;
  54920. this.currentNode.isCurrent = true;
  54921. }
  54922. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  54923. var _a;
  54924. const key = node[this.key];
  54925. const currNode = this.nodesMap[key];
  54926. this.setCurrentNode(currNode);
  54927. if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) {
  54928. (_a = this.currentNode.parent) == null ? void 0 : _a.expand(null, true);
  54929. }
  54930. }
  54931. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  54932. var _a;
  54933. this.currentNodeKey = key;
  54934. if (isPropAbsent(key)) {
  54935. this.currentNode && (this.currentNode.isCurrent = false);
  54936. this.currentNode = null;
  54937. return;
  54938. }
  54939. const node = this.getNode(key);
  54940. if (node) {
  54941. this.setCurrentNode(node);
  54942. if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) {
  54943. (_a = this.currentNode.parent) == null ? void 0 : _a.expand(null, true);
  54944. }
  54945. }
  54946. }
  54947. }
  54948. const ROOT_TREE_INJECTION_KEY$1 = "RootTree";
  54949. const NODE_INSTANCE_INJECTION_KEY = "NodeInstance";
  54950. const TREE_NODE_MAP_INJECTION_KEY = "TreeNodeMap";
  54951. const _sfc_main$p = defineComponent({
  54952. name: "ElTreeNodeContent",
  54953. props: {
  54954. node: {
  54955. type: Object,
  54956. required: true
  54957. },
  54958. renderContent: Function
  54959. },
  54960. setup(props) {
  54961. const ns = useNamespace("tree");
  54962. const nodeInstance = inject(NODE_INSTANCE_INJECTION_KEY);
  54963. const tree = inject(ROOT_TREE_INJECTION_KEY$1);
  54964. return () => {
  54965. const node = props.node;
  54966. const { data, store } = node;
  54967. return props.renderContent ? props.renderContent(h$1, { _self: nodeInstance, node, data, store }) : renderSlot(tree.ctx.slots, "default", { node, data }, () => [
  54968. h$1(ElText, { tag: "span", truncated: true, class: ns.be("node", "label") }, () => [node.label])
  54969. ]);
  54970. };
  54971. }
  54972. });
  54973. var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__file", "tree-node-content.vue"]]);
  54974. function useNodeExpandEventBroadcast(props) {
  54975. const parentNodeMap = inject(TREE_NODE_MAP_INJECTION_KEY, null);
  54976. const currentNodeMap = {
  54977. treeNodeExpand: (node) => {
  54978. var _a;
  54979. if (props.node !== node) {
  54980. (_a = props.node) == null ? void 0 : _a.collapse();
  54981. }
  54982. },
  54983. children: []
  54984. };
  54985. if (parentNodeMap) {
  54986. parentNodeMap.children.push(currentNodeMap);
  54987. }
  54988. provide(TREE_NODE_MAP_INJECTION_KEY, currentNodeMap);
  54989. return {
  54990. broadcastExpanded: (node) => {
  54991. if (!props.accordion)
  54992. return;
  54993. for (const childNode of currentNodeMap.children) {
  54994. childNode.treeNodeExpand(node);
  54995. }
  54996. }
  54997. };
  54998. }
  54999. const dragEventsKey = Symbol("dragEvents");
  55000. function useDragNodeHandler({
  55001. props,
  55002. ctx,
  55003. el$,
  55004. dropIndicator$,
  55005. store
  55006. }) {
  55007. const ns = useNamespace("tree");
  55008. const dragState = ref({
  55009. showDropIndicator: false,
  55010. draggingNode: null,
  55011. dropNode: null,
  55012. allowDrop: true,
  55013. dropType: null
  55014. });
  55015. const treeNodeDragStart = ({ event, treeNode }) => {
  55016. if (!event.dataTransfer)
  55017. return;
  55018. if (isFunction$1(props.allowDrag) && !props.allowDrag(treeNode.node)) {
  55019. event.preventDefault();
  55020. return false;
  55021. }
  55022. event.dataTransfer.effectAllowed = "move";
  55023. try {
  55024. event.dataTransfer.setData("text/plain", "");
  55025. } catch (e) {
  55026. }
  55027. dragState.value.draggingNode = treeNode;
  55028. ctx.emit("node-drag-start", treeNode.node, event);
  55029. };
  55030. const treeNodeDragOver = ({ event, treeNode }) => {
  55031. if (!event.dataTransfer)
  55032. return;
  55033. const dropNode = treeNode;
  55034. const oldDropNode = dragState.value.dropNode;
  55035. if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) {
  55036. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  55037. }
  55038. const draggingNode = dragState.value.draggingNode;
  55039. if (!draggingNode || !dropNode)
  55040. return;
  55041. let dropPrev = true;
  55042. let dropInner = true;
  55043. let dropNext = true;
  55044. let userAllowDropInner = true;
  55045. if (isFunction$1(props.allowDrop)) {
  55046. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  55047. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  55048. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  55049. }
  55050. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  55051. if ((dropPrev || dropInner || dropNext) && (oldDropNode == null ? void 0 : oldDropNode.node.id) !== dropNode.node.id) {
  55052. if (oldDropNode) {
  55053. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  55054. }
  55055. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  55056. }
  55057. if (dropPrev || dropInner || dropNext) {
  55058. dragState.value.dropNode = dropNode;
  55059. } else {
  55060. dragState.value.dropNode = null;
  55061. }
  55062. if (dropNode.node.nextSibling === draggingNode.node) {
  55063. dropNext = false;
  55064. }
  55065. if (dropNode.node.previousSibling === draggingNode.node) {
  55066. dropPrev = false;
  55067. }
  55068. if (dropNode.node.contains(draggingNode.node, false)) {
  55069. dropInner = false;
  55070. }
  55071. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  55072. dropPrev = false;
  55073. dropInner = false;
  55074. dropNext = false;
  55075. }
  55076. const dropEl = dropNode.$el;
  55077. const targetPosition = dropEl.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
  55078. const treePosition = el$.value.getBoundingClientRect();
  55079. const treeScrollTop = el$.value.scrollTop;
  55080. let dropType;
  55081. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : Number.NEGATIVE_INFINITY;
  55082. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : Number.POSITIVE_INFINITY;
  55083. let indicatorTop = -9999;
  55084. const distance = event.clientY - targetPosition.top;
  55085. if (distance < targetPosition.height * prevPercent) {
  55086. dropType = "before";
  55087. } else if (distance > targetPosition.height * nextPercent) {
  55088. dropType = "after";
  55089. } else if (dropInner) {
  55090. dropType = "inner";
  55091. } else {
  55092. dropType = "none";
  55093. }
  55094. const iconPosition = dropEl.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  55095. const dropIndicator = dropIndicator$.value;
  55096. if (dropType === "before") {
  55097. indicatorTop = iconPosition.top - treePosition.top + treeScrollTop;
  55098. } else if (dropType === "after") {
  55099. indicatorTop = iconPosition.bottom - treePosition.top + treeScrollTop;
  55100. }
  55101. dropIndicator.style.top = `${indicatorTop}px`;
  55102. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  55103. if (dropType === "inner") {
  55104. addClass(dropEl, ns.is("drop-inner"));
  55105. } else {
  55106. removeClass(dropEl, ns.is("drop-inner"));
  55107. }
  55108. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  55109. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  55110. dragState.value.dropType = dropType;
  55111. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  55112. };
  55113. const treeNodeDragEnd = (event) => {
  55114. var _a, _b;
  55115. const { draggingNode, dropType, dropNode } = dragState.value;
  55116. event.preventDefault();
  55117. if (event.dataTransfer) {
  55118. event.dataTransfer.dropEffect = "move";
  55119. }
  55120. if ((draggingNode == null ? void 0 : draggingNode.node.data) && dropNode) {
  55121. const draggingNodeCopy = { data: draggingNode.node.data };
  55122. if (dropType !== "none") {
  55123. draggingNode.node.remove();
  55124. }
  55125. if (dropType === "before") {
  55126. (_a = dropNode.node.parent) == null ? void 0 : _a.insertBefore(draggingNodeCopy, dropNode.node);
  55127. } else if (dropType === "after") {
  55128. (_b = dropNode.node.parent) == null ? void 0 : _b.insertAfter(draggingNodeCopy, dropNode.node);
  55129. } else if (dropType === "inner") {
  55130. dropNode.node.insertChild(draggingNodeCopy);
  55131. }
  55132. if (dropType !== "none") {
  55133. store.value.registerNode(draggingNodeCopy);
  55134. if (store.value.key) {
  55135. draggingNode.node.eachNode((node) => {
  55136. var _a2;
  55137. (_a2 = store.value.nodesMap[node.data[store.value.key]]) == null ? void 0 : _a2.setChecked(node.checked, !store.value.checkStrictly);
  55138. });
  55139. }
  55140. }
  55141. removeClass(dropNode.$el, ns.is("drop-inner"));
  55142. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  55143. if (dropType !== "none") {
  55144. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  55145. }
  55146. }
  55147. if (draggingNode && !dropNode) {
  55148. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  55149. }
  55150. dragState.value.showDropIndicator = false;
  55151. dragState.value.draggingNode = null;
  55152. dragState.value.dropNode = null;
  55153. dragState.value.allowDrop = true;
  55154. };
  55155. provide(dragEventsKey, {
  55156. treeNodeDragStart,
  55157. treeNodeDragOver,
  55158. treeNodeDragEnd
  55159. });
  55160. return {
  55161. dragState
  55162. };
  55163. }
  55164. const _sfc_main$o = defineComponent({
  55165. name: "ElTreeNode",
  55166. components: {
  55167. ElCollapseTransition,
  55168. ElCheckbox,
  55169. NodeContent,
  55170. ElIcon,
  55171. Loading: loading_default
  55172. },
  55173. props: {
  55174. node: {
  55175. type: Node$2,
  55176. default: () => ({})
  55177. },
  55178. props: {
  55179. type: Object,
  55180. default: () => ({})
  55181. },
  55182. accordion: Boolean,
  55183. renderContent: Function,
  55184. renderAfterExpand: Boolean,
  55185. showCheckbox: Boolean
  55186. },
  55187. emits: ["node-expand"],
  55188. setup(props, ctx) {
  55189. const ns = useNamespace("tree");
  55190. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  55191. const tree = inject(ROOT_TREE_INJECTION_KEY$1);
  55192. const expanded = ref(false);
  55193. const childNodeRendered = ref(false);
  55194. const oldChecked = ref();
  55195. const oldIndeterminate = ref();
  55196. const node$ = ref();
  55197. const dragEvents = inject(dragEventsKey);
  55198. const instance = getCurrentInstance();
  55199. provide(NODE_INSTANCE_INJECTION_KEY, instance);
  55200. if (!tree) {
  55201. debugWarn("Tree", "Can not find node's tree.");
  55202. }
  55203. if (props.node.expanded) {
  55204. expanded.value = true;
  55205. childNodeRendered.value = true;
  55206. }
  55207. const childrenKey = tree.props.props["children"] || "children";
  55208. watch(() => {
  55209. var _a;
  55210. const children = (_a = props.node.data) == null ? void 0 : _a[childrenKey];
  55211. return children && [...children];
  55212. }, () => {
  55213. props.node.updateChildren();
  55214. });
  55215. watch(() => props.node.indeterminate, (val) => {
  55216. handleSelectChange(props.node.checked, val);
  55217. });
  55218. watch(() => props.node.checked, (val) => {
  55219. handleSelectChange(val, props.node.indeterminate);
  55220. });
  55221. watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
  55222. watch(() => props.node.expanded, (val) => {
  55223. nextTick(() => expanded.value = val);
  55224. if (val) {
  55225. childNodeRendered.value = true;
  55226. }
  55227. });
  55228. const getNodeKey$1 = (node) => {
  55229. return getNodeKey(tree.props.nodeKey, node.data);
  55230. };
  55231. const getNodeClass = (node) => {
  55232. const nodeClassFunc = props.props.class;
  55233. if (!nodeClassFunc) {
  55234. return {};
  55235. }
  55236. let className;
  55237. if (isFunction$1(nodeClassFunc)) {
  55238. const { data } = node;
  55239. className = nodeClassFunc(data, node);
  55240. } else {
  55241. className = nodeClassFunc;
  55242. }
  55243. if (isString$1(className)) {
  55244. return { [className]: true };
  55245. } else {
  55246. return className;
  55247. }
  55248. };
  55249. const handleSelectChange = (checked, indeterminate) => {
  55250. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  55251. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  55252. }
  55253. oldChecked.value = checked;
  55254. oldIndeterminate.value = indeterminate;
  55255. };
  55256. const handleClick = (e) => {
  55257. handleCurrentChange(tree.store, tree.ctx.emit, () => {
  55258. var _a;
  55259. const nodeKeyProp = (_a = tree == null ? void 0 : tree.props) == null ? void 0 : _a.nodeKey;
  55260. if (nodeKeyProp) {
  55261. const curNodeKey = getNodeKey$1(props.node);
  55262. tree.store.value.setCurrentNodeKey(curNodeKey);
  55263. } else {
  55264. tree.store.value.setCurrentNode(props.node);
  55265. }
  55266. });
  55267. tree.currentNode.value = props.node;
  55268. if (tree.props.expandOnClickNode) {
  55269. handleExpandIconClick();
  55270. }
  55271. if ((tree.props.checkOnClickNode || props.node.isLeaf && tree.props.checkOnClickLeaf && props.showCheckbox) && !props.node.disabled) {
  55272. handleCheckChange(!props.node.checked);
  55273. }
  55274. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  55275. };
  55276. const handleContextMenu = (event) => {
  55277. var _a;
  55278. if ((_a = tree.instance.vnode.props) == null ? void 0 : _a["onNodeContextmenu"]) {
  55279. event.stopPropagation();
  55280. event.preventDefault();
  55281. }
  55282. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  55283. };
  55284. const handleExpandIconClick = () => {
  55285. if (props.node.isLeaf)
  55286. return;
  55287. if (expanded.value) {
  55288. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  55289. props.node.collapse();
  55290. } else {
  55291. props.node.expand(() => {
  55292. ctx.emit("node-expand", props.node.data, props.node, instance);
  55293. });
  55294. }
  55295. };
  55296. const handleCheckChange = (value) => {
  55297. props.node.setChecked(value, !(tree == null ? void 0 : tree.props.checkStrictly));
  55298. nextTick(() => {
  55299. const store = tree.store.value;
  55300. tree.ctx.emit("check", props.node.data, {
  55301. checkedNodes: store.getCheckedNodes(),
  55302. checkedKeys: store.getCheckedKeys(),
  55303. halfCheckedNodes: store.getHalfCheckedNodes(),
  55304. halfCheckedKeys: store.getHalfCheckedKeys()
  55305. });
  55306. });
  55307. };
  55308. const handleChildNodeExpand = (nodeData, node, instance2) => {
  55309. broadcastExpanded(node);
  55310. tree.ctx.emit("node-expand", nodeData, node, instance2);
  55311. };
  55312. const handleDragStart = (event) => {
  55313. if (!tree.props.draggable)
  55314. return;
  55315. dragEvents.treeNodeDragStart({ event, treeNode: props });
  55316. };
  55317. const handleDragOver = (event) => {
  55318. event.preventDefault();
  55319. if (!tree.props.draggable)
  55320. return;
  55321. dragEvents.treeNodeDragOver({
  55322. event,
  55323. treeNode: { $el: node$.value, node: props.node }
  55324. });
  55325. };
  55326. const handleDrop = (event) => {
  55327. event.preventDefault();
  55328. };
  55329. const handleDragEnd = (event) => {
  55330. if (!tree.props.draggable)
  55331. return;
  55332. dragEvents.treeNodeDragEnd(event);
  55333. };
  55334. return {
  55335. ns,
  55336. node$,
  55337. tree,
  55338. expanded,
  55339. childNodeRendered,
  55340. oldChecked,
  55341. oldIndeterminate,
  55342. getNodeKey: getNodeKey$1,
  55343. getNodeClass,
  55344. handleSelectChange,
  55345. handleClick,
  55346. handleContextMenu,
  55347. handleExpandIconClick,
  55348. handleCheckChange,
  55349. handleChildNodeExpand,
  55350. handleDragStart,
  55351. handleDragOver,
  55352. handleDrop,
  55353. handleDragEnd,
  55354. CaretRight: caret_right_default
  55355. };
  55356. }
  55357. });
  55358. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  55359. const _component_el_icon = resolveComponent("el-icon");
  55360. const _component_el_checkbox = resolveComponent("el-checkbox");
  55361. const _component_loading = resolveComponent("loading");
  55362. const _component_node_content = resolveComponent("node-content");
  55363. const _component_el_tree_node = resolveComponent("el-tree-node");
  55364. const _component_el_collapse_transition = resolveComponent("el-collapse-transition");
  55365. return withDirectives((openBlock(), createElementBlock("div", {
  55366. ref: "node$",
  55367. class: normalizeClass([
  55368. _ctx.ns.b("node"),
  55369. _ctx.ns.is("expanded", _ctx.expanded),
  55370. _ctx.ns.is("current", _ctx.node.isCurrent),
  55371. _ctx.ns.is("hidden", !_ctx.node.visible),
  55372. _ctx.ns.is("focusable", !_ctx.node.disabled),
  55373. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  55374. _ctx.getNodeClass(_ctx.node)
  55375. ]),
  55376. role: "treeitem",
  55377. tabindex: "-1",
  55378. "aria-expanded": _ctx.expanded,
  55379. "aria-disabled": _ctx.node.disabled,
  55380. "aria-checked": _ctx.node.checked,
  55381. draggable: _ctx.tree.props.draggable,
  55382. "data-key": _ctx.getNodeKey(_ctx.node),
  55383. onClick: withModifiers(_ctx.handleClick, ["stop"]),
  55384. onContextmenu: _ctx.handleContextMenu,
  55385. onDragstart: withModifiers(_ctx.handleDragStart, ["stop"]),
  55386. onDragover: withModifiers(_ctx.handleDragOver, ["stop"]),
  55387. onDragend: withModifiers(_ctx.handleDragEnd, ["stop"]),
  55388. onDrop: withModifiers(_ctx.handleDrop, ["stop"])
  55389. }, [
  55390. createElementVNode("div", {
  55391. class: normalizeClass(_ctx.ns.be("node", "content")),
  55392. style: normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  55393. }, [
  55394. _ctx.tree.props.icon || _ctx.CaretRight ? (openBlock(), createBlock(_component_el_icon, {
  55395. key: 0,
  55396. class: normalizeClass([
  55397. _ctx.ns.be("node", "expand-icon"),
  55398. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  55399. {
  55400. expanded: !_ctx.node.isLeaf && _ctx.expanded
  55401. }
  55402. ]),
  55403. onClick: withModifiers(_ctx.handleExpandIconClick, ["stop"])
  55404. }, {
  55405. default: withCtx(() => [
  55406. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  55407. ]),
  55408. _: 1
  55409. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  55410. _ctx.showCheckbox ? (openBlock(), createBlock(_component_el_checkbox, {
  55411. key: 1,
  55412. "model-value": _ctx.node.checked,
  55413. indeterminate: _ctx.node.indeterminate,
  55414. disabled: !!_ctx.node.disabled,
  55415. onClick: withModifiers(() => {
  55416. }, ["stop"]),
  55417. onChange: _ctx.handleCheckChange
  55418. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onChange"])) : createCommentVNode("v-if", true),
  55419. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  55420. key: 2,
  55421. class: normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  55422. }, {
  55423. default: withCtx(() => [
  55424. createVNode(_component_loading)
  55425. ]),
  55426. _: 1
  55427. }, 8, ["class"])) : createCommentVNode("v-if", true),
  55428. createVNode(_component_node_content, {
  55429. node: _ctx.node,
  55430. "render-content": _ctx.renderContent
  55431. }, null, 8, ["node", "render-content"])
  55432. ], 6),
  55433. createVNode(_component_el_collapse_transition, null, {
  55434. default: withCtx(() => [
  55435. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? withDirectives((openBlock(), createElementBlock("div", {
  55436. key: 0,
  55437. class: normalizeClass(_ctx.ns.be("node", "children")),
  55438. role: "group",
  55439. "aria-expanded": _ctx.expanded,
  55440. onClick: withModifiers(() => {
  55441. }, ["stop"])
  55442. }, [
  55443. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.node.childNodes, (child) => {
  55444. return openBlock(), createBlock(_component_el_tree_node, {
  55445. key: _ctx.getNodeKey(child),
  55446. "render-content": _ctx.renderContent,
  55447. "render-after-expand": _ctx.renderAfterExpand,
  55448. "show-checkbox": _ctx.showCheckbox,
  55449. node: child,
  55450. accordion: _ctx.accordion,
  55451. props: _ctx.props,
  55452. onNodeExpand: _ctx.handleChildNodeExpand
  55453. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  55454. }), 128))
  55455. ], 10, ["aria-expanded", "onClick"])), [
  55456. [vShow, _ctx.expanded]
  55457. ]) : createCommentVNode("v-if", true)
  55458. ]),
  55459. _: 1
  55460. })
  55461. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key", "onClick", "onContextmenu", "onDragstart", "onDragover", "onDragend", "onDrop"])), [
  55462. [vShow, _ctx.node.visible]
  55463. ]);
  55464. }
  55465. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]);
  55466. function useKeydown({ el$ }, store) {
  55467. const ns = useNamespace("tree");
  55468. onMounted(() => {
  55469. initTabIndex();
  55470. });
  55471. onUpdated(() => {
  55472. const checkboxItems = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  55473. checkboxItems.forEach((checkbox) => {
  55474. checkbox.setAttribute("tabindex", "-1");
  55475. });
  55476. });
  55477. function canNodeFocus(treeItems, nextIndex) {
  55478. var _a, _b;
  55479. const currentNode = store.value.getNode(treeItems[nextIndex].dataset.key);
  55480. return currentNode.canFocus && currentNode.visible && (((_a = currentNode.parent) == null ? void 0 : _a.expanded) || ((_b = currentNode.parent) == null ? void 0 : _b.level) === 0);
  55481. }
  55482. const handleKeydown = (ev) => {
  55483. const currentItem = ev.target;
  55484. if (!currentItem.className.includes(ns.b("node")))
  55485. return;
  55486. const code = getEventCode(ev);
  55487. const treeItems = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  55488. const currentIndex = treeItems.indexOf(currentItem);
  55489. let nextIndex;
  55490. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  55491. ev.preventDefault();
  55492. if (code === EVENT_CODE.up) {
  55493. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.length - 1;
  55494. const startIndex = nextIndex;
  55495. while (true) {
  55496. if (canNodeFocus(treeItems, nextIndex)) {
  55497. break;
  55498. }
  55499. nextIndex--;
  55500. if (nextIndex === startIndex) {
  55501. nextIndex = -1;
  55502. break;
  55503. }
  55504. if (nextIndex < 0) {
  55505. nextIndex = treeItems.length - 1;
  55506. }
  55507. }
  55508. } else {
  55509. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.length - 1 ? currentIndex + 1 : 0;
  55510. const startIndex = nextIndex;
  55511. while (true) {
  55512. if (canNodeFocus(treeItems, nextIndex)) {
  55513. break;
  55514. }
  55515. nextIndex++;
  55516. if (nextIndex === startIndex) {
  55517. nextIndex = -1;
  55518. break;
  55519. }
  55520. if (nextIndex >= treeItems.length) {
  55521. nextIndex = 0;
  55522. }
  55523. }
  55524. }
  55525. nextIndex !== -1 && treeItems[nextIndex].focus();
  55526. }
  55527. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  55528. ev.preventDefault();
  55529. currentItem.click();
  55530. }
  55531. const hasInput = currentItem.querySelector('[type="checkbox"]');
  55532. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(code) && hasInput) {
  55533. ev.preventDefault();
  55534. hasInput.click();
  55535. }
  55536. };
  55537. useEventListener(el$, "keydown", handleKeydown);
  55538. const initTabIndex = () => {
  55539. var _a;
  55540. if (!el$.value)
  55541. return;
  55542. const treeItems = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  55543. const checkboxItems = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  55544. checkboxItems.forEach((checkbox) => {
  55545. checkbox.setAttribute("tabindex", "-1");
  55546. });
  55547. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  55548. if (checkedItem.length) {
  55549. checkedItem[0].setAttribute("tabindex", "0");
  55550. return;
  55551. }
  55552. (_a = treeItems[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
  55553. };
  55554. }
  55555. const treeEmits$1 = {
  55556. "check-change": (data, checked, indeterminate) => data && isBoolean(checked) && isBoolean(indeterminate),
  55557. "current-change": (data, node) => true,
  55558. "node-click": (data, node, nodeInstance, evt) => data && node && evt instanceof Event,
  55559. "node-contextmenu": (evt, data, node, nodeInstance) => evt instanceof Event && data && node,
  55560. "node-collapse": (data, node, nodeInstance) => data && node,
  55561. "node-expand": (data, node, nodeInstance) => data && node,
  55562. check: (data, checkedInfo) => data && checkedInfo,
  55563. "node-drag-start": (node, evt) => node && evt,
  55564. "node-drag-end": (draggingNode, dropNode, dropType, evt) => draggingNode && evt,
  55565. "node-drop": (draggingNode, dropNode, dropType, evt) => draggingNode && dropNode && evt,
  55566. "node-drag-leave": (draggingNode, oldDropNode, evt) => draggingNode && oldDropNode && evt,
  55567. "node-drag-enter": (draggingNode, dropNode, evt) => draggingNode && dropNode && evt,
  55568. "node-drag-over": (draggingNode, dropNode, evt) => draggingNode && dropNode && evt
  55569. };
  55570. const _sfc_main$n = defineComponent({
  55571. name: "ElTree",
  55572. components: { ElTreeNode: ElTreeNode$1 },
  55573. props: {
  55574. data: {
  55575. type: definePropType(Array),
  55576. default: () => []
  55577. },
  55578. emptyText: {
  55579. type: String
  55580. },
  55581. renderAfterExpand: {
  55582. type: Boolean,
  55583. default: true
  55584. },
  55585. nodeKey: String,
  55586. checkStrictly: Boolean,
  55587. defaultExpandAll: Boolean,
  55588. expandOnClickNode: {
  55589. type: Boolean,
  55590. default: true
  55591. },
  55592. checkOnClickNode: Boolean,
  55593. checkOnClickLeaf: {
  55594. type: Boolean,
  55595. default: true
  55596. },
  55597. checkDescendants: Boolean,
  55598. autoExpandParent: {
  55599. type: Boolean,
  55600. default: true
  55601. },
  55602. defaultCheckedKeys: Array,
  55603. defaultExpandedKeys: Array,
  55604. currentNodeKey: [String, Number],
  55605. renderContent: {
  55606. type: definePropType(Function)
  55607. },
  55608. showCheckbox: Boolean,
  55609. draggable: Boolean,
  55610. allowDrag: {
  55611. type: definePropType(Function)
  55612. },
  55613. allowDrop: {
  55614. type: definePropType(Function)
  55615. },
  55616. props: {
  55617. type: Object,
  55618. default: () => ({
  55619. children: "children",
  55620. label: "label",
  55621. disabled: "disabled"
  55622. })
  55623. },
  55624. lazy: Boolean,
  55625. highlightCurrent: Boolean,
  55626. load: Function,
  55627. filterNodeMethod: Function,
  55628. accordion: Boolean,
  55629. indent: {
  55630. type: Number,
  55631. default: 18
  55632. },
  55633. icon: {
  55634. type: iconPropType
  55635. }
  55636. },
  55637. emits: treeEmits$1,
  55638. setup(props, ctx) {
  55639. const { t } = useLocale();
  55640. const ns = useNamespace("tree");
  55641. const store = ref(new TreeStore({
  55642. key: props.nodeKey,
  55643. data: props.data,
  55644. lazy: props.lazy,
  55645. props: props.props,
  55646. load: props.load,
  55647. currentNodeKey: props.currentNodeKey,
  55648. checkStrictly: props.checkStrictly,
  55649. checkDescendants: props.checkDescendants,
  55650. defaultCheckedKeys: props.defaultCheckedKeys,
  55651. defaultExpandedKeys: props.defaultExpandedKeys,
  55652. autoExpandParent: props.autoExpandParent,
  55653. defaultExpandAll: props.defaultExpandAll,
  55654. filterNodeMethod: props.filterNodeMethod
  55655. }));
  55656. store.value.initialize();
  55657. const root = ref(store.value.root);
  55658. const currentNode = ref(null);
  55659. const el$ = ref(null);
  55660. const dropIndicator$ = ref(null);
  55661. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  55662. const { dragState } = useDragNodeHandler({
  55663. props,
  55664. ctx,
  55665. el$,
  55666. dropIndicator$,
  55667. store
  55668. });
  55669. useKeydown({ el$ }, store);
  55670. const instance = getCurrentInstance();
  55671. const isSelectTree = computed(() => {
  55672. let parent = instance == null ? void 0 : instance.parent;
  55673. while (parent) {
  55674. if (parent.type.name === "ElTreeSelect") {
  55675. return true;
  55676. }
  55677. parent = parent.parent;
  55678. }
  55679. return false;
  55680. });
  55681. const isEmpty = computed(() => {
  55682. const { childNodes } = root.value;
  55683. return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !isSelectTree.value;
  55684. });
  55685. watch(() => props.currentNodeKey, (newVal) => {
  55686. store.value.setCurrentNodeKey(newVal != null ? newVal : null);
  55687. });
  55688. watch(() => props.defaultCheckedKeys, (newVal, oldVal) => {
  55689. if (isEqual$1(newVal, oldVal))
  55690. return;
  55691. store.value.setDefaultCheckedKey(newVal != null ? newVal : []);
  55692. });
  55693. watch(() => props.defaultExpandedKeys, (newVal) => {
  55694. store.value.setDefaultExpandedKeys(newVal != null ? newVal : []);
  55695. });
  55696. watch(() => props.data, (newVal) => {
  55697. store.value.setData(newVal);
  55698. }, { deep: true });
  55699. watch(() => props.checkStrictly, (newVal) => {
  55700. store.value.checkStrictly = newVal;
  55701. });
  55702. const filter = (value) => {
  55703. if (!props.filterNodeMethod)
  55704. throw new Error("[Tree] filterNodeMethod is required when filter");
  55705. store.value.filter(value);
  55706. };
  55707. const getNodeKey$1 = (node) => {
  55708. return getNodeKey(props.nodeKey, node.data);
  55709. };
  55710. const getNodePath = (data) => {
  55711. if (!props.nodeKey)
  55712. throw new Error("[Tree] nodeKey is required in getNodePath");
  55713. const node = store.value.getNode(data);
  55714. if (!node)
  55715. return [];
  55716. const path = [node.data];
  55717. let parent = node.parent;
  55718. while (parent && parent !== root.value) {
  55719. path.push(parent.data);
  55720. parent = parent.parent;
  55721. }
  55722. return path.reverse();
  55723. };
  55724. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  55725. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  55726. };
  55727. const getCheckedKeys = (leafOnly) => {
  55728. return store.value.getCheckedKeys(leafOnly);
  55729. };
  55730. const getCurrentNode = () => {
  55731. const currentNode2 = store.value.getCurrentNode();
  55732. return currentNode2 ? currentNode2.data : null;
  55733. };
  55734. const getCurrentKey = () => {
  55735. if (!props.nodeKey)
  55736. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  55737. const currentNode2 = getCurrentNode();
  55738. return currentNode2 ? currentNode2[props.nodeKey] : null;
  55739. };
  55740. const setCheckedNodes = (nodes, leafOnly) => {
  55741. if (!props.nodeKey)
  55742. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  55743. store.value.setCheckedNodes(nodes, leafOnly);
  55744. };
  55745. const setCheckedKeys = (keys, leafOnly) => {
  55746. if (!props.nodeKey)
  55747. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  55748. store.value.setCheckedKeys(keys, leafOnly);
  55749. };
  55750. const setChecked = (data, checked, deep) => {
  55751. store.value.setChecked(data, checked, deep);
  55752. };
  55753. const getHalfCheckedNodes = () => {
  55754. return store.value.getHalfCheckedNodes();
  55755. };
  55756. const getHalfCheckedKeys = () => {
  55757. return store.value.getHalfCheckedKeys();
  55758. };
  55759. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  55760. if (!props.nodeKey)
  55761. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  55762. handleCurrentChange(store, ctx.emit, () => {
  55763. broadcastExpanded(node);
  55764. store.value.setUserCurrentNode(node, shouldAutoExpandParent);
  55765. });
  55766. };
  55767. const setCurrentKey = (key = null, shouldAutoExpandParent = true) => {
  55768. if (!props.nodeKey)
  55769. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  55770. handleCurrentChange(store, ctx.emit, () => {
  55771. broadcastExpanded();
  55772. store.value.setCurrentNodeKey(key, shouldAutoExpandParent);
  55773. });
  55774. };
  55775. const getNode = (data) => {
  55776. return store.value.getNode(data);
  55777. };
  55778. const remove = (data) => {
  55779. store.value.remove(data);
  55780. };
  55781. const append = (data, parentNode) => {
  55782. store.value.append(data, parentNode);
  55783. };
  55784. const insertBefore = (data, refNode) => {
  55785. store.value.insertBefore(data, refNode);
  55786. };
  55787. const insertAfter = (data, refNode) => {
  55788. store.value.insertAfter(data, refNode);
  55789. };
  55790. const handleNodeExpand = (nodeData, node, instance2) => {
  55791. broadcastExpanded(node);
  55792. ctx.emit("node-expand", nodeData, node, instance2);
  55793. };
  55794. const updateKeyChildren = (key, data) => {
  55795. if (!props.nodeKey)
  55796. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  55797. store.value.updateChildren(key, data);
  55798. };
  55799. provide(ROOT_TREE_INJECTION_KEY$1, {
  55800. ctx,
  55801. props,
  55802. store,
  55803. root,
  55804. currentNode,
  55805. instance
  55806. });
  55807. provide(formItemContextKey, void 0);
  55808. return {
  55809. ns,
  55810. store,
  55811. root,
  55812. currentNode,
  55813. dragState,
  55814. el$,
  55815. dropIndicator$,
  55816. isEmpty,
  55817. filter,
  55818. getNodeKey: getNodeKey$1,
  55819. getNodePath,
  55820. getCheckedNodes,
  55821. getCheckedKeys,
  55822. getCurrentNode,
  55823. getCurrentKey,
  55824. setCheckedNodes,
  55825. setCheckedKeys,
  55826. setChecked,
  55827. getHalfCheckedNodes,
  55828. getHalfCheckedKeys,
  55829. setCurrentNode,
  55830. setCurrentKey,
  55831. t,
  55832. getNode,
  55833. remove,
  55834. append,
  55835. insertBefore,
  55836. insertAfter,
  55837. handleNodeExpand,
  55838. updateKeyChildren
  55839. };
  55840. }
  55841. });
  55842. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  55843. const _component_el_tree_node = resolveComponent("el-tree-node");
  55844. return openBlock(), createElementBlock("div", {
  55845. ref: "el$",
  55846. class: normalizeClass([
  55847. _ctx.ns.b(),
  55848. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  55849. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  55850. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  55851. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  55852. ]),
  55853. role: "tree"
  55854. }, [
  55855. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.root.childNodes, (child) => {
  55856. return openBlock(), createBlock(_component_el_tree_node, {
  55857. key: _ctx.getNodeKey(child),
  55858. node: child,
  55859. props: _ctx.props,
  55860. accordion: _ctx.accordion,
  55861. "render-after-expand": _ctx.renderAfterExpand,
  55862. "show-checkbox": _ctx.showCheckbox,
  55863. "render-content": _ctx.renderContent,
  55864. onNodeExpand: _ctx.handleNodeExpand
  55865. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  55866. }), 128)),
  55867. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  55868. key: 0,
  55869. class: normalizeClass(_ctx.ns.e("empty-block"))
  55870. }, [
  55871. renderSlot(_ctx.$slots, "empty", {}, () => {
  55872. var _a;
  55873. return [
  55874. createElementVNode("span", {
  55875. class: normalizeClass(_ctx.ns.e("empty-text"))
  55876. }, toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
  55877. ];
  55878. })
  55879. ], 2)) : createCommentVNode("v-if", true),
  55880. withDirectives(createElementVNode("div", {
  55881. ref: "dropIndicator$",
  55882. class: normalizeClass(_ctx.ns.e("drop-indicator"))
  55883. }, null, 2), [
  55884. [vShow, _ctx.dragState.showDropIndicator]
  55885. ])
  55886. ], 2);
  55887. }
  55888. var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$1], ["__file", "tree.vue"]]);
  55889. const ElTree = withInstall(Tree);
  55890. const useSelect = (props, { attrs, emit }, {
  55891. select,
  55892. tree,
  55893. key
  55894. }) => {
  55895. const ns = useNamespace("tree-select");
  55896. watch(() => props.data, () => {
  55897. if (props.filterable) {
  55898. nextTick(() => {
  55899. var _a, _b;
  55900. (_b = tree.value) == null ? void 0 : _b.filter((_a = select.value) == null ? void 0 : _a.states.inputValue);
  55901. });
  55902. }
  55903. }, { flush: "post" });
  55904. const result = {
  55905. ...pick(toRefs(props), Object.keys(ElSelect.props)),
  55906. ...attrs,
  55907. class: computed(() => attrs.class),
  55908. style: computed(() => attrs.style),
  55909. "onUpdate:modelValue": (value) => emit(UPDATE_MODEL_EVENT, value),
  55910. valueKey: key,
  55911. popperClass: computed(() => {
  55912. const classes = [ns.e("popper")];
  55913. if (props.popperClass)
  55914. classes.push(props.popperClass);
  55915. return classes.join(" ");
  55916. }),
  55917. filterMethod: (keyword = "") => {
  55918. var _a;
  55919. if (props.filterMethod) {
  55920. props.filterMethod(keyword);
  55921. } else if (props.remoteMethod) {
  55922. props.remoteMethod(keyword);
  55923. } else {
  55924. (_a = tree.value) == null ? void 0 : _a.filter(keyword);
  55925. }
  55926. }
  55927. };
  55928. return result;
  55929. };
  55930. const component = defineComponent({
  55931. extends: ElOption,
  55932. setup(props, ctx) {
  55933. const result = ElOption.setup(props, ctx);
  55934. delete result.selectOptionClick;
  55935. const vm = getCurrentInstance().proxy;
  55936. nextTick(() => {
  55937. if (!result.select.states.cachedOptions.get(vm.value)) {
  55938. result.select.onOptionCreate(vm);
  55939. }
  55940. });
  55941. watch(() => ctx.attrs.visible, (val) => {
  55942. nextTick(() => {
  55943. result.states.visible = val;
  55944. });
  55945. }, {
  55946. immediate: true
  55947. });
  55948. return result;
  55949. },
  55950. methods: {
  55951. selectOptionClick() {
  55952. this.$el.parentElement.click();
  55953. }
  55954. }
  55955. });
  55956. var TreeSelectOption = component;
  55957. function isValidValue(val) {
  55958. return val || val === 0;
  55959. }
  55960. function isValidArray(val) {
  55961. return isArray$1(val) && val.length;
  55962. }
  55963. function toValidArray(val) {
  55964. return isArray$1(val) ? val : isValidValue(val) ? [val] : [];
  55965. }
  55966. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  55967. for (let i = 0; i < treeData.length; i++) {
  55968. const data = treeData[i];
  55969. if (findCallback(data, i, treeData, parent)) {
  55970. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  55971. } else {
  55972. const children = getChildren(data);
  55973. if (isValidArray(children)) {
  55974. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  55975. if (find)
  55976. return find;
  55977. }
  55978. }
  55979. }
  55980. }
  55981. function treeEach(treeData, callback, getChildren, parent) {
  55982. for (let i = 0; i < treeData.length; i++) {
  55983. const data = treeData[i];
  55984. callback(data, i, treeData, parent);
  55985. const children = getChildren(data);
  55986. if (isValidArray(children)) {
  55987. treeEach(children, callback, getChildren, data);
  55988. }
  55989. }
  55990. }
  55991. const useTree$1 = (props, { attrs, slots, emit }, {
  55992. select,
  55993. tree,
  55994. key
  55995. }) => {
  55996. watch([() => props.modelValue, tree], () => {
  55997. if (props.showCheckbox) {
  55998. nextTick(() => {
  55999. const treeInstance = tree.value;
  56000. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  56001. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  56002. }
  56003. });
  56004. }
  56005. }, {
  56006. immediate: true,
  56007. deep: true
  56008. });
  56009. const propsMap = computed(() => ({
  56010. value: key.value,
  56011. label: "label",
  56012. children: "children",
  56013. disabled: "disabled",
  56014. isLeaf: "isLeaf",
  56015. ...props.props
  56016. }));
  56017. const getNodeValByProp = (prop, data) => {
  56018. var _a;
  56019. const propVal = propsMap.value[prop];
  56020. if (isFunction$1(propVal)) {
  56021. return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
  56022. } else {
  56023. return data[propVal];
  56024. }
  56025. };
  56026. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  56027. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  56028. }).filter((item) => isValidValue(item));
  56029. const cacheOptions = computed(() => {
  56030. if (!props.renderAfterExpand && !props.lazy)
  56031. return [];
  56032. const options = [];
  56033. treeEach(props.data.concat(props.cacheData), (node) => {
  56034. const value = getNodeValByProp("value", node);
  56035. options.push({
  56036. value,
  56037. currentLabel: getNodeValByProp("label", node),
  56038. isDisabled: getNodeValByProp("disabled", node)
  56039. });
  56040. }, (data) => getNodeValByProp("children", data));
  56041. return options;
  56042. });
  56043. const getChildCheckedKeys = () => {
  56044. var _a;
  56045. return (_a = tree.value) == null ? void 0 : _a.getCheckedKeys().filter((checkedKey) => {
  56046. var _a2;
  56047. const node = (_a2 = tree.value) == null ? void 0 : _a2.getNode(checkedKey);
  56048. return !isNil(node) && isEmpty(node.childNodes);
  56049. });
  56050. };
  56051. return {
  56052. ...pick(toRefs(props), Object.keys(ElTree.props)),
  56053. ...attrs,
  56054. nodeKey: key,
  56055. expandOnClickNode: computed(() => {
  56056. return !props.checkStrictly && props.expandOnClickNode;
  56057. }),
  56058. defaultExpandedKeys: computed(() => {
  56059. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  56060. }),
  56061. renderContent: (h, { node, data, store }) => {
  56062. return h(TreeSelectOption, {
  56063. value: getNodeValByProp("value", data),
  56064. label: getNodeValByProp("label", data),
  56065. disabled: getNodeValByProp("disabled", data),
  56066. visible: node.visible
  56067. }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  56068. },
  56069. filterNodeMethod: (value, data, node) => {
  56070. if (props.filterNodeMethod)
  56071. return props.filterNodeMethod(value, data, node);
  56072. if (!value)
  56073. return true;
  56074. const regexp = new RegExp(escapeStringRegexp(value), "i");
  56075. return regexp.test(getNodeValByProp("label", data) || "");
  56076. },
  56077. onNodeClick: (data, node, e) => {
  56078. var _a, _b, _c, _d;
  56079. (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
  56080. if (props.showCheckbox && props.checkOnClickNode)
  56081. return;
  56082. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  56083. if (!getNodeValByProp("disabled", data)) {
  56084. const option = (_b = select.value) == null ? void 0 : _b.states.options.get(getNodeValByProp("value", data));
  56085. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option);
  56086. }
  56087. } else if (props.expandOnClickNode) {
  56088. e.proxy.handleExpandIconClick();
  56089. }
  56090. (_d = select.value) == null ? void 0 : _d.focus();
  56091. },
  56092. onCheck: (data, params) => {
  56093. var _a;
  56094. if (!props.showCheckbox)
  56095. return;
  56096. const dataValue = getNodeValByProp("value", data);
  56097. const dataMap = {};
  56098. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  56099. const uncachedCheckedKeys = params.checkedKeys;
  56100. const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item)) : [];
  56101. const checkedKeys = cachedKeys.concat(uncachedCheckedKeys);
  56102. if (props.checkStrictly) {
  56103. emit(UPDATE_MODEL_EVENT, props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
  56104. } else {
  56105. if (props.multiple) {
  56106. const childKeys = getChildCheckedKeys();
  56107. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  56108. } else {
  56109. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  56110. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  56111. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  56112. emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  56113. }
  56114. }
  56115. nextTick(() => {
  56116. var _a2;
  56117. const checkedKeys2 = toValidArray(props.modelValue);
  56118. tree.value.setCheckedKeys(checkedKeys2);
  56119. (_a2 = attrs.onCheck) == null ? void 0 : _a2.call(attrs, data, {
  56120. checkedKeys: tree.value.getCheckedKeys(),
  56121. checkedNodes: tree.value.getCheckedNodes(),
  56122. halfCheckedKeys: tree.value.getHalfCheckedKeys(),
  56123. halfCheckedNodes: tree.value.getHalfCheckedNodes()
  56124. });
  56125. });
  56126. (_a = select.value) == null ? void 0 : _a.focus();
  56127. },
  56128. onNodeExpand: (data, node, e) => {
  56129. var _a;
  56130. (_a = attrs.onNodeExpand) == null ? void 0 : _a.call(attrs, data, node, e);
  56131. nextTick(() => {
  56132. if (!props.checkStrictly && props.lazy && props.multiple && node.checked) {
  56133. const dataMap = {};
  56134. const uncachedCheckedKeys = tree.value.getCheckedKeys();
  56135. treeEach([tree.value.store.root], (node2) => dataMap[node2.key] = node2, (node2) => node2.childNodes);
  56136. const cachedKeys = toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item));
  56137. const childKeys = getChildCheckedKeys();
  56138. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  56139. }
  56140. });
  56141. },
  56142. cacheOptions
  56143. };
  56144. };
  56145. var CacheOptions = defineComponent({
  56146. props: {
  56147. data: {
  56148. type: Array,
  56149. default: () => []
  56150. }
  56151. },
  56152. setup(props) {
  56153. const select = inject(selectKey);
  56154. watch(() => props.data, () => {
  56155. var _a;
  56156. props.data.forEach((item) => {
  56157. if (!select.states.cachedOptions.has(item.value)) {
  56158. select.states.cachedOptions.set(item.value, item);
  56159. }
  56160. });
  56161. const inputs = ((_a = select.selectRef) == null ? void 0 : _a.querySelectorAll("input")) || [];
  56162. if (isClient && !Array.from(inputs).includes(document.activeElement)) {
  56163. select.setSelected();
  56164. }
  56165. }, { flush: "post", immediate: true });
  56166. return () => void 0;
  56167. }
  56168. });
  56169. const _sfc_main$m = defineComponent({
  56170. name: "ElTreeSelect",
  56171. inheritAttrs: false,
  56172. props: {
  56173. ...ElSelect.props,
  56174. ...ElTree.props,
  56175. cacheData: {
  56176. type: Array,
  56177. default: () => []
  56178. }
  56179. },
  56180. setup(props, context) {
  56181. const { slots, expose } = context;
  56182. const select = ref();
  56183. const tree = ref();
  56184. const key = computed(() => props.nodeKey || props.valueKey || "value");
  56185. const selectProps = useSelect(props, context, { select, tree, key });
  56186. const { cacheOptions, ...treeProps } = useTree$1(props, context, {
  56187. select,
  56188. tree,
  56189. key
  56190. });
  56191. const methods = reactive({});
  56192. expose(methods);
  56193. onMounted(() => {
  56194. Object.assign(methods, {
  56195. ...pick(tree.value, [
  56196. "filter",
  56197. "updateKeyChildren",
  56198. "getCheckedNodes",
  56199. "setCheckedNodes",
  56200. "getCheckedKeys",
  56201. "setCheckedKeys",
  56202. "setChecked",
  56203. "getHalfCheckedNodes",
  56204. "getHalfCheckedKeys",
  56205. "getCurrentKey",
  56206. "getCurrentNode",
  56207. "setCurrentKey",
  56208. "setCurrentNode",
  56209. "getNode",
  56210. "remove",
  56211. "append",
  56212. "insertBefore",
  56213. "insertAfter"
  56214. ]),
  56215. ...pick(select.value, ["focus", "blur", "selectedLabel"]),
  56216. treeRef: tree.value,
  56217. selectRef: select.value
  56218. });
  56219. });
  56220. return () => h$1(ElSelect, reactive({
  56221. ...selectProps,
  56222. ref: (ref2) => select.value = ref2
  56223. }), {
  56224. ...slots,
  56225. default: () => [
  56226. h$1(CacheOptions, { data: cacheOptions.value }),
  56227. h$1(ElTree, reactive({
  56228. ...treeProps,
  56229. ref: (ref2) => tree.value = ref2
  56230. }))
  56231. ]
  56232. });
  56233. }
  56234. });
  56235. var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "tree-select.vue"]]);
  56236. const ElTreeSelect = withInstall(TreeSelect);
  56237. const ROOT_TREE_INJECTION_KEY = Symbol();
  56238. const EMPTY_NODE = {
  56239. key: -1,
  56240. level: -1,
  56241. data: {}
  56242. };
  56243. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  56244. TreeOptionsEnum2["KEY"] = "id";
  56245. TreeOptionsEnum2["LABEL"] = "label";
  56246. TreeOptionsEnum2["CHILDREN"] = "children";
  56247. TreeOptionsEnum2["DISABLED"] = "disabled";
  56248. TreeOptionsEnum2["CLASS"] = "";
  56249. return TreeOptionsEnum2;
  56250. })(TreeOptionsEnum || {});
  56251. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  56252. SetOperationEnum2["ADD"] = "add";
  56253. SetOperationEnum2["DELETE"] = "delete";
  56254. return SetOperationEnum2;
  56255. })(SetOperationEnum || {});
  56256. const itemSize = {
  56257. type: Number,
  56258. default: 26
  56259. };
  56260. const treeProps = buildProps({
  56261. data: {
  56262. type: definePropType(Array),
  56263. default: () => mutable([])
  56264. },
  56265. emptyText: {
  56266. type: String
  56267. },
  56268. height: {
  56269. type: Number,
  56270. default: 200
  56271. },
  56272. props: {
  56273. type: definePropType(Object),
  56274. default: () => mutable({
  56275. children: "children" /* CHILDREN */,
  56276. label: "label" /* LABEL */,
  56277. disabled: "disabled" /* DISABLED */,
  56278. value: "id" /* KEY */,
  56279. class: "" /* CLASS */
  56280. })
  56281. },
  56282. highlightCurrent: Boolean,
  56283. showCheckbox: Boolean,
  56284. defaultCheckedKeys: {
  56285. type: definePropType(Array),
  56286. default: () => mutable([])
  56287. },
  56288. checkStrictly: Boolean,
  56289. defaultExpandedKeys: {
  56290. type: definePropType(Array),
  56291. default: () => mutable([])
  56292. },
  56293. indent: {
  56294. type: Number,
  56295. default: 16
  56296. },
  56297. itemSize,
  56298. icon: {
  56299. type: iconPropType
  56300. },
  56301. expandOnClickNode: {
  56302. type: Boolean,
  56303. default: true
  56304. },
  56305. checkOnClickNode: Boolean,
  56306. checkOnClickLeaf: {
  56307. type: Boolean,
  56308. default: true
  56309. },
  56310. currentNodeKey: {
  56311. type: definePropType([String, Number])
  56312. },
  56313. accordion: Boolean,
  56314. filterMethod: {
  56315. type: definePropType(Function)
  56316. },
  56317. perfMode: {
  56318. type: Boolean,
  56319. default: true
  56320. },
  56321. scrollbarAlwaysOn: Boolean
  56322. });
  56323. const treeNodeProps = buildProps({
  56324. node: {
  56325. type: definePropType(Object),
  56326. default: () => mutable(EMPTY_NODE)
  56327. },
  56328. expanded: Boolean,
  56329. checked: Boolean,
  56330. indeterminate: Boolean,
  56331. showCheckbox: Boolean,
  56332. disabled: Boolean,
  56333. current: Boolean,
  56334. hiddenExpandIcon: Boolean,
  56335. itemSize
  56336. });
  56337. const treeNodeContentProps = buildProps({
  56338. node: {
  56339. type: definePropType(Object),
  56340. required: true
  56341. }
  56342. });
  56343. const NODE_CLICK = "node-click";
  56344. const NODE_DROP = "node-drop";
  56345. const NODE_EXPAND = "node-expand";
  56346. const NODE_COLLAPSE = "node-collapse";
  56347. const CURRENT_CHANGE = "current-change";
  56348. const NODE_CHECK = "check";
  56349. const NODE_CHECK_CHANGE = "check-change";
  56350. const NODE_CONTEXTMENU = "node-contextmenu";
  56351. const treeEmits = {
  56352. [NODE_CLICK]: (data, node, e) => data && node && e,
  56353. [NODE_DROP]: (data, node, e) => data && node && e,
  56354. [NODE_EXPAND]: (data, node) => data && node,
  56355. [NODE_COLLAPSE]: (data, node) => data && node,
  56356. [CURRENT_CHANGE]: (data, node) => data && node,
  56357. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  56358. [NODE_CHECK_CHANGE]: (data, checked) => data && isBoolean(checked),
  56359. [NODE_CONTEXTMENU]: (evt, data, node) => evt && data && node
  56360. };
  56361. const treeNodeEmits = {
  56362. click: (node, e) => !!(node && e),
  56363. drop: (node, e) => !!(node && e),
  56364. toggle: (node) => !!node,
  56365. check: (node, checked) => node && isBoolean(checked)
  56366. };
  56367. function useCheck(props, tree) {
  56368. const checkedKeys = ref(/* @__PURE__ */ new Set());
  56369. const indeterminateKeys = ref(/* @__PURE__ */ new Set());
  56370. const { emit } = getCurrentInstance();
  56371. watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  56372. return nextTick(() => {
  56373. _setCheckedKeys(props.defaultCheckedKeys);
  56374. });
  56375. }, {
  56376. immediate: true
  56377. });
  56378. const updateCheckedKeys = () => {
  56379. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  56380. return;
  56381. }
  56382. const { levelTreeNodeMap, maxLevel } = tree.value;
  56383. const checkedKeySet = checkedKeys.value;
  56384. const indeterminateKeySet = /* @__PURE__ */ new Set();
  56385. for (let level = maxLevel - 1; level >= 1; --level) {
  56386. const nodes = levelTreeNodeMap.get(level);
  56387. if (!nodes)
  56388. continue;
  56389. nodes.forEach((node) => {
  56390. const children = node.children;
  56391. if (children) {
  56392. let allChecked = true;
  56393. let hasChecked = false;
  56394. for (const childNode of children) {
  56395. const key = childNode.key;
  56396. if (checkedKeySet.has(key)) {
  56397. hasChecked = true;
  56398. } else if (indeterminateKeySet.has(key)) {
  56399. allChecked = false;
  56400. hasChecked = true;
  56401. break;
  56402. } else {
  56403. allChecked = false;
  56404. }
  56405. }
  56406. if (allChecked) {
  56407. checkedKeySet.add(node.key);
  56408. } else if (hasChecked) {
  56409. indeterminateKeySet.add(node.key);
  56410. checkedKeySet.delete(node.key);
  56411. } else {
  56412. checkedKeySet.delete(node.key);
  56413. indeterminateKeySet.delete(node.key);
  56414. }
  56415. }
  56416. });
  56417. }
  56418. indeterminateKeys.value = indeterminateKeySet;
  56419. };
  56420. const isChecked = (node) => checkedKeys.value.has(node.key);
  56421. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  56422. const toggleCheckbox = (node, isChecked2, nodeClick = true, immediateUpdate = true) => {
  56423. const checkedKeySet = checkedKeys.value;
  56424. const toggle = (node2, checked) => {
  56425. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  56426. const children = node2.children;
  56427. if (!props.checkStrictly && children) {
  56428. children.forEach((childNode) => {
  56429. if (!childNode.disabled) {
  56430. toggle(childNode, checked);
  56431. }
  56432. });
  56433. }
  56434. };
  56435. toggle(node, isChecked2);
  56436. if (immediateUpdate) {
  56437. updateCheckedKeys();
  56438. }
  56439. if (nodeClick) {
  56440. afterNodeCheck(node, isChecked2);
  56441. }
  56442. };
  56443. const afterNodeCheck = (node, checked) => {
  56444. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  56445. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  56446. emit(NODE_CHECK, node.data, {
  56447. checkedKeys: checkedKeys2,
  56448. checkedNodes,
  56449. halfCheckedKeys,
  56450. halfCheckedNodes
  56451. });
  56452. emit(NODE_CHECK_CHANGE, node.data, checked);
  56453. };
  56454. function getCheckedKeys(leafOnly = false) {
  56455. return getChecked(leafOnly).checkedKeys;
  56456. }
  56457. function getCheckedNodes(leafOnly = false) {
  56458. return getChecked(leafOnly).checkedNodes;
  56459. }
  56460. function getHalfCheckedKeys() {
  56461. return getHalfChecked().halfCheckedKeys;
  56462. }
  56463. function getHalfCheckedNodes() {
  56464. return getHalfChecked().halfCheckedNodes;
  56465. }
  56466. function getChecked(leafOnly = false) {
  56467. const checkedNodes = [];
  56468. const keys = [];
  56469. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  56470. const { treeNodeMap } = tree.value;
  56471. checkedKeys.value.forEach((key) => {
  56472. const node = treeNodeMap.get(key);
  56473. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  56474. keys.push(key);
  56475. checkedNodes.push(node.data);
  56476. }
  56477. });
  56478. }
  56479. return {
  56480. checkedKeys: keys,
  56481. checkedNodes
  56482. };
  56483. }
  56484. function getHalfChecked() {
  56485. const halfCheckedNodes = [];
  56486. const halfCheckedKeys = [];
  56487. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  56488. const { treeNodeMap } = tree.value;
  56489. indeterminateKeys.value.forEach((key) => {
  56490. const node = treeNodeMap.get(key);
  56491. if (node) {
  56492. halfCheckedKeys.push(key);
  56493. halfCheckedNodes.push(node.data);
  56494. }
  56495. });
  56496. }
  56497. return {
  56498. halfCheckedNodes,
  56499. halfCheckedKeys
  56500. };
  56501. }
  56502. function setCheckedKeys(keys) {
  56503. checkedKeys.value.clear();
  56504. indeterminateKeys.value.clear();
  56505. nextTick(() => {
  56506. _setCheckedKeys(keys);
  56507. });
  56508. }
  56509. function setChecked(key, isChecked2) {
  56510. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  56511. const node = tree.value.treeNodeMap.get(key);
  56512. if (node) {
  56513. toggleCheckbox(node, isChecked2, false);
  56514. }
  56515. }
  56516. }
  56517. function _setCheckedKeys(keys) {
  56518. if (tree == null ? void 0 : tree.value) {
  56519. const { treeNodeMap } = tree.value;
  56520. if (props.showCheckbox && treeNodeMap && (keys == null ? void 0 : keys.length) > 0) {
  56521. for (const key of keys) {
  56522. const node = treeNodeMap.get(key);
  56523. if (node && !isChecked(node)) {
  56524. toggleCheckbox(node, true, false, false);
  56525. }
  56526. }
  56527. updateCheckedKeys();
  56528. }
  56529. }
  56530. }
  56531. return {
  56532. updateCheckedKeys,
  56533. toggleCheckbox,
  56534. isChecked,
  56535. isIndeterminate,
  56536. getCheckedKeys,
  56537. getCheckedNodes,
  56538. getHalfCheckedKeys,
  56539. getHalfCheckedNodes,
  56540. setChecked,
  56541. setCheckedKeys
  56542. };
  56543. }
  56544. function useFilter(props, tree) {
  56545. const hiddenNodeKeySet = ref(/* @__PURE__ */ new Set([]));
  56546. const hiddenExpandIconKeySet = ref(/* @__PURE__ */ new Set([]));
  56547. const filterable = computed(() => {
  56548. return isFunction$1(props.filterMethod);
  56549. });
  56550. function doFilter(query) {
  56551. var _a;
  56552. if (!filterable.value) {
  56553. return;
  56554. }
  56555. const expandKeySet = /* @__PURE__ */ new Set();
  56556. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  56557. const hiddenKeys = hiddenNodeKeySet.value;
  56558. const family = [];
  56559. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  56560. const filter = props.filterMethod;
  56561. hiddenKeys.clear();
  56562. function traverse(nodes2) {
  56563. nodes2.forEach((node) => {
  56564. family.push(node);
  56565. if (filter == null ? void 0 : filter(query, node.data, node)) {
  56566. family.forEach((member) => {
  56567. expandKeySet.add(member.key);
  56568. member.expanded = true;
  56569. });
  56570. } else {
  56571. node.expanded = false;
  56572. if (node.isLeaf) {
  56573. hiddenKeys.add(node.key);
  56574. }
  56575. }
  56576. const children = node.children;
  56577. if (children) {
  56578. traverse(children);
  56579. }
  56580. if (!node.isLeaf) {
  56581. if (!expandKeySet.has(node.key)) {
  56582. hiddenKeys.add(node.key);
  56583. } else if (children) {
  56584. let allHidden = true;
  56585. for (const childNode of children) {
  56586. if (!hiddenKeys.has(childNode.key)) {
  56587. allHidden = false;
  56588. break;
  56589. }
  56590. }
  56591. if (allHidden) {
  56592. hiddenExpandIconKeys.add(node.key);
  56593. } else {
  56594. hiddenExpandIconKeys.delete(node.key);
  56595. }
  56596. }
  56597. }
  56598. family.pop();
  56599. });
  56600. }
  56601. traverse(nodes);
  56602. return expandKeySet;
  56603. }
  56604. function isForceHiddenExpandIcon(node) {
  56605. return hiddenExpandIconKeySet.value.has(node.key);
  56606. }
  56607. return {
  56608. hiddenExpandIconKeySet,
  56609. hiddenNodeKeySet,
  56610. doFilter,
  56611. isForceHiddenExpandIcon
  56612. };
  56613. }
  56614. function useTree(props, emit) {
  56615. const expandedKeySet = ref(/* @__PURE__ */ new Set());
  56616. const currentKey = ref();
  56617. const tree = shallowRef();
  56618. const listRef = ref();
  56619. const {
  56620. isIndeterminate,
  56621. isChecked,
  56622. toggleCheckbox,
  56623. getCheckedKeys,
  56624. getCheckedNodes,
  56625. getHalfCheckedKeys,
  56626. getHalfCheckedNodes,
  56627. setChecked,
  56628. setCheckedKeys
  56629. } = useCheck(props, tree);
  56630. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  56631. const valueKey = computed(() => {
  56632. var _a;
  56633. return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY;
  56634. });
  56635. const childrenKey = computed(() => {
  56636. var _a;
  56637. return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN;
  56638. });
  56639. const disabledKey = computed(() => {
  56640. var _a;
  56641. return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED;
  56642. });
  56643. const labelKey = computed(() => {
  56644. var _a;
  56645. return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL;
  56646. });
  56647. const flattenTree = computed(() => {
  56648. var _a;
  56649. const expandedKeys = expandedKeySet.value;
  56650. const hiddenKeys = hiddenNodeKeySet.value;
  56651. const flattenNodes = [];
  56652. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  56653. const stack = [];
  56654. for (let i = nodes.length - 1; i >= 0; --i) {
  56655. stack.push(nodes[i]);
  56656. }
  56657. while (stack.length) {
  56658. const node = stack.pop();
  56659. if (hiddenKeys.has(node.key))
  56660. continue;
  56661. flattenNodes.push(node);
  56662. if (node.children && expandedKeys.has(node.key)) {
  56663. for (let i = node.children.length - 1; i >= 0; --i) {
  56664. stack.push(node.children[i]);
  56665. }
  56666. }
  56667. }
  56668. return flattenNodes;
  56669. });
  56670. const isNotEmpty = computed(() => {
  56671. return flattenTree.value.length > 0;
  56672. });
  56673. function createTree(data) {
  56674. const treeNodeMap = /* @__PURE__ */ new Map();
  56675. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  56676. let maxLevel = 1;
  56677. function traverse(nodes, level = 1, parent = void 0) {
  56678. var _a;
  56679. const siblings = [];
  56680. for (const rawNode of nodes) {
  56681. const value = getKey(rawNode);
  56682. const node = {
  56683. level,
  56684. key: value,
  56685. data: rawNode
  56686. };
  56687. node.label = getLabel(rawNode);
  56688. node.parent = parent;
  56689. const children = getChildren(rawNode);
  56690. node.disabled = getDisabled(rawNode);
  56691. node.isLeaf = !children || children.length === 0;
  56692. node.expanded = expandedKeySet.value.has(value);
  56693. if (children && children.length) {
  56694. node.children = traverse(children, level + 1, node);
  56695. }
  56696. siblings.push(node);
  56697. treeNodeMap.set(value, node);
  56698. if (!levelTreeNodeMap.has(level)) {
  56699. levelTreeNodeMap.set(level, []);
  56700. }
  56701. (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node);
  56702. }
  56703. if (level > maxLevel) {
  56704. maxLevel = level;
  56705. }
  56706. return siblings;
  56707. }
  56708. const treeNodes = traverse(data);
  56709. return {
  56710. treeNodeMap,
  56711. levelTreeNodeMap,
  56712. maxLevel,
  56713. treeNodes
  56714. };
  56715. }
  56716. function filter(query) {
  56717. const keys = doFilter(query);
  56718. if (keys) {
  56719. expandedKeySet.value = keys;
  56720. }
  56721. }
  56722. function getChildren(node) {
  56723. return node[childrenKey.value];
  56724. }
  56725. function getKey(node) {
  56726. if (!node) {
  56727. return "";
  56728. }
  56729. return node[valueKey.value];
  56730. }
  56731. function getDisabled(node) {
  56732. return node[disabledKey.value];
  56733. }
  56734. function getLabel(node) {
  56735. return node[labelKey.value];
  56736. }
  56737. function toggleExpand(node) {
  56738. const expandedKeys = expandedKeySet.value;
  56739. if (expandedKeys.has(node.key)) {
  56740. collapseNode(node);
  56741. } else {
  56742. expandNode(node);
  56743. }
  56744. }
  56745. function setExpandedKeys(keys) {
  56746. const expandedKeys = /* @__PURE__ */ new Set();
  56747. const nodeMap = tree.value.treeNodeMap;
  56748. expandedKeySet.value.forEach((key) => {
  56749. const node = nodeMap.get(key);
  56750. expandedKeySet.value.delete(node.key);
  56751. node.expanded = false;
  56752. });
  56753. keys.forEach((k) => {
  56754. let node = nodeMap.get(k);
  56755. while (node && !expandedKeys.has(node.key)) {
  56756. expandedKeys.add(node.key);
  56757. node.expanded = true;
  56758. node = node.parent;
  56759. }
  56760. });
  56761. expandedKeySet.value = expandedKeys;
  56762. }
  56763. function handleNodeClick(node, e) {
  56764. emit(NODE_CLICK, node.data, node, e);
  56765. handleCurrentChange(node);
  56766. if (props.expandOnClickNode) {
  56767. toggleExpand(node);
  56768. }
  56769. if (props.showCheckbox && (props.checkOnClickNode || node.isLeaf && props.checkOnClickLeaf) && !node.disabled) {
  56770. toggleCheckbox(node, !isChecked(node), true);
  56771. }
  56772. }
  56773. function handleNodeDrop(node, e) {
  56774. emit(NODE_DROP, node.data, node, e);
  56775. }
  56776. function handleCurrentChange(node) {
  56777. if (!isCurrent(node)) {
  56778. currentKey.value = node.key;
  56779. emit(CURRENT_CHANGE, node.data, node);
  56780. }
  56781. }
  56782. function handleNodeCheck(node, checked) {
  56783. toggleCheckbox(node, checked);
  56784. }
  56785. function expandNode(node) {
  56786. const keySet = expandedKeySet.value;
  56787. if (tree.value && props.accordion) {
  56788. const { treeNodeMap } = tree.value;
  56789. keySet.forEach((key) => {
  56790. const treeNode = treeNodeMap.get(key);
  56791. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  56792. keySet.delete(key);
  56793. treeNode.expanded = false;
  56794. }
  56795. });
  56796. }
  56797. keySet.add(node.key);
  56798. const _node = getNode(node.key);
  56799. if (_node) {
  56800. _node.expanded = true;
  56801. emit(NODE_EXPAND, _node.data, _node);
  56802. }
  56803. }
  56804. function collapseNode(node) {
  56805. expandedKeySet.value.delete(node.key);
  56806. const _node = getNode(node.key);
  56807. if (_node) {
  56808. _node.expanded = false;
  56809. emit(NODE_COLLAPSE, _node.data, _node);
  56810. }
  56811. }
  56812. function isDisabled(node) {
  56813. return !!node.disabled;
  56814. }
  56815. function isCurrent(node) {
  56816. const current = currentKey.value;
  56817. return current !== void 0 && current === node.key;
  56818. }
  56819. function getCurrentNode() {
  56820. var _a, _b;
  56821. if (!currentKey.value)
  56822. return void 0;
  56823. return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  56824. }
  56825. function getCurrentKey() {
  56826. return currentKey.value;
  56827. }
  56828. function setCurrentKey(key) {
  56829. currentKey.value = key;
  56830. }
  56831. function setData(data) {
  56832. tree.value = createTree(data);
  56833. }
  56834. function getNode(data) {
  56835. var _a;
  56836. const key = isObject$1(data) ? getKey(data) : data;
  56837. return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key);
  56838. }
  56839. function scrollToNode(key, strategy = "auto") {
  56840. const node = getNode(key);
  56841. if (node && listRef.value) {
  56842. listRef.value.scrollToItem(flattenTree.value.indexOf(node), strategy);
  56843. }
  56844. }
  56845. function scrollTo(offset) {
  56846. var _a;
  56847. (_a = listRef.value) == null ? void 0 : _a.scrollTo(offset);
  56848. }
  56849. watch(() => props.currentNodeKey, (key) => {
  56850. currentKey.value = key;
  56851. }, {
  56852. immediate: true
  56853. });
  56854. watch(() => props.defaultExpandedKeys, (key) => {
  56855. expandedKeySet.value = new Set(key);
  56856. }, {
  56857. immediate: true
  56858. });
  56859. watch(() => props.data, (data) => {
  56860. setData(data);
  56861. }, {
  56862. immediate: true
  56863. });
  56864. return {
  56865. tree,
  56866. flattenTree,
  56867. isNotEmpty,
  56868. listRef,
  56869. getKey,
  56870. getChildren,
  56871. toggleExpand,
  56872. toggleCheckbox,
  56873. isChecked,
  56874. isIndeterminate,
  56875. isDisabled,
  56876. isCurrent,
  56877. isForceHiddenExpandIcon,
  56878. handleNodeClick,
  56879. handleNodeDrop,
  56880. handleNodeCheck,
  56881. getCurrentNode,
  56882. getCurrentKey,
  56883. setCurrentKey,
  56884. getCheckedKeys,
  56885. getCheckedNodes,
  56886. getHalfCheckedKeys,
  56887. getHalfCheckedNodes,
  56888. setChecked,
  56889. setCheckedKeys,
  56890. filter,
  56891. setData,
  56892. getNode,
  56893. expandNode,
  56894. collapseNode,
  56895. setExpandedKeys,
  56896. scrollToNode,
  56897. scrollTo
  56898. };
  56899. }
  56900. var ElNodeContent = defineComponent({
  56901. name: "ElTreeNodeContent",
  56902. props: treeNodeContentProps,
  56903. setup(props) {
  56904. const tree = inject(ROOT_TREE_INJECTION_KEY);
  56905. const ns = useNamespace("tree");
  56906. return () => {
  56907. const node = props.node;
  56908. const { data } = node;
  56909. return (tree == null ? void 0 : tree.ctx.slots.default) ? tree.ctx.slots.default({ node, data }) : h$1(ElText, { tag: "span", truncated: true, class: ns.be("node", "label") }, () => [node == null ? void 0 : node.label]);
  56910. };
  56911. }
  56912. });
  56913. const __default__$k = defineComponent({
  56914. name: "ElTreeNode"
  56915. });
  56916. const _sfc_main$l = /* @__PURE__ */ defineComponent({
  56917. ...__default__$k,
  56918. props: treeNodeProps,
  56919. emits: treeNodeEmits,
  56920. setup(__props, { emit }) {
  56921. const props = __props;
  56922. const tree = inject(ROOT_TREE_INJECTION_KEY);
  56923. const ns = useNamespace("tree");
  56924. const indent = computed(() => {
  56925. var _a;
  56926. return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16;
  56927. });
  56928. const icon = computed(() => {
  56929. var _a;
  56930. return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default;
  56931. });
  56932. const getNodeClass = (node) => {
  56933. const nodeClassFunc = tree == null ? void 0 : tree.props.props.class;
  56934. if (!nodeClassFunc)
  56935. return {};
  56936. let className;
  56937. if (isFunction$1(nodeClassFunc)) {
  56938. const { data } = node;
  56939. className = nodeClassFunc(data, node);
  56940. } else {
  56941. className = nodeClassFunc;
  56942. }
  56943. return isString$1(className) ? { [className]: true } : className;
  56944. };
  56945. const handleClick = (e) => {
  56946. emit("click", props.node, e);
  56947. };
  56948. const handleDrop = (e) => {
  56949. emit("drop", props.node, e);
  56950. };
  56951. const handleExpandIconClick = () => {
  56952. emit("toggle", props.node);
  56953. };
  56954. const handleCheckChange = (value) => {
  56955. emit("check", props.node, value);
  56956. };
  56957. const handleContextMenu = (event) => {
  56958. var _a, _b, _c, _d;
  56959. if ((_c = (_b = (_a = tree == null ? void 0 : tree.instance) == null ? void 0 : _a.vnode) == null ? void 0 : _b.props) == null ? void 0 : _c["onNodeContextmenu"]) {
  56960. event.stopPropagation();
  56961. event.preventDefault();
  56962. }
  56963. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  56964. };
  56965. return (_ctx, _cache) => {
  56966. var _a, _b, _c;
  56967. return openBlock(), createElementBlock("div", {
  56968. ref: "node$",
  56969. class: normalizeClass([
  56970. unref(ns).b("node"),
  56971. unref(ns).is("expanded", _ctx.expanded),
  56972. unref(ns).is("current", _ctx.current),
  56973. unref(ns).is("focusable", !_ctx.disabled),
  56974. unref(ns).is("checked", !_ctx.disabled && _ctx.checked),
  56975. getNodeClass(_ctx.node)
  56976. ]),
  56977. role: "treeitem",
  56978. tabindex: "-1",
  56979. "aria-expanded": _ctx.expanded,
  56980. "aria-disabled": _ctx.disabled,
  56981. "aria-checked": _ctx.checked,
  56982. "data-key": (_a = _ctx.node) == null ? void 0 : _a.key,
  56983. onClick: withModifiers(handleClick, ["stop"]),
  56984. onContextmenu: handleContextMenu,
  56985. onDragover: withModifiers(() => {
  56986. }, ["prevent"]),
  56987. onDragenter: withModifiers(() => {
  56988. }, ["prevent"]),
  56989. onDrop: withModifiers(handleDrop, ["stop"])
  56990. }, [
  56991. createElementVNode("div", {
  56992. class: normalizeClass(unref(ns).be("node", "content")),
  56993. style: normalizeStyle({
  56994. paddingLeft: `${(_ctx.node.level - 1) * unref(indent)}px`,
  56995. height: _ctx.itemSize + "px"
  56996. })
  56997. }, [
  56998. unref(icon) ? (openBlock(), createBlock(unref(ElIcon), {
  56999. key: 0,
  57000. class: normalizeClass([
  57001. unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  57002. unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  57003. {
  57004. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  57005. },
  57006. unref(ns).be("node", "expand-icon")
  57007. ]),
  57008. onClick: withModifiers(handleExpandIconClick, ["stop"])
  57009. }, {
  57010. default: withCtx(() => [
  57011. (openBlock(), createBlock(resolveDynamicComponent(unref(icon))))
  57012. ]),
  57013. _: 1
  57014. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  57015. _ctx.showCheckbox ? (openBlock(), createBlock(unref(ElCheckbox), {
  57016. key: 1,
  57017. "model-value": _ctx.checked,
  57018. indeterminate: _ctx.indeterminate,
  57019. disabled: _ctx.disabled,
  57020. onChange: handleCheckChange,
  57021. onClick: withModifiers(() => {
  57022. }, ["stop"])
  57023. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : createCommentVNode("v-if", true),
  57024. createVNode(unref(ElNodeContent), {
  57025. node: { ..._ctx.node, expanded: _ctx.expanded }
  57026. }, null, 8, ["node"])
  57027. ], 6)
  57028. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick", "onDragover", "onDragenter", "onDrop"]);
  57029. };
  57030. }
  57031. });
  57032. var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__file", "tree-node.vue"]]);
  57033. const __default__$j = defineComponent({
  57034. name: "ElTreeV2"
  57035. });
  57036. const _sfc_main$k = /* @__PURE__ */ defineComponent({
  57037. ...__default__$j,
  57038. props: treeProps,
  57039. emits: treeEmits,
  57040. setup(__props, { expose, emit }) {
  57041. const props = __props;
  57042. const slots = useSlots();
  57043. const treeNodeSize = computed(() => props.itemSize);
  57044. provide(ROOT_TREE_INJECTION_KEY, {
  57045. ctx: {
  57046. emit,
  57047. slots
  57048. },
  57049. props,
  57050. instance: getCurrentInstance()
  57051. });
  57052. provide(formItemContextKey, void 0);
  57053. const { t } = useLocale();
  57054. const ns = useNamespace("tree");
  57055. const {
  57056. flattenTree,
  57057. isNotEmpty,
  57058. listRef,
  57059. toggleExpand,
  57060. isIndeterminate,
  57061. isChecked,
  57062. isDisabled,
  57063. isCurrent,
  57064. isForceHiddenExpandIcon,
  57065. handleNodeClick,
  57066. handleNodeDrop,
  57067. handleNodeCheck,
  57068. toggleCheckbox,
  57069. getCurrentNode,
  57070. getCurrentKey,
  57071. setCurrentKey,
  57072. getCheckedKeys,
  57073. getCheckedNodes,
  57074. getHalfCheckedKeys,
  57075. getHalfCheckedNodes,
  57076. setChecked,
  57077. setCheckedKeys,
  57078. filter,
  57079. setData,
  57080. getNode,
  57081. expandNode,
  57082. collapseNode,
  57083. setExpandedKeys,
  57084. scrollToNode,
  57085. scrollTo
  57086. } = useTree(props, emit);
  57087. expose({
  57088. toggleCheckbox,
  57089. getCurrentNode,
  57090. getCurrentKey,
  57091. setCurrentKey,
  57092. getCheckedKeys,
  57093. getCheckedNodes,
  57094. getHalfCheckedKeys,
  57095. getHalfCheckedNodes,
  57096. setChecked,
  57097. setCheckedKeys,
  57098. filter,
  57099. setData,
  57100. getNode,
  57101. expandNode,
  57102. collapseNode,
  57103. setExpandedKeys,
  57104. scrollToNode,
  57105. scrollTo
  57106. });
  57107. return (_ctx, _cache) => {
  57108. return openBlock(), createElementBlock("div", {
  57109. class: normalizeClass([unref(ns).b(), { [unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  57110. role: "tree"
  57111. }, [
  57112. unref(isNotEmpty) ? (openBlock(), createBlock(unref(FixedSizeList$1), {
  57113. key: 0,
  57114. ref_key: "listRef",
  57115. ref: listRef,
  57116. "class-name": unref(ns).b("virtual-list"),
  57117. data: unref(flattenTree),
  57118. total: unref(flattenTree).length,
  57119. height: _ctx.height,
  57120. "item-size": unref(treeNodeSize),
  57121. "perf-mode": _ctx.perfMode,
  57122. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  57123. }, {
  57124. default: withCtx(({ data, index, style }) => [
  57125. (openBlock(), createBlock(ElTreeNode, {
  57126. key: data[index].key,
  57127. style: normalizeStyle(style),
  57128. node: data[index],
  57129. expanded: data[index].expanded,
  57130. "show-checkbox": _ctx.showCheckbox,
  57131. checked: unref(isChecked)(data[index]),
  57132. indeterminate: unref(isIndeterminate)(data[index]),
  57133. "item-size": unref(treeNodeSize),
  57134. disabled: unref(isDisabled)(data[index]),
  57135. current: unref(isCurrent)(data[index]),
  57136. "hidden-expand-icon": unref(isForceHiddenExpandIcon)(data[index]),
  57137. onClick: unref(handleNodeClick),
  57138. onToggle: unref(toggleExpand),
  57139. onCheck: unref(handleNodeCheck),
  57140. onDrop: unref(handleNodeDrop)
  57141. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck", "onDrop"]))
  57142. ]),
  57143. _: 1
  57144. }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode", "scrollbar-always-on"])) : (openBlock(), createElementBlock("div", {
  57145. key: 1,
  57146. class: normalizeClass(unref(ns).e("empty-block"))
  57147. }, [
  57148. renderSlot(_ctx.$slots, "empty", {}, () => {
  57149. var _a;
  57150. return [
  57151. createElementVNode("span", {
  57152. class: normalizeClass(unref(ns).e("empty-text"))
  57153. }, toDisplayString((_a = _ctx.emptyText) != null ? _a : unref(t)("el.tree.emptyText")), 3)
  57154. ];
  57155. })
  57156. ], 2))
  57157. ], 2);
  57158. };
  57159. }
  57160. });
  57161. var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__file", "tree.vue"]]);
  57162. const ElTreeV2 = withInstall(TreeV2);
  57163. const uploadContextKey = Symbol("uploadContextKey");
  57164. const SCOPE$2 = "ElUpload";
  57165. class UploadAjaxError extends Error {
  57166. constructor(message, status, method, url) {
  57167. super(message);
  57168. this.name = "UploadAjaxError";
  57169. this.status = status;
  57170. this.method = method;
  57171. this.url = url;
  57172. }
  57173. }
  57174. function getError(action, option, xhr) {
  57175. let msg;
  57176. if (xhr.response) {
  57177. msg = `${xhr.response.error || xhr.response}`;
  57178. } else if (xhr.responseText) {
  57179. msg = `${xhr.responseText}`;
  57180. } else {
  57181. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  57182. }
  57183. return new UploadAjaxError(msg, xhr.status, option.method, action);
  57184. }
  57185. function getBody(xhr) {
  57186. const text = xhr.responseText || xhr.response;
  57187. if (!text) {
  57188. return text;
  57189. }
  57190. try {
  57191. return JSON.parse(text);
  57192. } catch (e) {
  57193. return text;
  57194. }
  57195. }
  57196. const ajaxUpload = (option) => {
  57197. if (typeof XMLHttpRequest === "undefined")
  57198. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  57199. const xhr = new XMLHttpRequest();
  57200. const action = option.action;
  57201. if (xhr.upload) {
  57202. xhr.upload.addEventListener("progress", (evt) => {
  57203. const progressEvt = evt;
  57204. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  57205. option.onProgress(progressEvt);
  57206. });
  57207. }
  57208. const formData = new FormData();
  57209. if (option.data) {
  57210. for (const [key, value] of Object.entries(option.data)) {
  57211. if (isArray$1(value) && value.length)
  57212. formData.append(key, ...value);
  57213. else
  57214. formData.append(key, value);
  57215. }
  57216. }
  57217. formData.append(option.filename, option.file, option.file.name);
  57218. xhr.addEventListener("error", () => {
  57219. option.onError(getError(action, option, xhr));
  57220. });
  57221. xhr.addEventListener("load", () => {
  57222. if (xhr.status < 200 || xhr.status >= 300) {
  57223. return option.onError(getError(action, option, xhr));
  57224. }
  57225. option.onSuccess(getBody(xhr));
  57226. });
  57227. xhr.open(option.method, action, true);
  57228. if (option.withCredentials && "withCredentials" in xhr) {
  57229. xhr.withCredentials = true;
  57230. }
  57231. const headers = option.headers || {};
  57232. if (headers instanceof Headers) {
  57233. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  57234. } else {
  57235. for (const [key, value] of Object.entries(headers)) {
  57236. if (isNil(value))
  57237. continue;
  57238. xhr.setRequestHeader(key, String(value));
  57239. }
  57240. }
  57241. xhr.send(formData);
  57242. return xhr;
  57243. };
  57244. const uploadListTypes = ["text", "picture", "picture-card"];
  57245. let fileId = 1;
  57246. const genFileId = () => Date.now() + fileId++;
  57247. const uploadBaseProps = buildProps({
  57248. action: {
  57249. type: String,
  57250. default: "#"
  57251. },
  57252. headers: {
  57253. type: definePropType(Object)
  57254. },
  57255. method: {
  57256. type: String,
  57257. default: "post"
  57258. },
  57259. data: {
  57260. type: definePropType([Object, Function, Promise]),
  57261. default: () => mutable({})
  57262. },
  57263. multiple: Boolean,
  57264. name: {
  57265. type: String,
  57266. default: "file"
  57267. },
  57268. drag: Boolean,
  57269. withCredentials: Boolean,
  57270. showFileList: {
  57271. type: Boolean,
  57272. default: true
  57273. },
  57274. accept: {
  57275. type: String,
  57276. default: ""
  57277. },
  57278. fileList: {
  57279. type: definePropType(Array),
  57280. default: () => mutable([])
  57281. },
  57282. autoUpload: {
  57283. type: Boolean,
  57284. default: true
  57285. },
  57286. listType: {
  57287. type: String,
  57288. values: uploadListTypes,
  57289. default: "text"
  57290. },
  57291. httpRequest: {
  57292. type: definePropType(Function),
  57293. default: ajaxUpload
  57294. },
  57295. disabled: Boolean,
  57296. limit: Number
  57297. });
  57298. const uploadProps = buildProps({
  57299. ...uploadBaseProps,
  57300. beforeUpload: {
  57301. type: definePropType(Function),
  57302. default: NOOP
  57303. },
  57304. beforeRemove: {
  57305. type: definePropType(Function)
  57306. },
  57307. onRemove: {
  57308. type: definePropType(Function),
  57309. default: NOOP
  57310. },
  57311. onChange: {
  57312. type: definePropType(Function),
  57313. default: NOOP
  57314. },
  57315. onPreview: {
  57316. type: definePropType(Function),
  57317. default: NOOP
  57318. },
  57319. onSuccess: {
  57320. type: definePropType(Function),
  57321. default: NOOP
  57322. },
  57323. onProgress: {
  57324. type: definePropType(Function),
  57325. default: NOOP
  57326. },
  57327. onError: {
  57328. type: definePropType(Function),
  57329. default: NOOP
  57330. },
  57331. onExceed: {
  57332. type: definePropType(Function),
  57333. default: NOOP
  57334. },
  57335. crossorigin: {
  57336. type: definePropType(String)
  57337. }
  57338. });
  57339. const uploadListProps = buildProps({
  57340. files: {
  57341. type: definePropType(Array),
  57342. default: () => mutable([])
  57343. },
  57344. disabled: Boolean,
  57345. handlePreview: {
  57346. type: definePropType(Function),
  57347. default: NOOP
  57348. },
  57349. listType: {
  57350. type: String,
  57351. values: uploadListTypes,
  57352. default: "text"
  57353. },
  57354. crossorigin: {
  57355. type: definePropType(String)
  57356. }
  57357. });
  57358. const uploadListEmits = {
  57359. remove: (file) => !!file
  57360. };
  57361. const __default__$i = defineComponent({
  57362. name: "ElUploadList"
  57363. });
  57364. const _sfc_main$j = /* @__PURE__ */ defineComponent({
  57365. ...__default__$i,
  57366. props: uploadListProps,
  57367. emits: uploadListEmits,
  57368. setup(__props, { emit }) {
  57369. const props = __props;
  57370. const { t } = useLocale();
  57371. const nsUpload = useNamespace("upload");
  57372. const nsIcon = useNamespace("icon");
  57373. const nsList = useNamespace("list");
  57374. const disabled = useFormDisabled();
  57375. const focusing = ref(false);
  57376. const containerKls = computed(() => [
  57377. nsUpload.b("list"),
  57378. nsUpload.bm("list", props.listType),
  57379. nsUpload.is("disabled", props.disabled)
  57380. ]);
  57381. const handleRemove = (file) => {
  57382. emit("remove", file);
  57383. };
  57384. return (_ctx, _cache) => {
  57385. return openBlock(), createBlock(TransitionGroup, {
  57386. tag: "ul",
  57387. class: normalizeClass(unref(containerKls)),
  57388. name: unref(nsList).b()
  57389. }, {
  57390. default: withCtx(() => [
  57391. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file, index) => {
  57392. return openBlock(), createElementBlock("li", {
  57393. key: file.uid || file.name,
  57394. class: normalizeClass([
  57395. unref(nsUpload).be("list", "item"),
  57396. unref(nsUpload).is(file.status),
  57397. { focusing: focusing.value }
  57398. ]),
  57399. tabindex: unref(disabled) ? void 0 : 0,
  57400. "aria-disabled": unref(disabled),
  57401. role: "button",
  57402. onKeydown: withKeys(($event) => !unref(disabled) && handleRemove(file), ["delete"]),
  57403. onFocus: ($event) => focusing.value = true,
  57404. onBlur: ($event) => focusing.value = false,
  57405. onClick: ($event) => focusing.value = false
  57406. }, [
  57407. renderSlot(_ctx.$slots, "default", {
  57408. file,
  57409. index
  57410. }, () => [
  57411. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  57412. key: 0,
  57413. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  57414. src: file.url,
  57415. crossorigin: _ctx.crossorigin,
  57416. alt: ""
  57417. }, null, 10, ["src", "crossorigin"])) : createCommentVNode("v-if", true),
  57418. file.status === "uploading" || _ctx.listType !== "picture-card" ? (openBlock(), createElementBlock("div", {
  57419. key: 1,
  57420. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  57421. }, [
  57422. createElementVNode("a", {
  57423. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  57424. onClick: withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  57425. }, [
  57426. createVNode(unref(ElIcon), {
  57427. class: normalizeClass(unref(nsIcon).m("document"))
  57428. }, {
  57429. default: withCtx(() => [
  57430. createVNode(unref(document_default))
  57431. ]),
  57432. _: 1
  57433. }, 8, ["class"]),
  57434. createElementVNode("span", {
  57435. class: normalizeClass(unref(nsUpload).be("list", "item-file-name")),
  57436. title: file.name
  57437. }, toDisplayString(file.name), 11, ["title"])
  57438. ], 10, ["onClick"]),
  57439. file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  57440. key: 0,
  57441. type: _ctx.listType === "picture-card" ? "circle" : "line",
  57442. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  57443. percentage: Number(file.percentage),
  57444. style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  57445. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
  57446. ], 2)) : createCommentVNode("v-if", true),
  57447. createElementVNode("label", {
  57448. class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
  57449. }, [
  57450. _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  57451. key: 0,
  57452. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  57453. }, {
  57454. default: withCtx(() => [
  57455. createVNode(unref(circle_check_default))
  57456. ]),
  57457. _: 1
  57458. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  57459. key: 1,
  57460. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  57461. }, {
  57462. default: withCtx(() => [
  57463. createVNode(unref(check_default))
  57464. ]),
  57465. _: 1
  57466. }, 8, ["class"])) : createCommentVNode("v-if", true)
  57467. ], 2),
  57468. !unref(disabled) ? (openBlock(), createBlock(unref(ElIcon), {
  57469. key: 2,
  57470. class: normalizeClass(unref(nsIcon).m("close")),
  57471. onClick: ($event) => handleRemove(file)
  57472. }, {
  57473. default: withCtx(() => [
  57474. createVNode(unref(close_default))
  57475. ]),
  57476. _: 2
  57477. }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
  57478. createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  57479. createCommentVNode(" This is a bug which needs to be fixed "),
  57480. createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  57481. !unref(disabled) ? (openBlock(), createElementBlock("i", {
  57482. key: 3,
  57483. class: normalizeClass(unref(nsIcon).m("close-tip"))
  57484. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  57485. _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  57486. key: 4,
  57487. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  57488. }, [
  57489. createElementVNode("span", {
  57490. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  57491. onClick: ($event) => _ctx.handlePreview(file)
  57492. }, [
  57493. createVNode(unref(ElIcon), {
  57494. class: normalizeClass(unref(nsIcon).m("zoom-in"))
  57495. }, {
  57496. default: withCtx(() => [
  57497. createVNode(unref(zoom_in_default))
  57498. ]),
  57499. _: 1
  57500. }, 8, ["class"])
  57501. ], 10, ["onClick"]),
  57502. !unref(disabled) ? (openBlock(), createElementBlock("span", {
  57503. key: 0,
  57504. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  57505. onClick: ($event) => handleRemove(file)
  57506. }, [
  57507. createVNode(unref(ElIcon), {
  57508. class: normalizeClass(unref(nsIcon).m("delete"))
  57509. }, {
  57510. default: withCtx(() => [
  57511. createVNode(unref(delete_default))
  57512. ]),
  57513. _: 1
  57514. }, 8, ["class"])
  57515. ], 10, ["onClick"])) : createCommentVNode("v-if", true)
  57516. ], 2)) : createCommentVNode("v-if", true)
  57517. ])
  57518. ], 42, ["tabindex", "aria-disabled", "onKeydown", "onFocus", "onBlur", "onClick"]);
  57519. }), 128)),
  57520. renderSlot(_ctx.$slots, "append")
  57521. ]),
  57522. _: 3
  57523. }, 8, ["class", "name"]);
  57524. };
  57525. }
  57526. });
  57527. var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "upload-list.vue"]]);
  57528. const uploadDraggerProps = buildProps({
  57529. disabled: Boolean
  57530. });
  57531. const uploadDraggerEmits = {
  57532. file: (file) => isArray$1(file)
  57533. };
  57534. const COMPONENT_NAME$1 = "ElUploadDrag";
  57535. const __default__$h = defineComponent({
  57536. name: COMPONENT_NAME$1
  57537. });
  57538. const _sfc_main$i = /* @__PURE__ */ defineComponent({
  57539. ...__default__$h,
  57540. props: uploadDraggerProps,
  57541. emits: uploadDraggerEmits,
  57542. setup(__props, { emit }) {
  57543. const uploaderContext = inject(uploadContextKey);
  57544. if (!uploaderContext) {
  57545. throwError(COMPONENT_NAME$1, "usage: <el-upload><el-upload-dragger /></el-upload>");
  57546. }
  57547. const ns = useNamespace("upload");
  57548. const dragover = ref(false);
  57549. const disabled = useFormDisabled();
  57550. const onDrop = (e) => {
  57551. if (disabled.value)
  57552. return;
  57553. dragover.value = false;
  57554. e.stopPropagation();
  57555. const files = Array.from(e.dataTransfer.files);
  57556. const items = e.dataTransfer.items || [];
  57557. files.forEach((file, index) => {
  57558. var _a;
  57559. const item = items[index];
  57560. const entry = (_a = item == null ? void 0 : item.webkitGetAsEntry) == null ? void 0 : _a.call(item);
  57561. if (entry) {
  57562. file.isDirectory = entry.isDirectory;
  57563. }
  57564. });
  57565. emit("file", files);
  57566. };
  57567. const onDragover = () => {
  57568. if (!disabled.value)
  57569. dragover.value = true;
  57570. };
  57571. const onDragleave = (e) => {
  57572. if (!e.currentTarget.contains(e.relatedTarget))
  57573. dragover.value = false;
  57574. };
  57575. return (_ctx, _cache) => {
  57576. return openBlock(), createElementBlock("div", {
  57577. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  57578. onDrop: withModifiers(onDrop, ["prevent"]),
  57579. onDragover: withModifiers(onDragover, ["prevent"]),
  57580. onDragleave: withModifiers(onDragleave, ["prevent"])
  57581. }, [
  57582. renderSlot(_ctx.$slots, "default")
  57583. ], 42, ["onDrop", "onDragover", "onDragleave"]);
  57584. };
  57585. }
  57586. });
  57587. var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "upload-dragger.vue"]]);
  57588. const uploadContentProps = buildProps({
  57589. ...uploadBaseProps,
  57590. beforeUpload: {
  57591. type: definePropType(Function),
  57592. default: NOOP
  57593. },
  57594. onRemove: {
  57595. type: definePropType(Function),
  57596. default: NOOP
  57597. },
  57598. onStart: {
  57599. type: definePropType(Function),
  57600. default: NOOP
  57601. },
  57602. onSuccess: {
  57603. type: definePropType(Function),
  57604. default: NOOP
  57605. },
  57606. onProgress: {
  57607. type: definePropType(Function),
  57608. default: NOOP
  57609. },
  57610. onError: {
  57611. type: definePropType(Function),
  57612. default: NOOP
  57613. },
  57614. onExceed: {
  57615. type: definePropType(Function),
  57616. default: NOOP
  57617. }
  57618. });
  57619. const __default__$g = defineComponent({
  57620. name: "ElUploadContent",
  57621. inheritAttrs: false
  57622. });
  57623. const _sfc_main$h = /* @__PURE__ */ defineComponent({
  57624. ...__default__$g,
  57625. props: uploadContentProps,
  57626. setup(__props, { expose }) {
  57627. const props = __props;
  57628. const ns = useNamespace("upload");
  57629. const disabled = useFormDisabled();
  57630. const requests = shallowRef({});
  57631. const inputRef = shallowRef();
  57632. const uploadFiles = (files) => {
  57633. if (files.length === 0)
  57634. return;
  57635. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  57636. if (limit && fileList.length + files.length > limit) {
  57637. onExceed(files, fileList);
  57638. return;
  57639. }
  57640. if (!multiple) {
  57641. files = files.slice(0, 1);
  57642. }
  57643. for (const file of files) {
  57644. const rawFile = file;
  57645. rawFile.uid = genFileId();
  57646. onStart(rawFile);
  57647. if (autoUpload)
  57648. upload(rawFile);
  57649. }
  57650. };
  57651. const upload = async (rawFile) => {
  57652. inputRef.value.value = "";
  57653. if (!props.beforeUpload) {
  57654. return doUpload(rawFile);
  57655. }
  57656. let hookResult;
  57657. let beforeData = {};
  57658. try {
  57659. const originData = props.data;
  57660. const beforeUploadPromise = props.beforeUpload(rawFile);
  57661. beforeData = isPlainObject$1(props.data) ? cloneDeep(props.data) : props.data;
  57662. hookResult = await beforeUploadPromise;
  57663. if (isPlainObject$1(props.data) && isEqual$1(originData, beforeData)) {
  57664. beforeData = cloneDeep(props.data);
  57665. }
  57666. } catch (e) {
  57667. hookResult = false;
  57668. }
  57669. if (hookResult === false) {
  57670. props.onRemove(rawFile);
  57671. return;
  57672. }
  57673. let file = rawFile;
  57674. if (hookResult instanceof Blob) {
  57675. if (hookResult instanceof File) {
  57676. file = hookResult;
  57677. } else {
  57678. file = new File([hookResult], rawFile.name, {
  57679. type: rawFile.type
  57680. });
  57681. }
  57682. }
  57683. doUpload(Object.assign(file, {
  57684. uid: rawFile.uid
  57685. }), beforeData);
  57686. };
  57687. const resolveData = async (data, rawFile) => {
  57688. if (isFunction$1(data)) {
  57689. return data(rawFile);
  57690. }
  57691. return data;
  57692. };
  57693. const doUpload = async (rawFile, beforeData) => {
  57694. const {
  57695. headers,
  57696. data,
  57697. method,
  57698. withCredentials,
  57699. name: filename,
  57700. action,
  57701. onProgress,
  57702. onSuccess,
  57703. onError,
  57704. httpRequest
  57705. } = props;
  57706. try {
  57707. beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
  57708. } catch (e) {
  57709. props.onRemove(rawFile);
  57710. return;
  57711. }
  57712. const { uid } = rawFile;
  57713. const options = {
  57714. headers: headers || {},
  57715. withCredentials,
  57716. file: rawFile,
  57717. data: beforeData,
  57718. method,
  57719. filename,
  57720. action,
  57721. onProgress: (evt) => {
  57722. onProgress(evt, rawFile);
  57723. },
  57724. onSuccess: (res) => {
  57725. onSuccess(res, rawFile);
  57726. delete requests.value[uid];
  57727. },
  57728. onError: (err) => {
  57729. onError(err, rawFile);
  57730. delete requests.value[uid];
  57731. }
  57732. };
  57733. const request = httpRequest(options);
  57734. requests.value[uid] = request;
  57735. if (request instanceof Promise) {
  57736. request.then(options.onSuccess, options.onError);
  57737. }
  57738. };
  57739. const handleChange = (e) => {
  57740. const files = e.target.files;
  57741. if (!files)
  57742. return;
  57743. uploadFiles(Array.from(files));
  57744. };
  57745. const handleClick = () => {
  57746. if (!disabled.value) {
  57747. inputRef.value.value = "";
  57748. inputRef.value.click();
  57749. }
  57750. };
  57751. const handleKeydown = () => {
  57752. handleClick();
  57753. };
  57754. const abort = (file) => {
  57755. const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
  57756. _reqs.forEach(([uid, req]) => {
  57757. if (req instanceof XMLHttpRequest)
  57758. req.abort();
  57759. delete requests.value[uid];
  57760. });
  57761. };
  57762. expose({
  57763. abort,
  57764. upload
  57765. });
  57766. return (_ctx, _cache) => {
  57767. return openBlock(), createElementBlock("div", {
  57768. class: normalizeClass([
  57769. unref(ns).b(),
  57770. unref(ns).m(_ctx.listType),
  57771. unref(ns).is("drag", _ctx.drag),
  57772. unref(ns).is("disabled", unref(disabled))
  57773. ]),
  57774. tabindex: unref(disabled) ? void 0 : 0,
  57775. "aria-disabled": unref(disabled),
  57776. role: "button",
  57777. onClick: handleClick,
  57778. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  57779. }, [
  57780. _ctx.drag ? (openBlock(), createBlock(UploadDragger, {
  57781. key: 0,
  57782. disabled: unref(disabled),
  57783. onFile: uploadFiles
  57784. }, {
  57785. default: withCtx(() => [
  57786. renderSlot(_ctx.$slots, "default")
  57787. ]),
  57788. _: 3
  57789. }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
  57790. createElementVNode("input", {
  57791. ref_key: "inputRef",
  57792. ref: inputRef,
  57793. class: normalizeClass(unref(ns).e("input")),
  57794. name: _ctx.name,
  57795. disabled: unref(disabled),
  57796. multiple: _ctx.multiple,
  57797. accept: _ctx.accept,
  57798. type: "file",
  57799. onChange: handleChange,
  57800. onClick: withModifiers(() => {
  57801. }, ["stop"])
  57802. }, null, 42, ["name", "disabled", "multiple", "accept", "onClick"])
  57803. ], 42, ["tabindex", "aria-disabled", "onKeydown"]);
  57804. };
  57805. }
  57806. });
  57807. var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "upload-content.vue"]]);
  57808. const SCOPE$1 = "ElUpload";
  57809. const revokeFileObjectURL = (file) => {
  57810. var _a;
  57811. if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
  57812. URL.revokeObjectURL(file.url);
  57813. }
  57814. };
  57815. const useHandlers = (props, uploadRef) => {
  57816. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  57817. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  57818. function abort(file) {
  57819. var _a;
  57820. (_a = uploadRef.value) == null ? void 0 : _a.abort(file);
  57821. }
  57822. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  57823. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  57824. }
  57825. function removeFile(file) {
  57826. uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile.uid !== file.uid);
  57827. }
  57828. const handleError = (err, rawFile) => {
  57829. const file = getFile(rawFile);
  57830. if (!file)
  57831. return;
  57832. console.error(err);
  57833. file.status = "fail";
  57834. removeFile(file);
  57835. props.onError(err, file, uploadFiles.value);
  57836. props.onChange(file, uploadFiles.value);
  57837. };
  57838. const handleProgress = (evt, rawFile) => {
  57839. const file = getFile(rawFile);
  57840. if (!file)
  57841. return;
  57842. props.onProgress(evt, file, uploadFiles.value);
  57843. file.status = "uploading";
  57844. file.percentage = Math.round(evt.percent);
  57845. };
  57846. const handleSuccess = (response, rawFile) => {
  57847. const file = getFile(rawFile);
  57848. if (!file)
  57849. return;
  57850. file.status = "success";
  57851. file.response = response;
  57852. props.onSuccess(response, file, uploadFiles.value);
  57853. props.onChange(file, uploadFiles.value);
  57854. };
  57855. const handleStart = (file) => {
  57856. if (isNil(file.uid))
  57857. file.uid = genFileId();
  57858. const uploadFile = {
  57859. name: file.name,
  57860. percentage: 0,
  57861. status: "ready",
  57862. size: file.size,
  57863. raw: file,
  57864. uid: file.uid
  57865. };
  57866. if (props.listType === "picture-card" || props.listType === "picture") {
  57867. try {
  57868. uploadFile.url = URL.createObjectURL(file);
  57869. } catch (err) {
  57870. debugWarn(SCOPE$1, err.message);
  57871. props.onError(err, uploadFile, uploadFiles.value);
  57872. }
  57873. }
  57874. uploadFiles.value = [...uploadFiles.value, uploadFile];
  57875. props.onChange(uploadFile, uploadFiles.value);
  57876. };
  57877. const handleRemove = async (file) => {
  57878. const uploadFile = file instanceof File ? getFile(file) : file;
  57879. if (!uploadFile)
  57880. throwError(SCOPE$1, "file to be removed not found");
  57881. const doRemove = (file2) => {
  57882. abort(file2);
  57883. removeFile(file2);
  57884. props.onRemove(file2, uploadFiles.value);
  57885. revokeFileObjectURL(file2);
  57886. };
  57887. if (props.beforeRemove) {
  57888. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  57889. if (before !== false)
  57890. doRemove(uploadFile);
  57891. } else {
  57892. doRemove(uploadFile);
  57893. }
  57894. };
  57895. function submit() {
  57896. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  57897. var _a;
  57898. return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
  57899. });
  57900. }
  57901. watch(() => props.listType, (val) => {
  57902. if (val !== "picture-card" && val !== "picture") {
  57903. return;
  57904. }
  57905. uploadFiles.value = uploadFiles.value.map((file) => {
  57906. const { raw, url } = file;
  57907. if (!url && raw) {
  57908. try {
  57909. file.url = URL.createObjectURL(raw);
  57910. } catch (err) {
  57911. props.onError(err, file, uploadFiles.value);
  57912. }
  57913. }
  57914. return file;
  57915. });
  57916. });
  57917. watch(uploadFiles, (files) => {
  57918. for (const file of files) {
  57919. file.uid || (file.uid = genFileId());
  57920. file.status || (file.status = "success");
  57921. }
  57922. }, { immediate: true, deep: true });
  57923. return {
  57924. uploadFiles,
  57925. abort,
  57926. clearFiles,
  57927. handleError,
  57928. handleProgress,
  57929. handleStart,
  57930. handleSuccess,
  57931. handleRemove,
  57932. submit,
  57933. revokeFileObjectURL
  57934. };
  57935. };
  57936. const __default__$f = defineComponent({
  57937. name: "ElUpload"
  57938. });
  57939. const _sfc_main$g = /* @__PURE__ */ defineComponent({
  57940. ...__default__$f,
  57941. props: uploadProps,
  57942. setup(__props, { expose }) {
  57943. const props = __props;
  57944. const disabled = useFormDisabled();
  57945. const uploadRef = shallowRef();
  57946. const {
  57947. abort,
  57948. submit,
  57949. clearFiles,
  57950. uploadFiles,
  57951. handleStart,
  57952. handleError,
  57953. handleRemove,
  57954. handleSuccess,
  57955. handleProgress,
  57956. revokeFileObjectURL
  57957. } = useHandlers(props, uploadRef);
  57958. const isPictureCard = computed(() => props.listType === "picture-card");
  57959. const uploadContentProps = computed(() => ({
  57960. ...props,
  57961. fileList: uploadFiles.value,
  57962. onStart: handleStart,
  57963. onProgress: handleProgress,
  57964. onSuccess: handleSuccess,
  57965. onError: handleError,
  57966. onRemove: handleRemove
  57967. }));
  57968. onBeforeUnmount(() => {
  57969. uploadFiles.value.forEach(revokeFileObjectURL);
  57970. });
  57971. provide(uploadContextKey, {
  57972. accept: toRef(props, "accept")
  57973. });
  57974. expose({
  57975. abort,
  57976. submit,
  57977. clearFiles,
  57978. handleStart,
  57979. handleRemove
  57980. });
  57981. return (_ctx, _cache) => {
  57982. return openBlock(), createElementBlock("div", null, [
  57983. unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  57984. key: 0,
  57985. disabled: unref(disabled),
  57986. "list-type": _ctx.listType,
  57987. files: unref(uploadFiles),
  57988. crossorigin: _ctx.crossorigin,
  57989. "handle-preview": _ctx.onPreview,
  57990. onRemove: unref(handleRemove)
  57991. }, createSlots({
  57992. append: withCtx(() => [
  57993. createVNode(UploadContent, mergeProps({
  57994. ref_key: "uploadRef",
  57995. ref: uploadRef
  57996. }, unref(uploadContentProps)), {
  57997. default: withCtx(() => [
  57998. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  57999. !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  58000. ]),
  58001. _: 3
  58002. }, 16)
  58003. ]),
  58004. _: 2
  58005. }, [
  58006. _ctx.$slots.file ? {
  58007. name: "default",
  58008. fn: withCtx(({ file, index }) => [
  58009. renderSlot(_ctx.$slots, "file", {
  58010. file,
  58011. index
  58012. })
  58013. ])
  58014. } : void 0
  58015. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
  58016. !unref(isPictureCard) || unref(isPictureCard) && !_ctx.showFileList ? (openBlock(), createBlock(UploadContent, mergeProps({
  58017. key: 1,
  58018. ref_key: "uploadRef",
  58019. ref: uploadRef
  58020. }, unref(uploadContentProps)), {
  58021. default: withCtx(() => [
  58022. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  58023. !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  58024. ]),
  58025. _: 3
  58026. }, 16)) : createCommentVNode("v-if", true),
  58027. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  58028. renderSlot(_ctx.$slots, "tip"),
  58029. !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  58030. key: 3,
  58031. disabled: unref(disabled),
  58032. "list-type": _ctx.listType,
  58033. files: unref(uploadFiles),
  58034. crossorigin: _ctx.crossorigin,
  58035. "handle-preview": _ctx.onPreview,
  58036. onRemove: unref(handleRemove)
  58037. }, createSlots({
  58038. _: 2
  58039. }, [
  58040. _ctx.$slots.file ? {
  58041. name: "default",
  58042. fn: withCtx(({ file, index }) => [
  58043. renderSlot(_ctx.$slots, "file", {
  58044. file,
  58045. index
  58046. })
  58047. ])
  58048. } : void 0
  58049. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
  58050. ]);
  58051. };
  58052. }
  58053. });
  58054. var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "upload.vue"]]);
  58055. const ElUpload = withInstall(Upload);
  58056. const watermarkProps = buildProps({
  58057. zIndex: {
  58058. type: Number,
  58059. default: 9
  58060. },
  58061. rotate: {
  58062. type: Number,
  58063. default: -22
  58064. },
  58065. width: Number,
  58066. height: Number,
  58067. image: String,
  58068. content: {
  58069. type: definePropType([String, Array]),
  58070. default: "Element Plus"
  58071. },
  58072. font: {
  58073. type: definePropType(Object)
  58074. },
  58075. gap: {
  58076. type: definePropType(Array),
  58077. default: () => [100, 100]
  58078. },
  58079. offset: {
  58080. type: definePropType(Array)
  58081. }
  58082. });
  58083. function toLowercaseSeparator(key) {
  58084. return key.replace(/([A-Z])/g, "-$1").toLowerCase();
  58085. }
  58086. function getStyleStr(style) {
  58087. return Object.keys(style).map((key) => `${toLowercaseSeparator(key)}: ${style[key]};`).join(" ");
  58088. }
  58089. function getPixelRatio() {
  58090. return window.devicePixelRatio || 1;
  58091. }
  58092. const reRendering = (mutation, watermarkElement) => {
  58093. let flag = false;
  58094. if (mutation.removedNodes.length && watermarkElement) {
  58095. flag = Array.from(mutation.removedNodes).includes(watermarkElement);
  58096. }
  58097. if (mutation.type === "attributes" && mutation.target === watermarkElement) {
  58098. flag = true;
  58099. }
  58100. return flag;
  58101. };
  58102. const TEXT_ALIGN_RATIO_MAP = {
  58103. left: [0, 0.5],
  58104. start: [0, 0.5],
  58105. center: [0.5, 0],
  58106. right: [1, -0.5],
  58107. end: [1, -0.5]
  58108. };
  58109. function prepareCanvas(width, height, ratio = 1) {
  58110. const canvas = document.createElement("canvas");
  58111. const ctx = canvas.getContext("2d");
  58112. const realWidth = width * ratio;
  58113. const realHeight = height * ratio;
  58114. canvas.setAttribute("width", `${realWidth}px`);
  58115. canvas.setAttribute("height", `${realHeight}px`);
  58116. ctx.save();
  58117. return [ctx, canvas, realWidth, realHeight];
  58118. }
  58119. function useClips() {
  58120. function getClips(content, rotate, ratio, width, height, font, gapX, gapY, space) {
  58121. const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
  58122. if (content instanceof HTMLImageElement) {
  58123. ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
  58124. } else {
  58125. const {
  58126. color,
  58127. fontSize,
  58128. fontStyle,
  58129. fontWeight,
  58130. fontFamily,
  58131. textAlign,
  58132. textBaseline
  58133. } = font;
  58134. const mergedFontSize = Number(fontSize) * ratio;
  58135. ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
  58136. ctx.fillStyle = color;
  58137. ctx.textAlign = textAlign;
  58138. ctx.textBaseline = textBaseline;
  58139. const contents = isArray$1(content) ? content : [content];
  58140. contents == null ? void 0 : contents.forEach((item, index) => {
  58141. const [alignRatio, spaceRatio] = TEXT_ALIGN_RATIO_MAP[textAlign];
  58142. ctx.fillText(item != null ? item : "", contentWidth * alignRatio + space * spaceRatio, index * (mergedFontSize + font.fontGap * ratio));
  58143. });
  58144. }
  58145. const angle = Math.PI / 180 * Number(rotate);
  58146. const maxSize = Math.max(width, height);
  58147. const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
  58148. rCtx.translate(realMaxSize / 2, realMaxSize / 2);
  58149. rCtx.rotate(angle);
  58150. if (contentWidth > 0 && contentHeight > 0) {
  58151. rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
  58152. }
  58153. function getRotatePos(x, y) {
  58154. const targetX = x * Math.cos(angle) - y * Math.sin(angle);
  58155. const targetY = x * Math.sin(angle) + y * Math.cos(angle);
  58156. return [targetX, targetY];
  58157. }
  58158. let left = 0;
  58159. let right = 0;
  58160. let top = 0;
  58161. let bottom = 0;
  58162. const halfWidth = contentWidth / 2;
  58163. const halfHeight = contentHeight / 2;
  58164. const points = [
  58165. [0 - halfWidth, 0 - halfHeight],
  58166. [0 + halfWidth, 0 - halfHeight],
  58167. [0 + halfWidth, 0 + halfHeight],
  58168. [0 - halfWidth, 0 + halfHeight]
  58169. ];
  58170. points.forEach(([x, y]) => {
  58171. const [targetX, targetY] = getRotatePos(x, y);
  58172. left = Math.min(left, targetX);
  58173. right = Math.max(right, targetX);
  58174. top = Math.min(top, targetY);
  58175. bottom = Math.max(bottom, targetY);
  58176. });
  58177. const cutLeft = left + realMaxSize / 2;
  58178. const cutTop = top + realMaxSize / 2;
  58179. const cutWidth = right - left;
  58180. const cutHeight = bottom - top;
  58181. const realGapX = gapX * ratio;
  58182. const realGapY = gapY * ratio;
  58183. const filledWidth = (cutWidth + realGapX) * 2;
  58184. const filledHeight = cutHeight + realGapY;
  58185. const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
  58186. function drawImg(targetX = 0, targetY = 0) {
  58187. fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY, cutWidth, cutHeight);
  58188. }
  58189. drawImg();
  58190. drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
  58191. drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
  58192. return [fCanvas.toDataURL(), filledWidth / ratio, filledHeight / ratio];
  58193. }
  58194. return getClips;
  58195. }
  58196. const __default__$e = defineComponent({
  58197. name: "ElWatermark"
  58198. });
  58199. const _sfc_main$f = /* @__PURE__ */ defineComponent({
  58200. ...__default__$e,
  58201. props: watermarkProps,
  58202. setup(__props) {
  58203. const props = __props;
  58204. const style = {
  58205. position: "relative"
  58206. };
  58207. const fontGap = computed(() => {
  58208. var _a, _b;
  58209. return (_b = (_a = props.font) == null ? void 0 : _a.fontGap) != null ? _b : 3;
  58210. });
  58211. const color = computed(() => {
  58212. var _a, _b;
  58213. return (_b = (_a = props.font) == null ? void 0 : _a.color) != null ? _b : "rgba(0,0,0,.15)";
  58214. });
  58215. const fontSize = computed(() => {
  58216. var _a, _b;
  58217. return (_b = (_a = props.font) == null ? void 0 : _a.fontSize) != null ? _b : 16;
  58218. });
  58219. const fontWeight = computed(() => {
  58220. var _a, _b;
  58221. return (_b = (_a = props.font) == null ? void 0 : _a.fontWeight) != null ? _b : "normal";
  58222. });
  58223. const fontStyle = computed(() => {
  58224. var _a, _b;
  58225. return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
  58226. });
  58227. const fontFamily = computed(() => {
  58228. var _a, _b;
  58229. return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
  58230. });
  58231. const textAlign = computed(() => {
  58232. var _a, _b;
  58233. return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
  58234. });
  58235. const textBaseline = computed(() => {
  58236. var _a, _b;
  58237. return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
  58238. });
  58239. const gapX = computed(() => props.gap[0]);
  58240. const gapY = computed(() => props.gap[1]);
  58241. const gapXCenter = computed(() => gapX.value / 2);
  58242. const gapYCenter = computed(() => gapY.value / 2);
  58243. const offsetLeft = computed(() => {
  58244. var _a, _b;
  58245. return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
  58246. });
  58247. const offsetTop = computed(() => {
  58248. var _a, _b;
  58249. return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
  58250. });
  58251. const getMarkStyle = () => {
  58252. const markStyle = {
  58253. zIndex: props.zIndex,
  58254. position: "absolute",
  58255. left: 0,
  58256. top: 0,
  58257. width: "100%",
  58258. height: "100%",
  58259. pointerEvents: "none",
  58260. backgroundRepeat: "repeat"
  58261. };
  58262. let positionLeft = offsetLeft.value - gapXCenter.value;
  58263. let positionTop = offsetTop.value - gapYCenter.value;
  58264. if (positionLeft > 0) {
  58265. markStyle.left = `${positionLeft}px`;
  58266. markStyle.width = `calc(100% - ${positionLeft}px)`;
  58267. positionLeft = 0;
  58268. }
  58269. if (positionTop > 0) {
  58270. markStyle.top = `${positionTop}px`;
  58271. markStyle.height = `calc(100% - ${positionTop}px)`;
  58272. positionTop = 0;
  58273. }
  58274. markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
  58275. return markStyle;
  58276. };
  58277. const containerRef = shallowRef(null);
  58278. const watermarkRef = shallowRef();
  58279. const stopObservation = ref(false);
  58280. const destroyWatermark = () => {
  58281. if (watermarkRef.value) {
  58282. watermarkRef.value.remove();
  58283. watermarkRef.value = void 0;
  58284. }
  58285. };
  58286. const appendWatermark = (base64Url, markWidth) => {
  58287. var _a;
  58288. if (containerRef.value && watermarkRef.value) {
  58289. stopObservation.value = true;
  58290. watermarkRef.value.setAttribute("style", getStyleStr({
  58291. ...getMarkStyle(),
  58292. backgroundImage: `url('${base64Url}')`,
  58293. backgroundSize: `${Math.floor(markWidth)}px`
  58294. }));
  58295. (_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
  58296. setTimeout(() => {
  58297. stopObservation.value = false;
  58298. });
  58299. }
  58300. };
  58301. const getMarkSize = (ctx) => {
  58302. let defaultWidth = 120;
  58303. let defaultHeight = 64;
  58304. let space = 0;
  58305. const { image, content, width, height, rotate } = props;
  58306. if (!image && ctx.measureText) {
  58307. ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
  58308. const contents = isArray$1(content) ? content : [content];
  58309. let maxWidth = 0;
  58310. let maxHeight = 0;
  58311. contents.forEach((item) => {
  58312. const {
  58313. width: width2,
  58314. fontBoundingBoxAscent,
  58315. fontBoundingBoxDescent,
  58316. actualBoundingBoxAscent,
  58317. actualBoundingBoxDescent
  58318. } = ctx.measureText(item);
  58319. const height2 = isUndefined(fontBoundingBoxAscent) ? actualBoundingBoxAscent + actualBoundingBoxDescent : fontBoundingBoxAscent + fontBoundingBoxDescent;
  58320. if (width2 > maxWidth)
  58321. maxWidth = Math.ceil(width2);
  58322. if (height2 > maxHeight)
  58323. maxHeight = Math.ceil(height2);
  58324. });
  58325. defaultWidth = maxWidth;
  58326. defaultHeight = maxHeight * contents.length + (contents.length - 1) * fontGap.value;
  58327. const angle = Math.PI / 180 * Number(rotate);
  58328. space = Math.ceil(Math.abs(Math.sin(angle) * defaultHeight) / 2);
  58329. defaultWidth += space;
  58330. }
  58331. return [width != null ? width : defaultWidth, height != null ? height : defaultHeight, space];
  58332. };
  58333. const getClips = useClips();
  58334. const renderWatermark = () => {
  58335. const canvas = document.createElement("canvas");
  58336. const ctx = canvas.getContext("2d");
  58337. const image = props.image;
  58338. const content = props.content;
  58339. const rotate = props.rotate;
  58340. if (ctx) {
  58341. if (!watermarkRef.value) {
  58342. watermarkRef.value = document.createElement("div");
  58343. }
  58344. const ratio = getPixelRatio();
  58345. const [markWidth, markHeight, space] = getMarkSize(ctx);
  58346. const drawCanvas = (drawContent) => {
  58347. const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
  58348. color: color.value,
  58349. fontSize: fontSize.value,
  58350. fontStyle: fontStyle.value,
  58351. fontWeight: fontWeight.value,
  58352. fontFamily: fontFamily.value,
  58353. fontGap: fontGap.value,
  58354. textAlign: textAlign.value,
  58355. textBaseline: textBaseline.value
  58356. }, gapX.value, gapY.value, space);
  58357. appendWatermark(textClips, clipWidth);
  58358. };
  58359. if (image) {
  58360. const img = new Image();
  58361. img.onload = () => {
  58362. drawCanvas(img);
  58363. };
  58364. img.onerror = () => {
  58365. drawCanvas(content);
  58366. };
  58367. img.crossOrigin = "anonymous";
  58368. img.referrerPolicy = "no-referrer";
  58369. img.src = image;
  58370. } else {
  58371. drawCanvas(content);
  58372. }
  58373. }
  58374. };
  58375. onMounted(() => {
  58376. renderWatermark();
  58377. });
  58378. watch(() => props, () => {
  58379. renderWatermark();
  58380. }, {
  58381. deep: true,
  58382. flush: "post"
  58383. });
  58384. onBeforeUnmount(() => {
  58385. destroyWatermark();
  58386. });
  58387. const onMutate = (mutations) => {
  58388. if (stopObservation.value) {
  58389. return;
  58390. }
  58391. mutations.forEach((mutation) => {
  58392. if (reRendering(mutation, watermarkRef.value)) {
  58393. destroyWatermark();
  58394. renderWatermark();
  58395. }
  58396. });
  58397. };
  58398. useMutationObserver(containerRef, onMutate, {
  58399. attributes: true,
  58400. subtree: true,
  58401. childList: true
  58402. });
  58403. return (_ctx, _cache) => {
  58404. return openBlock(), createElementBlock("div", {
  58405. ref_key: "containerRef",
  58406. ref: containerRef,
  58407. style: normalizeStyle([style])
  58408. }, [
  58409. renderSlot(_ctx.$slots, "default")
  58410. ], 4);
  58411. };
  58412. }
  58413. });
  58414. var Watermark = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "watermark.vue"]]);
  58415. const ElWatermark = withInstall(Watermark);
  58416. const maskProps = buildProps({
  58417. zIndex: {
  58418. type: Number,
  58419. default: 1001
  58420. },
  58421. visible: Boolean,
  58422. fill: {
  58423. type: String,
  58424. default: "rgba(0,0,0,0.5)"
  58425. },
  58426. pos: {
  58427. type: definePropType(Object)
  58428. },
  58429. targetAreaClickable: {
  58430. type: Boolean,
  58431. default: true
  58432. }
  58433. });
  58434. function getSide(placement) {
  58435. return placement.split('-')[0];
  58436. }
  58437. function getAlignment(placement) {
  58438. return placement.split('-')[1];
  58439. }
  58440. function getMainAxisFromPlacement(placement) {
  58441. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  58442. }
  58443. function getLengthFromAxis(axis) {
  58444. return axis === 'y' ? 'height' : 'width';
  58445. }
  58446. function computeCoordsFromPlacement(_ref, placement, rtl) {
  58447. let {
  58448. reference,
  58449. floating
  58450. } = _ref;
  58451. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  58452. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  58453. const mainAxis = getMainAxisFromPlacement(placement);
  58454. const length = getLengthFromAxis(mainAxis);
  58455. const commonAlign = reference[length] / 2 - floating[length] / 2;
  58456. const side = getSide(placement);
  58457. const isVertical = mainAxis === 'x';
  58458. let coords;
  58459. switch (side) {
  58460. case 'top':
  58461. coords = {
  58462. x: commonX,
  58463. y: reference.y - floating.height
  58464. };
  58465. break;
  58466. case 'bottom':
  58467. coords = {
  58468. x: commonX,
  58469. y: reference.y + reference.height
  58470. };
  58471. break;
  58472. case 'right':
  58473. coords = {
  58474. x: reference.x + reference.width,
  58475. y: commonY
  58476. };
  58477. break;
  58478. case 'left':
  58479. coords = {
  58480. x: reference.x - floating.width,
  58481. y: commonY
  58482. };
  58483. break;
  58484. default:
  58485. coords = {
  58486. x: reference.x,
  58487. y: reference.y
  58488. };
  58489. }
  58490. switch (getAlignment(placement)) {
  58491. case 'start':
  58492. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  58493. break;
  58494. case 'end':
  58495. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  58496. break;
  58497. }
  58498. return coords;
  58499. }
  58500. /**
  58501. * Computes the `x` and `y` coordinates that will place the floating element
  58502. * next to a reference element when it is given a certain positioning strategy.
  58503. *
  58504. * This export does not have any `platform` interface logic. You will need to
  58505. * write one for the platform you are using Floating UI with.
  58506. */
  58507. const computePosition$1 = async (reference, floating, config) => {
  58508. const {
  58509. placement = 'bottom',
  58510. strategy = 'absolute',
  58511. middleware = [],
  58512. platform
  58513. } = config;
  58514. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  58515. let rects = await platform.getElementRects({
  58516. reference,
  58517. floating,
  58518. strategy
  58519. });
  58520. let {
  58521. x,
  58522. y
  58523. } = computeCoordsFromPlacement(rects, placement, rtl);
  58524. let statefulPlacement = placement;
  58525. let middlewareData = {};
  58526. let resetCount = 0;
  58527. for (let i = 0; i < middleware.length; i++) {
  58528. const {
  58529. name,
  58530. fn
  58531. } = middleware[i];
  58532. const {
  58533. x: nextX,
  58534. y: nextY,
  58535. data,
  58536. reset
  58537. } = await fn({
  58538. x,
  58539. y,
  58540. initialPlacement: placement,
  58541. placement: statefulPlacement,
  58542. strategy,
  58543. middlewareData,
  58544. rects,
  58545. platform,
  58546. elements: {
  58547. reference,
  58548. floating
  58549. }
  58550. });
  58551. x = nextX != null ? nextX : x;
  58552. y = nextY != null ? nextY : y;
  58553. middlewareData = { ...middlewareData,
  58554. [name]: { ...middlewareData[name],
  58555. ...data
  58556. }
  58557. };
  58558. if (reset && resetCount <= 50) {
  58559. resetCount++;
  58560. if (typeof reset === 'object') {
  58561. if (reset.placement) {
  58562. statefulPlacement = reset.placement;
  58563. }
  58564. if (reset.rects) {
  58565. rects = reset.rects === true ? await platform.getElementRects({
  58566. reference,
  58567. floating,
  58568. strategy
  58569. }) : reset.rects;
  58570. }
  58571. ({
  58572. x,
  58573. y
  58574. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  58575. }
  58576. i = -1;
  58577. continue;
  58578. }
  58579. }
  58580. return {
  58581. x,
  58582. y,
  58583. placement: statefulPlacement,
  58584. strategy,
  58585. middlewareData
  58586. };
  58587. };
  58588. function expandPaddingObject(padding) {
  58589. return {
  58590. top: 0,
  58591. right: 0,
  58592. bottom: 0,
  58593. left: 0,
  58594. ...padding
  58595. };
  58596. }
  58597. function getSideObjectFromPadding(padding) {
  58598. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  58599. top: padding,
  58600. right: padding,
  58601. bottom: padding,
  58602. left: padding
  58603. };
  58604. }
  58605. function rectToClientRect(rect) {
  58606. return { ...rect,
  58607. top: rect.y,
  58608. left: rect.x,
  58609. right: rect.x + rect.width,
  58610. bottom: rect.y + rect.height
  58611. };
  58612. }
  58613. /**
  58614. * Resolves with an object of overflow side offsets that determine how much the
  58615. * element is overflowing a given clipping boundary.
  58616. * - positive = overflowing the boundary by that number of pixels
  58617. * - negative = how many pixels left before it will overflow
  58618. * - 0 = lies flush with the boundary
  58619. * @see https://floating-ui.com/docs/detectOverflow
  58620. */
  58621. async function detectOverflow(middlewareArguments, options) {
  58622. var _await$platform$isEle;
  58623. if (options === void 0) {
  58624. options = {};
  58625. }
  58626. const {
  58627. x,
  58628. y,
  58629. platform,
  58630. rects,
  58631. elements,
  58632. strategy
  58633. } = middlewareArguments;
  58634. const {
  58635. boundary = 'clippingAncestors',
  58636. rootBoundary = 'viewport',
  58637. elementContext = 'floating',
  58638. altBoundary = false,
  58639. padding = 0
  58640. } = options;
  58641. const paddingObject = getSideObjectFromPadding(padding);
  58642. const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  58643. const element = elements[altBoundary ? altContext : elementContext];
  58644. const clippingClientRect = rectToClientRect(await platform.getClippingRect({
  58645. 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))),
  58646. boundary,
  58647. rootBoundary,
  58648. strategy
  58649. }));
  58650. const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  58651. rect: elementContext === 'floating' ? { ...rects.floating,
  58652. x,
  58653. y
  58654. } : rects.reference,
  58655. offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
  58656. strategy
  58657. }) : rects[elementContext]);
  58658. return {
  58659. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  58660. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  58661. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  58662. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  58663. };
  58664. }
  58665. const min$1 = Math.min;
  58666. const max$1 = Math.max;
  58667. function within(min$1$1, value, max$1$1) {
  58668. return max$1(min$1$1, min$1(value, max$1$1));
  58669. }
  58670. /**
  58671. * Positions an inner element of the floating element such that it is centered
  58672. * to the reference element.
  58673. * @see https://floating-ui.com/docs/arrow
  58674. */
  58675. const arrow = options => ({
  58676. name: 'arrow',
  58677. options,
  58678. async fn(middlewareArguments) {
  58679. // Since `element` is required, we don't Partial<> the type
  58680. const {
  58681. element,
  58682. padding = 0
  58683. } = options != null ? options : {};
  58684. const {
  58685. x,
  58686. y,
  58687. placement,
  58688. rects,
  58689. platform
  58690. } = middlewareArguments;
  58691. if (element == null) {
  58692. return {};
  58693. }
  58694. const paddingObject = getSideObjectFromPadding(padding);
  58695. const coords = {
  58696. x,
  58697. y
  58698. };
  58699. const axis = getMainAxisFromPlacement(placement);
  58700. const alignment = getAlignment(placement);
  58701. const length = getLengthFromAxis(axis);
  58702. const arrowDimensions = await platform.getDimensions(element);
  58703. const minProp = axis === 'y' ? 'top' : 'left';
  58704. const maxProp = axis === 'y' ? 'bottom' : 'right';
  58705. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  58706. const startDiff = coords[axis] - rects.reference[axis];
  58707. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  58708. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  58709. if (clientSize === 0) {
  58710. clientSize = rects.floating[length];
  58711. }
  58712. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  58713. // point is outside the floating element's bounds
  58714. const min = paddingObject[minProp];
  58715. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  58716. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  58717. const offset = within(min, center, max); // Make sure that arrow points at the reference
  58718. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  58719. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  58720. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  58721. return {
  58722. [axis]: coords[axis] - alignmentOffset,
  58723. data: {
  58724. [axis]: offset,
  58725. centerOffset: center - offset
  58726. }
  58727. };
  58728. }
  58729. });
  58730. const hash$1 = {
  58731. left: 'right',
  58732. right: 'left',
  58733. bottom: 'top',
  58734. top: 'bottom'
  58735. };
  58736. function getOppositePlacement(placement) {
  58737. return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
  58738. }
  58739. function getAlignmentSides(placement, rects, rtl) {
  58740. if (rtl === void 0) {
  58741. rtl = false;
  58742. }
  58743. const alignment = getAlignment(placement);
  58744. const mainAxis = getMainAxisFromPlacement(placement);
  58745. const length = getLengthFromAxis(mainAxis);
  58746. let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  58747. if (rects.reference[length] > rects.floating[length]) {
  58748. mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  58749. }
  58750. return {
  58751. main: mainAlignmentSide,
  58752. cross: getOppositePlacement(mainAlignmentSide)
  58753. };
  58754. }
  58755. const hash = {
  58756. start: 'end',
  58757. end: 'start'
  58758. };
  58759. function getOppositeAlignmentPlacement(placement) {
  58760. return placement.replace(/start|end/g, matched => hash[matched]);
  58761. }
  58762. function getExpandedPlacements(placement) {
  58763. const oppositePlacement = getOppositePlacement(placement);
  58764. return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
  58765. }
  58766. /**
  58767. * Changes the placement of the floating element to one that will fit if the
  58768. * initially specified `placement` does not.
  58769. * @see https://floating-ui.com/docs/flip
  58770. */
  58771. const flip = function (options) {
  58772. if (options === void 0) {
  58773. options = {};
  58774. }
  58775. return {
  58776. name: 'flip',
  58777. options,
  58778. async fn(middlewareArguments) {
  58779. var _middlewareData$flip;
  58780. const {
  58781. placement,
  58782. middlewareData,
  58783. rects,
  58784. initialPlacement,
  58785. platform,
  58786. elements
  58787. } = middlewareArguments;
  58788. const {
  58789. mainAxis: checkMainAxis = true,
  58790. crossAxis: checkCrossAxis = true,
  58791. fallbackPlacements: specifiedFallbackPlacements,
  58792. fallbackStrategy = 'bestFit',
  58793. flipAlignment = true,
  58794. ...detectOverflowOptions
  58795. } = options;
  58796. const side = getSide(placement);
  58797. const isBasePlacement = side === initialPlacement;
  58798. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  58799. const placements = [initialPlacement, ...fallbackPlacements];
  58800. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  58801. const overflows = [];
  58802. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  58803. if (checkMainAxis) {
  58804. overflows.push(overflow[side]);
  58805. }
  58806. if (checkCrossAxis) {
  58807. const {
  58808. main,
  58809. cross
  58810. } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
  58811. overflows.push(overflow[main], overflow[cross]);
  58812. }
  58813. overflowsData = [...overflowsData, {
  58814. placement,
  58815. overflows
  58816. }]; // One or more sides is overflowing
  58817. if (!overflows.every(side => side <= 0)) {
  58818. var _middlewareData$flip$, _middlewareData$flip2;
  58819. const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
  58820. const nextPlacement = placements[nextIndex];
  58821. if (nextPlacement) {
  58822. // Try next placement and re-run the lifecycle
  58823. return {
  58824. data: {
  58825. index: nextIndex,
  58826. overflows: overflowsData
  58827. },
  58828. reset: {
  58829. placement: nextPlacement
  58830. }
  58831. };
  58832. }
  58833. let resetPlacement = 'bottom';
  58834. switch (fallbackStrategy) {
  58835. case 'bestFit':
  58836. {
  58837. var _overflowsData$map$so;
  58838. const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
  58839. if (placement) {
  58840. resetPlacement = placement;
  58841. }
  58842. break;
  58843. }
  58844. case 'initialPlacement':
  58845. resetPlacement = initialPlacement;
  58846. break;
  58847. }
  58848. if (placement !== resetPlacement) {
  58849. return {
  58850. reset: {
  58851. placement: resetPlacement
  58852. }
  58853. };
  58854. }
  58855. }
  58856. return {};
  58857. }
  58858. };
  58859. };
  58860. async function convertValueToCoords(middlewareArguments, value) {
  58861. const {
  58862. placement,
  58863. platform,
  58864. elements
  58865. } = middlewareArguments;
  58866. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  58867. const side = getSide(placement);
  58868. const alignment = getAlignment(placement);
  58869. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  58870. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  58871. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  58872. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  58873. let {
  58874. mainAxis,
  58875. crossAxis,
  58876. alignmentAxis
  58877. } = typeof rawValue === 'number' ? {
  58878. mainAxis: rawValue,
  58879. crossAxis: 0,
  58880. alignmentAxis: null
  58881. } : {
  58882. mainAxis: 0,
  58883. crossAxis: 0,
  58884. alignmentAxis: null,
  58885. ...rawValue
  58886. };
  58887. if (alignment && typeof alignmentAxis === 'number') {
  58888. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  58889. }
  58890. return isVertical ? {
  58891. x: crossAxis * crossAxisMulti,
  58892. y: mainAxis * mainAxisMulti
  58893. } : {
  58894. x: mainAxis * mainAxisMulti,
  58895. y: crossAxis * crossAxisMulti
  58896. };
  58897. }
  58898. /**
  58899. * Displaces the floating element from its reference element.
  58900. * @see https://floating-ui.com/docs/offset
  58901. */
  58902. const offset = function (value) {
  58903. if (value === void 0) {
  58904. value = 0;
  58905. }
  58906. return {
  58907. name: 'offset',
  58908. options: value,
  58909. async fn(middlewareArguments) {
  58910. const {
  58911. x,
  58912. y
  58913. } = middlewareArguments;
  58914. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  58915. return {
  58916. x: x + diffCoords.x,
  58917. y: y + diffCoords.y,
  58918. data: diffCoords
  58919. };
  58920. }
  58921. };
  58922. };
  58923. function getCrossAxis(axis) {
  58924. return axis === 'x' ? 'y' : 'x';
  58925. }
  58926. /**
  58927. * Shifts the floating element in order to keep it in view when it will overflow
  58928. * a clipping boundary.
  58929. * @see https://floating-ui.com/docs/shift
  58930. */
  58931. const shift = function (options) {
  58932. if (options === void 0) {
  58933. options = {};
  58934. }
  58935. return {
  58936. name: 'shift',
  58937. options,
  58938. async fn(middlewareArguments) {
  58939. const {
  58940. x,
  58941. y,
  58942. placement
  58943. } = middlewareArguments;
  58944. const {
  58945. mainAxis: checkMainAxis = true,
  58946. crossAxis: checkCrossAxis = false,
  58947. limiter = {
  58948. fn: _ref => {
  58949. let {
  58950. x,
  58951. y
  58952. } = _ref;
  58953. return {
  58954. x,
  58955. y
  58956. };
  58957. }
  58958. },
  58959. ...detectOverflowOptions
  58960. } = options;
  58961. const coords = {
  58962. x,
  58963. y
  58964. };
  58965. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  58966. const mainAxis = getMainAxisFromPlacement(getSide(placement));
  58967. const crossAxis = getCrossAxis(mainAxis);
  58968. let mainAxisCoord = coords[mainAxis];
  58969. let crossAxisCoord = coords[crossAxis];
  58970. if (checkMainAxis) {
  58971. const minSide = mainAxis === 'y' ? 'top' : 'left';
  58972. const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
  58973. const min = mainAxisCoord + overflow[minSide];
  58974. const max = mainAxisCoord - overflow[maxSide];
  58975. mainAxisCoord = within(min, mainAxisCoord, max);
  58976. }
  58977. if (checkCrossAxis) {
  58978. const minSide = crossAxis === 'y' ? 'top' : 'left';
  58979. const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
  58980. const min = crossAxisCoord + overflow[minSide];
  58981. const max = crossAxisCoord - overflow[maxSide];
  58982. crossAxisCoord = within(min, crossAxisCoord, max);
  58983. }
  58984. const limitedCoords = limiter.fn({ ...middlewareArguments,
  58985. [mainAxis]: mainAxisCoord,
  58986. [crossAxis]: crossAxisCoord
  58987. });
  58988. return { ...limitedCoords,
  58989. data: {
  58990. x: limitedCoords.x - x,
  58991. y: limitedCoords.y - y
  58992. }
  58993. };
  58994. }
  58995. };
  58996. };
  58997. function isWindow(value) {
  58998. return value && value.document && value.location && value.alert && value.setInterval;
  58999. }
  59000. function getWindow(node) {
  59001. if (node == null) {
  59002. return window;
  59003. }
  59004. if (!isWindow(node)) {
  59005. const ownerDocument = node.ownerDocument;
  59006. return ownerDocument ? ownerDocument.defaultView || window : window;
  59007. }
  59008. return node;
  59009. }
  59010. function getComputedStyle$1(element) {
  59011. return getWindow(element).getComputedStyle(element);
  59012. }
  59013. function getNodeName(node) {
  59014. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  59015. }
  59016. function getUAString() {
  59017. const uaData = navigator.userAgentData;
  59018. if (uaData != null && uaData.brands) {
  59019. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  59020. }
  59021. return navigator.userAgent;
  59022. }
  59023. function isHTMLElement(value) {
  59024. return value instanceof getWindow(value).HTMLElement;
  59025. }
  59026. function isElement(value) {
  59027. return value instanceof getWindow(value).Element;
  59028. }
  59029. function isNode(value) {
  59030. return value instanceof getWindow(value).Node;
  59031. }
  59032. function isShadowRoot(node) {
  59033. // Browsers without `ShadowRoot` support
  59034. if (typeof ShadowRoot === 'undefined') {
  59035. return false;
  59036. }
  59037. const OwnElement = getWindow(node).ShadowRoot;
  59038. return node instanceof OwnElement || node instanceof ShadowRoot;
  59039. }
  59040. function isOverflowElement(element) {
  59041. // Firefox wants us to check `-x` and `-y` variations as well
  59042. const {
  59043. overflow,
  59044. overflowX,
  59045. overflowY
  59046. } = getComputedStyle$1(element);
  59047. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  59048. }
  59049. function isTableElement(element) {
  59050. return ['table', 'td', 'th'].includes(getNodeName(element));
  59051. }
  59052. function isContainingBlock(element) {
  59053. // TODO: Try and use feature detection here instead
  59054. const isFirefox = /firefox/i.test(getUAString());
  59055. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  59056. // create a containing block.
  59057. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  59058. return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
  59059. css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
  59060. }
  59061. function isLayoutViewport() {
  59062. // Not Safari
  59063. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  59064. // • Always-visible scrollbar or not
  59065. // • Width of <html>, etc.
  59066. // const vV = win.visualViewport;
  59067. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  59068. }
  59069. const min = Math.min;
  59070. const max = Math.max;
  59071. const round = Math.round;
  59072. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  59073. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  59074. if (includeScale === void 0) {
  59075. includeScale = false;
  59076. }
  59077. if (isFixedStrategy === void 0) {
  59078. isFixedStrategy = false;
  59079. }
  59080. const clientRect = element.getBoundingClientRect();
  59081. let scaleX = 1;
  59082. let scaleY = 1;
  59083. if (includeScale && isHTMLElement(element)) {
  59084. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  59085. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  59086. }
  59087. const win = isElement(element) ? getWindow(element) : window;
  59088. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  59089. const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
  59090. const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
  59091. const width = clientRect.width / scaleX;
  59092. const height = clientRect.height / scaleY;
  59093. return {
  59094. width,
  59095. height,
  59096. top: y,
  59097. right: x + width,
  59098. bottom: y + height,
  59099. left: x,
  59100. x,
  59101. y
  59102. };
  59103. }
  59104. function getDocumentElement(node) {
  59105. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  59106. }
  59107. function getNodeScroll(element) {
  59108. if (isElement(element)) {
  59109. return {
  59110. scrollLeft: element.scrollLeft,
  59111. scrollTop: element.scrollTop
  59112. };
  59113. }
  59114. return {
  59115. scrollLeft: element.pageXOffset,
  59116. scrollTop: element.pageYOffset
  59117. };
  59118. }
  59119. function getWindowScrollBarX(element) {
  59120. // If <html> has a CSS width greater than the viewport, then this will be
  59121. // incorrect for RTL.
  59122. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  59123. }
  59124. function isScaled(element) {
  59125. const rect = getBoundingClientRect(element);
  59126. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  59127. }
  59128. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  59129. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  59130. const documentElement = getDocumentElement(offsetParent);
  59131. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  59132. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  59133. let scroll = {
  59134. scrollLeft: 0,
  59135. scrollTop: 0
  59136. };
  59137. const offsets = {
  59138. x: 0,
  59139. y: 0
  59140. };
  59141. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  59142. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  59143. scroll = getNodeScroll(offsetParent);
  59144. }
  59145. if (isHTMLElement(offsetParent)) {
  59146. const offsetRect = getBoundingClientRect(offsetParent, true);
  59147. offsets.x = offsetRect.x + offsetParent.clientLeft;
  59148. offsets.y = offsetRect.y + offsetParent.clientTop;
  59149. } else if (documentElement) {
  59150. offsets.x = getWindowScrollBarX(documentElement);
  59151. }
  59152. }
  59153. return {
  59154. x: rect.left + scroll.scrollLeft - offsets.x,
  59155. y: rect.top + scroll.scrollTop - offsets.y,
  59156. width: rect.width,
  59157. height: rect.height
  59158. };
  59159. }
  59160. function getParentNode(node) {
  59161. if (getNodeName(node) === 'html') {
  59162. return node;
  59163. }
  59164. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  59165. // @ts-ignore
  59166. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  59167. node.parentNode || ( // DOM Element detected
  59168. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  59169. getDocumentElement(node) // fallback
  59170. );
  59171. }
  59172. function getTrueOffsetParent(element) {
  59173. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  59174. return null;
  59175. }
  59176. return composedOffsetParent(element);
  59177. }
  59178. /**
  59179. * Polyfills the old offsetParent behavior from before the spec was changed:
  59180. * https://github.com/w3c/csswg-drafts/issues/159
  59181. */
  59182. function composedOffsetParent(element) {
  59183. let {
  59184. offsetParent
  59185. } = element;
  59186. let ancestor = element;
  59187. let foundInsideSlot = false;
  59188. while (ancestor && ancestor !== offsetParent) {
  59189. const {
  59190. assignedSlot
  59191. } = ancestor;
  59192. if (assignedSlot) {
  59193. let newOffsetParent = assignedSlot.offsetParent;
  59194. if (getComputedStyle$1(assignedSlot).display === 'contents') {
  59195. const hadStyleAttribute = assignedSlot.hasAttribute('style');
  59196. const oldDisplay = assignedSlot.style.display;
  59197. assignedSlot.style.display = getComputedStyle$1(ancestor).display;
  59198. newOffsetParent = assignedSlot.offsetParent;
  59199. assignedSlot.style.display = oldDisplay;
  59200. if (!hadStyleAttribute) {
  59201. assignedSlot.removeAttribute('style');
  59202. }
  59203. }
  59204. ancestor = assignedSlot;
  59205. if (offsetParent !== newOffsetParent) {
  59206. offsetParent = newOffsetParent;
  59207. foundInsideSlot = true;
  59208. }
  59209. } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
  59210. break;
  59211. }
  59212. ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
  59213. }
  59214. return offsetParent;
  59215. }
  59216. function getContainingBlock(element) {
  59217. let currentNode = getParentNode(element);
  59218. if (isShadowRoot(currentNode)) {
  59219. currentNode = currentNode.host;
  59220. }
  59221. while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
  59222. if (isContainingBlock(currentNode)) {
  59223. return currentNode;
  59224. } else {
  59225. const parent = currentNode.parentNode;
  59226. currentNode = isShadowRoot(parent) ? parent.host : parent;
  59227. }
  59228. }
  59229. return null;
  59230. } // Gets the closest ancestor positioned element. Handles some edge cases,
  59231. // such as table ancestors and cross browser bugs.
  59232. function getOffsetParent(element) {
  59233. const window = getWindow(element);
  59234. let offsetParent = getTrueOffsetParent(element);
  59235. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  59236. offsetParent = getTrueOffsetParent(offsetParent);
  59237. }
  59238. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  59239. return window;
  59240. }
  59241. return offsetParent || getContainingBlock(element) || window;
  59242. }
  59243. function getDimensions(element) {
  59244. if (isHTMLElement(element)) {
  59245. return {
  59246. width: element.offsetWidth,
  59247. height: element.offsetHeight
  59248. };
  59249. }
  59250. const rect = getBoundingClientRect(element);
  59251. return {
  59252. width: rect.width,
  59253. height: rect.height
  59254. };
  59255. }
  59256. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  59257. let {
  59258. rect,
  59259. offsetParent,
  59260. strategy
  59261. } = _ref;
  59262. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  59263. const documentElement = getDocumentElement(offsetParent);
  59264. if (offsetParent === documentElement) {
  59265. return rect;
  59266. }
  59267. let scroll = {
  59268. scrollLeft: 0,
  59269. scrollTop: 0
  59270. };
  59271. const offsets = {
  59272. x: 0,
  59273. y: 0
  59274. };
  59275. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  59276. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  59277. scroll = getNodeScroll(offsetParent);
  59278. }
  59279. if (isHTMLElement(offsetParent)) {
  59280. const offsetRect = getBoundingClientRect(offsetParent, true);
  59281. offsets.x = offsetRect.x + offsetParent.clientLeft;
  59282. offsets.y = offsetRect.y + offsetParent.clientTop;
  59283. } // This doesn't appear to be need to be negated.
  59284. // else if (documentElement) {
  59285. // offsets.x = getWindowScrollBarX(documentElement);
  59286. // }
  59287. }
  59288. return { ...rect,
  59289. x: rect.x - scroll.scrollLeft + offsets.x,
  59290. y: rect.y - scroll.scrollTop + offsets.y
  59291. };
  59292. }
  59293. function getViewportRect(element, strategy) {
  59294. const win = getWindow(element);
  59295. const html = getDocumentElement(element);
  59296. const visualViewport = win.visualViewport;
  59297. let width = html.clientWidth;
  59298. let height = html.clientHeight;
  59299. let x = 0;
  59300. let y = 0;
  59301. if (visualViewport) {
  59302. width = visualViewport.width;
  59303. height = visualViewport.height;
  59304. const layoutViewport = isLayoutViewport();
  59305. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  59306. x = visualViewport.offsetLeft;
  59307. y = visualViewport.offsetTop;
  59308. }
  59309. }
  59310. return {
  59311. width,
  59312. height,
  59313. x,
  59314. y
  59315. };
  59316. }
  59317. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  59318. function getDocumentRect(element) {
  59319. var _element$ownerDocumen;
  59320. const html = getDocumentElement(element);
  59321. const scroll = getNodeScroll(element);
  59322. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  59323. const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  59324. const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  59325. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  59326. const y = -scroll.scrollTop;
  59327. if (getComputedStyle$1(body || html).direction === 'rtl') {
  59328. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  59329. }
  59330. return {
  59331. width,
  59332. height,
  59333. x,
  59334. y
  59335. };
  59336. }
  59337. function getNearestOverflowAncestor(node) {
  59338. const parentNode = getParentNode(node);
  59339. if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
  59340. // @ts-ignore assume body is always available
  59341. return node.ownerDocument.body;
  59342. }
  59343. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  59344. return parentNode;
  59345. }
  59346. return getNearestOverflowAncestor(parentNode);
  59347. }
  59348. function getOverflowAncestors(node, list) {
  59349. var _node$ownerDocument;
  59350. if (list === void 0) {
  59351. list = [];
  59352. }
  59353. const scrollableAncestor = getNearestOverflowAncestor(node);
  59354. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  59355. const win = getWindow(scrollableAncestor);
  59356. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  59357. const updatedList = list.concat(target);
  59358. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  59359. updatedList.concat(getOverflowAncestors(target));
  59360. }
  59361. function contains(parent, child) {
  59362. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  59363. if (parent.contains(child)) {
  59364. return true;
  59365. } // then fallback to custom implementation with Shadow DOM support
  59366. else if (rootNode && isShadowRoot(rootNode)) {
  59367. let next = child;
  59368. do {
  59369. // use `===` replace node.isSameNode()
  59370. if (next && parent === next) {
  59371. return true;
  59372. } // @ts-ignore: need a better way to handle this...
  59373. next = next.parentNode || next.host;
  59374. } while (next);
  59375. }
  59376. return false;
  59377. }
  59378. function getInnerBoundingClientRect(element, strategy) {
  59379. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  59380. const top = clientRect.top + element.clientTop;
  59381. const left = clientRect.left + element.clientLeft;
  59382. return {
  59383. top,
  59384. left,
  59385. x: left,
  59386. y: top,
  59387. right: left + element.clientWidth,
  59388. bottom: top + element.clientHeight,
  59389. width: element.clientWidth,
  59390. height: element.clientHeight
  59391. };
  59392. }
  59393. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  59394. if (clippingParent === 'viewport') {
  59395. return rectToClientRect(getViewportRect(element, strategy));
  59396. }
  59397. if (isElement(clippingParent)) {
  59398. return getInnerBoundingClientRect(clippingParent, strategy);
  59399. }
  59400. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  59401. } // A "clipping ancestor" is an overflowable container with the characteristic of
  59402. // clipping (or hiding) overflowing elements with a position different from
  59403. // `initial`
  59404. function getClippingAncestors(element) {
  59405. const clippingAncestors = getOverflowAncestors(element);
  59406. const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
  59407. const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  59408. if (!isElement(clipperElement)) {
  59409. return [];
  59410. } // @ts-ignore isElement check ensures we return Array<Element>
  59411. return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  59412. } // Gets the maximum area that the element is visible in due to any number of
  59413. // clipping ancestors
  59414. function getClippingRect(_ref) {
  59415. let {
  59416. element,
  59417. boundary,
  59418. rootBoundary,
  59419. strategy
  59420. } = _ref;
  59421. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  59422. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  59423. const firstClippingAncestor = clippingAncestors[0];
  59424. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  59425. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  59426. accRect.top = max(rect.top, accRect.top);
  59427. accRect.right = min(rect.right, accRect.right);
  59428. accRect.bottom = min(rect.bottom, accRect.bottom);
  59429. accRect.left = max(rect.left, accRect.left);
  59430. return accRect;
  59431. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  59432. return {
  59433. width: clippingRect.right - clippingRect.left,
  59434. height: clippingRect.bottom - clippingRect.top,
  59435. x: clippingRect.left,
  59436. y: clippingRect.top
  59437. };
  59438. }
  59439. const platform = {
  59440. getClippingRect,
  59441. convertOffsetParentRelativeRectToViewportRelativeRect,
  59442. isElement,
  59443. getDimensions,
  59444. getOffsetParent,
  59445. getDocumentElement,
  59446. getElementRects: _ref => {
  59447. let {
  59448. reference,
  59449. floating,
  59450. strategy
  59451. } = _ref;
  59452. return {
  59453. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  59454. floating: { ...getDimensions(floating),
  59455. x: 0,
  59456. y: 0
  59457. }
  59458. };
  59459. },
  59460. getClientRects: element => Array.from(element.getClientRects()),
  59461. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  59462. };
  59463. /**
  59464. * Automatically updates the position of the floating element when necessary.
  59465. * @see https://floating-ui.com/docs/autoUpdate
  59466. */
  59467. function autoUpdate(reference, floating, update, options) {
  59468. if (options === void 0) {
  59469. options = {};
  59470. }
  59471. const {
  59472. ancestorScroll: _ancestorScroll = true,
  59473. ancestorResize: _ancestorResize = true,
  59474. elementResize = true,
  59475. animationFrame = false
  59476. } = options;
  59477. const ancestorScroll = _ancestorScroll && !animationFrame;
  59478. const ancestorResize = _ancestorResize && !animationFrame;
  59479. const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
  59480. ancestors.forEach(ancestor => {
  59481. ancestorScroll && ancestor.addEventListener('scroll', update, {
  59482. passive: true
  59483. });
  59484. ancestorResize && ancestor.addEventListener('resize', update);
  59485. });
  59486. let observer = null;
  59487. if (elementResize) {
  59488. let initialUpdate = true;
  59489. observer = new ResizeObserver(() => {
  59490. if (!initialUpdate) {
  59491. update();
  59492. }
  59493. initialUpdate = false;
  59494. });
  59495. isElement(reference) && !animationFrame && observer.observe(reference);
  59496. observer.observe(floating);
  59497. }
  59498. let frameId;
  59499. let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  59500. if (animationFrame) {
  59501. frameLoop();
  59502. }
  59503. function frameLoop() {
  59504. const nextRefRect = getBoundingClientRect(reference);
  59505. if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
  59506. update();
  59507. }
  59508. prevRefRect = nextRefRect;
  59509. frameId = requestAnimationFrame(frameLoop);
  59510. }
  59511. update();
  59512. return () => {
  59513. var _observer;
  59514. ancestors.forEach(ancestor => {
  59515. ancestorScroll && ancestor.removeEventListener('scroll', update);
  59516. ancestorResize && ancestor.removeEventListener('resize', update);
  59517. });
  59518. (_observer = observer) == null ? void 0 : _observer.disconnect();
  59519. observer = null;
  59520. if (animationFrame) {
  59521. cancelAnimationFrame(frameId);
  59522. }
  59523. };
  59524. }
  59525. /**
  59526. * Computes the `x` and `y` coordinates that will place the floating element
  59527. * next to a reference element when it is given a certain CSS positioning
  59528. * strategy.
  59529. */
  59530. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  59531. platform,
  59532. ...options
  59533. });
  59534. const useTarget = (target, open, gap, mergedMask, scrollIntoViewOptions) => {
  59535. const posInfo = ref(null);
  59536. const getTargetEl = () => {
  59537. let targetEl;
  59538. if (isString$1(target.value)) {
  59539. targetEl = document.querySelector(target.value);
  59540. } else if (isFunction$1(target.value)) {
  59541. targetEl = target.value();
  59542. } else {
  59543. targetEl = target.value;
  59544. }
  59545. return targetEl;
  59546. };
  59547. const updatePosInfo = () => {
  59548. const targetEl = getTargetEl();
  59549. if (!targetEl || !open.value) {
  59550. posInfo.value = null;
  59551. return;
  59552. }
  59553. if (!isInViewPort(targetEl)) {
  59554. targetEl.scrollIntoView(scrollIntoViewOptions.value);
  59555. }
  59556. const { left, top, width, height } = targetEl.getBoundingClientRect();
  59557. posInfo.value = {
  59558. left,
  59559. top,
  59560. width,
  59561. height,
  59562. radius: 0
  59563. };
  59564. };
  59565. onMounted(() => {
  59566. watch([open, target], () => {
  59567. updatePosInfo();
  59568. }, {
  59569. immediate: true
  59570. });
  59571. window.addEventListener("resize", updatePosInfo);
  59572. });
  59573. onBeforeUnmount(() => {
  59574. window.removeEventListener("resize", updatePosInfo);
  59575. });
  59576. const getGapOffset = (index) => {
  59577. var _a;
  59578. return (_a = isArray$1(gap.value.offset) ? gap.value.offset[index] : gap.value.offset) != null ? _a : 6;
  59579. };
  59580. const mergedPosInfo = computed(() => {
  59581. var _a;
  59582. if (!posInfo.value)
  59583. return posInfo.value;
  59584. const gapOffsetX = getGapOffset(0);
  59585. const gapOffsetY = getGapOffset(1);
  59586. const gapRadius = ((_a = gap.value) == null ? void 0 : _a.radius) || 2;
  59587. return {
  59588. left: posInfo.value.left - gapOffsetX,
  59589. top: posInfo.value.top - gapOffsetY,
  59590. width: posInfo.value.width + gapOffsetX * 2,
  59591. height: posInfo.value.height + gapOffsetY * 2,
  59592. radius: gapRadius
  59593. };
  59594. });
  59595. const triggerTarget = computed(() => {
  59596. const targetEl = getTargetEl();
  59597. if (!mergedMask.value || !targetEl || !window.DOMRect) {
  59598. return targetEl || void 0;
  59599. }
  59600. return {
  59601. getBoundingClientRect() {
  59602. var _a, _b, _c, _d;
  59603. return window.DOMRect.fromRect({
  59604. width: ((_a = mergedPosInfo.value) == null ? void 0 : _a.width) || 0,
  59605. height: ((_b = mergedPosInfo.value) == null ? void 0 : _b.height) || 0,
  59606. x: ((_c = mergedPosInfo.value) == null ? void 0 : _c.left) || 0,
  59607. y: ((_d = mergedPosInfo.value) == null ? void 0 : _d.top) || 0
  59608. });
  59609. }
  59610. };
  59611. });
  59612. return {
  59613. mergedPosInfo,
  59614. triggerTarget
  59615. };
  59616. };
  59617. const tourKey = Symbol("ElTour");
  59618. function isInViewPort(element) {
  59619. const viewWidth = window.innerWidth || document.documentElement.clientWidth;
  59620. const viewHeight = window.innerHeight || document.documentElement.clientHeight;
  59621. const { top, right, bottom, left } = element.getBoundingClientRect();
  59622. return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
  59623. }
  59624. const useFloating = (referenceRef, contentRef, arrowRef, placement, strategy, offset$1, zIndex, showArrow) => {
  59625. const x = ref();
  59626. const y = ref();
  59627. const middlewareData = ref({});
  59628. const states = {
  59629. x,
  59630. y,
  59631. placement,
  59632. strategy,
  59633. middlewareData
  59634. };
  59635. const middleware = computed(() => {
  59636. const _middleware = [
  59637. offset(unref(offset$1)),
  59638. flip(),
  59639. shift(),
  59640. overflowMiddleware()
  59641. ];
  59642. if (unref(showArrow) && unref(arrowRef)) {
  59643. _middleware.push(arrow({
  59644. element: unref(arrowRef)
  59645. }));
  59646. }
  59647. return _middleware;
  59648. });
  59649. const update = async () => {
  59650. if (!isClient)
  59651. return;
  59652. const referenceEl = unref(referenceRef);
  59653. const contentEl = unref(contentRef);
  59654. if (!referenceEl || !contentEl)
  59655. return;
  59656. const data = await computePosition(referenceEl, contentEl, {
  59657. placement: unref(placement),
  59658. strategy: unref(strategy),
  59659. middleware: unref(middleware)
  59660. });
  59661. keysOf(states).forEach((key) => {
  59662. states[key].value = data[key];
  59663. });
  59664. };
  59665. const contentStyle = computed(() => {
  59666. if (!unref(referenceRef)) {
  59667. return {
  59668. position: "fixed",
  59669. top: "50%",
  59670. left: "50%",
  59671. transform: "translate3d(-50%, -50%, 0)",
  59672. maxWidth: "100vw",
  59673. zIndex: unref(zIndex)
  59674. };
  59675. }
  59676. const { overflow } = unref(middlewareData);
  59677. return {
  59678. position: unref(strategy),
  59679. zIndex: unref(zIndex),
  59680. top: unref(y) != null ? `${unref(y)}px` : "",
  59681. left: unref(x) != null ? `${unref(x)}px` : "",
  59682. maxWidth: (overflow == null ? void 0 : overflow.maxWidth) ? `${overflow == null ? void 0 : overflow.maxWidth}px` : ""
  59683. };
  59684. });
  59685. const arrowStyle = computed(() => {
  59686. if (!unref(showArrow))
  59687. return {};
  59688. const { arrow: arrow2 } = unref(middlewareData);
  59689. return {
  59690. left: (arrow2 == null ? void 0 : arrow2.x) != null ? `${arrow2 == null ? void 0 : arrow2.x}px` : "",
  59691. top: (arrow2 == null ? void 0 : arrow2.y) != null ? `${arrow2 == null ? void 0 : arrow2.y}px` : ""
  59692. };
  59693. });
  59694. let cleanup;
  59695. onMounted(() => {
  59696. const referenceEl = unref(referenceRef);
  59697. const contentEl = unref(contentRef);
  59698. if (referenceEl && contentEl) {
  59699. cleanup = autoUpdate(referenceEl, contentEl, update);
  59700. }
  59701. watchEffect(() => {
  59702. update();
  59703. });
  59704. });
  59705. onBeforeUnmount(() => {
  59706. cleanup && cleanup();
  59707. });
  59708. return {
  59709. update,
  59710. contentStyle,
  59711. arrowStyle
  59712. };
  59713. };
  59714. const overflowMiddleware = () => {
  59715. return {
  59716. name: "overflow",
  59717. async fn(state) {
  59718. const overflow = await detectOverflow(state);
  59719. let overWidth = 0;
  59720. if (overflow.left > 0)
  59721. overWidth = overflow.left;
  59722. if (overflow.right > 0)
  59723. overWidth = overflow.right;
  59724. const floatingWidth = state.rects.floating.width;
  59725. return {
  59726. data: {
  59727. maxWidth: floatingWidth - overWidth
  59728. }
  59729. };
  59730. }
  59731. };
  59732. };
  59733. const __default__$d = defineComponent({
  59734. name: "ElTourMask",
  59735. inheritAttrs: false
  59736. });
  59737. const _sfc_main$e = /* @__PURE__ */ defineComponent({
  59738. ...__default__$d,
  59739. props: maskProps,
  59740. setup(__props) {
  59741. const props = __props;
  59742. const { ns } = inject(tourKey);
  59743. const radius = computed(() => {
  59744. var _a, _b;
  59745. return (_b = (_a = props.pos) == null ? void 0 : _a.radius) != null ? _b : 2;
  59746. });
  59747. const roundInfo = computed(() => {
  59748. const v = radius.value;
  59749. const baseInfo = `a${v},${v} 0 0 1`;
  59750. return {
  59751. topRight: `${baseInfo} ${v},${v}`,
  59752. bottomRight: `${baseInfo} ${-v},${v}`,
  59753. bottomLeft: `${baseInfo} ${-v},${-v}`,
  59754. topLeft: `${baseInfo} ${v},${-v}`
  59755. };
  59756. });
  59757. const { width: windowWidth, height: windowHeight } = useWindowSize();
  59758. const path = computed(() => {
  59759. const width = windowWidth.value;
  59760. const height = windowHeight.value;
  59761. const info = roundInfo.value;
  59762. const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
  59763. const _radius = radius.value;
  59764. 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;
  59765. });
  59766. const maskStyle = computed(() => ({
  59767. position: "fixed",
  59768. left: 0,
  59769. right: 0,
  59770. top: 0,
  59771. bottom: 0,
  59772. zIndex: props.zIndex,
  59773. pointerEvents: props.pos && props.targetAreaClickable ? "none" : "auto"
  59774. }));
  59775. const pathStyle = computed(() => ({
  59776. fill: props.fill,
  59777. pointerEvents: "auto",
  59778. cursor: "auto"
  59779. }));
  59780. useLockscreen(toRef(props, "visible"), {
  59781. ns
  59782. });
  59783. return (_ctx, _cache) => {
  59784. return _ctx.visible ? (openBlock(), createElementBlock("div", mergeProps({
  59785. key: 0,
  59786. class: unref(ns).e("mask"),
  59787. style: unref(maskStyle)
  59788. }, _ctx.$attrs), [
  59789. (openBlock(), createElementBlock("svg", { style: {
  59790. width: "100%",
  59791. height: "100%"
  59792. } }, [
  59793. createElementVNode("path", {
  59794. class: normalizeClass(unref(ns).e("hollow")),
  59795. style: normalizeStyle(unref(pathStyle)),
  59796. d: unref(path)
  59797. }, null, 14, ["d"])
  59798. ]))
  59799. ], 16)) : createCommentVNode("v-if", true);
  59800. };
  59801. }
  59802. });
  59803. var ElTourMask = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "mask.vue"]]);
  59804. const tourStrategies = ["absolute", "fixed"];
  59805. const tourPlacements = [
  59806. "top-start",
  59807. "top-end",
  59808. "top",
  59809. "bottom-start",
  59810. "bottom-end",
  59811. "bottom",
  59812. "left-start",
  59813. "left-end",
  59814. "left",
  59815. "right-start",
  59816. "right-end",
  59817. "right"
  59818. ];
  59819. const tourContentProps = buildProps({
  59820. placement: {
  59821. type: definePropType(String),
  59822. values: tourPlacements,
  59823. default: "bottom"
  59824. },
  59825. reference: {
  59826. type: definePropType(Object),
  59827. default: null
  59828. },
  59829. strategy: {
  59830. type: definePropType(String),
  59831. values: tourStrategies,
  59832. default: "absolute"
  59833. },
  59834. offset: {
  59835. type: Number,
  59836. default: 10
  59837. },
  59838. showArrow: Boolean,
  59839. zIndex: {
  59840. type: Number,
  59841. default: 2001
  59842. }
  59843. });
  59844. const tourContentEmits = {
  59845. close: () => true
  59846. };
  59847. const __default__$c = defineComponent({
  59848. name: "ElTourContent"
  59849. });
  59850. const _sfc_main$d = /* @__PURE__ */ defineComponent({
  59851. ...__default__$c,
  59852. props: tourContentProps,
  59853. emits: tourContentEmits,
  59854. setup(__props, { emit }) {
  59855. const props = __props;
  59856. const placement = ref(props.placement);
  59857. const strategy = ref(props.strategy);
  59858. const contentRef = ref(null);
  59859. const arrowRef = ref(null);
  59860. watch(() => props.placement, () => {
  59861. placement.value = props.placement;
  59862. });
  59863. const { contentStyle, arrowStyle } = useFloating(toRef(props, "reference"), contentRef, arrowRef, placement, strategy, toRef(props, "offset"), toRef(props, "zIndex"), toRef(props, "showArrow"));
  59864. const side = computed(() => {
  59865. return placement.value.split("-")[0];
  59866. });
  59867. const { ns } = inject(tourKey);
  59868. const onCloseRequested = () => {
  59869. emit("close");
  59870. };
  59871. const onFocusoutPrevented = (event) => {
  59872. if (event.detail.focusReason === "pointer") {
  59873. event.preventDefault();
  59874. }
  59875. };
  59876. return (_ctx, _cache) => {
  59877. return openBlock(), createElementBlock("div", {
  59878. ref_key: "contentRef",
  59879. ref: contentRef,
  59880. style: normalizeStyle(unref(contentStyle)),
  59881. class: normalizeClass(unref(ns).e("content")),
  59882. "data-side": unref(side),
  59883. tabindex: "-1"
  59884. }, [
  59885. createVNode(unref(ElFocusTrap), {
  59886. loop: "",
  59887. trapped: "",
  59888. "focus-start-el": "container",
  59889. "focus-trap-el": contentRef.value || void 0,
  59890. onReleaseRequested: onCloseRequested,
  59891. onFocusoutPrevented
  59892. }, {
  59893. default: withCtx(() => [
  59894. renderSlot(_ctx.$slots, "default")
  59895. ]),
  59896. _: 3
  59897. }, 8, ["focus-trap-el"]),
  59898. _ctx.showArrow ? (openBlock(), createElementBlock("span", {
  59899. key: 0,
  59900. ref_key: "arrowRef",
  59901. ref: arrowRef,
  59902. style: normalizeStyle(unref(arrowStyle)),
  59903. class: normalizeClass(unref(ns).e("arrow"))
  59904. }, null, 6)) : createCommentVNode("v-if", true)
  59905. ], 14, ["data-side"]);
  59906. };
  59907. }
  59908. });
  59909. var ElTourContent = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "content.vue"]]);
  59910. var ElTourSteps = defineComponent({
  59911. name: "ElTourSteps",
  59912. props: {
  59913. current: {
  59914. type: Number,
  59915. default: 0
  59916. }
  59917. },
  59918. emits: ["update-total"],
  59919. setup(props, { slots, emit }) {
  59920. let cacheTotal = 0;
  59921. return () => {
  59922. var _a, _b;
  59923. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  59924. const result = [];
  59925. let total = 0;
  59926. function filterSteps(children2) {
  59927. if (!isArray$1(children2))
  59928. return;
  59929. children2.forEach((item) => {
  59930. var _a2;
  59931. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  59932. if (name === "ElTourStep") {
  59933. result.push(item);
  59934. total += 1;
  59935. }
  59936. });
  59937. }
  59938. if (children.length) {
  59939. filterSteps(flattedChildren((_b = children[0]) == null ? void 0 : _b.children));
  59940. }
  59941. if (cacheTotal !== total) {
  59942. cacheTotal = total;
  59943. emit("update-total", total);
  59944. }
  59945. if (result.length) {
  59946. return result[props.current];
  59947. }
  59948. return null;
  59949. };
  59950. }
  59951. });
  59952. const tourProps = buildProps({
  59953. modelValue: Boolean,
  59954. current: {
  59955. type: Number,
  59956. default: 0
  59957. },
  59958. showArrow: {
  59959. type: Boolean,
  59960. default: true
  59961. },
  59962. showClose: {
  59963. type: Boolean,
  59964. default: true
  59965. },
  59966. closeIcon: {
  59967. type: iconPropType
  59968. },
  59969. placement: tourContentProps.placement,
  59970. contentStyle: {
  59971. type: definePropType([Object])
  59972. },
  59973. mask: {
  59974. type: definePropType([Boolean, Object]),
  59975. default: true
  59976. },
  59977. gap: {
  59978. type: definePropType(Object),
  59979. default: () => ({
  59980. offset: 6,
  59981. radius: 2
  59982. })
  59983. },
  59984. zIndex: {
  59985. type: Number
  59986. },
  59987. scrollIntoViewOptions: {
  59988. type: definePropType([Boolean, Object]),
  59989. default: () => ({
  59990. block: "center"
  59991. })
  59992. },
  59993. type: {
  59994. type: definePropType(String)
  59995. },
  59996. appendTo: {
  59997. type: teleportProps.to.type,
  59998. default: "body"
  59999. },
  60000. closeOnPressEscape: {
  60001. type: Boolean,
  60002. default: true
  60003. },
  60004. targetAreaClickable: {
  60005. type: Boolean,
  60006. default: true
  60007. }
  60008. });
  60009. const tourEmits = {
  60010. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  60011. ["update:current"]: (current) => isNumber(current),
  60012. close: (current) => isNumber(current),
  60013. finish: () => true,
  60014. change: (current) => isNumber(current)
  60015. };
  60016. const __default__$b = defineComponent({
  60017. name: "ElTour"
  60018. });
  60019. const _sfc_main$c = /* @__PURE__ */ defineComponent({
  60020. ...__default__$b,
  60021. props: tourProps,
  60022. emits: tourEmits,
  60023. setup(__props, { emit }) {
  60024. const props = __props;
  60025. const ns = useNamespace("tour");
  60026. const total = ref(0);
  60027. const currentStep = ref();
  60028. const current = useVModel(props, "current", emit, {
  60029. passive: true
  60030. });
  60031. const currentTarget = computed(() => {
  60032. var _a;
  60033. return (_a = currentStep.value) == null ? void 0 : _a.target;
  60034. });
  60035. const kls = computed(() => [
  60036. ns.b(),
  60037. mergedType.value === "primary" ? ns.m("primary") : ""
  60038. ]);
  60039. const mergedPlacement = computed(() => {
  60040. var _a;
  60041. return ((_a = currentStep.value) == null ? void 0 : _a.placement) || props.placement;
  60042. });
  60043. const mergedContentStyle = computed(() => {
  60044. var _a, _b;
  60045. return (_b = (_a = currentStep.value) == null ? void 0 : _a.contentStyle) != null ? _b : props.contentStyle;
  60046. });
  60047. const mergedMask = computed(() => {
  60048. var _a, _b;
  60049. return (_b = (_a = currentStep.value) == null ? void 0 : _a.mask) != null ? _b : props.mask;
  60050. });
  60051. const mergedShowMask = computed(() => !!mergedMask.value && props.modelValue);
  60052. const mergedMaskStyle = computed(() => isBoolean(mergedMask.value) ? void 0 : mergedMask.value);
  60053. const mergedShowArrow = computed(() => {
  60054. var _a, _b;
  60055. return !!currentTarget.value && ((_b = (_a = currentStep.value) == null ? void 0 : _a.showArrow) != null ? _b : props.showArrow);
  60056. });
  60057. const mergedScrollIntoViewOptions = computed(() => {
  60058. var _a, _b;
  60059. return (_b = (_a = currentStep.value) == null ? void 0 : _a.scrollIntoViewOptions) != null ? _b : props.scrollIntoViewOptions;
  60060. });
  60061. const mergedType = computed(() => {
  60062. var _a, _b;
  60063. return (_b = (_a = currentStep.value) == null ? void 0 : _a.type) != null ? _b : props.type;
  60064. });
  60065. const { nextZIndex } = useZIndex();
  60066. const nowZIndex = nextZIndex();
  60067. const mergedZIndex = computed(() => {
  60068. var _a;
  60069. return (_a = props.zIndex) != null ? _a : nowZIndex;
  60070. });
  60071. const { mergedPosInfo: pos, triggerTarget } = useTarget(currentTarget, toRef(props, "modelValue"), toRef(props, "gap"), mergedMask, mergedScrollIntoViewOptions);
  60072. watch(() => props.modelValue, (val) => {
  60073. if (!val) {
  60074. current.value = 0;
  60075. }
  60076. });
  60077. const onEscClose = () => {
  60078. if (props.closeOnPressEscape) {
  60079. emit(UPDATE_MODEL_EVENT, false);
  60080. emit("close", current.value);
  60081. }
  60082. };
  60083. const onUpdateTotal = (val) => {
  60084. total.value = val;
  60085. };
  60086. const slots = useSlots();
  60087. provide(tourKey, {
  60088. currentStep,
  60089. current,
  60090. total,
  60091. showClose: toRef(props, "showClose"),
  60092. closeIcon: toRef(props, "closeIcon"),
  60093. mergedType,
  60094. ns,
  60095. slots,
  60096. updateModelValue(modelValue) {
  60097. emit(UPDATE_MODEL_EVENT, modelValue);
  60098. },
  60099. onClose() {
  60100. emit("close", current.value);
  60101. },
  60102. onFinish() {
  60103. emit("finish");
  60104. },
  60105. onChange() {
  60106. emit(CHANGE_EVENT, current.value);
  60107. }
  60108. });
  60109. return (_ctx, _cache) => {
  60110. return openBlock(), createElementBlock(Fragment, null, [
  60111. createVNode(unref(ElTeleport$1), { to: _ctx.appendTo }, {
  60112. default: withCtx(() => {
  60113. var _a, _b;
  60114. return [
  60115. createElementVNode("div", mergeProps({ class: unref(kls) }, _ctx.$attrs), [
  60116. createVNode(ElTourMask, {
  60117. visible: unref(mergedShowMask),
  60118. fill: (_a = unref(mergedMaskStyle)) == null ? void 0 : _a.color,
  60119. style: normalizeStyle((_b = unref(mergedMaskStyle)) == null ? void 0 : _b.style),
  60120. pos: unref(pos),
  60121. "z-index": unref(mergedZIndex),
  60122. "target-area-clickable": _ctx.targetAreaClickable
  60123. }, null, 8, ["visible", "fill", "style", "pos", "z-index", "target-area-clickable"]),
  60124. _ctx.modelValue ? (openBlock(), createBlock(ElTourContent, {
  60125. key: unref(current),
  60126. reference: unref(triggerTarget),
  60127. placement: unref(mergedPlacement),
  60128. "show-arrow": unref(mergedShowArrow),
  60129. "z-index": unref(mergedZIndex),
  60130. style: normalizeStyle(unref(mergedContentStyle)),
  60131. onClose: onEscClose
  60132. }, {
  60133. default: withCtx(() => [
  60134. createVNode(unref(ElTourSteps), {
  60135. current: unref(current),
  60136. onUpdateTotal
  60137. }, {
  60138. default: withCtx(() => [
  60139. renderSlot(_ctx.$slots, "default")
  60140. ]),
  60141. _: 3
  60142. }, 8, ["current"])
  60143. ]),
  60144. _: 3
  60145. }, 8, ["reference", "placement", "show-arrow", "z-index", "style"])) : createCommentVNode("v-if", true)
  60146. ], 16)
  60147. ];
  60148. }),
  60149. _: 3
  60150. }, 8, ["to"]),
  60151. createCommentVNode(" just for IDE "),
  60152. createCommentVNode("v-if", true)
  60153. ], 64);
  60154. };
  60155. }
  60156. });
  60157. var Tour = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "tour.vue"]]);
  60158. const tourStepProps = buildProps({
  60159. target: {
  60160. type: definePropType([String, Object, Function])
  60161. },
  60162. title: String,
  60163. description: String,
  60164. showClose: {
  60165. type: Boolean,
  60166. default: void 0
  60167. },
  60168. closeIcon: {
  60169. type: iconPropType
  60170. },
  60171. showArrow: {
  60172. type: Boolean,
  60173. default: void 0
  60174. },
  60175. placement: tourContentProps.placement,
  60176. mask: {
  60177. type: definePropType([Boolean, Object]),
  60178. default: void 0
  60179. },
  60180. contentStyle: {
  60181. type: definePropType([Object])
  60182. },
  60183. prevButtonProps: {
  60184. type: definePropType(Object)
  60185. },
  60186. nextButtonProps: {
  60187. type: definePropType(Object)
  60188. },
  60189. scrollIntoViewOptions: {
  60190. type: definePropType([Boolean, Object]),
  60191. default: void 0
  60192. },
  60193. type: {
  60194. type: definePropType(String)
  60195. }
  60196. });
  60197. const tourStepEmits = {
  60198. close: () => true
  60199. };
  60200. const __default__$a = defineComponent({
  60201. name: "ElTourStep"
  60202. });
  60203. const _sfc_main$b = /* @__PURE__ */ defineComponent({
  60204. ...__default__$a,
  60205. props: tourStepProps,
  60206. emits: tourStepEmits,
  60207. setup(__props, { emit }) {
  60208. const props = __props;
  60209. const { Close } = CloseComponents;
  60210. const { t } = useLocale();
  60211. const {
  60212. currentStep,
  60213. current,
  60214. total,
  60215. showClose,
  60216. closeIcon,
  60217. mergedType,
  60218. ns,
  60219. slots: tourSlots,
  60220. updateModelValue,
  60221. onClose: tourOnClose,
  60222. onFinish: tourOnFinish,
  60223. onChange
  60224. } = inject(tourKey);
  60225. watch(props, (val) => {
  60226. currentStep.value = val;
  60227. }, {
  60228. immediate: true
  60229. });
  60230. const mergedShowClose = computed(() => {
  60231. var _a;
  60232. return (_a = props.showClose) != null ? _a : showClose.value;
  60233. });
  60234. const mergedCloseIcon = computed(() => {
  60235. var _a, _b;
  60236. return (_b = (_a = props.closeIcon) != null ? _a : closeIcon.value) != null ? _b : Close;
  60237. });
  60238. const filterButtonProps = (btnProps) => {
  60239. if (!btnProps)
  60240. return;
  60241. return omit(btnProps, ["children", "onClick"]);
  60242. };
  60243. const onPrev = () => {
  60244. var _a, _b;
  60245. current.value -= 1;
  60246. if ((_a = props.prevButtonProps) == null ? void 0 : _a.onClick) {
  60247. (_b = props.prevButtonProps) == null ? void 0 : _b.onClick();
  60248. }
  60249. onChange();
  60250. };
  60251. const onNext = () => {
  60252. var _a;
  60253. if (current.value >= total.value - 1) {
  60254. onFinish();
  60255. } else {
  60256. current.value += 1;
  60257. }
  60258. if ((_a = props.nextButtonProps) == null ? void 0 : _a.onClick) {
  60259. props.nextButtonProps.onClick();
  60260. }
  60261. onChange();
  60262. };
  60263. const onFinish = () => {
  60264. onClose();
  60265. tourOnFinish();
  60266. };
  60267. const onClose = () => {
  60268. updateModelValue(false);
  60269. tourOnClose();
  60270. emit("close");
  60271. };
  60272. const handleKeydown = (e) => {
  60273. const target = e.target;
  60274. if (target == null ? void 0 : target.isContentEditable)
  60275. return;
  60276. const code = getEventCode(e);
  60277. switch (code) {
  60278. case EVENT_CODE.left:
  60279. e.preventDefault();
  60280. current.value > 0 && onPrev();
  60281. break;
  60282. case EVENT_CODE.right:
  60283. e.preventDefault();
  60284. onNext();
  60285. break;
  60286. }
  60287. };
  60288. onMounted(() => {
  60289. window.addEventListener("keydown", handleKeydown);
  60290. });
  60291. onBeforeUnmount(() => {
  60292. window.removeEventListener("keydown", handleKeydown);
  60293. });
  60294. return (_ctx, _cache) => {
  60295. return openBlock(), createElementBlock(Fragment, null, [
  60296. unref(mergedShowClose) ? (openBlock(), createElementBlock("button", {
  60297. key: 0,
  60298. "aria-label": unref(t)("el.tour.close"),
  60299. class: normalizeClass(unref(ns).e("closebtn")),
  60300. type: "button",
  60301. onClick: onClose
  60302. }, [
  60303. createVNode(unref(ElIcon), {
  60304. class: normalizeClass(unref(ns).e("close"))
  60305. }, {
  60306. default: withCtx(() => [
  60307. (openBlock(), createBlock(resolveDynamicComponent(unref(mergedCloseIcon))))
  60308. ]),
  60309. _: 1
  60310. }, 8, ["class"])
  60311. ], 10, ["aria-label"])) : createCommentVNode("v-if", true),
  60312. createElementVNode("header", {
  60313. class: normalizeClass([unref(ns).e("header"), { "show-close": unref(showClose) }])
  60314. }, [
  60315. renderSlot(_ctx.$slots, "header", {}, () => [
  60316. createElementVNode("span", {
  60317. role: "heading",
  60318. class: normalizeClass(unref(ns).e("title"))
  60319. }, toDisplayString(_ctx.title), 3)
  60320. ])
  60321. ], 2),
  60322. createElementVNode("div", {
  60323. class: normalizeClass(unref(ns).e("body"))
  60324. }, [
  60325. renderSlot(_ctx.$slots, "default", {}, () => [
  60326. createElementVNode("span", null, toDisplayString(_ctx.description), 1)
  60327. ])
  60328. ], 2),
  60329. createElementVNode("footer", {
  60330. class: normalizeClass(unref(ns).e("footer"))
  60331. }, [
  60332. createElementVNode("div", {
  60333. class: normalizeClass(unref(ns).b("indicators"))
  60334. }, [
  60335. unref(tourSlots).indicators ? (openBlock(), createBlock(resolveDynamicComponent(unref(tourSlots).indicators), {
  60336. key: 0,
  60337. current: unref(current),
  60338. total: unref(total)
  60339. }, null, 8, ["current", "total"])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(total), (item, index) => {
  60340. return openBlock(), createElementBlock("span", {
  60341. key: item,
  60342. class: normalizeClass([unref(ns).b("indicator"), unref(ns).is("active", index === unref(current))])
  60343. }, null, 2);
  60344. }), 128))
  60345. ], 2),
  60346. createElementVNode("div", {
  60347. class: normalizeClass(unref(ns).b("buttons"))
  60348. }, [
  60349. unref(current) > 0 ? (openBlock(), createBlock(unref(ElButton), mergeProps({
  60350. key: 0,
  60351. size: "small",
  60352. type: unref(mergedType)
  60353. }, filterButtonProps(_ctx.prevButtonProps), { onClick: onPrev }), {
  60354. default: withCtx(() => {
  60355. var _a, _b;
  60356. return [
  60357. createTextVNode(toDisplayString((_b = (_a = _ctx.prevButtonProps) == null ? void 0 : _a.children) != null ? _b : unref(t)("el.tour.previous")), 1)
  60358. ];
  60359. }),
  60360. _: 1
  60361. }, 16, ["type"])) : createCommentVNode("v-if", true),
  60362. unref(current) <= unref(total) - 1 ? (openBlock(), createBlock(unref(ElButton), mergeProps({
  60363. key: 1,
  60364. size: "small",
  60365. type: unref(mergedType) === "primary" ? "default" : "primary"
  60366. }, filterButtonProps(_ctx.nextButtonProps), { onClick: onNext }), {
  60367. default: withCtx(() => {
  60368. var _a, _b;
  60369. return [
  60370. createTextVNode(toDisplayString((_b = (_a = _ctx.nextButtonProps) == null ? void 0 : _a.children) != null ? _b : unref(current) === unref(total) - 1 ? unref(t)("el.tour.finish") : unref(t)("el.tour.next")), 1)
  60371. ];
  60372. }),
  60373. _: 1
  60374. }, 16, ["type"])) : createCommentVNode("v-if", true)
  60375. ], 2)
  60376. ], 2)
  60377. ], 64);
  60378. };
  60379. }
  60380. });
  60381. var TourStep = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "step.vue"]]);
  60382. const ElTour = withInstall(Tour, {
  60383. TourStep
  60384. });
  60385. const ElTourStep = withNoopInstall(TourStep);
  60386. const anchorProps = buildProps({
  60387. container: {
  60388. type: definePropType([
  60389. String,
  60390. Object
  60391. ])
  60392. },
  60393. offset: {
  60394. type: Number,
  60395. default: 0
  60396. },
  60397. bound: {
  60398. type: Number,
  60399. default: 15
  60400. },
  60401. duration: {
  60402. type: Number,
  60403. default: 300
  60404. },
  60405. marker: {
  60406. type: Boolean,
  60407. default: true
  60408. },
  60409. type: {
  60410. type: definePropType(String),
  60411. default: "default"
  60412. },
  60413. direction: {
  60414. type: definePropType(String),
  60415. default: "vertical"
  60416. },
  60417. selectScrollTop: Boolean
  60418. });
  60419. const anchorEmits = {
  60420. change: (href) => isString$1(href),
  60421. click: (e, href) => e instanceof MouseEvent && (isString$1(href) || isUndefined(href))
  60422. };
  60423. const anchorKey = Symbol("anchor");
  60424. const __default__$9 = defineComponent({
  60425. name: "ElAnchor"
  60426. });
  60427. const _sfc_main$a = /* @__PURE__ */ defineComponent({
  60428. ...__default__$9,
  60429. props: anchorProps,
  60430. emits: anchorEmits,
  60431. setup(__props, { expose, emit }) {
  60432. const props = __props;
  60433. const slots = useSlots();
  60434. const currentAnchor = ref("");
  60435. const markerStyle = ref({});
  60436. const anchorRef = ref(null);
  60437. const markerRef = ref(null);
  60438. const containerEl = ref();
  60439. const links = {};
  60440. let isScrolling = false;
  60441. let currentScrollTop = 0;
  60442. const ns = useNamespace("anchor");
  60443. const cls = computed(() => [
  60444. ns.b(),
  60445. props.type === "underline" ? ns.m("underline") : "",
  60446. ns.m(props.direction)
  60447. ]);
  60448. const addLink = (state) => {
  60449. links[state.href] = state.el;
  60450. };
  60451. const removeLink = (href) => {
  60452. delete links[href];
  60453. };
  60454. const setCurrentAnchor = (href) => {
  60455. const activeHref = currentAnchor.value;
  60456. if (activeHref !== href) {
  60457. currentAnchor.value = href;
  60458. emit(CHANGE_EVENT, href);
  60459. }
  60460. };
  60461. let clearAnimate = null;
  60462. const scrollToAnchor = (href) => {
  60463. if (!containerEl.value)
  60464. return;
  60465. const target = getElement(href);
  60466. if (!target)
  60467. return;
  60468. if (clearAnimate)
  60469. clearAnimate();
  60470. isScrolling = true;
  60471. const scrollEle = getScrollElement(target, containerEl.value);
  60472. const distance = getOffsetTopDistance(target, scrollEle);
  60473. const max = scrollEle.scrollHeight - scrollEle.clientHeight;
  60474. const to = Math.min(distance - props.offset, max);
  60475. clearAnimate = animateScrollTo(containerEl.value, currentScrollTop, to, props.duration, () => {
  60476. setTimeout(() => {
  60477. isScrolling = false;
  60478. }, 20);
  60479. });
  60480. };
  60481. const scrollTo = (href) => {
  60482. if (href) {
  60483. setCurrentAnchor(href);
  60484. scrollToAnchor(href);
  60485. }
  60486. };
  60487. const handleClick = (e, href) => {
  60488. emit("click", e, href);
  60489. scrollTo(href);
  60490. };
  60491. const handleScroll = throttleByRaf(() => {
  60492. if (containerEl.value) {
  60493. currentScrollTop = getScrollTop(containerEl.value);
  60494. }
  60495. const currentHref = getCurrentHref();
  60496. if (isScrolling || isUndefined(currentHref))
  60497. return;
  60498. setCurrentAnchor(currentHref);
  60499. });
  60500. const getCurrentHref = () => {
  60501. if (!containerEl.value)
  60502. return;
  60503. const scrollTop = getScrollTop(containerEl.value);
  60504. const anchorTopList = [];
  60505. for (const href of Object.keys(links)) {
  60506. const target = getElement(href);
  60507. if (!target)
  60508. continue;
  60509. const scrollEle = getScrollElement(target, containerEl.value);
  60510. const distance = getOffsetTopDistance(target, scrollEle);
  60511. anchorTopList.push({
  60512. top: distance - props.offset - props.bound,
  60513. href
  60514. });
  60515. }
  60516. anchorTopList.sort((prev, next) => prev.top - next.top);
  60517. for (let i = 0; i < anchorTopList.length; i++) {
  60518. const item = anchorTopList[i];
  60519. const next = anchorTopList[i + 1];
  60520. if (i === 0 && scrollTop === 0) {
  60521. return props.selectScrollTop ? item.href : "";
  60522. }
  60523. if (item.top <= scrollTop && (!next || next.top > scrollTop)) {
  60524. return item.href;
  60525. }
  60526. }
  60527. };
  60528. const getContainer = () => {
  60529. const el = getElement(props.container);
  60530. if (!el || isWindow$1(el)) {
  60531. containerEl.value = window;
  60532. } else {
  60533. containerEl.value = el;
  60534. }
  60535. };
  60536. useEventListener(containerEl, "scroll", handleScroll);
  60537. const updateMarkerStyle = () => {
  60538. nextTick(() => {
  60539. if (!anchorRef.value || !markerRef.value || !currentAnchor.value) {
  60540. markerStyle.value = {};
  60541. return;
  60542. }
  60543. const currentLinkEl = links[currentAnchor.value];
  60544. if (!currentLinkEl) {
  60545. markerStyle.value = {};
  60546. return;
  60547. }
  60548. const anchorRect = anchorRef.value.getBoundingClientRect();
  60549. const markerRect = markerRef.value.getBoundingClientRect();
  60550. const linkRect = currentLinkEl.getBoundingClientRect();
  60551. if (props.direction === "horizontal") {
  60552. const left = linkRect.left - anchorRect.left;
  60553. markerStyle.value = {
  60554. left: `${left}px`,
  60555. width: `${linkRect.width}px`,
  60556. opacity: 1
  60557. };
  60558. } else {
  60559. const top = linkRect.top - anchorRect.top + (linkRect.height - markerRect.height) / 2;
  60560. markerStyle.value = {
  60561. top: `${top}px`,
  60562. opacity: 1
  60563. };
  60564. }
  60565. });
  60566. };
  60567. watch(currentAnchor, updateMarkerStyle);
  60568. watch(() => {
  60569. var _a;
  60570. return (_a = slots.default) == null ? void 0 : _a.call(slots);
  60571. }, updateMarkerStyle);
  60572. onMounted(() => {
  60573. getContainer();
  60574. const hash = decodeURIComponent(window.location.hash);
  60575. const target = getElement(hash);
  60576. if (target) {
  60577. scrollTo(hash);
  60578. } else {
  60579. handleScroll();
  60580. }
  60581. });
  60582. watch(() => props.container, () => {
  60583. getContainer();
  60584. });
  60585. provide(anchorKey, {
  60586. ns,
  60587. direction: props.direction,
  60588. currentAnchor,
  60589. addLink,
  60590. removeLink,
  60591. handleClick
  60592. });
  60593. expose({
  60594. scrollTo
  60595. });
  60596. return (_ctx, _cache) => {
  60597. return openBlock(), createElementBlock("div", {
  60598. ref_key: "anchorRef",
  60599. ref: anchorRef,
  60600. class: normalizeClass(unref(cls))
  60601. }, [
  60602. _ctx.marker ? (openBlock(), createElementBlock("div", {
  60603. key: 0,
  60604. ref_key: "markerRef",
  60605. ref: markerRef,
  60606. class: normalizeClass(unref(ns).e("marker")),
  60607. style: normalizeStyle(markerStyle.value)
  60608. }, null, 6)) : createCommentVNode("v-if", true),
  60609. createElementVNode("div", {
  60610. class: normalizeClass(unref(ns).e("list"))
  60611. }, [
  60612. renderSlot(_ctx.$slots, "default")
  60613. ], 2)
  60614. ], 2);
  60615. };
  60616. }
  60617. });
  60618. var Anchor = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "anchor.vue"]]);
  60619. const anchorLinkProps = buildProps({
  60620. title: String,
  60621. href: String
  60622. });
  60623. const __default__$8 = defineComponent({
  60624. name: "ElAnchorLink"
  60625. });
  60626. const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  60627. ...__default__$8,
  60628. props: anchorLinkProps,
  60629. setup(__props) {
  60630. const props = __props;
  60631. const linkRef = ref(null);
  60632. const {
  60633. ns,
  60634. direction,
  60635. currentAnchor,
  60636. addLink,
  60637. removeLink,
  60638. handleClick: contextHandleClick
  60639. } = inject(anchorKey);
  60640. const cls = computed(() => [
  60641. ns.e("link"),
  60642. ns.is("active", currentAnchor.value === props.href)
  60643. ]);
  60644. const handleClick = (e) => {
  60645. contextHandleClick(e, props.href);
  60646. };
  60647. watch(() => props.href, (val, oldVal) => {
  60648. nextTick(() => {
  60649. if (oldVal)
  60650. removeLink(oldVal);
  60651. if (val) {
  60652. addLink({
  60653. href: val,
  60654. el: linkRef.value
  60655. });
  60656. }
  60657. });
  60658. });
  60659. onMounted(() => {
  60660. const { href } = props;
  60661. if (href) {
  60662. addLink({
  60663. href,
  60664. el: linkRef.value
  60665. });
  60666. }
  60667. });
  60668. onBeforeUnmount(() => {
  60669. const { href } = props;
  60670. if (href) {
  60671. removeLink(href);
  60672. }
  60673. });
  60674. return (_ctx, _cache) => {
  60675. return openBlock(), createElementBlock("div", {
  60676. class: normalizeClass(unref(ns).e("item"))
  60677. }, [
  60678. createElementVNode("a", {
  60679. ref_key: "linkRef",
  60680. ref: linkRef,
  60681. class: normalizeClass(unref(cls)),
  60682. href: _ctx.href,
  60683. onClick: handleClick
  60684. }, [
  60685. renderSlot(_ctx.$slots, "default", {}, () => [
  60686. createTextVNode(toDisplayString(_ctx.title), 1)
  60687. ])
  60688. ], 10, ["href"]),
  60689. _ctx.$slots["sub-link"] && unref(direction) === "vertical" ? (openBlock(), createElementBlock("div", {
  60690. key: 0,
  60691. class: normalizeClass(unref(ns).e("list"))
  60692. }, [
  60693. renderSlot(_ctx.$slots, "sub-link")
  60694. ], 2)) : createCommentVNode("v-if", true)
  60695. ], 2);
  60696. };
  60697. }
  60698. });
  60699. var AnchorLink = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "anchor-link.vue"]]);
  60700. const ElAnchor = withInstall(Anchor, {
  60701. AnchorLink
  60702. });
  60703. const ElAnchorLink = withNoopInstall(AnchorLink);
  60704. const defaultProps = {
  60705. label: "label",
  60706. value: "value",
  60707. disabled: "disabled"
  60708. };
  60709. const segmentedProps = buildProps({
  60710. direction: {
  60711. type: definePropType(String),
  60712. default: "horizontal"
  60713. },
  60714. options: {
  60715. type: definePropType(Array),
  60716. default: () => []
  60717. },
  60718. modelValue: {
  60719. type: [String, Number, Boolean],
  60720. default: void 0
  60721. },
  60722. props: {
  60723. type: definePropType(Object),
  60724. default: () => defaultProps
  60725. },
  60726. block: Boolean,
  60727. size: useSizeProp,
  60728. disabled: Boolean,
  60729. validateEvent: {
  60730. type: Boolean,
  60731. default: true
  60732. },
  60733. id: String,
  60734. name: String,
  60735. ...useAriaProps(["ariaLabel"])
  60736. });
  60737. const segmentedEmits = {
  60738. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  60739. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  60740. };
  60741. const __default__$7 = defineComponent({
  60742. name: "ElSegmented"
  60743. });
  60744. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  60745. ...__default__$7,
  60746. props: segmentedProps,
  60747. emits: segmentedEmits,
  60748. setup(__props, { emit }) {
  60749. const props = __props;
  60750. const ns = useNamespace("segmented");
  60751. const segmentedId = useId();
  60752. const segmentedSize = useFormSize();
  60753. const _disabled = useFormDisabled();
  60754. const { formItem } = useFormItem();
  60755. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  60756. formItemContext: formItem
  60757. });
  60758. const segmentedRef = ref(null);
  60759. const activeElement = useActiveElement();
  60760. const state = reactive({
  60761. isInit: false,
  60762. width: 0,
  60763. height: 0,
  60764. translateX: 0,
  60765. translateY: 0,
  60766. focusVisible: false
  60767. });
  60768. const handleChange = (item) => {
  60769. const value = getValue(item);
  60770. emit(UPDATE_MODEL_EVENT, value);
  60771. emit(CHANGE_EVENT, value);
  60772. };
  60773. const aliasProps = computed(() => ({ ...defaultProps, ...props.props }));
  60774. const intoAny = (item) => item;
  60775. const getValue = (item) => {
  60776. return isObject$1(item) ? item[aliasProps.value.value] : item;
  60777. };
  60778. const getLabel = (item) => {
  60779. return isObject$1(item) ? item[aliasProps.value.label] : item;
  60780. };
  60781. const getDisabled = (item) => {
  60782. return !!(_disabled.value || (isObject$1(item) ? item[aliasProps.value.disabled] : false));
  60783. };
  60784. const getSelected = (item) => {
  60785. return props.modelValue === getValue(item);
  60786. };
  60787. const getOption = (value) => {
  60788. return props.options.find((item) => getValue(item) === value);
  60789. };
  60790. const getItemCls = (item) => {
  60791. return [
  60792. ns.e("item"),
  60793. ns.is("selected", getSelected(item)),
  60794. ns.is("disabled", getDisabled(item))
  60795. ];
  60796. };
  60797. const updateSelect = () => {
  60798. if (!segmentedRef.value)
  60799. return;
  60800. const selectedItem = segmentedRef.value.querySelector(".is-selected");
  60801. const selectedItemInput = segmentedRef.value.querySelector(".is-selected input");
  60802. if (!selectedItem || !selectedItemInput) {
  60803. state.width = 0;
  60804. state.height = 0;
  60805. state.translateX = 0;
  60806. state.translateY = 0;
  60807. state.focusVisible = false;
  60808. return;
  60809. }
  60810. state.isInit = true;
  60811. if (props.direction === "vertical") {
  60812. state.height = selectedItem.offsetHeight;
  60813. state.translateY = selectedItem.offsetTop;
  60814. } else {
  60815. state.width = selectedItem.offsetWidth;
  60816. state.translateX = selectedItem.offsetLeft;
  60817. }
  60818. try {
  60819. state.focusVisible = selectedItemInput.matches(":focus-visible");
  60820. } catch (e) {
  60821. }
  60822. };
  60823. const segmentedCls = computed(() => [
  60824. ns.b(),
  60825. ns.m(segmentedSize.value),
  60826. ns.is("block", props.block)
  60827. ]);
  60828. const selectedStyle = computed(() => ({
  60829. width: props.direction === "vertical" ? "100%" : `${state.width}px`,
  60830. height: props.direction === "vertical" ? `${state.height}px` : "100%",
  60831. transform: props.direction === "vertical" ? `translateY(${state.translateY}px)` : `translateX(${state.translateX}px)`,
  60832. display: state.isInit ? "block" : "none"
  60833. }));
  60834. const selectedCls = computed(() => [
  60835. ns.e("item-selected"),
  60836. ns.is("disabled", getDisabled(getOption(props.modelValue))),
  60837. ns.is("focus-visible", state.focusVisible)
  60838. ]);
  60839. const name = computed(() => {
  60840. return props.name || segmentedId.value;
  60841. });
  60842. useResizeObserver(segmentedRef, updateSelect);
  60843. watch(activeElement, updateSelect);
  60844. watch(() => props.modelValue, () => {
  60845. var _a;
  60846. updateSelect();
  60847. if (props.validateEvent) {
  60848. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn(err));
  60849. }
  60850. }, {
  60851. flush: "post"
  60852. });
  60853. return (_ctx, _cache) => {
  60854. return _ctx.options.length ? (openBlock(), createElementBlock("div", {
  60855. key: 0,
  60856. id: unref(inputId),
  60857. ref_key: "segmentedRef",
  60858. ref: segmentedRef,
  60859. class: normalizeClass(unref(segmentedCls)),
  60860. role: "radiogroup",
  60861. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "segmented" : void 0,
  60862. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  60863. }, [
  60864. createElementVNode("div", {
  60865. class: normalizeClass([unref(ns).e("group"), unref(ns).m(_ctx.direction)])
  60866. }, [
  60867. createElementVNode("div", {
  60868. style: normalizeStyle(unref(selectedStyle)),
  60869. class: normalizeClass(unref(selectedCls))
  60870. }, null, 6),
  60871. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
  60872. return openBlock(), createElementBlock("label", {
  60873. key: index,
  60874. class: normalizeClass(getItemCls(item))
  60875. }, [
  60876. createElementVNode("input", {
  60877. class: normalizeClass(unref(ns).e("item-input")),
  60878. type: "radio",
  60879. name: unref(name),
  60880. disabled: getDisabled(item),
  60881. checked: getSelected(item),
  60882. onChange: ($event) => handleChange(item)
  60883. }, null, 42, ["name", "disabled", "checked", "onChange"]),
  60884. createElementVNode("div", {
  60885. class: normalizeClass(unref(ns).e("item-label"))
  60886. }, [
  60887. renderSlot(_ctx.$slots, "default", {
  60888. item: intoAny(item)
  60889. }, () => [
  60890. createTextVNode(toDisplayString(getLabel(item)), 1)
  60891. ])
  60892. ], 2)
  60893. ], 2);
  60894. }), 128))
  60895. ], 2)
  60896. ], 10, ["id", "aria-label", "aria-labelledby"])) : createCommentVNode("v-if", true);
  60897. };
  60898. }
  60899. });
  60900. var Segmented = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "segmented.vue"]]);
  60901. const ElSegmented = withInstall(Segmented);
  60902. const filterOption = (pattern, option) => {
  60903. const lowerCase = pattern.toLowerCase();
  60904. const label = option.label || option.value || "";
  60905. return label.toLowerCase().includes(lowerCase);
  60906. };
  60907. const getMentionCtx = (inputEl, prefix, split) => {
  60908. const { selectionEnd } = inputEl;
  60909. if (selectionEnd === null)
  60910. return;
  60911. const inputValue = inputEl.value;
  60912. const prefixArray = castArray$1(prefix);
  60913. let splitIndex = -1;
  60914. let mentionCtx;
  60915. for (let i = selectionEnd - 1; i >= 0; --i) {
  60916. const char = inputValue[i];
  60917. if (char === split || char === "\n" || char === "\r") {
  60918. splitIndex = i;
  60919. continue;
  60920. }
  60921. if (prefixArray.includes(char)) {
  60922. const end = splitIndex === -1 ? selectionEnd : splitIndex;
  60923. const pattern = inputValue.slice(i + 1, end);
  60924. mentionCtx = {
  60925. pattern,
  60926. start: i + 1,
  60927. end,
  60928. prefix: char,
  60929. prefixIndex: i,
  60930. splitIndex,
  60931. selectionEnd
  60932. };
  60933. break;
  60934. }
  60935. }
  60936. return mentionCtx;
  60937. };
  60938. const getCursorPosition = (element, options = {
  60939. debug: false,
  60940. useSelectionEnd: false
  60941. }) => {
  60942. const selectionStart = element.selectionStart !== null ? element.selectionStart : 0;
  60943. const selectionEnd = element.selectionEnd !== null ? element.selectionEnd : 0;
  60944. const position = options.useSelectionEnd ? selectionEnd : selectionStart;
  60945. const properties = [
  60946. "direction",
  60947. "boxSizing",
  60948. "width",
  60949. "height",
  60950. "overflowX",
  60951. "overflowY",
  60952. "borderTopWidth",
  60953. "borderRightWidth",
  60954. "borderBottomWidth",
  60955. "borderLeftWidth",
  60956. "borderStyle",
  60957. "paddingTop",
  60958. "paddingRight",
  60959. "paddingBottom",
  60960. "paddingLeft",
  60961. "fontStyle",
  60962. "fontVariant",
  60963. "fontWeight",
  60964. "fontStretch",
  60965. "fontSize",
  60966. "fontSizeAdjust",
  60967. "lineHeight",
  60968. "fontFamily",
  60969. "textAlign",
  60970. "textTransform",
  60971. "textIndent",
  60972. "textDecoration",
  60973. "letterSpacing",
  60974. "wordSpacing",
  60975. "tabSize",
  60976. "MozTabSize"
  60977. ];
  60978. if (options.debug) {
  60979. const el = document.querySelector("#input-textarea-caret-position-mirror-div");
  60980. if (el == null ? void 0 : el.parentNode)
  60981. el.parentNode.removeChild(el);
  60982. }
  60983. const div = document.createElement("div");
  60984. div.id = "input-textarea-caret-position-mirror-div";
  60985. document.body.appendChild(div);
  60986. const style = div.style;
  60987. const computed = window.getComputedStyle(element);
  60988. const isInput = element.nodeName === "INPUT";
  60989. style.whiteSpace = isInput ? "nowrap" : "pre-wrap";
  60990. if (!isInput)
  60991. style.wordWrap = "break-word";
  60992. style.position = "absolute";
  60993. if (!options.debug)
  60994. style.visibility = "hidden";
  60995. properties.forEach((prop) => {
  60996. if (isInput && prop === "lineHeight") {
  60997. if (computed.boxSizing === "border-box") {
  60998. const height = Number.parseInt(computed.height);
  60999. const outerHeight = Number.parseInt(computed.paddingTop) + Number.parseInt(computed.paddingBottom) + Number.parseInt(computed.borderTopWidth) + Number.parseInt(computed.borderBottomWidth);
  61000. const targetHeight = outerHeight + Number.parseInt(computed.lineHeight);
  61001. if (height > targetHeight) {
  61002. style.lineHeight = `${height - outerHeight}px`;
  61003. } else if (height === targetHeight) {
  61004. style.lineHeight = computed.lineHeight;
  61005. } else {
  61006. style.lineHeight = "0";
  61007. }
  61008. } else {
  61009. style.lineHeight = computed.height;
  61010. }
  61011. } else {
  61012. style[prop] = computed[prop];
  61013. }
  61014. });
  61015. if (isFirefox()) {
  61016. if (element.scrollHeight > Number.parseInt(computed.height)) {
  61017. style.overflowY = "scroll";
  61018. }
  61019. } else {
  61020. style.overflow = "hidden";
  61021. }
  61022. div.textContent = element.value.slice(0, Math.max(0, position));
  61023. if (isInput && div.textContent) {
  61024. div.textContent = div.textContent.replace(/\s/g, "\xA0");
  61025. }
  61026. const span = document.createElement("span");
  61027. span.textContent = element.value.slice(Math.max(0, position)) || ".";
  61028. span.style.position = "relative";
  61029. span.style.left = `${-element.scrollLeft}px`;
  61030. span.style.top = `${-element.scrollTop}px`;
  61031. div.appendChild(span);
  61032. const relativePosition = {
  61033. top: span.offsetTop + Number.parseInt(computed.borderTopWidth),
  61034. left: span.offsetLeft + Number.parseInt(computed.borderLeftWidth),
  61035. height: Number.parseInt(computed.fontSize) * 1.5
  61036. };
  61037. if (options.debug) {
  61038. span.style.backgroundColor = "#aaa";
  61039. } else {
  61040. document.body.removeChild(div);
  61041. }
  61042. if (relativePosition.left >= element.clientWidth) {
  61043. relativePosition.left = element.clientWidth;
  61044. }
  61045. return relativePosition;
  61046. };
  61047. const mentionProps = buildProps({
  61048. ...inputProps,
  61049. options: {
  61050. type: definePropType(Array),
  61051. default: () => []
  61052. },
  61053. prefix: {
  61054. type: definePropType([String, Array]),
  61055. default: "@",
  61056. validator: (val) => {
  61057. if (isString$1(val))
  61058. return val.length === 1;
  61059. return val.every((v) => isString$1(v) && v.length === 1);
  61060. }
  61061. },
  61062. split: {
  61063. type: String,
  61064. default: " ",
  61065. validator: (val) => val.length === 1
  61066. },
  61067. filterOption: {
  61068. type: definePropType([Boolean, Function]),
  61069. default: () => filterOption,
  61070. validator: (val) => {
  61071. if (val === false)
  61072. return true;
  61073. return isFunction$1(val);
  61074. }
  61075. },
  61076. placement: {
  61077. type: definePropType(String),
  61078. default: "bottom"
  61079. },
  61080. showArrow: Boolean,
  61081. offset: {
  61082. type: Number,
  61083. default: 0
  61084. },
  61085. whole: Boolean,
  61086. checkIsWhole: {
  61087. type: definePropType(Function)
  61088. },
  61089. modelValue: String,
  61090. loading: Boolean,
  61091. popperClass: useTooltipContentProps.popperClass,
  61092. popperStyle: useTooltipContentProps.popperStyle,
  61093. popperOptions: {
  61094. type: definePropType(Object),
  61095. default: () => ({})
  61096. },
  61097. props: {
  61098. type: definePropType(Object),
  61099. default: () => mentionDefaultProps
  61100. }
  61101. });
  61102. const mentionEmits = {
  61103. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  61104. "whole-remove": (pattern, prefix) => isString$1(pattern) && isString$1(prefix),
  61105. input: (value) => isString$1(value),
  61106. search: (pattern, prefix) => isString$1(pattern) && isString$1(prefix),
  61107. select: (option, prefix) => isObject$1(option) && isString$1(prefix),
  61108. focus: (evt) => evt instanceof FocusEvent,
  61109. blur: (evt) => evt instanceof FocusEvent
  61110. };
  61111. const mentionDefaultProps = {
  61112. value: "value",
  61113. label: "label",
  61114. disabled: "disabled"
  61115. };
  61116. const mentionDropdownProps = buildProps({
  61117. options: {
  61118. type: definePropType(Array),
  61119. default: () => []
  61120. },
  61121. loading: Boolean,
  61122. disabled: Boolean,
  61123. contentId: String,
  61124. ariaLabel: String
  61125. });
  61126. const mentionDropdownEmits = {
  61127. select: (option) => isString$1(option.value)
  61128. };
  61129. const __default__$6 = defineComponent({
  61130. name: "ElMentionDropdown"
  61131. });
  61132. const _sfc_main$7 = /* @__PURE__ */ defineComponent({
  61133. ...__default__$6,
  61134. props: mentionDropdownProps,
  61135. emits: mentionDropdownEmits,
  61136. setup(__props, { expose, emit }) {
  61137. const props = __props;
  61138. const ns = useNamespace("mention");
  61139. const { t } = useLocale();
  61140. const hoveringIndex = ref(-1);
  61141. const scrollbarRef = ref();
  61142. const optionRefs = ref();
  61143. const dropdownRef = ref();
  61144. const optionkls = (item, index) => [
  61145. ns.be("dropdown", "item"),
  61146. ns.is("hovering", hoveringIndex.value === index),
  61147. ns.is("disabled", item.disabled || props.disabled)
  61148. ];
  61149. const handleSelect = (item) => {
  61150. if (item.disabled || props.disabled)
  61151. return;
  61152. emit("select", item);
  61153. };
  61154. const handleMouseEnter = (index) => {
  61155. hoveringIndex.value = index;
  61156. };
  61157. const filteredAllDisabled = computed(() => props.disabled || props.options.every((item) => item.disabled));
  61158. const hoverOption = computed(() => props.options[hoveringIndex.value]);
  61159. const selectHoverOption = () => {
  61160. if (!hoverOption.value)
  61161. return;
  61162. emit("select", hoverOption.value);
  61163. };
  61164. const navigateOptions = (direction) => {
  61165. const { options } = props;
  61166. if (options.length === 0 || filteredAllDisabled.value)
  61167. return;
  61168. if (direction === "next") {
  61169. hoveringIndex.value++;
  61170. if (hoveringIndex.value === options.length) {
  61171. hoveringIndex.value = 0;
  61172. }
  61173. } else if (direction === "prev") {
  61174. hoveringIndex.value--;
  61175. if (hoveringIndex.value < 0) {
  61176. hoveringIndex.value = options.length - 1;
  61177. }
  61178. }
  61179. const option = options[hoveringIndex.value];
  61180. if (option.disabled) {
  61181. navigateOptions(direction);
  61182. return;
  61183. }
  61184. nextTick(() => scrollToOption(option));
  61185. };
  61186. const scrollToOption = (option) => {
  61187. var _a, _b, _c, _d;
  61188. const { options } = props;
  61189. const index = options.findIndex((item) => item.value === option.value);
  61190. const target = (_a = optionRefs.value) == null ? void 0 : _a[index];
  61191. if (target) {
  61192. const menu = (_c = (_b = dropdownRef.value) == null ? void 0 : _b.querySelector) == null ? void 0 : _c.call(_b, `.${ns.be("dropdown", "wrap")}`);
  61193. if (menu) {
  61194. scrollIntoView(menu, target);
  61195. }
  61196. }
  61197. (_d = scrollbarRef.value) == null ? void 0 : _d.handleScroll();
  61198. };
  61199. const resetHoveringIndex = () => {
  61200. if (filteredAllDisabled.value || props.options.length === 0) {
  61201. hoveringIndex.value = -1;
  61202. } else {
  61203. hoveringIndex.value = 0;
  61204. }
  61205. };
  61206. watch(() => props.options, resetHoveringIndex, {
  61207. immediate: true
  61208. });
  61209. expose({
  61210. hoveringIndex,
  61211. navigateOptions,
  61212. selectHoverOption,
  61213. hoverOption
  61214. });
  61215. return (_ctx, _cache) => {
  61216. return openBlock(), createElementBlock("div", {
  61217. ref_key: "dropdownRef",
  61218. ref: dropdownRef,
  61219. class: normalizeClass(unref(ns).b("dropdown"))
  61220. }, [
  61221. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  61222. key: 0,
  61223. class: normalizeClass(unref(ns).be("dropdown", "header"))
  61224. }, [
  61225. renderSlot(_ctx.$slots, "header")
  61226. ], 2)) : createCommentVNode("v-if", true),
  61227. withDirectives(createVNode(unref(ElScrollbar), {
  61228. id: _ctx.contentId,
  61229. ref_key: "scrollbarRef",
  61230. ref: scrollbarRef,
  61231. tag: "ul",
  61232. "wrap-class": unref(ns).be("dropdown", "wrap"),
  61233. "view-class": unref(ns).be("dropdown", "list"),
  61234. role: "listbox",
  61235. "aria-label": _ctx.ariaLabel,
  61236. "aria-orientation": "vertical"
  61237. }, {
  61238. default: withCtx(() => [
  61239. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
  61240. return openBlock(), createElementBlock("li", {
  61241. id: `${_ctx.contentId}-${index}`,
  61242. ref_for: true,
  61243. ref_key: "optionRefs",
  61244. ref: optionRefs,
  61245. key: index,
  61246. class: normalizeClass(optionkls(item, index)),
  61247. role: "option",
  61248. "aria-disabled": item.disabled || _ctx.disabled || void 0,
  61249. "aria-selected": hoveringIndex.value === index,
  61250. onMousemove: ($event) => handleMouseEnter(index),
  61251. onClick: withModifiers(($event) => handleSelect(item), ["stop"])
  61252. }, [
  61253. renderSlot(_ctx.$slots, "label", {
  61254. item,
  61255. index
  61256. }, () => {
  61257. var _a;
  61258. return [
  61259. createElementVNode("span", null, toDisplayString((_a = item.label) != null ? _a : item.value), 1)
  61260. ];
  61261. })
  61262. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"]);
  61263. }), 128))
  61264. ]),
  61265. _: 3
  61266. }, 8, ["id", "wrap-class", "view-class", "aria-label"]), [
  61267. [vShow, _ctx.options.length > 0 && !_ctx.loading]
  61268. ]),
  61269. _ctx.loading ? (openBlock(), createElementBlock("div", {
  61270. key: 1,
  61271. class: normalizeClass(unref(ns).be("dropdown", "loading"))
  61272. }, [
  61273. renderSlot(_ctx.$slots, "loading", {}, () => [
  61274. createTextVNode(toDisplayString(unref(t)("el.mention.loading")), 1)
  61275. ])
  61276. ], 2)) : createCommentVNode("v-if", true),
  61277. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  61278. key: 2,
  61279. class: normalizeClass(unref(ns).be("dropdown", "footer"))
  61280. }, [
  61281. renderSlot(_ctx.$slots, "footer")
  61282. ], 2)) : createCommentVNode("v-if", true)
  61283. ], 2);
  61284. };
  61285. }
  61286. });
  61287. var ElMentionDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "mention-dropdown.vue"]]);
  61288. const __default__$5 = defineComponent({
  61289. name: "ElMention",
  61290. inheritAttrs: false
  61291. });
  61292. const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  61293. ...__default__$5,
  61294. props: mentionProps,
  61295. emits: mentionEmits,
  61296. setup(__props, { expose, emit }) {
  61297. const props = __props;
  61298. const passInputProps = computed(() => pick(props, Object.keys(inputProps)));
  61299. const ns = useNamespace("mention");
  61300. const disabled = useFormDisabled();
  61301. const contentId = useId();
  61302. const elInputRef = ref();
  61303. const tooltipRef = ref();
  61304. const dropdownRef = ref();
  61305. const visible = ref(false);
  61306. const cursorStyle = ref();
  61307. const mentionCtx = ref();
  61308. const computedPlacement = computed(() => props.showArrow ? props.placement : `${props.placement}-start`);
  61309. const computedFallbackPlacements = computed(() => props.showArrow ? ["bottom", "top"] : ["bottom-start", "top-start"]);
  61310. const aliasProps = computed(() => ({
  61311. ...mentionDefaultProps,
  61312. ...props.props
  61313. }));
  61314. const mapOption = (option) => {
  61315. const base = {
  61316. label: option[aliasProps.value.label],
  61317. value: option[aliasProps.value.value],
  61318. disabled: option[aliasProps.value.disabled]
  61319. };
  61320. return { ...option, ...base };
  61321. };
  61322. const options = computed(() => props.options.map(mapOption));
  61323. const filteredOptions = computed(() => {
  61324. const { filterOption } = props;
  61325. if (!mentionCtx.value || !filterOption)
  61326. return options.value;
  61327. return options.value.filter((option) => filterOption(mentionCtx.value.pattern, option));
  61328. });
  61329. const dropdownVisible = computed(() => {
  61330. return visible.value && (!!filteredOptions.value.length || props.loading);
  61331. });
  61332. const hoveringId = computed(() => {
  61333. var _a;
  61334. return `${contentId.value}-${(_a = dropdownRef.value) == null ? void 0 : _a.hoveringIndex}`;
  61335. });
  61336. const handleInputChange = (value) => {
  61337. emit(UPDATE_MODEL_EVENT, value);
  61338. emit(INPUT_EVENT, value);
  61339. syncAfterCursorMove();
  61340. };
  61341. const handleInputKeyDown = (event) => {
  61342. var _a, _b, _c, _d;
  61343. if ((_a = elInputRef.value) == null ? void 0 : _a.isComposing)
  61344. return;
  61345. const code = getEventCode(event);
  61346. switch (code) {
  61347. case EVENT_CODE.left:
  61348. case EVENT_CODE.right:
  61349. syncAfterCursorMove();
  61350. break;
  61351. case EVENT_CODE.up:
  61352. case EVENT_CODE.down:
  61353. if (!visible.value)
  61354. return;
  61355. event.preventDefault();
  61356. (_b = dropdownRef.value) == null ? void 0 : _b.navigateOptions(code === EVENT_CODE.up ? "prev" : "next");
  61357. break;
  61358. case EVENT_CODE.enter:
  61359. case EVENT_CODE.numpadEnter:
  61360. if (!visible.value) {
  61361. props.type !== "textarea" && syncAfterCursorMove();
  61362. return;
  61363. }
  61364. event.preventDefault();
  61365. if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
  61366. (_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
  61367. } else {
  61368. visible.value = false;
  61369. }
  61370. break;
  61371. case EVENT_CODE.esc:
  61372. if (!visible.value)
  61373. return;
  61374. event.preventDefault();
  61375. visible.value = false;
  61376. break;
  61377. case EVENT_CODE.backspace:
  61378. if (props.whole && mentionCtx.value) {
  61379. const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
  61380. const inputEl = getInputEl();
  61381. if (!inputEl)
  61382. return;
  61383. const inputValue = inputEl.value;
  61384. const matchOption = options.value.find((item) => item.value === pattern);
  61385. const isWhole = isFunction$1(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption;
  61386. if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
  61387. event.preventDefault();
  61388. const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
  61389. emit(UPDATE_MODEL_EVENT, newValue);
  61390. emit(INPUT_EVENT, newValue);
  61391. emit("whole-remove", pattern, prefix);
  61392. const newSelectionEnd = prefixIndex;
  61393. nextTick(() => {
  61394. inputEl.selectionStart = newSelectionEnd;
  61395. inputEl.selectionEnd = newSelectionEnd;
  61396. syncDropdownVisible();
  61397. });
  61398. }
  61399. }
  61400. }
  61401. };
  61402. const { wrapperRef } = useFocusController(elInputRef, {
  61403. disabled,
  61404. afterFocus() {
  61405. syncAfterCursorMove();
  61406. },
  61407. beforeBlur(event) {
  61408. var _a;
  61409. return (_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  61410. },
  61411. afterBlur() {
  61412. visible.value = false;
  61413. }
  61414. });
  61415. const handleInputMouseDown = () => {
  61416. syncAfterCursorMove();
  61417. };
  61418. const getOriginalOption = (mentionOption) => {
  61419. return props.options.find((option) => {
  61420. return mentionOption.value === option[aliasProps.value.value];
  61421. });
  61422. };
  61423. const handleSelect = (item) => {
  61424. if (!mentionCtx.value)
  61425. return;
  61426. const inputEl = getInputEl();
  61427. if (!inputEl)
  61428. return;
  61429. const inputValue = inputEl.value;
  61430. const { split } = props;
  61431. const newEndPart = inputValue.slice(mentionCtx.value.end);
  61432. const alreadySeparated = newEndPart.startsWith(split);
  61433. const newMiddlePart = `${item.value}${alreadySeparated ? "" : split}`;
  61434. const newValue = inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart;
  61435. emit(UPDATE_MODEL_EVENT, newValue);
  61436. emit(INPUT_EVENT, newValue);
  61437. emit("select", getOriginalOption(item), mentionCtx.value.prefix);
  61438. const newSelectionEnd = mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0);
  61439. nextTick(() => {
  61440. inputEl.selectionStart = newSelectionEnd;
  61441. inputEl.selectionEnd = newSelectionEnd;
  61442. inputEl.focus();
  61443. syncDropdownVisible();
  61444. });
  61445. };
  61446. const getInputEl = () => {
  61447. var _a, _b;
  61448. return props.type === "textarea" ? (_a = elInputRef.value) == null ? void 0 : _a.textarea : (_b = elInputRef.value) == null ? void 0 : _b.input;
  61449. };
  61450. const syncAfterCursorMove = () => {
  61451. setTimeout(() => {
  61452. syncCursor();
  61453. syncDropdownVisible();
  61454. nextTick(() => {
  61455. var _a;
  61456. return (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  61457. });
  61458. }, 0);
  61459. };
  61460. const syncCursor = () => {
  61461. const inputEl = getInputEl();
  61462. if (!inputEl)
  61463. return;
  61464. const caretPosition = getCursorPosition(inputEl);
  61465. const inputRect = inputEl.getBoundingClientRect();
  61466. const wrapperRect = wrapperRef.value.getBoundingClientRect();
  61467. cursorStyle.value = {
  61468. position: "absolute",
  61469. width: 0,
  61470. height: `${caretPosition.height}px`,
  61471. left: `${caretPosition.left + inputRect.left - wrapperRect.left}px`,
  61472. top: `${caretPosition.top + inputRect.top - wrapperRect.top}px`
  61473. };
  61474. };
  61475. const syncDropdownVisible = () => {
  61476. const inputEl = getInputEl();
  61477. if (document.activeElement !== inputEl) {
  61478. visible.value = false;
  61479. return;
  61480. }
  61481. const { prefix, split } = props;
  61482. mentionCtx.value = getMentionCtx(inputEl, prefix, split);
  61483. if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {
  61484. visible.value = true;
  61485. emit("search", mentionCtx.value.pattern, mentionCtx.value.prefix);
  61486. return;
  61487. }
  61488. visible.value = false;
  61489. };
  61490. expose({
  61491. input: elInputRef,
  61492. tooltip: tooltipRef,
  61493. dropdownVisible
  61494. });
  61495. return (_ctx, _cache) => {
  61496. return openBlock(), createElementBlock("div", {
  61497. ref_key: "wrapperRef",
  61498. ref: wrapperRef,
  61499. class: normalizeClass(unref(ns).b())
  61500. }, [
  61501. createVNode(unref(ElInput), mergeProps(mergeProps(unref(passInputProps), _ctx.$attrs), {
  61502. ref_key: "elInputRef",
  61503. ref: elInputRef,
  61504. "model-value": _ctx.modelValue,
  61505. disabled: unref(disabled),
  61506. role: unref(dropdownVisible) ? "combobox" : void 0,
  61507. "aria-activedescendant": unref(dropdownVisible) ? unref(hoveringId) || "" : void 0,
  61508. "aria-controls": unref(dropdownVisible) ? unref(contentId) : void 0,
  61509. "aria-expanded": unref(dropdownVisible) || void 0,
  61510. "aria-label": _ctx.ariaLabel,
  61511. "aria-autocomplete": unref(dropdownVisible) ? "none" : void 0,
  61512. "aria-haspopup": unref(dropdownVisible) ? "listbox" : void 0,
  61513. onInput: handleInputChange,
  61514. onKeydown: handleInputKeyDown,
  61515. onMousedown: handleInputMouseDown
  61516. }), createSlots({
  61517. _: 2
  61518. }, [
  61519. renderList(_ctx.$slots, (_, name) => {
  61520. return {
  61521. name,
  61522. fn: withCtx((slotProps) => [
  61523. renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
  61524. ])
  61525. };
  61526. })
  61527. ]), 1040, ["model-value", "disabled", "role", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "aria-autocomplete", "aria-haspopup"]),
  61528. createVNode(unref(ElTooltip), {
  61529. ref_key: "tooltipRef",
  61530. ref: tooltipRef,
  61531. visible: unref(dropdownVisible),
  61532. "popper-class": [unref(ns).e("popper"), _ctx.popperClass],
  61533. "popper-style": _ctx.popperStyle,
  61534. "popper-options": _ctx.popperOptions,
  61535. placement: unref(computedPlacement),
  61536. "fallback-placements": unref(computedFallbackPlacements),
  61537. effect: "light",
  61538. pure: "",
  61539. offset: _ctx.offset,
  61540. "show-arrow": _ctx.showArrow
  61541. }, {
  61542. default: withCtx(() => [
  61543. createElementVNode("div", {
  61544. style: normalizeStyle(cursorStyle.value)
  61545. }, null, 4)
  61546. ]),
  61547. content: withCtx(() => {
  61548. var _a;
  61549. return [
  61550. createVNode(ElMentionDropdown, {
  61551. ref_key: "dropdownRef",
  61552. ref: dropdownRef,
  61553. options: unref(filteredOptions),
  61554. disabled: unref(disabled),
  61555. loading: _ctx.loading,
  61556. "content-id": unref(contentId),
  61557. "aria-label": _ctx.ariaLabel,
  61558. onSelect: handleSelect,
  61559. onClick: withModifiers((_a = elInputRef.value) == null ? void 0 : _a.focus, ["stop"])
  61560. }, createSlots({
  61561. _: 2
  61562. }, [
  61563. renderList(_ctx.$slots, (_, name) => {
  61564. return {
  61565. name,
  61566. fn: withCtx((slotProps) => [
  61567. renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
  61568. ])
  61569. };
  61570. })
  61571. ]), 1032, ["options", "disabled", "loading", "content-id", "aria-label", "onClick"])
  61572. ];
  61573. }),
  61574. _: 3
  61575. }, 8, ["visible", "popper-class", "popper-style", "popper-options", "placement", "fallback-placements", "offset", "show-arrow"])
  61576. ], 2);
  61577. };
  61578. }
  61579. });
  61580. var Mention = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "mention.vue"]]);
  61581. const ElMention = withInstall(Mention);
  61582. function useContainer(layout) {
  61583. const containerEl = ref();
  61584. const { width, height } = useElementSize(containerEl);
  61585. const containerSize = computed(() => {
  61586. return layout.value === "horizontal" ? width.value : height.value;
  61587. });
  61588. return { containerEl, containerSize };
  61589. }
  61590. function getPct(str) {
  61591. return Number(str.slice(0, -1)) / 100;
  61592. }
  61593. function getPx(str) {
  61594. return Number(str.slice(0, -2));
  61595. }
  61596. function isPct(itemSize) {
  61597. return isString$1(itemSize) && itemSize.endsWith("%");
  61598. }
  61599. function isPx(itemSize) {
  61600. return isString$1(itemSize) && itemSize.endsWith("px");
  61601. }
  61602. function useSize(panels, containerSize) {
  61603. const propSizes = computed(() => panels.value.map((i) => i.size));
  61604. const panelCounts = computed(() => panels.value.length);
  61605. const percentSizes = ref([]);
  61606. watch([propSizes, panelCounts, containerSize], () => {
  61607. var _a;
  61608. let ptgList = [];
  61609. let emptyCount = 0;
  61610. for (let i = 0; i < panelCounts.value; i += 1) {
  61611. const itemSize = (_a = panels.value[i]) == null ? void 0 : _a.size;
  61612. if (isPct(itemSize)) {
  61613. ptgList[i] = getPct(itemSize);
  61614. } else if (isPx(itemSize)) {
  61615. ptgList[i] = getPx(itemSize) / containerSize.value;
  61616. } else if (itemSize || itemSize === 0) {
  61617. const num = Number(itemSize);
  61618. if (!Number.isNaN(num)) {
  61619. ptgList[i] = num / containerSize.value;
  61620. }
  61621. } else {
  61622. emptyCount += 1;
  61623. ptgList[i] = void 0;
  61624. }
  61625. }
  61626. const totalPtg = ptgList.reduce((acc, ptg) => acc + (ptg || 0), 0);
  61627. if (totalPtg > 1 || !emptyCount) {
  61628. const scale = 1 / totalPtg;
  61629. ptgList = ptgList.map((ptg) => ptg === void 0 ? 0 : ptg * scale);
  61630. } else {
  61631. const avgRest = (1 - totalPtg) / emptyCount;
  61632. ptgList = ptgList.map((ptg) => ptg === void 0 ? avgRest : ptg);
  61633. }
  61634. percentSizes.value = ptgList;
  61635. });
  61636. const ptg2px = (ptg) => ptg * containerSize.value;
  61637. const pxSizes = computed(() => percentSizes.value.map(ptg2px));
  61638. return { percentSizes, pxSizes };
  61639. }
  61640. function useResize(panels, containerSize, pxSizes, lazy) {
  61641. const ptg2px = (ptg) => ptg * containerSize.value || 0;
  61642. function getLimitSize(str, defaultLimit) {
  61643. if (isPct(str)) {
  61644. return ptg2px(getPct(str));
  61645. } else if (isPx(str)) {
  61646. return getPx(str);
  61647. }
  61648. return str != null ? str : defaultLimit;
  61649. }
  61650. const lazyOffset = ref(0);
  61651. const movingIndex = ref(null);
  61652. let cachePxSizes = [];
  61653. let updatePanelSizes = NOOP;
  61654. const limitSizes = computed(() => panels.value.map((item) => [item.min, item.max]));
  61655. watch(lazy, () => {
  61656. if (lazyOffset.value) {
  61657. const mouseup = new MouseEvent("mouseup", { bubbles: true });
  61658. window.dispatchEvent(mouseup);
  61659. }
  61660. });
  61661. const onMoveStart = (index) => {
  61662. lazyOffset.value = 0;
  61663. movingIndex.value = { index, confirmed: false };
  61664. cachePxSizes = pxSizes.value;
  61665. };
  61666. const onMoving = (index, offset) => {
  61667. var _a, _b;
  61668. let confirmedIndex = null;
  61669. if ((!movingIndex.value || !movingIndex.value.confirmed) && offset !== 0) {
  61670. if (offset > 0) {
  61671. confirmedIndex = index;
  61672. movingIndex.value = { index, confirmed: true };
  61673. } else {
  61674. for (let i = index; i >= 0; i -= 1) {
  61675. if (cachePxSizes[i] > 0) {
  61676. confirmedIndex = i;
  61677. movingIndex.value = { index: i, confirmed: true };
  61678. break;
  61679. }
  61680. }
  61681. }
  61682. }
  61683. const mergedIndex = (_b = confirmedIndex != null ? confirmedIndex : (_a = movingIndex.value) == null ? void 0 : _a.index) != null ? _b : index;
  61684. const numSizes = [...cachePxSizes];
  61685. const nextIndex = mergedIndex + 1;
  61686. const startMinSize = getLimitSize(limitSizes.value[mergedIndex][0], 0);
  61687. const endMinSize = getLimitSize(limitSizes.value[nextIndex][0], 0);
  61688. const startMaxSize = getLimitSize(limitSizes.value[mergedIndex][1], containerSize.value || 0);
  61689. const endMaxSize = getLimitSize(limitSizes.value[nextIndex][1], containerSize.value || 0);
  61690. let mergedOffset = offset;
  61691. if (numSizes[mergedIndex] + mergedOffset < startMinSize) {
  61692. mergedOffset = startMinSize - numSizes[mergedIndex];
  61693. }
  61694. if (numSizes[nextIndex] - mergedOffset < endMinSize) {
  61695. mergedOffset = numSizes[nextIndex] - endMinSize;
  61696. }
  61697. if (numSizes[mergedIndex] + mergedOffset > startMaxSize) {
  61698. mergedOffset = startMaxSize - numSizes[mergedIndex];
  61699. }
  61700. if (numSizes[nextIndex] - mergedOffset > endMaxSize) {
  61701. mergedOffset = numSizes[nextIndex] - endMaxSize;
  61702. }
  61703. numSizes[mergedIndex] += mergedOffset;
  61704. numSizes[nextIndex] -= mergedOffset;
  61705. lazyOffset.value = mergedOffset;
  61706. updatePanelSizes = () => {
  61707. panels.value.forEach((panel, index2) => {
  61708. panel.size = numSizes[index2];
  61709. });
  61710. updatePanelSizes = NOOP;
  61711. };
  61712. if (!lazy.value) {
  61713. updatePanelSizes();
  61714. }
  61715. };
  61716. const onMoveEnd = () => {
  61717. if (lazy.value) {
  61718. updatePanelSizes();
  61719. }
  61720. lazyOffset.value = 0;
  61721. movingIndex.value = null;
  61722. cachePxSizes = [];
  61723. };
  61724. const cacheCollapsedSize = [];
  61725. const onCollapse = (index, type) => {
  61726. if (!cacheCollapsedSize.length) {
  61727. cacheCollapsedSize.push(...pxSizes.value);
  61728. }
  61729. const currentSizes = pxSizes.value;
  61730. const currentIndex = type === "start" ? index : index + 1;
  61731. const targetIndex = type === "start" ? index + 1 : index;
  61732. const currentSize = currentSizes[currentIndex];
  61733. const targetSize = currentSizes[targetIndex];
  61734. if (currentSize !== 0 && targetSize !== 0) {
  61735. currentSizes[currentIndex] = 0;
  61736. currentSizes[targetIndex] += currentSize;
  61737. cacheCollapsedSize[index] = currentSize;
  61738. } else {
  61739. const totalSize = currentSize + targetSize;
  61740. const targetCacheCollapsedSize = cacheCollapsedSize[index];
  61741. const currentCacheCollapsedSize = totalSize - targetCacheCollapsedSize;
  61742. currentSizes[targetIndex] = targetCacheCollapsedSize;
  61743. currentSizes[currentIndex] = currentCacheCollapsedSize;
  61744. }
  61745. panels.value.forEach((panel, index2) => {
  61746. panel.size = currentSizes[index2];
  61747. });
  61748. };
  61749. return {
  61750. lazyOffset,
  61751. onMoveStart,
  61752. onMoving,
  61753. onMoveEnd,
  61754. movingIndex,
  61755. onCollapse
  61756. };
  61757. }
  61758. const splitterProps = buildProps({
  61759. layout: {
  61760. type: String,
  61761. default: "horizontal",
  61762. values: ["horizontal", "vertical"]
  61763. },
  61764. lazy: Boolean
  61765. });
  61766. const splitterRootContextKey = Symbol("splitterRootContextKey");
  61767. const __default__$4 = defineComponent({
  61768. name: "ElSplitter"
  61769. });
  61770. const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  61771. ...__default__$4,
  61772. props: splitterProps,
  61773. emits: ["resizeStart", "resize", "resizeEnd", "collapse"],
  61774. setup(__props, { emit: emits }) {
  61775. const props = __props;
  61776. const ns = useNamespace("splitter");
  61777. const layout = toRef(props, "layout");
  61778. const lazy = toRef(props, "lazy");
  61779. const { containerEl, containerSize } = useContainer(layout);
  61780. const {
  61781. removeChild: unregisterPanel,
  61782. children: panels,
  61783. addChild: registerPanel,
  61784. ChildrenSorter: PanelsSorter
  61785. } = useOrderedChildren(getCurrentInstance(), "ElSplitterPanel");
  61786. watch(panels, () => {
  61787. panels.value.forEach((instance, index) => {
  61788. instance.setIndex(index);
  61789. });
  61790. });
  61791. const { percentSizes, pxSizes } = useSize(panels, containerSize);
  61792. const {
  61793. lazyOffset,
  61794. movingIndex,
  61795. onMoveStart,
  61796. onMoving,
  61797. onMoveEnd,
  61798. onCollapse
  61799. } = useResize(panels, containerSize, pxSizes, lazy);
  61800. const splitterStyles = computed(() => {
  61801. return {
  61802. [ns.cssVarBlockName("bar-offset")]: lazy.value ? `${lazyOffset.value}px` : void 0
  61803. };
  61804. });
  61805. const onResizeStart = (index) => {
  61806. onMoveStart(index);
  61807. emits("resizeStart", index, pxSizes.value);
  61808. };
  61809. const onResize = (index, offset) => {
  61810. onMoving(index, offset);
  61811. if (!lazy.value) {
  61812. emits("resize", index, pxSizes.value);
  61813. }
  61814. };
  61815. const onResizeEnd = async (index) => {
  61816. onMoveEnd();
  61817. await nextTick();
  61818. emits("resizeEnd", index, pxSizes.value);
  61819. };
  61820. const onCollapsible = (index, type) => {
  61821. onCollapse(index, type);
  61822. emits("collapse", index, type, pxSizes.value);
  61823. };
  61824. provide(splitterRootContextKey, reactive({
  61825. panels,
  61826. percentSizes,
  61827. pxSizes,
  61828. layout,
  61829. lazy,
  61830. movingIndex,
  61831. containerSize,
  61832. onMoveStart: onResizeStart,
  61833. onMoving: onResize,
  61834. onMoveEnd: onResizeEnd,
  61835. onCollapse: onCollapsible,
  61836. registerPanel,
  61837. unregisterPanel
  61838. }));
  61839. return (_ctx, _cache) => {
  61840. return openBlock(), createElementBlock("div", {
  61841. ref_key: "containerEl",
  61842. ref: containerEl,
  61843. class: normalizeClass([unref(ns).b(), unref(ns).e(unref(layout))]),
  61844. style: normalizeStyle(unref(splitterStyles))
  61845. }, [
  61846. renderSlot(_ctx.$slots, "default"),
  61847. createVNode(unref(PanelsSorter)),
  61848. createCommentVNode(" Prevent iframe touch events from breaking "),
  61849. unref(movingIndex) ? (openBlock(), createElementBlock("div", {
  61850. key: 0,
  61851. class: normalizeClass([unref(ns).e("mask"), unref(ns).e(`mask-${unref(layout)}`)])
  61852. }, null, 2)) : createCommentVNode("v-if", true)
  61853. ], 6);
  61854. };
  61855. }
  61856. });
  61857. var Splitter = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "splitter.vue"]]);
  61858. function getCollapsible(collapsible) {
  61859. if (collapsible && isObject$1(collapsible)) {
  61860. return collapsible;
  61861. }
  61862. return {
  61863. start: !!collapsible,
  61864. end: !!collapsible
  61865. };
  61866. }
  61867. function isCollapsible(panel, size, nextPanel, nextSize) {
  61868. if ((panel == null ? void 0 : panel.collapsible.end) && size > 0) {
  61869. return true;
  61870. }
  61871. if ((nextPanel == null ? void 0 : nextPanel.collapsible.start) && nextSize === 0 && size > 0) {
  61872. return true;
  61873. }
  61874. return false;
  61875. }
  61876. const __default__$3 = defineComponent({
  61877. name: "ElSplitterBar"
  61878. });
  61879. const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  61880. ...__default__$3,
  61881. props: {
  61882. index: {
  61883. type: Number,
  61884. required: true
  61885. },
  61886. layout: {
  61887. type: String,
  61888. values: ["horizontal", "vertical"],
  61889. default: "horizontal"
  61890. },
  61891. resizable: {
  61892. type: Boolean,
  61893. default: true
  61894. },
  61895. lazy: Boolean,
  61896. startCollapsible: Boolean,
  61897. endCollapsible: Boolean
  61898. },
  61899. emits: ["moveStart", "moving", "moveEnd", "collapse"],
  61900. setup(__props, { emit }) {
  61901. const props = __props;
  61902. const ns = useNamespace("splitter-bar");
  61903. const isHorizontal = computed(() => props.layout === "horizontal");
  61904. const barWrapStyles = computed(() => {
  61905. if (isHorizontal.value) {
  61906. return { width: 0 };
  61907. }
  61908. return { height: 0 };
  61909. });
  61910. const draggerStyles = computed(() => {
  61911. return {
  61912. width: isHorizontal.value ? "16px" : "100%",
  61913. height: isHorizontal.value ? "100%" : "16px",
  61914. cursor: !props.resizable ? "auto" : isHorizontal.value ? "ew-resize" : "ns-resize",
  61915. touchAction: "none"
  61916. };
  61917. });
  61918. const draggerPseudoClass = computed(() => {
  61919. const prefix = ns.e("dragger");
  61920. return {
  61921. [`${prefix}-horizontal`]: isHorizontal.value,
  61922. [`${prefix}-vertical`]: !isHorizontal.value,
  61923. [`${prefix}-active`]: !!startPos.value
  61924. };
  61925. });
  61926. const startPos = ref(null);
  61927. const onMousedown = (e) => {
  61928. if (!props.resizable)
  61929. return;
  61930. startPos.value = [e.pageX, e.pageY];
  61931. emit("moveStart", props.index);
  61932. window.addEventListener("mouseup", onMouseUp);
  61933. window.addEventListener("mousemove", onMouseMove);
  61934. };
  61935. const onTouchStart = (e) => {
  61936. if (props.resizable && e.touches.length === 1) {
  61937. e.preventDefault();
  61938. const touch = e.touches[0];
  61939. startPos.value = [touch.pageX, touch.pageY];
  61940. emit("moveStart", props.index);
  61941. window.addEventListener("touchend", onTouchEnd);
  61942. window.addEventListener("touchmove", onTouchMove);
  61943. }
  61944. };
  61945. const onMouseMove = (e) => {
  61946. const { pageX, pageY } = e;
  61947. const offsetX = pageX - startPos.value[0];
  61948. const offsetY = pageY - startPos.value[1];
  61949. const offset = isHorizontal.value ? offsetX : offsetY;
  61950. emit("moving", props.index, offset);
  61951. };
  61952. const onTouchMove = (e) => {
  61953. if (e.touches.length === 1) {
  61954. e.preventDefault();
  61955. const touch = e.touches[0];
  61956. const offsetX = touch.pageX - startPos.value[0];
  61957. const offsetY = touch.pageY - startPos.value[1];
  61958. const offset = isHorizontal.value ? offsetX : offsetY;
  61959. emit("moving", props.index, offset);
  61960. }
  61961. };
  61962. const onMouseUp = () => {
  61963. startPos.value = null;
  61964. window.removeEventListener("mouseup", onMouseUp);
  61965. window.removeEventListener("mousemove", onMouseMove);
  61966. emit("moveEnd", props.index);
  61967. };
  61968. const onTouchEnd = () => {
  61969. startPos.value = null;
  61970. window.removeEventListener("touchend", onTouchEnd);
  61971. window.removeEventListener("touchmove", onTouchMove);
  61972. emit("moveEnd", props.index);
  61973. };
  61974. const StartIcon = computed(() => isHorizontal.value ? arrow_left_default : arrow_up_default);
  61975. const EndIcon = computed(() => isHorizontal.value ? arrow_right_default : arrow_down_default);
  61976. return (_ctx, _cache) => {
  61977. return openBlock(), createElementBlock("div", {
  61978. class: normalizeClass([unref(ns).b()]),
  61979. style: normalizeStyle(unref(barWrapStyles))
  61980. }, [
  61981. __props.startCollapsible ? (openBlock(), createElementBlock("div", {
  61982. key: 0,
  61983. class: normalizeClass([unref(ns).e("collapse-icon"), unref(ns).e(`${__props.layout}-collapse-icon-start`)]),
  61984. onClick: ($event) => emit("collapse", __props.index, "start")
  61985. }, [
  61986. renderSlot(_ctx.$slots, "start-collapsible", {}, () => [
  61987. (openBlock(), createBlock(resolveDynamicComponent(unref(StartIcon)), { style: { "width": "12px", "height": "12px" } }))
  61988. ])
  61989. ], 10, ["onClick"])) : createCommentVNode("v-if", true),
  61990. createElementVNode("div", {
  61991. class: normalizeClass([
  61992. unref(ns).e("dragger"),
  61993. unref(draggerPseudoClass),
  61994. unref(ns).is("disabled", !__props.resizable),
  61995. unref(ns).is("lazy", __props.resizable && __props.lazy)
  61996. ]),
  61997. style: normalizeStyle(unref(draggerStyles)),
  61998. onMousedown,
  61999. onTouchstart: onTouchStart
  62000. }, null, 38),
  62001. __props.endCollapsible ? (openBlock(), createElementBlock("div", {
  62002. key: 1,
  62003. class: normalizeClass([unref(ns).e("collapse-icon"), unref(ns).e(`${__props.layout}-collapse-icon-end`)]),
  62004. onClick: ($event) => emit("collapse", __props.index, "end")
  62005. }, [
  62006. renderSlot(_ctx.$slots, "end-collapsible", {}, () => [
  62007. (openBlock(), createBlock(resolveDynamicComponent(unref(EndIcon)), { style: { "width": "12px", "height": "12px" } }))
  62008. ])
  62009. ], 10, ["onClick"])) : createCommentVNode("v-if", true)
  62010. ], 6);
  62011. };
  62012. }
  62013. });
  62014. var SplitBar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "split-bar.vue"]]);
  62015. const splitterPanelProps = buildProps({
  62016. min: {
  62017. type: [String, Number]
  62018. },
  62019. max: {
  62020. type: [String, Number]
  62021. },
  62022. size: {
  62023. type: [String, Number]
  62024. },
  62025. resizable: {
  62026. type: Boolean,
  62027. default: true
  62028. },
  62029. collapsible: Boolean
  62030. });
  62031. const COMPONENT_NAME = "ElSplitterPanel";
  62032. const __default__$2 = defineComponent({
  62033. name: COMPONENT_NAME
  62034. });
  62035. const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  62036. ...__default__$2,
  62037. props: splitterPanelProps,
  62038. emits: ["update:size"],
  62039. setup(__props, { emit: emits }) {
  62040. const props = __props;
  62041. const ns = useNamespace("splitter-panel");
  62042. const splitterContext = inject(splitterRootContextKey);
  62043. if (!splitterContext)
  62044. throwError(COMPONENT_NAME, "usage: <el-splitter><el-splitter-panel /></el-splitter/>");
  62045. const { panels, layout, lazy, containerSize, pxSizes } = toRefs(splitterContext);
  62046. const {
  62047. registerPanel,
  62048. unregisterPanel,
  62049. onCollapse,
  62050. onMoveEnd,
  62051. onMoveStart,
  62052. onMoving
  62053. } = splitterContext;
  62054. const panelEl = ref();
  62055. const instance = getCurrentInstance();
  62056. const uid = instance.uid;
  62057. const index = ref(0);
  62058. const panel = computed(() => panels.value[index.value]);
  62059. const setIndex = (val) => {
  62060. index.value = val;
  62061. };
  62062. const panelSize = computed(() => {
  62063. var _a;
  62064. if (!panel.value)
  62065. return 0;
  62066. return (_a = pxSizes.value[index.value]) != null ? _a : 0;
  62067. });
  62068. const nextSize = computed(() => {
  62069. var _a;
  62070. if (!panel.value)
  62071. return 0;
  62072. return (_a = pxSizes.value[index.value + 1]) != null ? _a : 0;
  62073. });
  62074. const nextPanel = computed(() => {
  62075. if (panel.value) {
  62076. return panels.value[index.value + 1];
  62077. }
  62078. return null;
  62079. });
  62080. const isResizable = computed(() => {
  62081. var _a;
  62082. if (!nextPanel.value)
  62083. return false;
  62084. return props.resizable && ((_a = nextPanel.value) == null ? void 0 : _a.resizable) && (panelSize.value !== 0 || !props.min) && (nextSize.value !== 0 || !nextPanel.value.min);
  62085. });
  62086. const isShowBar = computed(() => {
  62087. if (!panel.value)
  62088. return false;
  62089. return index.value !== panels.value.length - 1;
  62090. });
  62091. const startCollapsible = computed(() => isCollapsible(panel.value, panelSize.value, nextPanel.value, nextSize.value));
  62092. const endCollapsible = computed(() => isCollapsible(nextPanel.value, nextSize.value, panel.value, panelSize.value));
  62093. function sizeToPx(str) {
  62094. if (isPct(str)) {
  62095. return getPct(str) * containerSize.value || 0;
  62096. } else if (isPx(str)) {
  62097. return getPx(str);
  62098. }
  62099. return str != null ? str : 0;
  62100. }
  62101. let isSizeUpdating = false;
  62102. watch(() => props.size, () => {
  62103. if (!isSizeUpdating && panel.value) {
  62104. if (!containerSize.value) {
  62105. panel.value.size = props.size;
  62106. return;
  62107. }
  62108. const size = sizeToPx(props.size);
  62109. const maxSize = sizeToPx(props.max);
  62110. const minSize = sizeToPx(props.min);
  62111. const finalSize = Math.min(Math.max(size, minSize || 0), maxSize || size);
  62112. if (finalSize !== size) {
  62113. emits("update:size", finalSize);
  62114. }
  62115. panel.value.size = finalSize;
  62116. }
  62117. });
  62118. watch(() => {
  62119. var _a;
  62120. return (_a = panel.value) == null ? void 0 : _a.size;
  62121. }, (val) => {
  62122. if (val !== props.size) {
  62123. isSizeUpdating = true;
  62124. emits("update:size", val);
  62125. nextTick(() => isSizeUpdating = false);
  62126. }
  62127. });
  62128. watch(() => props.resizable, (val) => {
  62129. if (panel.value) {
  62130. panel.value.resizable = val;
  62131. }
  62132. });
  62133. const _panel = reactive({
  62134. el: panelEl.value,
  62135. uid,
  62136. getVnode: () => instance.vnode,
  62137. setIndex,
  62138. ...props,
  62139. collapsible: computed(() => getCollapsible(props.collapsible))
  62140. });
  62141. registerPanel(_panel);
  62142. onBeforeUnmount(() => unregisterPanel(_panel));
  62143. return (_ctx, _cache) => {
  62144. return openBlock(), createElementBlock(Fragment, null, [
  62145. createElementVNode("div", mergeProps({
  62146. ref_key: "panelEl",
  62147. ref: panelEl,
  62148. class: [unref(ns).b()],
  62149. style: { flexBasis: `${unref(panelSize)}px` }
  62150. }, _ctx.$attrs), [
  62151. renderSlot(_ctx.$slots, "default")
  62152. ], 16),
  62153. unref(isShowBar) ? (openBlock(), createBlock(SplitBar, {
  62154. key: 0,
  62155. index: index.value,
  62156. layout: unref(layout),
  62157. lazy: unref(lazy),
  62158. resizable: unref(isResizable),
  62159. "start-collapsible": unref(startCollapsible),
  62160. "end-collapsible": unref(endCollapsible),
  62161. onMoveStart: unref(onMoveStart),
  62162. onMoving: unref(onMoving),
  62163. onMoveEnd: unref(onMoveEnd),
  62164. onCollapse: unref(onCollapse)
  62165. }, {
  62166. "start-collapsible": withCtx(() => [
  62167. renderSlot(_ctx.$slots, "start-collapsible")
  62168. ]),
  62169. "end-collapsible": withCtx(() => [
  62170. renderSlot(_ctx.$slots, "end-collapsible")
  62171. ]),
  62172. _: 3
  62173. }, 8, ["index", "layout", "lazy", "resizable", "start-collapsible", "end-collapsible", "onMoveStart", "onMoving", "onMoveEnd", "onCollapse"])) : createCommentVNode("v-if", true)
  62174. ], 64);
  62175. };
  62176. }
  62177. });
  62178. var SplitPanel = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "split-panel.vue"]]);
  62179. const ElSplitter = withInstall(Splitter, {
  62180. SplitPanel
  62181. });
  62182. const ElSplitterPanel = withNoopInstall(SplitPanel);
  62183. var Components = [
  62184. ElAffix,
  62185. ElAlert,
  62186. ElAutocomplete,
  62187. ElAutoResizer,
  62188. ElAvatar,
  62189. ElBacktop,
  62190. ElBadge,
  62191. ElBreadcrumb,
  62192. ElBreadcrumbItem,
  62193. ElButton,
  62194. ElButtonGroup$1,
  62195. ElCalendar,
  62196. ElCard,
  62197. ElCarousel,
  62198. ElCarouselItem,
  62199. ElCascader,
  62200. ElCascaderPanel,
  62201. ElCheckTag,
  62202. ElCheckbox,
  62203. ElCheckboxButton,
  62204. ElCheckboxGroup$1,
  62205. ElCol,
  62206. ElCollapse,
  62207. ElCollapseItem,
  62208. ElCollapseTransition,
  62209. ElColorPickerPanel,
  62210. ElColorPicker,
  62211. ElConfigProvider,
  62212. ElContainer,
  62213. ElAside,
  62214. ElFooter,
  62215. ElHeader,
  62216. ElMain,
  62217. ElDatePicker,
  62218. ElDatePickerPanel,
  62219. ElDescriptions,
  62220. ElDescriptionsItem,
  62221. ElDialog,
  62222. ElDivider,
  62223. ElDrawer,
  62224. ElDropdown,
  62225. ElDropdownItem,
  62226. ElDropdownMenu,
  62227. ElEmpty,
  62228. ElForm,
  62229. ElFormItem,
  62230. ElIcon,
  62231. ElImage,
  62232. ElImageViewer,
  62233. ElInput,
  62234. ElInputNumber,
  62235. ElInputTag,
  62236. ElLink,
  62237. ElMenu,
  62238. ElMenuItem,
  62239. ElMenuItemGroup,
  62240. ElSubMenu,
  62241. ElPageHeader,
  62242. ElPagination,
  62243. ElPopconfirm,
  62244. ElPopover,
  62245. ElPopper,
  62246. ElProgress,
  62247. ElRadio,
  62248. ElRadioButton,
  62249. ElRadioGroup,
  62250. ElRate,
  62251. ElResult,
  62252. ElRow,
  62253. ElScrollbar,
  62254. ElSelect,
  62255. ElOption,
  62256. ElOptionGroup,
  62257. ElSelectV2,
  62258. ElSkeleton,
  62259. ElSkeletonItem,
  62260. ElSlider,
  62261. ElSpace,
  62262. ElStatistic,
  62263. ElCountdown,
  62264. ElSteps,
  62265. ElStep,
  62266. ElSwitch,
  62267. ElTable,
  62268. ElTableColumn,
  62269. ElTableV2,
  62270. ElTabs,
  62271. ElTabPane,
  62272. ElTag,
  62273. ElText,
  62274. ElTimePicker,
  62275. ElTimeSelect,
  62276. ElTimeline,
  62277. ElTimelineItem,
  62278. ElTooltip,
  62279. ElTransfer,
  62280. ElTree,
  62281. ElTreeSelect,
  62282. ElTreeV2,
  62283. ElUpload,
  62284. ElWatermark,
  62285. ElTour,
  62286. ElTourStep,
  62287. ElAnchor,
  62288. ElAnchorLink,
  62289. ElSegmented,
  62290. ElMention,
  62291. ElSplitter,
  62292. ElSplitterPanel
  62293. ];
  62294. const SCOPE = "ElInfiniteScroll";
  62295. const CHECK_INTERVAL = 50;
  62296. const DEFAULT_DELAY = 200;
  62297. const DEFAULT_DISTANCE = 0;
  62298. const attributes = {
  62299. delay: {
  62300. type: Number,
  62301. default: DEFAULT_DELAY
  62302. },
  62303. distance: {
  62304. type: Number,
  62305. default: DEFAULT_DISTANCE
  62306. },
  62307. disabled: {
  62308. type: Boolean,
  62309. default: false
  62310. },
  62311. immediate: {
  62312. type: Boolean,
  62313. default: true
  62314. }
  62315. };
  62316. const getScrollOptions = (el, instance) => {
  62317. return Object.entries(attributes).reduce((acm, [name, option]) => {
  62318. var _a, _b;
  62319. const { type, default: defaultValue } = option;
  62320. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  62321. let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
  62322. value = value === "false" ? false : value;
  62323. value = type(value);
  62324. acm[name] = Number.isNaN(value) ? defaultValue : value;
  62325. return acm;
  62326. }, {});
  62327. };
  62328. const destroyObserver = (el) => {
  62329. const { observer } = el[SCOPE];
  62330. if (observer) {
  62331. observer.disconnect();
  62332. delete el[SCOPE].observer;
  62333. }
  62334. };
  62335. const handleScroll = (el, cb) => {
  62336. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  62337. const { disabled, distance } = getScrollOptions(el, instance);
  62338. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  62339. const delta = scrollTop - lastScrollTop;
  62340. el[SCOPE].lastScrollTop = scrollTop;
  62341. if (observer || disabled || delta < 0)
  62342. return;
  62343. let shouldTrigger = false;
  62344. if (container === el) {
  62345. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  62346. } else {
  62347. const { clientTop, scrollHeight: height } = el;
  62348. const offsetTop = getOffsetTopDistance(el, containerEl);
  62349. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  62350. }
  62351. if (shouldTrigger) {
  62352. cb.call(instance);
  62353. }
  62354. };
  62355. function checkFull(el, cb) {
  62356. const { containerEl, instance } = el[SCOPE];
  62357. const { disabled } = getScrollOptions(el, instance);
  62358. if (disabled || containerEl.clientHeight === 0)
  62359. return;
  62360. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  62361. cb.call(instance);
  62362. } else {
  62363. destroyObserver(el);
  62364. }
  62365. }
  62366. const InfiniteScroll = {
  62367. async mounted(el, binding) {
  62368. const { instance, value: cb } = binding;
  62369. useDeprecated({
  62370. scope: SCOPE,
  62371. from: "the directive v-infinite-scroll",
  62372. replacement: "the el-scrollbar infinite scroll",
  62373. version: "3.0.0",
  62374. ref: "https://element-plus.org/en-US/component/scrollbar#infinite-scroll"
  62375. }, true);
  62376. if (!isFunction$1(cb)) {
  62377. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  62378. }
  62379. await nextTick();
  62380. const { delay, immediate } = getScrollOptions(el, instance);
  62381. const container = getScrollContainer(el, true);
  62382. const containerEl = container === window ? document.documentElement : container;
  62383. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  62384. if (!container)
  62385. return;
  62386. el[SCOPE] = {
  62387. instance,
  62388. container,
  62389. containerEl,
  62390. delay,
  62391. cb,
  62392. onScroll,
  62393. lastScrollTop: containerEl.scrollTop
  62394. };
  62395. if (immediate) {
  62396. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  62397. el[SCOPE].observer = observer;
  62398. observer.observe(el, { childList: true, subtree: true });
  62399. checkFull(el, cb);
  62400. }
  62401. container.addEventListener("scroll", onScroll);
  62402. },
  62403. unmounted(el) {
  62404. if (!el[SCOPE])
  62405. return;
  62406. const { container, onScroll } = el[SCOPE];
  62407. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  62408. destroyObserver(el);
  62409. },
  62410. async updated(el) {
  62411. if (!el[SCOPE]) {
  62412. await nextTick();
  62413. } else {
  62414. const { containerEl, cb, observer } = el[SCOPE];
  62415. if (containerEl.clientHeight && observer) {
  62416. checkFull(el, cb);
  62417. }
  62418. }
  62419. }
  62420. };
  62421. var InfiniteScroll$1 = InfiniteScroll;
  62422. const _InfiniteScroll = InfiniteScroll$1;
  62423. _InfiniteScroll.install = (app) => {
  62424. app.directive("InfiniteScroll", _InfiniteScroll);
  62425. };
  62426. const ElInfiniteScroll = _InfiniteScroll;
  62427. function createLoadingComponent(options, appContext) {
  62428. let afterLeaveTimer;
  62429. const afterLeaveFlag = ref(false);
  62430. const data = reactive({
  62431. ...options,
  62432. originalPosition: "",
  62433. originalOverflow: "",
  62434. visible: false
  62435. });
  62436. function setText(text) {
  62437. data.text = text;
  62438. }
  62439. function destroySelf() {
  62440. const target = data.parent;
  62441. const ns = vm.ns;
  62442. if (!target.vLoadingAddClassList) {
  62443. let loadingNumber = target.getAttribute("loading-number");
  62444. loadingNumber = Number.parseInt(loadingNumber) - 1;
  62445. if (!loadingNumber) {
  62446. removeClass(target, ns.bm("parent", "relative"));
  62447. target.removeAttribute("loading-number");
  62448. } else {
  62449. target.setAttribute("loading-number", loadingNumber.toString());
  62450. }
  62451. removeClass(target, ns.bm("parent", "hidden"));
  62452. }
  62453. removeElLoadingChild();
  62454. loadingInstance.unmount();
  62455. }
  62456. function removeElLoadingChild() {
  62457. var _a, _b;
  62458. (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  62459. }
  62460. function close() {
  62461. var _a;
  62462. if (options.beforeClose && !options.beforeClose())
  62463. return;
  62464. afterLeaveFlag.value = true;
  62465. clearTimeout(afterLeaveTimer);
  62466. afterLeaveTimer = setTimeout(handleAfterLeave, 400);
  62467. data.visible = false;
  62468. (_a = options.closed) == null ? void 0 : _a.call(options);
  62469. }
  62470. function handleAfterLeave() {
  62471. if (!afterLeaveFlag.value)
  62472. return;
  62473. const target = data.parent;
  62474. afterLeaveFlag.value = false;
  62475. target.vLoadingAddClassList = void 0;
  62476. destroySelf();
  62477. }
  62478. const elLoadingComponent = defineComponent({
  62479. name: "ElLoading",
  62480. setup(_, { expose }) {
  62481. const { ns, zIndex } = useGlobalComponentSettings("loading");
  62482. expose({
  62483. ns,
  62484. zIndex
  62485. });
  62486. return () => {
  62487. const svg = data.spinner || data.svg;
  62488. const spinner = h$1("svg", {
  62489. class: "circular",
  62490. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  62491. ...svg ? { innerHTML: svg } : {}
  62492. }, [
  62493. h$1("circle", {
  62494. class: "path",
  62495. cx: "25",
  62496. cy: "25",
  62497. r: "20",
  62498. fill: "none"
  62499. })
  62500. ]);
  62501. const spinnerText = data.text ? h$1("p", { class: ns.b("text") }, [data.text]) : void 0;
  62502. return h$1(Transition, {
  62503. name: ns.b("fade"),
  62504. onAfterLeave: handleAfterLeave
  62505. }, {
  62506. default: withCtx(() => [
  62507. withDirectives(createVNode("div", {
  62508. style: {
  62509. backgroundColor: data.background || ""
  62510. },
  62511. class: [
  62512. ns.b("mask"),
  62513. data.customClass,
  62514. ns.is("fullscreen", data.fullscreen)
  62515. ]
  62516. }, [
  62517. h$1("div", {
  62518. class: ns.b("spinner")
  62519. }, [spinner, spinnerText])
  62520. ]), [[vShow, data.visible]])
  62521. ])
  62522. });
  62523. };
  62524. }
  62525. });
  62526. const loadingInstance = createApp(elLoadingComponent);
  62527. Object.assign(loadingInstance._context, appContext != null ? appContext : {});
  62528. const vm = loadingInstance.mount(document.createElement("div"));
  62529. return {
  62530. ...toRefs(data),
  62531. setText,
  62532. removeElLoadingChild,
  62533. close,
  62534. handleAfterLeave,
  62535. vm,
  62536. get $el() {
  62537. return vm.$el;
  62538. }
  62539. };
  62540. }
  62541. let fullscreenInstance = void 0;
  62542. const Loading = function(options = {}, context) {
  62543. if (!isClient)
  62544. return void 0;
  62545. const resolved = resolveOptions(options);
  62546. if (resolved.fullscreen && fullscreenInstance) {
  62547. return fullscreenInstance;
  62548. }
  62549. const instance = createLoadingComponent({
  62550. ...resolved,
  62551. closed: () => {
  62552. var _a;
  62553. (_a = resolved.closed) == null ? void 0 : _a.call(resolved);
  62554. if (resolved.fullscreen)
  62555. fullscreenInstance = void 0;
  62556. }
  62557. }, context != null ? context : Loading._context);
  62558. addStyle(resolved, resolved.parent, instance);
  62559. addClassList(resolved, resolved.parent, instance);
  62560. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  62561. let loadingNumber = resolved.parent.getAttribute("loading-number");
  62562. if (!loadingNumber) {
  62563. loadingNumber = "1";
  62564. } else {
  62565. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  62566. }
  62567. resolved.parent.setAttribute("loading-number", loadingNumber);
  62568. resolved.parent.appendChild(instance.$el);
  62569. nextTick(() => instance.visible.value = resolved.visible);
  62570. if (resolved.fullscreen) {
  62571. fullscreenInstance = instance;
  62572. }
  62573. return instance;
  62574. };
  62575. const resolveOptions = (options) => {
  62576. var _a, _b, _c, _d;
  62577. let target;
  62578. if (isString$1(options.target)) {
  62579. target = (_a = document.querySelector(options.target)) != null ? _a : document.body;
  62580. } else {
  62581. target = options.target || document.body;
  62582. }
  62583. return {
  62584. parent: target === document.body || options.body ? document.body : target,
  62585. background: options.background || "",
  62586. svg: options.svg || "",
  62587. svgViewBox: options.svgViewBox || "",
  62588. spinner: options.spinner || false,
  62589. text: options.text || "",
  62590. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  62591. lock: (_c = options.lock) != null ? _c : false,
  62592. customClass: options.customClass || "",
  62593. visible: (_d = options.visible) != null ? _d : true,
  62594. beforeClose: options.beforeClose,
  62595. closed: options.closed,
  62596. target
  62597. };
  62598. };
  62599. const addStyle = async (options, parent, instance) => {
  62600. const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
  62601. const maskStyle = {};
  62602. if (options.fullscreen) {
  62603. instance.originalPosition.value = getStyle(document.body, "position");
  62604. instance.originalOverflow.value = getStyle(document.body, "overflow");
  62605. maskStyle.zIndex = nextZIndex();
  62606. } else if (options.parent === document.body) {
  62607. instance.originalPosition.value = getStyle(document.body, "position");
  62608. await nextTick();
  62609. for (const property of ["top", "left"]) {
  62610. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  62611. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  62612. }
  62613. for (const property of ["height", "width"]) {
  62614. maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  62615. }
  62616. } else {
  62617. instance.originalPosition.value = getStyle(parent, "position");
  62618. }
  62619. for (const [key, value] of Object.entries(maskStyle)) {
  62620. instance.$el.style[key] = value;
  62621. }
  62622. };
  62623. const addClassList = (options, parent, instance) => {
  62624. const ns = instance.vm.ns || instance.vm._.exposed.ns;
  62625. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  62626. addClass(parent, ns.bm("parent", "relative"));
  62627. } else {
  62628. removeClass(parent, ns.bm("parent", "relative"));
  62629. }
  62630. if (options.fullscreen && options.lock) {
  62631. addClass(parent, ns.bm("parent", "hidden"));
  62632. } else {
  62633. removeClass(parent, ns.bm("parent", "hidden"));
  62634. }
  62635. };
  62636. Loading._context = null;
  62637. var Loading$1 = Loading;
  62638. const INSTANCE_KEY = Symbol("ElLoading");
  62639. const getAttributeName = (name) => {
  62640. return `element-loading-${hyphenate(name)}`;
  62641. };
  62642. const createInstance = (el, binding) => {
  62643. var _a, _b, _c, _d;
  62644. const vm = binding.instance;
  62645. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  62646. const resolveExpression = (key) => {
  62647. const data = isString$1(key) && (vm == null ? void 0 : vm[key]) || key;
  62648. return ref(data);
  62649. };
  62650. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(getAttributeName(name)));
  62651. const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen;
  62652. const options = {
  62653. text: getProp("text"),
  62654. svg: getProp("svg"),
  62655. svgViewBox: getProp("svgViewBox"),
  62656. spinner: getProp("spinner"),
  62657. background: getProp("background"),
  62658. customClass: getProp("customClass"),
  62659. fullscreen,
  62660. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  62661. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  62662. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  62663. };
  62664. const instance = Loading$1(options);
  62665. instance._context = vLoading._context;
  62666. el[INSTANCE_KEY] = {
  62667. options,
  62668. instance
  62669. };
  62670. };
  62671. const updateOptions = (originalOptions, newOptions) => {
  62672. for (const key of Object.keys(originalOptions)) {
  62673. if (isRef(originalOptions[key]))
  62674. originalOptions[key].value = newOptions[key];
  62675. }
  62676. };
  62677. const vLoading = {
  62678. mounted(el, binding) {
  62679. if (binding.value) {
  62680. createInstance(el, binding);
  62681. }
  62682. },
  62683. updated(el, binding) {
  62684. const instance = el[INSTANCE_KEY];
  62685. if (!binding.value) {
  62686. instance == null ? void 0 : instance.instance.close();
  62687. el[INSTANCE_KEY] = null;
  62688. return;
  62689. }
  62690. if (!instance)
  62691. createInstance(el, binding);
  62692. else {
  62693. updateOptions(instance.options, isObject$1(binding.value) ? binding.value : {
  62694. text: el.getAttribute(getAttributeName("text")),
  62695. svg: el.getAttribute(getAttributeName("svg")),
  62696. svgViewBox: el.getAttribute(getAttributeName("svgViewBox")),
  62697. spinner: el.getAttribute(getAttributeName("spinner")),
  62698. background: el.getAttribute(getAttributeName("background")),
  62699. customClass: el.getAttribute(getAttributeName("customClass"))
  62700. });
  62701. }
  62702. },
  62703. unmounted(el) {
  62704. var _a;
  62705. (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close();
  62706. el[INSTANCE_KEY] = null;
  62707. }
  62708. };
  62709. vLoading._context = null;
  62710. var vLoading$1 = vLoading;
  62711. const ElLoading = {
  62712. install(app) {
  62713. Loading$1._context = app._context;
  62714. vLoading$1._context = app._context;
  62715. app.directive("loading", vLoading$1);
  62716. app.config.globalProperties.$loading = Loading$1;
  62717. },
  62718. directive: vLoading$1,
  62719. service: Loading$1
  62720. };
  62721. const messageTypes = [
  62722. "primary",
  62723. "success",
  62724. "info",
  62725. "warning",
  62726. "error"
  62727. ];
  62728. const messagePlacement = [
  62729. "top",
  62730. "top-left",
  62731. "top-right",
  62732. "bottom",
  62733. "bottom-left",
  62734. "bottom-right"
  62735. ];
  62736. const MESSAGE_DEFAULT_PLACEMENT = "top";
  62737. const messageDefaults = mutable({
  62738. customClass: "",
  62739. dangerouslyUseHTMLString: false,
  62740. duration: 3e3,
  62741. icon: void 0,
  62742. id: "",
  62743. message: "",
  62744. onClose: void 0,
  62745. showClose: false,
  62746. type: "info",
  62747. plain: false,
  62748. offset: 16,
  62749. placement: void 0,
  62750. zIndex: 0,
  62751. grouping: false,
  62752. repeatNum: 1,
  62753. appendTo: isClient ? document.body : void 0
  62754. });
  62755. const messageProps = buildProps({
  62756. customClass: {
  62757. type: String,
  62758. default: messageDefaults.customClass
  62759. },
  62760. dangerouslyUseHTMLString: {
  62761. type: Boolean,
  62762. default: messageDefaults.dangerouslyUseHTMLString
  62763. },
  62764. duration: {
  62765. type: Number,
  62766. default: messageDefaults.duration
  62767. },
  62768. icon: {
  62769. type: iconPropType,
  62770. default: messageDefaults.icon
  62771. },
  62772. id: {
  62773. type: String,
  62774. default: messageDefaults.id
  62775. },
  62776. message: {
  62777. type: definePropType([
  62778. String,
  62779. Object,
  62780. Function
  62781. ]),
  62782. default: messageDefaults.message
  62783. },
  62784. onClose: {
  62785. type: definePropType(Function),
  62786. default: messageDefaults.onClose
  62787. },
  62788. showClose: {
  62789. type: Boolean,
  62790. default: messageDefaults.showClose
  62791. },
  62792. type: {
  62793. type: String,
  62794. values: messageTypes,
  62795. default: messageDefaults.type
  62796. },
  62797. plain: {
  62798. type: Boolean,
  62799. default: messageDefaults.plain
  62800. },
  62801. offset: {
  62802. type: Number,
  62803. default: messageDefaults.offset
  62804. },
  62805. placement: {
  62806. type: String,
  62807. values: messagePlacement,
  62808. default: messageDefaults.placement
  62809. },
  62810. zIndex: {
  62811. type: Number,
  62812. default: messageDefaults.zIndex
  62813. },
  62814. grouping: {
  62815. type: Boolean,
  62816. default: messageDefaults.grouping
  62817. },
  62818. repeatNum: {
  62819. type: Number,
  62820. default: messageDefaults.repeatNum
  62821. }
  62822. });
  62823. const messageEmits = {
  62824. destroy: () => true
  62825. };
  62826. const placementInstances = shallowReactive({});
  62827. const getOrCreatePlacementInstances = (placement) => {
  62828. if (!placementInstances[placement]) {
  62829. placementInstances[placement] = shallowReactive([]);
  62830. }
  62831. return placementInstances[placement];
  62832. };
  62833. const getInstance = (id, placement) => {
  62834. const instances = placementInstances[placement] || [];
  62835. const idx = instances.findIndex((instance) => instance.id === id);
  62836. const current = instances[idx];
  62837. let prev;
  62838. if (idx > 0) {
  62839. prev = instances[idx - 1];
  62840. }
  62841. return { current, prev };
  62842. };
  62843. const getLastOffset = (id, placement) => {
  62844. const { prev } = getInstance(id, placement);
  62845. if (!prev)
  62846. return 0;
  62847. return prev.vm.exposed.bottom.value;
  62848. };
  62849. const getOffsetOrSpace = (id, offset, placement) => {
  62850. const instances = placementInstances[placement] || [];
  62851. const idx = instances.findIndex((instance) => instance.id === id);
  62852. return idx > 0 ? 16 : offset;
  62853. };
  62854. const __default__$1 = defineComponent({
  62855. name: "ElMessage"
  62856. });
  62857. const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  62858. ...__default__$1,
  62859. props: messageProps,
  62860. emits: messageEmits,
  62861. setup(__props, { expose, emit }) {
  62862. const props = __props;
  62863. const { Close } = TypeComponents;
  62864. const isStartTransition = ref(false);
  62865. const { ns, zIndex } = useGlobalComponentSettings("message");
  62866. const { currentZIndex, nextZIndex } = zIndex;
  62867. const messageRef = ref();
  62868. const visible = ref(false);
  62869. const height = ref(0);
  62870. let stopTimer = void 0;
  62871. const badgeType = computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  62872. const typeClass = computed(() => {
  62873. const type = props.type;
  62874. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  62875. });
  62876. const iconComponent = computed(() => props.icon || TypeComponentsMap[props.type] || "");
  62877. const placement = computed(() => props.placement || MESSAGE_DEFAULT_PLACEMENT);
  62878. const lastOffset = computed(() => getLastOffset(props.id, placement.value));
  62879. const offset = computed(() => {
  62880. return getOffsetOrSpace(props.id, props.offset, placement.value) + lastOffset.value;
  62881. });
  62882. const bottom = computed(() => height.value + offset.value);
  62883. const horizontalClass = computed(() => {
  62884. if (placement.value.includes("left"))
  62885. return ns.is("left");
  62886. if (placement.value.includes("right"))
  62887. return ns.is("right");
  62888. return ns.is("center");
  62889. });
  62890. const verticalProperty = computed(() => placement.value.startsWith("top") ? "top" : "bottom");
  62891. const customStyle = computed(() => ({
  62892. [verticalProperty.value]: `${offset.value}px`,
  62893. zIndex: currentZIndex.value
  62894. }));
  62895. function startTimer() {
  62896. if (props.duration === 0)
  62897. return;
  62898. ({ stop: stopTimer } = useTimeoutFn(() => {
  62899. close();
  62900. }, props.duration));
  62901. }
  62902. function clearTimer() {
  62903. stopTimer == null ? void 0 : stopTimer();
  62904. }
  62905. function close() {
  62906. visible.value = false;
  62907. nextTick(() => {
  62908. var _a;
  62909. if (!isStartTransition.value) {
  62910. (_a = props.onClose) == null ? void 0 : _a.call(props);
  62911. emit("destroy");
  62912. }
  62913. });
  62914. }
  62915. function keydown(event) {
  62916. const code = getEventCode(event);
  62917. if (code === EVENT_CODE.esc) {
  62918. close();
  62919. }
  62920. }
  62921. onMounted(() => {
  62922. startTimer();
  62923. nextZIndex();
  62924. visible.value = true;
  62925. });
  62926. watch(() => props.repeatNum, () => {
  62927. clearTimer();
  62928. startTimer();
  62929. });
  62930. useEventListener(document, "keydown", keydown);
  62931. useResizeObserver(messageRef, () => {
  62932. height.value = messageRef.value.getBoundingClientRect().height;
  62933. });
  62934. expose({
  62935. visible,
  62936. bottom,
  62937. close
  62938. });
  62939. return (_ctx, _cache) => {
  62940. return openBlock(), createBlock(Transition, {
  62941. name: unref(ns).b("fade"),
  62942. onBeforeEnter: ($event) => isStartTransition.value = true,
  62943. onBeforeLeave: _ctx.onClose,
  62944. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  62945. persisted: ""
  62946. }, {
  62947. default: withCtx(() => [
  62948. withDirectives(createElementVNode("div", {
  62949. id: _ctx.id,
  62950. ref_key: "messageRef",
  62951. ref: messageRef,
  62952. class: normalizeClass([
  62953. unref(ns).b(),
  62954. { [unref(ns).m(_ctx.type)]: _ctx.type },
  62955. unref(ns).is("closable", _ctx.showClose),
  62956. unref(ns).is("plain", _ctx.plain),
  62957. unref(ns).is("bottom", unref(verticalProperty) === "bottom"),
  62958. unref(horizontalClass),
  62959. _ctx.customClass
  62960. ]),
  62961. style: normalizeStyle(unref(customStyle)),
  62962. role: "alert",
  62963. onMouseenter: clearTimer,
  62964. onMouseleave: startTimer
  62965. }, [
  62966. _ctx.repeatNum > 1 ? (openBlock(), createBlock(unref(ElBadge), {
  62967. key: 0,
  62968. value: _ctx.repeatNum,
  62969. type: unref(badgeType),
  62970. class: normalizeClass(unref(ns).e("badge"))
  62971. }, null, 8, ["value", "type", "class"])) : createCommentVNode("v-if", true),
  62972. unref(iconComponent) ? (openBlock(), createBlock(unref(ElIcon), {
  62973. key: 1,
  62974. class: normalizeClass([unref(ns).e("icon"), unref(typeClass)])
  62975. }, {
  62976. default: withCtx(() => [
  62977. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  62978. ]),
  62979. _: 1
  62980. }, 8, ["class"])) : createCommentVNode("v-if", true),
  62981. renderSlot(_ctx.$slots, "default", {}, () => [
  62982. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", {
  62983. key: 0,
  62984. class: normalizeClass(unref(ns).e("content"))
  62985. }, toDisplayString(_ctx.message), 3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  62986. createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  62987. createElementVNode("p", {
  62988. class: normalizeClass(unref(ns).e("content")),
  62989. innerHTML: _ctx.message
  62990. }, null, 10, ["innerHTML"])
  62991. ], 2112))
  62992. ]),
  62993. _ctx.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  62994. key: 2,
  62995. class: normalizeClass(unref(ns).e("closeBtn")),
  62996. onClick: withModifiers(close, ["stop"])
  62997. }, {
  62998. default: withCtx(() => [
  62999. createVNode(unref(Close))
  63000. ]),
  63001. _: 1
  63002. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  63003. ], 46, ["id"]), [
  63004. [vShow, visible.value]
  63005. ])
  63006. ]),
  63007. _: 3
  63008. }, 8, ["name", "onBeforeEnter", "onBeforeLeave", "onAfterLeave"]);
  63009. };
  63010. }
  63011. });
  63012. var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
  63013. let seed$1 = 1;
  63014. const normalizeAppendTo = (normalized) => {
  63015. const appendTo = normalized.appendTo;
  63016. if (!appendTo) {
  63017. normalized.appendTo = document.body;
  63018. } else if (isString$1(normalized.appendTo)) {
  63019. let appendTo2 = document.querySelector(normalized.appendTo);
  63020. if (!isElement$2(appendTo2)) {
  63021. debugWarn("ElMessage", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  63022. appendTo2 = document.body;
  63023. }
  63024. normalized.appendTo = appendTo2;
  63025. }
  63026. };
  63027. const normalizePlacement = (normalized) => {
  63028. if (!normalized.placement && isString$1(messageConfig.placement) && messageConfig.placement) {
  63029. normalized.placement = messageConfig.placement;
  63030. }
  63031. if (!normalized.placement) {
  63032. normalized.placement = MESSAGE_DEFAULT_PLACEMENT;
  63033. }
  63034. if (!messagePlacement.includes(normalized.placement)) {
  63035. debugWarn("ElMessage", `Invalid placement: ${normalized.placement}. Falling back to '${MESSAGE_DEFAULT_PLACEMENT}'.`);
  63036. normalized.placement = MESSAGE_DEFAULT_PLACEMENT;
  63037. }
  63038. };
  63039. const normalizeOptions = (params) => {
  63040. const options = !params || isString$1(params) || isVNode(params) || isFunction$1(params) ? { message: params } : params;
  63041. const normalized = {
  63042. ...messageDefaults,
  63043. ...options
  63044. };
  63045. normalizeAppendTo(normalized);
  63046. normalizePlacement(normalized);
  63047. if (isBoolean(messageConfig.grouping) && !normalized.grouping) {
  63048. normalized.grouping = messageConfig.grouping;
  63049. }
  63050. if (isNumber(messageConfig.duration) && normalized.duration === 3e3) {
  63051. normalized.duration = messageConfig.duration;
  63052. }
  63053. if (isNumber(messageConfig.offset) && normalized.offset === 16) {
  63054. normalized.offset = messageConfig.offset;
  63055. }
  63056. if (isBoolean(messageConfig.showClose) && !normalized.showClose) {
  63057. normalized.showClose = messageConfig.showClose;
  63058. }
  63059. if (isBoolean(messageConfig.plain) && !normalized.plain) {
  63060. normalized.plain = messageConfig.plain;
  63061. }
  63062. return normalized;
  63063. };
  63064. const closeMessage = (instance) => {
  63065. const placement = instance.props.placement || MESSAGE_DEFAULT_PLACEMENT;
  63066. const instances = placementInstances[placement];
  63067. const idx = instances.indexOf(instance);
  63068. if (idx === -1)
  63069. return;
  63070. instances.splice(idx, 1);
  63071. const { handler } = instance;
  63072. handler.close();
  63073. };
  63074. const createMessage = ({ appendTo, ...options }, context) => {
  63075. const id = `message_${seed$1++}`;
  63076. const userOnClose = options.onClose;
  63077. const container = document.createElement("div");
  63078. const props = {
  63079. ...options,
  63080. id,
  63081. onClose: () => {
  63082. userOnClose == null ? void 0 : userOnClose();
  63083. closeMessage(instance);
  63084. },
  63085. onDestroy: () => {
  63086. render(null, container);
  63087. }
  63088. };
  63089. const vnode = createVNode(MessageConstructor, props, isFunction$1(props.message) || isVNode(props.message) ? {
  63090. default: isFunction$1(props.message) ? props.message : () => props.message
  63091. } : null);
  63092. vnode.appContext = context || message._context;
  63093. render(vnode, container);
  63094. appendTo.appendChild(container.firstElementChild);
  63095. const vm = vnode.component;
  63096. const handler = {
  63097. close: () => {
  63098. vm.exposed.close();
  63099. }
  63100. };
  63101. const instance = {
  63102. id,
  63103. vnode,
  63104. vm,
  63105. handler,
  63106. props: vnode.component.props
  63107. };
  63108. return instance;
  63109. };
  63110. const message = (options = {}, context) => {
  63111. if (!isClient)
  63112. return { close: () => void 0 };
  63113. const normalized = normalizeOptions(options);
  63114. const instances = getOrCreatePlacementInstances(normalized.placement || MESSAGE_DEFAULT_PLACEMENT);
  63115. if (normalized.grouping && instances.length) {
  63116. const instance2 = instances.find(({ vnode: vm }) => {
  63117. var _a;
  63118. return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message;
  63119. });
  63120. if (instance2) {
  63121. instance2.props.repeatNum += 1;
  63122. instance2.props.type = normalized.type;
  63123. return instance2.handler;
  63124. }
  63125. }
  63126. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  63127. return { close: () => void 0 };
  63128. }
  63129. const instance = createMessage(normalized, context);
  63130. instances.push(instance);
  63131. return instance.handler;
  63132. };
  63133. messageTypes.forEach((type) => {
  63134. message[type] = (options = {}, appContext) => {
  63135. const normalized = normalizeOptions(options);
  63136. return message({ ...normalized, type }, appContext);
  63137. };
  63138. });
  63139. function closeAll$1(type) {
  63140. for (const placement in placementInstances) {
  63141. if (hasOwn(placementInstances, placement)) {
  63142. const instances = [...placementInstances[placement]];
  63143. for (const instance of instances) {
  63144. if (!type || type === instance.props.type) {
  63145. instance.handler.close();
  63146. }
  63147. }
  63148. }
  63149. }
  63150. }
  63151. function closeAllByPlacement(placement) {
  63152. if (!placementInstances[placement])
  63153. return;
  63154. const instances = [...placementInstances[placement]];
  63155. instances.forEach((instance) => instance.handler.close());
  63156. }
  63157. message.closeAll = closeAll$1;
  63158. message.closeAllByPlacement = closeAllByPlacement;
  63159. message._context = null;
  63160. var Message = message;
  63161. const ElMessage = withInstallFunction(Message, "$message");
  63162. const _sfc_main$1 = defineComponent({
  63163. name: "ElMessageBox",
  63164. directives: {
  63165. TrapFocus
  63166. },
  63167. components: {
  63168. ElButton,
  63169. ElFocusTrap,
  63170. ElInput,
  63171. ElOverlay,
  63172. ElIcon,
  63173. ...TypeComponents
  63174. },
  63175. inheritAttrs: false,
  63176. props: {
  63177. buttonSize: {
  63178. type: String,
  63179. validator: isValidComponentSize
  63180. },
  63181. modal: {
  63182. type: Boolean,
  63183. default: true
  63184. },
  63185. lockScroll: {
  63186. type: Boolean,
  63187. default: true
  63188. },
  63189. showClose: {
  63190. type: Boolean,
  63191. default: true
  63192. },
  63193. closeOnClickModal: {
  63194. type: Boolean,
  63195. default: true
  63196. },
  63197. closeOnPressEscape: {
  63198. type: Boolean,
  63199. default: true
  63200. },
  63201. closeOnHashChange: {
  63202. type: Boolean,
  63203. default: true
  63204. },
  63205. center: Boolean,
  63206. draggable: Boolean,
  63207. overflow: Boolean,
  63208. roundButton: Boolean,
  63209. container: {
  63210. type: String,
  63211. default: "body"
  63212. },
  63213. boxType: {
  63214. type: String,
  63215. default: ""
  63216. }
  63217. },
  63218. emits: ["vanish", "action"],
  63219. setup(props, { emit }) {
  63220. const {
  63221. locale,
  63222. zIndex,
  63223. ns,
  63224. size: btnSize
  63225. } = useGlobalComponentSettings("message-box", computed(() => props.buttonSize));
  63226. const { t } = locale;
  63227. const { nextZIndex } = zIndex;
  63228. const visible = ref(false);
  63229. const state = reactive({
  63230. autofocus: true,
  63231. beforeClose: null,
  63232. callback: null,
  63233. cancelButtonText: "",
  63234. cancelButtonClass: "",
  63235. confirmButtonText: "",
  63236. confirmButtonClass: "",
  63237. customClass: "",
  63238. customStyle: {},
  63239. dangerouslyUseHTMLString: false,
  63240. distinguishCancelAndClose: false,
  63241. icon: "",
  63242. closeIcon: "",
  63243. inputPattern: null,
  63244. inputPlaceholder: "",
  63245. inputType: "text",
  63246. inputValue: "",
  63247. inputValidator: void 0,
  63248. inputErrorMessage: "",
  63249. message: "",
  63250. modalFade: true,
  63251. modalClass: "",
  63252. showCancelButton: false,
  63253. showConfirmButton: true,
  63254. type: "",
  63255. title: void 0,
  63256. showInput: false,
  63257. action: "",
  63258. confirmButtonLoading: false,
  63259. cancelButtonLoading: false,
  63260. confirmButtonLoadingIcon: markRaw(loading_default),
  63261. cancelButtonLoadingIcon: markRaw(loading_default),
  63262. confirmButtonDisabled: false,
  63263. editorErrorMessage: "",
  63264. validateError: false,
  63265. zIndex: nextZIndex()
  63266. });
  63267. const typeClass = computed(() => {
  63268. const type = state.type;
  63269. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  63270. });
  63271. const contentId = useId();
  63272. const inputId = useId();
  63273. const iconComponent = computed(() => {
  63274. const type = state.type;
  63275. return state.icon || type && TypeComponentsMap[type] || "";
  63276. });
  63277. const hasMessage = computed(() => !!state.message);
  63278. const rootRef = ref();
  63279. const headerRef = ref();
  63280. const focusStartRef = ref();
  63281. const inputRef = ref();
  63282. const confirmRef = ref();
  63283. const confirmButtonClasses = computed(() => state.confirmButtonClass);
  63284. watch(() => state.inputValue, async (val) => {
  63285. await nextTick();
  63286. if (props.boxType === "prompt" && val) {
  63287. validate();
  63288. }
  63289. }, { immediate: true });
  63290. watch(() => visible.value, (val) => {
  63291. var _a, _b;
  63292. if (val) {
  63293. if (props.boxType !== "prompt") {
  63294. if (state.autofocus) {
  63295. focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
  63296. } else {
  63297. focusStartRef.value = rootRef.value;
  63298. }
  63299. }
  63300. state.zIndex = nextZIndex();
  63301. }
  63302. if (props.boxType !== "prompt")
  63303. return;
  63304. if (val) {
  63305. nextTick().then(() => {
  63306. var _a2;
  63307. if (inputRef.value && inputRef.value.$el) {
  63308. if (state.autofocus) {
  63309. focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
  63310. } else {
  63311. focusStartRef.value = rootRef.value;
  63312. }
  63313. }
  63314. });
  63315. } else {
  63316. state.editorErrorMessage = "";
  63317. state.validateError = false;
  63318. }
  63319. });
  63320. const draggable = computed(() => props.draggable);
  63321. const overflow = computed(() => props.overflow);
  63322. const { isDragging } = useDraggable(rootRef, headerRef, draggable, overflow);
  63323. onMounted(async () => {
  63324. await nextTick();
  63325. if (props.closeOnHashChange) {
  63326. window.addEventListener("hashchange", doClose);
  63327. }
  63328. });
  63329. onBeforeUnmount(() => {
  63330. if (props.closeOnHashChange) {
  63331. window.removeEventListener("hashchange", doClose);
  63332. }
  63333. });
  63334. function doClose() {
  63335. if (!visible.value)
  63336. return;
  63337. visible.value = false;
  63338. nextTick(() => {
  63339. if (state.action)
  63340. emit("action", state.action);
  63341. });
  63342. }
  63343. const handleWrapperClick = () => {
  63344. if (props.closeOnClickModal) {
  63345. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  63346. }
  63347. };
  63348. const overlayEvent = useSameTarget(handleWrapperClick);
  63349. const handleInputEnter = (e) => {
  63350. if (state.inputType !== "textarea") {
  63351. e.preventDefault();
  63352. return handleAction("confirm");
  63353. }
  63354. };
  63355. const handleAction = (action) => {
  63356. var _a;
  63357. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  63358. return;
  63359. }
  63360. state.action = action;
  63361. if (state.beforeClose) {
  63362. (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose);
  63363. } else {
  63364. doClose();
  63365. }
  63366. };
  63367. const validate = () => {
  63368. if (props.boxType === "prompt") {
  63369. const inputPattern = state.inputPattern;
  63370. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  63371. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  63372. state.validateError = true;
  63373. return false;
  63374. }
  63375. const inputValidator = state.inputValidator;
  63376. if (isFunction$1(inputValidator)) {
  63377. const validateResult = inputValidator(state.inputValue);
  63378. if (validateResult === false) {
  63379. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  63380. state.validateError = true;
  63381. return false;
  63382. }
  63383. if (isString$1(validateResult)) {
  63384. state.editorErrorMessage = validateResult;
  63385. state.validateError = true;
  63386. return false;
  63387. }
  63388. }
  63389. }
  63390. state.editorErrorMessage = "";
  63391. state.validateError = false;
  63392. return true;
  63393. };
  63394. const getInputElement = () => {
  63395. var _a, _b;
  63396. const inputRefs = (_a = inputRef.value) == null ? void 0 : _a.$refs;
  63397. return (_b = inputRefs == null ? void 0 : inputRefs.input) != null ? _b : inputRefs == null ? void 0 : inputRefs.textarea;
  63398. };
  63399. const handleClose = () => {
  63400. handleAction("close");
  63401. };
  63402. const onCloseRequested = () => {
  63403. if (props.closeOnPressEscape) {
  63404. handleClose();
  63405. }
  63406. };
  63407. if (props.lockScroll) {
  63408. useLockscreen(visible, { ns });
  63409. }
  63410. return {
  63411. ...toRefs(state),
  63412. ns,
  63413. overlayEvent,
  63414. visible,
  63415. hasMessage,
  63416. typeClass,
  63417. contentId,
  63418. inputId,
  63419. btnSize,
  63420. iconComponent,
  63421. confirmButtonClasses,
  63422. rootRef,
  63423. focusStartRef,
  63424. headerRef,
  63425. inputRef,
  63426. isDragging,
  63427. confirmRef,
  63428. doClose,
  63429. handleClose,
  63430. onCloseRequested,
  63431. handleWrapperClick,
  63432. handleInputEnter,
  63433. handleAction,
  63434. t
  63435. };
  63436. }
  63437. });
  63438. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  63439. const _component_el_icon = resolveComponent("el-icon");
  63440. const _component_el_input = resolveComponent("el-input");
  63441. const _component_el_button = resolveComponent("el-button");
  63442. const _component_el_focus_trap = resolveComponent("el-focus-trap");
  63443. const _component_el_overlay = resolveComponent("el-overlay");
  63444. return openBlock(), createBlock(Transition, {
  63445. name: "fade-in-linear",
  63446. onAfterLeave: ($event) => _ctx.$emit("vanish"),
  63447. persisted: ""
  63448. }, {
  63449. default: withCtx(() => [
  63450. withDirectives(createVNode(_component_el_overlay, {
  63451. "z-index": _ctx.zIndex,
  63452. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  63453. mask: _ctx.modal
  63454. }, {
  63455. default: withCtx(() => [
  63456. createElementVNode("div", {
  63457. role: "dialog",
  63458. "aria-label": _ctx.title,
  63459. "aria-modal": "true",
  63460. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  63461. class: normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  63462. onClick: _ctx.overlayEvent.onClick,
  63463. onMousedown: _ctx.overlayEvent.onMousedown,
  63464. onMouseup: _ctx.overlayEvent.onMouseup
  63465. }, [
  63466. createVNode(_component_el_focus_trap, {
  63467. loop: "",
  63468. trapped: _ctx.visible,
  63469. "focus-trap-el": _ctx.rootRef,
  63470. "focus-start-el": _ctx.focusStartRef,
  63471. onReleaseRequested: _ctx.onCloseRequested
  63472. }, {
  63473. default: withCtx(() => [
  63474. createElementVNode("div", {
  63475. ref: "rootRef",
  63476. class: normalizeClass([
  63477. _ctx.ns.b(),
  63478. _ctx.customClass,
  63479. _ctx.ns.is("draggable", _ctx.draggable),
  63480. _ctx.ns.is("dragging", _ctx.isDragging),
  63481. { [_ctx.ns.m("center")]: _ctx.center }
  63482. ]),
  63483. style: normalizeStyle(_ctx.customStyle),
  63484. tabindex: "-1",
  63485. onClick: withModifiers(() => {
  63486. }, ["stop"])
  63487. }, [
  63488. _ctx.title !== null && _ctx.title !== void 0 ? (openBlock(), createElementBlock("div", {
  63489. key: 0,
  63490. ref: "headerRef",
  63491. class: normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
  63492. }, [
  63493. createElementVNode("div", {
  63494. class: normalizeClass(_ctx.ns.e("title"))
  63495. }, [
  63496. _ctx.iconComponent && _ctx.center ? (openBlock(), createBlock(_component_el_icon, {
  63497. key: 0,
  63498. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  63499. }, {
  63500. default: withCtx(() => [
  63501. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  63502. ]),
  63503. _: 1
  63504. }, 8, ["class"])) : createCommentVNode("v-if", true),
  63505. createElementVNode("span", null, toDisplayString(_ctx.title), 1)
  63506. ], 2),
  63507. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  63508. key: 0,
  63509. type: "button",
  63510. class: normalizeClass(_ctx.ns.e("headerbtn")),
  63511. "aria-label": _ctx.t("el.messagebox.close"),
  63512. onClick: ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"),
  63513. onKeydown: withKeys(withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"])
  63514. }, [
  63515. createVNode(_component_el_icon, {
  63516. class: normalizeClass(_ctx.ns.e("close"))
  63517. }, {
  63518. default: withCtx(() => [
  63519. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || "close")))
  63520. ]),
  63521. _: 1
  63522. }, 8, ["class"])
  63523. ], 42, ["aria-label", "onClick", "onKeydown"])) : createCommentVNode("v-if", true)
  63524. ], 2)) : createCommentVNode("v-if", true),
  63525. createElementVNode("div", {
  63526. id: _ctx.contentId,
  63527. class: normalizeClass(_ctx.ns.e("content"))
  63528. }, [
  63529. createElementVNode("div", {
  63530. class: normalizeClass(_ctx.ns.e("container"))
  63531. }, [
  63532. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (openBlock(), createBlock(_component_el_icon, {
  63533. key: 0,
  63534. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  63535. }, {
  63536. default: withCtx(() => [
  63537. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  63538. ]),
  63539. _: 1
  63540. }, 8, ["class"])) : createCommentVNode("v-if", true),
  63541. _ctx.hasMessage ? (openBlock(), createElementBlock("div", {
  63542. key: 1,
  63543. class: normalizeClass(_ctx.ns.e("message"))
  63544. }, [
  63545. renderSlot(_ctx.$slots, "default", {}, () => [
  63546. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  63547. key: 0,
  63548. for: _ctx.showInput ? _ctx.inputId : void 0,
  63549. textContent: toDisplayString(_ctx.message)
  63550. }, null, 8, ["for", "textContent"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  63551. key: 1,
  63552. for: _ctx.showInput ? _ctx.inputId : void 0,
  63553. innerHTML: _ctx.message
  63554. }, null, 8, ["for", "innerHTML"]))
  63555. ])
  63556. ], 2)) : createCommentVNode("v-if", true)
  63557. ], 2),
  63558. withDirectives(createElementVNode("div", {
  63559. class: normalizeClass(_ctx.ns.e("input"))
  63560. }, [
  63561. createVNode(_component_el_input, {
  63562. id: _ctx.inputId,
  63563. ref: "inputRef",
  63564. modelValue: _ctx.inputValue,
  63565. "onUpdate:modelValue": ($event) => _ctx.inputValue = $event,
  63566. type: _ctx.inputType,
  63567. placeholder: _ctx.inputPlaceholder,
  63568. "aria-invalid": _ctx.validateError,
  63569. class: normalizeClass({ invalid: _ctx.validateError }),
  63570. onKeydown: withKeys(_ctx.handleInputEnter, ["enter"])
  63571. }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  63572. createElementVNode("div", {
  63573. class: normalizeClass(_ctx.ns.e("errormsg")),
  63574. style: normalizeStyle({
  63575. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  63576. })
  63577. }, toDisplayString(_ctx.editorErrorMessage), 7)
  63578. ], 2), [
  63579. [vShow, _ctx.showInput]
  63580. ])
  63581. ], 10, ["id"]),
  63582. createElementVNode("div", {
  63583. class: normalizeClass(_ctx.ns.e("btns"))
  63584. }, [
  63585. _ctx.showCancelButton ? (openBlock(), createBlock(_component_el_button, {
  63586. key: 0,
  63587. loading: _ctx.cancelButtonLoading,
  63588. "loading-icon": _ctx.cancelButtonLoadingIcon,
  63589. class: normalizeClass([_ctx.cancelButtonClass]),
  63590. round: _ctx.roundButton,
  63591. size: _ctx.btnSize,
  63592. onClick: ($event) => _ctx.handleAction("cancel"),
  63593. onKeydown: withKeys(withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"])
  63594. }, {
  63595. default: withCtx(() => [
  63596. createTextVNode(toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  63597. ]),
  63598. _: 1
  63599. }, 8, ["loading", "loading-icon", "class", "round", "size", "onClick", "onKeydown"])) : createCommentVNode("v-if", true),
  63600. withDirectives(createVNode(_component_el_button, {
  63601. ref: "confirmRef",
  63602. type: "primary",
  63603. loading: _ctx.confirmButtonLoading,
  63604. "loading-icon": _ctx.confirmButtonLoadingIcon,
  63605. class: normalizeClass([_ctx.confirmButtonClasses]),
  63606. round: _ctx.roundButton,
  63607. disabled: _ctx.confirmButtonDisabled,
  63608. size: _ctx.btnSize,
  63609. onClick: ($event) => _ctx.handleAction("confirm"),
  63610. onKeydown: withKeys(withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"])
  63611. }, {
  63612. default: withCtx(() => [
  63613. createTextVNode(toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  63614. ]),
  63615. _: 1
  63616. }, 8, ["loading", "loading-icon", "class", "round", "disabled", "size", "onClick", "onKeydown"]), [
  63617. [vShow, _ctx.showConfirmButton]
  63618. ])
  63619. ], 2)
  63620. ], 14, ["onClick"])
  63621. ]),
  63622. _: 3
  63623. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  63624. ], 42, ["aria-label", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  63625. ]),
  63626. _: 3
  63627. }, 8, ["z-index", "overlay-class", "mask"]), [
  63628. [vShow, _ctx.visible]
  63629. ])
  63630. ]),
  63631. _: 3
  63632. }, 8, ["onAfterLeave"]);
  63633. }
  63634. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]);
  63635. const messageInstance = /* @__PURE__ */ new Map();
  63636. const getAppendToElement = (props) => {
  63637. let appendTo = document.body;
  63638. if (props.appendTo) {
  63639. if (isString$1(props.appendTo)) {
  63640. appendTo = document.querySelector(props.appendTo);
  63641. }
  63642. if (isElement$2(props.appendTo)) {
  63643. appendTo = props.appendTo;
  63644. }
  63645. if (!isElement$2(appendTo)) {
  63646. debugWarn("ElMessageBox", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  63647. appendTo = document.body;
  63648. }
  63649. }
  63650. return appendTo;
  63651. };
  63652. const initInstance = (props, container, appContext = null) => {
  63653. const vnode = createVNode(MessageBoxConstructor, props, isFunction$1(props.message) || isVNode(props.message) ? {
  63654. default: isFunction$1(props.message) ? props.message : () => props.message
  63655. } : null);
  63656. vnode.appContext = appContext;
  63657. render(vnode, container);
  63658. getAppendToElement(props).appendChild(container.firstElementChild);
  63659. return vnode.component;
  63660. };
  63661. const genContainer = () => {
  63662. return document.createElement("div");
  63663. };
  63664. const showMessage = (options, appContext) => {
  63665. const container = genContainer();
  63666. options.onVanish = () => {
  63667. render(null, container);
  63668. messageInstance.delete(vm);
  63669. };
  63670. options.onAction = (action) => {
  63671. const currentMsg = messageInstance.get(vm);
  63672. let resolve;
  63673. if (options.showInput) {
  63674. resolve = { value: vm.inputValue, action };
  63675. } else {
  63676. resolve = action;
  63677. }
  63678. if (options.callback) {
  63679. options.callback(resolve, instance.proxy);
  63680. } else {
  63681. if (action === "cancel" || action === "close") {
  63682. if (options.distinguishCancelAndClose && action !== "cancel") {
  63683. currentMsg.reject("close");
  63684. } else {
  63685. currentMsg.reject("cancel");
  63686. }
  63687. } else {
  63688. currentMsg.resolve(resolve);
  63689. }
  63690. }
  63691. };
  63692. const instance = initInstance(options, container, appContext);
  63693. const vm = instance.proxy;
  63694. for (const prop in options) {
  63695. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  63696. if (prop === "closeIcon" && isObject$1(options[prop])) {
  63697. vm[prop] = markRaw(options[prop]);
  63698. } else {
  63699. vm[prop] = options[prop];
  63700. }
  63701. }
  63702. }
  63703. vm.visible = true;
  63704. return vm;
  63705. };
  63706. function MessageBox(options, appContext = null) {
  63707. if (!isClient)
  63708. return Promise.reject();
  63709. let callback;
  63710. if (isString$1(options) || isVNode(options)) {
  63711. options = {
  63712. message: options
  63713. };
  63714. } else {
  63715. callback = options.callback;
  63716. }
  63717. return new Promise((resolve, reject) => {
  63718. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  63719. messageInstance.set(vm, {
  63720. options,
  63721. callback,
  63722. resolve,
  63723. reject
  63724. });
  63725. });
  63726. }
  63727. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  63728. const MESSAGE_BOX_DEFAULT_OPTS = {
  63729. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  63730. confirm: { showCancelButton: true },
  63731. prompt: { showCancelButton: true, showInput: true }
  63732. };
  63733. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  63734. MessageBox[boxType] = messageBoxFactory(boxType);
  63735. });
  63736. function messageBoxFactory(boxType) {
  63737. return (message, title, options, appContext) => {
  63738. let titleOrOpts = "";
  63739. if (isObject$1(title)) {
  63740. options = title;
  63741. titleOrOpts = "";
  63742. } else if (isUndefined(title)) {
  63743. titleOrOpts = "";
  63744. } else {
  63745. titleOrOpts = title;
  63746. }
  63747. return MessageBox(Object.assign({
  63748. title: titleOrOpts,
  63749. message,
  63750. type: "",
  63751. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  63752. }, options, {
  63753. boxType
  63754. }), appContext);
  63755. };
  63756. }
  63757. MessageBox.close = () => {
  63758. messageInstance.forEach((_, vm) => {
  63759. vm.doClose();
  63760. });
  63761. messageInstance.clear();
  63762. };
  63763. MessageBox._context = null;
  63764. const _MessageBox = MessageBox;
  63765. _MessageBox.install = (app) => {
  63766. _MessageBox._context = app._context;
  63767. app.config.globalProperties.$msgbox = _MessageBox;
  63768. app.config.globalProperties.$messageBox = _MessageBox;
  63769. app.config.globalProperties.$alert = _MessageBox.alert;
  63770. app.config.globalProperties.$confirm = _MessageBox.confirm;
  63771. app.config.globalProperties.$prompt = _MessageBox.prompt;
  63772. };
  63773. const ElMessageBox = _MessageBox;
  63774. const notificationTypes = [
  63775. "primary",
  63776. "success",
  63777. "info",
  63778. "warning",
  63779. "error"
  63780. ];
  63781. const notificationProps = buildProps({
  63782. customClass: {
  63783. type: String,
  63784. default: ""
  63785. },
  63786. dangerouslyUseHTMLString: Boolean,
  63787. duration: {
  63788. type: Number,
  63789. default: 4500
  63790. },
  63791. icon: {
  63792. type: iconPropType
  63793. },
  63794. id: {
  63795. type: String,
  63796. default: ""
  63797. },
  63798. message: {
  63799. type: definePropType([
  63800. String,
  63801. Object,
  63802. Function
  63803. ]),
  63804. default: ""
  63805. },
  63806. offset: {
  63807. type: Number,
  63808. default: 0
  63809. },
  63810. onClick: {
  63811. type: definePropType(Function),
  63812. default: () => void 0
  63813. },
  63814. onClose: {
  63815. type: definePropType(Function),
  63816. required: true
  63817. },
  63818. position: {
  63819. type: String,
  63820. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  63821. default: "top-right"
  63822. },
  63823. showClose: {
  63824. type: Boolean,
  63825. default: true
  63826. },
  63827. title: {
  63828. type: String,
  63829. default: ""
  63830. },
  63831. type: {
  63832. type: String,
  63833. values: [...notificationTypes, ""],
  63834. default: ""
  63835. },
  63836. zIndex: Number,
  63837. closeIcon: {
  63838. type: iconPropType,
  63839. default: close_default
  63840. }
  63841. });
  63842. const notificationEmits = {
  63843. destroy: () => true
  63844. };
  63845. const __default__ = defineComponent({
  63846. name: "ElNotification"
  63847. });
  63848. const _sfc_main = /* @__PURE__ */ defineComponent({
  63849. ...__default__,
  63850. props: notificationProps,
  63851. emits: notificationEmits,
  63852. setup(__props, { expose }) {
  63853. const props = __props;
  63854. const { ns, zIndex } = useGlobalComponentSettings("notification");
  63855. const { nextZIndex, currentZIndex } = zIndex;
  63856. const visible = ref(false);
  63857. let timer = void 0;
  63858. const typeClass = computed(() => {
  63859. const type = props.type;
  63860. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  63861. });
  63862. const iconComponent = computed(() => {
  63863. if (!props.type)
  63864. return props.icon;
  63865. return TypeComponentsMap[props.type] || props.icon;
  63866. });
  63867. const horizontalClass = computed(() => props.position.endsWith("right") ? "right" : "left");
  63868. const verticalProperty = computed(() => props.position.startsWith("top") ? "top" : "bottom");
  63869. const positionStyle = computed(() => {
  63870. var _a;
  63871. return {
  63872. [verticalProperty.value]: `${props.offset}px`,
  63873. zIndex: (_a = props.zIndex) != null ? _a : currentZIndex.value
  63874. };
  63875. });
  63876. function startTimer() {
  63877. if (props.duration > 0) {
  63878. ({ stop: timer } = useTimeoutFn(() => {
  63879. if (visible.value)
  63880. close();
  63881. }, props.duration));
  63882. }
  63883. }
  63884. function clearTimer() {
  63885. timer == null ? void 0 : timer();
  63886. }
  63887. function close() {
  63888. visible.value = false;
  63889. }
  63890. function onKeydown(event) {
  63891. const code = getEventCode(event);
  63892. switch (code) {
  63893. case EVENT_CODE.delete:
  63894. case EVENT_CODE.backspace:
  63895. clearTimer();
  63896. break;
  63897. case EVENT_CODE.esc:
  63898. if (visible.value) {
  63899. close();
  63900. }
  63901. break;
  63902. default:
  63903. startTimer();
  63904. break;
  63905. }
  63906. }
  63907. onMounted(() => {
  63908. startTimer();
  63909. nextZIndex();
  63910. visible.value = true;
  63911. });
  63912. useEventListener(document, "keydown", onKeydown);
  63913. expose({
  63914. visible,
  63915. close
  63916. });
  63917. return (_ctx, _cache) => {
  63918. return openBlock(), createBlock(Transition, {
  63919. name: unref(ns).b("fade"),
  63920. onBeforeLeave: _ctx.onClose,
  63921. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  63922. persisted: ""
  63923. }, {
  63924. default: withCtx(() => [
  63925. withDirectives(createElementVNode("div", {
  63926. id: _ctx.id,
  63927. class: normalizeClass([unref(ns).b(), _ctx.customClass, unref(horizontalClass)]),
  63928. style: normalizeStyle(unref(positionStyle)),
  63929. role: "alert",
  63930. onMouseenter: clearTimer,
  63931. onMouseleave: startTimer,
  63932. onClick: _ctx.onClick
  63933. }, [
  63934. unref(iconComponent) ? (openBlock(), createBlock(unref(ElIcon), {
  63935. key: 0,
  63936. class: normalizeClass([unref(ns).e("icon"), unref(typeClass)])
  63937. }, {
  63938. default: withCtx(() => [
  63939. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  63940. ]),
  63941. _: 1
  63942. }, 8, ["class"])) : createCommentVNode("v-if", true),
  63943. createElementVNode("div", {
  63944. class: normalizeClass(unref(ns).e("group"))
  63945. }, [
  63946. createElementVNode("h2", {
  63947. class: normalizeClass(unref(ns).e("title")),
  63948. textContent: toDisplayString(_ctx.title)
  63949. }, null, 10, ["textContent"]),
  63950. withDirectives(createElementVNode("div", {
  63951. class: normalizeClass(unref(ns).e("content")),
  63952. style: normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  63953. }, [
  63954. renderSlot(_ctx.$slots, "default", {}, () => [
  63955. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", { key: 0 }, toDisplayString(_ctx.message), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  63956. createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  63957. createElementVNode("p", { innerHTML: _ctx.message }, null, 8, ["innerHTML"])
  63958. ], 2112))
  63959. ])
  63960. ], 6), [
  63961. [vShow, _ctx.message]
  63962. ]),
  63963. _ctx.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  63964. key: 0,
  63965. class: normalizeClass(unref(ns).e("closeBtn")),
  63966. onClick: withModifiers(close, ["stop"])
  63967. }, {
  63968. default: withCtx(() => [
  63969. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon)))
  63970. ]),
  63971. _: 1
  63972. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  63973. ], 2)
  63974. ], 46, ["id", "onClick"]), [
  63975. [vShow, visible.value]
  63976. ])
  63977. ]),
  63978. _: 3
  63979. }, 8, ["name", "onBeforeLeave", "onAfterLeave"]);
  63980. };
  63981. }
  63982. });
  63983. var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]);
  63984. const notifications = {
  63985. "top-left": [],
  63986. "top-right": [],
  63987. "bottom-left": [],
  63988. "bottom-right": []
  63989. };
  63990. const GAP_SIZE = 16;
  63991. let seed = 1;
  63992. const notify = function(options = {}, context) {
  63993. if (!isClient)
  63994. return { close: () => void 0 };
  63995. if (isString$1(options) || isVNode(options)) {
  63996. options = { message: options };
  63997. }
  63998. const position = options.position || "top-right";
  63999. let verticalOffset = options.offset || 0;
  64000. notifications[position].forEach(({ vm: vm2 }) => {
  64001. var _a;
  64002. verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
  64003. });
  64004. verticalOffset += GAP_SIZE;
  64005. const id = `notification_${seed++}`;
  64006. const userOnClose = options.onClose;
  64007. const props = {
  64008. ...options,
  64009. offset: verticalOffset,
  64010. id,
  64011. onClose: () => {
  64012. close(id, position, userOnClose);
  64013. }
  64014. };
  64015. let appendTo = document.body;
  64016. if (isElement$2(options.appendTo)) {
  64017. appendTo = options.appendTo;
  64018. } else if (isString$1(options.appendTo)) {
  64019. appendTo = document.querySelector(options.appendTo);
  64020. }
  64021. if (!isElement$2(appendTo)) {
  64022. debugWarn("ElNotification", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  64023. appendTo = document.body;
  64024. }
  64025. const container = document.createElement("div");
  64026. const vm = createVNode(NotificationConstructor, props, isFunction$1(props.message) ? props.message : isVNode(props.message) ? () => props.message : null);
  64027. vm.appContext = isUndefined(context) ? notify._context : context;
  64028. vm.props.onDestroy = () => {
  64029. render(null, container);
  64030. };
  64031. render(vm, container);
  64032. notifications[position].push({ vm });
  64033. appendTo.appendChild(container.firstElementChild);
  64034. return {
  64035. close: () => {
  64036. vm.component.exposed.visible.value = false;
  64037. }
  64038. };
  64039. };
  64040. notificationTypes.forEach((type) => {
  64041. notify[type] = (options = {}, appContext) => {
  64042. if (isString$1(options) || isVNode(options)) {
  64043. options = {
  64044. message: options
  64045. };
  64046. }
  64047. return notify({ ...options, type }, appContext);
  64048. };
  64049. });
  64050. function close(id, position, userOnClose) {
  64051. const orientedNotifications = notifications[position];
  64052. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  64053. var _a;
  64054. return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
  64055. });
  64056. if (idx === -1)
  64057. return;
  64058. const { vm } = orientedNotifications[idx];
  64059. if (!vm)
  64060. return;
  64061. userOnClose == null ? void 0 : userOnClose(vm);
  64062. const removedHeight = vm.el.offsetHeight;
  64063. const verticalPos = position.split("-")[0];
  64064. orientedNotifications.splice(idx, 1);
  64065. const len = orientedNotifications.length;
  64066. if (len < 1)
  64067. return;
  64068. for (let i = idx; i < len; i++) {
  64069. const { el, component } = orientedNotifications[i].vm;
  64070. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  64071. component.props.offset = pos;
  64072. }
  64073. }
  64074. function closeAll() {
  64075. for (const orientedNotifications of Object.values(notifications)) {
  64076. orientedNotifications.forEach(({ vm }) => {
  64077. vm.component.exposed.visible.value = false;
  64078. });
  64079. }
  64080. }
  64081. function updateOffsets(position = "top-right") {
  64082. var _a, _b, _c, _d;
  64083. let verticalOffset = ((_c = (_b = (_a = notifications[position][0]) == null ? void 0 : _a.vm.component) == null ? void 0 : _b.props) == null ? void 0 : _c.offset) || 0;
  64084. for (const { vm } of notifications[position]) {
  64085. vm.component.props.offset = verticalOffset;
  64086. verticalOffset += (((_d = vm.el) == null ? void 0 : _d.offsetHeight) || 0) + GAP_SIZE;
  64087. }
  64088. }
  64089. notify.closeAll = closeAll;
  64090. notify.updateOffsets = updateOffsets;
  64091. notify._context = null;
  64092. var Notify = notify;
  64093. const ElNotification = withInstallFunction(Notify, "$notify");
  64094. var Plugins = [
  64095. ElInfiniteScroll,
  64096. ElLoading,
  64097. ElMessage,
  64098. ElMessageBox,
  64099. ElNotification,
  64100. ElPopoverDirective
  64101. ];
  64102. var installer = makeInstaller([...Components, ...Plugins]);
  64103. const install = installer.install;
  64104. const version = installer.version;
  64105. export { BAR_MAP, BORDER_HORIZONTAL_WIDTH, CAROUSEL_ITEM_NAME, CASCADER_PANEL_INJECTION_KEY, CHANGE_EVENT, ClickOutside, CommonPicker, CommonProps, DEFAULT_DIALOG_TRANSITION, DEFAULT_EMPTY_VALUES, DEFAULT_FORMATS_DATE, DEFAULT_FORMATS_DATEPICKER, DEFAULT_FORMATS_TIME, DEFAULT_VALUE_ON_CLEAR, DROPDOWN_INJECTION_KEY, DROPDOWN_INSTANCE_INJECTION_KEY, DefaultProps, DynamicSizeGrid$1 as DynamicSizeGrid, DynamicSizeList$1 as DynamicSizeList, EVENT_CODE, Effect, ElAffix, ElAlert, ElAnchor, ElAnchorLink, ElAside, ElAutoResizer, ElAutocomplete, ElAvatar, ElBacktop, ElBadge, ElBreadcrumb, ElBreadcrumbItem, ElButton, ElButtonGroup$1 as ElButtonGroup, ElCalendar, ElCard, ElCarousel, ElCarouselItem, ElCascader, ElCascaderPanel, ElCheckTag, ElCheckbox, ElCheckboxButton, ElCheckboxGroup$1 as 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$1 as ElLoadingDirective, Loading$1 as ElLoadingService, ElMain, ElMention, ElMenu, ElMenuItem, ElMenuItemGroup, ElMessage, ElMessageBox, ElNotification, ElOption, ElOptionGroup, ElOverlay, ElPageHeader, ElPagination, ElPopconfirm, ElPopover, ElPopoverDirective, ElPopper, ElPopperArrow, ElPopperContent, 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$1 as FixedSizeGrid, FixedSizeList$1 as 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$1 as ROOT_TREE_INJECTION_KEY, RowAlign, RowJustify, SCOPE$7 as SCOPE, SIZE_INJECTION_KEY, STEPS_INJECTION_KEY, SUB_MENU_INJECTION_KEY, TIMELINE_INJECTION_KEY, TOOLTIP_INJECTION_KEY, TREE_NODE_MAP_INJECTION_KEY, TableV2$1 as TableV2, Alignment as TableV2Alignment, FixedDir as TableV2FixedDir, placeholderSign as TableV2Placeholder, SortOrder as TableV2SortOrder, TimePickPanel, TrapFocus, UPDATE_MODEL_EVENT, WEEK_DAYS, ZINDEX_INJECTION_KEY, affixEmits, affixProps, alertEffects, alertEmits, alertProps, anchorEmits, anchorProps, ariaProps, arrowMiddleware, autoResizerProps, autocompleteEmits, autocompleteProps, avatarEmits, 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, colProps, collapseContextKey, collapseEmits, collapseItemProps, collapseProps, colorPickerEmits, colorPickerPanelContextKey, colorPickerPanelEmits, colorPickerPanelProps, colorPickerProps, columnAlignment, componentSizeMap, componentSizes, configProviderContextKey, configProviderProps, countdownEmits, countdownProps, createModelToggleComposable, dateEquals, datePickTypes, datePickerPanelProps, datePickerProps, dayOrDaysToDate, dayjs, installer as default, defaultInitialZIndex, defaultNamespace, defaultProps, descriptionItemProps, descriptionProps, dialogContextKey, dialogEmits, dialogInjectionKey, dialogProps, 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, 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, popperArrowProps, popperContentEmits, popperContentProps, popperCoreConfigProps, popperProps, popperTriggerProps, progressProps, provideGlobalConfig, radioButtonProps, radioDefaultProps, radioEmits, radioGroupEmits, radioGroupKey, radioGroupProps, radioProps, radioPropsBase, rangeArr, rateEmits, rateProps, renderThumbStyle$1 as renderThumbStyle, resultProps, roleTypes, rowContextKey, rowProps, scrollbarContextKey, scrollbarEmits, scrollbarProps, segmentedEmits, segmentedProps, selectEmits, selectGroupKey, selectKey, selectProps, selectV2InjectionKey, skeletonItemProps, skeletonProps, sliderContextKey, sliderEmits, sliderProps, spaceItemProps, spaceProps, 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$1 as timeUnits, timelineItemProps, tooltipEmits, tourContentEmits, tourContentProps, tourEmits, tourPlacements, tourProps, tourStepEmits, tourStepProps, tourStrategies, transferCheckedChangeFn, transferEmits, transferProps, translate, treeEmits$1 as treeEmits, uploadBaseProps, uploadContentProps, uploadContextKey, uploadDraggerEmits, uploadDraggerProps, uploadListEmits, uploadListProps, uploadListTypes, uploadProps, useAriaProps, useAttrs, useCalcInputWidth, useCascaderConfig, useComposition, useCursor, useDelayedRender, useDelayedToggle, useDelayedToggleProps, useDeprecated, useDialog, useDisabled, useDraggable, useEmptyValues, useEmptyValuesProps, useEscapeKeydown, useFloating$1 as 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$1 as useSize, useSizeProp, useSizeProps, useSpace, useTeleport, useThrottleRender, useTimeout, useTooltipContentProps, useTooltipModelToggle, useTooltipModelToggleEmits, useTooltipModelToggleProps, useTooltipProps, useTooltipTriggerProps, useTransitionFallthrough, useTransitionFallthroughEmits, useZIndex, vLoading$1 as vLoading, vRepeatClick, valueEquals, version, virtualizedGridProps, virtualizedListProps, virtualizedProps, virtualizedScrollbarProps, watermarkProps, zIndexContextKey };